Merge branch 'main' into main

This commit is contained in:
CreateSource 2025-01-15 19:54:23 -05:00 committed by GitHub
commit eb91e8162a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
234 changed files with 47605 additions and 9728 deletions

View file

@ -0,0 +1,24 @@
#ifndef ODEMUEXI_DEBUGGER_DRIVER_H
#define ODEMUEXI_DEBUGGER_DRIVER_H
#include <dolphin/os.h>
#ifdef __cplusplus
extern "C" {
#endif
int Hu_IsStub();
void DBInitComm(volatile u8** param_1, __OSInterruptHandler param_2);
void DBInitInterrupts(void);
u32 DBQueryData(void);
int DBRead(void* data, u32 size);
int DBWrite(const void* data, u32 size);
void DBOpen(void);
void DBClose(void);
#ifdef __cplusplus
}
#endif
#endif

View file

@ -0,0 +1,381 @@
#ifndef __METROTRK_TRK_H__
#define __METROTRK_TRK_H__
#include "dolphin/types.h"
#ifdef __cplusplus
extern "C" {
#endif
//////////// TRK ENUMS /////////////
// Hardware types.
typedef enum {
HARDWARE_AMC_DDH = 0,
HARDWARE_GDEV = 1,
HARDWARE_BBA = 2,
} HardwareType;
// DS Error returns.
enum {
DS_NoError = 0x0,
DS_StepError = 0x1,
DS_ParameterError = 0x2,
DS_EventQueueFull = 0x100,
DS_NoMessageBufferAvailable = 0x300,
DS_MessageBufferOverflow = 0x301,
DS_MessageBufferReadError = 0x302,
DS_DispatchError = 0x500,
DS_InvalidMemory = 0x700,
DS_InvalidRegister = 0x701,
DS_CWDSException = 0x702,
DS_UnsupportedError = 0x703,
DS_InvalidProcessID = 0x704,
DS_InvalidThreadID = 0x705,
DS_OSError = 0x706,
DS_Error800 = 0x800,
};
typedef int DSError;
// Where to read/write.
typedef enum {
DS_Stdin = 0,
DS_Stdout = 1,
DS_Stderr = 2,
} DSFileHandle;
// IO returns.
typedef enum {
DS_IONoError = 0,
DS_IOError = 1,
DS_IOEOF = 2,
} DSIOResult;
// Message command IDs
typedef enum {
DSMSG_Ping = 0x0,
DSMSG_Connect = 0x1,
DSMSG_Disconnect = 0x2,
DSMSG_Reset = 0x3,
DSMSG_Versions = 0x4,
DSMSG_SupportMask = 0x5,
DSMSG_Override = 0x7,
DSMSG_ReadMemory = 0x10,
DSMSG_WriteMemory = 0x11,
DSMSG_ReadRegisters = 0x12,
DSMSG_WriteRegisters = 0x13,
DSMSG_SetOption = 0x17,
DSMSG_Continue = 0x18,
DSMSG_Step = 0x19,
DSMSG_Stop = 0x1A,
DSMSG_ReplyACK = 0x80,
DSMSG_NotifyStopped = 0x90,
DSMSG_NotifyException = 0x91,
DSMSG_WriteFile = 0xD0,
DSMSG_ReadFile = 0xD1,
DSMSG_OpenFile = 0xD2,
DSMSG_CloseFile = 0xD3,
DSMSG_PositionFile = 0xD4,
DSMSG_ReplyNAK = 0xFF,
} MessageCommandID;
// Register commands.
typedef enum {
DSREG_Default = 0,
DSREG_FP = 1,
DSREG_Extended1 = 2,
DSREG_Extended2 = 3,
} DSMessageRegisterOptions;
// Step commands.
typedef enum {
DSSTEP_IntoCount = 0x0,
DSSTEP_IntoRange = 0x1,
DSSTEP_OverCount = 0x10,
DSSTEP_OverRange = 0x11,
} DSMessageStepOptions;
typedef enum {
DSREPLY_NoError = 0x0,
DSREPLY_Error = 0x1,
DSREPLY_PacketSizeError = 0x2,
DSREPLY_CWDSError = 0x3,
DSREPLY_EscapeError = 0x4,
DSREPLY_BadFCS = 0x5,
DSREPLY_Overflow = 0x6,
DSREPLY_SequenceMissing = 0x7,
DSREPLY_UnsupportedCommandError = 0x10,
DSREPLY_ParameterError = 0x11,
DSREPLY_UnsupportedOptionError = 0x12,
DSREPLY_InvalidMemoryRange = 0x13,
DSREPLY_InvalidRegisterRange = 0x14,
DSREPLY_CWDSException = 0x15,
DSREPLY_NotStopped = 0x16,
DSREPLY_BreakpointsFull = 0x17,
DSREPLY_BreakpointConflict = 0x18,
DSREPLY_OSError = 0x20,
DSREPLY_InvalidProcessID = 0x21,
DSREPLY_InvalidThreadID = 0x22,
DSREPLY_DebugSecurityError = 0x23,
} DSReplyError;
typedef enum {
DSRECV_Wait = 0,
DSRECV_Found = 1,
DSRECV_InFrame = 2,
DSRECV_FrameOverflow = 3,
} ReceiverState;
typedef enum {
DSMSGMEMORY_Segmented = 0x01, /* non-flat addr space */
DSMSGMEMORY_Extended = 0x02, /* > 32-bit data addr */
DSMSGMEMORY_Protected = 0x04, /* non-user memory */
DSMSGMEMORY_Userview = 0x08, /* breakpoints are invisible */
DSMSGMEMORY_Space_program = 0x00,
DSMSGMEMORY_Space_data = 0x40,
DSMSGMEMORY_Space_io = 0x80
};
typedef enum {
NUBEVENT_Null = 0,
NUBEVENT_Shutdown = 1,
NUBEVENT_Request = 2,
NUBEVENT_Breakpoint = 3,
NUBEVENT_Exception = 4,
NUBEVENT_Support = 5,
} NubEventType;
typedef enum {
VALIDMEM_Readable = 0,
VALIDMEM_Writeable = 1,
} ValidMemoryOptions;
typedef enum {
MEMACCESS_UserMemory = 0,
MEMACCESS_DebuggerMemory = 1,
} MemoryAccessOptions;
typedef int UARTError;
typedef enum {
UART_NoError = 0,
UART_UnknownBaudRate = 1,
UART_ConfigurationError = 2,
UART_BufferOverflow = 3, // specified buffer was too small
UART_NoData = 4, // no data available from polling
} UARTErrorOptions;
typedef enum {
kBaudHWSet = -1, // use HW settings such as DIP switches
kBaud300 = 300, // valid baud rates
kBaud600 = 600,
kBaud1200 = 1200,
kBaud1800 = 1800,
kBaud2000 = 2000,
kBaud2400 = 2400,
kBaud3600 = 3600,
kBaud4800 = 4800,
kBaud7200 = 7200,
kBaud9600 = 9600,
kBaud19200 = 19200,
kBaud38400 = 38400,
kBaud57600 = 57600,
kBaud115200 = 115200,
kBaud230400 = 230400
} UARTBaudRate;
////////////////////////////////////
typedef int MessageBufferID;
#define TRKMSGBUF_SIZE (0x800 + 0x80)
typedef struct TRKBuffer {
/* 0x00 */ u32 mutex;
/* 0x04 */ BOOL isInUse;
/* 0x08 */ u32 length;
/* 0x0C */ u32 position;
/* 0x10 */ u8 data[TRKMSGBUF_SIZE];
} TRKBuffer;
typedef struct TRKFramingState {
MessageBufferID msgBufID; // _00
TRKBuffer* buffer; // _04
ReceiverState receiveState; // _08
BOOL isEscape; // _0C
u8 fcsType; // _10
} TRKFramingState;
typedef struct TRKState_PPC {
u32 GPR[32]; // 0x0
u32 LR; // 0x80
u32 CTR; // 0x84
u32 XER; // 0x88
u32 MSR; // 0x8c
u32 DAR; // 0x90
u32 DSISR; // 0x94
BOOL stopped; // 0x98
BOOL inputActivated; // 0x9c
u8* inputPendingPtr; // 0xA0
} TRKState_PPC;
typedef struct CommandReply {
u32 _00; // _00
union {
u8 b;
MessageCommandID m;
} commandID; // _04, use MessageCommandID enum
union {
u8 b;
DSReplyError r;
} replyError; // _08, use DSReplyError enum - should be enum type? check
// size.
u32 _0C; // _0C
u8 _10[0x30]; // _10, unknown
} CommandReply;
typedef struct ProcessorRestoreFlags_PPC {
u8 TBR;
u8 DEC;
u8 linker_padding[0x9 - 0x2];
} ProcessorRestoreFlags_PPC;
void TRKSaveExtended1Block();
#define SPR_XER 1
#define SPR_LR 8
#define SPR_CTR 9
#define SPR_DSISR 18
#define SPR_DAR 19
#define SPR_DEC 22
#define SPR_SDR1 25
#define SPR_SRR0 26
#define SPR_SRR1 27
#define SPR_SPRG0 272
#define SPR_SPRG1 273
#define SPR_SPRG2 274
#define SPR_SPRG3 275
#define SPR_EAR 282
#define SPR_TBL 284
#define SPR_TBU 285
#define SPR_PVR 287
#define SPR_IBAT0U 528
#define SPR_IBAT0L 529
#define SPR_IBAT1U 530
#define SPR_IBAT1L 531
#define SPR_IBAT2U 532
#define SPR_IBAT2L 533
#define SPR_IBAT3U 534
#define SPR_IBAT3L 535
#define SPR_IBAT4U 560
#define SPR_IBAT4L 561
#define SPR_IBAT5U 562
#define SPR_IBAT5L 563
#define SPR_IBAT6U 564
#define SPR_IBAT6L 565
#define SPR_IBAT7U 566
#define SPR_IBAT7L 567
#define SPR_DBAT0U 536
#define SPR_DBAT0L 537
#define SPR_DBAT1U 538
#define SPR_DBAT1L 539
#define SPR_DBAT2U 540
#define SPR_DBAT2L 541
#define SPR_DBAT3U 542
#define SPR_DBAT3L 543
#define SPR_DBAT4U 568
#define SPR_DBAT4L 569
#define SPR_DBAT5U 570
#define SPR_DBAT5L 571
#define SPR_DBAT6U 572
#define SPR_DBAT6L 573
#define SPR_DBAT7U 574
#define SPR_DBAT7L 575
#define SPR_GQR0 912
#define SPR_GQR1 913
#define SPR_GQR2 914
#define SPR_GQR3 915
#define SPR_GQR4 916
#define SPR_GQR5 917
#define SPR_GQR6 918
#define SPR_GQR7 919
#define SPR_HID2 920
#define SPR_WPAR 921
#define SPR_DMA_U 922
#define SPR_DMA_L 923
#define SPR_UMMCR0 936
#define SPR_UPMC1 937
#define SPR_UPMC2 938
#define SPR_USIA 939
#define SPR_UMMCR1 940
#define SPR_UPMC3 941
#define SPR_UPMC4 942
#define SPR_USDA 943
#define SPR_MMCR0 952
#define SPR_PMC1 953
#define SPR_PMC2 954
#define SPR_SIA 955
#define SPR_MMCR1 956
#define SPR_PMC3 957
#define SPR_PMC4 958
#define SPR_SDA 959
#define SPR_HID0 1008
#define SPR_HID1 1009
#define SPR_IABR 1010
#define SPR_HID4 1011
#define SPR_DABR 1013
#define SPR_L2CR 1017
#define SPR_ICTC 1019
#define SPR_THRM1 1020
#define SPR_THRM2 1021
#define SPR_FPECR 1022
// PPC exceptions
// 0x000 is reserved
#define PPC_SystemReset 0x100
#define PPC_MachineCheck 0x200
#define PPC_DataStorage 0x300
#define PPC_InstructionStorage 0x400
#define PPC_ExternalInterrupt 0x500
#define PPC_Alignment 0x600
#define PPC_Program 0x700
#define PPC_FloatingPointUnavaiable 0x800
#define PPC_Decrementer 0x900
// 0xA00-0xB00 are reserved
#define PPC_SystemCall 0xC00
#define PPC_Trace 0xD00
#define PPC_FloatingPointAssist 0xE00 // unimplemented in 750CL
#define PPC_PerformanceMonitor 0xF00 // Dolphin/Broadway specific
// 0x1000-0x1200 are unimplemented in 750CL
#define PPC_InstructionAddressBreakpoint 0x1300 // Dolphin/Broadway specific
// 0x1400-0x2F00 are reserved, but TRK uses some
#define PPC_SystemManagementInterrupt 0x1400
// 0x1500-0x1600 are unimplemented in 750CL
#define PPC_ThermalManagementInterrupt 0x1700
#define PPC_1800Exception 0x1800
#define PPC_1900Exception 0x1900
#define PPC_1A00Exception 0x1A00
#define PPC_1B00Exception 0x1B00
#define PPC_1C00Exception 0x1C00 // Data breakpoint?
#define PPC_1D00Exception 0x1D00 // Instruction breakpoint?
#define PPC_1E00Exception 0x1E00 // Peripheral breakpoint?
#define PPC_1F00Exception 0x1F00 // Non maskable development port?
#define PPC_2000Exception 0x2000
#ifdef __cplusplus
}
#endif
#endif /* __METROTRK_TRK_H__ */

View file

@ -0,0 +1,18 @@
#ifndef _MSL_COMMON_FILE_POS_H
#define _MSL_COMMON_FILE_POS_H
#include "PowerPC_EABI_Support/Msl/MSL_C/MSL_Common/ansi_files.h"
#ifdef __cplusplus
extern "C" {
#endif
int fseek(FILE* file, unsigned long offset, int mode);
int _fseek(FILE* file, fpos_t offset, int mode);
long ftell(FILE* file);
#ifdef __cplusplus
}
#endif
#endif /* _MSL_COMMON_FILE_POS_H */

View file

@ -0,0 +1,17 @@
#ifndef _MSL_COMMON_ABORT_EXIT_H
#define _MSL_COMMON_ABORT_EXIT_H
#ifdef __cplusplus
extern "C" {
#endif
void exit(int status);
void abort(void);
extern void (*__stdio_exit)(void);
#ifdef __cplusplus
};
#endif
#endif /* _MSL_COMMON_ABORT_EXIT_H */

View file

@ -0,0 +1,16 @@
#ifndef _MSL_COMMON_ALLOC_H
#define _MSL_COMMON_ALLOC_H
#include "PowerPC_EABI_Support/Msl/MSL_C/MSL_Common/ansi_files.h"
#ifdef __cplusplus
extern "C" {
#endif
void free(void* ptr);
#ifdef __cplusplus
}
#endif
#endif /* _MSL_COMMON_ALLOC_H */

View file

@ -0,0 +1,133 @@
#ifndef _MSL_COMMON_ANSI_FILES_H
#define _MSL_COMMON_ANSI_FILES_H
#include "stddef.h"
#ifdef __cplusplus
extern "C" {
#endif
#define SEEK_SET 0
#define SEEK_CUR 1
#define SEEK_END 2
typedef unsigned long __file_handle;
typedef unsigned long fpos_t;
#ifndef __cplusplus
typedef unsigned short wchar_t;
#endif
#define set_error(file) \
do { \
(file)->file_state.error = 1; \
(file)->buffer_length = 0; \
} while (0)
enum __file_kinds {
__closed_file,
__disk_file,
__console_file,
__string_file,
__unavailable_file,
};
enum __file_orientation {
/* 0x0 */ UNORIENTED,
/* 0x1 */ CHAR_ORIENTED,
/* 0x2 */ WIDE_ORIENTED,
};
typedef struct _file_modes {
unsigned int open_mode : 2;
unsigned int io_mode : 3;
unsigned int buffer_mode : 2;
unsigned int file_kind : 3;
unsigned int file_orientation : 2;
unsigned int binary_io : 1;
} file_modes;
enum __io_modes {
__read = 1,
__write = 2,
__read_write = 3,
__append = 4,
};
enum __io_states {
__neutral,
__writing,
__reading,
__rereading,
};
enum __io_results {
__no_io_error,
__io_error,
__io_EOF,
};
typedef struct _file_states {
unsigned int io_state : 3;
unsigned int free_buffer : 1;
unsigned char eof;
unsigned char error;
} file_states;
typedef void (*__idle_proc)(void);
typedef int (*__pos_proc)(__file_handle file, fpos_t* position, int mode,
__idle_proc idle_proc);
typedef int (*__io_proc)(__file_handle file, unsigned char* buff, size_t* count,
__idle_proc idle_proc);
typedef int (*__close_proc)(__file_handle file);
typedef struct _FILE {
__file_handle handle;
file_modes file_mode;
file_states file_state;
char char_buffer;
char char_buffer_overflow;
char ungetc_buffer[2];
wchar_t ungetc_wide_buffer[2];
unsigned long position;
unsigned char* buffer;
unsigned long buffer_size;
unsigned char* buffer_ptr;
unsigned long buffer_length;
unsigned long buffer_alignment;
unsigned long save_buffer_length;
unsigned long buffer_position;
__pos_proc position_fn;
__io_proc read_fn;
__io_proc write_fn;
__close_proc close_fn;
__idle_proc idle_fn;
} FILE;
typedef struct _files {
FILE _stdin;
FILE _stdout;
FILE _stderr;
} files;
#define _IONBF 0
#define _IOLBF 1
#define _IOFBF 2
extern files __files;
extern int __close_console(__file_handle file);
extern int __write_console(__file_handle file, unsigned char* buf,
size_t* count, __idle_proc idle_fn);
extern int __read_console(__file_handle file, unsigned char* buf, size_t* count,
__idle_proc idle_fn);
unsigned int __flush_all(void);
void __close_all(void);
#ifdef __cplusplus
};
#endif
#endif /* _MSL_COMMON_ANSI_FILES_H */

View file

@ -0,0 +1,36 @@
#ifndef _MSL_COMMON_ANSI_FP_H
#define _MSL_COMMON_ANSI_FP_H
#include "PowerPC_EABI_Support/Msl/MSL_C/MSL_Common/float.h"
#define SIGDIGLEN 36
typedef struct decimal {
char sign;
char unk1;
short exp;
struct {
unsigned char length;
unsigned char text[36];
unsigned char unk41;
} sig;
} decimal;
typedef struct decform {
char style;
char unk1;
short digits;
} decform;
/* void __ull2dec(decimal*, u64);
void __timesdec(decimal*, const decimal*, const decimal*);
void __str2dec(decimal*, const char*, short);
void __two_exp(decimal*, s16);
BOOL __equals_dec(const decimal*, const decimal*);
BOOL __less_dec(const decimal*, const decimal*);
void __minus_dec(decimal*, const decimal*, const decimal*);
void __num2dec_internal(decimal*, f64);
void __num2dec(const decform*, f64, decimal*);
f64 __dec2num(const decimal*); */
#endif

View file

@ -0,0 +1,19 @@
#ifndef _MSL_COMMON_ARITH_H
#define _MSL_COMMON_ARITH_H
#ifdef __cplusplus
extern "C" {
#endif
typedef struct {
int quot; /* quotient */
int rem; /* remainder */
} div_t;
div_t div(int numerator, int denominator);
#ifdef __cplusplus
}
#endif
#endif /* _MSL_COMMON_ARITH_H */

View file

@ -0,0 +1,11 @@
#ifndef _MSL_COMMON_BUFFER_IO_H
#define _MSL_COMMON_BUFFER_IO_H
#include "PowerPC_EABI_Support/Msl/MSL_C/MSL_Common/ansi_files.h"
enum { __align_buffer, __dont_align_buffer };
void __prep_buffer(FILE* file);
int __flush_buffer(FILE* file, size_t* bytes_flushed);
#endif /* _MSL_COMMON_BUFFER_IO_H */

View file

@ -0,0 +1,17 @@
#ifndef _MSL_COMMON_CHAR_IO_H
#define _MSL_COMMON_CHAR_IO_H
#include "PowerPC_EABI_Support/Msl/MSL_C/MSL_Common/ansi_files.h"
#ifdef __cplusplus
extern "C" {
#endif
int fputs(const char* str, FILE* stream);
int __put_char(int c, FILE* stream);
#ifdef __cplusplus
}
#endif
#endif /* _MSL_COMMON_CHAR_IO_H */

View file

@ -0,0 +1,30 @@
#ifndef _MSL_COMMON_CRITICAL_REGIONS_H
#define _MSL_COMMON_CRITICAL_REGIONS_H
#ifdef __cplusplus
extern "C" {
#endif
enum critical_regions {
atexit_funcs_access,
malloc_pool_access,
stdin_access,
stdout_access,
stderr_access,
files_access,
console_status_access,
signal_funcs_access,
thread_access,
num_critical_regions
};
void __init_critical_regions(void);
void __kill_critical_regions(void);
void __begin_critical_region(int region);
void __end_critical_region(int region);
#ifdef __cplusplus
}
#endif
#endif

View file

@ -0,0 +1,76 @@
#ifndef _MSL_COMMON_CTYPE_H
#define _MSL_COMMON_CTYPE_H
#ifdef __cplusplus
extern "C" {
#endif
#define EOF -1L
extern const unsigned char __ctype_map[];
extern const unsigned char __lower_map[];
extern const unsigned char __upper_map[];
#define __control_char 0x01
#define __motion_char 0x02
#define __space_char 0x04
#define __punctuation 0x08
#define __digit 0x10
#define __hex_digit 0x20
#define __lower_case 0x40
#define __upper_case 0x80
#define __letter (__lower_case | __upper_case)
#define __alphanumeric (__letter | __digit)
#define __graphic (__alphanumeric | __punctuation)
#define __printable (__graphic | __space_char)
#define __whitespace (__motion_char | __space_char)
#define __control (__motion_char | __control_char)
#define __zero_fill(c) ((int)(unsigned char)(c))
int tolower(int c);
int toupper(int c);
inline int isalpha(int c)
{
return (int)(__ctype_map[(unsigned char)c] & __letter);
}
inline int isdigit(int c)
{
return (int)(__ctype_map[(unsigned char)c] & __digit);
}
inline int isspace(int c)
{
return (int)(__ctype_map[(unsigned char)c] & __whitespace);
}
inline int isupper(int c)
{
return (int)(__ctype_map[(unsigned char)c] & __upper_case);
}
inline int isxdigit(int c)
{
return (int)(__ctype_map[(unsigned char)c] & __hex_digit);
}
inline int _tolower(int c)
{
return (c == -1 ? -1 : (int)__lower_map[(unsigned char)c]);
}
#ifdef __cplusplus
};
namespace std {
inline int tolower(int c)
{
return (c == -1 ? -1 : (int)__lower_map[(unsigned char)c]);
}
inline int toupper(int c)
{
return (c == -1 ? -1 : (int)__upper_map[(unsigned char)c]);
}
}; // namespace std
#endif
#endif /* _MSL_COMMON_CTYPE_H */

View file

@ -0,0 +1,17 @@
#ifndef _MSL_COMMON_DIRECT_IO_H
#define _MSL_COMMON_DIRECT_IO_H
#include "PowerPC_EABI_Support/Msl/MSL_C/MSL_Common/ansi_files.h"
#ifdef __cplusplus
extern "C" {
#endif
size_t __fwrite(const void* buffer, size_t size, size_t count, FILE* stream);
size_t fwrite(const void* buffer, size_t size, size_t count, FILE* stream);
#ifdef __cplusplus
}
#endif
#endif /* _MSL_COMMON_DIRECT_IO_H */

View file

@ -0,0 +1,20 @@
#ifndef MSL_COMMON_SRC_ERRNO_H
#define MSL_COMMON_SRC_ERRNO_H
#ifdef __cplusplus
extern "C" {
#endif
#define ENOERR 0
#define EDOM 33
#define ERANGE 34
#define EFPOS 40
#define ESIGPARM 36
extern int errno;
#ifdef __cplusplus
}
#endif
#endif /* MSL_COMMON_SRC_ERRNO_H */

View file

@ -0,0 +1,15 @@
#ifndef _MSL_COMMON_EXTRAS_H
#define _MSL_COMMON_EXTRAS_H
#ifdef __cplusplus
extern "C" {
#endif
int strnicmp(const char* str1, const char* str2, int n);
int stricmp(const char* str1, const char* str2);
#ifdef __cplusplus
}
#endif
#endif /* _MSL_COMMON_EXTRAS_H */

View file

@ -0,0 +1,18 @@
#ifndef _MSL_COMMON_FILE_IO_H
#define _MSL_COMMON_FILE_IO_H
#include "PowerPC_EABI_Support/Msl/MSL_C/MSL_Common/ansi_files.h"
#ifdef __cplusplus
extern "C" {
#endif
int __msl_strnicmp(const char* str1, const char* str2, int n);
int fflush(FILE* file);
int fclose(FILE* file);
#ifdef __cplusplus
}
#endif
#endif /* _MSL_COMMON_FILE_IO_H */

View file

@ -0,0 +1,92 @@
#ifndef _MSL_COMMON_FLOAT_H
#define _MSL_COMMON_FLOAT_H
#include "PowerPC_EABI_Support/Msl/MSL_C/MSL_Common_Embedded/Math/fdlibm.h"
#define FP_SNAN 0
#define FP_QNAN 1
#define FP_INFINITE 2
#define FP_ZERO 3
#define FP_NORMAL 4
#define FP_SUBNORMAL 5
#define FP_NAN FP_QNAN
#define fpclassify(x) \
((sizeof(x) == sizeof(float)) ? __fpclassifyf(x) : __fpclassifyd(x))
#define signbit(x) \
((sizeof(x) == sizeof(float)) ? __signbitf(x) : __signbitd(x))
#define isfinite(x) ((fpclassify(x) > 2))
#define isnan(x) ((fpclassify(x) == FP_NAN))
#define isinf(x) ((fpclassify(x) == FP_INFINITE))
#define __signbitf(x) ((int)(__HI(x) & 0x80000000))
// TODO: OK?
#define __signbitd(x) ((int)(__HI(x) & 0x80000000))
extern unsigned long __float_nan[];
extern unsigned long __float_huge[];
extern unsigned long __float_max[];
extern unsigned long __float_epsilon[];
inline int __fpclassifyf(float __value)
{
unsigned long integer = *(unsigned long*)&__value;
switch (integer & 0x7f800000) {
case 0x7f800000:
if ((integer & 0x7fffff) != 0) {
return FP_QNAN;
}
return FP_INFINITE;
case 0:
if ((integer & 0x7fffff) != 0) {
return FP_SUBNORMAL;
}
return FP_ZERO;
}
return FP_NORMAL;
}
inline int __fpclassifyd(double __value)
{
switch (__HI(__value) & 0x7ff00000) {
case 0x7ff00000: {
if ((__HI(__value) & 0x000fffff) || (__LO(__value) & 0xffffffff))
return FP_QNAN;
else
return FP_INFINITE;
break;
}
case 0: {
if ((__HI(__value) & 0x000fffff) || (__LO(__value) & 0xffffffff))
return FP_SUBNORMAL;
else
return FP_ZERO;
break;
}
}
return FP_NORMAL;
}
#define FLT_MANT_DIG 24
#define FLT_DIG 6
#define FLT_MIN_EXP (-125)
#define FLT_MIN_10_EXP (-37)
#define FLT_MAX_EXP 128
#define FLT_MAX_10_EXP 38
#define FLT_MAX 3.40282346638528860e+38f
#define FLT_EPSILON 1.1920928955078125e-07f
#define DBL_MANT_DIG 53
#define DBL_DIG 15
#define DBL_MIN_EXP (-1021)
#define DBL_MIN_10_EXP (-308)
#define DBL_MAX_EXP 1024
#define DBL_MAX_10_EXP 308
#endif /* _MSL_COMMON_FLOAT_H */

View file

@ -0,0 +1,93 @@
#ifndef _STD_LIMITS_H
#define _STD_LIMITS_H
#ifdef __cplusplus
extern "C" {
#endif
#define CHAR_BIT 8
#define SCHAR_MIN (-0x7F - 1)
#define SCHAR_MAX 0x7F
#define UCHAR_MAX 0xFF
#define CHAR_MIN 0
#define CHAR_MAX SCHAR_MAX
#define SHRT_MIN (-0x7FFF - 1)
#define SHRT_MAX 0x7FFF
#define USHRT_MAX 0xFFFF
#define INT_MIN (-0x7FFFFFFF - 1)
#define INT_MAX 0x7FFFFFFF
#define UINT_MAX 0xFFFFFFFF
#define LONG_MIN (-0x7FFFFFFFL - 1)
#define LONG_MAX 0x7FFFFFFFL
#define ULONG_MAX 0xFFFFFFFFUL
#define LLONG_MIN (-0x7FFFFFFFFFFFFFFFLL - 1)
#define LLONG_MAX 0x7FFFFFFFFFFFFFFFLL
#define ULLONG_MAX 0xFFFFFFFFFFFFFFFFULL
#ifdef __cplusplus
}
namespace std {
template <typename T> class numeric_limits {
public:
inline static T min();
inline static T max();
};
template <> class numeric_limits<char> {
public:
inline static char min() { return -0x80; }
inline static char max() { return 0x7F; }
};
template <> class numeric_limits<short> {
public:
inline static short min() { return -0x8000; }
inline static short max() { return 0x7FFF; }
};
template <> class numeric_limits<int> {
public:
inline static int min() { return -0x80000000; }
inline static int max() { return 0x7FFFFFFF; }
};
template <> class numeric_limits<long> {
public:
inline static long min() { return -0x80000000; }
inline static long max() { return 0x7FFFFFFF; }
};
template <> class numeric_limits<unsigned char> {
public:
inline static unsigned char min() { return 0x0; }
inline static unsigned char max() { return 0xFF; }
};
template <> class numeric_limits<unsigned short> {
public:
inline static unsigned short min() { return 0x0; }
inline static unsigned short max() { return 0xFFFF; }
};
template <> class numeric_limits<unsigned int> {
public:
inline static unsigned int min() { return 0x0; }
inline static unsigned int max() { return 0xFFFFFFFF; }
};
template <> class numeric_limits<unsigned long> {
public:
inline static unsigned long min() { return 0x0; }
inline static unsigned long max() { return 0xFFFFFFFF; }
};
} // namespace std
#endif
#endif

View file

@ -0,0 +1,106 @@
#ifndef MSL_MATH_H_
#define MSL_MATH_H_
#include "PowerPC_EABI_Support/Msl/MSL_C/MSL_Common/float.h"
#define NAN (*(float*)__float_nan)
#define HUGE_VALF (*(float*)__float_huge)
#define M_PI 3.14159265358979323846f
#define M_SQRT3 1.73205f
#define DEG_TO_RAD(degrees) (degrees * (M_PI / 180.0f))
#define RAD_TO_DEG(radians) \
(radians \
* (180.0f / M_PI + 0.000005f)) // the 0.000005f is probably a fakematch
#ifdef __cplusplus
extern "C" {
#endif
int abs(int);
double acos(double);
float acosf(float);
double asin(double);
double atan(double);
double atan2(double, double);
double ceil(double);
double copysign(double, double);
double cos(double);
float cosf(float);
double exp(double);
extern double __fabs(double);
extern float __fabsf(float);
inline double fabs(double f) { return __fabs(f); }
double __frsqrte(double);
float __fres(float);
double floor(double);
double fmod(double, double);
double frexp(double, int*);
double ldexp(double, int);
double modf(double, double*);
double pow(double, double);
double sin(double);
float sinf(float);
double tan(double);
float tanf(float);
extern inline double sqrt(double x)
{
if (x > 0.0) {
double guess = __frsqrte(x); /* returns an approximation to */
guess
= .5 * guess * (3.0 - guess * guess * x); /* now have 8 sig bits */
guess
= .5 * guess * (3.0 - guess * guess * x); /* now have 16 sig bits */
guess
= .5 * guess * (3.0 - guess * guess * x); /* now have 32 sig bits */
guess = .5 * guess
* (3.0 - guess * guess * x); /* now have > 53 sig bits */
return x * guess;
} else if (x == 0)
return 0;
else if (x)
return NAN;
return HUGE_VALF;
}
#ifdef __cplusplus
};
namespace std {
inline float fabsf(float f) { return fabs(f); }
inline float abs(float f) { return fabsf(f); }
inline float fmodf(float x, float y) { return fmod(x, y); }
inline float atan2f(float y, float x) { return (float)atan2(y, x); }
inline float sinf(float x) { return sin(x); }
inline float cosf(float x) { return cos(x); }
inline float tanf(float x) { return tan(x); }
extern inline float sqrtf(float x)
{
const double _half = .5;
const double _three = 3.0;
volatile float y;
if (x > 0.0f) {
double guess = __frsqrte((double)x); // returns an approximation to
guess = _half * guess
* (_three - guess * guess * x); // now have 12 sig bits
guess = _half * guess
* (_three - guess * guess * x); // now have 24 sig bits
guess = _half * guess
* (_three - guess * guess * x); // now have 32 sig bits
y = (float)(x * guess);
return y;
}
return x;
}
}; // namespace std
#endif
#endif

View file

@ -0,0 +1,16 @@
#ifndef _MSL_COMMON_MBSTRING_H
#define _MSL_COMMON_MBSTRING_H
#include "PowerPC_EABI_Support/Msl/MSL_C/MSL_Common/wchar_io.h"
#ifdef __cplusplus
extern "C" {
#endif
size_t wcstombs(char* dst, const wchar_t* src, size_t n);
#ifdef __cplusplus
}
#endif
#endif /* _MSL_COMMON_MBSTRING_H */

View file

@ -0,0 +1,19 @@
#ifndef _MSL_COMMON_MEM_FUNCS_H
#define _MSL_COMMON_MEM_FUNCS_H
#include "stddef.h"
#ifdef __cplusplus
extern "C" {
#endif
void __copy_longs_rev_unaligned(void* dst, const void* src, size_t n);
void __copy_longs_unaligned(void* dst, const void* src, size_t n);
void __copy_longs_rev_aligned(void* dst, const void* src, size_t n);
void __copy_longs_aligned(void* dst, const void* src, size_t n);
#ifdef __cplusplus
}
#endif
#endif /* _MSL_COMMON_MEM_FUNCS_H */

View file

@ -0,0 +1,14 @@
#ifndef _MSL_COMMON_MISC_IO_H
#define _MSL_COMMON_MISC_IO_H
#ifdef __cplusplus
extern "C" {
#endif
void __stdio_atexit(void);
#ifdef __cplusplus
}
#endif
#endif /* _MSL_COMMON_MISC_IO_H */

View file

@ -0,0 +1,22 @@
#ifndef _MSL_COMMON_PRINTF_H
#define _MSL_COMMON_PRINTF_H
#include "PowerPC_EABI_Support/Msl/MSL_C/MSL_Common/ansi_files.h"
#include "stdarg.h"
#ifdef __cplusplus
extern "C" {
#endif
int fprintf(FILE* stream, const char* format, ...);
int printf(const char* format, ...);
int sprintf(char* s, const char* format, ...);
int snprintf(char* s, size_t n, const char* format, ...);
int vsnprintf(char* s, size_t n, const char* format, va_list arg);
int vprintf(const char* format, va_list arg);
#ifdef __cplusplus
}
#endif
#endif /* _MSL_COMMON_PRINTF_H */

View file

@ -0,0 +1,43 @@
#ifndef _MSL_COMMON_SCANF_H
#define _MSL_COMMON_SCANF_H
#include "stddef.h"
#include "PowerPC_EABI_Support/Msl/MSL_C/MSL_Common/ansi_files.h"
#ifdef __cplusplus
extern "C" {
#endif
enum __ReadProcActions { __GetAChar, __UngetAChar, __TestForError };
enum __WReadProcActions { __GetAwChar, __UngetAwChar, __TestForwcsError };
typedef struct {
char* CharStr;
size_t MaxCharCount;
size_t CharsWritten;
} __OutStrCtrl;
typedef struct {
char* NextChar;
int NullCharDetected;
} __InStrCtrl;
typedef struct {
wchar_t* wCharStr;
size_t MaxCharCount;
size_t CharsWritten;
} __wOutStrCtrl;
typedef struct {
wchar_t* wNextChar;
int wNullCharDetected;
} __wInStrCtrl;
int __StringRead(void* str, int ch, int behavior);
#ifdef __cplusplus
}
#endif
#endif /* _MSL_COMMON_SCANF_H */

View file

@ -0,0 +1,16 @@
#ifndef _MSL_COMMON_SIGNAL_H
#define _MSL_COMMON_SIGNAL_H
#ifdef __cplusplus
extern "C" {
#endif
typedef void (*__signal_func_ptr)(int);
int raise(int sig);
#ifdef __cplusplus
}
#endif
#endif /* _MSL_COMMON_SIGNAL_H */

View file

@ -0,0 +1,13 @@
#ifndef MSL_STDIO_H_
#define MSL_STDIO_H_
#include "PowerPC_EABI_Support/Msl/MSL_C/MSL_Common/char_io.h" // IWYU pragma: export
#include "PowerPC_EABI_Support/Msl/MSL_C/MSL_Common/file_io.h" // IWYU pragma: export
#include "PowerPC_EABI_Support/Msl/MSL_C/MSL_Common/printf.h" // IWYU pragma: export
#include "PowerPC_EABI_Support/Msl/MSL_C/MSL_Common/extras.h" // IWYU pragma: export
#define stdin (&__files._stdin)
#define stdout (&__files._stdout)
#define stderr (&__files._stderr)
#endif

View file

@ -0,0 +1,9 @@
#ifndef MSL_STDLIB_H_
#define MSL_STDLIB_H_
#include "PowerPC_EABI_Support/Msl/MSL_C/MSL_Common/abort_exit.h"
#include "PowerPC_EABI_Support/Msl/MSL_C/MSL_Common/arith.h"
#include "PowerPC_EABI_Support/Msl/MSL_C/MSL_Common/mbstring.h"
#include "PowerPC_EABI_Support/Msl/MSL_C/MSL_Common/strtoul.h"
#endif

View file

@ -0,0 +1,18 @@
#ifndef _MSL_COMMON_STRTOUL_H
#define _MSL_COMMON_STRTOUL_H
#ifdef __cplusplus
extern "C" {
#endif
long strtol(const char* str, char** end, int base);
unsigned long strtoul(const char* str, char** end, int base);
unsigned long __strtoul(int base, int max_width,
int (*ReadProc)(void*, int, int), void* ReadProcArg,
int* chars_scanned, int* negative, int* overflow);
#ifdef __cplusplus
}
#endif
#endif /* _MSL_COMMON_STRTOUL_H */

View file

@ -0,0 +1,12 @@
#ifndef _MSL_COMMON_WCHAR_IO_H
#define _MSL_COMMON_WCHAR_IO_H
#include "PowerPC_EABI_Support/Msl/MSL_C/MSL_Common/ansi_files.h"
#ifndef __cplusplus
typedef unsigned short wchar_t;
#endif
int fwide(FILE* file, int mode);
#endif /* _MSL_COMMON_WCHAR_IO_H */

View file

@ -0,0 +1,234 @@
#ifndef _FDLIBM_H
#define _FDLIBM_H
/* @(#)fdlibm.h 1.5 04/04/22 */
/**
* ====================================================
* Copyright (C) 2004 by Sun Microsystems, Inc. All rights reserved.
*
* Permission to use, copy, modify, and distribute this
* software is freely granted, provided that this notice
* is preserved.
* ====================================================
*/
#ifdef __cplusplus
extern "C" {
#endif // ifdef __cplusplus
/* Sometimes it's necessary to define __LITTLE_ENDIAN explicitly
but these catch some common cases. */
#if defined(i386) || defined(i486) || defined(intel) || defined(x86) \
|| defined(i86pc) || defined(__alpha) || defined(__osf__)
#define __LITTLE_ENDIAN
#endif
#ifdef __LITTLE_ENDIAN
#define __HI(x) *(1 + (int*)&x)
#define __LO(x) *(int*)&x
#define __HIp(x) *(1 + (int*)x)
#define __LOp(x) *(int*)x
#else
#define __HI(x) *(int*)&x
#define __LO(x) *(1 + (int*)&x)
#define __HIp(x) *(int*)x
#define __LOp(x) *(1 + (int*)x)
#endif
// NOTE: should be enabled according to w_atan2.c
#define _IEEE_LIBM
// TODO: should __STDC__ actually be defined?
// #ifdef __STDC__
#define __P(p) p
// #else
// #define __P(p) ()
// #endif
/**
* ANSI/POSIX
*/
extern int signgam;
#define MAXFLOAT ((f32)3.40282346638528860e+38)
enum fdversion { fdlibm_ieee = -1, fdlibm_svid, fdlibm_xopen, fdlibm_posix };
#define _LIB_VERSION_TYPE enum fdversion
#define _LIB_VERSION _fdlib_version
/* if global variable _LIB_VERSION is not desirable, one may
* change the following to be a constant by:
* #define _LIB_VERSION_TYPE const enum version
* In that case, after one initializes the value _LIB_VERSION (see
* s_lib_version.c) during compile time, it cannot be modified
* in the middle of a program
*/
extern _LIB_VERSION_TYPE _LIB_VERSION;
#define _IEEE_ fdlibm_ieee
#define _SVID_ fdlibm_svid
#define _XOPEN_ fdlibm_xopen
#define _POSIX_ fdlibm_posix
struct exception {
int type;
char* name;
double arg1;
double arg2;
double retval;
};
#define HUGE MAXFLOAT
/**
* set X_TLOSS = pi*2**52, which is possibly defined in <values.h>
* (one may replace the following line by "#include <values.h>")
*/
#define X_TLOSS 1.41484755040568800000e+16
#define DOMAIN 1
#define SING 2
#define OVERFLOW 3
#define UNDERFLOW 4
#define TLOSS 5
#define PLOSS 6
/**
* ANSI/POSIX
*/
extern double acos __P((double));
extern double asin __P((double));
extern double atan __P((double));
extern double atan2 __P((double, double));
extern double cos __P((double));
extern double sin __P((double));
extern double tan __P((double));
extern double cosh __P((double));
extern double sinh __P((double));
extern double tanh __P((double));
extern double exp __P((double));
extern double frexp __P((double, int*));
extern double ldexp __P((double, int));
extern double scalbn __P((double, int));
extern double log __P((double));
extern double log10 __P((double));
extern double modf __P((double, double*));
extern double pow __P((double, double));
extern double sqrt __P((double));
extern double ceil __P((double));
extern double fabs __P((double));
// NOTE: I have no idea how they got it to mangle like this
extern double fabs__Fd(double);
extern double floor __P((double));
extern double fmod __P((double, double));
extern double erf __P((double));
extern double erfc __P((double));
extern double gamma __P((double));
extern double hypot __P((double, double));
extern int isnan __P((double));
extern int finite __P((double));
extern double j0 __P((double));
extern double j1 __P((double));
extern double jn __P((int, double));
extern double lgamma __P((double));
extern double y0 __P((double));
extern double y1 __P((double));
extern double yn __P((int, double));
extern double acosh __P((double));
extern double asinh __P((double));
extern double atanh __P((double));
extern double cbrt __P((double));
extern double logb __P((double));
extern double nextafter __P((double, double));
extern double remainder __P((double, double));
#ifdef _SCALB_INT
extern double scalb __P((double, int));
#else
extern double scalb __P((double, double));
#endif
extern int matherr __P((struct exception*));
/**
* IEEE Test Vector
*/
extern double significand __P((double));
/**
* Functions callable from C, intended to support IEEE arithmetic.
*/
extern double copysign __P((double, double));
extern int ilogb __P((double));
extern double rint __P((double));
extern double scalbn __P((double, int));
/**
* BSD math library entry points
*/
extern double expm1 __P((double));
extern double log1p __P((double));
/**
* Reentrant version of gamma & lgamma; passes signgam back by reference
* as the second argument; user must allocate space for signgam.
*/
#ifdef _REENTRANT
extern double gamma_r __P((double, int*));
extern double lgamma_r __P((double, int*));
#endif /* _REENTRANT */
/* ieee style elementary functions */
extern double __ieee754_sqrt __P((double));
extern double __ieee754_acos __P((double));
extern double __ieee754_acosh __P((double));
extern double __ieee754_log __P((double));
extern double __ieee754_atanh __P((double));
extern double __ieee754_asin __P((double));
extern double __ieee754_atan2 __P((double, double));
extern double __ieee754_exp __P((double));
extern double __ieee754_cosh __P((double));
extern double __ieee754_fmod __P((double, double));
extern double __ieee754_pow __P((double, double));
extern double __ieee754_lgamma_r __P((double, int*));
extern double __ieee754_gamma_r __P((double, int*));
extern double __ieee754_lgamma __P((double));
extern double __ieee754_gamma __P((double));
extern double __ieee754_log10 __P((double));
extern double __ieee754_sinh __P((double));
extern double __ieee754_hypot __P((double, double));
extern double __ieee754_j0 __P((double));
extern double __ieee754_j1 __P((double));
extern double __ieee754_y0 __P((double));
extern double __ieee754_y1 __P((double));
extern double __ieee754_jn __P((int, double));
extern double __ieee754_yn __P((int, double));
extern double __ieee754_remainder __P((double, double));
extern int __ieee754_rem_pio2 __P((double, double*));
#ifdef _SCALB_INT
extern double __ieee754_scalb __P((double, int));
#else
extern double __ieee754_scalb __P((double, double));
#endif
/* fdlibm kernel function */
extern double __kernel_standard __P((double, double, int));
extern double __kernel_sin __P((double, double, int));
extern double __kernel_cos __P((double, double));
extern double __kernel_tan __P((double, double, int));
extern int __kernel_rem_pio2 __P((double*, double*, int, int, int, const int*));
#ifdef __cplusplus
};
#endif // ifdef __cplusplus
#endif

View file

@ -0,0 +1,44 @@
#ifndef _RUNTIME_MWCPLUSLIB_H
#define _RUNTIME_MWCPLUSLIB_H
#include "stddef.h"
#define CTORARG_TYPE int
#define CTORARG_PARTIAL (0)
#define CTORARG_COMPLETE (1)
#define CTORCALL_COMPLETE(ctor, objptr) \
(((void (*)(void*, CTORARG_TYPE))ctor)(objptr, CTORARG_COMPLETE))
#define DTORARG_TYPE int
#define DTORCALL_COMPLETE(dtor, objptr) \
(((void (*)(void*, DTORARG_TYPE))dtor)(objptr, -1))
#define DTORCALL_PARTIAL(dtor, objptr) \
(((void (*)(void*, DTORARG_TYPE))dtor)(objptr, 0))
typedef void* ConstructorDestructor;
#ifdef __cplusplus
extern "C" {
#endif
extern void* __copy(char* to, char* from, size_t size);
extern void __construct_array(void* ptr, ConstructorDestructor ctor,
ConstructorDestructor dtor, size_t size,
size_t n);
extern void __destroy_arr(void* block, ConstructorDestructor* dtor, size_t size,
size_t n);
extern void* __construct_new_array(void* block, ConstructorDestructor ctor,
ConstructorDestructor dtor_arg, size_t size,
size_t n);
extern void __destroy_new_array(void* block, ConstructorDestructor dtor);
extern void __destroy_new_array2();
extern void __destroy_new_array3();
#ifdef __cplusplus
}
#endif
#endif

View file

@ -0,0 +1,43 @@
#ifndef _NMWEXCEPTION
#define _NMWEXCEPTION
typedef short vbase_ctor_arg_type;
typedef char local_cond_type;
typedef struct CatchInfo {
void* location;
void* typeinfo;
void* dtor;
void* sublocation;
long pointercopy;
void* stacktop;
} CatchInfo;
typedef struct DestructorChain {
struct DestructorChain* next;
void* destructor;
void* object;
} DestructorChain;
#ifdef __cplusplus
extern "C" {
#endif
extern void* __register_global_object(void* object, void* destructor,
void* registration);
extern void __destroy_global_chain(void);
extern void __end__catch(CatchInfo* catchinfo);
extern void __throw(char* throwtype, void* location, void* dtor);
extern char __throw_catch_compare(const char* throwtype, const char* catchtype,
long* offset_result);
extern void __unexpected(CatchInfo* catchinfo);
extern int __register_fragment(struct __eti_init_info* info, char* TOC);
extern void __unregister_fragment(int fragmentID);
#ifdef __cplusplus
}
#endif
#endif // _NMWEXCEPTION

View file

@ -0,0 +1,17 @@
#ifndef _RUNTIME_MEM_H
#define _RUNTIME_MEM_H
#include "stddef.h"
#ifdef __cplusplus
extern "C" {
#endif
__declspec(section ".init") void* memcpy(void* dest, const void* src, size_t n);
__declspec(section ".init") void* memset(void* dest, int val, size_t count);
#ifdef __cplusplus
}
#endif
#endif

View file

@ -0,0 +1,72 @@
#ifndef __PPC_EABI_LINKER
#define __PPC_EABI_LINKER
__declspec(section ".init") extern char _stack_addr[];
__declspec(section ".init") extern char _stack_end[];
__declspec(section ".init") extern char _heap_addr[];
__declspec(section ".init") extern char _heap_end[];
__declspec(section ".init") extern const char _fextabindex_rom[];
__declspec(section ".init") extern char _fextabindex[];
__declspec(section ".init") extern char _eextabindex[];
__declspec(section ".init") extern char _SDA_BASE_[];
__declspec(section ".init") extern char _SDA2_BASE_[];
typedef struct __rom_copy_info {
char* rom;
char* addr;
unsigned int size;
} __rom_copy_info;
__declspec(section ".init") extern __rom_copy_info _rom_copy_info[];
typedef struct __bss_init_info {
char* addr;
unsigned int size;
} __bss_init_info;
__declspec(section ".init") extern __bss_init_info _bss_init_info[];
typedef struct __eti_init_info {
void* eti_start;
void* eti_end;
void* code_start;
unsigned long code_size;
} __eti_init_info;
__declspec(section ".init") extern __eti_init_info _eti_init_info[];
__declspec(section ".init") extern const char _f_init_rom[];
__declspec(section ".init") extern char _f_init[];
__declspec(section ".init") extern char _e_init[];
__declspec(section ".init") extern const char _f_text_rom[];
__declspec(section ".init") extern char _f_text[];
__declspec(section ".init") extern char _e_text[];
__declspec(section ".init") extern const char _f_rodata_rom[];
__declspec(section ".init") extern char _f_rodata[];
__declspec(section ".init") extern char _e_rodata[];
__declspec(section ".init") extern const char _fextab_rom[];
__declspec(section ".init") extern char _fextab[];
__declspec(section ".init") extern char _eextab[];
__declspec(section ".init") extern const char _f_data_rom[];
__declspec(section ".init") extern char _f_data[];
__declspec(section ".init") extern char _e_data[];
__declspec(section ".init") extern char _f_bss[];
__declspec(section ".init") extern char _e_bss[];
__declspec(section ".init") extern const char _f_sdata_rom[];
__declspec(section ".init") extern char _f_sdata[];
__declspec(section ".init") extern char _e_sdata[];
__declspec(section ".init") extern char _f_sbss[];
__declspec(section ".init") extern char _e_sbss[];
__declspec(section ".init") extern const char _f_sdata2_rom[];
__declspec(section ".init") extern char _f_sdata2[];
__declspec(section ".init") extern char _e_sdata2[];
__declspec(section ".init") extern char _f_sbss2[];
__declspec(section ".init") extern char _e_sbss2[];
__declspec(section ".init") extern const char _f_PPC_EMB_sdata0_rom[];
__declspec(section ".init") extern char _f_PPC_EMB_sdata0[];
__declspec(section ".init") extern char _e_PPC_EMB_sdata0[];
__declspec(section ".init") extern char _f_PPC_EMB_sbss0[];
__declspec(section ".init") extern char _e_PPC_EMB_sbss0[];
#endif // __PPC_EABI_LINKER

15
include/REL/m425Dll.h Normal file
View file

@ -0,0 +1,15 @@
#ifndef M425DLL_H
#define M425DLL_H
#include "game/object.h"
omObjData *fn_1_6A0C(Process *process, s32 arg1);
void fn_1_6C08(void);
void fn_1_6CD0(s32 arg0, Vec *arg1);
s32 fn_1_109EC(s32 arg0, s32 arg1, Vec *arg2, Vec *arg3, Vec *arg4, s32 arg5);
float fn_1_10CF4(s32 arg0);
void fn_1_10DB4(s32 arg0);
void fn_1_10E3C(s32 arg0);
float fn_1_10EF8(s32 arg0, s32 arg1, float arg8, float arg9);
#endif

26
include/REL/m430Dll.h Normal file
View file

@ -0,0 +1,26 @@
#ifndef M430DLL_H
#define M430DLL_H
#include "game/object.h"
s32 fn_1_4030(void);
u32 fn_1_4058(void);
u32 fn_1_4070(void);
u32 fn_1_4088(void);
void fn_1_40D0(s32 arg0);
void fn_1_4100(s32 arg0);
float fn_1_4130(void);
float fn_1_48B0(float arg8, float arg9, float argA);
void fn_1_4A80(Process *process);
void fn_1_4C48(void);
float fn_1_7FBC(s32 arg0);
void fn_1_7FFC(s32 arg0, float arg8);
void fn_1_AEE0(s32 arg0, Vec *arg1, float arg8, float arg9);
void fn_1_B570(s32 arg0, Vec *arg1, float arg8, float arg9, Vec *arg2);
void fn_1_BB98(u32 arg0);
void fn_1_BBC4(Process *process);
void fn_1_C00C(void);
#endif

43
include/REL/m433Dll.h Normal file
View file

@ -0,0 +1,43 @@
#ifndef M4303LL_H
#define M4303LL_H
#include "game/object.h"
typedef struct M433DllWork {
u32 unk_00;
s32 unk_04;
s32 unk_08;
s32 unk_0C;
s32 unk_10;
s32 unk_14;
s32 unk_18;
u32 unk_1C;
u32 unk_20;
s32 unk_24;
u32 unk_28;
s32 unk_2C[2];
u32 unk_34;
s32 unk_38;
s32 unk_3C;
} M433DllWork; /* size = 0x40 */
void fn_1_584(omObjData *object);
void fn_1_618(omObjData *object);
u32 fn_1_216C(void);
u32 fn_1_2184(void);
void fn_1_219C(s32 arg0, s32 arg1, s32 arg2);
void fn_1_21E4(s32 arg0);
void fn_1_2214(s32 arg0);
s32 fn_1_2244(void);
float fn_1_26C4(float arg8, float arg9, float argA);
void fn_1_2894(Process *process);
void fn_1_2984(void);
omObjFunc fn_1_29A4(Process *process, omObjData *object);
void fn_1_58D8(s32);
void fn_1_5904(Process *process);
void fn_1_5B74(void);
s32 fn_1_10FA4(s32 arg0);
#endif

View file

@ -5,12 +5,13 @@
#include "game/objsub.h"
#include "game/object.h"
#include "ext_math.h"
// -------------------------------------------------------------------------- //
#define US_PER_60TH_SEC (1000000.0f / 60.0f)
#define US_TO_60TH_SEC(us) ((us) / US_PER_60TH_SEC)
#define FB_SIZE(width, height) width * height * 2
#define ABS(x) ((x) < 0 ? -(x) : (x))
// -------------------------------------------------------------------------- //
@ -44,4 +45,4 @@ omObjFunc2 fn_1_F9C;
#endif
// -------------------------------------------------------------------------- //
// -------------------------------------------------------------------------- //

114
include/REL/mstory2Dll.h Normal file
View file

@ -0,0 +1,114 @@
#ifndef MSTORY2DLL_H
#define MSTORY2DLL_H
#include "game/object.h"
#include "game/process.h"
#include "dolphin/types.h"
typedef struct {
/* 0x00 */ void (*unk00)(void);
/* 0x04 */ void (*unk04)(void);
/* 0x08 */ Vec unk08;
/* 0x14 */ float unk14;
/* 0x18 */ float unk18;
/* 0x1C */ float unk1C;
/* 0x20 */ Vec unk20;
/* 0x2C */ float unk2C;
/* 0x30 */ float unk30;
/* 0x34 */ float unk34;
/* 0x38 */ float unk38;
/* 0x3C */ float unk3C;
/* 0x40 */ s32 unk40;
} StructBss24; // Size 0x44
typedef struct {
/* 0x00 */ s32 unk00;
/* 0x04 */ s32 unk04;
/* 0x08 */ s32 unk08;
/* 0x0C */ s32 unk0C;
/* 0x10 */ s32 unk10;
/* 0x14 */ s32 unk14;
/* 0x18 */ s32 unk18;
/* 0x1C */ char unk1C[0x18];
} StructFn357C; // Size 0x34
typedef struct {
/* 0x00 */ omObjData* unk00;
/* 0x04 */ void (*unk04)(omObjData*, ...);
/* 0x08 */ s32 unk08;
/* 0x0C */ s32 unk0C;
/* 0x10 */ char unk10[0x18];
} StructBss16C; // Size 0x28
// main.c
float fn_1_864(float arg0, float arg1, float arg2, float arg3);
float fn_1_88C(float arg0, float arg1, float arg2);
float fn_1_8AC(float arg0, float arg1, float arg2, float arg3);
float fn_1_984(float arg0, float arg1, float arg2, float arg3);
float fn_1_A4C(float arg0, float arg1, float arg2, float arg3);
float fn_1_B08(float arg0, float arg1, float arg2, float arg3);
void fn_1_BC8(void);
void fn_1_BE8(s32 arg0);
void fn_1_C30(void);
s32 fn_1_185C(s32 arg0, s32 arg1, s32 arg2, s32 arg3, s32 arg4);
void fn_1_1A94(s32 arg0);
void fn_1_1AFC(s32 arg0, s32 arg1);
BOOL fn_1_1BA8(s32 arg0, s32 arg1);
BOOL fn_1_1C64(s32 arg0);
void fn_1_1D18(s32 arg0, s32 arg1);
void fn_1_1D4C(s32 arg0, s32 arg1, s32 arg2);
void fn_1_1DFC(omObjData* arg0, s32 arg1, s32 arg2, s32 arg3, s32 arg4);
void fn_1_2264(omObjData* arg0, s32 arg1, s32 arg2, s32 arg3);
void fn_1_2750(void (*arg0)(void));
void fn_1_2828(Process* arg0, void (*arg1)(void));
void fn_1_2948(omObjData* arg0, s32 arg1, Vec arg2, float arg3, float arg4, float arg5);
void fn_1_2D00(omObjData* arg0, s32 arg1, Vec arg2, float arg3, float arg4, float arg5);
void fn_1_357C(StructFn357C* arg0, s32 arg1);
void fn_1_42A0(StructBss24* arg0, StructBss24* arg1, float arg2, float arg3, float arg4);
s32 fn_1_3668(s32 arg0);
void fn_1_3754(void);
void fn_1_3854(StructBss24* arg0);
void fn_1_3B04(StructBss24* arg0, float arg1);
void fn_1_4FEC(StructBss24* arg0, StructBss24* arg1, float arg2, float arg3, float arg4);
void fn_1_6004(StructBss24* arg0, StructBss24* arg1, float arg2, float arg3, float arg4);
int fn_1_66CC(int modelId);
void fn_1_6704(omObjData* arg0);
void fn_1_67D8(omObjData* arg0, s32 arg1, s32 arg2, s32 arg3, s32 arg4);
void fn_1_6A90(s32 arg0, s32 arg1, s32 arg2, s32 arg3, s32 arg4);
void fn_1_6D78(s32 arg0, s32 arg1, s32 arg2, s32 arg3);
void fn_1_6DBC(s32 arg0, s32 arg1, s32 arg2, s32 arg3);
s32 fn_1_7064(s32 arg0, s32 arg1);
void fn_1_71DC(s32 arg0);
void fn_1_7244(s16 modelId, char *objName, u32 constAttr, float ofs);
void fn_1_7384(int modelId, int charNo, float ofs, s32 maxTime, BOOL flag);
// board_clear.c
void fn_1_7F54(Process* arg0, s32 arg1);
// board_clear.c
void fn_1_B3E4(Process* arg0, s32 arg1);
// board_miss.c
void fn_1_EA2C(Process* arg0, s32 arg1);
// mg_clear.c
void fn_1_1256C(Process* arg0, s32 arg1);
// mg_miss.c
void fn_1_16060(Process* arg0, s32 arg1);
// ending.c
void fn_1_188F0(Process* arg0, s32 arg1);
// ending.c
void fn_1_1B90C(Process* arg0);
extern s32 lbl_1_bss_88[16];
extern s32 lbl_1_bss_78[4];
extern s32 lbl_1_bss_68[];
extern StructBss24 lbl_1_bss_24;
extern s32 lbl_1_data_0[][4];
#endif

96
include/REL/mstoryDll.h Executable file
View file

@ -0,0 +1,96 @@
#ifndef MSTORYDLL_H
#define MSTORYDLL_H
#include "game/object.h"
#include "game/process.h"
#include "dolphin/types.h"
typedef struct {
/* 0x00 */ void (*unk00)(void);
/* 0x04 */ void (*unk04)(void);
/* 0x08 */ Vec unk08;
/* 0x14 */ float unk14;
/* 0x18 */ float unk18;
/* 0x1C */ float unk1C;
/* 0x20 */ Vec unk20;
/* 0x2C */ float unk2C;
/* 0x30 */ float unk30;
/* 0x34 */ float unk34;
/* 0x38 */ float unk38;
/* 0x3C */ float unk3C;
/* 0x40 */ s32 unk40;
} StructBss4; // Size 0x44
typedef struct {
/* 0x00 */ s32 unk00;
/* 0x04 */ s32 unk04;
/* 0x08 */ s32 unk08;
/* 0x0C */ s32 unk0C;
/* 0x10 */ s32 unk10;
/* 0x14 */ s32 unk14;
/* 0x18 */ s32 unk18;
/* 0x1C */ char unk1C[0x18];
} StructFn352C; // Size 0x34
typedef struct {
/* 0x00 */ omObjData* unk00;
/* 0x04 */ void (*unk04)(omObjData*, ...);
/* 0x08 */ s32 unk08;
/* 0x0C */ s32 unk0C;
/* 0x10 */ char unk10[0x18];
} StructBss19C; // Size 0x28
// main.c
float fn_1_828(float arg0, float arg1, float arg2, float arg3);
float fn_1_870(float arg0, float arg1, float arg2, float arg3);
float fn_1_948(float arg0, float arg1, float arg2, float arg3);
float fn_1_ACC(float arg0, float arg1, float arg2, float arg3);
void fn_1_B8C(void);
void fn_1_BAC(s32 arg0);
void fn_1_BF4(void);
s32 fn_1_1834(s32 arg0, s32 arg1, s32 arg2, s32 arg3, s32 arg4);
void fn_1_1A64(s32 arg0);
void fn_1_1ACC(s32 arg0, s32 arg1);
BOOL fn_1_1B78(s32 arg0, s32 arg1);
BOOL fn_1_1C34(s32 arg0);
void fn_1_1CE8(s32 arg0, s32 arg1);
void fn_1_1D1C(s32 arg0, s32 arg1, s32 arg2);
void fn_1_1DCC(omObjData* arg0, s32 arg1, s32 arg2, s32 arg3, s32 arg4);
void fn_1_2224(omObjData* arg0, s32 arg1, s32 arg2, s32 arg3);
void fn_1_2710(void (*arg0)(void));
void fn_1_27E8(Process* arg0, void (*arg1)(void));
void fn_1_2908(omObjData* arg0, s32 arg1, Vec arg2, float arg3, float arg4, float arg5);
void fn_1_2CB0(omObjData* arg0, s32 arg1, Vec arg2, float arg3, float arg4, float arg5);
void fn_1_352C(StructFn352C* arg0, s32 arg1);
s32 fn_1_3618(s32 arg0);
void fn_1_3704(void);
void fn_1_3804(StructBss4* arg0);
void fn_1_3ABC(StructBss4* arg0, float arg1);
void fn_1_51D0(StructBss4* arg0, StructBss4* arg1, float arg2, float arg3, float arg4);
void fn_1_61E8(StructBss4* arg0, StructBss4* arg1, float arg2, float arg3, float arg4);
void fn_1_6C1C(s32 arg0, s32 arg1, s32 arg2, s32 arg3);
s32 fn_1_6EB8(s32 arg0, s32 arg1);
void fn_1_7028(s32 arg0);
// board_clear.c
void fn_1_79B8(Process* arg0, s32 arg1, s32 arg2);
// board_miss.c
void fn_1_ACFC(Process* arg0, s32 arg1, s32 arg2);
// mg_clear.c
void fn_1_E710(Process* arg0, s32 arg1, s32 arg2);
// mg_miss.c
void fn_1_11624(Process* arg0, s32 arg1, s32 arg2);
// save.c
void fn_1_14150(Process* arg0);
extern s32 lbl_1_bss_68;
extern s32 lbl_1_bss_58[];
extern StructBss4 lbl_1_bss_4;
extern s32 lbl_1_data_0[][4];
#endif

View file

@ -0,0 +1,35 @@
#ifndef METROTRK_PORTABLE_DISPATCH_H
#define METROTRK_PORTABLE_DISPATCH_H
#include "dolphin/types.h"
#include "PowerPC_EABI_Support/MetroTRK/trk.h"
#ifdef __cplusplus
extern "C" {
#endif
#define TRK_DISPATCH_CMD_CONNECT 1 /* Connect to the console */
#define TRK_DISPATCH_CMD_DISCONNECT 2 /* Disconnect from the console */
#define TRK_DISPATCH_CMD_RESET 3 /* Reset the debugger */
#define TRK_DISPATCH_CMD_GETVERSION 4 /* Get debugger version */
#define TRK_DISPATCH_CMD_GETSUPPORTMASK 5 /* Get Support Mask */
#define TRK_DISPATCH_CMD_OVERRIDE 7 /* Override? */
#define TRK_DISPATCH_CMD_READMEM 16 /* Reading from memory */
#define TRK_DISPATCH_CMD_WRITEMEM 17 /* Writing to memory */
#define TRK_DISPATCH_CMD_READREGS 18 /* Read a register value */
#define TRK_DISPATCH_CMD_WRITEREGS 19 /* Set a register */
#define TRK_DISPATCH_CMD_SETOPTION 23 /* Set an option? */
#define TRK_DISPATCH_CMD_CONTINUE 24 /* Continue debugging */
#define TRK_DISPATCH_CMD_STEP 25 /* Step through an instruction */
#define TRK_DISPATCH_CMD_STOP 26 /* Stop the debugger */
typedef struct TRKBuffer TRKBuffer;
DSError TRKInitializeDispatcher();
BOOL TRKDispatchMessage(TRKBuffer* buffer);
#ifdef __cplusplus
}
#endif
#endif /* METROTRK_PORTABLE_DISPATCH_H */

View file

@ -0,0 +1,16 @@
#ifndef METROTRK_PORTABLE_MAIN_TRK_H
#define METROTRK_PORTABLE_MAIN_TRK_H
#include "PowerPC_EABI_Support/MetroTRK/trk.h"
#ifdef __cplusplus
extern "C" {
#endif
DSError TRK_main(void);
#ifdef __cplusplus
}
#endif
#endif /* METROTRK_PORTABLE_MAIN_TRK_H */

View file

@ -0,0 +1,14 @@
#ifndef METROTRK_PORTABLE_MAINLOOP_H
#define METROTRK_PORTABLE_MAINLOOP_H
#ifdef __cplusplus
extern "C" {
#endif
void TRKNubMainLoop(void);
#ifdef __cplusplus
}
#endif
#endif /* METROTRK_PORTABLE_MAINLOOP_H */

View file

@ -0,0 +1,17 @@
#ifndef METROTRK_PORTABLE_MEM_TRK_H
#define METROTRK_PORTABLE_MEM_TRK_H
#include "stddef.h"
#ifdef __cplusplus
extern "C" {
#endif
void* TRK_memset(void* dst, int val, size_t n);
void* TRK_memcpy(void* dst, const void* src, size_t n);
#ifdef __cplusplus
}
#endif
#endif /* METROTRK_PORTABLE_MEM_TRK_H */

View file

@ -0,0 +1,24 @@
#ifndef METROTRK_PORTABLE_MSG_H
#define METROTRK_PORTABLE_MSG_H
#include "PowerPC_EABI_Support/MetroTRK/trk.h"
#include "dolphin/types.h"
typedef struct _TRK_Msg {
u8 _00[8];
u32 m_msgLength;
u32 _0C;
u32 m_msg;
} TRK_Msg;
#ifdef __cplusplus
extern "C" {
#endif
DSError TRKMessageSend(TRK_Msg* msg);
#ifdef __cplusplus
}
#endif
#endif /* METROTRK_PORTABLE_MSG_H */

View file

@ -0,0 +1,50 @@
#ifndef METROTRK_PORTABLE_MSGBUF_H
#define METROTRK_PORTABLE_MSGBUF_H
#include "PowerPC_EABI_Support/MetroTRK/trk.h"
#include "stddef.h"
#ifdef __cplusplus
extern "C" {
#endif
DSError TRKInitializeMessageBuffers(void);
DSError TRKSetBufferPosition(TRKBuffer* msg, u32 pos);
void* TRKGetBuffer(int);
void TRKResetBuffer(TRKBuffer* msg, BOOL keepData);
void* TRKGetBuffer(int idx);
void TRKReleaseBuffer(int idx);
DSError TRKGetFreeBuffer(int* msgID, TRKBuffer** outMsg);
DSError TRKAppendBuffer(TRKBuffer* msg, const void* data, size_t length);
DSError TRKAppendBuffer1_ui8(TRKBuffer* buffer, const u8 data);
inline DSError TRKAppendBuffer1_ui8(TRKBuffer* buffer, const u8 data)
{
if (buffer->position >= TRKMSGBUF_SIZE) {
return DS_MessageBufferOverflow;
}
buffer->data[buffer->position++] = data;
buffer->length++;
return DS_NoError;
}
DSError TRKAppendBuffer1_ui16(TRKBuffer* buffer, const u16 data);
DSError TRKAppendBuffer1_ui32(TRKBuffer* buffer, const u32 data);
DSError TRKAppendBuffer1_ui64(TRKBuffer* buffer, const u64 data);
DSError TRKAppendBuffer_ui8(TRKBuffer* buffer, const u8* data, int count);
DSError TRKAppendBuffer_ui32(TRKBuffer* buffer, const u32* data, int count);
DSError TRKReadBuffer1_ui8(TRKBuffer* buffer, u8* data);
DSError TRKReadBuffer1_ui16(TRKBuffer* buffer, u16* data);
DSError TRKReadBuffer1_ui32(TRKBuffer* buffer, u32* data);
DSError TRKReadBuffer1_ui64(TRKBuffer* buffer, u64* data);
DSError TRKReadBuffer_ui8(TRKBuffer* buffer, u8* data, int count);
DSError TRKReadBuffer_ui32(TRKBuffer* buffer, u32* data, int count);
DSError TRKReadBuffer(TRKBuffer* msg, void* data, size_t length);
#ifdef __cplusplus
}
#endif
#endif /* METROTRK_PORTABLE_MSGBUF_H */

View file

@ -0,0 +1,31 @@
#ifndef METROTRK_PORTABLE_MSGHNDLR_H
#define METROTRK_PORTABLE_MSGHNDLR_H
#include "PowerPC_EABI_Support/MetroTRK/trk.h"
void SetTRKConnected(BOOL);
BOOL GetTRKConnected(void);
DSError TRKDoUnsupported(TRKBuffer*);
DSError TRKDoSetOption(TRKBuffer*);
DSError TRKDoStop(TRKBuffer*);
DSError TRKDoStep(TRKBuffer*);
DSError TRKDoContinue(TRKBuffer*);
DSError TRKDoWriteRegisters(TRKBuffer*);
DSError TRKDoReadRegisters(TRKBuffer*);
DSError TRKDoFlushCache(TRKBuffer*);
DSError TRKDoWriteMemory(TRKBuffer*);
DSError TRKDoReadMemory(TRKBuffer*);
DSError TRKDoSupportMask(TRKBuffer*);
DSError TRKDoVersions(TRKBuffer*);
DSError TRKDoSupportMask(TRKBuffer*);
DSError TRKDoCPUType(TRKBuffer*);
DSError TRKDoOverride(TRKBuffer*);
DSError TRKDoReset(TRKBuffer*);
DSError TRKDoDisconnect(TRKBuffer*);
DSError TRKDoConnect(TRKBuffer*);
DSError TRKStandardACK(TRKBuffer* buffer, MessageCommandID commandID,
DSReplyError replyError);
void OutputData(void* data, int length);
#endif /* METROTRK_PORTABLE_MSGHNDLR_H */

View file

@ -0,0 +1,10 @@
#ifndef METROTRK_PORTABLE_MUTEX_TRK_H
#define METROTRK_PORTABLE_MUTEX_TRK_H
#include "PowerPC_EABI_Support/MetroTRK/trk.h"
DSError TRKInitializeMutex(void*);
DSError TRKAcquireMutex(void*);
DSError TRKReleaseMutex(void*);
#endif /* METROTRK_PORTABLE_MUTEX_TRK_H */

View file

@ -0,0 +1,16 @@
#ifndef METROTRK_PORTABLE_NOTIFY_H
#define METROTRK_PORTABLE_NOTIFY_H
#include "PowerPC_EABI_Support/MetroTRK/trk.h"
#ifdef __cplusplus
extern "C" {
#endif
DSError TRKDoNotifyStopped(MessageCommandID cmd);
#ifdef __cplusplus
}
#endif
#endif /* METROTRK_PORTABLE_NOTIFY_H */

View file

@ -0,0 +1,37 @@
#ifndef METROTRK_PORTABLE_NUBEVENT_H
#define METROTRK_PORTABLE_NUBEVENT_H
#include "PowerPC_EABI_Support/MetroTRK/trk.h"
#ifdef __cplusplus
extern "C" {
#endif
typedef u32 NubEventID;
typedef struct TRKEvent {
NubEventType eventType;
NubEventID eventID;
MessageBufferID msgBufID;
} TRKEvent;
typedef struct TRKEventQueue {
int _00;
int count;
int next;
TRKEvent events[2];
NubEventID eventID;
} TRKEventQueue;
extern TRKEventQueue gTRKEventQueue;
BOOL TRKGetNextEvent(TRKEvent* event);
void TRKDestructEvent(TRKEvent*);
void TRKConstructEvent(TRKEvent*, NubEventType);
DSError TRKPostEvent(TRKEvent*);
DSError TRKInitializeEventQueue();
#ifdef __cplusplus
}
#endif
#endif /* METROTRK_PORTABLE_NUBEVENT_H */

View file

@ -0,0 +1,21 @@
#ifndef METROTRK_PORTABLE_NUBINIT_H
#define METROTRK_PORTABLE_NUBINIT_H
#include "PowerPC_EABI_Support/MetroTRK/trk.h"
#ifdef __cplusplus
extern "C" {
#endif
void TRKNubWelcome(void);
void TRKNubMainLoop(void);
DSError TRKTerminateNub(void);
DSError TRKInitializeNub(void);
extern BOOL gTRKBigEndian;
#ifdef __cplusplus
}
#endif
#endif /* METROTRK_PORTABLE_NUBINIT_H */

View file

@ -0,0 +1,23 @@
#ifndef METROTRK_PORTABLE_SERPOLL_H
#define METROTRK_PORTABLE_SERPOLL_H
#include "PowerPC_EABI_Support/MetroTRK/trk.h"
#ifdef __cplusplus
extern "C" {
#endif
DSError TRKInitializeSerialHandler(void);
DSError TRKTerminateSerialHandler(void);
void TRKGetInput(void);
MessageBufferID TRKTestForPacket();
void TRKProcessInput(int bufferIdx);
extern void* gTRKInputPendingPtr;
#ifdef __cplusplus
}
#endif
#endif /* METROTRK_PORTABLE_SERPOLL_H */

View file

@ -0,0 +1,29 @@
#ifndef METROTRK_PORTABLE_SUPPORT_H
#define METROTRK_PORTABLE_SUPPORT_H
#include "PowerPC_EABI_Support/MetroTRK/trk.h"
#include "stddef.h"
#ifdef __cplusplus
extern "C" {
#endif
DSError TRKSuppAccessFile(u32 file_handle, u8* data, size_t* count,
DSIOResult* io_result, BOOL need_reply, BOOL read);
DSError TRKRequestSend(TRKBuffer* msgBuf, int* bufferId, u32 p1, u32 p2,
int p3);
DSError HandleOpenFileSupportRequest(const char* path, u8 replyError,
u32* param_3, DSIOResult* ioResult);
DSError HandleCloseFileSupportRequest(int replyError, DSIOResult* ioResult);
DSError HandlePositionFileSupportRequest(DSReplyError replyErr, u32* param_2,
u8 param_3, DSIOResult* ioResult);
#ifdef __cplusplus
}
#endif
#endif /* METROTRK_PORTABLE_SUPPORT_H */

View file

@ -0,0 +1,24 @@
#ifndef OS_DOLPHIN_DOLPHIN_TRK_H
#define OS_DOLPHIN_DOLPHIN_TRK_H
#include "dolphin/types.h"
#include "PowerPC_EABI_Support/MetroTRK/trk.h"
#ifdef __cplusplus
extern "C" {
#endif
DSError TRKInitializeTarget();
void EnableMetroTRKInterrupts();
u32 TRKTargetTranslate(u32 param_0);
void TRK__read_aram(register int c, register u32 p2, void* p3);
void TRK__write_aram(register int c, register u32 p2, void* p3);
void __TRK_copy_vectors(void);
#ifdef __cplusplus
}
#endif
#endif /* OS_DOLPHIN_DOLPHIN_TRK_H */

View file

@ -0,0 +1,45 @@
#ifndef OS_DOLPHIN_DOLPHIN_TRK_GLUE_H
#define OS_DOLPHIN_DOLPHIN_TRK_GLUE_H
#include "dolphin/os.h"
#include "PowerPC_EABI_Support/MetroTRK/trk.h"
#include "stddef.h"
#ifdef __cplusplus
extern "C" {
#endif
typedef void (*DBCommFunc)(void);
typedef u32 (*DBPollFunc)(void);
typedef void (*DBCommInitFunc)(volatile u8**, __OSInterruptHandler);
typedef int (*DBCommReadFunc)(void*, size_t);
typedef int (*DBCommWriteFunc)(const void*, size_t);
typedef struct DBCommTable {
DBCommInitFunc initialize_func;
DBCommFunc init_interrupts_func;
DBPollFunc peek_func;
DBCommReadFunc read_func;
DBCommWriteFunc write_func;
DBCommFunc open_func;
DBCommFunc close_func;
} DBCommTable;
DSError TRKInitializeIntDrivenUART(u32 param_0, u32 param_1, u32 param_2,
volatile u8** param_3);
void UnreserveEXI2Port(void);
void ReserveEXI2Port(void);
int TRKPollUART(void);
UARTError TRKReadUARTN(void* bytes, u32 length);
UARTError TRKWriteUARTN(const void* bytes, u32 length);
void TRKLoadContext(OSContext* ctx, u32 r4);
int InitMetroTRKCommTable(int hwId);
void EnableEXI2Interrupts(void);
void TRK_board_display(char* str);
#ifdef __cplusplus
}
#endif
#endif /* OS_DOLPHIN_DOLPHIN_TRK_GLUE_H */

View file

@ -0,0 +1,16 @@
#ifndef OS_DOLPHIN_TARGCONT_H
#define OS_DOLPHIN_TARGCONT_H
#include "PowerPC_EABI_Support/MetroTRK/trk.h"
#ifdef __cplusplus
extern "C" {
#endif
DSError TRKTargetContinue(void);
#ifdef __cplusplus
}
#endif
#endif /* OS_DOLPHIN_TARGCONT_H */

View file

@ -0,0 +1,14 @@
#ifndef OS_DOLPHIN_USR_PUT_H
#define OS_DOLPHIN_USR_PUT_H
#ifdef __cplusplus
extern "C" {
#endif
void usr_put_initialize(void);
#ifdef __cplusplus
}
#endif
#endif /* OS_DOLPHIN_USR_PUT_H */

View file

@ -0,0 +1,16 @@
#ifndef PPC_GENERIC_FLUSH_CACHE_H
#define PPC_GENERIC_FLUSH_CACHE_H
#include <dolphin/types.h>
#ifdef __cplusplus
extern "C" {
#endif
void TRK_flush_cache(void* param_1, int param_2);
#ifdef __cplusplus
}
#endif
#endif /* PPC_GENERIC_FLUSH_CACHE_H */

View file

@ -0,0 +1,16 @@
#ifndef PPC_GENERIC_MPC_7XX_603E_H
#define PPC_GENERIC_MPC_7XX_603E_H
#include <dolphin/types.h>
#ifdef __cplusplus
extern "C" {
#endif
u32 TRKTargetCPUMinorType(void);
#ifdef __cplusplus
}
#endif
#endif /* PPC_GENERIC_MPC_7XX_603E_H */

View file

@ -0,0 +1,190 @@
#ifndef PPC_GENERIC_TARGIMPL_H
#define PPC_GENERIC_TARGIMPL_H
#include "TRK_MINNOW_DOLPHIN/MetroTRK/Portable/nubevent.h"
#include "stddef.h"
#ifdef __cplusplus
extern "C" {
#endif
void TRKTargetSetInputPendingPtr(void* ptr);
void TRKSwapAndGo();
void TRKTargetSetStopped(unsigned int);
DSError TRKTargetInterrupt(TRKEvent*);
DSError TRKTargetSupportRequest();
void TRKDestructEvent(TRKEvent*);
DSError TRKTargetFlushCache(u8, void* start, void* end);
BOOL TRKTargetStopped(void);
DSError TRKTargetAddStopInfo(TRKBuffer* b);
DSError TRKTargetAddExceptionInfo(TRKBuffer* b);
DSError TRKTargetAccessARAM(u32 p1, u32 p2, u32* p3, BOOL read);
DSError TRKTargetAccessMemory(void* data, u32 start, size_t* length,
MemoryAccessOptions accessOptions, BOOL read);
DSError TRKTargetAccessDefault(u32 firstRegister, u32 lastRegister,
TRKBuffer* b, size_t* registersLengthPtr,
BOOL read);
DSError TRKTargetAccessFP(u32 firstRegister, u32 lastRegister, TRKBuffer* b,
size_t* registersLengthPtr, BOOL read);
DSError TRKTargetAccessExtended1(u32 firstRegister, u32 lastRegister,
TRKBuffer* b, size_t* registersLengthPtr,
BOOL read);
DSError TRKTargetAccessExtended2(u32 firstRegister, u32 lastRegister,
TRKBuffer* b, size_t* registerStorageSize,
BOOL read);
u32 TRKTargetGetPC();
DSError TRKTargetSingleStep(u32 count, BOOL stepOver);
DSError TRKTargetStepOutOfRange(u32 rangeStart, u32 rangeEnd, BOOL stepOver);
u32 TRKTargetStop();
void TRKInterruptHandler();
void TRKPostInterruptEvent(void);
typedef struct DSVersions {
u8 kernelMajor;
u8 kernelMinor;
u8 protocolMajor;
u8 protocolMinor;
} DSVersions;
DSError TRKTargetVersions(DSVersions* versions);
DSError TRKTargetSupportMask(u8 mask[32]);
typedef struct DSCPUType {
u8 cpuMajor;
u8 cpuMinor;
u8 bigEndian;
u8 defaultTypeSize;
u8 fpTypeSize;
u8 extended1TypeSize;
u8 extended2TypeSize;
} DSCPUType;
DSError TRKTargetCPUType(DSCPUType* cpuType);
typedef struct Default_PPC {
u32 GPR[32];
u32 PC;
u32 LR;
u32 CR;
u32 CTR;
u32 XER;
} Default_PPC;
typedef struct Float_PPC {
u64 FPR[32];
u64 FPSCR;
u64 FPECR;
} Float_PPC;
typedef struct Extended1_PPC_6xx_7xx {
u32 SR[16];
u32 TBL;
u32 TBU;
u32 HID0;
u32 HID1;
u32 MSR;
u32 PVR;
u32 IBAT0U;
u32 IBAT0L;
u32 IBAT1U;
u32 IBAT1L;
u32 IBAT2U;
u32 IBAT2L;
u32 IBAT3U;
u32 IBAT3L;
u32 DBAT0U;
u32 DBAT0L;
u32 DBAT1U;
u32 DBAT1L;
u32 DBAT2U;
u32 DBAT2L;
u32 DBAT3U;
u32 DBAT3L;
u32 DMISS;
u32 DCMP;
u32 HASH1;
u32 HASH2;
u32 IMISS;
u32 ICMP;
u32 RPA;
u32 SDR1;
u32 DAR;
u32 DSISR;
u32 SPRG0;
u32 SPRG1;
u32 SPRG2;
u32 SPRG3;
u32 DEC;
u32 IABR;
u32 EAR;
u32 DABR;
u32 PMC1;
u32 PMC2;
u32 PMC3;
u32 PMC4;
u32 SIA;
u32 MMCR0;
u32 MMCR1;
u32 THRM1;
u32 THRM2;
u32 THRM3;
u32 ICTC;
u32 L2CR;
u32 UMMCR2;
u32 UBAMR;
u32 UMMCR0;
u32 UPMC1;
u32 UPMC2;
u32 USIA;
u32 UMMCR1;
u32 UPMC3;
u32 UPMC4;
u32 USDA;
u32 MMCR2;
u32 BAMR;
u32 SDA;
u32 MSSCR0;
u32 MSSCR1;
u32 PIR;
u32 exceptionID;
u32 GQR[8];
u32 HID_G;
u32 WPAR;
u32 DMA_U;
u32 DMA_L;
} Extended1_PPC_6xx_7xx;
typedef struct Extended2_PPC_6xx_7xx {
u32 PSR[32][2];
} Extended2_PPC_6xx_7xx;
typedef struct ProcessorState_PPC_6xx_7xx {
Default_PPC Default;
Float_PPC Float;
Extended1_PPC_6xx_7xx Extended1;
Extended2_PPC_6xx_7xx Extended2;
u32 transport_handler_saved_ra;
} ProcessorState_PPC_6xx_7xx;
typedef ProcessorState_PPC_6xx_7xx ProcessorState_PPC;
extern ProcessorState_PPC gTRKCPUState;
typedef struct TRKState {
u32 gpr[32]; // _00
u32 lr; // _80
u32 ctr; // _84
u32 xer; // _88
u32 msr; // _8C
u32 dar; // _90
u32 dsisr; // _94
BOOL isStopped; // _98
BOOL inputActivated; // _9C
void* inputPendingPtr; // _A0
} TRKState;
extern TRKState gTRKState;
#ifdef __cplusplus
}
#endif
#endif /* PPC_GENERIC_TARGIMPL_H */

View file

@ -0,0 +1,27 @@
#ifndef AMCEXI2STUBS_H
#define AMCEXI2STUBS_H
#include "dolphin/os.h"
#ifdef __cplusplus
extern "C" {
#endif
typedef __OSInterruptHandler AmcEXICallback;
typedef enum { AMC_EXI_NO_ERROR = 0, AMC_EXI_UNSELECTED } AmcExiError;
void EXI2_Init(volatile u8**, AmcEXICallback);
void EXI2_EnableInterrupts(void);
u32 EXI2_Poll(void);
int EXI2_ReadN(void*, u32);
int EXI2_WriteN(const void*, u32);
void EXI2_Reserve(void);
void EXI2_Unreserve(void);
BOOL AMC_IsStub(void);
#ifdef __cplusplus
};
#endif
#endif

View file

@ -114,6 +114,12 @@ static inline void GXPosition3f32(const f32 x, const f32 y, const f32 z) {
GXWGFifo.f32 = z;
}
static inline void GXNormal3s16(const s16 x, const s16 y, const s16 z) {
GXWGFifo.s16 = x;
GXWGFifo.s16 = y;
GXWGFifo.s16 = z;
}
static inline void GXNormal3f32(const f32 x, const f32 y, const f32 z) {
GXWGFifo.f32 = x;
GXWGFifo.f32 = y;

85
include/dolphin/math.h Normal file
View file

@ -0,0 +1,85 @@
#ifndef _DOLPHIN_MATH
#define _DOLPHIN_MATH
// this file is necessary to match mtx/quat.c
#define M_PI 3.141592653589793
#ifndef _MATH_INLINE
#define _MATH_INLINE static inline
#endif
extern int __float_nan[];
extern int __float_huge[];
extern int __double_huge[];
#define INFINITY (*(float *)__float_huge)
#define NAN (*(float *)__float_nan)
#define HUGE_VAL (*(double *)__double_huge)
#ifdef __MWERKS__
extern inline double sqrt(double x)
{
if (x > 0.0) {
double guess = __frsqrte(x); /* returns an approximation to */
guess = .5 * guess * (3.0 - guess * guess * x); /* now have 8 sig bits */
guess = .5 * guess * (3.0 - guess * guess * x); /* now have 16 sig bits */
guess = .5 * guess * (3.0 - guess * guess * x); /* now have 32 sig bits */
guess = .5 * guess * (3.0 - guess * guess * x); /* now have > 53 sig bits */
return x * guess;
}
else if (x == 0)
return 0;
else if (x)
return NAN;
return INFINITY;
}
extern inline float sqrtf(float x)
{
const double _half = .5;
const double _three = 3.0;
volatile float y;
if (x > 0.0f) {
double guess = __frsqrte((double)x); // returns an approximation to
guess = _half * guess * (_three - guess * guess * x); // now have 12 sig bits
guess = _half * guess * (_three - guess * guess * x); // now have 24 sig bits
guess = _half * guess * (_three - guess * guess * x); // now have 32 sig bits
y = (float)(x * guess);
return y;
}
return x;
}
#else
double sqrt(double x);
float sqrtf(float x);
#endif
double atan(double x);
double copysign(double x, double y);
double cos(double x);
double floor(double x);
double frexp(double x, int *exp);
double ldexp(double x, int exp);
double modf(double x, double *intpart);
double sin(double x);
double tan(double x);
double acos(double x);
double asin(double x);
double atan2(double y, double x);
double fmod(double x, double y);
double log(double x);
double pow(double x, double y);
float tanf(float x);
#ifdef __MWERKS__
extern inline double fabs(double x)
{
return __fabs(x);
}
#else
double fabs(double x);
#endif
#endif

View file

@ -118,7 +118,7 @@ void PSMTXScaleApply(const Mtx src, Mtx dst, f32 xS, f32 yS, f32 zS);
void PSMTXRotRad(Mtx m, char axis, f32 rad);
void PSMTXRotTrig(Mtx m, char axis, f32 sinA, f32 cosA);
void PSMTXRotAxisRad(Mtx m, const Vec* axis, f32 rad);
void PSMTXRotAxisRad(register Mtx m, const Vec* axis, register f32 rad);
#endif
#ifdef MTX_USE_PS

View file

@ -40,7 +40,8 @@ typedef struct system_state {
};
/* 0x09 */ s8 last5_effect;
/* 0x0A */ s8 player_curr;
/* 0x0B */ s8 unk0B[3];
/* 0x0B */ u8 unk0B;
/* 0x0C */ s8 unk0C;
/* 0x0E */ s16 block_pos;
/* 0x10 */ u8 ATTRIBUTE_ALIGN(4) board_data[32];
/* 0x30 */ u8 mess_delay;
@ -314,6 +315,11 @@ static inline s32 GWPlayerCurrGet(void)
return GWSystem.player_curr;
}
static inline s32 GWUnkB1Get(void)
{
return GWSystem.unk0C;
}
static inline s32 GWPlayerTeamGet(s32 player)
{
return GWPlayer[player].team;
@ -357,6 +363,6 @@ static inline void GWPlayerCoinWinSet(s32 player, s16 value)
}
#define GWPlayerCoinWinAdd(player, value) GWPlayerCoinWinSet((player), GWPlayerCoinWinGet((player))+(value))
#define GWPlayerCoinCollectAdd(player, value) GWPlayerCoinCollectSet((player), GWPlayerCoinCollectGet((player))+(value))
#define GWPlayerCoinCollectAdd(player, value) GWPlayerCoinCollectSet((player), (s32)GWPlayerCoinCollectGet((player))+(value))
#endif

View file

@ -12,6 +12,7 @@
#define MSM_SEPARAM_AUXVOLA (1 << 4)
#define MSM_SEPARAM_AUXVOLB (1 << 5)
#define MSM_SEPARAM_POS (1 << 6)
#define MSM_SEPARAM_PAD (1 << 7)
#define MSM_LISTENER_NONE 0
#define MSM_LISTENER_STARTDIS (1 << 0)
@ -40,16 +41,24 @@
#define MSM_ERR_OUTOFMEM -10
#define MSM_ERR_OUTOFAMEM -20
#define MSM_ERR_INITFAIL -20
#define MSM_ERR_1E -30
#define MSM_ERR_INVALID_AUXPARAM -31
#define MSM_ERR_20 -32
#define MSM_ERR_PLAYFAIL -33
#define MSM_ERR_22 -34
#define MSM_ERR_STREAMALLOC_FAIL -35
#define MSM_ERR_INSTALLED -36
#define MSM_ERR_64 -100
#define MSM_ERR_65 -101
#define MSM_ERR_GRP_NOTLOADED -103
#define MSM_ERR_6E -110
#define MSM_ERR_6F -111
#define MSM_ERR_INVALIDID -120
#define MSM_ERR_INVALIDFILE -121
#define MSM_ERR_REMOVEDID -122
#define MSM_ERR_MUSGRP_NOTLOADED -123
#define MSM_ERR_OUTOFMUS -130
#define MSM_ERR_8C -140
#define MSM_VOL_MAX 127
#define MSM_PAN_LEFT 32
@ -132,7 +141,7 @@ typedef struct msmSe_s {
u8 span;
u8 reverb;
u8 chorus;
u8 doppler;
s8 doppler;
s8 comp;
u8 pad[3];
} MSMSE;
@ -164,16 +173,15 @@ typedef struct msmStreamParam_s {
} MSM_STREAMPARAM;
s32 msmSysInit(MSM_INIT *init, MSM_ARAM *aram);
void msmSysSetOutputMode(SND_OUTPUTMODE mode);
s32 msmSysSetOutputMode(SND_OUTPUTMODE mode);
s32 msmSysDelGroupAll(void);
s32 msmSysLoadGroup(s32 grp, void *buf, BOOL flag);
s32 msmSysGetSampSize(BOOL baseGrp);
s32 msmSysDelGroupBase(s32 grpNum);
s32 msmSeSetParam(int seNo, MSM_SEPARAM *param);
int msmSePlay(int seId, MSM_SEPARAM *param);
s32 msmSeStop(int seNo, s32 speed);
s32 msmSePauseAll(BOOL pause, s32 speed);
void msmSePauseAll(BOOL pause, s32 speed);
s32 msmSePause(int seNo, BOOL pause, s32 speed);
void msmSeStopAll(BOOL checkGrp, s32 speed);
s32 msmSeSetListener(Vec *pos, Vec *heading, float sndDist, float sndSpeed, MSM_SELISTENER *listener);
@ -181,11 +189,11 @@ s32 msmSeUpdataListener(Vec *pos, Vec *heading);
void msmSeDelListener(void);
s32 msmSeGetStatus(int seNo);
s32 msmSeGetNumPlay(BOOL baseGrp);
s32 msmSeGetEntryID(s16 seId, int *seNo);
s32 msmSeGetEntryID(s32 seId, int *seNo);
int msmMusPlay(int musId, MSM_MUSPARAM *musParam);
s32 msmMusStop(int musNo, s32 speed);
s32 msmMusPauseAll(BOOL pause, s32 speed);
void msmMusPauseAll(BOOL pause, s32 speed);
s32 msmMusPause(int musNo, BOOL pause, s32 speed);
s32 msmMusGetMidiCtrl(int musNo, s32 channel, s32 ctrl);
void msmMusStopAll(BOOL checkGrp, s32 speed);
@ -200,4 +208,4 @@ s32 msmStreamPause(int streamNo, BOOL pause, s32 speed);
void msmStreamStopAll(s32 speed);
s32 msmStreamGetStatus(int streamNo);
#endif
#endif

View file

@ -1,10 +1,21 @@
#ifndef MSMMUS_H
#define MSMMUS_H
#include "dolphin.h"
#include "dolphin/types.h"
#include "game/msm.h"
#include "msm/msmsys.h"
s32 msmMusInit(s32 *, DVDFileInfo *);
void msmMusFdoutEnd(void);
void msmMusPeriodicProc(void);
s32 msmMusGetMidiCtrl(int musNo, s32 channel, s32 ctrl);
s32 msmMusGetNumPlay(BOOL baseGrp);
s32 msmMusGetStatus(int musNo);
void msmMusSetMasterVolume(s32 arg0);
s32 msmMusSetParam(s32 arg0, MSM_MUSPARAM* arg1);
void msmMusPauseAll(BOOL pause, s32 speed);
s32 msmMusPause(int musNo, BOOL pause, s32 speed);
void msmMusStopAll(BOOL checkGrp, s32 speed);
s32 msmMusStop(int musNo, s32 speed);
int msmMusPlay(int musId, MSM_MUSPARAM* musParam);
s32 msmMusInit(sysData* arg0, DVDFileInfo* arg1);
#endif

View file

@ -1,10 +1,23 @@
#ifndef MSMSE_H
#define MSMSE_H
#include "dolphin.h"
#include "dolphin/types.h"
#include "game/msm.h"
#include "msm/msmsys.h"
s32 msmSeInit(s32 *, DVDFileInfo *);
void msmSePeriodicProc(void);
MSMSE* msmSeGetIndexPtr(s32 arg0);
void msmSeDelListener(void);
s32 msmSeUpdataListener(Vec* pos, Vec* heading);
s32 msmSeSetListener(Vec* pos, Vec* heading, float sndDist, float sndSpeed, MSM_SELISTENER* listener);
s32 msmSeGetEntryID(s32 seId, int* seNo);
s32 msmSeGetNumPlay(BOOL baseGrp);
s32 msmSeGetStatus(int seNo);
void msmSeSetMasterVolume(s32 arg0);
s32 msmSeSetParam(int seNo, MSM_SEPARAM* param);
void msmSePauseAll(BOOL pause, s32 speed);
void msmSeStopAll(BOOL checkGrp, s32 speed);
s32 msmSeStop(int seNo, s32 speed);
int msmSePlay(int seId, MSM_SEPARAM* param);
s32 msmSeInit(sysData* arg0, DVDFileInfo* arg1);
#endif

View file

@ -1,12 +1,22 @@
#ifndef MSMSTREAM_H
#define MSMSTREAM_H
#include "dolphin/types.h"
#include "game/msm.h"
s32 msmStreamGetStatus(int streamNo);
void msmStreamSetMasterVolume(s32 arg0);
void msmStreamStopAll(s32 speed);
s32 msmStreamStop(int streamNo, s32 speed);
int msmStreamPlay(int streamId, MSM_STREAMPARAM* streamParam);
void msmStreamPeriodicProc(void);
void msmStreamSetOutputMode(s8);
void msmStreamSetOutputMode(s32 arg0);
void msmStreamAmemFree(void);
s32 msmStreamAmemAlloc(void);
s32 msmStreamInit(char *);
s32 msmStreamInit(char* arg0);
void msmStreamPauseOff(s32 arg0);
void msmStreamPauseOn(s32 streamNo, s32 arg1);
s32 msmStreamPackStartStereo(s32 arg0, MSM_STREAMPARAM* arg1, s32 arg2);
s32 msmStreamPackStartMono(s32 arg0, MSM_STREAMPARAM* arg1, s32 arg2);
void msmStreamSlotOff(s32 streamNo);
#endif

189
include/msm/msmsys.h Executable file
View file

@ -0,0 +1,189 @@
#ifndef MSMSYS_H
#define MSMSYS_H
#include "game/msm.h" // TODO remove, only for decomp
#include "dolphin.h"
typedef struct {
u32 tempDisableFX;
f32 coloration;
f32 mix;
f32 time;
f32 damping;
f32 preDelay;
f32 crosstalk;
} SubStructRev;
typedef struct {
u32 baseDelay;
u32 variation;
u32 period;
} SubStructCh;
typedef struct {
u32 delay[3];
u32 feedback[3];
u32 output[3];
} SubDelay;
typedef struct _unkSubStruct {
s8 unk0;
union {
SubStructRev rev;
SubStructCh ch;
SubDelay delay;
};
} unkSubStruct;
typedef union {
SND_AUX_REVERBHI revHi;
SND_AUX_REVERBSTD revStd;
SND_AUX_CHORUS ch;
SND_AUX_DELAY delay;
} UnkSndAuxUnion; // Size 0x1E0
typedef struct _unkSubStruct3 {
char unk[0x4];
s32 unk4;
char unk8[0x8];
s32 unk10; // offset
u32 unk14; // length
s32 unk18; // offset
u32 unk1C; // length
s32 unk20;
s32 unk24;
s32 unk28;
s32 unk2C;
s32 unk30;
s32 unk34;
s32 unk38;
char unk3C[4];
s32 unk40;
char unk44[4];
s32 unk48;
char unk4C[4];
s32 unk50;
s32 unk54;
char unk58[8];
} unkSubStruct3; // sizeof 0x60
typedef struct _unkStruct3 {
s32 unk0;
s32 unk4;
s32 unk8;
} unkStruct3;
typedef struct _sndInitData {
s8 unk0;
s8 unk1;
s8 unk2;
s8 unk3;
s16 unk4;
s16 unk6;
s8 unk8;
s8 unk9;
s8 unkA;
s8 unkB;
char unkC[2];
s8 unkE;
s8 unkF;
u32 unk10;
s32 unk14;
s32 unk18;
s32 unk1C;
s32 unk20;
char unk24[4];
s8 unk28;
s8 unk29[10]; // size unknown
} sndInitData;
typedef struct {
/* 0x00 */ s8 unk00;
/* 0x01 */ s8 unk01;
/* 0x02 */ char unk02[2];
/* 0x04 */ u32 unk04;
/* 0x08 */ void *unk08;
} UnkStructSys43C; // Size 0xC
typedef struct _unkStruct4 {
SND_GROUPID unk0;
s8 unk2;
s8 unk3;
s32 unk4;
s32 unk8;
s32 unkC;
s32 unk10;
char unk14[0xC];
} unkStruct4; // Size 0x20
typedef struct {
/* 0x00 */ s8 unk00;
/* 0x01 */ s8 unk01;
/* 0x02 */ s8 unk02[1]; // unknown array length
} UnkSys3F0Struct; // Size unknown
typedef struct _sysData {
s32 unk0;
s8 unk4;
s8 unk5;
s8 unk6;
s8 unk7;
s32 unk8;
unkSubStruct3 *unkC;
sndInitData *unk10;
unkSubStruct *unk14;
s8 unk18[2];
s8 unk1A;
s8 unk1B;
UnkSndAuxUnion unk1C[2]; // 0: userA, 1: userB
s8 unk3DC;
char unk3DD[3];
s32 unk3E0;
u32 unk3E4;
u32 unk3E8;
unkStruct4 *unk3EC;
UnkSys3F0Struct *unk3F0;
s8 unk3F4;
unkStruct3 *unk3F8[1]; // unknown array length
char unk3FC[0x38];
s8 unk434;
u8 unk435;
s8 unk436;
char unk437[1];
void *unk438;
UnkStructSys43C unk43C[1]; // unknown array length
char unk448[0x24];
s8 unk46C;
u8 unk46D;
s8 unk46E;
char unk46F[1];
void *unk470;
UnkStructSys43C unk474[1]; // unknown array length
char unk480[0x6C];
s32 unk4EC;
BOOL unk4F0;
AIDCallback unk4F4;
s32 unk4F8;
} sysData;
s32 msmSysSearchGroupStack(s32 arg0, s32 arg1);
s32 msmSysGroupInit(DVDFileInfo *arg0);
void msmSysIrqDisable(void);
void msmSysIrqEnable(void);
BOOL msmSysCheckBaseGroup(s32 arg0);
void *msmSysGetGroupDataPtr(s32 arg0);
BOOL msmSysCheckLoadGroupID(s32 arg0);
void msmSysRegularProc(void);
s32 msmSysGetOutputMode(void);
s32 msmSysSetOutputMode(SND_OUTPUTMODE mode);
s32 msmSysSetAux(s32 arg0, s32 arg1);
s32 msmSysGetSampSize(BOOL baseGrp);
s32 msmSysDelGroupAll(void);
s32 msmSysDelGroupBase(s32 grpNum);
s32 msmSysLoadGroupBase(s32 arg0, void *arg1);
s32 msmSysLoadGroupSet(s32 arg0, void *arg1);
void msmSysCheckInit(void);
s32 msmSysInit(MSM_INIT *init, MSM_ARAM *aram);
#endif

View file

@ -1,19 +1,39 @@
#ifndef STDARG_H
#define STDARG_H
#ifndef _MSL_COMMON_STDARG_H
#define _MSL_COMMON_STDARG_H
#ifdef __cplusplus
extern "C" {
#endif
#ifdef __MWERKS__
typedef struct {
char gpr;
char fpr;
char reserved[2];
char* input_arg_area;
char* reg_save_area;
char gpr;
char fpr;
char reserved[2];
char* input_arg_area;
char* reg_save_area;
} __va_list[1];
typedef __va_list va_list;
#ifndef __MWERKS__
extern void __builtin_va_info(va_list*);
#endif
void* __va_arg(va_list v_list, unsigned char type);
#define va_start(ap, fmt) ((void) fmt, __builtin_va_info(&ap))
#define va_arg(ap, t) (*((t*) __va_arg(ap, _var_arg_typeof(t))))
#define va_end(ap) (void) 0
#define va_start(ap, fmt) ((void)fmt, __builtin_va_info(&ap))
#define va_arg(ap, t) (*((t*)__va_arg(ap, _var_arg_typeof(t))))
#define va_end(ap) (void)0
#endif
#else
typedef __builtin_va_list va_list;
#define va_start(v, l) __builtin_va_start(v, l)
#define va_end(v) __builtin_va_end(v)
#define va_arg(v, l) __builtin_va_arg(v, l)
#endif
#ifdef __cplusplus
}
#endif
#endif /* _MSL_COMMON_STDARG_H */

View file

@ -10,8 +10,13 @@ extern "C" {
/* These break 1.2.5 */
//typedef __typeof__(sizeof(0)) size_t;
//typedef __typeof__((char*)0 - (char*)0) ptrdiff_t;
#ifdef __INTELLISENSE__
typedef unsigned int size_t;
typedef int ptrdiff_t;
#else
typedef unsigned long size_t;
typedef long ptrdiff_t;
#endif
#ifndef NULL
#define NULL 0L
#endif
@ -20,4 +25,4 @@ typedef long ptrdiff_t;
}
#endif
#endif
#endif

View file

@ -15,4 +15,4 @@ char* strncpy(char* dst, const char* src, size_t n);
char* strcpy(char* dst, const char* src);
size_t strlen(const char* str);
#endif
#endif