more progress + headers

This commit is contained in:
Ethan Roseman 2023-09-20 17:12:41 +09:00
parent a05a2858a1
commit 97944c7491
No known key found for this signature in database
GPG Key ID: 27F9FCEB8E4969BD
62 changed files with 12820 additions and 147 deletions

3
.gitignore vendored
View File

@ -3,6 +3,7 @@ asm/
assets/
build/
permuter_settings.toml
undefined_syms_auto.txt
undefined_funcs_auto.txt
@ -14,3 +15,5 @@ SLPS_251.05*
*.iso
*.bin
*.o
ctx.c
ctx.c.m2c

View File

@ -10,6 +10,7 @@
"expected/": true
},
"files.associations": {
"common.h": "c"
"common.h": "c",
"vumacros.h": "c"
},
}

View File

@ -32,6 +32,10 @@ ELF_PATH = f"build/{BASENAME}"
MAP_PATH = f"build/{BASENAME}.map"
PRE_ELF_PATH = f"build/{BASENAME}.elf"
COMMON_INCLUDES = "-Iinclude"
COMPILER_DIR = f"{TOOLS_DIR}/cc/ee-gcc2.96/bin"
COMPILE_CMD = f"{COMPILER_DIR}/ee-gcc -c -B {COMPILER_DIR}/ee- {COMMON_INCLUDES} -O2 -G0 -g"
WIBO_VER = "0.6.0"
def exec_shell(command: List[str]) -> str:
@ -46,6 +50,18 @@ def clean():
shutil.rmtree("assets", ignore_errors=True)
shutil.rmtree("build", ignore_errors=True)
def write_permuter_settings():
with open("permuter_settings.toml", "w") as f:
f.write(f"""compiler_command = "{COMPILE_CMD}"
assembler_command = "mips-linux-gnu-as -march=r5900 -mabi=eabi -Iinclude"
compiler_type = "gcc"
[preserve_macros]
[decompme.compilers]
"tools/build/cc/gcc/gcc" = "ee-gcc2.96"
""")
def build_stuff(linker_entries: List[LinkerEntry]):
built_objects: Set[Path] = set()
@ -75,8 +91,6 @@ def build_stuff(linker_entries: List[LinkerEntry]):
ninja = ninja_syntax.Writer(open(str(ROOT / "build.ninja"), "w"), width=9999)
COMMON_INCLUDES = "-Iinclude"
COMPILER_DIR = f"{TOOLS_DIR}/cc/ee-gcc2.96/bin"
# Rules
cross = "mips-linux-gnu-"
@ -92,7 +106,7 @@ def build_stuff(linker_entries: List[LinkerEntry]):
ninja.rule(
"cc",
description="cc $in",
command=f"{COMPILER_DIR}/ee-gcc -c -B {COMPILER_DIR}/ee- {COMMON_INCLUDES} -O2 -G0 -g $in -o $out && {cross}strip $out -N dummy-symbol-name",
command=f"{COMPILE_CMD} $in -o $out && {cross}strip $out -N dummy-symbol-name",
)
ninja.rule(
@ -182,3 +196,5 @@ if __name__ == "__main__":
linker_entries = split.linker_writer.entries
build_stuff(linker_entries)
write_permuter_settings()

View File

@ -13,5 +13,5 @@ def apply(config, args):
"assets",
]
config["make_command"] = ["ninja"]
config["objdump_flags"] = []
config["objdump_flags"] = ["-Mfpr-names=32"]
config["expected_dir"] = f"expected/"

View File

@ -15,8 +15,18 @@ typedef unsigned long u64;
typedef float f32;
#define UNK_TYPE s32
#define UNK_PTR void*
#define UNK_RET void
#define UNK_FUN_ARG void(*)(void)
#define UNK_FUN_PTR(name) void(*name)(void)
#define UNK_ARGS
#define NULL 0
#define TRUE 1
#define FALSE 0
f32 atan2f(f32, f32);
f32 cosf(f32);
#endif /* COMMON_H */

1
include/ee/README.md Normal file
View File

@ -0,0 +1 @@
The headers in this directory originated from the 2.4.3 version of the PS2 SDK, found on archive.org.

75
include/ee/deci2.h Normal file
View File

@ -0,0 +1,75 @@
/* SCE CONFIDENTIAL
"PlayStation 2" Programmer Tool Runtime Library Release 2.5
*/
/*
* Emotion Engine Library
* Version 0.02
* Copyright (C) 1999 Sony Computer Entertainment Inc., All Rights Reserved.
*
* libkernel - deci2.h
* user side DECI2 API library
*
* Version Date Design Log
* --------------------------------------------------------------------
* 0.00 03/26/99 koji 1st version
* 0.01 04/26/99 koji fucntion table to bss section
* 0.02 06/16/99 koji changed for new specification
* 0.03 07/05/99 koji changed function prototypes
*/
#ifndef _DECI2_H
#define _DECI2_H
#ifdef __cplusplus
extern "C" {
#endif
// deci2 header
typedef struct {
unsigned short len;
unsigned short rsvd;
unsigned short proto;
unsigned char src;
unsigned char dest;
} sceDeci2Hdr;
// events value for protocol handler
#define DECI2_READ 1
#define DECI2_READDONE 2
#define DECI2_WRITE 3
#define DECI2_WRITEDONE 4
#define DECI2_CHSTATUS 5
#define DECI2_ERROR 6
// error codes
#define DECI2_ERR_INVALID -1 // invalid argument
#define DECI2_ERR_INVALSOCK -2 // invalid socket descriptor
#define DECI2_ERR_ALREADYUSE -3 // protocol number already used
#define DECI2_ERR_MFILE -4 // too many open protocols
#define DECI2_ERR_INVALADDR -5 // invalid address for buffer
#define DECI2_ERR_PKTSIZE -6 // buffer is too small
#define DECI2_ERR_WOULDBLOCK -7 // blocks inspite of asynchronous
#define DECI2_ERR_ALREADYLOCK -8 // already lock
#define DECI2_ERR_NOTLOCKED -9 // not locked
#define DECI2_ERR_NOROUTE -10 // no route to host
#define DECI2_ERR_NOSPACE -11 // no room left on manager
#define DECI2_ERR_INVALHEAD -12 // invalid deci2 header
// function prototypes
int sceDeci2Open(unsigned short protocol, void *opt,
void (*handler)(int event, int param, void *opt));
int sceDeci2Close(int s);
int sceDeci2ReqSend(int s, char dest);
void sceDeci2Poll(int s);
int sceDeci2ExRecv(int s, void *buf, unsigned short len);
int sceDeci2ExSend(int s, void *buf, unsigned short len);
int sceDeci2ExReqSend(int s, char dest);
int sceDeci2ExLock(int s);
int sceDeci2ExUnLock(int s);
#ifdef __cplusplus
}
#endif
#endif _DECI2_H

102
include/ee/devfont.h Normal file
View File

@ -0,0 +1,102 @@
/* SCE CONFIDENTIAL
"PlayStation 2" Programmer Tool Runtime Library Release 2.5
*/
/*
* Emotion Engine Library
* Version 0.01
* Shift-JIS
*
* Copyright (C) 1998-1999 Sony Computer Entertainment Inc.
* All Rights Reserved.
*
* libdev - devfont.h
* develop library
*
* Version Date Design Log
* --------------------------------------------------------------------
* 0.01 Mar,29,1999 shibuya
* 0.02 Jun,11,1999 shibuya
*/
#ifndef __devfont__
#define __devfont__
#include <eekernel.h>
#include <eetypes.h>
#include <eestruct.h>
#include <libdma.h>
#include <libgraph.h>
#include <libgifpk.h>
#ifdef __cplusplus
extern "C" {
#endif
// コンソールライブラリを初期化
void sceDevConsInit(void);
// コンソールをオープン。つしかない。サイズの最大は80 x 64キャラクタ
int sceDevConsOpen(u_int gs_x, u_int gs_y, u_int chr_w, u_int chr_h);
// コンソールをクローズ
void sceDevConsClose(int cd);
// コンソールのイメージをパケットにつける。
void sceDevConsRef(int cd, sceGifPacket* pPacket);
// コンソールのイメージを描画
void sceDevConsDraw(int cd);
// コンソールのイメージを描画(スクラッチパッド使用)
void sceDevConsDrawS(int cd);
// コンソールクリア
void sceDevConsClear(int cd);
// コンソールへ文字表示
u_int sceDevConsPrintf(int cd, const char* str, ...);
// フォントのカラーテーブルの変更
void sceDevConsSetColor(int cd, u_char c, u_char r, u_char g, u_char b);
// カーソル位置を変更
void sceDevConsLocate(int cd, u_int lx, u_int ly);
// カーソル位置に1文字出力
void sceDevConsPut(int cd, u_char c, u_char a);
// カーソル位置から1文字取得(上位8ビットにはアトリビュート)
u_short sceDevConsGet(int cd);
// アトリビュート(色)変更
void sceDevConsAttribute(int cd, u_char col);
// 矩形領域クリア
void sceDevConsClearBox(int cd, int x, int y, u_int w, u_int h);
// 矩形領域移動
void sceDevConsMove(int cd, int dx, int dy, int sx, int sy, u_int w, u_int h);
// ロールアップ
void sceDevConsRollup(int cd, u_int line);
// 枠つきメッセージ表示
void sceDevConsMessage(int cd, int x, int y, char const* str);
// フレーム
void sceDevConsFrame(int cd, int x, int y, u_int w, u_int h);
// 旧ライブラリサポート
u_long128* sceDevFont(u_long128*, int, int, int, char *, int);
/* packet, x, y, z(無効), str, ctxt */
#ifdef __cplusplus
}
#endif
#endif /* __devfont__ */

58
include/ee/devgif.h Normal file
View File

@ -0,0 +1,58 @@
/* SCE CONFIDENTIAL
"PlayStation 2" Programmer Tool Runtime Library Release 2.5
*/
/*
* Emotion Engine Library
* Version 0.01
* Shift-JIS
*
* Copyright (C) 1998-1999 Sony Computer Entertainment Inc.
* All Rights Reserved.
*
* libdev - devgif.h
* develop library
*
* Version Date Design Log
* --------------------------------------------------------------------
* 0.01 Mar,29,1999 shibuya
*/
#ifndef __devgif__
#define __devgif__
#ifdef __cplusplus
extern "C" {
#endif
typedef struct{
u_long128 tag;
u_int stat;
u_int count;
u_int p3count;
u_int p3tag;
u_int pad;
}sceDevGifCnd;
void sceDevGifReset(void);
int sceDevGifPause(void);
int sceDevGifContinue(void);
void sceDevGifPutImtMode(int);
u_int sceDevGifGetImtMode(void);
int sceDevGifPutP3msk(int enable);
int sceDevGifGetP3msk(void);
int sceDevGifGetCnd(sceDevGifCnd *);
int sceDevGifPutFifo(u_long128 *addr, int n);
#ifdef __cplusplus
}
#endif
#endif

63
include/ee/devvif0.h Normal file
View File

@ -0,0 +1,63 @@
/* SCE CONFIDENTIAL
"PlayStation 2" Programmer Tool Runtime Library Release 2.5
*/
/*
* Emotion Engine Library
* Version 0.01
* Shift-JIS
*
* Copyright (C) 1998-1999 Sony Computer Entertainment Inc.
* All Rights Reserved.
*
* libdev - devvif0.h
* develop library
*
* Version Date Design Log
* --------------------------------------------------------------------
* 0.01 Mar,29,1999 shibuya
*/
#ifndef __devvif0__
#define __devvif0__
#ifdef __cplusplus
extern "C" {
#endif
typedef struct{
u_int row[4];
u_int col[4];
u_int mask;
u_int code;
u_int stat;
u_short itop,itops;
u_short mark;
u_short num;
u_char error;
u_char cl,wl;
u_char cmod;
u_char pad;
}sceDevVif0Cnd;
void sceDevVif0Reset(void);
int sceDevVif0Pause(int mode);
int sceDevVif0Continue(void);
u_int sceDevVif0PutErr(int interrupt, int miss1, int miss2);
u_int sceDevVif0GetErr(void);
int sceDevVif0GetCnd(sceDevVif0Cnd *);
int sceDevVif0PutFifo(u_long128 *addr, int n);
#ifdef __cplusplus
}
#endif
#endif

66
include/ee/devvif1.h Normal file
View File

@ -0,0 +1,66 @@
/* SCE CONFIDENTIAL
"PlayStation 2" Programmer Tool Runtime Library Release 2.5
*/
/*
* Emotion Engine Library
* Version 0.01
* Shift-JIS
*
* Copyright (C) 1998-1999 Sony Computer Entertainment Inc.
* All Rights Reserved.
*
* libdev - devvif1.h
* develop library
*
* Version Date Design Log
* --------------------------------------------------------------------
* 0.01 Mar,29,1999 shibuya
*/
#ifndef __devvif1__
#define __devvif1__
#ifdef __cplusplus
extern "C" {
#endif
typedef struct{
u_int row[4];
u_int col[4];
u_int mask;
u_int code;
u_int stat;
u_short itop,itops;
u_short base,offset;
u_short top,tops;
u_short mark;
u_short num;
u_char error;
u_char cl,wl;
u_char cmod;
u_char pad;
}sceDevVif1Cnd;
void sceDevVif1Reset(void);
int sceDevVif1Pause(int mode);
int sceDevVif1Continue(void);
u_int sceDevVif1PutErr(int interrupt, int miss1, int miss2);
u_int sceDevVif1GetErr(void);
int sceDevVif1GetCnd(sceDevVif1Cnd *);
int sceDevVif1PutFifo(u_long128 *addr, int n);
int sceDevVif1GetFifo(u_long128 *addr, int n);
#ifdef __cplusplus
}
#endif
#endif

62
include/ee/devvu0.h Normal file
View File

@ -0,0 +1,62 @@
/* SCE CONFIDENTIAL
"PlayStation 2" Programmer Tool Runtime Library Release 2.5
*/
/*
* Emotion Engine Library
* Version 0.01
* Shift-JIS
*
* Copyright (C) 1998-1999 Sony Computer Entertainment Inc.
* All Rights Reserved.
*
* libdev - devvu0.h
* develop library
*
* Version Date Design Log
* --------------------------------------------------------------------
* 0.01 Mar,29,1999 shibuya
*/
#ifndef __devvu0__
#define __devvu0__
#ifdef __cplusplus
extern "C" {
#endif
typedef struct{
u_long128 vf[32];
u_int status;
u_int mac;
u_int clipping;
u_int r, i, q;
u_short vi[16];
}sceDevVu0Cnd;
void sceDevVu0Reset(void);
int sceDevVu0Pause(void);
int sceDevVu0Continue(void);
void sceDevVu0PutDBit(int bit);
void sceDevVu0PutTBit(int bit);
int sceDevVu0GetDBit(void);
int sceDevVu0GetTBit(void);
void sceDevVu0Exec(u_short addr);
u_short sceDevVu0GetTpc(void);
int sceDevVu0GetCnd(sceDevVu0Cnd *cnd);
int sceDevVu0PutCnd(sceDevVu0Cnd *cnd);
#ifdef __cplusplus
}
#endif
#endif

62
include/ee/devvu1.h Normal file
View File

@ -0,0 +1,62 @@
/* SCE CONFIDENTIAL
"PlayStation 2" Programmer Tool Runtime Library Release 2.5
*/
/*
* Emotion Engine Library
* Version 0.01
* Shift-JIS
*
* Copyright (C) 1998-1999 Sony Computer Entertainment Inc.
* All Rights Reserved.
*
* libdev - devvu1.h
* develop library
*
* Version Date Design Log
* --------------------------------------------------------------------
* 0.01 Mar,29,1999 shibuya
*/
#ifndef __devvu1__
#define __devvu1__
#ifdef __cplusplus
extern "C" {
#endif
typedef struct{
u_long128 vf[32];
u_int status;
u_int mac;
u_int clipping;
u_int r, i, q, p;
u_short vi[16];
}sceDevVu1Cnd;
void sceDevVu1Reset(void);
int sceDevVu1Pause(void);
int sceDevVu1Continue(void);
void sceDevVu1PutDBit(int bit);
void sceDevVu1PutTBit(int bit);
int sceDevVu1GetDBit(void);
int sceDevVu1GetTBit(void);
void sceDevVu1Exec(u_short addr);
u_short sceDevVu1GetTpc(void);
int sceDevVu1GetCnd(sceDevVu1Cnd *cnd);
int sceDevVu1PutCnd(sceDevVu1Cnd *cnd);
#ifdef __cplusplus
}
#endif
#endif

292
include/ee/eekernel.h Normal file
View File

@ -0,0 +1,292 @@
/* SCE CONFIDENTIAL
"PlayStation 2" Programmer Tool Runtime Library Release 2.5
*/
/*
* Emotion Engine Library
* Version 2.2.1
* Shift-JIS
*
* Copyright (C) 1998-1999 Sony Computer Entertainment Inc.
* All Rights Reserved.
*
* eekernel.h
* develop library
*
* Version Date Design Log
* --------------------------------------------------------------------
* 0.3.0 Jun.18.1999 horikawa add syscall
* 0.4.0 Jul.15.1999 horikawa add syscall
* 0.5.0 Aug.12.1999 horikawa add syscall
* 1.1.0 Oct.12.1999 horikawa add syscall
* 1.2.0 Nov.03.1999 horikawa add syscall
* 1.4.0 Jan.19.2000 horikawa modified to 'DI()'
* 1.5.0 Feb.29.2000 horikawa modified to syscalls
* 1.6.0 Feb.29.2000 horikawa AddIntcHandler2
* AddDmacHandler2
* SetDebugHandler
* 2.0.0 Aug.17.2000 horikawa ExpandScratchPad
* 2.2.0 Dec.12.2000 horikawa DIntr/EIntr
* 2.2.1 Jan.23.2001 akiyuki added void, const
* and __asm__
*/
#ifndef _eekernel_h_
#define _eekernel_h_
#include <eetypes.h>
#define THREAD_ERROR (-1)
#define MAX_THREADS 256
#define MAX_SEMAPHORES 256
#define MAX_PRIORITY 128
#define MAX_HANDLERS 128
#define MAX_ALARMS 64
#ifdef __cplusplus
extern "C" {
#endif
int EIntr(void); /* System used */
int DIntr(void); /* System used */
#ifdef __cplusplus
}
#endif
#define EI EIntr
#define DI DIntr
#ifndef EI
#define EI() __asm__ volatile("ei")
#endif
#ifndef DI
#define DI() \
{ \
u_int stat; \
do { \
__asm__ volatile (".p2align 3"); \
__asm__ volatile ("di"); \
__asm__ volatile ("sync.p"); \
__asm__ volatile ("mfc0 %0, $12" : "=r"(stat):); \
} while (stat & 0x00010000); \
}
#endif
#define ExitHandler() __asm__ volatile("sync.l; ei")
#define INST_CACHE 2
#define DATA_CACHE 1
#define CacheOn() EnableCache(INST_CACHE | DATA_CACHE)
#define CacheOff() DisableCache(INST_CACHE | DATA_CACHE)
#define WRITEBACK_DCACHE 0
#define INVALIDATE_DCACHE 1
#define INVALIDATE_ICACHE 2
#define INVALIDATE_CACHE 3
#define DOUBLE_ISSUE_ON 0
#define NON_BLOCKING_LOAD_ON 1
#define BRANCH_PREDICTION_ON 2
#define DOUBLE_ISSUE_OFF 3
#define NON_BLOCKING_LOAD_OFF 4
#define BRANCH_PREDICTION_OFF 5
#define INTC_GS 0
#define INTC_SBUS 1
#define INTC_VBON 2 /* old fashioned */
#define INTC_VBLANK_S 2
#define INTC_VBOF 3 /* old fashioned */
#define INTC_VBLANK_E 3
#define INTC_VIF0 4
#define INTC_VIF1 5
#define INTC_VU0 6
#define INTC_VU1 7
#define INTC_IPU 8
#define INTC_TIM0 9
#define INTC_TIM1 10
#define DMAC_VIF0 0
#define DMAC_VIF1 1
#define DMAC_GIF 2
#define DMAC_FROM_IPU 3
#define DMAC_TO_IPU 4
#define DMAC_FROM_SPR 8
#define DMAC_TO_SPR 9
#define DMAC_CIS 13 /* Channel interrupt */
#define DMAC_MEIS 14 /* MemFIFO empty interrupt */
#define DMAC_BEIS 15 /* Bus error interrupt */
#define THS_RUN 0x01
#define THS_READY 0x02
#define THS_WAIT 0x04
#define THS_SUSPEND 0x08
#define THS_WAITSUSPEND 0x0c
#define THS_DORMANT 0x10
#define INIT_DMAC 0x01
#define INIT_VU1 0x02
#define INIT_VIF1 0x04
#define INIT_GIF 0x08
#define INIT_VU0 0x10
#define INIT_VIF0 0x20
#define INIT_IPU 0x40
#define TLB_MODIFICATION 1
#define TLB_REFILL_LOAD 2
#define TLB_REFILL_STORE 3
#ifdef __cplusplus
extern "C" {
#endif
struct ThreadParam {
int status;
void (*entry)(void *);
void *stack;
int stackSize;
void *gpReg;
int initPriority;
int currentPriority;
u_int attr;
u_int option;
int waitType;
int waitId;
int wakeupCount;
};
struct SemaParam {
int currentCount;
int maxCount;
int initCount;
int numWaitThreads;
u_int attr;
u_int option;
};
extern void *_gp;
/*
* COP0
*/
int EnableCache(int); /* Future Use */
int DisableCache(int); /* Future Use */
void FlushCache(int);
void iFlushCache(int);
void SyncDCache(void *, void *);
void iSyncDCache(void *, void *);
void InvalidDCache(void *, void *);
void iInvalidDCache(void *, void *);
u_int GetCop0(int);
u_int iGetCop0(int);
u_int CpuConfig(u_int); /* Future Use */
/*
* Multi Thread
*/
int InitThread(void);
int CreateThread(struct ThreadParam *);
int DeleteThread(int);
int StartThread(int, void *arg);
void ExitThread(void);
void ExitDeleteThread(void);
int TerminateThread(int);
int iTerminateThread(int);
int ChangeThreadPriority(int, int);
int iChangeThreadPriority(int, int);
int RotateThreadReadyQueue(int);
int iRotateThreadReadyQueue(int);
int ReleaseWaitThread(int);
int iReleaseWaitThread(int);
int GetThreadId(void);
int ReferThreadStatus(int, struct ThreadParam *);
int iReferThreadStatus(int, struct ThreadParam *);
int SleepThread(void);
int WakeupThread(int);
int iWakeupThread(int);
int CancelWakeupThread(int);
int iCancelWakeupThread(int);
int SuspendThread(int);
int iSuspendThread(int);
int ResumeThread(int);
int iResumeThread(int);
void *EndOfHeap(void); /* System Use */
/*
* Semaphore
*/
int CreateSema(struct SemaParam *);
int DeleteSema(int);
int SignalSema(int);
int iSignalSema(int);
int WaitSema(int);
int PollSema(int);
int iPollSema(int);
int ReferSemaStatus(int, struct SemaParam *);
int iReferSemaStatus(int, struct SemaParam *);
/*
* V-sync
*/
void SetVSyncCount(u_int *); /* old fashioned */
void VSync(void); /* System Use */
/*
* Interrupt
*/
int EnableIntc(int);
int iEnableIntc(int);
int DisableIntc(int);
int iDisableIntc(int);
int EnableDmac(int);
int iEnableDmac(int);
int DisableDmac(int);
int iDisableDmac(int);
int SetAlarm(u_short, void (*)(int, u_short, void *), void *);
int iSetAlarm(u_short, void (*)(int, u_short, void *), void *);
int ReleaseAlarm(int);
int iReleaseAlarm(int);
int AddIntcHandler(int, int (*)(int), int);
int AddIntcHandler2(int, int (*)(int, void *, void *), int, void *);
int RemoveIntcHandler(int, int);
int AddDmacHandler(int, int (*)(int), int);
int AddDmacHandler2(int, int (*)(int, void *, void *), int, void *);
int RemoveDmacHandler(int, int);
int AddSbusIntcHandler(int, void (*)(int ca));
int RemoveSbusIntcHandler(int);
int Interrupt2Iop(int);
void *SetDebugHandler(
int,
void (*h)(u_int, u_int, u_int, u_int, u_int, u_long128 *)
);
void InitTLBFunctions(void);
int ExpandScratchPad(u_int);
/*
* Others
*/
void LoadExecPS2(const char *, int, char *[]);
void Exit(int n);
void ResetEE(u_int n); /* System Use */
int ExecPS2(void *, void *, int, char *[]); /* System Use */
void SetGsCrt(short, short, short); /* System Use */
int MachineType(void); /* System Use */
int iMachineType(void); /* System Use */
void PSMode(void); /* System Use */
int GetMemorySize(void); /* System Use */
int Deci2Call(int, u_int *); /* System Use */
u_long GsGetIMR(void); /* System Use */
u_long GsPutIMR(u_long); /* System Use */
void scePrintf(const char *fmt, ...);
#ifdef __cplusplus
}
#endif
#endif /* _eekernel_h_ */

3219
include/ee/eeregs.h Normal file

File diff suppressed because it is too large Load Diff

1537
include/ee/eestruct.h Normal file

File diff suppressed because it is too large Load Diff

47
include/ee/eetypes.h Normal file
View File

@ -0,0 +1,47 @@
/* SCE CONFIDENTIAL
"PlayStation 2" Programmer Tool Runtime Library Release 2.5
*/
/*
* Emotion Engine Library
* Version 0.01
* Shift-JIS
*
* Copyright (C) 1998-1999 Sony Computer Entertainment Inc.
* All Rights Reserved.
*
* eetypes.h
* develop library
*
* Version Date Design Log
* --------------------------------------------------------------------
* 0.1.0
* 0.3.0 June.05 horikawa required of M.W.
*/
#ifndef _eetypes_h_
#define _eetypes_h_
#ifndef _SYS_TYPES_H
typedef unsigned char u_char;
typedef unsigned short u_short;
typedef unsigned int u_int;
typedef unsigned long u_long;
#endif
#ifdef __GNUC__
typedef int long128 __attribute__ ((mode (TI)));
typedef unsigned int u_long128 __attribute__ ((mode (TI)));
#endif
#ifndef FALSE
#define FALSE 0
#endif
#ifndef TRUE
#define TRUE (!FALSE)
#endif
#ifndef NULL
#define NULL 0
#endif
#endif /* _eetypes_h_ */

35
include/ee/libdbc.h Normal file
View File

@ -0,0 +1,35 @@
/* SCE CONFIDENTIAL
"PlayStation 2" Programmer Tool Runtime Library Release 2.5
*/
/*
* device basic control library
* Version 1.0
* Shift-JIS
*
* Copyright (C) 2000,2001 Sony Computer Entertainment Inc.
* All Rights Reserved.
*
* libdbc - libdbc.h
* header file of libdbc
*
* Version Date Design Log
* --------------------------------------------------------------------
* 0.00 2000-10- 1 makoto the first version
* 1.00 2001- 6-13 iwano modify for release
*/
#ifndef _LIBDBC_H_
#define _LIBDBC_H_
#if defined(__LANGUAGE_C_PLUS_PLUS)||defined(__cplusplus)||defined(c_plusplus)
extern "C" {
#endif
int sceDbcInit( void );
int sceDbcEnd( void );
#if defined(__LANGUAGE_C_PLUS_PLUS)||defined(__cplusplus)||defined(c_plusplus)
}
#endif
#endif /* _LIBDBC_H_ */

41
include/ee/libdev.h Normal file
View File

@ -0,0 +1,41 @@
/* SCE CONFIDENTIAL
"PlayStation 2" Programmer Tool Runtime Library Release 2.5
*/
/*
* Emotion Engine Library
* Version 0.01
* Shift-JIS
*
* Copyright (C) 1998-1999 Sony Computer Entertainment Inc.
* All Rights Reserved.
*
* libdev - libdev.h
* include devvu0.h,devvu1.h,devgif.h devvif0.h devvif1.h devfont.h
*
* Version Date Design Log
* --------------------------------------------------------------------
* 0.01 Mar,29,1999 shibuya
*/
#ifndef __libdev__
#define __libdev__
#include <devvu0.h>
#include <devvu1.h>
#include <devgif.h>
#include <devvif0.h>
#include <devvif1.h>
#include <devfont.h>
/*
#ifdef __cplusplus
extern "C" {
#endif
#ifdef __cplusplus
}
#endif
*/
#endif

350
include/ee/libdma.h Normal file
View File

@ -0,0 +1,350 @@
/* SCE CONFIDENTIAL
"PlayStation 2" Programmer Tool Runtime Library Release 2.5
*/
/*
* Emotion Engine Library
* Version 0.12
* Shift-JIS
*
* Copyright (C) 2001 Sony Computer Entertainment Inc.
* All Rights Reserved.
*
* libdma - libdma.h
* header file of libdma
*
* Version Date Design Log
* --------------------------------------------------------------------
* 0.09 October.07.1998 suzu initial
* 0.10 March.25.1999 suzu use inline function
* 0.11 May,17,1999 suzu delete warnings
* 0.12 January,23,2001 akiyuki addition of prototype
* declaration and __inline__
* 0.13 Feb,16,2001 kumagae delete unused value declarasion
*/
#ifndef _LIB_DMA_H_
#define _LIB_DMA_H_
#include <eeregs.h>
#include <eetypes.h>
//
// Channels
//
#ifndef SCE_DMA_VIF0
#define SCE_DMA_VIF0 0
#define SCE_DMA_VIF1 1
#define SCE_DMA_GIF 2
#define SCE_DMA_fromIPU 3
#define SCE_DMA_toIPU 4
#define SCE_DMA_SIF0 5
#define SCE_DMA_SIF1 6
#define SCE_DMA_SIF2 7
#define SCE_DMA_fromSPR 8
#define SCE_DMA_toSPR 9
#endif
//
// DMA Tag
//
typedef struct _sceDmaTag {
u_short qwc; // transfer count
u_char mark; // mark
u_char id; // tag
struct _sceDmaTag *next; // next tag
u_int p[2]; // padding
} sceDmaTag __attribute__ ((aligned(16)));
//
// DMA Environmen
//
typedef struct {
u_char sts; // stall source
u_char std; // stall drain
u_char mfd; // MFIFO drain
u_char rcycle; // release cycle
u_short express; // express channel mask
u_short notify; // notify channel mask
u_short sqwc; // Interleave skip qword count
u_short tqwc; // Interleave transfer qword count
void *rbadr; // MFIFO Ring buffer address
u_int rbmsk; // MFIFO Ring buffer mask
} sceDmaEnv;
//
// Channel Attributes
//
typedef struct {
tD_CHCR chcr; u_int p0[3]; // channel control
void *madr; u_int p1[3]; // memory address
u_int qwc; u_int p2[3]; // transfer count
sceDmaTag *tadr; u_int p3[3]; // tag address
void *as0; u_int p4[3]; // address stack
void *as1; u_int p5[3]; // address stack
u_int p6[4]; // pad
u_int p7[4]; // pad
void *sadr; u_int p8[3]; // spr address
} sceDmaChan;
//
// prototypes
//
#ifdef __cplusplus
extern "C" {
#endif
int sceDmaReset(int mode);
int sceDmaPutEnv(sceDmaEnv *env);
sceDmaEnv *sceDmaGetEnv(sceDmaEnv *env);
void *sceDmaPutStallAddr(void *addr);
sceDmaChan *sceDmaGetChan(int id);
void sceDmaSend(sceDmaChan *d, void *tag);
void sceDmaSendN(sceDmaChan *d, void *addr, int size);
void sceDmaSendI(sceDmaChan *d, void *addr, int size);
void sceDmaRecv(sceDmaChan *d);
void sceDmaRecvN(sceDmaChan *d, void *addr, int size);
void sceDmaRecvI(sceDmaChan *d, void *addr, int size);
int sceDmaSync(sceDmaChan *d, int mode, int timeout);
int sceDmaWatch(sceDmaChan *d, void *addr, int mode, int timeout);
u_int sceDmaPause(sceDmaChan *d);
int sceDmaRestart(sceDmaChan *d, u_int chcr);
#ifdef __cplusplus
}
#endif
// select inline function strategy
#ifndef INLINE
#define INLINE extern __inline__
#endif
#define setADR(v,x) {if ((v)!=(void *)-1) (v)=(sceDmaTag *)(x);}
#define setQWC(v,x) (v)=(x)
#define setCHCR(v,m,d) (v).MOD=(m),(v).DIR=(d),(v).STR=1
#define settag(t,i,a,q) (t)->id=(i),(t)->next=(sceDmaTag *)(a),(t)->qwc=(u_short)(q)
// Tag manipulation
INLINE sceDmaTag *sceDmaGetNextTag(sceDmaTag *tag);
INLINE sceDmaTag *sceDmaGetNextTag(sceDmaTag *tag)
{
switch (tag->id&0x70) {
case 0x30:
case 0x40:
return(tag+1);
case 0x10:
return(tag+1+tag->qwc);
case 0x20:
case 0x50:
return(tag->next);
}
return(0);
}
INLINE void sceDmaAddExpress(sceDmaTag *tag);
INLINE void sceDmaAddExpress(sceDmaTag *tag)
{
sceDmaTag *ntag;
if ((ntag = sceDmaGetNextTag(tag)) != 0) {
tag ->id = (u_char)((tag->id&0xf0)|0x0c); // PCE: on
ntag->id = (u_char)((tag->id&0xf0)|0x08); // PCE: off
}
}
INLINE void *sceDmaAddRef(sceDmaTag **tag, int qwc, void *addr);
INLINE void *sceDmaAddRef(sceDmaTag **tag, int qwc, void *addr)
{
settag(*tag,0x30,addr,qwc);
(*tag)++;
return(addr);
}
INLINE void *sceDmaAddRefe(sceDmaTag **tag, int qwc, void *addr);
INLINE void *sceDmaAddRefe(sceDmaTag **tag, int qwc, void *addr)
{
settag(*tag,0x00,addr,qwc);
(*tag)++;
return(addr);
}
INLINE void *sceDmaAddRefs(sceDmaTag **tag, int qwc, void *addr);
INLINE void *sceDmaAddRefs(sceDmaTag **tag, int qwc, void *addr)
{
settag(*tag,0x40,addr,qwc);
(*tag)++;
return(addr);
}
INLINE void *sceDmaAddCont(sceDmaTag **tag, int qwc);
INLINE void *sceDmaAddCont(sceDmaTag **tag, int qwc)
{
void *ret;
settag(*tag,0x10,0,qwc);
ret = *tag+1;
(*tag) += qwc+1;
return(ret);
}
INLINE void *sceDmaAddNext(sceDmaTag **tag, int qwc, void *addr);
INLINE void *sceDmaAddNext(sceDmaTag **tag, int qwc, void *addr)
{
void *ret;
settag(*tag,0x20,addr,qwc);
ret = *tag+1;
*tag = (sceDmaTag *)addr;
return(ret);
}
INLINE void *sceDmaAddCall(sceDmaTag **tag, int qwc, void *ctag);
INLINE void *sceDmaAddCall(sceDmaTag **tag, int qwc, void *ctag)
{
void *ret;
settag(*tag,0x50,ctag,qwc);
ret = *tag+1;
(*tag) += qwc+1;
return(ret);
}
INLINE void *sceDmaAddRet(sceDmaTag **tag, int qwc);
INLINE void *sceDmaAddRet(sceDmaTag **tag, int qwc)
{
void *ret;
settag(*tag,0x60,0,qwc);
ret = *tag+1;
(*tag) += qwc+1;
return(ret);
}
INLINE void *sceDmaAddEnd(sceDmaTag **tag, int qwc, void *addr);
INLINE void *sceDmaAddEnd(sceDmaTag **tag, int qwc, void *addr)
{
void *ret;
settag(*tag,0x70,addr,qwc);
ret = *tag+1;
(*tag) += qwc+1;
return(ret);
}
INLINE void *sceDmaAddDest(sceDmaTag **tag, int qwc, void *addr);
INLINE void *sceDmaAddDest(sceDmaTag **tag, int qwc, void *addr)
{
void *ret;
settag(*tag,0x10,addr,qwc);
ret = *tag+1;
(*tag) += qwc+1;
return(ret);
}
INLINE void *sceDmaAddDests(sceDmaTag **tag, int qwc, void *addr);
INLINE void *sceDmaAddDests(sceDmaTag **tag, int qwc, void *addr)
{
void *ret;
settag(*tag,0x00,addr,qwc);
ret = *tag+1;
(*tag) += qwc+1;
return(ret);
}
INLINE void *sceDmaAddIRef(sceDmaTag **tag, int qwc, void *addr);
INLINE void *sceDmaAddIRef(sceDmaTag **tag, int qwc, void *addr)
{
settag(*tag,0x30|0x80,addr,qwc);
(*tag)++;
return(addr);
}
INLINE void *sceDmaAddIRefe(sceDmaTag **tag, int qwc, void *addr);
INLINE void *sceDmaAddIRefe(sceDmaTag **tag, int qwc, void *addr)
{
settag(*tag,0x00|0x80,addr,qwc);
(*tag)++;
return(addr);
}
INLINE void *sceDmaAddIRefs(sceDmaTag **tag, int qwc, void *addr);
INLINE void *sceDmaAddIRefs(sceDmaTag **tag, int qwc, void *addr)
{
settag(*tag,0x40|0x80,addr,qwc);
(*tag)++;
return(addr);
}
INLINE void *sceDmaAddICont(sceDmaTag **tag, int qwc);
INLINE void *sceDmaAddICont(sceDmaTag **tag, int qwc)
{
void *ret;
settag(*tag,0x10|0x80,0,qwc);
ret = *tag+1;
(*tag) += qwc+1;
return(ret);
}
INLINE void *sceDmaAddINext(sceDmaTag **tag, int qwc, void *addr);
INLINE void *sceDmaAddINext(sceDmaTag **tag, int qwc, void *addr)
{
void *ret;
settag(*tag,0x20|0x80,addr,qwc);
ret = *tag+1;
*tag = (sceDmaTag *)addr;
return(ret);
}
INLINE void *sceDmaAddICall(sceDmaTag **tag, int qwc, void *ctag);
INLINE void *sceDmaAddICall(sceDmaTag **tag, int qwc, void *ctag)
{
void *ret;
settag(*tag,0x50|0x80,ctag,qwc);
ret = *tag+1;
(*tag) += qwc+1;
return(ret);
}
INLINE void *sceDmaAddIRet(sceDmaTag **tag, int qwc);
INLINE void *sceDmaAddIRet(sceDmaTag **tag, int qwc)
{
void *ret;
settag(*tag,0x60|0x80,0,qwc);
ret = *tag+1;
(*tag) += qwc+1;
return(ret);
}
INLINE void *sceDmaAddIEnd(sceDmaTag **tag, int qwc, void *addr);
INLINE void *sceDmaAddIEnd(sceDmaTag **tag, int qwc, void *addr)
{
void *ret;
settag(*tag,0x70|0x80,addr,qwc);
ret = *tag+1;
(*tag) += qwc+1;
return(ret);
}
INLINE void *sceDmaAddIDest(sceDmaTag **tag, int qwc, void *addr);
INLINE void *sceDmaAddIDest(sceDmaTag **tag, int qwc, void *addr)
{
void *ret;
settag(*tag,0x10|0x80,addr,qwc);
ret = *tag+1;
(*tag) += qwc+1;
return(ret);
}
INLINE void *sceDmaAddIDests(sceDmaTag **tag, int qwc, void *addr);
INLINE void *sceDmaAddIDests(sceDmaTag **tag, int qwc, void *addr)
{
void *ret;
settag(*tag,0x00|0x80,addr,qwc);
ret = *tag+1;
(*tag) += qwc+1;
return(ret);
}
#undef setADR
#undef setQWC
#undef setCHCR
#undef settag
#undef INLINE
#endif

65
include/ee/libdmapk.h Normal file
View File

@ -0,0 +1,65 @@
/* SCE CONFIDENTIAL
"PlayStation 2" Programmer Tool Runtime Library Release 2.5
*/
/*
* Emotion Engine Library
* Version 0.01
* Shift-JIS
*
* Copyright (C) 1998-1999 Sony Computer Entertainment Inc.
* All Rights Reserved.
*
* libpkt - libdmapk.h
* dma packet support
*
* Version Date Design Log
* --------------------------------------------------------------------
* 0.01 Mar,26,1999 shibuya
*/
#ifndef __libdmapk__
#define __libdmapk__
#include <eekernel.h>
#ifdef __cplusplus
extern "C" {
#endif
typedef struct{
u_int *pCurrent;
u_long128 *pBase;
u_long128 *pDmaTag;
u_int pad03;
}sceDmaPacket;
void sceDmaPkInit(sceDmaPacket *pPacket, u_long128 *pBase);
void sceDmaPkReset(sceDmaPacket *pPacket);
u_long128 *sceDmaPkTerminate(sceDmaPacket *pPacket);
u_int sceDmaPkSize(sceDmaPacket *pPacket);
void sceDmaPkCnt(sceDmaPacket *pPacket, u_int opt1, u_int opt2, u_int flag);
void sceDmaPkRet(sceDmaPacket *pPacket, u_int opt1, u_int opt2, u_int flag);
void sceDmaPkEnd(sceDmaPacket *pPacket, u_int opt1, u_int opt2, u_int flag);
void sceDmaPkNext(sceDmaPacket *pPacket, u_long128 *pNext, u_int opt1, u_int opt2, u_int flag);
void sceDmaPkCall(sceDmaPacket *pPacket, u_long128 *pCall, u_int opt1, u_int opt2, u_int flag);
void sceDmaPkRefe(sceDmaPacket *pPacket, u_long128 *pRef, u_int size, u_int opt1, u_int opt2, u_int flag);
void sceDmaPkRef(sceDmaPacket *pPacket, u_long128 *pRef, u_int size, u_int opt1, u_int opt2, u_int flag);
void sceDmaPkRefs(sceDmaPacket *pPacket, u_long128 *pRef, u_int size, u_int opt1, u_int opt2, u_int flag);
u_int *sceDmaPkReserve(sceDmaPacket *pPacket, u_int count);
void sceDmaPkAddData(sceDmaPacket *pPacket, u_long128 data);
void sceDmaPkAddDataN(sceDmaPacket *pPacket, u_long128* pData, u_int count);
void sceDmaPkDump(sceDmaPacket *pPacket);
#ifdef __cplusplus
}
#endif
#endif /* __libdmapk__ */

78
include/ee/libgifpk.h Normal file
View File

@ -0,0 +1,78 @@
/* SCE CONFIDENTIAL
"PlayStation 2" Programmer Tool Runtime Library Release 2.5
*/
/*
* Emotion Engine Library
* Version 0.01
* Shift-JIS
*
* Copyright (C) 1998-1999 Sony Computer Entertainment Inc.
* All Rights Reserved.
*
* libpkt - libgifpk.h
* gif packet support
*
* Version Date Design Log
* --------------------------------------------------------------------
* 0.01 Mar,26,1999 shibuya
*/
#ifndef __libgifpk__
#define __libgifpk__
#include <eekernel.h>
#include <eestruct.h>
#ifdef __cplusplus
extern "C" {
#endif
typedef struct{
u_int *pCurrent;
u_long128 *pBase;
u_long128 *pDmaTag;
u_long *pGifTag;
}sceGifPacket;
void sceGifPkInit(sceGifPacket *pPacket, u_long128 *pBase);
void sceGifPkReset(sceGifPacket *pPacket);
u_long128 *sceGifPkTerminate(sceGifPacket *pPacket);
u_int sceGifPkSize(sceGifPacket *pPacket);
void sceGifPkCnt(sceGifPacket *pPacket, u_int opt1, u_int opt2, u_int flag);
void sceGifPkRet(sceGifPacket *pPacket, u_int opt1, u_int opt2, u_int flag);
void sceGifPkEnd(sceGifPacket *pPacket, u_int opt1, u_int opt2, u_int flag);
void sceGifPkNext(sceGifPacket *pPacket, u_long128 *pNext, u_int opt1, u_int opt2, u_int flag);
void sceGifPkCall(sceGifPacket *pPacket, u_long128 *pCall, u_int opt1, u_int opt2, u_int flag);
void sceGifPkRefe(sceGifPacket *pPacket, u_long128 *pRef, u_int size, u_int opt1, u_int opt2, u_int flag);
void sceGifPkRef(sceGifPacket *pPacket, u_long128 *pRef, u_int size, u_int opt1, u_int opt2, u_int flag);
void sceGifPkRefs(sceGifPacket *pPacket, u_long128 *pRef, u_int size, u_int opt1, u_int opt2, u_int flag);
u_int *sceGifPkReserve(sceGifPacket *pPacket, u_int count);
void sceGifPkOpenGifTag(sceGifPacket *pPacket, u_long128 gifTag);
void sceGifPkCloseGifTag(sceGifPacket *pPacket);
void sceGifPkAddGsData(sceGifPacket *pPacket, u_long data);
void sceGifPkAddGsDataN(sceGifPacket *pPacket, u_long *pData, u_int count);
void sceGifPkAddGsPacked(sceGifPacket* pPacket, u_long128 data);
void sceGifPkAddGsPackedN(sceGifPacket* pPacket, u_long128* pData, u_int count);
void sceGifPkAddGsAD(sceGifPacket *pPacket, u_int addr, u_long data);
void sceGifPkRefLoadImage(sceGifPacket *pPacket, u_short bp, u_char psm, u_short bw, u_long128 *image, u_int size, u_int x, u_int y, u_int w, u_int h);
void sceGifPkDump(sceGifPacket *pPacket);
#ifdef __cplusplus
}
#endif
#endif /* __libgifpk__ */

640
include/ee/libgp.h Normal file
View File

@ -0,0 +1,640 @@
/* SCE CONFIDENTIAL
"PlayStation 2" Programmer Tool Runtime Library Release 2.5.3
*/
/*
* Emotion Engine Library
* Version 0.2.0.0
* Shift-JIS
*
* Copyright (C) 2001 Sony Computer Entertainment Inc.
* All Rights Reserved.
*
* libgp - libgp.h
* header file of libgp
*
* Version Date Design Log
* --------------------------------------------------------------------
* 1.00
*/
/* libgp.h */
#ifndef _LIBGP_H
#define _LIBGP_H
#include <eeregs.h>
#include <eestruct.h>
#include <eetypes.h>
#include <libdma.h>
#include <libgraph.h>
#include <libvu0.h>
typedef struct _sceGpChain {
u_long128 *ot; /* chain のアドレス */
u_long128 *pKick; /* DMA 転送開始アドレス */
u_long128 *pEnd;
int resolution;
} sceGpChain;
/***********************************************
* prim packet
***********************************************/
typedef struct _sceGpAdc{ /* dummy */
int ADC;
int pad;
}sceGpAdc;
typedef union _sceGpReg{ /* registers for reglist mode */
sceGsPrim prim;
sceGsRgbaq rgbaq;
sceGsSt st;
sceGsUv uv;
sceGsXyzf xyzf;
sceGsXyz xyz;
sceGsTex0 tex0;
sceGsClamp clamp;
sceGsFog fog;
sceGpAdc adc;
u_long ul;
u_int ui[2];
} sceGpReg;
typedef union _sceGpPack{ /* registers for packed mode */
sceGifPackRgbaq rgbaq;
sceGifPackSt st;
sceGifPackUv uv;
sceGifPackXyzf xyzf;
sceGifPackXyz xyz;
sceGifPackFog fog;
sceGifPackAd ad;
sceGifPackNop nop;
sceGifPackXyzf adc;
sceVu0FVECTOR fv;
sceVu0IVECTOR iv;
u_long128 ul128;
u_long ul[2];
u_int ui[4];
float f[4];
} sceGpPack;
/***********************************
* Packet structures
***********************************/
typedef struct { /* reglist mode */
sceDmaTag dmanext;
sceGifTag giftag1;
sceGifPackAd userreg;
sceGifTag giftag2;
sceGpReg reg[1];
} sceGpPrimR;
typedef struct { /* packed mode */
sceDmaTag dmanext;
sceGifTag giftag1;
sceGifPackAd userreg;
sceGifTag giftag2;
sceGpPack reg[1];
} sceGpPrimP;
typedef struct { /* load 1 texture( texel or clut ) */
sceDmaTag dmacnt;
sceGifTag giftag1;
sceGsBitbltbuf bitbltbuf; long bitbltbufaddr;
sceGsTrxpos trxpos; long trxposaddr;
sceGsTrxreg trxreg; long trxregaddr;
sceGsTrxdir trxdir; long trxdiraddr;
sceGifTag giftag2;
sceDmaTag dmaref;
sceDmaTag dmanext;
sceGifTag giftag3;
sceGsTexflush texflush; long texflushaddr;
} sceGpLoadImage __attribute__((aligned(16)));
typedef struct { /* load texel and clut */
struct {
sceDmaTag dmacnt;
sceGifTag giftag1;
sceGsBitbltbuf bitbltbuf; long bitbltbufaddr;
sceGsTrxpos trxpos; long trxposaddr;
sceGsTrxreg trxreg; long trxregaddr;
sceGsTrxdir trxdir; long trxdiraddr;
sceGifTag giftag2;
sceDmaTag dmaref;
} trans[2];
sceDmaTag dmanext;
sceGifTag giftag3;
sceGsTexflush texflush; long texflushaddr;
} sceGpLoadTexelClut __attribute__((aligned(16)));
typedef struct { /* send texenv */
sceDmaTag dmanext;
sceGifTag giftag;
sceGsTex1 tex1; long tex1addr;
sceGsTex0 tex0; long tex0addr;
sceGsClamp clamp; long clampaddr;
} sceGpTexEnv __attribute__((aligned(16)));
typedef struct { /* send texenv & mipmapenv */
sceDmaTag dmanext;
sceGifTag giftag;
sceGsTex1 tex1; long tex1addr;
sceGsTex0 tex0; long tex0addr;
sceGsClamp clamp; long clampaddr;
sceGsMiptbp1 miptbp1; long miptbp1addr;
sceGsMiptbp2 miptbp2; long miptbp2addr;
} sceGpTexEnvMipmap __attribute__((aligned(16)));
typedef struct { /* send alphaenv */
sceDmaTag dmanext;
sceGifTag giftag;
sceGsAlpha alpha; long alphaaddr;
sceGsPabe pabe; long pabeaddr;
sceGsTexa texa; long texaaddr;
sceGsFba fba; long fbaaddr;
} sceGpAlphaEnv __attribute__((aligned(16)));
typedef struct { /* call other chain */
sceDmaTag dmacall;
sceDmaTag dmanext;
} sceGpCall __attribute__((aligned(16)));
typedef struct { /* ref mem region */
sceDmaTag dmaref;
sceDmaTag dmanext;
} sceGpRef __attribute__((aligned(16)));
typedef struct { /* general-purpose */
sceDmaTag dmanext;
sceGifTag giftag;
struct {
u_long value;
u_long addr;
}reg[1];
} sceGpAd __attribute__((aligned(16)));
/* Argument structures */
typedef struct{
short tbp, tbw, tpsm;
short tx, ty, tw, th;
short cbp, cpsm;
} sceGpTextureArg;
enum {
SCE_GP_PATH1,
SCE_GP_PATH2,
SCE_GP_PATH3
};
/* Packet ID */
#define SCE_GP_UNKNOWN 0x0000
#define SCE_GP_CHAIN 0x1000
#define SCE_GP_PRIM_R 0x2000
#define SCE_GP_PRIM_P 0x3000
#define SCE_GP_ALPHAENV 0x4000
#define SCE_GP_TEXENV 0x5000
#define SCE_GP_TEXENVMIPMAP 0x6000
#define SCE_GP_LOADIMAGE 0x7000
#define SCE_GP_LOADTEXELCLUT 0x8000
#define SCE_GP_AD 0x9000
#define SCE_GP_REF 0xa000
#define SCE_GP_CALL 0xb000
/* Prim type */
#define SCE_GP_MONOCHROME (1<<11)
#define SCE_GP_POINT_FM ( SCE_GS_PRIM_POINT | SCE_GP_MONOCHROME )
#define SCE_GP_POINT_FMTU ( SCE_GS_PRIM_POINT | SCE_GP_MONOCHROME | SCE_GS_PRIM_TME | SCE_GS_PRIM_FST )
#define SCE_GP_POINT_F ( SCE_GS_PRIM_POINT )
#define SCE_GP_POINT_FTU ( SCE_GS_PRIM_POINT | SCE_GS_PRIM_TME | SCE_GS_PRIM_FST )
#define SCE_GP_POINT_FTS ( SCE_GS_PRIM_POINT | SCE_GS_PRIM_TME )
#define SCE_GP_LINE_FM ( SCE_GS_PRIM_LINE | SCE_GP_MONOCHROME )
#define SCE_GP_LINE_FMTU ( SCE_GS_PRIM_LINE | SCE_GP_MONOCHROME | SCE_GS_PRIM_TME | SCE_GS_PRIM_FST )
#define SCE_GP_LINE_F ( SCE_GS_PRIM_LINE )
#define SCE_GP_LINE_FTU ( SCE_GS_PRIM_LINE | SCE_GS_PRIM_TME | SCE_GS_PRIM_FST )
#define SCE_GP_LINE_FTS ( SCE_GS_PRIM_LINE | SCE_GS_PRIM_TME )
#define SCE_GP_LINE_G ( SCE_GS_PRIM_LINE | SCE_GS_PRIM_IIP)
#define SCE_GP_LINE_GTU ( SCE_GS_PRIM_LINE | SCE_GS_PRIM_IIP | SCE_GS_PRIM_TME | SCE_GS_PRIM_FST )
#define SCE_GP_LINE_GTS ( SCE_GS_PRIM_LINE | SCE_GS_PRIM_IIP | SCE_GS_PRIM_TME )
#define SCE_GP_LINESTRIP_FM ( SCE_GS_PRIM_LINESTRIP | SCE_GP_MONOCHROME )
#define SCE_GP_LINESTRIP_FMTU ( SCE_GS_PRIM_LINESTRIP | SCE_GP_MONOCHROME | SCE_GS_PRIM_TME | SCE_GS_PRIM_FST )
#define SCE_GP_LINESTRIP_F ( SCE_GS_PRIM_LINESTRIP )
#define SCE_GP_LINESTRIP_FTU ( SCE_GS_PRIM_LINESTRIP | SCE_GS_PRIM_TME | SCE_GS_PRIM_FST )
#define SCE_GP_LINESTRIP_FTS ( SCE_GS_PRIM_LINESTRIP | SCE_GS_PRIM_TME )
#define SCE_GP_LINESTRIP_G ( SCE_GS_PRIM_LINESTRIP | SCE_GS_PRIM_IIP)
#define SCE_GP_LINESTRIP_GTU ( SCE_GS_PRIM_LINESTRIP | SCE_GS_PRIM_IIP | SCE_GS_PRIM_TME | SCE_GS_PRIM_FST )
#define SCE_GP_LINESTRIP_GTS ( SCE_GS_PRIM_LINESTRIP | SCE_GS_PRIM_IIP | SCE_GS_PRIM_TME )
#define SCE_GP_TRI_FM ( SCE_GS_PRIM_TRI | SCE_GP_MONOCHROME )
#define SCE_GP_TRI_FMTU ( SCE_GS_PRIM_TRI | SCE_GP_MONOCHROME | SCE_GS_PRIM_TME | SCE_GS_PRIM_FST )
#define SCE_GP_TRI_F ( SCE_GS_PRIM_TRI )
#define SCE_GP_TRI_FTU ( SCE_GS_PRIM_TRI | SCE_GS_PRIM_TME | SCE_GS_PRIM_FST )
#define SCE_GP_TRI_FTS ( SCE_GS_PRIM_TRI | SCE_GS_PRIM_TME )
#define SCE_GP_TRI_G ( SCE_GS_PRIM_TRI | SCE_GS_PRIM_IIP)
#define SCE_GP_TRI_GTU ( SCE_GS_PRIM_TRI | SCE_GS_PRIM_IIP | SCE_GS_PRIM_TME | SCE_GS_PRIM_FST )
#define SCE_GP_TRI_GTS ( SCE_GS_PRIM_TRI | SCE_GS_PRIM_IIP | SCE_GS_PRIM_TME )
#define SCE_GP_TRISTRIP_FM ( SCE_GS_PRIM_TRISTRIP | SCE_GP_MONOCHROME )
#define SCE_GP_TRISTRIP_FMTU ( SCE_GS_PRIM_TRISTRIP | SCE_GP_MONOCHROME | SCE_GS_PRIM_TME | SCE_GS_PRIM_FST )
#define SCE_GP_TRISTRIP_F ( SCE_GS_PRIM_TRISTRIP )
#define SCE_GP_TRISTRIP_FTU ( SCE_GS_PRIM_TRISTRIP | SCE_GS_PRIM_TME | SCE_GS_PRIM_FST )
#define SCE_GP_TRISTRIP_FTS ( SCE_GS_PRIM_TRISTRIP | SCE_GS_PRIM_TME )
#define SCE_GP_TRISTRIP_G ( SCE_GS_PRIM_TRISTRIP | SCE_GS_PRIM_IIP)
#define SCE_GP_TRISTRIP_GTU ( SCE_GS_PRIM_TRISTRIP | SCE_GS_PRIM_IIP | SCE_GS_PRIM_TME | SCE_GS_PRIM_FST )
#define SCE_GP_TRISTRIP_GTS ( SCE_GS_PRIM_TRISTRIP | SCE_GS_PRIM_IIP | SCE_GS_PRIM_TME )
#define SCE_GP_TRIFAN_FM ( SCE_GS_PRIM_TRIFAN | SCE_GP_MONOCHROME )
#define SCE_GP_TRIFAN_FMTU ( SCE_GS_PRIM_TRIFAN | SCE_GP_MONOCHROME | SCE_GS_PRIM_TME | SCE_GS_PRIM_FST )
#define SCE_GP_TRIFAN_F ( SCE_GS_PRIM_TRIFAN )
#define SCE_GP_TRIFAN_FTU ( SCE_GS_PRIM_TRIFAN | SCE_GS_PRIM_TME | SCE_GS_PRIM_FST )
#define SCE_GP_TRIFAN_FTS ( SCE_GS_PRIM_TRIFAN | SCE_GS_PRIM_TME )
#define SCE_GP_TRIFAN_G ( SCE_GS_PRIM_TRIFAN | SCE_GS_PRIM_IIP)
#define SCE_GP_TRIFAN_GTU ( SCE_GS_PRIM_TRIFAN | SCE_GS_PRIM_IIP | SCE_GS_PRIM_TME | SCE_GS_PRIM_FST )
#define SCE_GP_TRIFAN_GTS ( SCE_GS_PRIM_TRIFAN | SCE_GS_PRIM_IIP | SCE_GS_PRIM_TME )
#define SCE_GP_SPRITE_FM ( SCE_GS_PRIM_SPRITE | SCE_GP_MONOCHROME )
#define SCE_GP_SPRITE_FMTU ( SCE_GS_PRIM_SPRITE | SCE_GP_MONOCHROME | SCE_GS_PRIM_TME | SCE_GS_PRIM_FST )
#define SCE_GP_SPRITE_F ( SCE_GS_PRIM_SPRITE )
#define SCE_GP_SPRITE_FTU ( SCE_GS_PRIM_SPRITE | SCE_GS_PRIM_TME | SCE_GS_PRIM_FST )
#define SCE_GP_SPRITE_FTS ( SCE_GS_PRIM_SPRITE | SCE_GS_PRIM_TME )
/* for sceGpSetAlphaEnv() */
#define SCE_GP_ALPHA_NOP (0)
#define SCE_GP_ALPHA_INTER_AS (1)
#define SCE_GP_ALPHA_INTER_AD (2)
#define SCE_GP_ALPHA_INTER_FIX (3)
#define SCE_GP_ALPHA_RINTER_AS (4)
#define SCE_GP_ALPHA_RINTER_AD (5)
#define SCE_GP_ALPHA_RINTER_FIX (6)
#define SCE_GP_ALPHA_ADD (7)
#define SCE_GP_ALPHA_ADD_CS_FIX (8)
#define SCE_GP_ALPHA_ADD_CD_FIX (9)
#define SCE_GP_ALPHA_ADD_CS_AS (10)
#define SCE_GP_ALPHA_ADD_CD_AS (11)
#define SCE_GP_ALPHA_ADD_CS_AD (12)
#define SCE_GP_ALPHA_ADD_CD_AD (13)
#define SCE_GP_ALPHA_SUB_CS (14)
#define SCE_GP_ALPHA_SUB_CD (15)
#define SCE_GP_ALPHA_SUB_CS_FIX (16)
#define SCE_GP_ALPHA_SUB_CD_FIX (17)
#define SCE_GP_ALPHA_SUB_CS_AS (18)
#define SCE_GP_ALPHA_SUB_CD_AS (19)
#define SCE_GP_ALPHA_SUB_CS_AD (20)
#define SCE_GP_ALPHA_SUB_CD_AD (21)
#define SCE_GP_ALPHA_MUL_CS_AS (22)
#define SCE_GP_ALPHA_MUL_CS_AD (23)
#define SCE_GP_ALPHA_MUL_CS_FIX (24)
#define SCE_GP_ALPHA_MUL_CD_AS (25)
#define SCE_GP_ALPHA_MUL_CD_AD (26)
#define SCE_GP_ALPHA_MUL_CD_FIX (27)
#if defined(__LANGUAGE_C_PLUS_PLUS)||defined(__cplusplus)||defined(c_plusplus)
extern "C" {
#endif
/* chain(dma) operate functions */
extern int sceGpInitChain(sceGpChain *chain, void *addr, int resolution);
extern void sceGpResetChain(sceGpChain *chain);
extern void sceGpResetChainRev(sceGpChain *chain);
extern int sceGpKickChain(sceGpChain *chain, int path);
extern void sceGpKickChain2(sceGpChain *chain, int path);
extern void sceGpPrintChain(sceGpChain *chain, int verbosity, int from, int num);
extern void sceGpTermChain(sceGpChain *chain, int level, int isret);
extern void sceGpSetStartLevel(sceGpChain *chain, int level);
extern void sceGpSetEndLevel(sceGpChain *chain, int level);
extern void sceGpAddChain(sceGpChain* chain, int level, sceGpChain *chain2);
extern void sceGpCallChain(sceGpChain* chain, int level, sceGpChain* chain2, sceGpCall* calltag);
extern sceDmaTag* sceGpSearchTailToRemove(sceGpChain* chain, void* p);
extern void* sceGpRemoveNextPacket(sceDmaTag* tail2remv);
extern sceGpChain* sceGpRemoveNextChain(sceDmaTag* tail2remv, sceGpChain* chain);
extern void sceGpInsertPacket(void* b, void* p);
extern void sceGpAddPacket(sceGpChain* chain, int level, void* p);
extern int sceGpCopyPacket(void* dp, void* sp);
extern sceDmaTag *sceGpAddPacket2(sceDmaTag *tail2remv, void* pPacket);
extern sceDmaTag *sceGpAddChain2(sceDmaTag *tail2remv, sceGpChain *chain2);
extern sceDmaTag *sceGpCallChain2(sceDmaTag *tail2remv, sceGpChain* chain2, sceGpCall* calltag);
extern sceDmaTag *sceGpGetTailChain(sceGpChain *chain, int level);
extern sceDmaTag *sceGpGetTail(void *pPacket);
extern int sceGpKickPacket(void* p, int path);
extern void sceGpKickPacket2(void* p, int path);
extern void sceGpSyncPacket(void* p);
extern void sceGpSyncPacketI(void* p);
extern void sceGpSetPacketMode(void* p, int mode);
#define sceGpChkChainOtSize(r) ((r)+1)
/* packet operate functions */
extern void sceGpSetDefaultCtxt(int ctxt);
extern void sceGpSetDefaultAa1(int aa1);
extern void sceGpSetDefaultAbe(int abe);
extern void sceGpSetDefaultFog(int fge);
extern void sceGpSetDefaultDirectHL(int on);
extern void sceGpSetDefaultZ32(int on);
extern int sceGpChkNumPtoV(u_int type, int pnum);
extern int sceGpChkPacketSize(u_int type, int pnum);
extern int sceGpInitPacket(void *p, u_int type, int num);
extern int sceGpInitPrimR(sceGpPrimR *p, u_int type, int pnum);
extern int sceGpInitPrimP(sceGpPrimP *p, u_int type, int pnum);
extern int sceGpInitLoadImage(sceGpLoadImage *p);
extern int sceGpInitLoadTexelClut(sceGpLoadTexelClut *p);
extern int sceGpInitTexEnv(sceGpTexEnv *p, int ctxt);
extern int sceGpInitTexEnvMipmap(sceGpTexEnvMipmap *p, int ctxt);
extern int sceGpInitAlphaEnv(sceGpAlphaEnv *p, int ctxt);
extern int sceGpInitAd(sceGpAd *p, int size);
extern int sceGpInitRef(sceGpRef *p);
extern int sceGpInitCall(sceGpCall *p);
extern void sceGpSetLoadImageByTim2(sceGpLoadImage *p, const void *ptim2, int picture, int miplevel, int isClut);
extern void sceGpSetLoadImageByArgTim2(sceGpLoadImage *p, const sceGpTextureArg *arg, const void *ptim2, int picture, int miplevel, int isClut);
extern void sceGpSetLoadTexelClutByTim2(sceGpLoadTexelClut *p, const void *ptim2, int picture, int miplevel);
extern void sceGpSetLoadTexelClutByArgTim2(sceGpLoadTexelClut *p, const sceGpTextureArg *arg, const void *ptim2, int picture, int miplevel);
extern void sceGpSetTexEnvByTim2(sceGpTexEnv *p, const void *ptim2, int picture, int miplevel);
extern void sceGpSetTexEnvByArgTim2(sceGpTexEnv *p, const sceGpTextureArg *arg, const void *ptim2, int picture, int miplevel);
extern void sceGpSetLoadImage(sceGpLoadImage *p, sceGpTextureArg *texarg, void *srcaddr, int isClut);
extern void sceGpSetLoadTexelClut(sceGpLoadTexelClut *p, sceGpTextureArg *texarg, void *tsrcaddr, void *csrcaddr);
extern void sceGpSetTexEnv(sceGpTexEnv *p, sceGpTextureArg *tex, int tfx, int filter);
extern void sceGpSetTexEnvByDrawEnv(sceGpTexEnv *p, sceGsDrawEnv1 *draw, int tfx, int filter);
extern void sceGpSetAlphaEnv(sceGpAlphaEnv* p, int func, int fix);
extern void sceGpSetAd(sceGpAd *p, int level, u_long addr, u_long value);
extern void sceGpSetRef(sceGpRef *p, void* addr, int size, int path);
extern void sceGpSetCall(sceGpCall *p, void* addr);
extern void sceGpSetAlphaEnvFunc(sceGpAlphaEnv* p, int func, int fix);
/************** GetIndex functions **************/
/* point */
static __inline__ unsigned int sceGpIndexXyzfPointFM(unsigned int n) { return n; }
static __inline__ unsigned int sceGpIndexUvPointFMTU(unsigned int n) { return n*2; }
static __inline__ unsigned int sceGpIndexXyzfPointFMTU(unsigned int n) { return n*2 + 1; }
static __inline__ unsigned int sceGpIndexRgbaPointF(unsigned int n) { return n*2; }
static __inline__ unsigned int sceGpIndexXyzfPointF(unsigned int n) { return n*2 + 1; }
static __inline__ unsigned int sceGpIndexUvPointFTU(unsigned int n) { return n*3; }
static __inline__ unsigned int sceGpIndexRgbaPointFTU(unsigned int n) { return n*3 + 1; }
static __inline__ unsigned int sceGpIndexXyzfPointFTU(unsigned int n) { return n*3 + 2; }
static __inline__ unsigned int sceGpIndexStqPointFTS_P(unsigned int n) { return n*3; }
static __inline__ unsigned int sceGpIndexRgbaPointFTS(unsigned int n) { return n*3 + 1; }
static __inline__ unsigned int sceGpIndexXyzfPointFTS(unsigned int n) { return n*3 + 2; }
static __inline__ unsigned int sceGpIndexStPointFTS_R(unsigned int n) { return n*3; }
static __inline__ unsigned int sceGpIndexQPointFTS_R(unsigned int n) { return n*3 + 1; }
/* line */
static __inline__ unsigned int sceGpIndexXyzfLineFM(unsigned int n) { return n; }
static __inline__ unsigned int sceGpIndexUvLineFMTU(unsigned int n) { return n*2; }
static __inline__ unsigned int sceGpIndexXyzfLineFMTU(unsigned int n) { return n*2 + 1; }
static __inline__ unsigned int sceGpIndexRgbaLineF(unsigned int n) { return n*3 + 1; }
static __inline__ unsigned int sceGpIndexXyzfLineF(unsigned int n) { return (n*3+1)/2;}
static __inline__ unsigned int sceGpIndexUvLineFTU(unsigned int n) { return n*5/2; }
static __inline__ unsigned int sceGpIndexRgbaLineFTU(unsigned int n) { return n*5 + 3; }
static __inline__ unsigned int sceGpIndexXyzfLineFTU(unsigned int n) { return (n*5+3)/2;}
static __inline__ unsigned int sceGpIndexStqLineFTS_P(unsigned int n) { return n*3; }
static __inline__ unsigned int sceGpIndexRgbaLineFTS(unsigned int n) { return n*6 + 4; }
static __inline__ unsigned int sceGpIndexXyzfLineFTS(unsigned int n) { return n*3 + 2; }
static __inline__ unsigned int sceGpIndexStLineFTS_R(unsigned int n) { return n*3; }
static __inline__ unsigned int sceGpIndexQLineFTS_R(unsigned int n) { return n*3 + 1; }
static __inline__ unsigned int sceGpIndexRgbaLineG(unsigned int n) { return n*2; }
static __inline__ unsigned int sceGpIndexXyzfLineG(unsigned int n) { return n*2 + 1; }
static __inline__ unsigned int sceGpIndexUvLineGTU(unsigned int n) { return n*3; }
static __inline__ unsigned int sceGpIndexRgbaLineGTU(unsigned int n) { return n*3 + 1; }
static __inline__ unsigned int sceGpIndexXyzfLineGTU(unsigned int n) { return n*3 + 2; }
static __inline__ unsigned int sceGpIndexStqLineGTS_P(unsigned int n) { return n*3; }
static __inline__ unsigned int sceGpIndexRgbaLineGTS(unsigned int n) { return n*3 + 1; }
static __inline__ unsigned int sceGpIndexXyzfLineGTS(unsigned int n) { return n*3 + 2; }
static __inline__ unsigned int sceGpIndexStLineGTS_R(unsigned int n) { return n*3; }
static __inline__ unsigned int sceGpIndexQLineGTS_R(unsigned int n) { return n*3 + 1; }
/* line strip */
static __inline__ unsigned int sceGpIndexXyzfLineStripFM(unsigned int n) { return n; }
static __inline__ unsigned int sceGpIndexUvLineStripFMTU(unsigned int n) { return n*2; }
static __inline__ unsigned int sceGpIndexXyzfLineStripFMTU(unsigned int n){ return n*2 + 1; }
static __inline__ unsigned int sceGpIndexRgbaLineStripF(unsigned int n) { return n*2 + 2; }
static __inline__ unsigned int sceGpIndexXyzfLineStripF(unsigned int n) { return n*2 + 1; }
static __inline__ unsigned int sceGpIndexUvLineStripFTU(unsigned int n) { return n*3; }
static __inline__ unsigned int sceGpIndexRgbaLineStripFTU(unsigned int n) { return n*3 + 4; }
static __inline__ unsigned int sceGpIndexXyzfLineStripFTU(unsigned int n) { return n*3 + 2; }
static __inline__ unsigned int sceGpIndexStqLineStripFTS_P(unsigned int n){ return n*3; }
static __inline__ unsigned int sceGpIndexRgbaLineStripFTS(unsigned int n) { return n*3 + 4; }
static __inline__ unsigned int sceGpIndexXyzfLineStripFTS(unsigned int n) { return n*3 + 2; }
static __inline__ unsigned int sceGpIndexStLineStripFTS_R(unsigned int n) { return n*3; }
static __inline__ unsigned int sceGpIndexQLineStripFTS_R(unsigned int n) { return n*3 + 1; }
static __inline__ unsigned int sceGpIndexRgbaLineStripG(unsigned int n) { return n*2; }
static __inline__ unsigned int sceGpIndexXyzfLineStripG(unsigned int n) { return n*2 + 1; }
static __inline__ unsigned int sceGpIndexUvLineStripGTU(unsigned int n) { return n*3; }
static __inline__ unsigned int sceGpIndexRgbaLineStripGTU(unsigned int n) { return n*3 + 1; }
static __inline__ unsigned int sceGpIndexXyzfLineStripGTU(unsigned int n) { return n*3 + 2; }
static __inline__ unsigned int sceGpIndexStqLineStripGTS_P(unsigned int n){ return n*3; }
static __inline__ unsigned int sceGpIndexRgbaLineStripGTS(unsigned int n) { return n*3 + 1; }
static __inline__ unsigned int sceGpIndexXyzfLineStripGTS(unsigned int n) { return n*3 + 2; }
static __inline__ unsigned int sceGpIndexStLineStripGTS_R(unsigned int n) { return n*3; }
static __inline__ unsigned int sceGpIndexQLineStripGTS_R(unsigned int n) { return n*3 + 1; }
/* tri */
static __inline__ unsigned int sceGpIndexXyzfTriFM(unsigned int n) { return n; }
static __inline__ unsigned int sceGpIndexUvTriFMTU(unsigned int n) { return n*2; }
static __inline__ unsigned int sceGpIndexXyzfTriFMTU(unsigned int n) { return n*2 + 1; }
static __inline__ unsigned int sceGpIndexRgbaTriF(unsigned int n) { return n*4 + 2; }
static __inline__ unsigned int sceGpIndexXyzfTriF(unsigned int n) { return (n*4+1)/3;}
static __inline__ unsigned int sceGpIndexUvTriFTU(unsigned int n) { return n*7/3; }
static __inline__ unsigned int sceGpIndexRgbaTriFTU(unsigned int n) { return n*7 + 5; }
static __inline__ unsigned int sceGpIndexXyzfTriFTU(unsigned int n) { return (n*7+4)/3;}
static __inline__ unsigned int sceGpIndexStqTriFTS_P(unsigned int n) { return n*3; }
static __inline__ unsigned int sceGpIndexRgbaTriFTS(unsigned int n) { return n*9 + 7; }
static __inline__ unsigned int sceGpIndexXyzfTriFTS(unsigned int n) { return n*3 + 2; }
static __inline__ unsigned int sceGpIndexStTriFTS_R(unsigned int n) { return n*3; }
static __inline__ unsigned int sceGpIndexQTriFTS_R(unsigned int n) { return n*3 + 1; }
static __inline__ unsigned int sceGpIndexRgbaTriG(unsigned int n) { return n*2; }
static __inline__ unsigned int sceGpIndexXyzfTriG(unsigned int n) { return n*2 + 1; }
static __inline__ unsigned int sceGpIndexUvTriGTU(unsigned int n) { return n*3; }
static __inline__ unsigned int sceGpIndexRgbaTriGTU(unsigned int n) { return n*3 + 1; }
static __inline__ unsigned int sceGpIndexXyzfTriGTU(unsigned int n) { return n*3 + 2; }
static __inline__ unsigned int sceGpIndexStqTriGTS_P(unsigned int n) { return n*3; }
static __inline__ unsigned int sceGpIndexRgbaTriGTS(unsigned int n) { return n*3 + 1; }
static __inline__ unsigned int sceGpIndexXyzfTriGTS(unsigned int n) { return n*3 + 2; }
static __inline__ unsigned int sceGpIndexStTriGTS_R(unsigned int n) { return n*3; }
static __inline__ unsigned int sceGpIndexQTriGTS_R(unsigned int n) { return n*3 + 1; }
/* tri strip */
static __inline__ unsigned int sceGpIndexXyzfTriStripFM(unsigned int n) { return n; }
static __inline__ unsigned int sceGpIndexUvTriStripFMTU(unsigned int n) { return n*2; }
static __inline__ unsigned int sceGpIndexXyzfTriStripFMTU(unsigned int n) { return n*2 + 1; }
static __inline__ unsigned int sceGpIndexRgbaTriStripF(unsigned int n) { return n*2 + 4; }
static __inline__ unsigned int sceGpIndexXyzfTriStripF(unsigned int n) { return n*2 + 1; }
static __inline__ unsigned int sceGpIndexUvTriStripFTU(unsigned int n) { return n*3; }
static __inline__ unsigned int sceGpIndexRgbaTriStripFTU(unsigned int n) { return n*3 + 7; }
static __inline__ unsigned int sceGpIndexXyzfTriStripFTU(unsigned int n) { return n*3 + 2; }
static __inline__ unsigned int sceGpIndexStqTriStripFTS_P(unsigned int n) { return n*3; }
static __inline__ unsigned int sceGpIndexRgbaTriStripFTS(unsigned int n) { return n*3 + 7; }
static __inline__ unsigned int sceGpIndexXyzfTriStripFTS(unsigned int n) { return n*3 + 2; }
static __inline__ unsigned int sceGpIndexStTriStripFTS_R(unsigned int n) { return n*3; }
static __inline__ unsigned int sceGpIndexQTriStripFTS_R(unsigned int n) { return n*3 + 1; }
static __inline__ unsigned int sceGpIndexRgbaTriStripG(unsigned int n) { return n*2; }
static __inline__ unsigned int sceGpIndexXyzfTriStripG(unsigned int n) { return n*2 + 1; }
static __inline__ unsigned int sceGpIndexUvTriStripGTU(unsigned int n) { return n*3; }
static __inline__ unsigned int sceGpIndexRgbaTriStripGTU(unsigned int n) { return n*3 + 1; }
static __inline__ unsigned int sceGpIndexXyzfTriStripGTU(unsigned int n) { return n*3 + 2; }
static __inline__ unsigned int sceGpIndexStqTriStripGTS_P(unsigned int n) { return n*3; }
static __inline__ unsigned int sceGpIndexRgbaTriStripGTS(unsigned int n) { return n*3 + 1; }
static __inline__ unsigned int sceGpIndexXyzfTriStripGTS(unsigned int n) { return n*3 + 2; }
static __inline__ unsigned int sceGpIndexStTriStripGTS_R(unsigned int n) { return n*3; }
static __inline__ unsigned int sceGpIndexQTriStripGTS_R(unsigned int n) { return n*3 + 1; }
/* tri fan */
static __inline__ unsigned int sceGpIndexXyzfTriFanFM(unsigned int n) { return n; }
static __inline__ unsigned int sceGpIndexUvTriFanFMTU(unsigned int n) { return n*2; }
static __inline__ unsigned int sceGpIndexXyzfTriFanFMTU(unsigned int n) { return n*2 + 1; }
static __inline__ unsigned int sceGpIndexRgbaTriFanF(unsigned int n) { return n*2 + 4; }
static __inline__ unsigned int sceGpIndexXyzfTriFanF(unsigned int n) { return n*2 + 1; }
static __inline__ unsigned int sceGpIndexUvTriFanFTU(unsigned int n) { return n*3; }
static __inline__ unsigned int sceGpIndexRgbaTriFanFTU(unsigned int n) { return n*3 + 7; }
static __inline__ unsigned int sceGpIndexXyzfTriFanFTU(unsigned int n) { return n*3 + 2; }
static __inline__ unsigned int sceGpIndexStqTriFanFTS_P(unsigned int n) { return n*3; }
static __inline__ unsigned int sceGpIndexRgbaTriFanFTS(unsigned int n) { return n*3 + 7; }
static __inline__ unsigned int sceGpIndexXyzfTriFanFTS(unsigned int n) { return n*3 + 2; }
static __inline__ unsigned int sceGpIndexStTriFanFTS_R(unsigned int n) { return n*3; }
static __inline__ unsigned int sceGpIndexQTriFanFTS_R(unsigned int n) { return n*3 + 1; }
static __inline__ unsigned int sceGpIndexRgbaTriFanG(unsigned int n) { return n*2; }
static __inline__ unsigned int sceGpIndexXyzfTriFanG(unsigned int n) { return n*2 + 1; }
static __inline__ unsigned int sceGpIndexUvTriFanGTU(unsigned int n) { return n*3; }
static __inline__ unsigned int sceGpIndexRgbaTriFanGTU(unsigned int n) { return n*3 + 1; }
static __inline__ unsigned int sceGpIndexXyzfTriFanGTU(unsigned int n) { return n*3 + 2; }
static __inline__ unsigned int sceGpIndexStqTriFanGTS_P(unsigned int n) { return n*3; }
static __inline__ unsigned int sceGpIndexRgbaTriFanGTS(unsigned int n) { return n*3 + 1; }
static __inline__ unsigned int sceGpIndexXyzfTriFanGTS(unsigned int n) { return n*3 + 2; }
static __inline__ unsigned int sceGpIndexStTriFanGTS_R(unsigned int n) { return n*3; }
static __inline__ unsigned int sceGpIndexQTriFanGTS_R(unsigned int n) { return n*3 + 1; }
/* sprite */
static __inline__ unsigned int sceGpIndexXyzfSpriteFM(unsigned int n) { return n; }
static __inline__ unsigned int sceGpIndexUvSpriteFMTU(unsigned int n) { return n*2; }
static __inline__ unsigned int sceGpIndexXyzfSpriteFMTU(unsigned int n) { return n*2 + 1; }
static __inline__ unsigned int sceGpIndexRgbaSpriteF(unsigned int n) { return n*3 + 1; }
static __inline__ unsigned int sceGpIndexXyzfSpriteF(unsigned int n) { return (n*3+1)/2;}
static __inline__ unsigned int sceGpIndexUvSpriteFTU(unsigned int n) { return n*5/2; }
static __inline__ unsigned int sceGpIndexRgbaSpriteFTU(unsigned int n) { return n*5 + 3; }
static __inline__ unsigned int sceGpIndexXyzfSpriteFTU(unsigned int n) { return (n*5+3)/2;}
static __inline__ unsigned int sceGpIndexStqSpriteFTS_P(unsigned int n) { return n*3; }
static __inline__ unsigned int sceGpIndexRgbaSpriteFTS(unsigned int n) { return n*6 + 4; }
static __inline__ unsigned int sceGpIndexXyzfSpriteFTS(unsigned int n) { return n*3 + 2; }
static __inline__ unsigned int sceGpIndexStSpriteFTS_R(unsigned int n) { return n*3; }
static __inline__ unsigned int sceGpIndexQSpriteFTS_R(unsigned int n) { return n*3 + 1; }
extern const int _sce_Index_UvFTU[7][3];
extern const int _sce_Index_RgbaF[7][3];
extern const int _sce_Index_RgbaFTU[7][3];
extern const int _sce_Index_RgbaFTS[7][3];
extern const int _sce_Index_XyzF[7][3];
extern const int _sce_Index_XyzFTU[7][3];
/* prim type compatible */
extern unsigned int sceGpIndexUv(u_int type, unsigned int n);
static __inline__ unsigned int sceGpIndexStq_P(u_int type, unsigned int n)
{
(void)type; /* suppress warning */
return n*3;
}
static __inline__ unsigned int sceGpIndexSt_R(u_int type, unsigned int n)
{
(void)type; /* suppress warning */
return n*3;
}
static __inline__ unsigned int sceGpIndexQ_R(u_int type, unsigned int n)
{
(void)type; /* suppress warning */
return n*3 + 1;
}
static __inline__ void sceGpSetRgbaFM(void* p, u_long r, u_long g, u_long b, u_long a)
{
((sceGpPrimR*)p)->userreg.ADDR = SCE_GS_RGBAQ;
((sceGpPrimR*)p)->userreg.DATA = SCE_GS_SET_RGBAQ(r,g,b,a,0x3f800000);
}
extern unsigned int sceGpIndexRgba(u_int type, unsigned int n);
extern unsigned int sceGpIndexXyzf(u_int type, unsigned int n);
#define sceGpSetRgb(p, k, r, g, b) ((p)->reg[k].rgbaq.R=(r),(p)->reg[k].rgbaq.G=(g),(p)->reg[k].rgbaq.B=(b))
#define sceGpSetRgba(p, k, r, g, b, a) ((p)->reg[k].rgbaq.R=(r),(p)->reg[k].rgbaq.G=(g),(p)->reg[k].rgbaq.B=(b),(p)->reg[k].rgbaq.A=(a))
#define sceGpSetXy(p, k, x, y) ((p)->reg[k].adc.ADC=0,(p)->reg[k].xyzf.X=(x),(p)->reg[k].xyzf.Y=(y))
#define sceGpSetXyz(p, k, x, y, z) ((p)->reg[k].adc.ADC=0,(p)->reg[k].xyzf.X=(x),(p)->reg[k].xyzf.Y=(y),(p)->reg[k].xyzf.Z=(z))
#define sceGpSetXyzf(p, k, x, y, z, f) ((p)->reg[k].adc.ADC=0,(p)->reg[k].xyzf.X=(x),(p)->reg[k].xyzf.Y=(y),(p)->reg[k].xyzf.Z=(z),(p)->reg[k].xyzf.F=(f))
#define sceGpSetXyz32(p, k, x, y, z) ((p)->reg[k].adc.ADC=0,(p)->reg[k].xyz.X=(x),(p)->reg[k].xyz.Y=(y),(p)->reg[k].xyz.Z=(z))
#define sceGpSetUv(p, k, u, v) ((p)->reg[k].uv.U=(u),(p)->reg[k].uv.V=(v))
#define sceGpSetStq_R(p, k, s, t, q) ((p)->reg[k].st.S=(s),(p)->reg[k].st.T=(t),(p)->reg[k+1].rgbaq.Q=(q))
#define sceGpSetStq_P(p, k, s, t, q) ((p)->reg[k].st.S=(s),(p)->reg[k].st.T=(t),(p)->reg[k].st.Q=(q))
#define sceGpSetFog(p,v) ((p)->giftag1.PRIM = ((v)?((p)->giftag1.PRIM|GS_PRIM_FGE_M):((p)->giftag1.PRIM&(‾GS_PRIM_FGE_M))))
#define sceGpSetAa1(p,v) ((p)->giftag1.PRIM = ((v)?((p)->giftag1.PRIM|GS_PRIM_AA1_M):((p)->giftag1.PRIM&(‾GS_PRIM_AA1_M))))
#define sceGpSetCtxt(p,v) ((p)->giftag1.PRIM = ((v)?((p)->giftag1.PRIM|GS_PRIM_CTXT_M):((p)->giftag1.PRIM&(‾GS_PRIM_CTXT_M))))
#define sceGpSetAbe(p,v) ((p)->giftag1.PRIM = ((v)?((p)->giftag1.PRIM|GS_PRIM_ABE_M):((p)->giftag1.PRIM&(‾GS_PRIM_ABE_M))))
extern void sceGpSetZ32(void* p, int on);
#if defined(__LANGUAGE_C_PLUS_PLUS)||defined(__cplusplus)||defined(c_plusplus)
}
#endif
#endif /* _LIBGP_H */

346
include/ee/libgraph.h Normal file
View File

@ -0,0 +1,346 @@
/* SCE CONFIDENTIAL
"PlayStation 2" Programmer Tool Runtime Library Release 2.5
*/
/*
* Emotion Engine Library
* Version 1.1.0.0
* Shift-JIS
*
* Copyright (C) 1998-2002 Sony Computer Entertainment Inc.
* All Rights Reserved.
*
* libgraph - libgraph.h
* header file of libgraph
*
* Version Date Design Log
* --------------------------------------------------------------------
* 0.10 March.25.1999 okadaa the first version
* 0.2.0.0 May.11.1999 okadaa add functions for 2context
* 1.10 Feb, 8, 2002 ywashizu Added DTV480P macro
*
* $Id: libgraph.h,v 1.12.2.2 2002/03/11 05:13:00 xokano Exp $
*
*/
/* libgraph.h - definitions to use GS. */
#ifndef _LIBGRAPH_H
#define _LIBGRAPH_H
#include <eeregs.h>
#include <eestruct.h>
#include <eetypes.h>
/* Functions for control GS */
typedef struct {
tGS_PMODE pmode;
tGS_SMODE2 smode2;
tGS_DISPFB2 dispfb;
tGS_DISPLAY2 display;
tGS_BGCOLOR bgcolor;
} sceGsDispEnv;
typedef struct {
sceGsFrame frame1;
u_long frame1addr;
sceGsZbuf zbuf1;
long zbuf1addr;
sceGsXyoffset xyoffset1;
long xyoffset1addr;
sceGsScissor scissor1;
long scissor1addr;
sceGsPrmodecont prmodecont;
long prmodecontaddr;
sceGsColclamp colclamp;
long colclampaddr;
sceGsDthe dthe;
long dtheaddr;
sceGsTest test1;
long test1addr;
} sceGsDrawEnv1 __attribute__((aligned(16)));
typedef struct {
sceGsFrame frame2;
u_long frame2addr;
sceGsZbuf zbuf2;
long zbuf2addr;
sceGsXyoffset xyoffset2;
long xyoffset2addr;
sceGsScissor scissor2;
long scissor2addr;
sceGsPrmodecont prmodecont;
long prmodecontaddr;
sceGsColclamp colclamp;
long colclampaddr;
sceGsDthe dthe;
long dtheaddr;
sceGsTest test2;
long test2addr;
} sceGsDrawEnv2 __attribute__((aligned(16)));
typedef struct {
sceGsTest testa;
long testaaddr;
sceGsPrim prim;
long primaddr;
sceGsRgbaq rgbaq;
long rgbaqaddr;
sceGsXyz xyz2a;
long xyz2aaddr;
sceGsXyz xyz2b;
long xyz2baddr;
sceGsTest testb;
long testbaddr;
} sceGsClear __attribute__((aligned(16)));
typedef struct {
sceGsDispEnv disp[2];
sceGifTag giftag0;
sceGsDrawEnv1 draw0;
sceGsClear clear0;
sceGifTag giftag1;
sceGsDrawEnv1 draw1;
sceGsClear clear1;
} sceGsDBuff;
typedef struct {
sceGsDispEnv disp[2];
sceGifTag giftag0;
sceGsDrawEnv1 draw01;
sceGsDrawEnv2 draw02;
sceGsClear clear0;
sceGifTag giftag1;
sceGsDrawEnv1 draw11;
sceGsDrawEnv2 draw12;
sceGsClear clear1;
} sceGsDBuffDc;
typedef struct {
sceGsTexflush texflush;
long texflushaddr;
sceGsTex1 tex11;
long tex11addr;
sceGsTex0 tex01;
long tex01addr;
sceGsClamp clamp1;
long clamp1addr;
} sceGsTexEnv __attribute__((aligned(16)));
typedef struct {
sceGsTexflush texflush;
long texflushaddr;
sceGsTex1 tex12;
long tex12addr;
sceGsTex0 tex02;
long tex02addr;
sceGsClamp clamp2;
long clamp2addr;
} sceGsTexEnv2 __attribute__((aligned(16)));
typedef struct {
sceGsAlpha alpha1;
long alpha1addr;
sceGsPabe pabe;
long pabeaddr;
sceGsTexa texa;
long texaaddr;
sceGsFba fba1;
long fba1addr;
} sceGsAlphaEnv __attribute__((aligned(16)));
typedef struct {
sceGsAlpha alpha2;
long alpha2addr;
sceGsPabe pabe;
long pabeaddr;
sceGsTexa texa;
long texaaddr;
sceGsFba fba2;
long fba2addr;
} sceGsAlphaEnv2 __attribute__((aligned(16)));
typedef struct {
sceGifTag giftag0;
sceGsBitbltbuf bitbltbuf;
long bitbltbufaddr;
sceGsTrxpos trxpos;
long trxposaddr;
sceGsTrxreg trxreg;
long trxregaddr;
sceGsTrxdir trxdir;
long trxdiraddr;
sceGifTag giftag1;
} sceGsLoadImage __attribute__((aligned(16)));
typedef struct {
u_int vifcode[4];
sceGifTag giftag;
sceGsBitbltbuf bitbltbuf;
long bitbltbufaddr;
sceGsTrxpos trxpos;
long trxposaddr;
sceGsTrxreg trxreg;
long trxregaddr;
sceGsFinish finish;
long finishaddr;
sceGsTrxdir trxdir;
long trxdiraddr;
} sceGsStoreImage __attribute__((aligned(16)));
typedef struct {
short sceGsInterMode;
short sceGsOutMode;
short sceGsFFMode;
short sceGsVersion;
volatile int (*sceGsVSCfunc)(int);
int sceGsVSCid;
} sceGsGParam __attribute__((aligned(16)));
#define SCE_GS_NOINTERLACE (0)
#define SCE_GS_INTERLACE (1)
#define SCE_GS_FIELD (0)
#define SCE_GS_FRAME (1)
#define SCE_GS_NTSC (0x2)
#define SCE_GS_PAL (0x3)
#define SCE_GS_VESA1A (0x1a) /* System Use */
#define SCE_GS_VESA1B (0x1b) /* System Use */
#define SCE_GS_VESA1C (0x1c) /* System Use */
#define SCE_GS_VESA1D (0x1d) /* System Use */
#define SCE_GS_VESA2A (0x2a) /* System Use */
#define SCE_GS_VESA2B (0x2b) /* System Use */
#define SCE_GS_VESA2C (0x2c) /* System Use */
#define SCE_GS_VESA2D (0x2d) /* System Use */
#define SCE_GS_VESA2E (0x2e) /* System Use */
#define SCE_GS_VESA3B (0x3b) /* System Use */
#define SCE_GS_VESA3C (0x3c) /* System Use */
#define SCE_GS_VESA3D (0x3d) /* System Use */
#define SCE_GS_VESA3E (0x3e) /* System Use */
#define SCE_GS_VESA4A (0x4a) /* System Use */
#define SCE_GS_VESA4B (0x4b) /* System Use */
#define SCE_GS_DTV480P (0x50)
#define SCE_GS_PSMCT32 (0)
#define SCE_GS_PSMCT24 (1)
#define SCE_GS_PSMCT16 (2)
#define SCE_GS_PSMCT16S (10)
#define SCE_GS_PSMT8 (19)
#define SCE_GS_PSMT4 (20)
#define SCE_GS_PSMT8H (27)
#define SCE_GS_PSMT4HL (36)
#define SCE_GS_PSMT4HH (44)
#define SCE_GS_PSMZ32 (48)
#define SCE_GS_PSMZ24 (49)
#define SCE_GS_PSMZ16 (50)
#define SCE_GS_PSMZ16S (58)
#define SCE_GS_ZNOUSE (0)
#define SCE_GS_ZALWAYS (1)
#define SCE_GS_ZGEQUAL (2)
#define SCE_GS_ZGREATER (3)
#define SCE_GS_NOCLEAR (0)
#define SCE_GS_CLEAR (1)
#define SCE_GS_MODULATE (0)
#define SCE_GS_DECAL (1)
#define SCE_GS_HILIGHT (2)
#define SCE_GS_GHLIGHT2 SCE_GS_HIGHLIGHT2
#define SCE_GS_HIGHLIGHT2 (3)
#define SCE_GS_NEAREST (0)
#define SCE_GS_LINEAR (1)
#define SCE_GS_NEAREST_MIPMAP_NEAREST (2)
#define SCE_GS_NEAREST_MIPMAP_LINEAR SCE_GS_NEAREST_MIPMAP_LENEAR
#define SCE_GS_NEAREST_MIPMAP_LENEAR (3)
#define SCE_GS_LINEAR_MIPMAP_NEAREST (4)
#define SCE_GS_LINEAR_MIPMAP_LINEAR (5)
#define SCE_GS_PRIM_POINT (0)
#define SCE_GS_PRIM_LINE (1)
#define SCE_GS_PRIM_LINESTRIP (2)
#define SCE_GS_PRIM_TRI (3)
#define SCE_GS_PRIM_TRISTRIP (4)
#define SCE_GS_PRIM_TRIFAN (5)
#define SCE_GS_PRIM_SPRITE (6)
#define SCE_GS_PRIM_IIP (1<<3)
#define SCE_GS_PRIM_TME (1<<4)
#define SCE_GS_PRIM_FGE (1<<5)
#define SCE_GS_PRIM_ABE (1<<6)
#define SCE_GS_PRIM_AA1 (1<<7)
#define SCE_GS_PRIM_FST (1<<8)
#define SCE_GS_PRIM_CTXT1 (0)
#define SCE_GS_PRIM_CTXT2 (1<<9)
#define SCE_GS_PRIM_FIX (1<<10)
#define SCE_GS_FALSE (0)
#define SCE_GS_TRUE (1)
#define SCE_GS_REPEAT (0)
#define SCE_GS_CLAMP (1)
#define SCE_GS_REGION_CLAMP (2)
#define SCE_GS_REGION_REPEAT (3)
#define SCE_GS_DEPTH_NEVER (0)
#define SCE_GS_DEPTH_ALWAYS (1)
#define SCE_GS_DEPTH_GEQUAL (2)
#define SCE_GS_DEPTH_GREATER (3)
#define SCE_GS_ALPHA_NEVER (0)
#define SCE_GS_ALPHA_ALWAYS (1)
#define SCE_GS_ALPHA_LESS (2)
#define SCE_GS_ALPHA_LEQUAL (3)
#define SCE_GS_ALPHA_EQUAL (4)
#define SCE_GS_ALPHA_GEQUAL (5)
#define SCE_GS_ALPHA_GREATER (6)
#define SCE_GS_ALPHA_NOTEQUAL (7)
#define SCE_GS_AFAIL_KEEP (0)
#define SCE_GS_AFAIL_FB_ONLY (1)
#define SCE_GS_AFAIL_ZB_ONLY (2)
#define SCE_GS_AFAIL_RGB_ONLY (3)
#define SCE_GS_ALPHA_CS (0)
#define SCE_GS_ALPHA_CD (1)
#define SCE_GS_ALPHA_ZERO (2)
#define SCE_GS_ALPHA_AS (0)
#define SCE_GS_ALPHA_AD (1)
#define SCE_GS_ALPHA_FIX (2)
#if defined(__LANGUAGE_C_PLUS_PLUS)||defined(__cplusplus)||defined(c_plusplus)
extern "C" {
#endif
void sceGsResetGraph(short mode, short inter, short omode, short ffmode);
sceGsGParam *sceGsGetGParam(void);
void sceGsResetPath(void);
void sceGsSetDefDispEnv(sceGsDispEnv *disp, short psm, short w, short h, short dx, short dy);
void sceGsPutDispEnv(sceGsDispEnv *disp);
int sceGsSetDefDrawEnv(sceGsDrawEnv1 *draw, short psm, short w, short h, short ztest, short zpsm);
int sceGsPutDrawEnv(sceGifTag *giftag);
void sceGsSetDefDBuff(sceGsDBuff *dp, short psm, short w, short h, short ztest, short zpsm, short clear);
int sceGsSwapDBuff(sceGsDBuff *db, int id);
int sceGsSyncV(int mode);
int sceGsSyncPath(int mode, u_short timeout);
int sceGsSetDefTexEnv(sceGsTexEnv *tp, short flush, short tbp0, short tbw, short psm, short w, short h, short tfx, short cbp, short cpsm, short cld, short filter);
int sceGsSetDefAlphaEnv(sceGsAlphaEnv *ap, short pabe);
int sceGsSetDefClear(sceGsClear *cp, short ztest, short x, short y, short w, short h, u_char r, u_char g, u_char b, u_char a, u_int z);
int sceGsSetDefLoadImage(sceGsLoadImage *lp, short dbp, short dbw, short dpsm, short x, short y, short w, short h);
int sceGsSetDefStoreImage(sceGsStoreImage *sp, short sbp, short sbw, short spsm, short x, short y, short w, short h);
int sceGsExecLoadImage(sceGsLoadImage *lp, u_long128 *srcaddr);
int sceGsExecStoreImage(sceGsStoreImage *sp, u_long128 *dstaddr);
int *sceGsSyncVCallback(int (*func)(int));
u_long sceGsPutIMR(u_long imr);
u_long sceGsGetIMR(void);
u_long isceGsPutIMR(u_long imr);
u_long isceGsGetIMR(void);
void sceGsSetHalfOffset(sceGsDrawEnv1 *draw, short centerx, short centery, short halfoff);
int sceGsSetDefDrawEnv2(sceGsDrawEnv2 *draw, short psm, short w, short h, short ztest, short zpsm);
int sceGsSetDefClear2(sceGsClear *cp, short ztest, short x, short y, short w, short h, u_char r, u_char g, u_char b, u_char a, u_int z);
int sceGsSetDefTexEnv2(sceGsTexEnv2 *tp, short flush, short tbp0, short tbw, short psm, short w, short h, short tfx, short cbp, short cpsm, short cld, short filter);
int sceGsSetDefAlphaEnv2(sceGsAlphaEnv2 *ap, short pabe);
void sceGsSetHalfOffset2(sceGsDrawEnv2 *draw, short centerx, short cyntery, short halfoff);
void sceGsSetDefDBuffDc(sceGsDBuffDc *db, short psm, short w, short h, short ztest, short zpsm, short clear);
int sceGsSwapDBuffDc(sceGsDBuffDc *db, int id);
#if defined(__LANGUAGE_C_PLUS_PLUS)||defined(__cplusplus)||defined(c_plusplus)
}
#endif
#endif /* _LIBGRAPH_H */

611
include/ee/libhig.h Normal file
View File

@ -0,0 +1,611 @@
/* SCE CONFIDENTIAL
"PlayStation 2" Programmer Tool Runtime Library Release 2.5
*/
/*
* Emotion Engine Library
*
* Copyright (C) 2000 Sony Computer Entertainment Inc.
* All Rights Reserved.
*
* libhig - libhig.h
*
* Version Date Design Log
* --------------------------------------------------------------------
* Sep,20,2000 kaneko
*/
/* $Id: libhig.h,v 1.26.6.5 2002/02/25 12:26:48 xokano Exp $ */
#ifndef __HiG_H__
#define __HiG_H__
#ifdef __cplusplus
extern "C" {
#endif
#ifndef _eestruct_
#include <eestruct.h> /* necessary header */
#endif
#ifndef _LIB_VU0_H_
#include <libvu0.h> /* necessary header */
#endif
#ifndef _LIBGRAPH_H
#include <libgraph.h> /* necessary header */
#endif
/*********************************************************************************
* Error Codes
*********************************************************************************/
/* HiG Error Code (number 0 - 127 reserved) */
typedef enum _sceHiErr{
SCE_HIG_NO_ERR = 0,
SCE_HIG_NO_HEAP,
SCE_HIG_INVALID_VALUE,
SCE_HIG_INVALID_DATA,
SCE_HIG_FAILURE,
HIG_NO_ERR = SCE_HIG_NO_ERR
}sceHiErr;
/*********************************************************************************
* TYPE DEFINES
*********************************************************************************/
/* HiG Data Header structure */
typedef struct _sceHiHeader{
u_int ver; /* 0-7bit is 'status' (same place of (sceHiPlug).type */
u_int reserve1;
u_int reserve2;
u_int qsize;
} sceHiHeader;
typedef struct _sceHiHeadData{
char plug_name[12];
struct _sceHiPlug *plug_blk_addr;
} sceHiHeadData;
/* plugin type structure */
typedef struct _sceHiType {
unsigned long repository:8;
unsigned long project:8;
unsigned long category:8;
unsigned long status:8;
unsigned long id:24;
unsigned long revision:8;
} sceHiType;
enum {
SCE_HIG_REPOSITORY_O = 0,
SCE_HIG_PROJECT_O = 8,
SCE_HIG_CATEGORY_O = 16,
SCE_HIG_STATUS_O = 24,
SCE_HIG_ID_O = 32,
SCE_HIG_REVISION_O = 56,
};
#define SCE_HIG_REPOSITORY_M (0x00000000000000ffUL)
#define SCE_HIG_PROJECT_M (0x000000000000ff00UL)
#define SCE_HIG_CATEGORY_M (0x0000000000ff0000UL)
#define SCE_HIG_STATUS_M (0x00000000ff000000UL)
#define SCE_HIG_ID_M (0x00ffffff00000000UL)
#define SCE_HIG_REVISION_M (0xff00000000000000UL)
enum {
SCE_HIG_STATUS_MAP_O = 0x01,
SCE_HIG_STATUS_DATA_O = 0x02,
SCE_HIG_STATUS_REF_O = 0x03,
SCE_HIG_STATUS_STOP_O = 0x04
};
/* plugin block handle structure */
typedef struct _sceHiPlug {
sceHiType type;
void *myapi;
u_int size;
char nplug;
char ndata;
char reserve[6];
u_int stack;
u_int args;
qword list;
} sceHiPlug;
/* plugin block & plugin data block list structure */
typedef struct _sceHiList {
sceHiType type;
u_int *addr;
u_int reserve;
} sceHiList;
/* plugin data block structure */
typedef struct _sceHiData {
sceHiType type;
char count;
char reserve[3];
u_int size;
u_int data[1];
} sceHiData;
/* plugin regist table structure */
typedef struct _sceHiPlugTable {
sceHiType type;
void *func;
} sceHiPlugTable;
/* sceHiG Error State Structure */
typedef struct _sceHiErrStateType {
sceHiPlug *top; /* Root of plugin (if not in *plugin* then NULL */
sceHiPlug *plug; /* Err plugin (if not in *plugin* then NULL*/
int process; /* Err plugin process (if not in *plugin then -1 */
sceHiType type; /* plugin type (if not in *plugin* then 0 */
const char *mes; /* error message (if no err then NULL) */
} sceHiErrStateType;
extern sceHiErrStateType sceHiErrState;
/*********************************************************************************
* FUNCTIONS
*********************************************************************************/
extern sceHiErr sceHiRegistTable(sceHiPlugTable *, u_int);
extern sceHiErr sceHiParseHeader(u_int *);
extern sceHiErr sceHiGetPlug(u_int *, char *, sceHiPlug **);
extern sceHiErr sceHiCallPlug(sceHiPlug *, int);
extern sceHiErr sceHiGetInsPlug(sceHiPlug *, sceHiPlug **, sceHiType);
extern sceHiErr sceHiGetPlugList(sceHiPlug *, sceHiList **, sceHiType);
extern sceHiErr sceHiGetList(sceHiPlug *, sceHiList **, sceHiType);
extern sceHiErr sceHiGetData(sceHiPlug *, u_int **, sceHiType);
extern sceHiErr sceHiMakeType(sceHiType *, u_long *);
extern sceHiErr sceHiGetType(sceHiType *, sceHiType *);
extern sceHiErr sceHiNewPlugBlk(int, int, sceHiPlug **, sceHiType *);
extern sceHiErr sceHiSetPlugType(sceHiPlug *, sceHiType *);
extern sceHiErr sceHiSetDataType(sceHiData *, sceHiType *);
extern sceHiErr sceHiSetPluginApi(sceHiPlug *);
extern sceHiErr sceHiAddPlugBlk(sceHiPlug *, sceHiPlug *);
extern sceHiErr sceHiInsPlugBlk(sceHiPlug *, sceHiPlug *, int);
extern sceHiErr sceHiAddDataBlk(sceHiPlug *, sceHiData *);
extern sceHiErr sceHiInsDataBlk(sceHiPlug *, sceHiData *, int);
extern sceHiErr sceHiRmvPlugBlk(sceHiPlug *, sceHiPlug *);
extern sceHiErr sceHiRmvDataBlk(sceHiPlug *, sceHiData *);
extern sceHiErr sceHiMakeDataBlk(u_int *, sceHiData **, sceHiType *);
extern sceHiErr sceHiGetPlugPlace(sceHiPlug *, sceHiPlug *, int *);
extern sceHiErr sceHiGetDataPlace(sceHiPlug *, sceHiData *, int *);
extern sceHiErr sceHiStopPlugStatus(sceHiPlug *);
extern sceHiErr sceHiContPlugStatus(sceHiPlug *);
extern sceHiErr sceHiStopPlugListStatus(sceHiList *);
extern sceHiErr sceHiContPlugListStatus(sceHiList *);
/*********************************************************************************
* MACROS
*********************************************************************************/
/* HiG Version */
#define SCE_HIG_VERSION 0x000001
/* default plugins process */
#define SCE_HIG_INIT_PROCESS 1
#define SCE_HIG_PRE_PROCESS 2
#define SCE_HIG_POST_PROCESS 3
#define SCE_HIG_END_PROCESS 4
/* default converter variables */
#define SCE_HIG_HEADER_STATUS 0
#define SCE_HIG_PLUGIN_STATUS 0
#define SCE_HIG_DATA_STATUS 0
/*********************************************************************************
* Mem Services
*********************************************************************************/
extern void *sceHiMemAlloc(size_t);
extern void *sceHiMemAlign(size_t, size_t);
extern void sceHiMemFree(void *);
extern void *sceHiMemRealloc(void *, size_t);
extern void *sceHiMemCalloc(size_t, size_t);
extern sceHiErr sceHiMemInit(void *, size_t);
extern sceHiErr sceHiMemGetUsedSize(int *);
extern sceHiErr sceHiMemGetNousedSize(int *);
/*********************************************************************************
* DMA Services
*********************************************************************************/
typedef enum {
SCE_UPF_S32 = 0x00, /* 0b0000 */
SCE_UPF_S16 = 0x01, /* 0b0001 */
SCE_UPF_S8 = 0x02, /* 0b0010 */
SCE_UPF_V2_32 = 0x04, /* 0b0100 */
SCE_UPF_V2_16 = 0x05, /* 0b0101 */
SCE_UPF_V2_8 = 0x06, /* 0b0110 */
SCE_UPF_V3_32 = 0x08, /* 0b1000 */
SCE_UPF_V3_16 = 0x09, /* 0b1001 */
SCE_UPF_V3_8 = 0x0a, /* 0b1010 */
SCE_UPF_V4_32 = 0x0c, /* 0b1100 */
SCE_UPF_V4_16 = 0x0d, /* 0b1101 */
SCE_UPF_V4_8 = 0x0e, /* 0b1110 */
SCE_UPF_V4_5 = 0x0f /* 0b1111 */
} sceHiDMAUnpackFormat_t;
typedef int sceHiDMAChainID_t;
typedef struct {
sceHiDMAUnpackFormat_t fmt; /* unpack format */
int irq; /* vif irq bit */
int pack_active;/* pack data quantity of activity */
} sceHiDMAState_t;
extern sceHiErr sceHiDMAInit(void *(*)(size_t, size_t), void (*)(void *), size_t);
extern sceHiErr sceHiDMAInit_DBuf(int, int);
extern sceHiErr sceHiDMARegist(sceHiDMAChainID_t);
extern sceHiErr sceHiDMASend(void);
extern sceHiErr sceHiDMASendI(void);
extern sceHiErr sceHiDMAWait(void);
extern sceHiErr sceHiDMASwap(void);
extern sceHiErr sceHiDMAMake_ChainStart(void);
extern sceHiErr sceHiDMAMake_ChainEnd(sceHiDMAChainID_t *);
extern sceHiErr sceHiDMAMake_DynamicChainStart(void);
extern sceHiErr sceHiDMAMake_DynamicChainEnd(void);
extern sceHiErr sceHiDMADel_Chain(sceHiDMAChainID_t);
extern sceHiErr sceHiDMAPurge(void);
extern sceHiErr sceHiDMAMake_DBufStart(void);
extern sceHiErr sceHiDMAMake_DBufEnd(void);
extern sceHiErr sceHiDMAMake_LoadMicro(char *, size_t);
extern sceHiErr sceHiDMAMake_ExecMicro(void);
extern sceHiErr sceHiDMAMake_ExecMicroAddr(int);
extern sceHiErr sceHiDMAMake_ContinueMicro(void);
extern sceHiErr sceHiDMAMake_WaitMicro(void);
extern sceHiErr sceHiDMAMake_LoadImm(u_int *, qword);
extern sceHiErr sceHiDMAMake_LoadPtr(u_int *, u_int *, size_t);
extern sceHiErr sceHiDMAMake_CallID(sceHiDMAChainID_t);
extern sceHiErr sceHiDMAMake_CallPtr(u_int *);
extern sceHiErr sceHiDMAMake_LoadStep(u_int *, u_int *, size_t, int, int);
extern sceHiErr sceHiDMAMake_LumpStart(u_int *);
extern sceHiErr sceHiDMAMake_LumpEnd(void);
extern sceHiErr sceHiDMAMake_Lump(qword);
extern sceHiErr sceHiDMAMake_LoadGSLump(u_int *, size_t);
extern sceHiErr sceHiDMAMake_LoadGS(u_int *, size_t);
extern sceHiErr sceHiDMAGet_ChainAddr(sceHiDMAChainID_t, u_int **);
extern sceHiErr sceHiDMASet_BufferPtr(u_int *);
extern sceHiErr sceHiDMAGet_BufferPtr(u_int **);
/*********************************************************************************
* Gs Services
*********************************************************************************/
#define SCE_HIGS_MEM_TOP (0x000000) /* default top word address */
#define SCE_HIGS_MEM_END (0x100000) /* default end word address */
#define SCE_HIGS_PAGE_SIZE (8192) /* byte size 8*1024 */
#define SCE_HIGS_BLOCK_SIZE (256) /* byte size */
#define SCE_HIGS_COLUMN_SIZE (64) /* byte size */
#define SCE_HIGS_PAGE_ALIGN (2048) /* 2K word */
#define SCE_HIGS_BLOCK_ALIGN (64) /* 64 word */
#define SCE_HIGS_COLUMN_ALIGN (16) /* 16 word */
#define SCE_HIGS_ALIGN_ADDR(addr, align) (((addr + (align-1))/align)*align)
typedef struct _sceHiGsMemTbl{
u_int align; /* buffer alignment */
u_int addr; /* buffer address */
u_int size; /* buffer size */
struct _sceHiGsMemTbl *next; /* next chunk table */
}sceHiGsMemTbl;
typedef enum _sceHiGsDisp_t{
SCE_HIGS_NTSC, /* NTSC non interlace */
SCE_HIGS_NTSCI, /* NTSC interlace */
SCE_HIGS_PAL, /* PAL non interlace */
SCE_HIGS_PALI, /* PAL interlace */
SCE_HIGS_NTSCIH, /* NTSC interlace field mode */
SCE_HIGS_PALIH /* PAL interlace field mode */
}sceHiGsDisp_t;
typedef enum _sceHiGsRGBA_t{
SCE_HIGS_RGBA = (0<<5), /* PSMCT32 */
SCE_HIGS_RGB = (1<<5), /* PSMCT24 */
SCE_HIGS_RGBA16 = (2<<5), /* PSMCT16 */
SCE_HIGS_RGBA16S = (3<<5) /* PSMCT16S */
}sceHiGsRGBA_t;
typedef enum _sceHiGsReset_t{
SCE_HIGS_RESET = (0<<7), /* reset GS */
SCE_HIGS_FLUSH = (1<<7) /* flush GS */
}sceHiGsReset_t;
typedef enum _sceHiGsDEPTH_t{
SCE_HIGS_DEPTH0 = (0<<8), /* no Z */
SCE_HIGS_DEPTH = (1<<8), /* PSMZ32 */
SCE_HIGS_DEPTH24 = (2<<8), /* PSMZ24 */
SCE_HIGS_DEPTH16 = (3<<8), /* PSMZ16 */
SCE_HIGS_DEPTH16S = (4<<8) /* PSMZ16S */
}sceHiGsDEPTH_t;
typedef enum _sceHiGsBUFFERING_t{
SCE_HIGS_DOUBLE = (0<<11), /* double buffer */
SCE_HIGS_SINGLE = (1<<11) /* single buffer */
}sceHiGsBUFFERING_t;
#define SCE_HIGS_DISP_M (0x001f)
#define SCE_HIGS_RGBA_M (0x0060)
#define SCE_HIGS_RESET_M (0x0080)
#define SCE_HIGS_DEPTH_M (0x0700)
#define SCE_HIGS_BUFFERING_M (0x1800)
#define SCE_HIGS_DISP_O (0)
#define SCE_HIGS_RGBA_O (5)
#define SCE_HIGS_RESET_O (7)
#define SCE_HIGS_DEPTH_O (8)
#define SCE_HIGS_BUFFERING_O (8)
typedef enum _sceHiGsClear_t{
SCE_HIGS_CLEAR_KEEP = 0,
SCE_HIGS_CLEAR_COLOR = 1,
SCE_HIGS_CLEAR_DEPTH = 2,
SCE_HIGS_CLEAR_RGB = 3,
SCE_HIGS_CLEAR_ALL = 4
}sceHiGsClear_t;
typedef struct _sceHiGsDisplay{
int swap;
sceGsDBuff dbuf;
}sceHiGsDisplay;
typedef struct _sceHiGsContext{
sceGsFrame frame;
sceGsZbuf zbuf;
sceGsTex0 tex0;
sceGsTex1 tex1;
sceGsTex2 tex2;
sceGsMiptbp1 miptbp1;
sceGsMiptbp2 miptbp2;
sceGsClamp clamp;
sceGsTest test;
sceGsAlpha alpha;
sceGsXyoffset xyoffset;
sceGsScissor scissor;
sceGsFba fba;
}sceHiGsContext;
typedef struct _sceHiGsGeneral {
sceGsColclamp colclamp;
sceGsDimx dimx;
sceGsDthe dthe;
sceGsFog fog;
sceGsFogcol fogcol;
sceGsPabe pabe;
sceGsTexa texa;
sceGsPrmode prmode;
sceGsPrmodecont prmodecont;
} sceHiGsGeneral;
typedef struct _sceHiGsGifTag{
unsigned long nloop:15;
unsigned long eop:1;
unsigned long id:30;
unsigned long pre:1;
unsigned long prim:11;
unsigned long flg:2;
unsigned long nreg:4;
unsigned long regs:64;
}sceHiGsGiftag;
typedef struct _sceHiGsPacked_t{
u_long data; /* :64 */
u_char addr; /* :8 */
unsigned long padd:56;
}sceHiGsPacked_t;
typedef struct _sceHiGsPacked{
sceHiGsGiftag *giftag;
sceHiGsPacked_t *packed;
}sceHiGsPacked;
typedef enum _sceHiGsFbw_t {
SCE_HIGS_FBW_KEEP = (-1),
SCE_HIGS_FBW_DEFAULT = (-2)
} sceHiGsFbw_t;
typedef struct {
sceHiGsGiftag giftag;
sceGsClear clear;
} sceHiGsClearPacket __attribute__((aligned(64)));
typedef struct {
sceHiGsClearPacket clearp;
sceHiGsPacked packed; /* DMA packet area */
sceHiGsContext value; /* context registers */
u_short fbp[2];
u_short validregs;
u_char clearmode;
u_char ctxt; /* 設定するコンテキスト */
u_char swap; /* double buffer 時: 描画中のバッファ,他: 常に 0 */
u_char field;
u_char isDbuf; /* double buffer するか */
u_char isSync; /* sceHiGsDisplaySwap() で swap するか */
u_char isInterlace;
u_char isZbuf; /* Zbuf つきか */
char ppos[2]; /* positions in packed[] of xyoffset, frame */
} sceHiGsCtx __attribute__((aligned(64)));
typedef struct {
sceHiGsPacked packed; /* DMA packet area */
u_long *value;
u_int validregs;
} sceHiGsEnv __attribute__((aligned(16)));
typedef enum _sceHiGsEnvValidRegs_t { /* sceHiGsGeneral と同じならび順 */
SCE_HIGS_VALID_COLCLAMP = (1<<0),
SCE_HIGS_VALID_DIMX = (1<<1),
SCE_HIGS_VALID_DTHE = (1<<2),
SCE_HIGS_VALID_FOG = (1<<3),
SCE_HIGS_VALID_FOGCOL = (1<<4),
SCE_HIGS_VALID_PABE = (1<<5),
SCE_HIGS_VALID_TEXA = (1<<6),
SCE_HIGS_VALID_PRMODE = (1<<7),
SCE_HIGS_VALID_PRMODECONT=(1<<8),
/* -- */
SCE_HIGS_VALID_TEXCLUT=(1<<9),
SCE_HIGS_VALID_SCANMSK=(1<<10),
SCE_HIGS_VALID_TEXFLUSH=(1<<11),
SCE_HIGS_VALID_BITBLT=(1<<12),
SCE_HIGS_VALID_TRXPOS=(1<<13),
SCE_HIGS_VALID_TRXREG=(1<<14),
SCE_HIGS_VALID_TRXDIR=(1<<15),
SCE_HIGS_VALID_SIGNAL=(1<<16),
SCE_HIGS_VALID_FINISH=(1<<17),
SCE_HIGS_VALID_LABEL=(1<<18)
} sceHiGsEnvValidRegs_t;
typedef enum _sceHiGsCtxValidRegs_t {
SCE_HIGS_VALID_FRAME = (1<<0),
SCE_HIGS_VALID_ZBUF = (1<<1),
SCE_HIGS_VALID_TEX0 = (1<<2),
SCE_HIGS_VALID_TEX1 = (1<<3),
SCE_HIGS_VALID_TEX2 = (1<<4),
SCE_HIGS_VALID_MIPTBP1 = (1<<5),
SCE_HIGS_VALID_MIPTBP2 = (1<<6),
SCE_HIGS_VALID_CLAMP = (1<<7),
SCE_HIGS_VALID_TEST = (1<<8),
SCE_HIGS_VALID_ALPHA = (1<<9),
SCE_HIGS_VALID_XYOFFSET = (1<<10),
SCE_HIGS_VALID_SCISSOR = (1<<11),
SCE_HIGS_VALID_FBA = (1<<12)
} sceHiGsCtxValidRegs_t;
extern sceHiGsCtx *sceHiGsStdCtx;
extern sceHiGsEnv *sceHiGsStdEnv;
extern sceHiErr sceHiGsMemInit(u_int addr, size_t size);
extern sceHiGsMemTbl *sceHiGsMemAlloc(u_int align, size_t size);
extern sceHiErr sceHiGsMemFree(sceHiGsMemTbl *tbl);
extern sceHiGsMemTbl *sceHiGsMemRealloc(sceHiGsMemTbl *tbl, u_int align, size_t size);
extern sceHiErr sceHiGsMemAddTbl(sceHiGsMemTbl *tbl);
extern size_t sceHiGsMemRestSize(void);
extern size_t sceHiGsMemRestSizePlus(void);
extern sceHiErr sceHiGsMemPrintTbl(void);
extern sceHiGsDisplay *sceHiGsDisplayStatus(void);
extern sceHiErr sceHiGsDisplaySet(u_int w, u_int h, u_int psm, u_int zpsm);
extern sceHiErr sceHiGsDisplayEnd(void);
extern sceHiErr sceHiGsDisplayMode(u_int mode);
extern sceHiErr sceHiGsDisplaySize(u_int width, u_int height);
extern sceHiErr sceHiGsDisplaySwap(int field);
extern sceHiErr sceHiGsClearColor(u_char red, u_char green, u_char blue, u_char alpha);
extern sceHiErr sceHiGsClearDepth(u_int z);
extern sceHiErr sceHiGsClear(u_int mode);
extern size_t sceHiGsBlockSize(u_int w, u_int h, u_int psm);
extern size_t sceHiGsPageSize(u_int w, u_int h, u_int psm);
extern sceHiErr sceHiGsContextID(int id);
extern sceHiGsContext *sceHiGsContextStatus(void);
extern sceHiGsGeneral *sceHiGsGeneralStatus(void);
extern sceHiErr sceHiGsPackedDelete(sceHiGsPacked *p);
extern sceHiGsPacked *sceHiGsPackedCreate(u_char *addr, u_short n);
extern sceHiErr sceHiGsPackedUpdate(sceHiGsPacked *p);
extern sceHiErr sceHiGsFrameRegs(int fbp, int fbw, int psm, int fbmsk);
extern sceHiErr sceHiGsZbufRegs(int zbp, int psm, int zmsk);
extern sceHiErr sceHiGsTex0Regs(int tbp0, int tbw, int psm, int tw, int th, int tcc, int tfx, int cbp, int cpsm, int csm, int csa, int cld);
extern sceHiErr sceHiGsTex1Regs(int lcm, int mxl, int mmag, int mmin, int mtba, int l, int k);
extern sceHiErr sceHiGsMiptbp1Regs(int tbp1, int tbw1, int tbp2, int tbw2, int tbp3, int tbw3);
extern sceHiErr sceHiGsMiptbp2Regs(int tbp4, int tbw4, int tbp5, int tbw5, int tbp6, int tbw6);
extern sceHiErr sceHiGsClampRegs(int wms, int wmt, int minu, int maxu, int minv, int maxv);
extern sceHiErr sceHiGsTestRegs(int ate, int atst, int aref, int afail, int date, int datm, int zte, int ztst);
extern sceHiErr sceHiGsAlphaRegs(int a, int b, int c, int d, int fix);
extern sceHiErr sceHiGsXyoffsetRegs(int ofx, int ofy);
extern sceHiErr sceHiGsFbaRegs(int fba);
extern sceHiErr sceHiGsColclampRegs(int clamp);
extern sceHiErr sceHiGsDimxRegs(int dm[16]);
extern sceHiErr sceHiGsDtheRegs(int dthe);
extern sceHiErr sceHiGsFogRegs(int f);
extern sceHiErr sceHiGsFogcolRegs(int fcr, int fcg, int fcb);
extern sceHiErr sceHiGsPabeRegs(int pabe);
extern sceHiErr sceHiGsTexaRegs(int ta0, int aem, int ta1);
extern sceHiErr sceHiGsPrmodeRegs(int iip, int tme, int fge, int abe, int aa1, int fst, int ctxt, int fix);
extern sceHiErr sceHiGsPrmodecontRegs(int ac);
extern sceHiErr sceHiGsCtxSetMax(int num);
extern sceHiErr sceHiGsCtxSetDefault(sceHiGsCtx *gsctx);
extern sceHiErr sceHiGsEnvSetDefault(sceHiGsEnv *gsenv);
extern sceHiGsCtx *sceHiGsCtxGetDefault(void);
extern sceHiGsEnv *sceHiGsEnvGetDefault(void);
extern sceHiErr sceHiGsEnvRegist(sceHiGsEnv *gsenv);
extern sceHiErr sceHiGsServiceInit(void);
extern sceHiErr sceHiGsServiceExit(void);
extern sceHiErr sceHiGsEnvUpdate(sceHiGsEnv *gsenv);
extern sceHiErr sceHiGsEnvDelete(sceHiGsEnv *gsenv);
extern sceHiGsEnv *sceHiGsEnvCreate(u_int validregs);
extern sceHiGsCtx *sceHiGsCtxCreate(int isDbuf);
extern sceHiErr sceHiGsCtxDelete(sceHiGsCtx *gsctx);
extern sceHiErr sceHiGsCtxSwapAll(int swap, int field);
extern sceHiErr sceHiGsCtxSwap(sceHiGsCtx *gsctx, int swap, int field);
extern sceHiErr sceHiGsCtxSetHalfOffset(sceHiGsCtx *gsctx, int field);
extern sceHiErr sceHiGsEnvCopy(sceHiGsEnv *dst, sceHiGsEnv *src);
extern sceHiErr sceHiGsCtxCopy(sceHiGsCtx *dst, sceHiGsCtx *src);
extern sceHiErr sceHiGsCtxRegist(sceHiGsCtx *gsctx, int clear);
extern sceHiErr sceHiGsCtxSend(sceHiGsCtx *gsctx, int clear);
extern sceHiErr sceHiGsCtxFcache(sceHiGsCtx *gsctx, int clear);
extern sceHiErr sceHiGsEnvSend(sceHiGsEnv *gsenv);
extern sceHiErr sceHiGsCtxUpdate(sceHiGsCtx *gsctx);
extern sceHiErr sceHiGsCtxSetClearColor(sceHiGsCtx *gsctx, u_char red, u_char green, u_char blue, u_char alpha);
extern sceHiErr sceHiGsCtxSetClearZ(sceHiGsCtx *gsctx, u_int z);
extern sceHiErr sceHiGsCtxSetClearMode(sceHiGsCtx *gsctx, u_int mode);
extern u_int sceHiGsCtxChkSize(sceHiGsCtx *gsctx);
extern sceHiErr sceHiGsCtxSetDepth(sceHiGsCtx *gsctx, int psm, int zpsm, int isZbuf);
extern sceHiErr sceHiGsCtxSetColorDepth(sceHiGsCtx *gsctx, int psm);
extern sceHiErr sceHiGsCtxSetZbufDepth(sceHiGsCtx *gsctx, int zpsm, int isZbuf);
extern sceHiErr sceHiGsCtxSetRect(sceHiGsCtx *gsctx, int x, int y, int w, int h, int fbw);
extern sceHiErr sceHiGsCtxSetLumpBuffer(sceHiGsCtx *gsctx, u_int bp);
extern sceHiErr sceHiGsCtxSetEachBuffer(sceHiGsCtx *gsctx, u_int fbp0, u_int fbp1, u_int zbp);
extern sceHiErr sceHiGsCtxShiftBuffers(sceHiGsCtx *gsctx, int fbpoffset);
extern sceHiErr sceHiGsCtxGetTex0(sceHiGsCtx *gsctx, u_long *tex0, int swap, int tcc, int tfx);
extern sceHiErr sceHiGsCtxSetContext(sceHiGsCtx *gsctx, int context);
extern sceHiErr sceHiGsCtxSetFrame(sceHiGsCtx *gsctx, int fbp0, int fbp1, int fbw, int psm, int fbmsk);
extern sceHiErr sceHiGsCtxSetRegZbuf(sceHiGsCtx *gsctx, int zbp, int psm, int zmsk);
extern sceHiErr sceHiGsCtxSetRegTex0(sceHiGsCtx *gsctx, int tbp0, int tbw, int psm, int tw, int th, int tcc, int tfx, int cbp, int cpsm, int csm, int csa, int cld);
extern sceHiErr sceHiGsCtxSetRegTex1(sceHiGsCtx *gsctx, int lcm, int mxl, int mmag, int mmin, int mtba, int l, int k);
extern sceHiErr sceHiGsCtxSetRegMiptbp1(sceHiGsCtx *gsctx, int tbp1, int tbw1, int tbp2, int tbw2, int tbp3, int tbw3);
extern sceHiErr sceHiGsCtxSetRegMiptbp2(sceHiGsCtx *gsctx, int tbp4, int tbw4, int tbp5, int tbw5, int tbp6, int tbw6);
extern sceHiErr sceHiGsCtxSetRegClamp(sceHiGsCtx *gsctx, int wms, int wmt, int minu, int maxu, int minv, int maxv);
extern sceHiErr sceHiGsCtxSetRegTest(sceHiGsCtx *gsctx, int ate, int atst, int aref, int afail, int date, int datm, int zte, int ztst);
extern sceHiErr sceHiGsCtxSetRegAlpha(sceHiGsCtx *gsctx, int a, int b, int c, int d, int fix);
extern sceHiErr sceHiGsCtxSetRegXyoffset(sceHiGsCtx *gsctx, int ofx, int ofy);
extern sceHiErr sceHiGsCtxSetRegFba(sceHiGsCtx *gsctx, int fba);
extern sceHiErr sceHiGsEnvSetRegColclamp(sceHiGsEnv *gsenv, int clamp);
extern sceHiErr sceHiGsEnvSetRegDimx(sceHiGsEnv *gsenv, int dm[16]);
extern sceHiErr sceHiGsEnvSetRegDthe(sceHiGsEnv *gsenv, int dthe);
extern sceHiErr sceHiGsEnvSetRegFog(sceHiGsEnv *gsenv, int f);
extern sceHiErr sceHiGsEnvSetRegFogcol(sceHiGsEnv *gsenv, int fcr, int fcg, int fcb);
extern sceHiErr sceHiGsEnvSetRegPabe(sceHiGsEnv *gsenv, int pabe);
extern sceHiErr sceHiGsEnvSetRegTexa(sceHiGsEnv *gsenv, int ta0, int aem, int ta1);
extern sceHiErr sceHiGsEnvSetRegPrmode(sceHiGsEnv *gsenv, int iip, int tme, int fge, int abe, int aa1, int fst, int ctxt, int fix);
extern sceHiErr sceHiGsEnvSetRegPrmodecont(sceHiGsEnv *gsenv, int ac);
extern sceHiErr sceHiGsCtxSetDefaultValues(sceHiGsCtx *gsctx, int psm, int zpsm, int isZbuf, int w, int h);
extern sceHiErr sceHiGsServiceSetRegistFunc(int (*func)(void *, int));
extern sceHiErr sceHiGsCtxGetRect(sceHiGsCtx *gsctx, int *xyzw);
extern sceHiErr sceHiGsCtxSetByDBuff(sceHiGsCtx *gsctx, sceGsDBuff *dbuf);
extern sceHiErr sceHiGsCtxFcacheI(sceHiGsCtx *gsctx, int clear);
extern sceHiErr sceHiGsEnvFcache(sceHiGsEnv *gsenv);
extern sceHiErr sceHiGsEnvFcacheI(sceHiGsEnv *gsenv);
extern sceHiErr sceHiGsCtxSendClear(sceHiGsCtx *gsctx);
extern sceHiErr sceHiGsCtxRegistClear(sceHiGsCtx *gsctx);
extern sceHiErr sceHiGsCtxGetClamp(sceHiGsCtx *gsctx, u_long *clamp, int w_repeat, int h_repeat);
extern sceHiErr sceHiGsEnvSetRegTexclut(sceHiGsEnv *gsenv, int cbw, int cou, int cov);
extern sceHiErr sceHiGsEnvSetRegScanmsk(sceHiGsEnv *gsenv, int msk);
extern sceHiErr sceHiGsEnvSetRegBitblt(sceHiGsEnv *gsenv, int sbp, int sbw, int spsm, int dbp, int dbw, int dpsm);
extern sceHiErr sceHiGsEnvSetRegTrxpos(sceHiGsEnv *gsenv, int ssax, int ssay, int dsax, int dsay, int dir);
extern sceHiErr sceHiGsEnvSetRegTrxreg(sceHiGsEnv *gsenv, int rrw, int rrh);
extern sceHiErr sceHiGsEnvSetRegTrxdir(sceHiGsEnv *gsenv, int xdr);
extern sceHiErr sceHiGsEnvSetRegSignal(sceHiGsEnv *gsenv, u_int id, u_int idmsk);
extern sceHiErr sceHiGsEnvSetRegLabel(sceHiGsEnv *gsenv, u_int id, u_int idmsk);
#ifdef __cplusplus
}
#endif
#endif /* !__HiG_H__ */

441
include/ee/libhip.h Normal file
View File

@ -0,0 +1,441 @@
/* SCE CONFIDENTIAL
"PlayStation 2" Programmer Tool Runtime Library Release 2.5.3
*/
/*
* Emotion Engine Library
*
* Copyright (C) 2000 Sony Computer Entertainment Inc.
* All Rights Reserved.
*
* libhip - libhip.h
*
* Version Date Design Log
* --------------------------------------------------------------------
* Sep,19,2000 kaneko
*/
/* $Id: libhip.h,v 1.24 2002/05/20 02:17:30 kaneko Exp $ */
#ifndef __HIP_H__
#define __HIP_H__
#ifdef __cplusplus
extern "C" {
#endif
/*********************************************************************************
* CONSTANTS
*********************************************************************************/
/* Micro Code ID for micro plug*/
typedef enum {
SCE_HIP_MICRO_ATTR_NONE = 0,
SCE_HIP_MICRO_ATTR_FGE = (1 << 0),
SCE_HIP_MICRO_ATTR_ANTI = (1 << 1)
} sceHiPlugMicroAttr_t;
/*********************************************************************************
* STRUCTURES
*********************************************************************************/
typedef struct {
u_int *micro;
u_int attr;
} sceHiPlugMicroTbl_t;
typedef struct {
sceHiPlugMicroTbl_t *tbl;
u_int tblnum;
} sceHiPlugMicroInitArg_t;
typedef struct {
int micro; /* The microcode which you want to activate */
float anticutoff; /* anti-alias parameter */
float fogbegin; /* fog begin */
float fogend; /* fog end */
} sceHiPlugMicroPreCalcArg_t;
typedef struct {
int resident; /* for resident */
sceHiGsMemTbl *tbl; /* for tbp & cbp */
}sceHiPlugTex2dInitArg_t;
typedef struct {
int resident; /* for resident */
sceHiGsMemTbl *tbl; /* for tbp & cbp */
}sceHiPlugTim2InitArg_t;
typedef struct {
u_int setframe; /* force frame count */
int setframe_enable; /* enable setframe value */
u_int currentframe; /* return current frame cocunt */
} sceHiPlugAnimePreCalcArg_t;
typedef struct {
sceVu0FMATRIX *root;
} sceHiPlugHrchyPreCalcArg_t;
/* ClutBump */
typedef struct {
sceVu0FVECTOR light_dir;
sceVu0FVECTOR shading;
} sceHiPlugClutBumpPreArg_t;
/* ShadowMap */
typedef struct {
int width,height;
u_int *box; /* shadowobj bounding box */
}sceHiPlugShadowMapInitArg_t;
/* LightMap */
typedef struct {
int width,height;
int fov;
}sceHiPlugLightMapInitArg_t;
/* FishEye */
typedef struct {
u_int zdepth;
float rmin;
float rmax;
} sceHiPlugFishEyeInitArg_t;
typedef struct {
sceVu0FVECTOR *camera_pos;
sceVu0FVECTOR *camera_zdir;
sceVu0FVECTOR *camera_up;
float tex_size;
} sceHiPlugFishEyePreArg_t;
/* Reflect */
typedef struct {
sceVu0FVECTOR *camera_pos;
sceVu0FVECTOR *camera_zdir;
sceVu0FVECTOR *camera_up;
float zoom;
float z_shift;
} sceHiPlugReflectPreArg_t;
/* Refract */
typedef struct {
sceVu0FVECTOR *camera_pos;
sceVu0FVECTOR *camera_zdir;
sceVu0FVECTOR *camera_up;
float refract_index;
float zoom;
float z_shift;
} sceHiPlugRefractPreArg_t;
/*********************************************************************************
* FUNCTIONS
*********************************************************************************/
/* plugin functions */
extern sceHiErr sceHiPlugMicro(sceHiPlug *plug, int process);
extern sceHiErr sceHiPlugTex2D(sceHiPlug *plug, int process);
extern sceHiErr sceHiPlugTim2 (sceHiPlug *plug, int process);
extern sceHiErr sceHiPlugShape(sceHiPlug *plug, int process);
extern sceHiErr sceHiPlugHrchy(sceHiPlug *plug, int process);
extern sceHiErr sceHiPlugAnime(sceHiPlug *plug, int process);
extern sceHiErr sceHiPlugShare(sceHiPlug *plug, int process);
extern sceHiErr sceHiPlugClutBump(sceHiPlug *plug, int process);
extern sceHiErr sceHiPlugShadowMap(sceHiPlug *plug, int process);
extern sceHiErr sceHiPlugShadowBox(sceHiPlug *plug, int process);
extern sceHiErr sceHiPlugLightMap(sceHiPlug *plug, int process);
extern sceHiErr sceHiPlugFishEye(sceHiPlug *plug, int process);
extern sceHiErr sceHiPlugReflect(sceHiPlug *plug, int process);
extern sceHiErr sceHiPlugRefract(sceHiPlug *plug, int process);
extern sceHiErr sceHiPlugSkin(sceHiPlug *plug, int process);
extern sceHiErr sceHiPlugClip(sceHiPlug *plug, int process);
extern sceHiErr sceHiPlugCamera(sceHiPlug *plug, int process);
/* plugin services */
extern size_t sceHiPlugTex2DSize(sceHiPlug *plug);
extern int sceHiPlugTim2Num(sceHiPlug *plug);
extern char *sceHiPlugTim2GetName(sceHiPlug *plug, int idx);
extern sceHiErr sceHiPlugTim2SetData(sceHiPlug *plug, int idx, u_int *fdata);
extern sceHiErr sceHiPlugTim2GetNPictures(sceHiPlug *plug, int n, int *num);
extern sceHiErr sceHiPlugTim2SetPicture(sceHiPlug *plug, int n, int num);
extern sceHiErr sceHiPlugShapeInvisible(sceHiPlug *plug, int matidx, int flag);
extern sceHiErr sceHiPlugShapeMasterChainSetting(sceHiPlug *, int flag);
enum { /* the bellow use as flag in sceHiPlugShapeMasterChainSetting() args */
SCE_HIP_SHAPE_MASTER_CHAIN_IN_STATIC_O = (1 << 0)
};
/*********************************************************************************
* ACCESSOR
*********************************************************************************/
typedef union {
struct {
int id; /* geometry id */
size_t size; /* geometry word size */
u_int prim; /* prim register bits */
int num; /* num of prim */
}geo;
struct {
int id; /* material id */
int num; /* num of geometry */
int tex_id; /* texture id */
int tex_num; /* num of texture */
}mat;
struct {
int id; /* shape id */
size_t size; /* shape word size */
int reserve; /* reserve */
int num; /* num of material */
}dat;
struct {
int reserve[3]; /* reserve */
int num; /* num of shape */
}top;
}sceHiPlugShapeHead_t;
typedef struct {
int reserve[2]; /* reserve */
int flags; /* visible/invisible flag */
int shape; /* shape id */
sceVu0FMATRIX local; /* local world matrix */
sceVu0FMATRIX light; /* light rotation matrix */
}sceHiPlugShapeMatrix_t;
extern sceHiPlugShapeHead_t *sceHiPlugShapeGetHead(sceHiPlug *p, sceHiType t);
extern sceHiPlugShapeHead_t *sceHiPlugShapeGetDataHead(sceHiPlugShapeHead_t *h, int idx);
extern sceHiPlugShapeHead_t *sceHiPlugShapeGetMaterialHead(sceHiPlugShapeHead_t *h, int idx);
extern sceHiPlugShapeHead_t *sceHiPlugShapeGetGeometryHead(sceHiPlugShapeHead_t *h, int idx);
extern sceHiGsGiftag *sceHiPlugShapeGetMaterialGiftag(sceHiPlugShapeHead_t *h);
extern sceVu0FMATRIX *sceHiPlugShapeGetMaterialAttrib(sceHiPlugShapeHead_t *h);
extern sceVu0FVECTOR *sceHiPlugShapeGetGeometryVertex(sceHiPlugShapeHead_t *h, int idx);
extern sceVu0FVECTOR *sceHiPlugShapeGetGeometryNormal(sceHiPlugShapeHead_t *h, int idx);
extern sceVu0FVECTOR *sceHiPlugShapeGetGeometryST(sceHiPlugShapeHead_t *h, int idx);
extern sceVu0FVECTOR *sceHiPlugShapeGetGeometryColor(sceHiPlugShapeHead_t *h, int idx);
extern sceHiPlugShapeMatrix_t *sceHiPlugShapeGetMatrix(sceHiPlugShapeHead_t *h, int idx);
typedef struct {
int reserve[2]; /* reserve */
u_int rorder; /* rotation order */
int num; /* num of data */
}sceHiPlugHrchyHead_t;
typedef struct {
sceVu0FVECTOR trans; /* trans xyz */
sceVu0FVECTOR rot; /* rot xyz */
sceVu0FVECTOR scale; /* scale xyz */
int shape; /* shape id */
int parent; /* parent id */
int child; /* unused */
int sibling; /* unused */
}sceHiPlugHrchyData_t;
extern sceHiPlugHrchyHead_t *sceHiPlugHrchyGetHead(sceHiPlug *p, sceHiType t);
extern sceHiPlugHrchyData_t *sceHiPlugHrchyGetData(sceHiPlugHrchyHead_t *h, int idx);
extern sceVu0FVECTOR *sceHiPlugHrchyGetPivot(sceHiPlugHrchyHead_t *h, int idx);
typedef struct {
int reserve[3]; /* reserve */
int num; /* num of data */
}sceHiPlugTex2DHead_t;
typedef struct {
sceGsTex0 tex0; /* Gs tex0 register */
union {
struct {
int reserve;
int miplv;
} mipmap;
u_long addr; /* Gs tex0 address */
} info;
size_t texelsize; /* texel word size */
size_t clutsize; /* clut word size */
u_short texelwidth; /* texel width */
u_short texelheight; /* texel height */
u_short clutwidth; /* clut width */
u_short clutheight; /* clut height */
}sceHiPlugTex2DData_t;
extern sceHiPlugTex2DHead_t *sceHiPlugTex2DGetHead(sceHiPlug *p, sceHiType t);
extern sceHiPlugTex2DData_t *sceHiPlugTex2DGetData(sceHiPlugTex2DHead_t *h, int idx);
extern u_int *sceHiPlugTex2DGetTexel(sceHiPlugTex2DData_t *d);
extern u_int *sceHiPlugTex2DGetClut(sceHiPlugTex2DData_t *d);
extern sceHiGsGiftag *sceHiPlugTex2DGetEnv(sceHiPlugTex2DHead_t *h, int idx);
typedef struct {
sceVu0FVECTOR dir[4]; /* 3 light direction, 1 reserve */
sceVu0FVECTOR pos[4]; /* 3 light position, 1 reserve */
sceVu0FVECTOR col[4]; /* 3 light color, 1 ambient */
}sceHiPlugMicroLight_t;
typedef struct {
sceVu0FMATRIX wscreen; /* world screen matrix */
union {
sceVu0FMATRIX wview; /* world view matrix */
sceVu0FMATRIX texproj; /* texture projection matrix */
}mtx;
sceVu0FMATRIX material; /* overwrite from shape */
float camx,camy,camz; /* camera position */
float aa1; /* aa1 cut off angle */
float fogA,fogB; /* fog parameters */
u_int prmode; /* prmode bit field */
int reserve; /* reserve */
union {
sceVu0FVECTOR clip; /* clip parameters */
struct {
float texsize; /* spherical texture size */
float ZA,ZB; /* depth parameters */
int reserve; /* reserve */
}fisheye;
}clp;
float shift; /* emboss bump shift */
float refidx; /* refract index */
float zoom; /* reflect/refract zoom */
float zshift; /* reflect/refract zshift */
sceHiPlugMicroLight_t light[3]; /* 3*3 lights */
} sceHiPlugMicroData_t;
extern sceHiPlugMicroData_t *sceHiPlugMicroGetData(sceHiPlug *p);
typedef struct {
sceVu0FVECTOR min; /* bbox min size */
sceVu0FVECTOR max; /* bbox max size */
sceVu0FVECTOR box[8]; /* dist bbox pos */
}sceHiPlugShadowBoxData_t;
extern sceHiPlugShadowBoxData_t *sceHiPlugShadowBoxGetData(sceHiPlug *p);
typedef struct {
int reserve[3]; /* reserve */
int num; /* num of data */
}sceHiPlugClutBumpHead_t;
typedef struct {
int shape; /* shape id */
int tex2d; /* tex2d id */
int normal; /* normal id */
int reserve; /* reserve */
}sceHiPlugClutBumpData_t;
extern sceHiPlugClutBumpHead_t *sceHiPlugClutBumpGetHead(sceHiPlug *p, sceHiType t);
extern sceHiPlugClutBumpData_t *sceHiPlugClutBumpGetData(sceHiPlugClutBumpHead_t *h, int idx);
extern sceVu0FVECTOR *sceHiPlugClutBumpGetNormal(sceHiPlugClutBumpHead_t *h, int idx);
typedef struct {
int reserve[3]; /* reserve */
int num; /* num of data */
}sceHiPlugTim2Head_t;
typedef struct {
int id; /* tim2 id */
int *ptr; /* file looad ptr */
size_t size; /* file size */
size_t length; /* name length fix 16 */
char fname[16]; /* file name fix 16 */
}sceHiPlugTim2Data_t;
extern sceHiPlugTim2Head_t *sceHiPlugTim2GetHead(sceHiPlug *p, sceHiType t);
extern sceHiPlugTim2Data_t *sceHiPlugTim2GetData(sceHiPlugTim2Head_t *h, int idx);
typedef union {
struct {
u_int type; /* interp|fcurve type */
int index; /* index number (but unused) */
size_t size; /* word size */
int num; /* num of frame|value */
}key;
struct {
int reserve[3]; /* reserve */
int num; /* num of data|key */
}top;
}sceHiPlugAnimeHead_t;
typedef struct {
int hrchy; /* hrchy id */
int numframe; /* num of frame */
int keyframe; /* keyframe id */
int keyvalue; /* keyvalue id */
}sceHiPlugAnimeData_t;
extern sceHiPlugAnimeHead_t *sceHiPlugAnimeGetHead(sceHiPlug *p, sceHiType t);
extern sceHiPlugAnimeData_t *sceHiPlugAnimeGetData(sceHiPlugAnimeHead_t *h, int idx);
extern sceHiPlugAnimeHead_t *sceHiPlugAnimeGetKeyHead(sceHiPlugAnimeHead_t *h, int idx);
extern int *sceHiPlugAnimeGetFrame(sceHiPlugAnimeHead_t *h, int idx);
extern sceVu0FVECTOR *sceHiPlugAnimeGetValue(sceHiPlugAnimeHead_t *h, int idx);
typedef struct {
int reserve[2]; /* reserve */
int shape; /* shape id */
int num; /* num of data */
}sceHiPlugShareHead_t;
typedef union {
struct {
int offset; /* src offset */
int geomid; /* geometry id */
int reserve; /* reserve */
int num; /* num of data */
}shr;
struct {
int voffset; /* dst vertex offset */
int vlength; /* dst vertex length */
int noffset; /* dst normal offset */
int nlength; /* dst normal length */
}dat;
}sceHiPlugShareData_t;
extern sceHiPlugShareHead_t *sceHiPlugShareGetHead(sceHiPlug *p, sceHiType t);
extern sceHiPlugShareData_t *sceHiPlugShareGetData(sceHiPlugShareHead_t *h, int idx);
extern sceHiPlugShareData_t *sceHiPlugShareGetShare(sceHiPlugShareHead_t *h, int idx);
extern int *sceHiPlugShareGetIndex(sceHiPlugShareHead_t *h, int idx);
extern sceVu0FVECTOR *sceHiPlugShareGetSrc(sceHiPlugShareHead_t *h, int idx);
extern sceVu0FVECTOR *sceHiPlugShareGetDst(sceHiPlugShareHead_t *h, int idx);
typedef struct {
int reserve[3];
int num;
}sceHiPlugClipHead_t;
typedef struct {
sceVu0FVECTOR min;
sceVu0FVECTOR max;
}sceHiPlugClipData_t;
extern sceHiPlugClipHead_t *sceHiPlugClipGetHead(sceHiPlug *p, sceHiType t);
extern sceHiPlugClipData_t *sceHiPlugClipGetData(sceHiPlugClipHead_t *h, int idx);
typedef struct {
int reserve[2]; /* reserve */
int func; /* function option */
int num; /* num of data */
}sceHiPlugSkinHead_t;
typedef struct {
sceVu0FVECTOR vertex;
sceVu0FVECTOR normal;
sceVu0FVECTOR weight;
int matrix[4];
int id[4];
}sceHiPlugSkinData_t;
extern sceHiPlugSkinHead_t *sceHiPlugSkinGetHead(sceHiPlug *p, sceHiType t);
extern sceHiPlugSkinData_t *sceHiPlugSkinGetData(sceHiPlugSkinHead_t *h, int idx);
extern sceVu0FMATRIX *sceHiPlugSkinGetLB(sceHiPlugSkinHead_t *h, int idx);
extern sceVu0FMATRIX *sceHiPlugSkinGetLW(sceHiPlugSkinHead_t *h, int idx);
extern int *sceHiPlugSkinGetBW(sceHiPlugSkinHead_t *h, int idx);
typedef struct {
int reserve[4];
sceVu0FVECTOR screen;
sceVu0FVECTOR window;
sceVu0FVECTOR depth;
sceVu0FVECTOR position;
sceVu0FVECTOR rotation;
sceVu0FVECTOR interest;
sceVu0FVECTOR upvector;
}sceHiPlugCameraData_t;
extern sceHiPlugCameraData_t *sceHiPlugCameraGetData(sceHiPlug *p);
#include <hipdef.h>
#ifdef __cplusplus
}
#endif
#endif /* !__HIP_H__ */

380
include/ee/libhttp.h Normal file
View File

@ -0,0 +1,380 @@
/* SCE CONFIDENTIAL
"PlayStation 2" Programmer Tool Runtime Library Release 2.5.3
*/
/*
* Emotion Engine Library
* Version 1.00
* Shift-JIS
*
* Copyright (C) 2001-2002 Sony Computer Entertainment Inc.
* All Rights Reserved.
*
* <libhttp - libhttp.h>
* <header for http library>
*
* Version Date Design Log
* --------------------------------------------------------------------
* 1.00 Nov,05,2001 komaki first version
*/
#ifndef _LIBHTTP_H
#define _LIBHTTP_H
#ifdef __cplusplus
extern "C" {
#endif
#include <libhttp/http_status.h>
#include <libhttp/http_methods.h>
#include <libhttp/http_options.h>
#define sceHTTPProt_HTTP 0
#define sceHTTPProt_HTTPS 1
typedef struct sceHTTPHeaderList {
struct sceHTTPHeaderList *forw, *back;
char *name;
char *value;
} sceHTTPHeaderList_t;
#ifdef __GNUC__
typedef int sceHTTPTime_t __attribute__ ((mode (__DI__)));
typedef int sceHTTPSize_t __attribute__ ((mode (__DI__)));
#else
typedef long long sceHTTPTime_t;
typedef long long sceHTTPSize_t;
#endif
typedef struct sceHTTPResponse {
int http_ver;
int http_rev;
sceHTTPStatusCode_t code; /* server status return */
char *reason; /* reason phrase */
int server_prot; /* server protocol */
sceHTTPHeaderList_t *headers; /* list of returned headers */
unsigned char *entity; /* response data */
sceHTTPSize_t length; /* length of response data */
int interrupted; /* transfer interrupted */
sceHTTPTime_t date; /* response date and time */
sceHTTPSize_t content_length; /* length of entity */
} sceHTTPResponse_t;
typedef struct sceHTTPClient {
char *name; /* user-agent name */
int http_ver;
int http_rev;
int rtimeout; /* response timeout */
int ttimeout; /* transfer timeout */
int laptime;
int prot; /* protocol */
int state;
int errnum;
int net_errno;
int net_herrno;
int reloading;
int keep_alive;
int keep_count;
int non_blocking;
int abort_req;
int otimeout;
int c_wait0, c_wait1;
int c_tcount;
int c_timer;
int t_stacksize;
int t_priority;
int t_thread;
void *t_stack;
int t_rtn;
void (*t_notify)(struct sceHTTPClient *, int, void *);
void *t_notify_opt;
int t_busy;
void (*t_hash)(struct sceHTTPClient *, sceHTTPSize_t, void *);
void *t_hash_opt;
int hashbytes;
unsigned int t_sent;
unsigned int max_olength;
struct sceHTTPParsedURI *proxy;
/* Request */
sceHTTPMethod_t method; /* method code */
struct sceHTTPParsedURI *puri; /* parsed identifier */
sceHTTPHeaderList_t *iheaders; /* list of headers */
char *idata; /* input data */
int ilength; /* length of idata */
int iflags; /* input flags */
int fd; /* local file descriptor */
int (*writef)(int, unsigned char *, unsigned int);
int hflags;
/* Response */
sceHTTPResponse_t response;
void (*chunkf)(struct sceHTTPClient *, unsigned char *, unsigned int,
void *);
void *chunkf_opt;
/* io */
int recv_thread;
int send_thread;
void *io_rstack;
void *io_sstack;
int io_desc;
char *io_buf;
int io_len;
int io_rtn;
int io_timer;
int io_rwait, io_rdone;
int io_swait, io_sdone;
int io_flags;
int io_tcount;
} sceHTTPClient_t;
/* iflags */
/* sceHTTPInputF_ESCAPE wants to encode data with URL encoding. */
#define sceHTTPInputF_ESCAPE 1
/* The input data doesn't copied if sceHTTPInputF_LINK is on. */
#define sceHTTPInputF_LINK 2
/* hflags */
#define sceHTTPHeaderF_Accept 1
#define sceHTTPHeaderF_AcceptCharset 2
#define sceHTTPHeaderF_UserAgent 4
/* errnum */
#define sceHTTPError_KERNEL -1001
#define sceHTTPError_NOMEM -1002
#define sceHTTPError_IO -1003
#define sceHTTPError_INVAL -1004
#define sceHTTPError_TIMEOUT -1005
#define sceHTTPError_RESOLV -1006
#define sceHTTPError_SOCKET -1007
#define sceHTTPError_CONNECT -1008
#define sceHTTPError_SSL -1009
#define sceHTTPError_NOTYET -1010
#define sceHTTPError_INTR -1011
#define sceHTTPError_PROXY -1012
#define sceHTTPError_BUSY -1013
#define sceHTTPError_WRITEF -1014
typedef struct sceHTTPParsedURI {
char *scheme;
char *username;
char *password;
char *hostname;
int port;
char *filename;
char *search;
} sceHTTPParsedURI_t;
#define sceHTTPParseURI_USER 0x02
#define sceHTTPParseURI_FILENAME 0x20
#define sceHTTPParseURI_SEARCHPART 0x40
typedef struct sceHTTPCookie {
char *name;
char *value;
char *domain;
char *path;
sceHTTPTime_t expires;
int secure;
int version;
sceHTTPTime_t maxage;
} sceHTTPCookie_t;
typedef struct sceHTTPCookieList {
struct sceHTTPCookieList *forw, *back;
struct sceHTTPCookie cookie;
} sceHTTPCookieList_t;
typedef struct sceHTTPAuth {
int type;
char *realm;
char **domains;
char *uri;
char *nonce;
char *opaque;
int stale;
int algorithm;
int qop;
int proxy;
} sceHTTPAuth_t;
typedef struct sceHTTPAuthList {
struct sceHTTPAuthList *forw, *back;
struct sceHTTPAuth auth;
} sceHTTPAuthList_t;
typedef struct sceHTTPAuthInfo {
char *nextnonce;
char *rspauth;
char *cnonce;
int nc;
int qop;
int proxy;
} sceHTTPAuthInfo_t;
typedef struct sceHTTPDigest {
char *username;
char *realm;
char *password;
char *uri;
char *nonce;
char *cnonce;
char *opaque;
int algorithm;
int nc;
int qop;
int method;
char *entity;
int length;
} sceHTTPDigest_t;
#define sceHTTPAuth_BASIC 0
#define sceHTTPAuth_DIGEST 1
#define sceHTTPDigestAlg_MD5 1
#define sceHTTPDigestAlg_MD5SESS 2
#define sceHTTPDigestQOP_AUTH 1
#define sceHTTPDigestQOP_AUTHINT 2
#define sceHTTPDigestStale_TRUE 1
#define sceHTTPDigestStale_FALSE 2
#define sceHTTPVerifyAuthInfo_NORSPAUTH 1
typedef struct sceHTTPMimeFilter {
struct sceHTTPMimeFilter *next;
struct sceHTTPMimeFilter *prev;
int itype;
int idesc;
unsigned char *ibuf;
unsigned int ibuflen;
unsigned char *iptr;
int idesc_eof;
int otype;
int odesc;
unsigned char *obuf;
unsigned int obuflen;
unsigned char *optr;
sceHTTPHeaderList_t *headers;
int dflags;
int (*decoder)(const char *, char *, int);
unsigned char *dbuf;
int multipart;
char *boundary;
} sceHTTPMimeFilter_t;
#define sceHTTPMimeFilter_STRING 0
#define sceHTTPMimeFilter_FILE 1
#define sceHTTPMultipart_MIXED 1
#define sceHTTPMultipart_BYTERANGES 2
#define sceHTTPMultipart_ALTERNATIVE 3
/* Library initialization */
extern int sceHTTPInit(void);
/* Library termination */
extern int sceHTTPTerminate(void);
/* HTTP connection */
extern int sceHTTPOpen(sceHTTPClient_t *client);
extern int sceHTTPClose(sceHTTPClient_t *client);
extern int sceHTTPGetSocketError(sceHTTPClient_t *client);
extern int sceHTTPGetResolveError(sceHTTPClient_t *client);
/* HTTP client transaction */
extern sceHTTPClient_t *sceHTTPCreate(void);
extern int sceHTTPDestroy(sceHTTPClient_t *client);
extern int sceHTTPRequest(sceHTTPClient_t *client);
extern sceHTTPResponse_t *sceHTTPGetResponse(sceHTTPClient_t *client);
extern int sceHTTPCleanUpResponse(sceHTTPClient_t *client);
extern int sceHTTPGetClientError(sceHTTPClient_t *client);
extern int sceHTTPAbortRequest(sceHTTPClient_t *client);
extern sceHTTPSize_t sceHTTPGetTransferedBytes(sceHTTPClient_t *client);
extern sceHTTPSize_t sceHTTPGetPostedBytes(sceHTTPClient_t *p);
extern sceHTTPSize_t sceHTTPGetContentLength(sceHTTPClient_t *client);
/* Options */
extern int sceHTTPSetOption(sceHTTPClient_t *client, sceHTTPOption_t opt, ...);
extern int sceHTTPGetOption(sceHTTPClient_t *client, sceHTTPOption_t opt, ...);
/* URI */
extern sceHTTPParsedURI_t *sceHTTPParseURI(const char *uri, int parseflag);
extern int sceHTTPFreeURI(sceHTTPParsedURI_t *puri);
extern sceHTTPParsedURI_t *sceHTTPCloneURI(sceHTTPParsedURI_t *puri);
extern char *sceHTTPUnparseURI(sceHTTPParsedURI_t *puri);
extern int sceHTTPIsAbsoluteURI(const char *uri);
extern char *sceHTTPFindAbsoluteURI(const char *uri, const char *base);
/* Convenience */
extern const char *sceHTTPErrorString(sceHTTPStatusCode_t error);
/* Header List */
extern sceHTTPHeaderList_t *sceHTTPAddHeaderList(sceHTTPHeaderList_t *p,
const char *name, const char *value);
extern int sceHTTPFreeHeaderList(sceHTTPHeaderList_t *p);
static __inline__ sceHTTPHeaderList_t *sceHTTPNextHeader(sceHTTPHeaderList_t *p){
return((p)? p->forw : 0);
}
/* Cookies */
extern sceHTTPCookieList_t *sceHTTPAddCookieList(sceHTTPCookieList_t *p,
sceHTTPCookie_t *cp);
extern sceHTTPCookieList_t *sceHTTPDeleteCookieListEntry(
sceHTTPCookieList_t *p, sceHTTPCookieList_t *ep);
extern sceHTTPCookieList_t *sceHTTPFilterCookieList(sceHTTPCookieList_t *list,
int (*filter)(sceHTTPCookie_t *, void *), void *arg);
extern int sceHTTPFreeCookieList(sceHTTPCookieList_t *p);
extern sceHTTPCookieList_t *sceHTTPParseCookie(sceHTTPClient_t *client,
sceHTTPResponse_t *rp);
extern int sceHTTPSetCookie(sceHTTPClient_t *client, sceHTTPCookieList_t *p);
/* Authentication */
extern int sceHTTPFreeAuthList(sceHTTPAuthList_t *p);
extern sceHTTPAuthList_t *sceHTTPParseAuth(sceHTTPResponse_t *rp);
extern int sceHTTPSetBasicAuth(sceHTTPClient_t *client,
const char *user, const char *passwd, int proxy);
extern int sceHTTPSetDigestAuth(sceHTTPClient_t *client, sceHTTPDigest_t *dp,
int proxy);
extern sceHTTPAuthInfo_t *sceHTTPParseAuthInfo(sceHTTPResponse_t *rp);
extern int sceHTTPFreeAuthInfo(sceHTTPAuthInfo_t *ip);
extern int sceHTTPVerifyAuthInfo(sceHTTPClient_t *client,
sceHTTPAuthInfo_t *ip, sceHTTPDigest_t *dp, int flags);
/* Redirection */
extern const char **sceHTTPParseLocations(sceHTTPResponse_t *rp);
extern int sceHTTPFreeLocations(char **vec);
extern int sceHTTPSetRedirection(sceHTTPClient_t *client,
sceHTTPParsedURI_t *uri, int proxy);
/* Mime */
extern sceHTTPMimeFilter_t *sceHTTPMimeFilterCreate(int itype, void *iarg,
int ilen, int otype, void *oarg);
extern int sceHTTPMimeFilterFree(sceHTTPMimeFilter_t *p);
extern int sceHTTPMimeFilterParseHeaders(sceHTTPMimeFilter_t *p);
extern int sceHTTPMimeFilterApply(sceHTTPMimeFilter_t *p, int *closep);
extern int sceHTTPMimeFilterGetMultipartType(sceHTTPMimeFilter_t *p);
extern int sceHTTPMimeFilterChangeOutput(sceHTTPMimeFilter_t *p, int otype,
void *arg);
extern int sceHTTPMimeFilterGetStringOutput(sceHTTPMimeFilter_t *p,
char **odatap, int *olengthp);
extern sceHTTPHeaderList_t *sceHTTPMimeFilterGetHeaderList(
sceHTTPMimeFilter_t *p);
/* Version */
extern const char *sceHTTPLibVersion;
/* base64 */
extern int sceBASE64Encoder(unsigned const char *in, unsigned char *out,
int len);
extern int sceBASE64LineDecoder(unsigned const char *in, unsigned char *out,
int len);
/* quoted-printable */
extern int sceQPrintableEncoder(unsigned const char *in, unsigned char *out,
int len);
extern int sceQPrintableLineDecoder(unsigned const char *in, unsigned char *out,
int len);
/* url escape */
extern unsigned char *sceURLEscape(unsigned const char *in);
extern unsigned char *sceURLUnescape(unsigned const char *in);
#ifdef __cplusplus
}
#endif
#endif /* _LIBHTTP_H */

59
include/ee/libinsck.h Normal file
View File

@ -0,0 +1,59 @@
/* SCE CONFIDENTIAL
"PlayStation 2" Programmer Tool Runtime Library Release 2.5.3
*/
/*
* Emotion Engine Library
* Version 1.00
* Shift-JIS
*
* Copyright (C) 2001 Sony Computer Entertainment Inc.
* All Rights Reserved.
*
* <libinsck - libinsck.h>
* <libinsck general header>
*
* Version Date Design Log
* --------------------------------------------------------------------
* 1.00 May,17,2001 komaki first version
*/
#ifndef _LIBINSCK_H_
#define _LIBINSCK_H_
#if defined(__cplusplus)
extern "C" {
#endif
#include <libinsck/netdb.h>
#include <libinsck/sys/socket.h>
#include <libnet.h>
#include <libinsck/netinet/in.h>
#include <libinsck/netinet/tcp.h>
#include <libinsck/arpa/inet.h>
int *__sceInsockErrnoLoc(void);
int *__sceInsockHErrnoLoc(void);
#define sceInsockErrno (*__sceInsockErrnoLoc())
#define sceInsockHErrno (*__sceInsockHErrnoLoc())
int sceInsockSetSifMBindRpcValue(u_int buffersize, u_int stacksize,
int priority);
int sceInsockSetRecvTimeout(int s, int ms);
int sceInsockSetSendTimeout(int s, int ms);
int sceInsockAbort(int s, int flags);
int sceInsockTerminate(int thread_id);
int sceInsockPoll(sceInetPollFd_t *fds, int nfds, int ms);
int sceInsockSendFin(int s, int ms);
#if defined(__cplusplus)
}
#endif
#endif /* _LIBINSCK_H_ */

493
include/ee/libipu.h Normal file
View File

@ -0,0 +1,493 @@
/* SCE CONFIDENTIAL
"PlayStation 2" Programmer Tool Runtime Library Release 2.5
*/
/*
* Emotion Engine Library
* Version 0.10
* Shift-JIS
*
* Copyright (C) 1998-1999 Sony Computer Entertainment Inc.
* All Rights Reserved.
*
* libipu - libipu.h
* header file of libipu
*
* Version Date Design Log
* --------------------------------------------------------------------
* 0.10 Mar.25.1999 umemura the first version
* 0.20 Feb.29.2000 umemura inline -> define
*/
#ifndef _LIBIPU_H_
#define _LIBIPU_H_
#include <eetypes.h>
#include <eeregs.h>
#ifdef __cplusplus
extern "C" {
#endif
/////////////////////////////////////////////////////////
//
// IPU_CTRL.IDP
//
#define SCE_IPU_CTRL_IDP_8BIT (0x00<<16)
#define SCE_IPU_CTRL_IDP_9BIT (0x01<<16)
#define SCE_IPU_CTRL_IDP_10BIT (0x02<<16)
/////////////////////////////////////////////////////////
//
// IPU_CTRL.AS
//
#define SCE_IPU_CTRL_AS_ZIGZAG (0x00<<20)
#define SCE_IPU_CTRL_AS_ALTERNATE (0x01<<20)
/////////////////////////////////////////////////////////
//
// IPU_CTRL.IVF
//
#define SCE_IPU_CTRL_IVF_SAME (0x00<<21)
#define SCE_IPU_CTRL_IVF_SWITCH (0x01<<21)
/////////////////////////////////////////////////////////
//
// IPU_CTRL.QST
//
#define SCE_IPU_CTRL_QST_LINEAR (0x00<<22)
#define SCE_IPU_CTRL_QST_NONLINEAR (0x01<<22)
/////////////////////////////////////////////////////////
//
// IPU_CTRL.MP1
//
#define SCE_IPU_CTRL_MP1_NONCOMPATIBLE (0x00<<23)
#define SCE_IPU_CTRL_MP1_COMPATIBLE (0x01<<23)
/////////////////////////////////////////////////////////
//
// IPU_CTRL.PCT
//
#define SCE_IPU_CTRL_PCT_IPIC (0x01<<24)
#define SCE_IPU_CTRL_PCT_PPIC (0x02<<24)
#define SCE_IPU_CTRL_PCT_BPIC (0x03<<24)
#define SCE_IPU_CTRL_PCT_DPIC (0x04<<24)
/////////////////////////////////////////////////////////
//
// IPU commands
//
#define SCE_IPU_BCLR 0x00000000
#define SCE_IPU_IDEC 0x10000000
#define SCE_IPU_BDEC 0x20000000
#define SCE_IPU_VDEC 0x30000000
#define SCE_IPU_FDEC 0x40000000
#define SCE_IPU_SETIQ 0x50000000
#define SCE_IPU_SETVQ 0x60000000
#define SCE_IPU_CSC 0x70000000
#define SCE_IPU_PACK 0x80000000
#define SCE_IPU_SETTH 0x90000000
/////////////////////////////////////////////////////////
//
// IPU commands' arguments
//
// for IDEC
#define SCE_IPU_IDEC_NODTDECODE 0
#define SCE_IPU_IDEC_DTDECODE 1
#define SCE_IPU_IDEC_NOOFFSET 0
#define SCE_IPU_IDEC_OFFSET 1
#define SCE_IPU_IDEC_NODITHER 0
#define SCE_IPU_IDEC_DITHER 1
#define SCE_IPU_IDEC_RGB32 0
#define SCE_IPU_IDEC_RGB16 1
// for BDEC
#define SCE_IPU_BDEC_FRAMEDCT 0
#define SCE_IPU_BDEC_FIELDDCT 1
#define SCE_IPU_BDEC_NODCRESET 0
#define SCE_IPU_BDEC_DCRESET 1
#define SCE_IPU_BDEC_NONINTRA 0
#define SCE_IPU_BDEC_INTRA 1
// for VDEC
#define SCE_IPU_VDEC_MBAI 0
#define SCE_IPU_VDEC_MBTYPE 1
#define SCE_IPU_VDEC_MOTIONCODE 2
#define SCE_IPU_VDEC_DMVECTOR 3
// for SETIQ
#define SCE_IPU_SETIQ_INTRA 0
#define SCE_IPU_SETIQ_NONINTRA 1
// for CSC
#define SCE_IPU_CSC_NODITHER 0
#define SCE_IPU_CSC_DITHER 1
#define SCE_IPU_CSC_RGB32 0
#define SCE_IPU_CSC_RGB16 1
// for PACK
#define SCE_IPU_PACK_NODITHER 0
#define SCE_IPU_PACK_DITHER 1
#define SCE_IPU_PACK_INDX4 0
#define SCE_IPU_PACK_RGB16 1
/////////////////////////////////////////////////////////
//
// Structures
//
typedef struct {
u_char y[16*16];
u_char cb[8*8];
u_char cr[8*8];
} sceIpuRAW8;
typedef struct {
short y[16*16];
short cb[8*8];
short cr[8*8];
} sceIpuRAW16;
typedef struct {
u_int pix[16*16];
} sceIpuRGB32;
typedef struct {
u_short pix[16*16];
} sceIpuRGB16;
typedef struct {
u_int pix[2*16];
} sceIpuINDX4;
typedef struct {
u_int d4madr; // 停止したときの D4_MADR レジスタの値
u_int d4tadr; // 停止したときの D4_TADR レジスタの値
u_int d4qwc; // 停止したときの D4_QWC レジスタの値
u_int d4chcr; // 停止したときの D4_CHCR レジスタの値
u_int d3madr; // 停止したときの D3_MADR レジスタの値
u_int d3qwc; // 停止したときの D3_QWC レジスタの値
u_int d3chcr; // 停止したときの D3_CHCR レジスタの値
u_int ipubp; // 停止したときの IPU_BP レジスタの値
u_int ipuctrl;// 停止したときの IPU_CTRL レジスタの値
} sceIpuDmaEnv;
///////////////////////////////////////////////////////////////////////
//
// Functions
//
// ---------------------------------------------------------------------
// sceIpuInit
// ---------------------------------------------------------------------
// [書式] void sceIpuInit(void)
// [引数] なし
// [返値] なし
// [解説] IPU 自体をリセットし、FIFOをクリアします。
void sceIpuInit(void);
// ---------------------------------------------------------------------
// sceIpuBCLR
// ---------------------------------------------------------------------
// [書式] void sceIpuBCLR(int bp)
// [引数] bp 最初の 128 bit のうち復号を開始するビット位置
// [返値] なし
// [解説] BCLR コマンドを実行して入力FIFOをクリアします。
// この関数を呼び出す前に、入力FIFOへのDMA(toIPU:ch-4)を
// 停止しておく必要があります。
#define sceIpuBCLR(bp) DPUT_IPU_CMD(SCE_IPU_BCLR | (bp))
// ---------------------------------------------------------------------
// sceIpuIDEC
// ---------------------------------------------------------------------
// [書式]
// void sceIpuIDEC(
// int ofm,
// int dte,
// int sgn,
// int dtd,
// int qsc,
// int fb
// )
//
// [引数]
// ofm Output Format
// SCE_IPU_IDEC_RGB32(0) : RGB32
// SCE_IPU_IDEC_RGB16(1) : RGB16
// dte Dither Enable
// SCE_IPU_IDEC_NODITHER(0) : ディザなし
// SCE_IPU_IDEC_DITHER(1) : ディザあり
// (ofm = RGB16 のときのみ有効)
// sgn Pseudo Sign Offset
// SCE_IPU_IDEC_NOOFFSET(0) : offset なし
// SCE_IPU_IDEC_OFFSET(1) : offset -128
// dtd DT Decode
// SCE_IPU_IDEC_NODTDECODE(0) : Dct Type をデコードしない
// SCE_IPU_IDEC_DTDECODE(1) : Dct Type をデコードする
// qsc Quantizer Step Code
// fb Forward Bit
//
// [返値] なし
// [解説] IDEC コマンドを実行してイントラ復号を行います。
#define sceIpuIDEC(ofm, dte, sgn, dtd, qsc, fb) \
DPUT_IPU_CMD(SCE_IPU_IDEC \
| ((ofm) << 27) \
| ((dte) << 26) \
| ((sgn) << 25) \
| ((dtd) << 24) \
| ((qsc) << 16) \
| (fb) \
)
// ---------------------------------------------------------------------
// sceIpuBDEC
// ---------------------------------------------------------------------
// [書式]
// void sceIpuBDEC(
// int mbi,
// int dcr,
// int dt,
// int qsc,
// int fb
// )
//
// [引数]
// mbi Macroblock Intra
// SCE_IPU_BDEC_NONINTRA(0) : 非イントラマクロブロック
// SCE_IPU_BDEC_INTRA(1) : イントラマクロブロック
// dcr DC Reset
// SCE_IPU_BDEC_NODCRESET(0): DC予測値をリセットしない
// SCE_IPU_BDEC_DCRESET(1) : DC予測値をリセットする
// dt DCT Type
// SCE_IPU_BDEC_FRAMEDCT(0) : frame DCT
// SCE_IPU_BDEC_FIELDDCT(1) : field DCT
// qsc Quantiser Step Code
// fb Forward Bit
//
// [返値] なし
// [解説] BDEC コマンドを実行してブロック復号を行います。
#define sceIpuBDEC(mbi, dcr, dt, qsc, fb) \
DPUT_IPU_CMD(SCE_IPU_BDEC \
| ((mbi) << 27) \
| ((dcr) << 26) \
| ((dt) << 25) \
| ((qsc) << 16) \
| (fb) \
)
// ---------------------------------------------------------------------
// sceIpuVDEC
// ---------------------------------------------------------------------
// [書式] void sceIpuVDEC(int tbl, int fb)
// [引数]
// tbl VLC table
// SCE_IPU_VDEC_MBAI(0) : Macroblock Address Increment
// SCE_IPU_VDEC_MBTYPE(1) : Macroblock Type
// SCE_IPU_VDEC_MOTIONCODE(2): Motion Code
// SCE_IPU_VDEC_DMVECTOR(3) : DMVector
// fb Forward Bit
//
// [返値] なし
// [解説] VDEC コマンドを実行して、tbl で指定されたシンボルを復号しま
// す。復号結果は sceIpuGetVdecResult() で取得することができ
// ます。
#define sceIpuVDEC(tbl, fb) \
DPUT_IPU_CMD(SCE_IPU_VDEC | ((tbl) << 26) | (fb))
// ---------------------------------------------------------------------
// sceIpuFDEC
// ---------------------------------------------------------------------
// [書式] void sceIpuFDEC(int fb)
// [引数] fb Forward Bit
// [返値] なし
// [解説] FDEC コマンドを実行して固定長データを復号します。
// 復号結果は sceIpuGetFdecResult() で取得することができます。
#define sceIpuFDEC(fb) DPUT_IPU_CMD(SCE_IPU_FDEC | (fb))
// ---------------------------------------------------------------------
// sceIpuSETIQ
// ---------------------------------------------------------------------
// [書式] void sceIpuSETIQ(int iqm, int fb)
// [引数]
// iqm Intra IQ Matrix
// SCE_IPU_SETIQ_INTRA(0) : イントラ量子化マトリクス
// SCE_IPU_SETIQ_NONINTRA(1) : 非イントラ量子化マトリクス
// fb Forward Bit
//
// [返値] なし
// [解説] SETIQ コマンドを実行して IQ テーブルを設定します。
#define sceIpuSETIQ(iqm, fb) \
DPUT_IPU_CMD(SCE_IPU_SETIQ | ((iqm) << 27) | (fb))
// ---------------------------------------------------------------------
// sceIpuSETVQ
// ---------------------------------------------------------------------
// [書式] void sceIpuSETVQ(void)
// [引数] なし
// [返値] なし
// [解説] SETVQ コマンドを実行して VQCLUT テーブルを設定します。
#define sceIpuSETVQ() DPUT_IPU_CMD(SCE_IPU_SETVQ)
// ---------------------------------------------------------------------
// sceIpuCSC
// ---------------------------------------------------------------------
// [書式] void sceIpuCSC(int ofm, int dte, int mbc)
// [引数]
// ofm Output Format
// SCE_IPU_CSC_RGB32(0) : RGB32
// SCE_IPU_CSC_RGB16(1) : RGB16
// dte Dither Enable
// SCE_IPU_CSC_NODITHER(0) : ディザなし
// SCE_IPU_CSC_DITHER(1) : ディザあり
// (ofm = RGB16 のときのみ有効)
// mbc Macroblock Count 変換するマクロブロック数
// [返値] なし
// [解説] CSC コマンドを実行して色空間の変換を行います。
#define sceIpuCSC(ofm, dte, mbc) \
DPUT_IPU_CMD(SCE_IPU_CSC | ((ofm) << 27) | ((dte) << 26) | (mbc))
// ---------------------------------------------------------------------
// sceIpuPACK
// ---------------------------------------------------------------------
// [書式] void sceIpuPACK(int ofm, int dte, int mbc)
// [引数]
// ofm Output Format
// SCE_IPU_PACK_INDX4(0) : INDX4
// SCE_IPU_PACK_RGB16(1) : RGB16
// dte Dither Enable
// SCE_IPU_PACK_NODITHER(0) : ディザなし
// SCE_IPU_PACK_DITHER(1) : ディザあり
// mbc Macroblock Count 変換するマクロブロック数
// [返値] なし
// [解説] PACK コマンドを実行してフォーマット変換を行います。
#define sceIpuPACK(ofm, dte, mbc) \
DPUT_IPU_CMD(SCE_IPU_PACK | ((ofm) << 27) | ((dte) << 26) | (mbc))
// ---------------------------------------------------------------------
// sceIpuSETTH
// ---------------------------------------------------------------------
// [書式] void sceIpuSETTH(int th1, int th0)
// [引数]
// th1 半透明スレショルド
// th0 透明スレショルド
// [返値] なし
// [解説] SETTH コマンドを実行してスレショルド値を設定します。
// このスレショルド値は CSC コマンドで色変換を行う際に使用され
// ます。
#define sceIpuSETTH(th1, th0) \
DPUT_IPU_CMD(SCE_IPU_SETTH | ((th1) << 16) | (th0))
// ---------------------------------------------------------------------
// sceIpuGetFVdecResult
// ---------------------------------------------------------------------
// [書式] u_int sceIpuGetFVdecResult(void)
// [引数] なし
// [返値] 直前の FDEC コマンドまたは VDEC コマンドで復号されたデータ
// [解説] 直前に実行された FDEC コマンドまたは VDEC コマンドの実行結果
// を読み出します。
#define sceIpuGetFVdecResult() DGET_IPU_CMD()
// ---------------------------------------------------------------------
// sceIpuReset
// ---------------------------------------------------------------------
// [書式] void sceIpuReset(void)
// [引数] なし
// [返値] なし
// [解説] IPU をリセットします。
#define sceIpuReset() DPUT_IPU_CTRL(IPU_CTRL_RST_M)
// ---------------------------------------------------------------------
// sceIpuIsBusy
// ---------------------------------------------------------------------
// [書式] int sceIpuIsBusy(void)
// [引数] なし
// [返値]
// 0 : 停止中
// その他 : 動作中
// [解説] IPU が動作中かどうかを返します。
#define sceIpuIsBusy() ((int)((int)DGET_IPU_CTRL() < 0))
// ---------------------------------------------------------------------
// sceIpuIsError
// ---------------------------------------------------------------------
// [書式] int sceIpuIsError(void)
// [引数] なし
// [返値]
// 0 : エラーなし
// その他 : エラーあり
// [解説] IPU の処理途中でエラーが発生したかどうかを返します。
// この値は IPU コマンドを実行するたびに自動的にクリアされます。
#define sceIpuIsError() ((int)(DGET_IPU_CTRL() & IPU_CTRL_ECD_M))
// ---------------------------------------------------------------------
// sceIpuSync
// ---------------------------------------------------------------------
// [書式] int sceIpuSync(int mode, u_short timeout)
// [引数]
// mode:
// 0: IPU が動作中である間ブロックします。
// 1: 即座に終了し、そのときのステータスを返します。
// これは、sceIpuIsBusy() と同じ動作となります。
//
// timeout:
// mode = 0 のときのタイムアウト値を指定します。
// 指定する値の単位は Horizontal line カウントで、
// 有効な値の範囲は
// 0 <= timeout <= 65535
// です。
//
// timeout = 0: ライブラリでデフォルトのタイムアウト値を
// 使用します。
// timeout > 0: 指定される値をタイムアウト値として使用します。
//
// [返値]
// mode = 0 のとき
// 0 以上の値: 正常終了
// 負の値: 異常終了(タイムアウト発生)
//
// mode = 1 のとき
// 0: IPU が動作中でない
// 正の値: IPU が動作中
//
// [解説] IPU が動作中かどうかを判断し、IPU の動作終了を待ったり、
// IPU の状態を返したりします。
int sceIpuSync(int mode, u_short timeout);
// ---------------------------------------------------------------------
// sceIpuStopDMA
// ---------------------------------------------------------------------
// [書式] void sceIpuStopDMA(sceIpuDmaEnv *env)
// [引数] env 内部状態を保存する構造体変数へのポインタ
//
// typedef struct {
// u_int d4madr; // 停止したときの D4_MADR レジスタの値
// u_int d4tadr; // 停止したときの D4_TADR レジスタの値
// u_int d4qwc; // 停止したときの D4_QWC レジスタの値
// u_int d4chcr; // 停止したときの D4_CHCR レジスタの値
// u_int d3madr; // 停止したときの D3_MADR レジスタの値
// u_int d3qwc; // 停止したときの D3_QWC レジスタの値
// u_int d3chcr; // 停止したときの D3_CHCR レジスタの値
// u_int ipubp; // 停止したときの IPU_BP レジスタの値
// u_int ipuctrl;// 停止したときの IPU_CTRL レジスタの値
// } sceIpuDmaEnv;
//
// [返値] なし
// [解説] toIPU(ch-4) および fromIPU(ch-3) の DMA を安全に停止し、
// これらの DMAの状態および IPU の内部状態を保存します。
void sceIpuStopDMA(sceIpuDmaEnv *env);
// ---------------------------------------------------------------------
// sceIpuRestartDMA
// ---------------------------------------------------------------------
// [書式] void sceIpuRestartDMA(sceIpuDmaEnv *env)
// [引数] env DMA および IPU の状態を保存した構造体変数のポインタ
// [返値] なし
// [解説] 保存された DMA および IPU の状態に従って、toIPU(ch-4) および
// fromIPU(ch-3) の DMA を再開する。
void sceIpuRestartDMA(sceIpuDmaEnv *env);
#ifdef __cplusplus
}
#endif
#endif // _LIBIPU_H_

49
include/ee/liblout.h Normal file
View File

@ -0,0 +1,49 @@
/* SCE CONFIDENTIAL
"PlayStation 2" Programmer Tool Runtime Library Release 2.5
*/
/*
* Emotion Engine Library
* Version 0.60
* Shift-JIS
*
* Copyright (C) 1998-1999, 2002 Sony Computer Entertainment Inc.
* All Rights Reserved.
*
* liblout - liblout.h
* EE PCM Line Out
*
* Version Date Design Log
* --------------------------------------------------------------------
* 0.60 Oct.12.1999 katayama first checked in.
*/
#ifndef _liblout_h_
#define _liblout_h_
#define sceLoutNoError 0
#define sceLoutError -1
#define sceLoutInputUnit 512
#define sceLoutMaxLine 4
#define sceLoutNoOutPut 0xff
#define sceLoutDmaPreWait (1<<7)
typedef struct {
unsigned char attrib;
unsigned char lineAssign[sceLoutMaxLine];
unsigned int iopBufSize;
void* iopBuf[2];
unsigned int nDmaBuf;
sceSifDmaData dma[0];
} sceLoutConf;
#if defined(_LANGUAGE_C_PLUS_PLUS)||defined(__cplusplus)||defined(c_plusplus)
extern "C" {
#endif
int sceLout_Init(sceCslCtx*,unsigned int);
int sceLout_ATick(sceCslCtx*);
//int sceLout_Load(sceCslCtx*);
#define sceLout_Load(x)
#if defined(_LANGUAGE_C_PLUS_PLUS)||defined(__cplusplus)||defined(c_plusplus)
}
#endif
#endif //!_liblout_h_
/* $Id: liblout.h,v 1.5.2.1 2002/02/19 09:16:10 xokano Exp $ */

162
include/ee/libmc.h Normal file
View File

@ -0,0 +1,162 @@
/* SCE CONFIDENTIAL
"PlayStation 2" Programmer Tool Runtime Library Release 2.5.4
*/
/*
* Emotion Engine Library
* Version 0.10
* Shift-JIS
*
* Copyright (C) 1998-1999 Sony Computer Entertainment Inc.
* All Rights Reserved.
*
* libmc - libmc.h
* header file of libmc
*
* Version Date Design Log
* --------------------------------------------------------------------
* 0.00 1999- 7-28 T.Honda the first version
* 0.01 2001-11-01 iwano update macro define/etc
*/
#ifndef _LIBMC_H_
#define _LIBMC_H_
#ifndef SCE_STM_R
#include <sifdev.h>
#endif
#define sceMcFuncNoCardInfo (1)
#define sceMcFuncNoOpen (2)
#define sceMcFuncNoClose (3)
#define sceMcFuncNoSeek (4)
#define sceMcFuncNoRead (5)
#define sceMcFuncNoWrite (6)
#define sceMcFuncNoFlush (10)
#define sceMcFuncNoMkdir (11)
#define sceMcFuncNoChDir (12)
#define sceMcFuncNoGetDir (13)
#define sceMcFuncNoFileInfo (14)
#define sceMcFuncNoDelete (15)
#define sceMcFuncNoFormat (16)
#define sceMcFuncNoUnformat (17)
#define sceMcFuncNoEntSpace (18)
#define sceMcFuncNoRename (19)
#define sceMcFuncChgPrior (20)
#define sceMcFuncSlotMax (21)
#define sceMcFileInfoCreate 0x01
#define sceMcFileInfoModify 0x02
#define sceMcFileInfoAttr 0x04
#define sceMcFileAttrReadable SCE_STM_R
#define sceMcFileAttrWriteable SCE_STM_W
#define sceMcFileAttrExecutable SCE_STM_X
#define sceMcFileAttrDupProhibit SCE_STM_C
#define sceMcFileAttrSubdir SCE_STM_D
#define sceMcFileAttrClosed 0x0080
#define sceMcFileAttrPDAExec 0x0800
#define sceMcFileAttrPS1 0x1000
#define sceMcResSucceed (0)
#define sceMcResChangedCard (-1)
#define sceMcResNoFormat (-2)
#define sceMcResFullDevice (-3)
#define sceMcResNoEntry (-4)
#define sceMcResDeniedPermit (-5)
#define sceMcResNotEmpty (-6)
#define sceMcResUpLimitHandle (-7)
#define sceMcResFailReplace (-8)
#define sceMcIniSucceed (0)
#define sceMcIniErrKernel (-101)
#define sceMcIniOldMcserv (-120)
#define sceMcIniOldMcman (-121)
#define sceMcErrUnbind (-100)
#define sceMcErrSemapho (-200)
#define sceMcErrNullStr (-210)
#define sceMcTypeNoCard (0)
#define sceMcTypePS1 (1)
#define sceMcTypePS2 (2)
#define sceMcTypePDA (3)
#define sceMcExecRun (0)
#define sceMcExecIdle (-1)
#define sceMcExecFinish (1)
typedef int _iconVu0IVECTOR[4];
typedef float _iconVu0FVECTOR[4];
typedef struct
{
unsigned char Head[4];
unsigned short Reserv1;
unsigned short OffsLF;
unsigned Reserv2;
unsigned TransRate;
_iconVu0IVECTOR BgColor[4];
_iconVu0FVECTOR LightDir[3];
_iconVu0FVECTOR LightColor[3];
_iconVu0FVECTOR Ambient;
unsigned char TitleName[68];
unsigned char FnameView[64];
unsigned char FnameCopy[64];
unsigned char FnameDel[64];
unsigned char Reserve3[512];
} sceMcIconSys;
typedef struct
{
unsigned char Resv2,Sec,Min,Hour;
unsigned char Day,Month;
unsigned short Year;
} sceMcStDateTime;
typedef struct
{
sceMcStDateTime _Create;
sceMcStDateTime _Modify;
unsigned FileSizeByte;
unsigned short AttrFile;
unsigned short Reserve1;
unsigned Reserve2;
unsigned PdaAplNo;
unsigned char EntryName[32];
} sceMcTblGetDir __attribute__((aligned (64)));
#if defined(__LANGUAGE_C_PLUS_PLUS)||defined(__cplusplus)||defined(c_plusplus)
extern "C" {
#endif
int sceMcInit(void);
int sceMcEnd(void);
int sceMcGetInfo(int, int, int *, int *, int *);
int sceMcOpen(int, int, const char *, int);
int sceMcClose(int);
int sceMcSeek(int, int, int);
int sceMcRead(int, void *, int);
int sceMcWrite(int, const void *, int);
int sceMcFlush(int);
int sceMcMkdir(int, int, const char *);
int sceMcChdir(int, int, const char *, char *);
int sceMcGetDir(int, int, const char *, unsigned, int, sceMcTblGetDir *);
int sceMcSetFileInfo(int, int, const char *, const char *, unsigned int);
int sceMcDelete(int, int, const char *);
int sceMcFormat(int, int);
int sceMcUnformat(int, int);
int sceMcGetEntSpace(int, int, const char *);
int sceMcRename(int, int, const char *, const char *);
int sceMcChangeThreadPriority(int);
int sceMcGetSlotMax(int);
int sceMcSync(int, int *, int *);
#if defined(__LANGUAGE_C_PLUS_PLUS)||defined(__cplusplus)||defined(c_plusplus)
}
#endif
#endif /* _LIBMC_H_ */

132
include/ee/libmcx.h Normal file
View File

@ -0,0 +1,132 @@
/* SCE CONFIDENTIAL
"PlayStation 2" Programmer Tool Runtime Library Release 2.5
*/
/*
* Emotion Engine Library
* Version 0.10
* Shift-JIS
*
* Copyright (C) 1998-1999 Sony Computer Entertainment Inc.
* All Rights Reserved.
*
* libmc - libmc.h
* header file of libmc
*
* Version Date Design Log
* --------------------------------------------------------------------
* 0.00 2000- 5-25 T.Honda the first version
*/
#ifndef _LIBMCX_H
#define _LIBMCX_H
#define sceMcxFuncGetInfo 1
#define sceMcxFuncSetInfo 2
#define sceMcxFuncGetMem 3
#define sceMcxFuncSetMem 4
#define sceMcxFuncShowTrans 5
#define sceMcxFuncHideTrans 6
#define sceMcxFuncReadDev 7
#define sceMcxFuncWriteDev 8
#define sceMcxFuncGetUifs 9
#define sceMcxFuncSetUifs 10
#define sceMcxFuncSetLed 11
#define sceMcxFuncChgPrior 12
#define sceMcxSyncRun 0
#define sceMcxSyncNone (-1)
#define sceMcxSyncFin 1
#define sceMcxBitAppli 0x01
#define sceMcxBitSpeaker 0x02
#define sceMcxBitInfrared 0x04
#define sceMcxBitFlash 0x08
#define sceMcxBitLed 0x10
#define sceMcxBitDate 0x20
#define sceMcxDevRtc 0
#define sceMcxDevMem 1
#define sceMcxDevUifs 2
#define sceMcxResSucceed 0
#define sceMcxResNoDevice (-12)
#define sceMcxIniSucceed 0
#define sceMcxIniErrKernel (-101)
#define sceMcxIniOldMcxserv (-120)
#define sceMcxIniOldMcxman (-121)
typedef struct {
short AppliNo;
short Reserve1;
int AplArg;
unsigned char Speaker;
unsigned char Infrared;
unsigned char Flash;
unsigned char Led;
struct {
unsigned char Week, Sec, Min, Hour;
unsigned char Day, Month;
unsigned short Year;
} _Rtc;
unsigned Serial;
} sceMcxTblInfo;
#define PWeek _Rtc.Week
#define PSec _Rtc.Sec
#define PMin _Rtc.Min
#define PHour _Rtc.Hour
#define PDay _Rtc.Day
#define PMonth _Rtc.Month
#define PYear _Rtc.Year
typedef struct {
unsigned char AMin, AHour;
unsigned Alarm:1;
unsigned KeyLock:1;
unsigned Volume:2;
unsigned AreaCode:3;
unsigned RtcSet:1;
unsigned char Reserve1;
unsigned short Font;
short Reserve2;
} sceMcxTblUifs;
/*
* Prototypes
*/
#ifdef __cplusplus
extern "C" {
#endif
int sceMcxInit(void);
int sceMcxGetInfo(int, int, sceMcxTblInfo *);
int sceMcxSetInfo(int, int, const sceMcxTblInfo *, unsigned);
int sceMcxGetMem(int, int, void *, unsigned, unsigned);
int sceMcxSetMem(int, int, const void *, unsigned, unsigned);
int sceMcxShowTrans(int, int, int, int);
int sceMcxHideTrans(int, int);
int sceMcxReadDev(int, int, int, const void *, unsigned, void *, unsigned);
int sceMcxWriteDev(int, int, int, const void *, unsigned, const void *, unsigned);
int sceMcxGetUifs(int, int, sceMcxTblUifs *);
int sceMcxSetUifs(int, int, const sceMcxTblUifs *);
int sceMcxSetLed(int, int, int);
int sceMcxChangeThreadPriority(int);
int sceMcxSync(int, int *, int *);
#ifdef __cplusplus
}
#endif
#endif // ndef _LIBMCX_H_

320
include/ee/libmpeg.h Normal file
View File

@ -0,0 +1,320 @@
/* SCE CONFIDENTIAL
"PlayStation 2" Programmer Tool Runtime Library Release 2.5
*/
/*
* Emotion Engine Library
* Version 0.10
* Shift-JIS
*
* Copyright (C) 1998-2000 Sony Computer Entertainment Inc.
* All Rights Reserved.
*
* libmpeg - libmpeg.h
* header file of libmpeg
*
* Version Date Design Log
* --------------------------------------------------------------------
* 0.10 Aug.14.1999 umemura the first version
* 0.20 Dec.11.1999 umemura PSS support
* 0.30 Dec.15.1999 umemura API is modified
* 0.40 Jan.19.2000 umemura flags area added
* 0.50 Feb.05.2000 umemura MPEG_BUFFER_SIZE
*/
#ifndef _LIBMPEG_H_
#define _LIBMPEG_H_
#include <eetypes.h>
#include <eeregs.h>
#include <libipu.h>
#ifdef __cplusplus
extern "C" {
#endif
// /////////////////////////////////////////////////////////////////////
//
// Definitions for MPEG decoder
//
//#define SCE_MPEG_BUFFER_SIZE(w, h) ((w)*(h)*9/2 + 512 + 24*64)
#define SCE_MPEG_BUFFER_SIZE(w, h) ((w)*(h)*9/2 + 512 + 24*64 + 4224 - 280)
#define SCE_MPEG_DECODE_ALL (-1)
// /////////////////////////////////////////////////////////////////////
//
// Flags for MPEG decoder
//
// 63 56 48 40 32
// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
// | |
// | |
// | |
// | |
// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
// 31 24 16 8 0
// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
// | |p|p|t|r| p| p|
// | |s|f|f|f| s| i|
// | |e|r|f|f| t| c|
// | |q|m| | | r| |
// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
//
// <pic>: picture_coding_type
//
// 000: Reserved
// 001: I picture
// 010: P picture
// 011: B picture
// 100: D picture (mpeg1)
// 101: Reserved
// 110: Reserved
// 111: Reserved
//
// <pstr>: picture_structure
//
// 00: reserved
// 01: Top Field
// 10: Bottom Field
// 11: Frame Picture
//
// <rff>: repeat_first_field
// <tff>: top_field_first
// <pfrm>: progressive_frame
// <pseq>: progressive_sequence
//
// Picture Coding Type
#define SCE_MPEG_I_PIC 0x1
#define SCE_MPEG_P_PIC 0x2
#define SCE_MPEG_B_PIC 0x3
#define SCE_MPEG_D_PIC 0x4
// Picture Structure
#define SCE_MPEG_TOP_FIELD 0x1
#define SCE_MPEG_BOT_FIELD 0x2
#define SCE_MPEG_FRAME 0x3
// /////////////////////////////////////////////////////////////////////
//
// Stream types
//
typedef enum {
sceMpegStrM2V = 0, // MPEG2 video stream
sceMpegStrIPU = 1, // IPU stream
sceMpegStrPCM = 2, // PCM stream
sceMpegStrADPCM = 3, // ADPCM stream
sceMpegStrDATA = 4 // DATA stream
} sceMpegStrType;
// /////////////////////////////////////////////////////////////////////
//
// MPEG callback types
//
typedef enum {
sceMpegCbError = 0,
sceMpegCbNodata = 1,
sceMpegCbStopDMA = 2,
sceMpegCbRestartDMA = 3,
sceMpegCbBackground = 4,
sceMpegCbTimeStamp = 5,
sceMpegCbStr = 6
} sceMpegCbType;
// /////////////////////////////////////////////////////////////////////
//
// MPEG callback data
//
// data structure for sceMpegCbError callback
typedef struct {
sceMpegCbType type;
char *errMessage;
} sceMpegCbDataError;
// data structure for sceMpegCbTimeStamp callback
typedef struct {
sceMpegCbType type;
long pts; // PTS value; valid only when pts >= 0
long dts; // DTS value; valid only when dts >= 0
} sceMpegCbDataTimeStamp;
// data structure for sceMpegCbStr callback
typedef struct {
sceMpegCbType type;
u_char *header; // the begining of packet header
u_char *data; // the begining of packet data
u_int len; // length of packet data
long pts; // PTS value; valid only when pts >= 0
long dts; // DTS value; valid only when dts >= 0
} sceMpegCbDataStr;
// Universal callback data structure
// sceMpegCbData is used as the default callback data structure
typedef union {
sceMpegCbType type;
sceMpegCbDataError error;
sceMpegCbDataTimeStamp ts;
sceMpegCbDataStr str;
} sceMpegCbData;
// /////////////////////////////////////////////////////////////////////
//
// MPEG decoder
//
typedef struct {
int width; // width of decoded image
int height; // height of decoded image
int frameCount; // frame number in the stream
long pts; // PTS(Presentation Time Stamp) value
// pts is valid only when pts >= 0
long dts; // DTS(Decoding Time Stamp) value
// dts is valid only when dts >= 0
u_long flags; // flags
long pts2nd; // PTS for 2nd field(for future use)
long dts2nd; // DTS for 2nd field(for future use)
u_long flags2nd; // flags for 2nd field(for future use)
void *sys; // system data for decoding
} sceMpeg;
// /////////////////////////////////////////////////////////////////////
//
// MPEG callback function definition
//
typedef int (*sceMpegCallback)(sceMpeg *mp,
sceMpegCbData *cbData, void *anyData);
// /////////////////////////////////////////////////////////////////////
//
// Functions of MPEG library
//
// =====================================================================
// sceMpegInit
// =====================================================================
// Initialize MPEG library
int sceMpegInit(void);
// =====================================================================
// sceMpegCreate
// =====================================================================
// Create MPEG decoder
int sceMpegCreate(sceMpeg *mp, u_char *work_area, int work_area_size);
// =====================================================================
// sceMpegDelete
// =====================================================================
// Delete MPEG decoder
int sceMpegDelete(sceMpeg *mp);
// =====================================================================
// sceMpegAddBs
// =====================================================================
// Set bitstream to MPEG decoder
int sceMpegAddBs(sceMpeg *mp, u_long128 *p, int size);
// =====================================================================
// sceMpegGetPicture
// =====================================================================
// Decode and extract one picture from input bitsream (RGB32 format)
int sceMpegGetPicture(sceMpeg *mp, sceIpuRGB32 *rgb32, int mbcount);
// =====================================================================
// sceMpegGetPictureRAW8
// =====================================================================
// Decode and extract one picture from input bitsream (RAW8 format)
int sceMpegGetPictureRAW8(sceMpeg *mp, sceIpuRAW8 *raw8, int mbcount);
// =====================================================================
// sceMpegReset
// =====================================================================
// Re-initialize MPEG decoder
int sceMpegReset(sceMpeg *mp);
// =====================================================================
// sceMpegIsEnd
// =====================================================================
// Check to see if MPEG decoder encounters sequence_end_code or not
int sceMpegIsEnd(sceMpeg *mp);
// =====================================================================
// sceMpegIsRefBuffEmpty
// =====================================================================
// Check to see if inner reference image buffers are empty or not
int sceMpegIsRefBuffEmpty(sceMpeg *mp);
// =====================================================================
// sceMpegDemuxPss
// =====================================================================
// Parse pss stream and call callback function for each
// elementary stream. This is used for de-multiplexing PSS data.
int sceMpegDemuxPss(sceMpeg *mp, u_char *pss, int pss_size);
// =====================================================================
// sceMpegDemuxPssRing
// =====================================================================
// Parse pss stream in a ring shape buffer and call callback
// function for each elementary stream. This is used for de-multiplexing
// PSS data.
int sceMpegDemuxPssRing(sceMpeg *mp, u_char *pss, int pss_size,
u_char *buf_top, int buf_size);
// =====================================================================
// sceMpegSetDecodeMode
// =====================================================================
// Set decode mode of MPEG decoder
void sceMpegSetDecodeMode(sceMpeg *mp, int ni, int np, int nb);
// =====================================================================
// sceMpegGetDecodeMode
// =====================================================================
// Get decode mode of MPEG decoder
void sceMpegGetDecodeMode(sceMpeg *mp, int *ni, int *np, int *nb);
// =====================================================================
// sceMpegAddCallback
// =====================================================================
// Add callback function to MPEG decoder
sceMpegCallback sceMpegAddCallback(
sceMpeg *mp,
sceMpegCbType type,
sceMpegCallback callback,
void *anyData
);
// =====================================================================
// sceMpegAddStrCallback
// =====================================================================
// Add callback function for sceMpegCbStr callback
sceMpegCallback sceMpegAddStrCallback(
sceMpeg *mp,
sceMpegStrType strType,
int ch,
sceMpegCallback callback,
void *anyData
);
#ifdef __cplusplus
}
#endif
#endif // _LIBMPEG_H_

89
include/ee/libmrpc.h Normal file
View File

@ -0,0 +1,89 @@
/* SCE CONFIDENTIAL
"PlayStation 2" Programmer Tool Runtime Library Release 2.5.3
*/
/*
* Emotion Engine Library
* Version 0.1.0
* Shift-JIS
*
* Copyright (C) 1998-1999 Sony Computer Entertainment Inc.
* All Rights Reserved.
*
* sifrpc.h
* develop library
*
* Version Date Design Log
* --------------------------------------------------------------------
* 0.1.0
*/
#ifndef _MSIFRPC_H_DEFS
#define _MSIFRPC_H_DEFS
#if defined(_LANGUAGE_C_PLUS_PLUS)||defined(__cplusplus)||defined(c_plusplus)
extern "C" {
#endif
typedef struct _sifm_rpc_data {
void *paddr; /* packet address */
unsigned int pid; /* packet id */
int tid; /* thread id */
unsigned int mode; /* call mode */
} sceSifMRpcData;
typedef void (* sceSifMEndFunc)(void *);
typedef struct _sifm_client_data {
struct _sifm_rpc_data rpcd;
unsigned int command;
void *buff;
void *cbuff;
sceSifMEndFunc func;
void *para;
void *serve;
int sema;
int unbind;
int buffersize;
int stacksize;
int prio;
} sceSifMClientData;
/* call & bind mode */
#define SIF_RPCM_NOWAIT 0x01 /* not wait for end of function */
#define SIF_RPCM_NOWBDC 0x02 /* no write back d-cache .ee only */
/* error no */
#define SIF_RPCE_GETP 1 /* fail to get packet data */
#define SIF_RPCE_SENDP 2 /* fail to send dma packet */
#define SIF_RPCE_CSEMA 3 /* fail to get sema */
/* unbind result */
#define SIFM_UB_OK 1
#define SIFM_UB_NOT_DORMANT 2
#define SIFM_UB_NOT_EXIST 3
#define SIFM_UB_NOT_SLEEP 4
/* get member macro */
#define sceSifMGetBufferSize(x) (x)->buffersize
#define sceSifMGetStackSize(x) (x)->stacksize
#define sceSifMGetPriority(x) (x)->prio
/* functions */
void sceSifMInitRpc(unsigned int mode);
void sceSifMExitRpc(void);
int sceSifMBindRpc(sceSifMClientData *, unsigned int, unsigned int);
int sceSifMBindRpcParam(sceSifMClientData *, unsigned int, unsigned int,
unsigned int,unsigned int, int);
int sceSifMUnBindRpc(sceSifMClientData *, unsigned int);
/* int sceSifMUnBindRpc(sceSifMClientData *, unsigned int, unsigned int);*/
int sceSifMCallRpc(sceSifMClientData *, unsigned int, unsigned int,void *,int, void *,int, sceSifMEndFunc, void *);
#if defined(_LANGUAGE_C_PLUS_PLUS)||defined(__cplusplus)||defined(c_plusplus)
}
#endif
#endif /* _MSIFRPC_H_DEFS */
/* End of File */

21
include/ee/libmsin.h Normal file
View File

@ -0,0 +1,21 @@
/* SCE CONFIDENTIAL
"PlayStation 2" Programmer Tool Runtime Library Release 2.5
*/
/*
* Emotion Engine Library
* Version 0.60
* Shift-JIS
*
* Copyright (C) 1998-1999 Sony Computer Entertainment Inc.
* All Rights Reserved.
*
* libmsin - libmsin.h
* EE Midi Stream Message Input
*
* Version Date Design Log
* --------------------------------------------------------------------
* 0.60 Dec.02.1999 katayama first checked in.
*/
#include <modmsin.h>
/* $Id: libmsin.h,v 1.1.54.1 2002/02/19 09:16:30 xokano Exp $ */

25
include/ee/libmtap.h Normal file
View File

@ -0,0 +1,25 @@
/* SCE CONFIDENTIAL
"PlayStation 2" Programmer Tool Runtime Library Release 2.5
*/
/*
* multitap library
* Copyright(C) 1999,2000 Sony Computer Entertainment Inc.,
* All rights reserved.
*/
#ifndef _LIBMTAP_H_
#define _LIBMTAP_H_
#if defined(__LANGUAGE_C_PLUS_PLUS)||defined(__cplusplus)||defined(c_plusplus)
extern "C" {
#endif
int sceMtapInit( void );
int sceMtapPortOpen( int port );
int sceMtapPortClose( int port );
int sceMtapGetConnection( int port );
int sceMtapChangeThreadPriority( int priority_high, int priority_low );
#if defined(__LANGUAGE_C_PLUS_PLUS)||defined(__cplusplus)||defined(c_plusplus)
}
#endif
#endif

115
include/ee/libnet.h Normal file
View File

@ -0,0 +1,115 @@
/* SCE CONFIDENTIAL
"PlayStation 2" Programmer Tool Runtime Library Release 2.5.3
*/
/*
* Libnet Library
*
* Copyright (C) 2000-2002 Sony Computer Entertainment Inc.
* All Rights Reserved.
*
* This header is used in Application(EE) & Libnet(EE).
*
* Version Date Design Log
* --------------------------------------------------------------------
* 1.1.0 2002/01/24 ksh sample to library
*/
#if ( !defined __LIBNET_LIBNET_H )
#define __LIBNET_LIBNET_H
/*** Header ***/
#include <libmrpc.h>
/*** Libnet header ***/
#include <libnet/libnetdefs.h>
/*** IOP header ***/
#define __LIBNET__
#include <../../iop/install/include/inet/inet.h>
#include <../../iop/install/include/inet/in.h>
#include <../../iop/install/include/inet/netdev.h>
#if defined(__cplusplus)
extern "C" {
#endif
/*** Libnet ***/
int sceLibnetInitialize( sceSifMClientData *cd, u_int buffersize, u_int stacksize, int priority );
int sceLibnetTerminate( sceSifMClientData *cd );
int sceLibnetRegisterHandler( sceSifMClientData *cd, u_int *net_buf );
int sceLibnetUnregisterHandler( sceSifMClientData *cd, u_int *net_buf );
int sceLibnetSetConfiguration( sceSifMClientData *cd, u_int *net_buf, u_int env_addr );
int sceLibnetWaitGetAddress( sceSifMClientData *cd, u_int *net_buf, int *if_id, int n, struct sceInetAddress *addr, u_int flags );
int sceLibnetWaitGetInterfaceID( sceSifMClientData *cd, u_int *net_buf, int *if_id, int n );
/*** INET ***/
int sceInetPoll( sceSifMClientData *cd, u_int *net_buf, sceInetPollFd_t *fds, int nfds, int ms );
int sceInetName2Address( sceSifMClientData *cd, u_int *net_buf, int flags, struct sceInetAddress *paddr, const char *name, int ms, int nretry );
int sceInetAddress2String( sceSifMClientData *cd, u_int *net_buf, char *name, int len, struct sceInetAddress *paddr );
int sceInetAddress2Name( sceSifMClientData *cd, u_int *net_buf, int flags, char *name, int len, struct sceInetAddress *paddr, int ms, int nretry );
int sceInetCreate( sceSifMClientData *cd, u_int *net_buf, struct sceInetParam *param );
int sceInetOpen( sceSifMClientData *cd, u_int *net_buf, int cid, int ms );
int sceInetClose( sceSifMClientData *cd, u_int *net_buf, int cid, int ms );
int sceInetRecv( sceSifMClientData *cd, u_int *net_buf, int cid, void *ptr, int count, int *pflags, int ms );
int sceInetRecvFrom( sceSifMClientData *cd, u_int *net_buf, int cid, void *ptr, int count, int *pflags, struct sceInetAddress *remote_adr, int *premote_port, int ms );
int sceInetSend( sceSifMClientData *cd, u_int *net_buf, int cid, const void *ptr, int count, int *pflags, int ms );
int sceInetSendTo( sceSifMClientData *cd, u_int *net_buf, int cid, void *ptr, int count, int *pflags, struct sceInetAddress *remote_adr, int remote_port, int ms );
int sceInetAbort( sceSifMClientData *cd, u_int *net_buf, int cid, int flags );
int sceInetControl( sceSifMClientData *cd, u_int *net_buf, int cid, int code, void *ptr, int len );
int sceInetGetInterfaceList( sceSifMClientData *cd, u_int *net_buf, int *interface_id_list, int n );
int sceInetInterfaceControl( sceSifMClientData *cd, u_int *net_buf, int interface_id, int code, void *ptr, int len );
int sceInetGetRoutingTable( sceSifMClientData *cd, u_int *net_buf, struct sceInetRoutingEntry *p, int n );
int sceInetGetNameServers( sceSifMClientData *cd, u_int *net_buf, struct sceInetAddress *paddr, int n );
int sceInetChangeThreadPriority( sceSifMClientData *cd, u_int *net_buf, int prio );
int sceInetGetLog( sceSifMClientData *cd, u_int *net_buf, char *log_buf, int len, int ms );
int sceInetAbortLog( sceSifMClientData *cd, u_int *net_buf );
/*** INETCTL ***/
int sceInetCtlUpInterface( sceSifMClientData *cd, u_int *net_buf, int id );
int sceInetCtlDownInterface( sceSifMClientData *cd, u_int *net_buf, int id );
int sceInetCtlSetAutoMode( sceSifMClientData *cd, u_int *net_buf, int f_auto );
int sceInetCtlGetState( sceSifMClientData *cd, u_int *net_buf, int id, int *pstate );
/*** disable ***/
#if defined sceLibnetDisableAll
#undef sceLibnetDisableCompatible
#define sceLibnetDisableCompatible
#undef sceLibnetDisableNoExtra
#define sceLibnetDisableNoExtra
#undef sceLibnetDisableAliases
#define sceLibnetDisableAliases
#endif /*** sceLibnetDisableAll ***/
/*** compatible ***/
#if ( !defined sceLibnetDisableCompatible )
int load_set_conf_extra( sceSifMClientData *cd, u_int *net_buf, char *fname, char *usr_name, u_int flags );
#endif /*** sceLibnetDisableCompatible ***/
/*** extra( reserved ) ***/
#if ( !defined sceLibnetDisableNoExtra )
#endif /*** sceLibnetDisableNoExtra ***/
/*** alias ***/
#if ( !defined sceLibnetDisableAliases )
#define libnet_init( xcd, x1, x2, x3 ) sceLibnetInitialize( xcd, x1, x2, x3 )
#define libnet_term( xcd ) sceLibnetTerminate( xcd )
#define reg_handler( xcd, xnet_buf ) sceLibnetRegisterHandler( xcd, xnet_buf )
#define unreg_handler( xcd, xnet_buf ) sceLibnetUnregisterHandler( xcd, xnet_buf )
#define load_set_conf( xcd, xnet_buf, x1, x2 ) load_set_conf_extra( xcd, xnet_buf, x1, x2, sceLIBNETF_AUTO_LOADMODULE | sceLIBNETF_AUTO_UPIF )
#define load_set_conf_only( xcd, xnet_buf, x1, x2 ) load_set_conf_extra( xcd, xnet_buf, x1, x2, sceLIBNETF_AUTO_LOADMODULE )
#define wait_get_addr( xcd, xnet_buf, x1, x2 ) sceLibnetWaitGetAddress( xcd, xnet_buf, x1, 1, x2, sceLIBNETF_AUTO_UPIF )
#define wait_get_addr_only( xcd, xnet_buf, x1, x2 ) sceLibnetWaitGetAddress( xcd, xnet_buf, x1, 1, x2, 0 )
#define get_interface_id( xcd, xnet_buf, x1 ) sceLibnetWaitGetInterfaceID( xcd, xnet_buf, x1, 1 )
#define up_interface( xcd, xnet_buf, x1 ) sceInetCtlUpInterface( xcd, xnet_buf, x1 )
#define down_interface( xcd, xnet_buf, x1 ) sceInetCtlDownInterface( xcd, xnet_buf, x1 )
#endif /*** sceLibnetDisableAliases ***/
#if defined(__cplusplus)
}
#endif
#endif /*** __LIBNET_LIBNET_H ***/
/*** End of file ***/

112
include/ee/libpad.h Normal file
View File

@ -0,0 +1,112 @@
/* SCE CONFIDENTIAL
"PlayStation 2" Programmer Tool Runtime Library Release 2.5
*/
/*
* Controller Library
* Version 1.2
* Shift-JIS
*
* Copyright (C) 1998-1999 Sony Computer Entertainment Inc.
* All Rights Reserved.
*
* libpad - libpad.h
* header file of libpad
*
* Version Date Design Log
* --------------------------------------------------------------------
* 0.00 1999- 7-28 makoto the first version
* 1.10 1999-10-15 iwano remove sce Prefix
* 1.20 1999-11-22 added scePrefix
* 1.30 1999-12-14 support cplus
* 1.31 1999-12-20 cplus native support
* 2.00 2000-08-15 remove "scePadStateFindCTP2"
* 2.10 2000-10-18 added scePadStateClosed
* 2.324 2001-07-25 added scePadInitGun()/EndGun()
*/
#ifndef _LIBPAD_H_
#define _LIBPAD_H_
#ifndef SCE_PADLup
/* keys config */
#define SCE_PADLup (1<<12)
#define SCE_PADLdown (1<<14)
#define SCE_PADLleft (1<<15)
#define SCE_PADLright (1<<13)
#define SCE_PADRup (1<< 4)
#define SCE_PADRdown (1<< 6)
#define SCE_PADRleft (1<< 7)
#define SCE_PADRright (1<< 5)
#define SCE_PADi (1<< 9)
#define SCE_PADj (1<<10)
#define SCE_PADk (1<< 8)
#define SCE_PADl (1<< 3)
#define SCE_PADm (1<< 1)
#define SCE_PADn (1<< 2)
#define SCE_PADo (1<< 0)
#define SCE_PADh (1<<11)
#define SCE_PADL1 SCE_PADn
#define SCE_PADL2 SCE_PADo
#define SCE_PADR1 SCE_PADl
#define SCE_PADR2 SCE_PADm
#define SCE_PADstart SCE_PADh
#define SCE_PADselect SCE_PADk
#endif /* SCE_PADLup */
#define scePadStateDiscon (0)
#define scePadStateFindPad (1)
#define scePadStateFindCTP1 (2)
#define scePadStateExecCmd (5)
#define scePadStateStable (6)
#define scePadStateError (7)
#define scePadStateClosed ( 99 )
#define scePadReqStateComplete (0)
#define scePadReqStateFaild (1)
#define scePadReqStateFailed (1)
#define scePadReqStateBusy (2)
#define InfoModeCurID (1)
#define InfoModeCurExID (2)
#define InfoModeCurExOffs (3)
#define InfoModeIdTable (4)
#define InfoActFunc (1)
#define InfoActSub (2)
#define InfoActSize (3)
#define InfoActCurr (4)
#define InfoActSign (5)
#define scePadDmaBufferMax (16)
#define scePadError (0)
#if defined(__LANGUAGE_C_PLUS_PLUS)||defined(__cplusplus)||defined(c_plusplus)
extern "C" {
#endif
int scePadInit( int mode );
int scePadPortOpen( int port, int slot, u_long128* addr );
int scePadRead( int port, int slot, unsigned char* rdata );
int scePadInfoAct( int port, int slot, int actno, int term );
int scePadInfoComb( int port, int slot, int listno, int offs );
int scePadInfoMode( int port, int slot, int term, int offs );
int scePadSetActDirect( int port, int slot, const unsigned char* data );
int scePadSetActAlign( int port, int slot, const unsigned char* data );
int scePadGetState( int port, int slot );
int scePadGetReqState(int port, int slot);
int scePadSetMainMode( int port, int slot, int offs, int lock );
int scePadInfoPressMode( int port, int slot );
int scePadEnterPressMode( int port, int slot );
int scePadExitPressMode( int port, int slot );
void scePadReqIntToStr(int state, char* str);
void scePadStateIntToStr(int state, char* str);
int scePadEnd(void);
int scePadPortClose( int port, int slot );
int scePadGetSlotMax( int port );
int scePadSetWarningLevel(int level);
int scePadInitGun(int mode);
int scePadEndGun(void);
#if defined(__LANGUAGE_C_PLUS_PLUS)||defined(__cplusplus)||defined(c_plusplus)
}
#endif
#endif /* _LIBPAD_H_ */

102
include/ee/libpad2.h Normal file
View File

@ -0,0 +1,102 @@
/* SCE CONFIDENTIAL
"PlayStation 2" Programmer Tool Runtime Library Release 2.5
*/
/*
* Controller Library
* Version 2.01
* Shift-JIS
*
* Copyright (C) 2001 Sony Computer Entertainment Inc.
* All Rights Reserved.
*
* libpad2 - libpad2.h
* header file of libpad2
*
* Version Date Design Log
* --------------------------------------------------------------------
* 2.01 2001-03-09 nozomu the first version
*
*/
#ifndef _LIBPAD2_H_
#define _LIBPAD2_H_
#define SCE_PAD2_DMA_BUFFER_MAX (16)
#define SCE_PAD2_MAX_DEVICE_NAME (16)
#define SCE_PAD2_PORT_1C (0)
#define SCE_PAD2_PORT_2C (1)
#define SCE_PAD2_PORT_USB (99)
#define SCE_PAD2_SPECIFIC_PORT ( 1 << 1 )
#define SCE_PAD2_SPECIFIC_DRIVER_NUMBER ( 1 << 2 )
#define SCE_PAD2_SPECIFIC_DEVICE_NAME ( 1 << 3 )
#define scePad2StateNoLink (0)
#define scePad2StateStable (1)
#define scePad2StateExecCmd (2)
#define scePad2StateError (3)
#define SCE_PAD2_SELECT (0)
#define SCE_PAD2_L3 (1)
#define SCE_PAD2_R3 (2)
#define SCE_PAD2_START (3)
#define SCE_PAD2_UP (4)
#define SCE_PAD2_RIGHT (5)
#define SCE_PAD2_DOWN (6)
#define SCE_PAD2_LEFT (7)
#define SCE_PAD2_L2 (8)
#define SCE_PAD2_R2 (9)
#define SCE_PAD2_L1 (10)
#define SCE_PAD2_R1 (11)
#define SCE_PAD2_TRIANGLE (12)
#define SCE_PAD2_CIRCLE (13)
#define SCE_PAD2_CROSS (14)
#define SCE_PAD2_SQUARE (15)
#define SCE_PAD2_STICK_RX (16)
#define SCE_PAD2_STICK_RY (17)
#define SCE_PAD2_STICK_LX (18)
#define SCE_PAD2_STICK_LY (19)
#define SCE_PAD2_ANALOG_RIGHT (20)
#define SCE_PAD2_ANALOG_LEFT (21)
#define SCE_PAD2_ANALOG_UP (22)
#define SCE_PAD2_ANALOG_DOWN (23)
#define SCE_PAD2_ANALOG_TRIANGLE (24)
#define SCE_PAD2_ANALOG_CIRCLE (25)
#define SCE_PAD2_ANALOG_CROSS (26)
#define SCE_PAD2_ANALOG_SQUARE (27)
#define SCE_PAD2_ANALOG_L1 (28)
#define SCE_PAD2_ANALOG_R1 (29)
#define SCE_PAD2_ANALOG_L2 (30)
#define SCE_PAD2_ANALOG_R2 (31)
typedef struct
{
unsigned int option;
int port;
int slot;
int number;
unsigned char name[ SCE_PAD2_MAX_DEVICE_NAME ];
} scePad2SocketParam;
#if defined(__LANGUAGE_C_PLUS_PLUS)||defined(__cplusplus)||defined(c_plusplus)
extern "C" {
#endif
int scePad2Init( int );
int scePad2End( void );
int scePad2CreateSocket( scePad2SocketParam*, u_long128* );
int scePad2DeleteSocket( int );
int scePad2Read( int, unsigned char* );
int scePad2GetButtonProfile( int, unsigned char* );
int scePad2GetState( int );
int scePad2GetButtonInfo( int, unsigned char*, int );
void scePad2StateIntToStr( int, unsigned char* );
#if defined(__LANGUAGE_C_PLUS_PLUS)||defined(__cplusplus)||defined(c_plusplus)
}
#endif
#endif /* _LIBPAD2_H_ */

102
include/ee/libpc.h Normal file
View File

@ -0,0 +1,102 @@
/* SCE CONFIDENTIAL
"PlayStation 2" Programmer Tool Runtime Library Release 2.5
*/
/*
* Emotion Engine Library
* Version 0.02
* Shift-JIS
*
* Copyright (C) 2001 Sony Computer Entertainment Inc.
* All Rights Reserved.
*
* libpc - libpc.h
* Performance Counter access functions
*
* Version Date Design Log
* --------------------------------------------------------------------
* 0.00 06/21/1999 koji first version
* 0.01 12/08/1999 koji bug fix, TLB to ITLB
* 0.02 01/23/2001 akiyuki addition of prototype
* declaration and __asm__
*/
#ifndef _LIBPC_H
#define _LIBPC_H
#ifdef __cplusplus
extern "C" {
#endif
// Bitfields in the CCR register
#define SCE_PC_EXL0 (1 << 1)
#define SCE_PC_K0 (1 << 2)
#define SCE_PC_S0 (1 << 3)
#define SCE_PC_U0 (1 << 4)
#define SCE_PC_EVENT0 (31 << 5)
#define SCE_PC_EXL1 (1 << 11)
#define SCE_PC_K1 (1 << 12)
#define SCE_PC_S1 (1 << 13)
#define SCE_PC_U1 (1 << 14)
#define SCE_PC_EVENT1 (31 << 15)
#define SCE_PC_CTE (1 << 31)
// Performance Counter Events
#define SCE_PC0_RESERVED (0 << 5)
#define SCE_PC0_CPU_CYCLE (1 << 5) // Processor cycle
#define SCE_PC0_SINGLE_ISSUE (2 << 5) // Single instructions issue
#define SCE_PC0_BRANCH_ISSUED (3 << 5) // Branch issued
#define SCE_PC0_BTAC_MISS (4 << 5) // BTAC miss
#define SCE_PC0_ITLB_MISS (5 << 5) // ITLB miss
#define SCE_PC0_ICACHE_MISS (6 << 5) // Instruction cache miss
#define SCE_PC0_DTLB_ACCESSED (7 << 5) // DTLB accessed
#define SCE_PC0_NONBLOCK_LOAD (8 << 5) // Non-blocking load
#define SCE_PC0_WBB_SINGLE_REQ (9 << 5) // WBB single request
#define SCE_PC0_WBB_BURST_REQ (10 << 5) // WBB burst request
#define SCE_PC0_ADDR_BUS_BUSY (11 << 5) // CPU address bus busy
#define SCE_PC0_INST_COMP (12 << 5) // Instruction completed
#define SCE_PC0_NON_BDS_COMP (13 << 5) // Non-BDS instruction completed
#define SCE_PC0_COP2_COMP (14 << 5) // COP2 instruction completed
#define SCE_PC0_LOAD_COMP (15 << 5) // Load completed
#define SCE_PC0_NO_EVENT (16 << 5) // No event
#define SCE_PC1_LOW_BRANCH_ISSUED (0 << 15) // Low-order branch issued
#define SCE_PC1_CPU_CYCLE (1 << 15) // Processor cycle
#define SCE_PC1_DUAL_ISSUE (2 << 15) // Dual instructions issue
#define SCE_PC1_BRANCH_MISS_PREDICT (3 << 15) // Branch miss-predicted
#define SCE_PC1_TLB_MISS (4 << 15) // TLB miss
#define SCE_PC1_DTLB_MISS (5 << 15) // DTLB miss
#define SCE_PC1_DCACHE_MISS (6 << 15) // Data cache miss
#define SCE_PC1_WBB_SINGLE_UNAVAIL (7 << 15) // WBB single request unavailable
#define SCE_PC1_WBB_BURST_UNAVAIL (8 << 15) // WBB burst request unavailable
#define SCE_PC1_WBB_BURST_ALMOST (9 << 15) // WBB burst request almost full
#define SCE_PC1_WBB_BURST_FULL (10 << 15) // WBB burst request full
#define SCE_PC1_DATA_BUS_BUSY (11 << 15) // CPU data bus busy
#define SCE_PC1_INST_COMP (12 << 15) // Instruction completed
#define SCE_PC1_NON_BDS_COMP (13 << 15) // Non-BDS instruction completed
#define SCE_PC1_COP1_COMP (14 << 15) // COP1 instruction completed
#define SCE_PC1_STORE_COMP (15 << 15) // Store completed
#define SCE_PC1_NO_EVENT (16 << 15) // No event
void scePcStart(int control, int counter0, int counter1);
void scePcStop(void);
extern __inline__ int scePcGetCounter0(void);
extern __inline__ int scePcGetCounter0(void) {
register int ctr0;
__asm__ volatile ("mfpc %0, 0": "=r" (ctr0));
return ctr0;
};
extern __inline__ int scePcGetCounter1(void);
extern __inline__ int scePcGetCounter1(void) {
register int ctr1;
__asm__ volatile ("mfpc %0, 1": "=r" (ctr1));
return ctr1;
};
#ifdef __cplusplus
}
#endif
#endif // _LIBPC_H

27
include/ee/libpkt.h Normal file
View File

@ -0,0 +1,27 @@
/* SCE CONFIDENTIAL
"PlayStation 2" Programmer Tool Runtime Library Release 2.5
*/
/*
* Emotion Engine Library
* Version 0.01
* Shift-JIS
*
* Copyright (C) 1998-1999 Sony Computer Entertainment Inc.
* All Rights Reserved.
*
* libpkt - libpkt.h
* include libdmapk.h,libvifpk.h,libgifpk.h
*
* Version Date Design Log
* --------------------------------------------------------------------
* 0.01 Mar,26,1999 shibuya
*/
#ifndef __libpkt__
#define __libpkt__
#include <libdmapk.h>
#include <libvifpk.h>
#include <libgifpk.h>
#endif /* __libpkt__ */

94
include/ee/libscf.h Normal file
View File

@ -0,0 +1,94 @@
/* SCE CONFIDENTIAL
"PlayStation 2" Programmer Tool Runtime Library Release 2.5
*/
/*
* Emotion Engine Library
* Version 1.0
* S-JIS
*
* Copyright (C) 1998-2000 Sony Computer Entertainment Inc.
* All Rights Reserved.
*
* <libscf - libscf.h>
* <system configuration library>
*
* Version Date Design Log
* --------------------------------------------------------------------
* 1.0 Jul.31.2000 kumagae First release
*/
#ifndef _LIBSCF_H
#define _LIBSCF_H
#ifndef _LIBCDVD_H
#include <libcdvd.h>
#endif
//ASPECT
#define SCE_ASPECT_43 0
#define SCE_ASPECT_FULL 1
#define SCE_ASPECT_169 2
//DATE NOTATION
#define SCE_DATE_YYYYMMDD 0
#define SCE_DATE_MMDDYYYY 1
#define SCE_DATE_DDMMYYYY 2
//LANGUAGE
#define SCE_JAPANESE_LANGUAGE 0
#define SCE_ENGLISH_LANGUAGE 1
#define SCE_FRENCH_LANGUAGE 2
#define SCE_SPANISH_LANGUAGE 3
#define SCE_GERMAN_LANGUAGE 4
#define SCE_ITALIAN_LANGUAGE 5
#define SCE_DUTCH_LANGUAGE 6
#define SCE_PORTUGUESE_LANGUAGE 7
//SPDIF
#define SCE_SPDIF_ON 0
#define SCE_SPDIF_OFF 1
//SUMMER TIME
#define SCE_SUMMERTIME_OFF 0
#define SCE_SUMMERTIME_ON 1
//TIME NOTATION
#define SCE_TIME_24HOUR 0
#define SCE_TIME_12HOUR 1
typedef struct {
short TimeZone;
u_char Aspect;
u_char DateNotation;
u_char Language;
u_char Spdif;
u_char SummerTime;
u_char TimeNotation;
} sceScfT10kConfig;
/*
* Prototypes
*/
#if defined(_LANGUAGE_C_PLUS_PLUS)||defined(__cplusplus)||defined(c_plusplus)
extern "C" {
#endif
void sceScfSetT10kConfig(sceScfT10kConfig *config);
int sceScfGetLanguage(void);
int sceScfGetAspect(void);
int sceScfGetSpdif(void);
int sceScfGetTimeZone(void);
int sceScfGetDateNotation(void);
int sceScfGetSummerTime(void);
int sceScfGetTimeNotation(void);
void sceScfGetLocalTimefromRTC(sceCdCLOCK *rtc);
void sceScfGetGMTfromRTC(sceCdCLOCK *rtc);
#if defined(_LANGUAGE_C_PLUS_PLUS)||defined(__cplusplus)||defined(c_plusplus)
}
#endif
#endif /* _LIBSCF_H */

39
include/ee/libsdr.h Normal file
View File

@ -0,0 +1,39 @@
/* SCE CONFIDENTIAL
"PlayStation 2" Programmer Tool Runtime Library Release 2.5.3
*/
/*
* Emotion Engine Library
*
* Copyright (C) 1998-1999 Sony Computer Entertainment Inc.
* All Rights Reserved.
*
* libsdr.h
*
*/
#ifndef _LIBSDR_H_
#define _LIBSDR_H_
#include <sdmacro.h> /* common/include */
#include <sdrcmd.h> /* common/include */
#include <sifrpc.h>
#ifdef __cplusplus
extern "C" {
#endif
/* ----------------------------------------------------------------
* Proto Types
* ---------------------------------------------------------------- */
extern int sceSdRemoteInit( void );
extern int sceSdRemote( int arg, ... );
extern int sceSdRemoteCallbackInit( int priority );
extern sceSifEndFunc sceSdCallBack( sceSifEndFunc end_func );
extern int sceSdTransToIOP( void *buff, u_int sendAddr, u_int size, u_int isBlock );
#ifdef __cplusplus
}
#endif
#endif /* _LIBSDR_H_ */

16
include/ee/libsein.h Normal file
View File

@ -0,0 +1,16 @@
/* SCE CONFIDENTIAL
"PlayStation 2" Programmer Tool Runtime Library Release 2.5
*/
/*
* Emotion Engine Library
*
* Copyright (C) 2001 Sony Computer Entertainment Inc.
* All Rights Reserved.
*
* libsein.h
* EE SE Stream Message Input
*/
#include <modsein.h>
/* This file ends here, DON'T ADD STUFF AFTER THIS */

135
include/ee/libsn.h Normal file
View File

@ -0,0 +1,135 @@
#ifndef _LIBSN_H
#define _LIBSN_H
/* Version 1.12 */
/* 1.12 ADB 17-12-2001 - Removed DEBUG/VU modules because 1.72.21 PS2DBG does this now */
/* 1.11 TC VU0/1 MAC flags now preserved when doing Get/Set ACC */
/* 1.10 ADB irq handler now initialises own local stack space */
/* 1.9 ADB removed inter-function branch that upset ps2ld fn stripping */
/* 1.8 ADB removed dependency on 2.2.4 lib version of EI/DI */
/* 1.7 ADB paranoia... preserved other regs in context */
/* 1.6 ADB fixed occasional spurious corruption of lo register */
/* 1.5 ADB samples written to uncached space */
/* 1.4 ADB wrapped snProfEnableInt and snProfDisableInt with global EI/DI */
/* 1.3 ADB added snProfEnableInt and snProfDisableInt */
#ifdef __cplusplus
extern "C" {
#endif
#ifndef UINT32
#define UINT32 unsigned int
#define NEEDUNDEFUINT32
#endif
/**************************/
/* SN debugger extensions */
/* Routine to install additional debugger supprt functions */
extern int snDebugInit (void); // this is now just a dummy Fn that returns 1 because the 1.72.21 debugger onwards does this automatically.
extern int __snIsDebuggerRunning;
extern int snIsDebuggerRunning(void); /* fn or macro? leave this as a function for now */
/*************************************/
/* SN Run time DLL handling routines */
/* call at the start of your code to initialise the dll system */
extern int snInitDllSystem (void** index_pointer);
/* Call this routine after a dll has been loaded into memory to relocate and initialise it */
extern int snDllLoaded (void* buffer, void** index_pointer);
/* Call this routine to close down a dll before freeing the memory it's in */
extern int snDllUnload (void* buffer);
/* Call this routine to re-relocate a dll to a new address */
/* If your program has taken any pointers to the dll code or data your program will fail */
/* A dll cannot move itself or call a routine that moves it */
extern int snDllMove (void* destination, void* source, void** index_pointer);
#define SN_DLL_SUCCESS 0 /* operation succeeded */
#define SN_DLL_NOT_A_DLL 1 /* The buffer doesn't seem to contain a dll */
#define SN_DLL_BAD_VERSION 2 /* The dll version is not support by this code */
#define SN_DLL_INVALID 3 /* Some data in the dll header was invalid */
#define SN_DLL_BAD_ALIGN 4 /* The dll is not aligned to the required boundary */
#define SN_DLL_NOT_LOADED 5 /* The dll has not been loaded so can't be unloaded */
#define SN_DLL_TOO_MANY_MODULES 6 /* Too many modules loaded */
#define SN_DLL_INVALID_SYMTYPE 7 /* Symbol type invalid - dll file is corrupt or libsn.a needs updating */
#define SN_DLL_INVALID_DEFINE_GLOBAL_FAILED 8 /* Failure defining a global symbol. Most likely cause is that there is a breakpoint on an address that needs to be patched */
#define SN_DLL_INVALID_DEFINE_ABS_FAILED 9 /* Failure defining an absolute symbol. Most likely cause is that there is a breakpoint on an address that needs to be patched */
#define SN_DLL_INVALID_PATCH_FAILED 10 /* Invalid patch type - dll file is corrupt or libsn.a needs updating */
#define SN_DLL_INVALID_REMOVE_RELMOD_FAILED 11 /* The dll has not been loaded so can't be moved */
/*============ PROFILER STUFF ====================*/
/* interval values to pass to snProfInit() and snProfSetInterval() */
#define _1KHZ 300000
#define _2KHZ 150000
#define _4KHZ 75000
#define _10KHZ 30000
#define _20KHZ 15000
struct _PROFHDR
{
UINT32 interval; /* interval count (cpu clocks) */
UINT32 startpc; /* profile lower limit for PC */
UINT32 endpc; /* profile upper limit for PC */
UINT32 mask; /* mask value for above flags */
UINT32 flags; /* flags */
UINT32 buffptr; /* ptr to two profile-sample-data buffers */
UINT32 bufflen; /* length of one-half sample buffer */
UINT32 ptr; /* actually an index but we just want to know if it is 0 or -1 */
/* UINT32 buffnum; not present on IOP side */
};
typedef struct _PROFHDR PROFHDR;
struct _PROFSAMPLE
{
UINT32 pc;
/* UINT32 flags; */
};
typedef struct _PROFSAMPLE PROFSAMPLE;
/* Export from profile.c */
int snProfInit(unsigned int rate, void* buffer, int buffersize );
void snProfEnableInt();
void snProfDisableInt();
/* and it's return values */
#define SN_PRF_SUCCESS 0 /* operation succeeded */
#define SN_PRF_TEQFAIL 1 /* IRQ hook failed to install */
#define SN_PRF_NOIOP 2 /* IOP sync failed */
#define SN_PRF_BUFFALIGN 3 /* The profile data buffer is not quadword aligned */
#define SN_PRF_BUFFSIZE 4 /* The buffer is too small or too large */
#define SN_PRF_RPCFAIL 5 /* Cannot RPC the IOP module */
/* things in prof.s */
extern int _snProfInit(unsigned int rate, void* buffer, int buffersize );
extern void _snProfEnableInt();
extern void _snProfDisableInt();
extern int snDIntr();
extern int snEIntr();
extern void snProfSetInterval(UINT32 interval);
extern void snProfSetRange(int profmask, void* startpc, void* endpc);
extern int snProfSetFlagValue(int value);
extern int snProfSetFlags(int flags);
extern int snProfClrFlags(int flags);
#ifdef NEEDUNDEFUINT32 /* only undefine it if *we* defined it */
#undef UINT32
#endif
#ifdef __cplusplus
}
#endif
#endif

37
include/ee/libspu2m.h Normal file
View File

@ -0,0 +1,37 @@
/* SCE CONFIDENTIAL
"PlayStation 2" Programmer Tool Runtime Library Release 2.5
*/
/*
* Emotion Engine Library
*
* Copyright (C) 2001 Sony Computer Entertainment Inc.
* All Rights Reserved.
*
* libspu2m.h
* SPU2 local memory manager
*/
#ifndef _SPU2_MEMORY_ALLOCATE_H_
#define _SPU2_MEMORY_ALLOCATE_H_
#define SCESPU2MEM_TABLE_UNITSIZE 12
#define SCESPU2MEM_NO_EFFECT 1
#define SCESPU2MEM_USE_EFFECT 0
#if defined(_LANGUAGE_C_PLUS_PLUS)||defined(__cplusplus)||defined(c_plusplus)
extern "C" {
#endif
extern int sceSpu2MemInit (void *, unsigned int, unsigned int);
extern int sceSpu2MemQuit (void);
extern int sceSpu2MemAllocate (unsigned int);
extern void sceSpu2MemFree (unsigned int);
#if defined(_LANGUAGE_C_PLUS_PLUS)||defined(__cplusplus)||defined(c_plusplus)
}
#endif
#endif /* _SPU2_MEMORY_ALLOCATE_H_ */
/* This file ends here, DON'T ADD STUFF AFTER THIS */

103
include/ee/libssyn.h Normal file
View File

@ -0,0 +1,103 @@
/* SCE CONFIDENTIAL
"PlayStation 2" Programmer Tool Runtime Library Release 2.5
*/
/*
* Emotion Engine Library
* Version 0.60
* Shift-JIS
*
* Copyright (C) 1998,1999,2000,2002 Sony Computer Entertainment Inc.
* All Rights Reserved.
*
* libssyn - libssyn.h
* EE Software Synthesizer
*
* Version Date Design Log
* --------------------------------------------------------------------
* 0.60 Oct.12.1999 katayama first checked in.
*/
#ifndef _libssyn_h_
#define _libssyn_h_
#define sceSSynNoError 0
#define sceSSynError -1
#define sceSSynMaxOutput 8
#define sceSSynMaxInput 8
#define sceSynthesizerChOutNum 4
#define sceSSynVoiceBufferSize 576
#define sceSSynInputBufferSize 13952
typedef struct {
unsigned int unit_samples;
unsigned int sampling_frequency;
unsigned int n_voices;
void *voice_buffer;
unsigned int voice_buffer_size;
unsigned int n_input_port;
void *input_port_buffer;
unsigned int input_port_buffer_size;
} sceSSynConf;
#define sceSSynEnvSize 28
typedef struct {
unsigned int input_buff_len;
void *input_buff;
void *tone_param;
unsigned int (*msg_callback)(unsigned int,unsigned int);
unsigned int msg_callback_private_data;
unsigned int (*exc_callback)(unsigned int,unsigned char*,unsigned int,
unsigned char*,unsigned int);
unsigned int exc_callback_private_data;
unsigned int system[(sceSSynEnvSize+sizeof(int)-1)/sizeof(int)];
} sceSSynEnv;
#if defined(_LANGUAGE_C_PLUS_PLUS)||defined(__cplusplus)||defined(c_plusplus)
extern "C" {
#endif
int sceSSyn_Init(sceCslCtx *pCtx, unsigned int interval );
int sceSSyn_ATick(sceCslCtx*);
int sceSSyn_Load(sceCslCtx*,unsigned int,void*);
int sceSSyn_RegisterRpc(sceCslCtx*,int);
int sceSSyn_PrepareParameter(void*,unsigned int);
#define SSYN_VOLUME_0DB 0x10000
int sceSSyn_SetMasterVolume(sceCslCtx*,unsigned int);
int sceSSyn_SetOutPortVolume(sceCslCtx*,unsigned int,unsigned int);
typedef struct {
unsigned char ch;
unsigned char ch_output;
#define sceSSynMuteOut 0
#define sceSSynMonoOut 1
#define sceSSynLOut 2
#define sceSSynROut 3
unsigned char mode;
unsigned char output_line;
unsigned int att;
} sceSSynChOutAttrib;
int sceSSyn_SetOutputAssign(sceCslCtx*,unsigned int,sceSSynChOutAttrib*);
int sceSSyn_SetPortVolume(sceCslCtx*,unsigned int,unsigned int);
int sceSSyn_SendShortMsg(sceCslCtx*,unsigned int,unsigned int);
int sceSSyn_SendExcMsg(sceCslCtx*,unsigned int,unsigned char*,unsigned int);
typedef struct {
unsigned char ch;
unsigned short num;
unsigned short data;
} sceSSynRpnMsg;
typedef sceSSynRpnMsg sceSSynNrpnMsg;
int sceSSyn_SendRpnMsg(sceCslCtx*,unsigned int,sceSSynRpnMsg*);
int sceSSyn_SendNrpnMsg(sceCslCtx*,unsigned int,sceSSynNrpnMsg*);
int sceSSyn_SetChPriority(sceCslCtx*,unsigned int,unsigned int,unsigned char);
int sceSSyn_SetPortMaxPoly(sceCslCtx*,unsigned int,unsigned char);
int sceSSyn_ClearBreakAtick(sceCslCtx*);
int sceSSyn_BreakAtick(sceCslCtx*);
#define sceSSynOutputMode_Mono 0
#define sceSSynOutputMode_Stereo 1
int sceSSyn_SetOutputMode(int);
#define sceSSynTvaEnvMode_Fixed 0
#define sceSSynTvaEnvMode_ChangeByLevel 1
int sceSSyn_SetTvaEnvMode(int);
#if defined(_LANGUAGE_C_PLUS_PLUS)||defined(__cplusplus)||defined(c_plusplus)
}
#endif
#endif //!_libssyn_h_
/* $Id: libssyn.h,v 1.7.2.1 2002/02/19 09:17:15 xokano Exp $ */

261
include/ee/libusbkb.h Normal file
View File

@ -0,0 +1,261 @@
#ifndef INCLUDE_LIBUSBKB_H
#define INCLUDE_LIBUSBKB_H
/* SCE CONFIDENTIAL
"PlayStation 2" Programmer Tool Runtime Library Release 2.5.3
*/
/*
* USB Keyboard Library (for EE)
*
* Version 1.20
* Shift-JIS
*
* Copyright (C) 2000-2001 Sony Computer Entertainment Inc.
* All Rights Reserved.
*
* libusbkb.h
*
* Version Date Design Log
* --------------------------------------------------------------------
* 0.10 Dec,11,2000 fukunaga USB Keyboard Library
* 1.00 Feb,5,2001 fukunaga First release version
* 1.01 Mar,29,2001 fukunaga Bug fix (Ring buffer)
* 1.10 Apr,9,2001 fukunaga sceUsbKbSetReadMode()
* 1.20 June,21,2001 fukunaga sceUsbKbClearRbuf()
*
*/
#ifdef __cplusplus
extern "C" {
#endif
#ifndef _eetypes_h_
#include <sys/types.h>
#endif
/*----- Structure -----*/
#define USBKB_MAX_STATUS 127
typedef struct {
int max_connect;
int now_connect;
u_char status[USBKB_MAX_STATUS];
} USBKBINFO_t;
#define USBKB_MAX_KEYCODES 62
typedef struct {
u_int led;
u_int mkey;
int len;
u_short keycode[USBKB_MAX_KEYCODES];
} USBKBDATA_t;
/*----- MACRO -----*/
#define USBKB_OK 0
#define USBKB_NG (-1)
#define USBKB_E_SIF (-2) /* SIF error */
#define USBKB_E_PAR1 (-11) /* first parameter error */
#define USBKB_E_PAR2 (-12) /* second parameter error */
/* sceUsbKbSync関数 */
#define USBKB_WAIT 0
#define USBKB_NO_WAIT 1
#define USBKB_DONE 0
#define USBKB_EXEC 1
/* USBKBDATA_t の led で使用 */
#define USBKB_LED_NUM_LOCK (1U<<0) /* 0:OFF 1:ON */
#define USBKB_LED_CAPS_LOCK (1U<<1) /* 0:OFF 1:ON */
#define USBKB_LED_SCROLL_LOCK (1U<<2) /* 0:OFF 1:ON */
#define USBKB_LED_COMPOSE (1U<<3) /* 0:OFF 1:ON */
#define USBKB_LED_KANA (1U<<4) /* 0:OFF 1:ON */
/* USBKBDATA_t の mkey で使用 */
#define USBKB_MKEY_L_CTRL (1U<<0) /* 0:Release 1:Push */
#define USBKB_MKEY_L_SHIFT (1U<<1) /* 0:Release 1:Push */
#define USBKB_MKEY_L_ALT (1U<<2) /* 0:Release 1:Push */
#define USBKB_MKEY_L_WIN (1U<<3) /* 0:Release 1:Push */
#define USBKB_MKEY_R_CTRL (1U<<4) /* 0:Release 1:Push */
#define USBKB_MKEY_R_SHIFT (1U<<5) /* 0:Release 1:Push */
#define USBKB_MKEY_R_ALT (1U<<6) /* 0:Release 1:Push */
#define USBKB_MKEY_R_WIN (1U<<7) /* 0:Release 1:Push */
/*
Macintosh用キーボードの場合ALT WIN
OPTION APPLE
*/
/* sceUsbKbSetLEDMode() で使用するマクロ */
#define USBKB_LED_MODE_MANUAL 0
#define USBKB_LED_MODE_AUTO1 1
#define USBKB_LED_MODE_AUTO2 2
/* sceUsbdKbCodeType() で使用するマクロ */
#define USBKB_CODETYPE_RAW 0
#define USBKB_CODETYPE_ASCII 1
/* sceUsbKbSetArrangement() で使用するマクロ */
#define USBKB_ARRANGEMENT_101 0
#define USBKB_ARRANGEMENT_106 1
#define USBKB_ARRANGEMENT_106_KANA 2
/* sceUsbKbSetReadMode() で使用するマクロ */
#define USBKB_RMODE_INPUTCHAR 0
#define USBKB_RMODE_PACKET 1
/* Keycode flag */
#define USBKB_RAWDAT 0x8000U /* ASCIIコードに変換できないコード */
#define USBKB_KEYPAD 0x4000U /* キーパッドコード */
/* ******* ASCII Code に変換できないキーコード ********/
/*
1 USBKB_RAWDAT
2
*/
#define USBKEYC_NO_EVENT 0x00
#define USBKEYC_E_ROLLOVER 0x01
#define USBKEYC_E_POSTFAIL 0x02
#define USBKEYC_E_UNDEF 0x03
#define USBKEYC_ESCAPE 0x29
#define USBKEYC_106_KANJI 0x35 /* 半角/全角 漢字 */
#define USBKEYC_CAPS_LOCK 0x39
#define USBKEYC_F1 0x3a
#define USBKEYC_F2 0x3b
#define USBKEYC_F3 0x3c
#define USBKEYC_F4 0x3d
#define USBKEYC_F5 0x3e
#define USBKEYC_F6 0x3f
#define USBKEYC_F7 0x40
#define USBKEYC_F8 0x41
#define USBKEYC_F9 0x42
#define USBKEYC_F10 0x43
#define USBKEYC_F11 0x44
#define USBKEYC_F12 0x45
#define USBKEYC_PRINTSCREEN 0x46
#define USBKEYC_SCROLL_LOCK 0x47
#define USBKEYC_PAUSE 0x48
#define USBKEYC_INSERT 0x49
#define USBKEYC_HOME 0x4a
#define USBKEYC_PAGE_UP 0x4b
#define USBKEYC_DELETE 0x4c
#define USBKEYC_END 0x4d
#define USBKEYC_PAGE_DOWN 0x4e
#define USBKEYC_RIGHT_ARROW 0x4f
#define USBKEYC_LEFT_ARROW 0x50
#define USBKEYC_DOWN_ARROW 0x51
#define USBKEYC_UP_ARROW 0x52
#define USBKEYC_NUM_LOCK 0x53
#define USBKEYC_APPLICATION 0x65 /* アプリケーションキー */
#define USBKEYC_KANA 0x88 /* カタカナ/ひらがな/ローマ字 */
#define USBKEYC_HENKAN 0x8a /* 前候補/変換/全候補 */
#define USBKEYC_MUHENKAN 0x8b /* 無変換 */
/* ******* 代表的な生コード *******/
/*
1 使
ASCII Code 使
2
*/
#define USBKEYC_A 0x04
#define USBKEYC_B 0x05
#define USBKEYC_C 0x06
#define USBKEYC_D 0x07
#define USBKEYC_E 0x08
#define USBKEYC_F 0x09
#define USBKEYC_G 0x0A
#define USBKEYC_H 0x0B
#define USBKEYC_I 0x0C
#define USBKEYC_J 0x0D
#define USBKEYC_K 0x0E
#define USBKEYC_L 0x0F
#define USBKEYC_M 0x10
#define USBKEYC_N 0x11
#define USBKEYC_O 0x12
#define USBKEYC_P 0x13
#define USBKEYC_Q 0x14
#define USBKEYC_R 0x15
#define USBKEYC_S 0x16
#define USBKEYC_T 0x17
#define USBKEYC_U 0x18
#define USBKEYC_V 0x19
#define USBKEYC_W 0x1A
#define USBKEYC_X 0x1B
#define USBKEYC_Y 0x1C
#define USBKEYC_Z 0x1D
#define USBKEYC_1 0x1E
#define USBKEYC_2 0x1F
#define USBKEYC_3 0x20
#define USBKEYC_4 0x21
#define USBKEYC_5 0x22
#define USBKEYC_6 0x23
#define USBKEYC_7 0x24
#define USBKEYC_8 0x25
#define USBKEYC_9 0x26
#define USBKEYC_0 0x27
#define USBKEYC_ENTER 0x28
#define USBKEYC_ESC 0x29
#define USBKEYC_BS 0x2A
#define USBKEYC_TAB 0x2B
#define USBKEYC_SPACE 0x2C
#define USBKEYC_MINUS 0x2D
#define USBKEYC_EQUAL_101 0x2E /* = and + */
#define USBKEYC_ACCENT_CIRCONFLEX_106 0x2E /* ^ and ‾ */
#define USBKEYC_LEFT_BRACKET_101 0x2F /* [ */
#define USBKEYC_ATMARK_106 0x2F /* @ */
#define USBKEYC_RIGHT_BRACKET_101 0x30 /* ] */
#define USBKEYC_LEFT_BRACKET_106 0x30 /* [ */
#define USBKEYC_BACKSLASH_101 0x31 /* \ and | */
#define USBKEYC_RIGHT_BRACKET_106 0x32 /* ] */
#define USBKEYC_SEMICOLON 0x33 /* ; */
#define USBKEYC_QUOTATION_101 0x34 /* ' and " */
#define USBKEYC_COLON_106 0x34 /* : and * */
#define USBKEYC_COMMA 0x36
#define USBKEYC_PERIOD 0x37
#define USBKEYC_SLASH 0x38
#define USBKEYC_CAPS_LOCK 0x39
#define USBKEYC_KPAD_NUMLOCK 0x53
#define USBKEYC_KPAD_SLASH 0x54
#define USBKEYC_KPAD_ASTERISK 0x55
#define USBKEYC_KPAD_MINUS 0x56
#define USBKEYC_KPAD_PLUS 0x57
#define USBKEYC_KPAD_ENTER 0x58
#define USBKEYC_KPAD_1 0x59
#define USBKEYC_KPAD_2 0x5A
#define USBKEYC_KPAD_3 0x5B
#define USBKEYC_KPAD_4 0x5C
#define USBKEYC_KPAD_5 0x5D
#define USBKEYC_KPAD_6 0x5E
#define USBKEYC_KPAD_7 0x5F
#define USBKEYC_KPAD_8 0x60
#define USBKEYC_KPAD_9 0x61
#define USBKEYC_KPAD_0 0x62
#define USBKEYC_KPAD_PERIOD 0x63
#define USBKEYC_BACKSLASH_106 0x87
#define USBKEYC_YEN_106 0x89
/*----- Prototype -----*/
extern int sceUsbKbInit(int *max_connect);
extern int sceUsbKbEnd(void);
extern int sceUsbKbGetInfo(USBKBINFO_t *info);
extern int sceUsbKbRead(u_int no,USBKBDATA_t *data);
extern int sceUsbKbGetLocation(int no,u_char *location);
extern int sceUsbKbSetLEDStatus(int no, u_char led);
extern int sceUsbKbSetLEDMode(int no, int mode);
extern int sceUsbKbSetRepeat(int no, int sta_time, int interval);
extern int sceUsbKbSetCodeType(int no, int type);
extern int sceUsbKbSetArrangement(int no, int arrange);
extern int sceUsbKbSync(int mode, int *result);
extern u_short sceUsbKbCnvRawCode(int arrange, u_int mkey, u_int led, u_short rawcode);
extern int sceUsbKbSetReadMode(int no, int rmode);
extern int sceUsbKbClearRbuf(u_int no);
#ifdef __cplusplus
}
#endif
#endif

33
include/ee/libvib.h Normal file
View File

@ -0,0 +1,33 @@
/* SCE CONFIDENTIAL
"PlayStation 2" Programmer Tool Runtime Library Release 2.5
*/
/*
* Controller Vibration Library
* Version 2.01
* Shift-JIS
*
* Copyright (C) 2001 Sony Computer Entertainment Inc.
* All Rights Reserved.
*
* libvib - libvib.h
* header file of libvib
*
* Version Date Design Log
* --------------------------------------------------------------------
* 2.01 2001-03-09 nozomu the first version
*
*/
#ifndef _LIBVIB_H_
#define _LIBVIB_H_
#if defined(__LANGUAGE_C_PLUS_PLUS)||defined(__cplusplus)||defined(c_plusplus)
extern "C" {
#endif
int sceVibGetProfile( int, unsigned char* );
int sceVibSetActParam( int, int, unsigned char*, int, unsigned char* );
#if defined(__LANGUAGE_C_PLUS_PLUS)||defined(__cplusplus)||defined(c_plusplus)
}
#endif
#endif /* _LIBVIB_H_ */

167
include/ee/libvifpk.h Normal file
View File

@ -0,0 +1,167 @@
/* SCE CONFIDENTIAL
"PlayStation 2" Programmer Tool Runtime Library Release 2.5
*/
/*
* Emotion Engine Library
* Version 0.01
* Shift-JIS
*
* Copyright (C) 1998-1999 Sony Computer Entertainment Inc.
* All Rights Reserved.
*
* libpkt - libvifpk.h
* vif packet support
*
* Version Date Design Log
* --------------------------------------------------------------------
* 0.01 Mar,26,1999 shibuya
*/
#ifndef __libvifpk__
#define __libvifpk__
#include <eekernel.h>
#include <eestruct.h>
#ifdef __cplusplus
extern "C" {
#endif
typedef struct{
u_int *pCurrent;
u_long128 *pBase;
u_long128 *pDmaTag;
u_int *pVifCode;
u_int numlen;
u_int pad11;
u_int pad12;
u_int pad13;
}sceVif0Packet;
typedef struct{
u_int *pCurrent;
u_long128 *pBase;
u_long128 *pDmaTag;
u_int *pVifCode;
u_int numlen;
u_long *pGifTag;
u_int pad12;
u_int pad13;
}sceVif1Packet;
/*------------------------------------------------------------------*/
void sceVif0PkInit(sceVif0Packet *pPacket, u_long128 *pBase);
void sceVif0PkReset(sceVif0Packet *pPacket);
u_long128 *sceVif0PkTerminate(sceVif0Packet *pPacket);
u_int sceVif0PkSize(sceVif0Packet *pPacket);
void sceVif0PkCnt(sceVif0Packet *pPacket, u_int flag);
void sceVif0PkRet(sceVif0Packet *pPacket, u_int flag);
void sceVif0PkEnd(sceVif0Packet *pPacket, u_int flag);
void sceVif0PkNext(sceVif0Packet *pPacket, u_long128 *pNext, u_int flag);
void sceVif0PkCall(sceVif0Packet *pPacket, u_long128 *pCall, u_int flag);
void sceVif0PkRefe(sceVif0Packet *pPacket, u_long128 *pRef, u_int size, u_int opt1, u_int opt2, u_int flag);
void sceVif0PkRef(sceVif0Packet *pPacket, u_long128 *pRef, u_int size, u_int opt1, u_int opt2, u_int flag);
void sceVif0PkRefs(sceVif0Packet *pPacket, u_long128 *pRef, u_int size, u_int opt1, u_int opt2, u_int flag);
void sceVif0PkOpenUpkCode(sceVif0Packet *pPacket, u_short vuaddr, u_int upkcmd, u_int cl, u_int wl);
void sceVif0PkCloseUpkCode(sceVif0Packet *pPacket);
u_int *sceVif0PkReserve(sceVif0Packet *pPacket, u_int count);
void sceVif0PkAddCode(sceVif0Packet *pPacket, u_int code);
void sceVif0PkAddData(sceVif0Packet *pPacket, u_int data);
void sceVif0PkAddDataN(sceVif0Packet *pPacket, u_int* pData, u_int count);
void sceVif0PkAddUpkData32(sceVif0Packet *pPacket, u_int data);
void sceVif0PkAddUpkData64(sceVif0Packet *pPacket, u_long data);
void sceVif0PkAddUpkData128(sceVif0Packet *pPacket, u_long128 data);
void sceVif0PkAddUpkData32N(sceVif0Packet *pPacket, u_int *pData, u_int count);
void sceVif0PkAddUpkData64N(sceVif0Packet *pPacket, u_long *pData, u_int count);
void sceVif0PkAddUpkData128N(sceVif0Packet *pPacket, u_long128 *pData, u_int count);
void sceVif0PkAlign(sceVif0Packet *pPacket, u_int bit, u_int pos);
void sceVif0PkRefMpg(sceVif0Packet *pPacket, u_short vuaddr, u_long128 *pMicro, u_int size, u_int opt1);
void sceVif0PkDump(sceVif0Packet *pPacket);
/*------------------------------------------------------------------*/
void sceVif1PkInit(sceVif1Packet *pPacket, u_long128 *pBase);
void sceVif1PkReset(sceVif1Packet *pPacket);
u_long128 *sceVif1PkTerminate(sceVif1Packet *pPacket);
u_int sceVif1PkSize(sceVif1Packet *pPacket);
void sceVif1PkCnt(sceVif1Packet *pPacket, u_int flag);
void sceVif1PkRet(sceVif1Packet *pPacket, u_int flag);
void sceVif1PkEnd(sceVif1Packet *pPacket, u_int flag);
void sceVif1PkNext(sceVif1Packet *pPacket, u_long128 *pNext, u_int flag);
void sceVif1PkCall(sceVif1Packet *pPacket, u_long128 *pCall, u_int flag);
void sceVif1PkRefe(sceVif1Packet *pPacket, u_long128 *pRef, u_int size, u_int opt1, u_int opt2, u_int flag);
void sceVif1PkRef(sceVif1Packet *pPacket, u_long128 *pRef, u_int size, u_int opt1, u_int opt2, u_int flag);
void sceVif1PkRefs(sceVif1Packet *pPacket, u_long128 *pRef, u_int size, u_int opt1, u_int opt2, u_int flag);
void sceVif1PkOpenUpkCode(sceVif1Packet *pPacket, u_short vuaddr, u_int upkcmd, u_int cl, u_int wl);
void sceVif1PkCloseUpkCode(sceVif1Packet *pPacket);
void sceVif1PkOpenDirectCode(sceVif1Packet *pPacket, int stall);
void sceVif1PkCloseDirectCode(sceVif1Packet *pPacket);
void sceVif1PkOpenDirectHLCode(sceVif1Packet *pPacket, int stall);
void sceVif1PkCloseDirectHLCode(sceVif1Packet *pPacket);
void sceVif1PkOpenGifTag(sceVif1Packet *pPacket, u_long128 gifTag);
void sceVif1PkCloseGifTag(sceVif1Packet *pPacket);
u_int *sceVif1PkReserve(sceVif1Packet *pPacket, u_int count);
void sceVif1PkAlign(sceVif1Packet *pPacket, u_int bit, u_int pos);
void sceVif1PkAddCode(sceVif1Packet *pPacket, u_int code);
void sceVif1PkAddData(sceVif1Packet *pPacket, u_int data);
void sceVif1PkAddDataN(sceVif1Packet *pPacket, u_int *pData, u_int count);
void sceVif1PkAddUpkData32(sceVif1Packet *pPacket, u_int data);
void sceVif1PkAddUpkData64(sceVif1Packet *pPacket, u_long data);
void sceVif1PkAddUpkData128(sceVif1Packet *pPacket, u_long128 data);
void sceVif1PkAddUpkData32N(sceVif1Packet *pPacket, u_int *pData, u_int count);
void sceVif1PkAddUpkData64N(sceVif1Packet *pPacket, u_long *pData, u_int count);
void sceVif1PkAddUpkData128N(sceVif1Packet *pPacket, u_long128 *pData, u_int count);
void sceVif1PkAddDirectData(sceVif1Packet *pPacket, u_long128 data);
void sceVif1PkAddDirectDataN(sceVif1Packet *pPacket, u_long128* pData, u_int count);
void sceVif1PkAddGsData(sceVif1Packet *pPacket, u_long data);
void sceVif1PkAddGsDataN(sceVif1Packet *pPacket, u_long *pData, u_int count);
void sceVif1PkAddGsPacked(sceVif1Packet* pPacket, u_long128 data);
void sceVif1PkAddGsPackedN(sceVif1Packet* pPacket, u_long128* pData, u_int count);
void sceVif1PkAddGsAD(sceVif1Packet *pPacket, u_int addr, u_long data);
void sceVif1PkRefLoadImage(sceVif1Packet *pPacket, u_short bp, u_char psm, u_short bw, u_long128 *image, u_int size, u_int x, u_int y, u_int w, u_int h);
void sceVif1PkRefMpg(sceVif1Packet *pPacket, u_short vuaddr, u_long128 *pMicro, u_int size, u_int opt1);
void sceVif1PkDump(sceVif1Packet *pPacket);
#ifdef __cplusplus
}
#endif
#endif /* __libvifpk__ */

85
include/ee/libvu0.h Normal file
View File

@ -0,0 +1,85 @@
/* SCE CONFIDENTIAL
"PlayStation 2" Programmer Tool Runtime Library Release 2.5
*/
/*
* Emotion Engine Library
* Version 0.10
* Shift-JIS
*
* Copyright (C) 1998-1999 Sony Computer Entertainment Inc.
* All Rights Reserved.
*
* libvu0 - libvu0.h
* Header File for VU0 Macro Code Library
*
* Version Date Design Log
* --------------------------------------------------------------------
* 0.10 Mar,25,1999 shino
*/
#ifndef _LIB_VU0_H_
#define _LIB_VU0_H_
#include "eetypes.h"
#ifdef __cplusplus
extern "C" {
#endif
// basic type
typedef int qword[4] __attribute__ ((aligned(16)));
typedef int sceVu0IVECTOR[4] __attribute__((aligned (16)));
typedef float sceVu0FVECTOR[4] __attribute__((aligned (16)));
typedef float sceVu0FMATRIX[4][4] __attribute__((aligned (16)));
// prototypes
void sceVu0CopyVector(sceVu0FVECTOR v0, sceVu0FVECTOR v1);
void sceVu0CopyVectorXYZ(sceVu0FVECTOR v0, sceVu0FVECTOR v1);
void sceVu0FTOI0Vector(sceVu0IVECTOR v0, sceVu0FVECTOR v1);
void sceVu0FTOI4Vector(sceVu0IVECTOR v0, sceVu0FVECTOR v1);
void sceVu0ITOF0Vector(sceVu0FVECTOR v0, sceVu0IVECTOR v1);
void sceVu0ITOF4Vector(sceVu0FVECTOR v0, sceVu0IVECTOR v1);
void sceVu0ScaleVector(sceVu0FVECTOR v0, sceVu0FVECTOR v1, float s);
void sceVu0ScaleVectorXYZ(sceVu0FVECTOR v0, sceVu0FVECTOR v1, float s);
void sceVu0AddVector(sceVu0FVECTOR v0, sceVu0FVECTOR v1, sceVu0FVECTOR v2);
void sceVu0SubVector(sceVu0FVECTOR v0, sceVu0FVECTOR v1, sceVu0FVECTOR v2);
void sceVu0MulVector(sceVu0FVECTOR v0, sceVu0FVECTOR v1, sceVu0FVECTOR v2);
void sceVu0InterVector(sceVu0FVECTOR v0, sceVu0FVECTOR v1, sceVu0FVECTOR v2, float r);
void sceVu0InterVectorXYZ(sceVu0FVECTOR v0, sceVu0FVECTOR v1, sceVu0FVECTOR v2, float r);
void sceVu0DivVector(sceVu0FVECTOR v0, sceVu0FVECTOR v1, float q);
void sceVu0DivVectorXYZ(sceVu0FVECTOR v0, sceVu0FVECTOR v1, float q);
float sceVu0InnerProduct(sceVu0FVECTOR v0, sceVu0FVECTOR v1);
void sceVu0OuterProduct(sceVu0FVECTOR v0, sceVu0FVECTOR v1, sceVu0FVECTOR v2);
void sceVu0Normalize(sceVu0FVECTOR v0, sceVu0FVECTOR v1);
void sceVu0ApplyMatrix(sceVu0FVECTOR v0, sceVu0FMATRIX m, sceVu0FVECTOR v1);
void sceVu0UnitMatrix(sceVu0FMATRIX m);
void sceVu0CopyMatrix(sceVu0FMATRIX m0, sceVu0FMATRIX m1);
void sceVu0TransposeMatrix(sceVu0FMATRIX m0, sceVu0FMATRIX m1);
void sceVu0MulMatrix(sceVu0FMATRIX m0, sceVu0FMATRIX m1, sceVu0FMATRIX m2);
void sceVu0InversMatrix(sceVu0FMATRIX m0, sceVu0FMATRIX m1);
void sceVu0RotMatrixX(sceVu0FMATRIX m0, sceVu0FMATRIX m1, float rx);
void sceVu0RotMatrixY(sceVu0FMATRIX m0, sceVu0FMATRIX m1, float ry);
void sceVu0RotMatrixZ(sceVu0FMATRIX m0, sceVu0FMATRIX m1, float rz);
void sceVu0RotMatrix(sceVu0FMATRIX m0, sceVu0FMATRIX m1, sceVu0FVECTOR rot);
void sceVu0TransMatrix(sceVu0FMATRIX m0, sceVu0FMATRIX m1, sceVu0FVECTOR tv);
void sceVu0CameraMatrix(sceVu0FMATRIX m, sceVu0FVECTOR p, sceVu0FVECTOR zd, sceVu0FVECTOR yd);
void sceVu0NormalLightMatrix(sceVu0FMATRIX m, sceVu0FVECTOR l0, sceVu0FVECTOR l1, sceVu0FVECTOR l2);
void sceVu0LightColorMatrix(sceVu0FMATRIX m, sceVu0FVECTOR c0,
sceVu0FVECTOR c1, sceVu0FVECTOR c2, sceVu0FVECTOR a);
void sceVu0ViewScreenMatrix(sceVu0FMATRIX m, float scrz, float ax, float ay,
float cx, float cy, float zmin, float zmax, float nearz, float farz);
void sceVu0DropShadowMatrix(sceVu0FMATRIX m,
sceVu0FVECTOR lp, float a, float b, float c, int mode);
int sceVu0ClipAll(sceVu0FVECTOR minv, sceVu0FVECTOR maxv, sceVu0FMATRIX ms, sceVu0FVECTOR *vm, int n);
void sceVu0ClampVector(sceVu0FVECTOR v0, sceVu0FVECTOR v1, float min, float max);
int sceVu0ClipScreen(sceVu0FVECTOR v0);
int sceVu0ClipScreen3(sceVu0FVECTOR v0, sceVu0FVECTOR v1, sceVu0FVECTOR v2);
void sceVu0RotTransPersN(sceVu0IVECTOR *v0, sceVu0FMATRIX m0, sceVu0FVECTOR *v1, int n, int mode);
void sceVu0RotTransPers(sceVu0IVECTOR v0, sceVu0FMATRIX m0, sceVu0FVECTOR v1, int mode);
void sceVpu0Reset(void);
#ifdef __cplusplus
}
#endif
#endif /* _LIB_VU0_H_ */

45
include/ee/netglue.h Normal file
View File

@ -0,0 +1,45 @@
/* SCE CONFIDENTIAL
"PlayStation 2" Programmer Tool Runtime Library Release 2.5.3
*/
/*
* Emotion Engine Library
* Version 1.00
* Shift-JIS
*
* Copyright (C) 2002 Sony Computer Entertainment Inc.
* All Rights Reserved.
*
* <netglue - netglue.h>
* <glue library header for protocol stack >
*
* Version Date Design Log
* --------------------------------------------------------------------
* 1.00 Sep,21,2001 komaki first version
* 1.10 Jan,29,2002 komaki move errno function
* inside extern "C"{}
*/
#include <netglue/netdb.h>
#include <netglue/sys/socket.h>
#include <netglue/netinet/in.h>
#include <netglue/netinet/tcp.h>
#include <netglue/arpa/inet.h>
#ifdef __cplusplus
extern "C" {
#endif
int *__sceNetGlueErrnoLoc(void);
int *__sceNetGlueHErrnoLoc(void);
#define sceNetGlueErrno (*__sceNetGlueErrnoLoc())
#define sceNetGlueHErrno (*__sceNetGlueHErrnoLoc())
int sceNetGlueAbort(int sockfd);
int sceNetGlueThreadInit(int thread_id);
int sceNetGlueThreadTerminate(int thread_id);
#ifdef __cplusplus
}
#endif

267
include/ee/ntguicnf.h Normal file
View File

@ -0,0 +1,267 @@
/* SCE CONFIDENTIAL
* "PlayStation 2" Programmer Tool Runtime Library NTGUI package (Release 2.5 version)
*/
/*
* GUI Network Setting Application Library
*
* Version 1.3
*
* Copyright (C) 2001 Sony Computer Entertainment Inc.
* All Rights Reserved.
*
* ntguicnf.h
*
* Version Date Design Log
* --------------------------------------------------------------------
* 1.1 2001.05.25 tetsu Beta Release
* 1.2 2001.07.19 tetsu Fist Ver. Release
* 1.3 2001.11.28 tetsu add sceNetCnfSelected
*/
#ifndef __sceNetGuiCnf_H_
#define __sceNetGuiCnf_H_
#ifdef __cplusplus
extern "C" {
#endif
#include <stdio.h>
#include <stdlib.h>
#define SCE_NETGUICNF_STR_SIZE (256)
/* マウスの動作ポイント */
enum
{
SCE_NETGUICNF_MOUSE_MESSAGE_TYPE__PRESS = 0,
SCE_NETGUICNF_MOUSE_MESSAGE_TYPE__RELEASE,
SCE_NETGUICNF_MOUSE_MESSAGE_TYPE__MOVE,
};
/* ソフトウェアキーボードのキー状態設定タイプ */
enum
{
SCE_NETGUICNF_ENABLE_KEY_TYPE_ENABLE_LISTED_AND_DISABLE_NOTLISTED = 0,
SCE_NETGUICNF_ENABLE_KEY_TYPE_ENABLE_ALL,
SCE_NETGUICNF_ENABLE_KEY_TYPE_DISABLE_LISTED,
};
/* マウスのボタン状態 */
enum
{
SCE_NETGUICNF_MOUSE_BUTTON_LEFT = 1<<0,
SCE_NETGUICNF_MOUSE_BUTTON_RIGHT = 1<<1,
SCE_NETGUICNF_MOUSE_BUTTON_MIDDLE = 1<<2,
};
/* 起動オプション */
enum
{
SCE_NETGUICNF_FLAG_USE_HDD = 1<<0,
SCE_NETGUICNF_FLAG_USE_USB_MOUSE = 1<<1,
SCE_NETGUICNF_FLAG_USE_USB_KB = 1<<2,
SCE_NETGUICNF_FLAG_USE_SELECT_OPTION = 1<<3,
SCE_NETGUICNF_FLAG_SELECT_ONLY = 1<<4,
SCE_NETGUICNF_FLAG_MC_SLOT1_ONLY = 1<<5,
};
/* dialing_type */
enum
{
SCE_NETGUICNF_DIALINGTYPE_TONE = 0,
SCE_NETGUICNF_DIALINGTYPE_PULSE,
};
/* phy_config */
enum
{
SCE_NETGUICNF_PHYCONFIG_AUTO = 1,
SCE_NETGUICNF_PHYCONFIG_10 = 2,
SCE_NETGUICNF_PHYCONFIG_10_FD = 3,
SCE_NETGUICNF_PHYCONFIG_TX = 5,
SCE_NETGUICNF_PHYCONFIG_TX_FD = 6,
};
/* dhcp */
enum
{
SCE_NETGUICNF_NOUSE_DHCP = 0,
SCE_NETGUICNF_USE_DHCP,
};
/* pppoe */
enum
{
SCE_NETGUICNF_NOUSE_PPPOE = 0,
SCE_NETGUICNF_USE_PPPOE,
};
/* type */
enum
{
SCE_NETGUICNF_TYPE_ETH = 1,
SCE_NETGUICNF_TYPE_PPP,
SCE_NETGUICNF_TYPE_NIC,
};
typedef void * (*sceNetGuiCnfCallback_Malloc)( size_t size );
typedef void * (*sceNetGuiCnfCallback_Memalign)( size_t align, size_t size );
typedef void * (*sceNetGuiCnfCallback_Realloc)( void * old_ptr, size_t new_size );
typedef void (*sceNetGuiCnfCallback_Free)( void * ptr );
typedef void (*sceNetGuiCnfCallback_SKBInit)(void);
typedef void (*sceNetGuiCnfCallback_SKBDestroy)(void);
typedef void * (*sceNetGuiCnfCallback_SKBGetVif1PktTopAddr)(void);
typedef void (*sceNetGuiCnfCallback_SKBGetStatus)( int * w, int * h );
typedef int (*sceNetGuiCnfCallback_SKBSendMouseMessage)( int type, int x, int y );
typedef void (*sceNetGuiCnfCallback_SKBEnableKey)( int type, unsigned char * keynames[], int keynames_size );
typedef void (*sceNetGuiCnfCallback_SKBEveryFrame)(void);
typedef void (*sceNetGuiCnfCallback_SJIStoUTF8 )( unsigned char * dst, size_t dst_size, unsigned char const* src );
typedef void (*sceNetGuiCnfCallback_UTF8toSJIS )( unsigned char * dst, size_t dst_size, unsigned char const* src );
typedef void (*sceNetGuiCnfCallback_UsbMouseRead )( int * delta_x, int * delta_y, int * buttons, int * wheel );
typedef void (*sceNetGuiCnfCallback_UsbKbRead )(void);
typedef void (*sceNetGuiCnfCallback_PadRead )( unsigned int * paddata );
typedef struct sceNetGuiCnf_Color {
unsigned char r;
unsigned char g;
unsigned char b;
unsigned char a;
} sceNetGuiCnf_Color_t;
typedef struct sceNetGuiCnf_Color4 {
sceNetGuiCnf_Color_t aColor[4];
} sceNetGuiCnf_Color4_t;
typedef struct sceNetGuiCnfEnvData {
char attach_ifc[SCE_NETGUICNF_STR_SIZE]; /* (0x0100) */
char attach_dev[SCE_NETGUICNF_STR_SIZE]; /* (0x0200) */
char address[SCE_NETGUICNF_STR_SIZE]; /* (0x0300) */
char netmask[SCE_NETGUICNF_STR_SIZE]; /* (0x0400) */
char gateway[SCE_NETGUICNF_STR_SIZE]; /* (0x0500) */
char dns1_address[SCE_NETGUICNF_STR_SIZE]; /* (0x0600) */
char dns2_address[SCE_NETGUICNF_STR_SIZE]; /* (0x0700) */
char phone_numbers1[SCE_NETGUICNF_STR_SIZE]; /* (0x0800) */
char phone_numbers2[SCE_NETGUICNF_STR_SIZE]; /* (0x0900) */
char phone_numbers3[SCE_NETGUICNF_STR_SIZE]; /* (0x0a00) */
char auth_name[SCE_NETGUICNF_STR_SIZE]; /* (0x0b00) */
char auth_key[SCE_NETGUICNF_STR_SIZE]; /* (0x0c00) */
char vendor[SCE_NETGUICNF_STR_SIZE]; /* (0x0d00) */
char product[SCE_NETGUICNF_STR_SIZE]; /* (0x0e00) */
char chat_additional[SCE_NETGUICNF_STR_SIZE]; /* (0x0f00) */
char outside_number[SCE_NETGUICNF_STR_SIZE]; /* (0x1000) */
char outside_delay[SCE_NETGUICNF_STR_SIZE]; /* (0x1100) */
char dhcp_host_name[SCE_NETGUICNF_STR_SIZE]; /* (0x1200) */
char peer_name[SCE_NETGUICNF_STR_SIZE]; /* (0x1300) */
int dialing_type; /* (0x1304) */
int type; /* (0x1308) */
int phy_config; /* (0x130c) */
int idle_timeout; /* (0x1310) */
unsigned char dhcp; /* (0x1311) */
unsigned char dns1_nego; /* (0x1312) */
unsigned char dns2_nego; /* (0x1313) */
unsigned char f_auth; /* (0x1314) */
unsigned char auth; /* (0x1315) */
unsigned char pppoe; /* (0x1316) */
unsigned char prc_nego; /* (0x1317) */
unsigned char acc_nego; /* (0x1318) */
unsigned char accm_nego; /* (0x1319) */
unsigned char p0; /* (0x131a) */
unsigned char p1; /* (0x131b) */
unsigned char p2; /* (0x131c) */
int mtu; /* (0x1320) */
} sceNetGuiCnfEnvData_t;
/* select_device */
enum
{
SCE_NETGUICNF_SELECT_DEVICE_NO_DEVICE,
SCE_NETGUICNF_SELECT_DEVICE_MC0,
SCE_NETGUICNF_SELECT_DEVICE_MC1,
SCE_NETGUICNF_SELECT_DEVICE_HDD,
};
typedef struct sceNetGuiCnfSelected {
char select_env[SCE_NETGUICNF_STR_SIZE]; /* 選択された組み合わせ */
char select_ifc[SCE_NETGUICNF_STR_SIZE]; /* 選択された接続プロバイダ設定 */
char select_dev[SCE_NETGUICNF_STR_SIZE]; /* 選択された接続機器設定 */
int env_device; /* 選択された組み合わせのデバイス */
int ifc_device; /* 選択された接続プロバイダ設定のデバイス */
int dev_device; /* 選択された接続機器設定のデバイス */
} sceNetGuiCnfSelected_t;
typedef struct sceNetGuiCnf_Arg
{
/* 起動オプション */
int flag;
/* v-blank 開始を待つセマフォ */
int _sema_vsync;
/* 追加時のデフォルトデータへのポインタ */
sceNetGuiCnfEnvData_t *default_env_data;
/* 選択結果を返すバッファへのポインタ */
sceNetGuiCnfEnvData_t *result_env_data;
/* 選択された設定名とそのデバイスを返すバッファへのポインタ */
sceNetGuiCnfSelected_t *selected_configuration;
/* メモリアロケーション コールバック関数ポインタ */
sceNetGuiCnfCallback_Malloc cb_malloc;
sceNetGuiCnfCallback_Memalign cb_memalign;
sceNetGuiCnfCallback_Realloc cb_realloc;
sceNetGuiCnfCallback_Free cb_free;
/* ソフトウェアキーボード コールバック関数ポインタ */
sceNetGuiCnfCallback_SKBInit cb_skb_init;
sceNetGuiCnfCallback_SKBDestroy cb_skb_destroy;
sceNetGuiCnfCallback_SKBGetVif1PktTopAddr cb_skb_getvif1pkttopaddr;
sceNetGuiCnfCallback_SKBGetStatus cb_skb_getstatus;
sceNetGuiCnfCallback_SKBSendMouseMessage cb_skb_sendmousemessage;
sceNetGuiCnfCallback_SKBEnableKey cb_skb_enablekey;
sceNetGuiCnfCallback_SKBEveryFrame cb_skb_everyframe;
/* SJIS <-> UTF8 変換する関数へのポインタ */
sceNetGuiCnfCallback_SJIStoUTF8 cb_sjis_to_utf8;
sceNetGuiCnfCallback_UTF8toSJIS cb_utf8_to_sjis;
/* USBマウスの 入力を受ける関数へのポインタ */
sceNetGuiCnfCallback_UsbMouseRead cb_mouse_read;
/* パッドの 入力を受ける関数へのポインタ */
sceNetGuiCnfCallback_PadRead cb_pad_read;
/* USBキーボードの入力を受ける関数へのポインタ */
sceNetGuiCnfCallback_UsbKbRead cb_kb_read;
/* 背景をファイルからから読み込むためのパス */
char * str_path_bg;
/* 色 */
sceNetGuiCnf_Color4_t color_titlebar;
sceNetGuiCnf_Color4_t color_window;
sceNetGuiCnf_Color4_t color_pagebutton;
sceNetGuiCnf_Color4_t color_msgbox_ok;
sceNetGuiCnf_Color4_t color_msgbox_yesno;
sceNetGuiCnf_Color4_t color_msgbox_warning;
sceNetGuiCnf_Color4_t color_msgbox_wait;
} sceNetGuiCnf_Arg_t;
void sceNetGuiCnf_Do( sceNetGuiCnf_Arg_t * arg );
/* SendKBMessage の 要因 */
enum
{
SCE_NETGUICNF_KBMSG_TYPE_SOFTKB,
SCE_NETGUICNF_KBMSG_TYPE_HARDKB,
};
void sceNetGuiCnf_SendKBMessage( int type, unsigned char * keyname );
#ifdef __cplusplus
}
#endif
#endif //__sceNetGuiCnf_H_

87
include/ee/sif.h Normal file
View File

@ -0,0 +1,87 @@
/* SCE CONFIDENTIAL
"PlayStation 2" Programmer Tool Runtime Library Release 2.5
*/
/*
* Emotion Engine Library
* Version 0.1.0
* Shift-JIS
*
* Copyright (C) 1998-1999 Sony Computer Entertainment Inc.
* All Rights Reserved.
*
* sif.h
* develop library
*
* Version Date Design Log
* --------------------------------------------------------------------
* 0.1.0
*/
#ifndef _SIF_H_DEFS
#define _SIF_H_DEFS
#if defined(_LANGUAGE_C_PLUS_PLUS)||defined(__cplusplus)||defined(c_plusplus)
extern "C" {
#endif
/* flag bit asigned */
#define SIF_INIT (1 << 0)
#define SIF_INIT2 (1 << 1)
#define SIF_CMD_FLG (1 << 17)
#define SIF_DBG_1 (1 << 2)
#define SIF_DBG_2 (1 << 3)
#define SIF_DBG_3 (1 << 4)
/* send direction & mode */
#define SIF_FROM_IO 0x0
#define SIF_TO_IO 0x1
#define SIF_FROM_IOP 0x0
#define SIF_TO_IOP 0x1
#define SIF_FROM_EE 0x0
#define SIF_TO_EE 0x1
#define SIF_DMA_INT 0x2
#define SIF_DMA_INT_I 0x2
#define SIF_DMA_INT_O 0x4
#define SIF_DMA_SPR 0x8
#define SIF_DMA_BSN 0x10
#define SIF_DMA_TAG 0x20
#define SIF_DMA_ERT 0x40
#define SIF_MSCOM 0x1
#define SIF_SMCOM 0x2
#define SIF_MSFLG 0x3
#define SIF_SMFLG 0x4
/* for ELF loader */
extern void sceSifAcceptData(void); /* EE only : System use*/
extern void sceSifInit(void); /* System use */
extern void sceSifSetDChain(void);
extern void isceSifSetDChain(void);
typedef struct {
unsigned int data;
unsigned int addr;
unsigned int size;
unsigned int mode;
} sceSifDmaData;
extern unsigned int sceSifSetDma(sceSifDmaData *sdd, int len);
extern unsigned int isceSifSetDma(sceSifDmaData *sdd, int len);
extern int sceSifDmaStat(unsigned int id);
extern int isceSifDmaStat(unsigned int id);
#if defined(_LANGUAGE_C_PLUS_PLUS)||defined(__cplusplus)||defined(c_plusplus)
}
#endif
#endif /* SIF_H_DEFS */
/* End of File */

105
include/ee/sifcmd.h Normal file
View File

@ -0,0 +1,105 @@
/* SCE CONFIDENTIAL
"PlayStation 2" Programmer Tool Runtime Library Release 2.5
*/
/*
* Emotion Engine Library
* Version 0.1.0
* Shift-JIS
*
* Copyright (C) 1998-1999 Sony Computer Entertainment Inc.
* All Rights Reserved.
*
* sifcmd.h
* develop library
*
* Version Date Design Log
* --------------------------------------------------------------------
* 0.1.0
*/
#ifndef _SIFCMD_H_DEFS
#define _SIFCMD_H_DEFS
#if defined(_LANGUAGE_C_PLUS_PLUS)||defined(__cplusplus)||defined(c_plusplus)
extern "C" {
#endif
#define SIF_CMDI_SYSTEM 0x80000000 /* system func call , not user func*/
/* commnad packet header (128bit) */
typedef struct {
unsigned int psize:8; /* packet size(min 16(hdr only),max 16*7)*/
unsigned int dsize:24;/* attended data size */
unsigned int daddr; /* attended data address */
unsigned int fcode; /* called function code */
unsigned int opt; /* system no use */
} sceSifCmdHdr;
/* commnad packet handler */
typedef void (* sceSifCmdHandler)(void *, void *);
/* structure of command packet handler & data */
typedef struct {
sceSifCmdHandler func;
void *data;
} sceSifCmdData;
/* system function (defalut) */
#define SIF_CMDC_CHANGE_SADDR ( SIF_CMDI_SYSTEM | 0x00000000)
#define SIF_CMDC_SET_SREG ( SIF_CMDI_SYSTEM | 0x00000001)
#define SIF_CMDC_INIT_CMD ( SIF_CMDI_SYSTEM | 0x00000002)
#define SIF_CMDC_RESET_CMD ( SIF_CMDI_SYSTEM | 0x00000003)
/* data structure for telling to change packet buffer address */
typedef struct {
sceSifCmdHdr chdr;
void *newaddr;
} sceSifCmdCSData; /* System use */
/* data structure for telling to set software register[0 - 31] */
/* software register[0 - 7] used by system */
typedef struct {
sceSifCmdHdr chdr;
int rno;
unsigned int value;
} sceSifCmdSRData;
/* data structure for reset iop modules */
typedef struct {
sceSifCmdHdr chdr;
int size;
int flag;
char arg[80];
} sceSifCmdResetData; /* System use */
/* */
void sceSifInitCmd(void);
void sceSifExitCmd(void);
/* get & set software register value */
unsigned int sceSifGetSreg(int);
unsigned int sceSifSetSreg(int,unsigned int);
sceSifCmdData * sceSifSetCmdBuffer(sceSifCmdData *, int);
sceSifCmdData * sceSifSetSysCmdBuffer(sceSifCmdData *, int); /* System use */
void sceSifAddCmdHandler(unsigned int,sceSifCmdHandler,void *);
void sceSifRemoveCmdHandler(unsigned int);
unsigned int sceSifSendCmd(unsigned int,void *,int,void *, void *, int);
unsigned int isceSifSendCmd(unsigned int,void *,int,void *, void *, int);
void sceSifWriteBackDCache(const void *, int); /* EE only */
/* send mode */
#define SIF_CMDM_INTR 0x01 /* called in no intr area */
#define SIF_CMDM_TAG 0x02 /* */
#define SIF_CMDM_WBDC 0x04 /* write back atended data */
#if defined(_LANGUAGE_C_PLUS_PLUS)||defined(__cplusplus)||defined(c_plusplus)
}
#endif
#endif /* _SIFCMD_H_DEFS */
/* End of File */

313
include/ee/sifdev.h Normal file
View File

@ -0,0 +1,313 @@
/* SCE CONFIDENTIAL
"PlayStation 2" Programmer Tool Runtime Library Release 2.5.4
*/
/*
* Emotion Engine Library
* Version 0.2.0
* Shift-JIS
*
* Copyright (C) 2001 Sony Computer Entertainment Inc.
* All Rights Reserved.
*
* sifdev.h
* develop library
*
* Version Date Design Log
* --------------------------------------------------------------------
* 0.1.0
* 0.2.0 01/23/2001 akiyuki addition of const and
* sceSifLoadModuleBuffer
*/
#ifndef _SIFDEV_H_DEFS
#define _SIFDEV_H_DEFS
#if defined(_LANGUAGE_C_PLUS_PLUS)||defined(__cplusplus)||defined(c_plusplus)
extern "C" {
#endif
/* Flag for sceOpen() */
#define SCE_RDONLY 0x0001
#define SCE_WRONLY 0x0002
#define SCE_RDWR 0x0003
#define SCE_NBLOCK 0x0010 /* Non-Blocking I/O */
#define SCE_APPEND 0x0100 /* append (writes guaranteed at the end) */
#define SCE_CREAT 0x0200 /* open with file create */
#define SCE_TRUNC 0x0400 /* open with truncation */
#define SCE_EXCL 0x0800 /* exclusive create */
#define SCE_NOBUF 0x4000 /* no device buffer and console interrupt */
#define SCE_NOWAIT 0x8000 /* asyncronous i/o */
/* SCE local usage */
#define SCE_NOWBDC 0x20000000 /* not write back d cashe */
/* Seek Code */
#ifndef SCE_SEEK_SET
#define SCE_SEEK_SET (0)
#endif
#ifndef SCE_SEEK_CUR
#define SCE_SEEK_CUR (1)
#endif
#ifndef SCE_SEEK_END
#define SCE_SEEK_END (2)
#endif
/* Ioctl Code */
#define SCE_FS_EXECUTING 0x1
/* dev9 */
#define DDIOC_MODEL (('D'<<8)|1)
#define DDIOC_OFF (('D'<<8)|2)
/* hdd */
#define HIOCADDSUB (('h'<<8)|1)
#define HIOCDELSUB (('h'<<8)|2)
#define HIOCNSUB (('h'<<8)|3)
#define HIOCFLUSH (('h'<<8)|4)
#define HDIOC_MAXSECTOR (('H'<<8)|1)
#define HDIOC_TOTALSECTOR (('H'<<8)|2)
#define HDIOC_IDLE (('H'<<8)|3)
#define HDIOC_FLUSH (('H'<<8)|4)
#define HDIOC_SWAPTMP (('H'<<8)|5)
#define HDIOC_DEV9OFF (('H'<<8)|6)
#define HDIOC_STATUS (('H'<<8)|7)
#define HDIOC_FORMATVER (('H'<<8)|8)
#define HDIOC_SMARTSTAT (('H'<<8)|9)
#define HDIOC_FREESECTOR (('H'<<8)|10)
#define HDIOC_IDLEIMM (('H'<<8)|11)
/* mount() flag */
#define SCE_MT_RDWR 0x00
#define SCE_MT_RDONLY 0x01
#define SCE_MT_ROBUST 0x02
#define SCE_MT_ERRCHECK 0x04
/* pfs */
#define PIOCALLOC (('p'<<8)|1)
#define PIOCFREE (('p'<<8)|2)
#define PIOCATTRADD (('p'<<8)|3)
#define PIOCATTRDEL (('p'<<8)|4)
#define PIOCATTRLOOKUP (('p'<<8)|5)
#define PIOCATTRREAD (('p'<<8)|6)
#define PDIOC_ZONESZ (('P'<<8)|1)
#define PDIOC_ZONEFREE (('P'<<8)|2)
#define PDIOC_CLOSEALL (('P'<<8)|3)
#define PDIOC_GETFSCKSTAT (('P'<<8)|4)
#define PDIOC_CLRFSCKSTAT (('P'<<8)|5)
/* CD/DVD Ioctl */
#define CIOCSTREAMPAUSE (('c'<<8)|13)
#define CIOCSTREAMRESUME (('c'<<8)|14)
#define CIOCSTREAMSTAT (('c'<<8)|15)
/* CD/DVD Devctl */
#define CDIOC_READCLOCK (('C'<<8)|12)
#define CDIOC_GETDISKTYP (('C'<<8)|31)
#define CDIOC_GETERROR (('C'<<8)|32)
#define CDIOC_TRAYREQ (('C'<<8)|33)
#define CDIOC_STATUS (('C'<<8)|34)
#define CDIOC_POWEROFF (('C'<<8)|35)
#define CDIOC_MMODE (('C'<<8)|36)
#define CDIOC_DISKRDY (('C'<<8)|37)
#define CDIOC_STREAMINIT (('C'<<8)|39)
#define CDIOC_BREAK (('C'<<8)|40)
#define CDIOC_SPINNOM (('C'<<8)|128)
#define CDIOC_TRYCNT (('C'<<8)|130)
#define CDIOC_STANDBY (('C'<<8)|132)
#define CDIOC_STOP (('C'<<8)|133)
#define CDIOC_PAUSE (('C'<<8)|134)
#define CDIOC_GETTOC (('C'<<8)|135)
#define CDIOC_READDVDDUALINFO (('C'<<8)|137)
#define CDIOC_INIT (('C'<<8)|138)
#define SCE_PAD_ADDRESS 0x1
/* Error codes */
#define SCE_ENXIO 6 /* No such device or address */
#define SCE_EBADF 9 /* Bad file number */
#define SCE_ENODEV 19 /* No such device */
#define SCE_EINVAL 22 /* Invalid argument */
#define SCE_EMFILE 24 /* Too many open files */
#define SCE_EBINDMISS 0x10000
#define SCE_ECALLMISS 0x10001
#define SCE_ETYPEMISS 0x10002
#define SCE_ELOADMISS 0x10003
#define SCE_EVERSIONMISS 0x10004
struct sce_stat {
unsigned int st_mode; /* ファイルの種類(file/dir) */
/* とモード(R/W/X) */
unsigned int st_attr; /* デバイス依存の属性 */
unsigned int st_size; /* ファイルサイズ 下位 32 bit */
unsigned char st_ctime[8]; /* 作成時間 */
unsigned char st_atime[8]; /* 最終参照時間 */
unsigned char st_mtime[8]; /* 最終変更時間 */
unsigned int st_hisize; /* ファイルサイズ 上位 32bit */
unsigned int st_private[6]; /* その他 */
};
struct sce_dirent {
struct sce_stat d_stat; /* ファイルのステータス */
char d_name[256]; /* ファイル名(フルパスではない) */
void *d_private; /* その他 */
};
#define SCE_CST_MODE 0x0001
#define SCE_CST_ATTR 0x0002
#define SCE_CST_SIZE 0x0004
#define SCE_CST_CT 0x0008
#define SCE_CST_AT 0x0010
#define SCE_CST_MT 0x0020
#define SCE_CST_PRVT 0x0040
extern int sceOpen(const char *filename, int flag, ...);
extern int sceClose(int fd);
extern int sceRead(int fd, void *buf, int nbyte);
extern int sceWrite(int fd, const void *buf, int nbyte);
extern int sceLseek(int fd, int offset, int where);
extern int sceIoctl(int fd, int req, void *);
extern int sceFsReset(void);
extern int sceDopen ( const char *dirname);
extern int sceDclose ( int fd);
extern int sceDread(int fd, struct sce_dirent *buf);
extern int sceRemove ( const char *filename);
extern int sceMkdir ( const char *dirname, int flag);
extern int sceRmdir ( const char *dirname);
extern int sceGetstat ( const char *name, struct sce_stat *buf);
extern int sceChstat ( const char *name, struct sce_stat *buf, unsigned int cbit);
extern int sceFormat( const char *path, const char *blkdevname, void *arg, int arglen);
extern int sceChdir( const char *name);
extern int sceSync( const char *path, int flag);
extern int sceMount( const char *fsdevname, const char *blkdevname, int flag, void *arg, int arglen);
extern int sceUmount( const char *name);
extern long sceLseek64(int fd, long offset, int whence);
extern int sceDevctl (const char *devname, int cmd, const void *arg,
unsigned int arglen, void *bufp, unsigned int buflen);
extern int sceSymlink(const char *existing, const char *newname);
extern int sceReadlink(const char *path, char *buf, unsigned int bufsize);
extern int sceRename( const char *oldname, const char *newname);
extern int sceIoctl2(int fd, int request, const void *argp,
unsigned int arglen, void *bufp, unsigned int buflen);
extern int sceFsInit(void);
extern int *scePowerOffHandler(void (*func)(void *),void *addr);
/*
Memory Card status
*/
#define SCE_STM_R 0x0001
#define SCE_STM_W 0x0002
#define SCE_STM_X 0x0004
#define SCE_STM_C 0x0008
#define SCE_STM_F 0x0010
#define SCE_STM_D 0x0020
/*
HDD Pfs status macro
*/
/* Filetypes and Protection bits for pfs */
#define SCE_STM_FMT (0xf << 12)
#define SCE_STM_FLNK (0x4 << 12) /* symbolic link */
#define SCE_STM_FREG (0x2 << 12) /* regular file */
#define SCE_STM_FDIR (0x1 << 12) /* directory */
#define SCE_STM_ISLNK(m) (((m) & SCE_STM_FMT) == SCE_STM_FLNK)
#define SCE_STM_ISREG(m) (((m) & SCE_STM_FMT) == SCE_STM_FREG)
#define SCE_STM_ISDIR(m) (((m) & SCE_STM_FMT) == SCE_STM_FDIR)
#define SCE_STM_SUID 04000 /* set uid bit */
#define SCE_STM_SGID 02000 /* set gid bit */
#define SCE_STM_SVTX 01000 /* sticky bit */
#define SCE_STM_RWXU 00700
#define SCE_STM_RUSR 00400
#define SCE_STM_WUSR 00200
#define SCE_STM_XUSR 00100
#define SCE_STM_RWXG 00070
#define SCE_STM_RGRP 00040
#define SCE_STM_WGRP 00020
#define SCE_STM_XGRP 00010
#define SCE_STM_RWXO 00007
#define SCE_STM_ROTH 00004
#define SCE_STM_WOTH 00002
#define SCE_STM_XOTH 00001
#define SCE_STM_ALLUGO \
(SCE_STM_SUID|SCE_STM_SGID|SCE_STM_SVTX|SCE_STM_RWXUGO)
#define SCE_STM_RWXUGO (SCE_STM_RWXU|SCE_STM_RWXG|SCE_STM_RWXO)
#define SCE_STM_RUGO (SCE_STM_RUSR|SCE_STM_RGRP|SCE_STM_ROTH)
#define SCE_STM_WUGO (SCE_STM_WUSR|SCE_STM_WGRP|SCE_STM_WOTH)
#define SCE_STM_XUGO (SCE_STM_XUSR|SCE_STM_XGRP|SCE_STM_XOTH)
extern int sceSifInitIopHeap(void);
extern void *sceSifAllocIopHeap(unsigned int);
extern int sceSifFreeIopHeap(void *);
extern int sceSifLoadIopHeap(const char *, void *);
extern void *sceSifAllocSysMemory(int, unsigned int, void *);
extern int sceSifFreeSysMemory(void *);
extern unsigned int sceSifQueryMemSize(void);
extern unsigned int sceSifQueryMaxFreeMemSize(void);
extern unsigned int sceSifQueryTotalFreeMemSize(void);
extern void *sceSifQueryBlockTopAddress(void *);
extern unsigned int sceSifQueryBlockSize(void *);
/* ee load file routine */
typedef struct {
unsigned int epc;
unsigned int gp;
unsigned int sp;
unsigned int dummy;
} sceExecData;
#define SCE_SIF_TYPECHAR 0
#define SCE_SIF_TYPESHORT 1
#define SCE_SIF_TYPEINT 2
#define RESIDENT_END (0)
#define REMOVABLE_RESIDENT_END (2)
#define NO_RESIDENT_END (1)
#define FAREWELL_END (1)
extern int sceSifLoadModule(const char *filename, int args, const char *argp);
extern int sceSifLoadModuleBuffer(const void *addr, int args, const char *argp);
extern int sceSifLoadStartModule(const char *filename, int args,
const char *argp, int *result);
extern int sceSifLoadStartModuleBuffer(const void *addr, int args,
const char *argp, int *result);
extern int sceSifLoadElf(const char *name, sceExecData *data);
extern int sceSifLoadElfPart(const char *name, const char *secname,
sceExecData *data);
extern int sceSifStopModule(int modid, int args,
const char *argp, int *result);
extern int sceSifUnloadModule(int modid);
extern int sceSifSearchModuleByName(const char *modulename);
extern int sceSifSearchModuleByAddress(const void *addr);
extern int sceSifLoadFileReset(void);
extern int sceSifRebootIop(const char *img);
extern int sceSifSyncIop(void);
#define IOP_IMAGE_FILE "IOPRP254.IMG"
#define IOP_IMAGE_file "ioprp254.img"
/* extern int errno; */
#if defined(_LANGUAGE_C_PLUS_PLUS)||defined(__cplusplus)||defined(c_plusplus)
}
#endif
#endif /* _SIFDEV_H_DEFS */
/* End of File */

117
include/ee/sifrpc.h Normal file
View File

@ -0,0 +1,117 @@
/* SCE CONFIDENTIAL
"PlayStation 2" Programmer Tool Runtime Library Release 2.5
*/
/*
* Emotion Engine Library
* Version 0.1.0
* Shift-JIS
*
* Copyright (C) 1998-1999 Sony Computer Entertainment Inc.
* All Rights Reserved.
*
* sifrpc.h
* develop library
*
* Version Date Design Log
* --------------------------------------------------------------------
* 0.1.0
*/
#ifndef _SIFRPC_H_DEFS
#define _SIFRPC_H_DEFS
#if defined(_LANGUAGE_C_PLUS_PLUS)||defined(__cplusplus)||defined(c_plusplus)
extern "C" {
#endif
typedef struct _sif_rpc_data {
void *paddr; /* packet address */
unsigned int pid; /* packet id */
int tid; /* thread id */
unsigned int mode; /* call mode */
} sceSifRpcData;
typedef void (* sceSifEndFunc)(void *);
typedef struct _sif_client_data {
struct _sif_rpc_data rpcd;
unsigned int command;
void *buff;
void *cbuff;
sceSifEndFunc func;
void *para;
struct _sif_serve_data *serve;
} sceSifClientData;
typedef struct _sif_receive_data {
struct _sif_rpc_data rpcd;
void *src;
void *dest;
int size;
} sceSifReceiveData;
typedef void * (* sceSifRpcFunc)(unsigned int,void *,int);
typedef struct _sif_serve_data {
unsigned int command;
sceSifRpcFunc func;
void *buff;
int size;
sceSifRpcFunc cfunc;
void *cbuff;
int csize;
sceSifClientData *client;
void *paddr;
unsigned int fno;
void *receive;
int rsize;
int rmode;
unsigned int rid;
struct _sif_serve_data *link;
struct _sif_serve_data *next;
struct _sif_queue_data *base;
} sceSifServeData;
typedef struct _sif_queue_data {
int key;
int active;
struct _sif_serve_data *link;
struct _sif_serve_data *start;
struct _sif_serve_data *end;
struct _sif_queue_data *next;
}sceSifQueueData;
/* call & bind mode */
#define SIF_RPCM_NOWAIT 0x01 /* not wait for end of function */
#define SIF_RPCM_NOWBDC 0x02 /* no write back d-cache .ee only */
/* error no */
#define SIF_RPCE_GETP 1 /* fail to get packet data */
#define SIF_RPCE_SENDP 2 /* fail to send dma packet */
#define SIF_RPCE_CSEMA 3 /* fail to get sema */
/* functions */
void sceSifInitRpc(unsigned int mode);
int sceSifBindRpc(sceSifClientData *, unsigned int, unsigned int);
int sceSifCallRpc(sceSifClientData *, unsigned int, unsigned int,void *,int, void *,int, sceSifEndFunc, void *);
int sceSifCheckStatRpc(sceSifRpcData *);
void sceSifSetRpcQueue( sceSifQueueData *, int);
sceSifServeData * sceSifGetNextRequest(sceSifQueueData *);
void sceSifExecRequest(sceSifServeData *);
void sceSifRegisterRpc(sceSifServeData *, unsigned int,sceSifRpcFunc,void *,sceSifRpcFunc,void *,sceSifQueueData *);
void sceSifRpcLoop(sceSifQueueData *);
int sceSifGetOtherData(sceSifReceiveData *,void *,void *,int size, unsigned int mode);
sceSifServeData * sceSifRemoveRpc(sceSifServeData *,sceSifQueueData *);
sceSifQueueData * sceSifRemoveRpcQueue(sceSifQueueData *);
#if defined(_LANGUAGE_C_PLUS_PLUS)||defined(__cplusplus)||defined(c_plusplus)
}
#endif
#endif /* _SIFRPC_H_DEFS */
/* End of File */

166
include/ee/vumacros.h Normal file
View File

@ -0,0 +1,166 @@
/* SCE CONFIDENTIAL
"PlayStation 2" Programmer Tool Runtime Library Release 2.5
*/
/*
* Emotion Engine Library
* Version 0.01
* Shift-JIS
*
* Copyright (C) 1998-1999 Sony Computer Entertainment Inc.
* All Rights Reserved.
*
* vumacros.h
* develop library
*
* Version Date Design Log
* --------------------------------------------------------------------
* 0.1.0
*/
; float x 4
;
.macro fxyzw f1, f2, f3, f4
.float \f1, \f2, \f3, \f4
.endm
.macro fwzyx f1, f2, f3, f4
.float \f4, \f3, \f2, \f1
.endm
; int x 4
;
.macro ixyzw i1, i2, i3, i4
.int \i1, \i2, \i3, \i4
.endm
.macro iwzyx i1, i2, i3, i4
.int \i4, \i3, \i2, \i1
.endm
; short x 4
;
.macro sxyzw s1, s2, s3, s4
.short \s1, \s2, \s3, \s4
.endm
.macro swzyx s1, s2, s3, s4
.short \s4, \s3, \s2, \s1
.endm
; byte x 4
;
.macro bxyzw b1, b2, b3, b4
.byte \b1, \b2, \b3, \b4
.endm
.macro bwzyx b1, b2, b3, b4
.byte \b4, \b3, \b2, \b1
.endm
; float x 3
;
.macro fxyz f1, f2, f3
.float \f1, \f2, \f3
.endm
.macro fzyx f1, f2, f3
.float \f3, \f2, \f1
.endm
; int x 3
;
.macro ixyz i1, i2, i3
.int \i1, \i2, \i3
.endm
.macro izyx i1, i2, i3
.int \i3, \i2, \i1
.endm
; short x 3
;
.macro sxyz s1, s2, s3
.short \s1, \s2, \s3
.endm
.macro szyx s1, s2, s3
.short \s3, \s2, \s1
.endm
; byte x 3
;
.macro bxyz b1, b2, b3
.byte \b1, \b2, \b3
.endm
.macro bzyx b1, b2, b3
.byte \b3, \b2, \b1
.endm
; float x 2
;
.macro fxy f1, f2
.float \f1, \f2
.endm
.macro fyx f1, f2
.float \f2, \f1
.endm
; int x 2
;
.macro ixy i1, i2
.int \i1, \i2
.endm
.macro iyx i1, i2
.int \i2, \i1
.endm
; short x 2
;
.macro sxy s1, s2
.short \s1, \s2
.endm
.macro syx s1, s2
.short \s2, \s1
.endm
; byte x 2
;
.macro bxy b1, b2
.byte \b1, \b2
.endm
.macro byx b1, b2
.byte \b2, \b1
.endm
; float x 1
;
.macro fx f1
.float \f1
.endm
; int x 1
;
.macro ix i1
.int \i1
.endm
; short x 1
;
.macro sx s1
.short \s1
.endm
; byte x 1
;
.macro bx b1
.byte \b1
.endm

View File

@ -6,7 +6,7 @@
#define INCLUDE_ASM_INTERNAL(TYPE, BASE_FOLDER, FOLDER, NAME, ARGS...) \
__asm__( \
".section .text\n" \
"\t.align\t2\n" \
"\t.align\t3\n" \
"\t.globl\t" #NAME "\n" \
"\t.ent\t" #NAME "\n" #NAME ":\n" \
"\t.include \"asm/" BASE_FOLDER "/" FOLDER "/" #NAME ".s\"\n" \

View File

@ -1,14 +0,0 @@
compiler_command = "/home/ethteck/repos/decomp.me/backend/compilers/ps2/ee-gcc2.96/bin/ee-gcc -c -B /home/ethteck/repos/decomp.me/backend/compilers/ps2/ee-gcc2.96/bin/ee- -G0 -O2 -Iinclude"
assembler_command = "mips-linux-gnu-as -march=r5900 -mabi=eabi -Iinclude"
compiler_type = "gcc"
[preserve_macros]
"gs?[DS]P.*" = "void"
OVERRIDE_FLAG_CHECK = "int"
OS_K0_TO_PHYSICAL = "int"
"G_.*" = "int"
"TEXEL.*" = "int"
PRIMITIVE = "int"
[decompme.compilers]
"tools/build/cc/gcc/gcc" = "ee-gcc2.96"

View File

@ -1,67 +1,197 @@
#include "common.h"
typedef struct AppleStemTip {
#include "ee/libvu0.h"
typedef struct XAppleStemTip {
/* 0x00 */ char unk_00[0x48];
/* 0x48 */ s32 unk_48;
} AppleStemTip;
} XAppleStemTip;
typedef struct AppleStem {
typedef struct XAppleStem {
/* 0x00 */ s32 unk_00[0x6C / 4];
/* 0x6C */ AppleStemTip *unk_6C;
} AppleStem;
/* 0x6C */ XAppleStemTip *unk_6C;
} XAppleStem;
typedef struct Apple4 {
typedef struct XApple4 {
/* 0x00 */ s32 unk_00[4];
} Apple4;
} XApple4;
typedef struct AppleBlemish {
typedef union X32 {
s32 s32;
u8 u8[4];
} X32;
typedef struct XAppleBlemish {
/* 0x000 */ s32 unk_00;
/* 0x004 */ s32 unk_04;
/* 0x008 */ char unk_08[0x368];
/* 0x004 */ X32 unk_04;
/* 0x008 */ char unk_08[0x8];
/* 0x010 */ f32 unk_10;
/* 0x014 */ char unk_14[0x28];
/* 0x03C */ f32 unk_3C;
/* 0x040 */ char unk_40[0x90];
/* 0x0D0 */ sceVu0FMATRIX unk_D0;
/* 0x110 */ char unk_110[0x10];
/* 0x120 */ sceVu0FVECTOR unk_120;
/* 0x134 */ char unk_130[0x240];
/* 0x370 */ u64 unk_370;
/* 0x374 */ char unk_378[0xC8];
/* 0x374 */ char unk_378[0xCC];
/* 0x444 */ s32 unk_444;
} AppleBlemish;
} XAppleBlemish;
extern s32 func_0013B1D0;
// .data
extern s32 D_002C1EA8;
extern u32 D_002C1EC8;
extern s32 D_00301088;
extern AppleStem *D_002DEC00;
extern u32 D_002DED20;
extern s32 D_00301010[];
extern s32 D_00301050;
extern s32 D_00301054;
extern s32 D_00301058;
// .rodata
extern char *D_004879D0; // "%s%s"
// .bss ?
extern s32 D_00532508;
extern s32 D_00532518;
extern s32 D_00532600;
extern s32 D_00532604;
extern Apple4* D_00532608;
extern s32* D_0053260C;
// funcs
s32 func_0011ED30(s32, s32 (*func)(void));
s32 func_0011EF58(s32*, s32);
s32 func_00120590(char*, void*, void*, void*);
f32 func_00120A38(sceVu0FVECTOR);
f32 func_00120A58(f32*);
f32 func_00120AC8(f32);
void func_001223B0(f32*, f32*);
XAppleBlemish* func_001234A0(XAppleBlemish*);
void func_00123830(XAppleBlemish*, s32);
void func_00123E48(s32, sceVu0FVECTOR);
void func_00124BC8(XAppleBlemish*);
void func_00130248(XAppleBlemish*, f32, UNK_PTR);
void func_001313A8(XAppleBlemish*, UNK_PTR);
void func_00131410(XAppleBlemish*);
s32 func_00132160(s32, s32, s32);
void func_001372F8(f32, XAppleBlemish*);
void func_00137348(XAppleBlemish*);
void func_0013A790(void);
s32 func_0013B1D0(void);
void func_0013B578(void);
s32 func_0013BD88(s32*, s32*, s32);
s32 func_0013BDA0(s32*);
s32 func_00157B90(void);
void func_00163638(sceVu0FMATRIX, sceVu0FMATRIX);
void func_00177828(s32);
void func_001778A0(s32);
void func_001778B8(s32);
f32 func_00177D68(void);
void func_001C64E0(UNK_PTR, UNK_PTR, UNK_PTR);
s32 func_001EE090(void);
s32 sprintf(void*, s32*, s32, s32);
// ???
extern s32 func_F20000(s32, s32);
s32 func_0011ED30(s32, s32*);
s32 func_0011EF58(s32*, s32);
s32 func_00120590(void*, s32*, s32*, s32);
s32 func_00132160(s32, s32, s32);
s32 func_0013A790();
s32 func_0013BD88(s32*, s32*, s32);
s32 func_0013BDA0(s32*);
s32 func_00157B90(void);
s32 func_001EE090(void);
s32 sprintf(void*, s32*, s32, s32);
// .data
extern f32 D_002B8340[];
extern s32 D_002C1E00;
extern sceVu0FMATRIX D_002C1E20;
extern u32 D_002C1EA8;
extern u32 D_002C1EC8;
extern XAppleStem* D_002DEC00;
extern sceVu0FVECTOR D_002DECE0;
extern sceVu0FVECTOR D_002DECF0;
extern u32 D_002DED20;
extern sceVu0FVECTOR D_00301030;
extern sceVu0FVECTOR D_00301040;
extern s32 D_00301088;
extern s32 D_00301010[];
extern s32 D_00301050;
extern s32 D_00301054;
extern s32 D_00301058;
extern u32 D_00375BC0;
INCLUDE_ASM(const s32, "unnamed_apple", func_0013AB68);
// .rodata
extern char* D_004879D0; // "%s%s"
// .bss ?
extern f32 D_005324B4;
extern f32 D_005324B8;
extern f32 D_005324BC;
extern sceVu0FVECTOR D_005324C0;
extern sceVu0FVECTOR D_005324D0;
extern sceVu0FVECTOR D_005324E0;
extern sceVu0FVECTOR D_005324F0;
extern f32 D_00532500;
extern s32 D_00532508;
extern s32 D_00532518;
extern XAppleBlemish* D_005325E8;
extern XAppleBlemish* D_005325EC;
extern sceVu0FVECTOR D_005325F0;
extern s32 D_00532600;
extern s32 D_00532604;
extern XApple4* D_00532608;
extern s32* D_0053260C;
extern s32 D_00532610;
s32 func_0013AB68(u16* arg0) {
sceVu0FVECTOR sp0;
sceVu0FVECTOR sp10;
sceVu0FMATRIX sp20;
sceVu0FMATRIX sp60;
f32 var_f21;
f32 ry;
f32 s;
f32 fVar1;
f32 fVar2;
if (((D_002C1EA8 >> 20) & 1) == 0) {
return 4;
}
if (*arg0 & 0x10) {
func_00163638(D_005325E8->unk_D0, sp60);
D_002DECF0[3] = 1.0f;
D_002DECE0[3] = 1.0f;
sceVu0ApplyMatrix(D_005324D0, sp60, D_002DECE0);
sceVu0ApplyMatrix(D_005324E0, sp60, D_002DECF0);
sceVu0SubVector(D_005324C0, D_00301040, D_005324D0);
D_005324B8 = func_00120A38(D_005324C0);
sceVu0SubVector(D_005324C0, D_005324E0, D_005324D0);
sceVu0Normalize(D_005324C0, D_005324C0);
sceVu0ScaleVector(D_005324C0, D_005324C0, D_005324B8);
sceVu0AddVector(D_005324E0, D_005324C0, D_005324D0);
sceVu0SubVector(D_005324F0, D_005324D0, D_005324E0);
D_005324F0[1] = 0.0f;
func_001223B0(D_005324F0, D_005324F0);
D_005324B8 = D_005324F0[3];
D_005324F0[3] = 1.0f;
sceVu0SubVector(D_005324C0, D_00301030, D_00301040);
D_005324BC = func_00120A58(D_005324C0) - D_005324B8;
fVar1 = atan2f(D_005324D0[0] - D_005324E0[0], D_005324D0[2] - D_005324E0[2]);
fVar2 = atan2f(D_00301030[0] - D_00301040[0], D_00301030[2] - D_00301040[2]);
D_005324B4 = func_00120AC8(fVar2 - fVar1);
if (func_00177D68() < 0.5f) {
if (D_005324B4 < 0.0f) {
D_005324B4 += 6.2831855f;
} else {
D_005324B4 -= 6.2831855f;
}
}
if (func_00177D68() < 0.5f) {
D_005324B4 += 0.5235988f;
} else {
D_005324B4 -= 0.5235988f;
}
D_00532500 = 40.0f;
}
D_00532500 -= D_002B8340[1];
var_f21 = D_00532500 / 40.0f;
if (var_f21 < 0.0f) {
var_f21 = 0.0f;
}
var_f21 = (cosf(var_f21 * 3.1415928f) + 1.0f) * 0.5f;
sceVu0InterVector(sp10, D_00301040, D_005324E0, var_f21);
ry = func_00120AC8(D_005324B4 * var_f21);
sceVu0RotMatrixY(sp20, D_002C1E20, ry);
sceVu0ApplyMatrix(D_005324C0, sp20, D_005324F0);
s = D_005324B8 + D_005324BC * var_f21;
sceVu0ScaleVector(D_005324C0, D_005324C0, s);
sceVu0AddVector(sp0, sp10, D_005324C0);
sp0[3] = 1.0f;
sp10[3] = 1.0f;
sp0[1] = (D_00301030[1] * var_f21) + (D_005324D0[1] * (1.0f - var_f21));
sceVu0ApplyMatrix(D_002DECE0, D_005325E8->unk_D0, sp0);
sceVu0ApplyMatrix(D_002DECF0, D_005325E8->unk_D0, sp10);
return 0;
}
INCLUDE_ASM(const s32, "unnamed_apple", func_0013AFE8);
@ -81,6 +211,46 @@ void func_0013B138(void) {
INCLUDE_ASM(const s32, "unnamed_apple", func_0013B1D0);
// s32 func_0013B1D0(void) {
// XAppleBlemish* var_17;
// s32 var_16;
// var_17 = NULL;
// do {
// var_17 = func_001234A0(var_17);
// if (var_17 == NULL) {
// break;
// }
// if (var_17 == D_005325E8) {
// var_16 = var_17->unk_00 | 0x30;
// var_16 &= ~0x2;
// func_001372F8(0.0f, var_17);
// var_17->unk_370 |= 0x10000000000000;
// } else {
// var_16 = var_17->unk_00 & ~0x8000;
// func_00137348(var_17);
// sceVu0CopyVector(var_17->unk_120, D_002C1E00 + 0x1E00);
// }
// func_00123830(var_17, var_16);
// } while (TRUE);
// sceVu0CopyVector(D_005325F0, &D_005325E8->unk_10);
// D_005325F0[3] = D_005325E8->unk_3C;
// func_00123E48(D_005325E8->unk_04.s32, D_002C1E00);
// func_00177828(D_00532610);
// func_001778B8(0);
// func_001778A0(1);
// D_002C1EA8 &= ~0x100000;
// D_002C1EA8 |= 0x4000;
// if (((s32)((D_002C1EC8 >> 8) % 4) < 2) && (D_00532608[1].unk_00[1] != D_00532608[1].unk_00[0])) {
// func_001313A8(D_005325E8, (s32)D_00532608 + D_00532608->unk_00[3]);
// func_001C64E0((s32)D_00532608 + D_00532608[1].unk_00[0], (s32)D_00532608 + D_00532608[1].unk_00[1], (s32)D_00532608 + D_00532608[1].unk_00[2]);
// }
// return 4;
// }
s32 func_0013B368(void) {
char something[0x20];
@ -142,24 +312,17 @@ INCLUDE_ASM(const s32, "unnamed_apple", func_0013B480);
INCLUDE_ASM(const s32, "unnamed_apple", func_0013B578);
// int func_0011EEB8(int*, int, int*);
// void* func_001234A0(void*);
// int func_00123858(void*);
// int func_00123E48(s32, int*);
// int func_001250B0();
// int func_00130248(void*, f32, int);
// int func_00131410(void*);
// int func_00133588();
// int func_001452E0(int, int);
// int func_0014F8B0(void*, int);
// int func_001778A0();
// int func_0023E0B0(int, int);
// void func_001250B0(void);
// void func_00133588(void);
// void func_001452E0(int, int);
// void func_0014F8B0(XAppleBlemish*, int);
// void func_0023E0B0(int, int);
// extern AppleBlemish* D_005325E8;
// extern int D_005325F0;
// extern int func_0013B480;
// void func_0013B578(void) {
// AppleBlemish* var_16;
// XAppleBlemish* var_16;
// func_00133588();
// func_001250B0();
@ -174,13 +337,13 @@ INCLUDE_ASM(const s32, "unnamed_apple", func_0013B578);
// } while (var_16 != NULL);
// }
// func_0014F8B0(D_005325E8, 0);
// func_00123E48(D_005325E8->unk_04, &D_005325F0);
// func_00123E48(D_005325E8->unk_04.s32, D_005325F0);
// func_00131410(D_005325E8);
// func_00130248(D_005325E8, 0, 0x40000000);
// func_00130248(D_005325E8, 0.0f, 0x40000000);
// D_005325E8->unk_370 &= ~0x10000000000000;
// D_005325E8->unk_00 &= 0xFFDFFFFF;
// D_005325E8->unk_00 &= ~0x200000;
// D_005325E8->unk_444 = 0;
// func_001778A0();
// func_001778A0(0);
// D_002C1EA8 &= ~0x4000;
// func_001452E0(0, 4);
// func_0011EEB8(&D_00532518, 0, &func_0013B480);
@ -188,63 +351,48 @@ INCLUDE_ASM(const s32, "unnamed_apple", func_0013B578);
INCLUDE_ASM(const s32, "unnamed_apple", func_0013B6E0);
// s32* func_001234A0(s32*);
// s32 func_00124BC8(s32*);
// s32 func_00130248(s32*, f32, s32);
// s32 func_001313A8(s32*, void*);
// s32 func_00131410(s32*);
// s32 func_0013B578();
// s32 func_001EE090();
// extern u32 D_002C1EC8;
// extern u32 D_00375BC0;
// extern s32* D_005325E8;
// extern AppleBlemish* D_005325EC;
// extern s32 D_00532604;
// s32 func_0013B6E0(void) {
// AppleBlemish **new_var;
// AppleBlemish* var_4;
// XAppleBlemish* var_4;
// if (((D_00375BC0 >> 2) & 1) || (D_00532604 != 4) || (func_001EE090() != 0)) {
// if (((D_00375BC0 >> 2) & 1) != 0 || D_00532604 != 4 || func_001EE090() != 0) {
// return 0;
// } else {
// func_0013B578();
// D_005325EC = NULL;
// var_4 = NULL;
// do {
// var_4 = func_001234A0(var_4);
// if (var_4 == NULL) {
// break;
// }
// if (var_4->unk_06 == 7) {
// D_005325EC = var_4;
// break;
// }
// } while (1);
// if (D_005325EC != NULL) {
// if ((D_0053260C[2] - D_0053260C[1]) > 0) {
// func_001313A8(D_005325EC, (s32)D_0053260C + D_0053260C[1]);
// func_00130248(D_005325EC, 0.0f, 0);
// D_005325EC->unk_00 &= ~0x30;
// }
// D_005325EC->unk_444 = 0;
// }
// if (((D_002C1EC8 >> 8) % 4) != 1) {
// if (D_0053260C[3] - D_0053260C[2] > 0) {
// func_001313A8(D_005325E8, (s32)D_0053260C + D_0053260C[2]);
// func_00130248(D_005325E8, 0.0f, 0);
// }
// func_F20000(0, ((D_0053260C[4] - D_0053260C[3]) <= 0) ? NULL : ((s32)D_0053260C + D_0053260C[3]));
// } else {
// func_00124BC8(D_005325EC);
// func_00131410(D_005325E8);
// func_00130248(D_005325E8, 0.0f, 0x40000000);
// }
// return 1;
// }
// func_0013B578();
// D_005325EC = NULL;
// var_4 = NULL;
// do {
// var_4 = func_001234A0(var_4);
// if (var_4 == NULL) {
// break;
// }
// if (var_4->unk_04.u8[2] == 7) {
// D_005325EC = var_4;
// break;
// }
// } while (TRUE);
// if (D_005325EC != NULL) {
// if ((D_0053260C[2] - D_0053260C[1]) > 0) {
// func_001313A8(D_005325EC, (s32)D_0053260C + D_0053260C[1]);
// func_00130248(D_005325EC, 0.0f, 0);
// D_005325EC->unk_00 &= ~0x30;
// }
// D_005325EC->unk_444 = 0;
// }
// if ((((u32) D_002C1EC8 >> 8) % 4) != 1) {
// if (D_0053260C[3] - D_0053260C[2] > 0) {
// func_001313A8(D_005325E8, (s32)D_0053260C + D_0053260C[2]);
// func_00130248(D_005325E8, 0.0f, 0);
// }
// func_F20000(0, ((D_0053260C[4] - D_0053260C[3]) <= 0) ? NULL : ((s32)D_0053260C + D_0053260C[3]));
// } else {
// func_00124BC8(D_005325EC);
// func_00131410(D_005325E8);
// func_00130248(D_005325E8, 0.0f, 0x40000000);
// }
// return 1;
// }
s32 func_0013B890(void) {
@ -283,10 +431,9 @@ f32 func_0013BAC0(void) {
}
// s32 func_0011EDD0(s32*, s32*, s32, s32);
// f32 func_0013BAC0(void);
// s32 func_00141668(s32, s32);
// s32 func_00155ED8(s32, s32);
// s32 func_00157AD8(s32);
// s32 func_00141668(XAppleBlemish*, s32);
// XApple4* func_00155ED8(s32, s32);
// void func_00157AD8(s32);
// typedef struct AppleWormInner {
// /* 0x00 */ u8 unk_00;
@ -298,20 +445,14 @@ f32 func_0013BAC0(void) {
// /* 0x98 */ AppleWormInner unk_98[2];
// } AppleWorm;
// extern s32 D_002C1EA8;
// extern s32 D_00301078;
// extern s32 D_00301080;
// extern s32 D_00301088;
// extern f32 D_0030108C;
// extern f32 D_00301090;
// extern s32 D_00301094;
// extern AppleWorm D_003051EC;
// extern AppleWorm* D_003051EC;
// extern s32 D_00532518;
// extern s32 D_00532528;
// extern s32 D_005325E8;
// extern s32 D_00532600;
// extern s32 D_00532604;
// extern s32 func_0013B9B8;

67
tools/m2ctx.py Executable file
View File

@ -0,0 +1,67 @@
#!/usr/bin/env python3
import argparse
import os
import sys
import subprocess
import tempfile
script_dir = os.path.dirname(os.path.realpath(__file__))
root_dir = os.path.abspath(os.path.join(script_dir, ".."))
src_dir = root_dir + "src/"
# Project-specific
CPP_FLAGS = [
"-Iinclude",
"-D_LANGUAGE_C",
"-D__asm__(test...)=",
"-ffreestanding",
"-DM2CTX",
"-D__attribute__(test...)=",
]
def import_c_file(in_file) -> str:
in_file = os.path.relpath(in_file, root_dir)
cpp_command = ["gcc", "-E", "-P", "-dM", *CPP_FLAGS, in_file]
cpp_command2 = ["gcc", "-E", "-P", *CPP_FLAGS, in_file]
with tempfile.NamedTemporaryFile(suffix=".c") as tmp:
stock_macros = subprocess.check_output(["gcc", "-E", "-P", "-dM", tmp.name], cwd=root_dir, encoding="utf-8")
out_text = ""
try:
out_text += subprocess.check_output(cpp_command, cwd=root_dir, encoding="utf-8")
out_text += subprocess.check_output(cpp_command2, cwd=root_dir, encoding="utf-8")
except subprocess.CalledProcessError:
print(
"Failed to preprocess input file, when running command:\n" + cpp_command,
file=sys.stderr,
)
sys.exit(1)
if not out_text:
print("Output is empty - aborting")
sys.exit(1)
for line in stock_macros.strip().splitlines():
out_text = out_text.replace(line + "\n", "")
return out_text
def main():
parser = argparse.ArgumentParser(description="""Create a context file which can be used for mips_to_c""")
parser.add_argument(
"c_file",
help="""File from which to create context""",
)
args = parser.parse_args()
output = import_c_file(args.c_file)
with open(os.path.join(root_dir, "ctx.c"), "w", encoding="UTF-8") as f:
f.write(output)
if __name__ == "__main__":
main()