- PsyCross is no longer a part of ReDriver2 and separated into Submodule

This commit is contained in:
InspirationByte 2022-01-20 21:28:17 +03:00
parent b066a66b8c
commit afe523d8e5
64 changed files with 3 additions and 22314 deletions

3
.gitmodules vendored Normal file
View File

@ -0,0 +1,3 @@
[submodule "src_rebuild/PsyCross"]
path = src_rebuild/PsyCross
url = git@github.com:OpenDriver2/PsyCross.git

View File

@ -1,24 +0,0 @@
# Psy-Cross (Psy-X)
![](https://i.ibb.co/PFNnw4G/PsyCross.jpg)
Framework aiming to build and run originally targeted **Playstation** applications on other platforms based on Psy-Q SDK.
### Implementation details
- High-level *Playstation API* reimplementation which translates it's calls into modern/compatible APIs
- Psy-Q - compatible headers
- Implements Geometry Transformation Engine (GTE) in software and adapts it's macros and calls
- **PGXP-Z** - PGXP support with optimized vertex cache lookup and extended with *modern 3D hardware perspective transform* and *Z-buffer* support **PGXP-Z**, with additional API to help improve rendering
- *LibSPU* with ADPCM decoding on OpenAL (SPU-AL)
- *LibGPU* with Playstation-style polygon and image handling
- ISO 9660 BIN/CUE image support with Playstation CD API
- Already proven to be *95% compatible* with the Psy-Q Playstation SDK - Psy-X game look identical to the Playstation game
## TODO
- Add some missing **LibGTE** functions
- MDEC implementation in **LibPress**
- CD Audio/XA decoding and playback
- SPU Attack-Decay-Sustain-Release (ADSR) support, *maybe through own mixer?*
### Credits
- SoapyMan - more GTE functions, SPU-AL, PGXP-Z
- Gh0stBlade - original source/base [(link)](https://github.com/TOMB5/TOMB5/tree/master/EMULATOR)

View File

@ -1,11 +0,0 @@
#ifndef PSYX_CONFIG_H
#define PSYX_CONFIG_H
// Required. Uses 32 bit pointers on P_TAG and other primitives
#define USE_EXTENDED_PRIM_POINTERS
// PGXP-Z: Precise GTE transform pipeline with Z-depth and widescreen fixes. Recommended
#define USE_PGXP
#endif // PSYX_CONFIG_H

View File

@ -1,38 +0,0 @@
#ifndef EMULATOR_GLOBALS_H
#define EMULATOR_GLOBALS_H
#if defined(_LANGUAGE_C_PLUS_PLUS)||defined(__cplusplus)||defined(c_plusplus)
extern "C" {
#endif
extern int g_windowWidth;
extern int g_windowHeight;
extern int g_wireframeMode;
extern int g_texturelessMode;
extern int g_enableSwapInterval;
extern int g_pgxpZBuffer;
extern int g_bilinearFiltering;
extern int g_swapInterval;
extern float g_pgxpZNear;
extern float g_pgxpZFar;
extern int g_emulatorPaused;
extern int g_polygonSelected;
extern int g_pgxpTextureCorrection;
extern int g_controllerToSlotMapping[2];
extern void PsyX_Pad_InternalPadUpdates();
// logging functions
extern void PsyX_Log(const char* fmt, ...);
extern void PsyX_Log_Info(const char* fmt, ...);
extern void PsyX_Log_Warning(const char* fmt, ...);
extern void PsyX_Log_Error(const char* fmt, ...);
extern void PsyX_Log_Success(const char* fmt, ...);
#if defined(_LANGUAGE_C_PLUS_PLUS)||defined(__cplusplus)||defined(c_plusplus)
}
#endif
#endif

View File

@ -1,101 +0,0 @@
#ifndef EMULATOR_PUBLIC_H
#define EMULATOR_PUBLIC_H
#define CONTROLLER_MAP_FLAG_AXIS 0x4000
#define CONTROLLER_MAP_FLAG_INVERSE 0x8000
typedef struct
{
int id;
int kc_square, kc_circle, kc_triangle, kc_cross;
int kc_l1, kc_l2, kc_l3;
int kc_r1, kc_r2, kc_r3;
int kc_start, kc_select;
int kc_dpad_left, kc_dpad_right, kc_dpad_up, kc_dpad_down;
} PsyXKeyboardMapping;
typedef struct
{
int id;
// you can bind axis by adding CONTROLLER_MAP_AXIS_FLAG
int gc_square, gc_circle, gc_triangle, gc_cross;
int gc_l1, gc_l2, gc_l3;
int gc_r1, gc_r2, gc_r3;
int gc_start, gc_select;
int gc_dpad_left, gc_dpad_right, gc_dpad_up, gc_dpad_down;
int gc_axis_left_x, gc_axis_left_y;
int gc_axis_right_x, gc_axis_right_y;
} PsyXControllerMapping;
typedef void(*GameDebugKeysHandlerFunc)(int nKey, char down);
typedef void(*GameDebugMouseHandlerFunc)(int x, int y);
typedef void(*GameOnTextInputHandler)(const char* buf);
//------------------------------------------------------------------------
#if defined(_LANGUAGE_C_PLUS_PLUS)||defined(__cplusplus)||defined(c_plusplus)
extern "C" {
#endif
/* Mapped inputs */
extern PsyXControllerMapping g_controller_mapping;
extern PsyXKeyboardMapping g_keyboard_mapping;
/* Game and debug inputs */
extern GameDebugKeysHandlerFunc gameDebugKeys;
extern GameDebugMouseHandlerFunc gameDebugMouse;
extern GameOnTextInputHandler gameOnTextInput;
/* Usually called at the beginning of main function */
extern void PsyX_Initialise(char* windowName, int screenWidth, int screenHeight, int fullscreen);
/* Cleans all resources and closes open instances */
extern void PsyX_Shutdown(void);
/* Returns the screen size dimensions */
extern void PsyX_GetScreenSize(int* screenWidth, int* screenHeight);
/* Sets mouse cursor position */
extern void PsyX_SetCursorPosition(int x, int y);
/* Usually called after ClearOTag/ClearOTagR */
extern char PsyX_BeginScene(void);
/* Usually called after DrawOTag/DrawOTagEnv */
extern void PsyX_EndScene(void);
/* Explicitly updates emulator input loop */
extern void PsyX_UpdateInput(void);
/* Returns keyboard mapping index */
extern int PsyX_LookupKeyboardMapping(const char* str, int default_value);
/* Returns controller mapping index */
extern int PsyX_LookupGameControllerMapping(const char* str, int default_value);
/* Screen size of emulated PSX viewport with widescreen offsets */
extern void PsyX_GetPSXWidescreenMappedViewport(struct _RECT16* rect);
/* Waits for timer */
extern void PsyX_WaitForTimestep(int count);
/* Changes swap interval state */
extern void PsyX_EnableSwapInterval(int enable);
/* Changes swap interval interval interval */
extern void PsyX_SetSwapInterval(int interval);
#if defined(_LANGUAGE_C_PLUS_PLUS)||defined(__cplusplus)||defined(c_plusplus)
}
#endif
#endif

View File

@ -1,202 +0,0 @@
#ifndef EMULATOR_H
#define EMULATOR_H
/*
* Platform specific emulator setup
*/
#if (defined(_WIN32) || defined(__APPLE__) || defined(__linux__)) && !defined(__ANDROID__) && !defined(__EMSCRIPTEN__) && !defined(__RPI__)
# define RENDERER_OGL
# define USE_GLAD
#elif defined(__RPI__)
# define RENDERER_OGLES
# define OGLES_VERSION (3)
#elif defined(__EMSCRIPTEN__)
# define RENDERER_OGLES
# define OGLES_VERSION (2)
#elif defined(__ANDROID__)
# define RENDERER_OGLES
# define OGLES_VERSION (3)
#endif
#if defined(RENDERER_OGL) || defined(RENDERER_OGLES)
# define USE_OPENGL 1
#endif
#if OGLES_VERSION == 2
# define ES2_SHADERS
#elif OGLES_VERSION == 3
# define ES3_SHADERS
#endif
/*
* OpenGL
*/
#if defined (RENDERER_OGL)
# define GL_GLEXT_PROTOTYPES
# include "common/glad.h"
#elif defined (RENDERER_OGLES)
# define GL_GLEXT_PROTOTYPES
# ifdef __EMSCRIPTEN__
# include <GL/gl.h>
# else
# if OGLES_VERSION == 2
# include <GLES2/gl2.h>
# include <GLES2/gl2ext.h>
# elif OGLES_VERSION == 3
# include <GLES3/gl3.h>
# endif
# endif
# include <EGL/egl.h>
#endif
// setup renderer texture formats
#if defined(RENDERER_OGL)
# define TEXTURE_FORMAT GL_UNSIGNED_SHORT_1_5_5_5_REV
#elif defined(RENDERER_OGLES)
# define TEXTURE_FORMAT GL_UNSIGNED_SHORT_5_5_5_1
#endif
#include "psx/types.h"
#include "common/pgxp_defs.h"
#include "psx/libgte.h"
#include "psx/libgpu.h"
#include <stdio.h>
#include <stddef.h>
#ifndef NULL
#define NULL 0
#endif
/*
// FIXME: enable when needed
#if defined(RENDERER_OGLES)
# define glGenVertexArrays glGenVertexArraysOES
# define glBindVertexArray glBindVertexArrayOES
# define glDeleteVertexArrays glDeleteVertexArraysOES
#endif
*/
#if defined(RENDERER_OGL)
# define VRAM_FORMAT GL_RG
# define VRAM_INTERNAL_FORMAT GL_RG32F
#elif defined(RENDERER_OGLES)
# define VRAM_FORMAT GL_LUMINANCE_ALPHA
# define VRAM_INTERNAL_FORMAT GL_LUMINANCE_ALPHA
#endif
#define VRAM_WIDTH (1024)
#define VRAM_HEIGHT (512)
#define TPAGE_WIDTH (256)
#define TPAGE_HEIGHT (256)
#pragma pack(push,1)
typedef struct
{
#if defined(USE_PGXP)
float x, y, page, clut;
float z, scr_h, ofsX, ofsY;
#else
short x, y, page, clut;
#endif
u_char u, v, bright, dither;
u_char r, g, b, a;
char tcx, tcy, _p0, _p1;
} GrVertex;
#pragma pack(pop)
typedef enum
{
a_position,
a_zw,
a_texcoord,
a_color,
a_extra,
} ShaderAttrib;
typedef enum
{
BM_NONE,
BM_AVERAGE,
BM_ADD,
BM_SUBTRACT,
BM_ADD_QUATER_SOURCE
} BlendMode;
typedef enum
{
TF_4_BIT,
TF_8_BIT,
TF_16_BIT
} TexFormat;
#define MAX_NUM_POLY_BUFFER_VERTICES (32768)
#define MAX_NUM_INDEX_BUFFERS (4096)
#if defined(RENDERER_OGLES) || defined(RENDERER_OGL)
typedef uint TextureID;
typedef uint ShaderID;
#else
#error
#endif
#if defined(_LANGUAGE_C_PLUS_PLUS)||defined(__cplusplus)||defined(c_plusplus)
extern "C" {
#endif
extern TextureID g_whiteTexture;
extern TextureID g_vramTexture;
extern void GR_SwapWindow();
// PSX VRAM operations
extern void GR_SaveVRAM(const char* outputFileName, int x, int y, int width, int height, int bReadFromFrameBuffer);
extern void GR_CopyVRAM(unsigned short* src, int x, int y, int w, int h, int dst_x, int dst_y);
extern void GR_ReadVRAM(unsigned short* dst, int x, int y, int dst_w, int dst_h);
extern void GR_StoreFrameBuffer(int x, int y, int w, int h);
extern void GR_UpdateVRAM();
extern void GR_ReadFramebufferDataToVRAM();
extern TextureID GR_CreateRGBATexture(int width, int height, u_char* data /*= nullptr*/);
extern ShaderID GR_Shader_Compile(const char* source);
extern void GR_SetShader(const ShaderID shader);
extern void GR_Perspective3D(const float fov, const float width, const float height, const float zNear, const float zFar);
extern void GR_Ortho2D(float left, float right, float bottom, float top, float znear, float zfar);
extern void GR_SetBlendMode(BlendMode blendMode);
extern void GR_SetPolygonOffset(float ofs);
extern void GR_SetStencilMode(int drawPrim);
extern void GR_EnableDepth(int enable);
extern void GR_SetScissorState(int enable);
extern void GR_SetOffscreenState(const RECT16* offscreenRect, int enable);
extern void GR_SetupClipMode(const RECT16* clipRect, int enable);
extern void GR_SetViewPort(int x, int y, int width, int height);
extern void GR_SetTexture(TextureID texture, TexFormat texFormat);
extern void GR_SetWireframe(int enable);
extern void GR_DestroyTexture(TextureID texture);
extern void GR_Clear(int x, int y, int w, int h, unsigned char r, unsigned char g, unsigned char b);
extern void GR_ClearVRAM(int x, int y, int w, int h, unsigned char r, unsigned char g, unsigned char b);
extern void GR_UpdateVertexBuffer(const GrVertex* vertices, int count);
extern void GR_DrawTriangles(int start_vertex, int triangles);
#if defined(_LANGUAGE_C_PLUS_PLUS)||defined(__cplusplus)||defined(c_plusplus)
}
#endif
#endif

View File

@ -1,16 +0,0 @@
#ifndef PSYX_VERSION_H
#define PSYX_VERSION_H
/* Emulator version */
#define PSYX_MAJOR_VERSION (2)
#define PSYX_MINOR_VERSION (8)
/* Compile date and time */
#define PSYX_COMPILE_DATE (__DATE__)
#define PSYX_COMPILE_TIME (__TIME__)
/* Psy-Q version */
#define PSYQ_MAJOR_VERSION (4)
#define PSYQ_MINOR_VERSION (7)
#endif

File diff suppressed because it is too large Load Diff

View File

@ -1,36 +0,0 @@
#ifndef HALF_FLOAT
#define HALF_FLOAT
typedef struct half
{
unsigned short sh;
#if defined(_LANGUAGE_C_PLUS_PLUS)||defined(__cplusplus)||defined(c_plusplus)
half() {};
half(const float x);
half(const half& other);
operator float() const;
half& operator=(const half& other)
{
sh = other.sh;
return *this;
}
#endif
} half;
#if defined(_LANGUAGE_C_PLUS_PLUS)||defined(__cplusplus)||defined(c_plusplus)
extern "C" {
#endif
extern short to_half_float(const float x);
extern float from_half_float(const short x);
#if defined(_LANGUAGE_C_PLUS_PLUS)||defined(__cplusplus)||defined(c_plusplus)
}
#endif
#endif // HALF_FLOAT

View File

@ -1,75 +0,0 @@
#ifndef PGXP_DEFS_H
#define PGXP_DEFS_H
#ifdef USE_PGXP
#include "PsyX/common/half_float.h"
// Helpful macro
#define PGXP_LOOKUP_VALUE(x, y) (*(u_short*)&(x) | (*(u_short*)&(y) << 16))
//-------------------------------------
// in C++, VERTTYPE can be declared as half
#if defined(_LANGUAGE_C_PLUS_PLUS)||defined(__cplusplus)||defined(c_plusplus)
typedef half VERTTYPE;
#else
typedef short VERTTYPE;
#endif
typedef struct
{
float px, py, pz; // 32 bit values
VERTTYPE x, y, z; // 16 bit values (for lookup and backwards compat if not found in cache)
} PGXPVector3D;
typedef struct
{
uint lookup;
float px;
float py;
float pz;
float scr_h;
float ofx;
float ofy;
} PGXPVData;
#if defined(_LANGUAGE_C_PLUS_PLUS)||defined(__cplusplus)||defined(c_plusplus)
extern "C" {
#endif
extern PGXPVector3D g_FP_SXYZ0; // direct access PGXP without table lookup
extern PGXPVector3D g_FP_SXYZ1;
extern PGXPVector3D g_FP_SXYZ2;
/* clears PGXP vertex buffer */
void PGXP_ClearCache();
/* emits new PGXP vertex */
ushort PGXP_EmitCacheData(PGXPVData* newData);
/* sets Z offset (works like Z bias) */
void PGXP_SetZOffsetScale(float offset, float scale);
/* searches for vertex with given lookup value */
int PGXP_GetCacheData(PGXPVData* out, uint lookup, ushort indexhint /* = 0xFFFF */);
/* used by primitive setup */
ushort PGXP_GetIndex();
#if defined(_LANGUAGE_C_PLUS_PLUS)||defined(__cplusplus)||defined(c_plusplus)
}
#endif
// special PGXP type
typedef struct { /* 2D short vector */
half vx, vy;
ushort pgxp_index;
} DVECTORF;
#else
typedef short VERTTYPE;
#endif
#endif // PGXP_DEFS

View File

@ -1,30 +0,0 @@
#ifndef UTIL_TIMER_H
#define UTIL_TIMER_H
#ifdef _WIN32
#include <stdint.h>
#else
#include <sys/time.h>
#endif
typedef struct
{
#ifdef _WIN32
uint64_t clockStart;
#else
struct timeval timeStart;
#endif // _WIN32
} timerCtx_t;
#if defined(_LANGUAGE_C_PLUS_PLUS)||defined(__cplusplus)||defined(c_plusplus)
extern "C" {
#endif
extern void Util_InitHPCTimer(timerCtx_t* timer);
extern double Util_GetHPCTime(timerCtx_t* timer, int reset /*= 0*/);
#if defined(_LANGUAGE_C_PLUS_PLUS)||defined(__cplusplus)||defined(c_plusplus)
}
#endif
#endif

View File

@ -1,18 +0,0 @@
#ifndef ABS_H
#define ABS_H
#ifndef ABS
#define ABS(x) fst_abs(x)
#endif
#if defined(_LANGUAGE_C_PLUS_PLUS)||defined(__cplusplus)||defined(c_plusplus)
extern "C" {
#endif
extern int fst_abs(int x);
#if defined(_LANGUAGE_C_PLUS_PLUS)||defined(__cplusplus)||defined(c_plusplus)
}
#endif
#endif

View File

@ -1,12 +0,0 @@
#ifndef ASM_H
#define ASM_H
/*
This header must be empty
*/
#define NREGS 40
#endif

View File

@ -1,360 +0,0 @@
#ifndef GTEMAC_H
#define GTEMAC_H
/*
* GTE inline functions(Simple)
*/
#define gte_RotTransPers(r1,r2,r3,r4,r5) \
{ gte_ldv0(r1); \
gte_rtps(); \
gte_stsxy(r2); \
gte_stdp(r3); \
gte_stflg(r4); \
gte_stszotz(r5); }
#define gte_RotTransPers3(r1,r2,r3,r4,r5,r6,r7,r8,r9) \
{ gte_ldv3(r1,r2,r3); \
gte_rtpt(); \
gte_stsxy3(r4,r5,r6); \
gte_stdp(r7); \
gte_stflg(r8); \
gte_stszotz(r9); }
#define gte_RotTrans(r1,r2,r3) \
{ gte_ldv0(r1); \
gte_rt(); \
gte_stlvnl(r2); \
gte_stflg(r3); }
#define gte_LocalLight(r1,r2) \
{ gte_ldv0(r1); \
gte_ll(); \
gte_stlvl(r2); }
#define gte_LightColor(r1,r2) \
{ gte_ldlvl(r1); \
gte_lc(); \
gte_stlvl(r2); }
#define gte_DpqColorLight(r1,r2,r3,r4) \
{ gte_ldlvl(r1); \
gte_ldrgb(r2); \
gte_lddp(r3); \
gte_dpcl(); \
gte_strgb(r4); }
#define gte_DpqColor(r1,r2,r3) \
{ gte_ldrgb(r1); \
gte_lddp(r2); \
gte_dpcs(); \
gte_strgb(r3); }
#define gte_DpqColor3(r1,r2,r3,r4,r5,r6,r7) \
{ gte_ldrgb3(r1,r2,r3); \
gte_lddp(r4); \
gte_dpct(); \
gte_strgb3(r5,r6,r7); }
#define gte_Intpl(r1,r2,r3) \
{ gte_ldlvl(r1); \
gte_lddp(r2); \
gte_intpl(); \
gte_strgb(r3); }
#define gte_Square12(r1,r2) \
{ gte_ldlvl(r1); \
gte_sqr12(); \
gte_stlvnl(r2); }
#define gte_Square0(r1,r2) \
{ gte_ldlvl(r1); \
gte_sqr0(); \
gte_stlvnl(r2); }
#define gte_NormalColor(r1,r2) \
{ gte_ldv0(r1); \
gte_ncs(); \
gte_strgb(r2); }
#define gte_NormalColor3(r1,r2,r3,r4,r5,r6) \
{ gte_ldv3(r1,r2,r3); \
gte_nct(); \
gte_strgb3(r4,r5,r6); }
#define gte_NormalColorDpq(r1,r2,r3,r4) \
{ gte_ldv0(r1); \
gte_ldrgb(r2); \
gte_lddp(r3); \
gte_ncds(); \
gte_strgb(r4); }
#define gte_NormalColorDpq3(r1,r2,r3,r4,r5,r6,r7,r8) \
{ gte_ldv3(r1,r2,r3); \
gte_ldrgb(r4); \
gte_lddp(r5); \
gte_ncdt(); \
gte_strgb3(r6,r7,r8); }
#define gte_NormalColorCol(r1,r2,r3) \
{ gte_ldv0(r1); \
gte_ldrgb(r2); \
gte_nccs(); \
gte_strgb(r3); }
#define gte_NormalColorCol3(r1,r2,r3,r4,r5,r6,r7) \
{ gte_ldv3(r1,r2,r3); \
gte_ldrgb(r4); \
gte_ncct(); \
gte_strgb3(r5,r6,r7); }
#define gte_ColorDpq(r1,r2,r3,r4) \
{ gte_ldlvl(r1); \
gte_ldrgb(r2); \
gte_lddp(r3); \
gte_cdp(); \
gte_strgb(r4); }
#define gte_ColorCol(r1,r2,r3) \
{ gte_ldlvl(r1); \
gte_ldrgb(r2); \
gte_cc(); \
gte_strgb(r3); }
#define gte_NormalClip(r1,r2,r3,r4) \
{ gte_ldsxy3(r1,r2,r3); \
gte_nclip(); \
gte_stopz(r4); }
#define gte_AverageZ3(r1,r2,r3,r4) \
{ gte_ldsz3(r1,r2,r3); \
gte_avsz3(); \
gte_stotz(r4); }
#define gte_AverageZ4(r1,r2,r3,r4,r5) \
{ gte_ldsz4(r1,r2,r3,r4); \
gte_avsz4(); \
gte_stotz(r5); }
#define gte_OuterProduct12(r1,r2,r3) \
{ gte_ldopv1(r1); \
gte_ldopv2(r2); \
gte_op12(); \
gte_stlvnl(r3); }
#define gte_OuterProduct0(r1,r2,r3) \
{ gte_ldopv1(r1); \
gte_ldopv2(r2); \
gte_op0(); \
gte_stlvnl(r3); }
#define gte_OuterProduct12SVL(r1,r2,r3) \
{ gte_ldopv1SV(r1); \
gte_ldopv2SV(r2); \
gte_op12(); \
gte_stlvnl(r3); }
#define gte_OuterProduct0SVL(r1,r2,r3) \
{ gte_ldopv1SV(r1); \
gte_ldopv2SV(r2); \
gte_op0(); \
gte_stlvnl(r3); }
#define gte_OuterProduct12SV(r1,r2,r3) \
{ gte_ldopv1SV(r1); \
gte_ldopv2SV(r2); \
gte_op12(); \
gte_stsv(r3); }
#define gte_OuterProduct0SV(r1,r2,r3) \
{ gte_ldopv1SV(r1); \
gte_ldopv2SV(r2); \
gte_op0(); \
gte_stsv(r3); }
#define gte_Lzc(r1,r2) \
{ gte_ldlzc(r1); \
gte_nop(); \
gte_nop(); \
gte_stlzc(r2); }
/*
* GTE inline functions(Combination)
* 4 vertices functions can't be replaced by equivalent macros
* because they use OR of flags after rtpt & rtps
* Please write directry in your program.
*/
#define gte_RotAverage3(r1,r2,r3,r4,r5,r6,r7,r8,r9) \
{ gte_ldv3(r1,r2,r3); \
gte_rtpt(); \
gte_stsxy3(r4,r5,r6); \
gte_stdp(r7); \
gte_stflg(r8); \
gte_avsz3(); \
gte_stotz(r9); }
#define gte_RotNclip3(r1,r2,r3,r4,r5,r6,r7,r8,r9,r10) \
{ gte_ldv3(r1,r2,r3); \
gte_rtpt(); \
gte_stflg(r9); \
gte_nclip(); \
gte_stopz(r10); \
gte_stsxy3(r4,r5,r6); \
gte_stdp(r7); \
gte_stszotz(r8); }
#define gte_RotAverageNclip3(r1,r2,r3,r4,r5,r6,r7,r8,r9,r10) \
{ gte_ldv3(r1,r2,r3); \
gte_rtpt(); \
gte_stflg(r9); \
gte_nclip(); \
gte_stopz(r10); \
gte_stsxy3(r4,r5,r6); \
gte_stdp(r7); \
gte_avsz3(); \
gte_stotz(r8); }
#define gte_RotColorDpq(r1,r2,r3,r4,r5,r6,r7) \
{ gte_ldv0(r1); \
gte_rtps(); \
gte_stsxy(r4); \
gte_stflg(r6); \
gte_ldv0(r2); \
gte_ldrgb(r3); \
gte_ncds(); \
gte_strgb(r5); \
gte_stszotz(r7); }
#define gte_RotColorDpq3(r1,r2,r3,r4,r5,r6,r7,r8,r9,r10,r11,r12,r13,r14,r15) \
{ gte_ldv3(r1,r2,r3); \
gte_rtpt(); \
gte_stsxy3(r8,r9,r10); \
gte_stflg(r14); \
gte_ldv3(r4,r5,r6); \
gte_ldrgb(r7); \
gte_ncdt(); \
gte_strgb3(r11,r12,r13);\
gte_stszotz(r15); }
#define gte_RotAverageNclipColorDpq3(r1,r2,r3,r4,r5,r6,r7,r8,r9,r10,r11,r12,r13,r14,r15,r16) \
{ gte_ldv3(r1,r2,r3); \
gte_rtpt(); \
gte_stflg(r15); \
gte_nclip(); \
gte_stopz(r16); \
gte_ldv3(r4,r5,r6); \
gte_ldrgb(r7); \
gte_ncdt(); \
gte_stsxy3(r8,r9,r10); \
gte_strgb3(r11,r12,r13);\
gte_avsz3(); \
gte_stotz(r14); }
#define gte_RotAverageNclipColorCol3(r1,r2,r3,r4,r5,r6,r7,r8,r9,r10,r11,r12,r13,r14,r15,r16) \
{ gte_ldv3(r1,r2,r3); \
gte_rtpt(); \
gte_stflg(r15); \
gte_nclip(); \
gte_stopz(r16); \
gte_ldv3(r4,r5,r6); \
gte_ldrgb(r7); \
gte_ncct(); \
gte_stsxy3(r8,r9,r10); \
gte_strgb3(r11,r12,r13);\
gte_avsz3(); \
gte_stotz(r14); }
#define gte_LoadAverage12(r1,r2,r3,r4,r5) \
{ gte_lddp(r3); \
gte_ldlvl(r1); \
gte_gpf12(); \
gte_lddp(r4); \
gte_ldlvl(r2); \
gte_gpl12(); \
gte_stlvl(r5); }
#define gte_LoadAverage0(r1,r2,r3,r4,r5) \
{ gte_lddp(r3); \
gte_ldlvl(r1); \
gte_gpf0(); \
gte_lddp(r4); \
gte_ldlvl(r2); \
gte_gpl0(); \
gte_stlvl(r5); }
#define gte_LoadAverageShort12(r1,r2,r3,r4,r5) \
{ gte_lddp(r3); \
gte_ldsv(r1); \
gte_gpf12(); \
gte_lddp(r4); \
gte_ldsv(r2); \
gte_gpl12(); \
gte_stsv(r5); }
#define gte_LoadAverageShort0(r1,r2,r3,r4,r5) \
{ gte_lddp(r3); \
gte_ldsv(r1); \
gte_gpf0(); \
gte_lddp(r4); \
gte_ldsv(r2); \
gte_gpl0(); \
gte_stsv(r5); }
#define gte_LoadAverageByte(r1,r2,r3,r4,r5) \
{ gte_lddp(r3); \
gte_ldbv(r1); \
gte_gpf12(); \
gte_lddp(r4); \
gte_ldbv(r2); \
gte_gpl12(); \
gte_stbv(r5); }
#define gte_LoadAverageCol(r1,r2,r3,r4,r5) \
{ gte_lddp(r3); \
gte_ldcv(r1); \
gte_gpf12(); \
gte_lddp(r4); \
gte_ldcv(r2); \
gte_gpl12(); \
gte_stcv(r5); }
/*
*
*/
#define gte_MulMatrix0(r1,r2,r3) \
{ gte_SetRotMatrix(r1); \
gte_ldclmv(r2); \
gte_rtir(); \
gte_stclmv(r3); \
gte_ldclmv((char*)r2+2);\
gte_rtir(); \
gte_stclmv((char*)r3+2);\
gte_ldclmv((char*)r2+4);\
gte_rtir(); \
gte_stclmv((char*)r3+4); }
#define gte_ApplyMatrix(r1,r2,r3) \
{ gte_SetRotMatrix(r1); \
gte_ldv0(r2); \
gte_rtv0(); \
gte_stlvnl(r3); }
#define gte_ApplyMatrixSV(r1,r2,r3) \
{ gte_SetRotMatrix(r1); \
gte_ldv0(r2); \
gte_rtv0(); \
gte_stsv(r3); }
#define gte_CompMatrix(r1,r2,r3) \
{ gte_MulMatrix0(r1,r2,r3);\
gte_SetTransMatrix(r1); \
gte_ldlv0((char*)r2+20);\
gte_rt(); \
gte_stlvnl((char*)r3+20); }
#define gte_ApplyRotMatrix(r1,r2) \
{ gte_ldv0(r1); \
gte_rtv0(); \
gte_stlvnl(r2); }
#endif

View File

@ -1,222 +0,0 @@
#ifndef GTEREG_H
#define GTEREG_H
#ifdef Status
// Fix for stupid GLES headers in RPI or MESA, whatever... just get rid of this dumb shit
#undef Status
#endif
typedef union
{
struct { unsigned char l, h, h2, h3; } b;
struct { unsigned short l, h; } w;
struct { char l, h, h2, h3; } sb;
struct { short l, h; } sw;
unsigned int d;
int sd;
} PAIR;
typedef struct {
unsigned char r, g, b, c;
} CBGR;
typedef struct {
short x, y, z, pad;
} SVector3D;
typedef struct {
short x, y;
} SVector2D;
typedef struct {
short z, pad;
} SVector2Dz;
typedef struct {
short m11, m12, m13, m21, m22, m23, m31, m32, m33, pad;
} SMatrix3D;
typedef union
{
struct
{
SVector3D v0, v1, v2;
CBGR rgb;
int otz;
int ir0, ir1, ir2, ir3;
SVector2D sxy0, sxy1, sxy2, sxyp;
SVector2Dz sz0, sz1, sz2, sz3;
CBGR rgb0, rgb1, rgb2;
int reserved;
int mac0, mac1, mac2, mac3;
unsigned int irgb, orgb;
int lzcs, lzcr;
} n;
unsigned int r[32];
PAIR p[32];
} psxCP2Data;
typedef union
{
struct {
SMatrix3D rMatrix;
int trX, trY, trZ;
SMatrix3D lMatrix;
int rbk, gbk, bbk;
SMatrix3D cMatrix;
int rfc, gfc, bfc;
int ofx, ofy;
int h;
int dqa, dqb;
int zsf3, zsf4;
int flag;
} n;
unsigned int r[32];
PAIR p[32];
} psxCP2Ctrl;
typedef union {
struct {
unsigned int Index, Random, EntryLo0, BPC,
Context, BDA, PIDMask, DCIC,
BadVAddr, BDAM, EntryHi, BPCM,
Status, Cause, EPC, PRid,
Config, LLAddr, WatchLO, WatchHI,
XContext, Reserved1, Reserved2, Reserved3,
Reserved4, Reserved5, ECC, CacheErr,
TagLo, TagHi, ErrorEPC, Reserved6;
} n;
unsigned int r[32];
} psxCP0Regs;
typedef struct
{
psxCP0Regs CP0; /* Coprocessor0 Registers */
psxCP2Data CP2D; /* Cop2 data registers */
psxCP2Ctrl CP2C; /* Cop2 control registers */
} GTERegisters;
#if defined(_LANGUAGE_C_PLUS_PLUS)||defined(__cplusplus)||defined(c_plusplus)
extern "C" {
#endif
extern GTERegisters gteRegs;
extern int GTE_operator(int);
extern int LIM(int value, int max, int min, unsigned int flag);
#if defined(_LANGUAGE_C_PLUS_PLUS)||defined(__cplusplus)||defined(c_plusplus)
}
#endif
/* Data Registers mtc2 mfc2 */
#define C2_VX0 (gteRegs.CP2D.p[ 0 ].sw.l)
#define C2_VY0 (gteRegs.CP2D.p[ 0 ].sw.h)
#define C2_VZ0 (gteRegs.CP2D.p[ 1 ].sw.l)
#define C2_VX1 (gteRegs.CP2D.p[ 2 ].w.l)
#define C2_VY1 (gteRegs.CP2D.p[ 2 ].w.h)
#define C2_VZ1 (gteRegs.CP2D.p[ 3 ].w.l)
#define C2_VX2 (gteRegs.CP2D.p[ 4 ].w.l)
#define C2_VY2 (gteRegs.CP2D.p[ 4 ].w.h)
#define C2_VZ2 (gteRegs.CP2D.p[ 5 ].w.l)
#define C2_R (gteRegs.CP2D.p[ 6 ].b.l)
#define C2_G (gteRegs.CP2D.p[ 6 ].b.h)
#define C2_B (gteRegs.CP2D.p[ 6 ].b.h2)
#define C2_CODE (gteRegs.CP2D.p[ 6 ].b.h3)
#define C2_OTZ (gteRegs.CP2D.p[ 7 ].w.l)
#define C2_IR0 (gteRegs.CP2D.p[ 8 ].sw.l)
#define C2_IR1 (gteRegs.CP2D.p[ 9 ].sw.l)
#define C2_IR2 (gteRegs.CP2D.p[ 10 ].sw.l)
#define C2_IR3 (gteRegs.CP2D.p[ 11 ].sw.l)
#define C2_SXY0 (gteRegs.CP2D.p[ 12 ].d)
#define C2_SX0 (gteRegs.CP2D.p[ 12 ].sw.l)
#define C2_SY0 (gteRegs.CP2D.p[ 12 ].sw.h)
#define C2_SXY1 (gteRegs.CP2D.p[ 13 ].d)
#define C2_SX1 (gteRegs.CP2D.p[ 13 ].sw.l)
#define C2_SY1 (gteRegs.CP2D.p[ 13 ].sw.h)
#define C2_SXY2 (gteRegs.CP2D.p[ 14 ].d)
#define C2_SX2 (gteRegs.CP2D.p[ 14 ].sw.l)
#define C2_SY2 (gteRegs.CP2D.p[ 14 ].sw.h)
#define C2_SXYP (gteRegs.CP2D.p[ 15 ].d)
#define C2_SXP (gteRegs.CP2D.p[ 15 ].sw.l)
#define C2_SYP (gteRegs.CP2D.p[ 15 ].sw.h)
#define C2_SZ0 (gteRegs.CP2D.p[ 16 ].w.l)
#define C2_SZ1 (gteRegs.CP2D.p[ 17 ].w.l)
#define C2_SZ2 (gteRegs.CP2D.p[ 18 ].w.l)
#define C2_SZ3 (gteRegs.CP2D.p[ 19 ].w.l)
#define C2_RGB0 (gteRegs.CP2D.p[ 20 ].d)
#define C2_R0 (gteRegs.CP2D.p[ 20 ].b.l)
#define C2_G0 (gteRegs.CP2D.p[ 20 ].b.h)
#define C2_B0 (gteRegs.CP2D.p[ 20 ].b.h2)
#define C2_CD0 (gteRegs.CP2D.p[ 20 ].b.h3)
#define C2_RGB1 (gteRegs.CP2D.p[ 21 ].d)
#define C2_R1 (gteRegs.CP2D.p[ 21 ].b.l)
#define C2_G1 (gteRegs.CP2D.p[ 21 ].b.h)
#define C2_B1 (gteRegs.CP2D.p[ 21 ].b.h2)
#define C2_CD1 (gteRegs.CP2D.p[ 21 ].b.h3)
#define C2_RGB2 (gteRegs.CP2D.p[ 22 ].d)
#define C2_R2 (gteRegs.CP2D.p[ 22 ].b.l)
#define C2_G2 (gteRegs.CP2D.p[ 22 ].b.h)
#define C2_B2 (gteRegs.CP2D.p[ 22 ].b.h2)
#define C2_CD2 (gteRegs.CP2D.p[ 22 ].b.h3)
#define C2_RES1 (gteRegs.CP2D.p[ 23 ].d)
#define C2_MAC0 (gteRegs.CP2D.p[ 24 ].sd)
#define C2_MAC1 (gteRegs.CP2D.p[ 25 ].sd)
#define C2_MAC2 (gteRegs.CP2D.p[ 26 ].sd)
#define C2_MAC3 (gteRegs.CP2D.p[ 27 ].sd)
#define C2_IRGB (gteRegs.CP2D.p[ 28 ].d)
#define C2_ORGB (gteRegs.CP2D.p[ 29 ].d)
#define C2_LZCS (gteRegs.CP2D.p[ 30 ].d)
#define C2_LZCR (gteRegs.CP2D.p[ 31 ].d)
/* Control Registers ctc2 cfc2*/
#define C2_R11 (gteRegs.CP2C.p[ 0 ].sw.l)
#define C2_R12 (gteRegs.CP2C.p[ 0 ].sw.h)
#define C2_R13 (gteRegs.CP2C.p[ 1 ].sw.l)
#define C2_R21 (gteRegs.CP2C.p[ 1 ].sw.h)
#define C2_R22 (gteRegs.CP2C.p[ 2 ].sw.l)
#define C2_R23 (gteRegs.CP2C.p[ 2 ].sw.h)
#define C2_R31 (gteRegs.CP2C.p[ 3 ].sw.l)
#define C2_R32 (gteRegs.CP2C.p[ 3 ].sw.h)
#define C2_R33 (gteRegs.CP2C.p[ 4 ].sw.l)
#define C2_TRX (gteRegs.CP2C.p[ 5 ].sd)
#define C2_TRY (gteRegs.CP2C.p[ 6 ].sd)
#define C2_TRZ (gteRegs.CP2C.p[ 7 ].sd)
#define C2_L11 (gteRegs.CP2C.p[ 8 ].sw.l)
#define C2_L12 (gteRegs.CP2C.p[ 8 ].sw.h)
#define C2_L13 (gteRegs.CP2C.p[ 9 ].sw.l)
#define C2_L21 (gteRegs.CP2C.p[ 9 ].sw.h)
#define C2_L22 (gteRegs.CP2C.p[ 10 ].sw.l)
#define C2_L23 (gteRegs.CP2C.p[ 10 ].sw.h)
#define C2_L31 (gteRegs.CP2C.p[ 11 ].sw.l)
#define C2_L32 (gteRegs.CP2C.p[ 11 ].sw.h)
#define C2_L33 (gteRegs.CP2C.p[ 12 ].sw.l)
#define C2_RBK (gteRegs.CP2C.p[ 13 ].sd)
#define C2_GBK (gteRegs.CP2C.p[ 14 ].sd)
#define C2_BBK (gteRegs.CP2C.p[ 15 ].sd)
#define C2_LR1 (gteRegs.CP2C.p[ 16 ].sw.l)
#define C2_LR2 (gteRegs.CP2C.p[ 16 ].sw.h)
#define C2_LR3 (gteRegs.CP2C.p[ 17 ].sw.l)
#define C2_LG1 (gteRegs.CP2C.p[ 17 ].sw.h)
#define C2_LG2 (gteRegs.CP2C.p[ 18 ].sw.l)
#define C2_LG3 (gteRegs.CP2C.p[ 18 ].sw.h)
#define C2_LB1 (gteRegs.CP2C.p[ 19 ].sw.l)
#define C2_LB2 (gteRegs.CP2C.p[ 19 ].sw.h)
#define C2_LB3 (gteRegs.CP2C.p[ 20 ].sw.l)
#define C2_RFC (gteRegs.CP2C.p[ 21 ].sd)
#define C2_GFC (gteRegs.CP2C.p[ 22 ].sd)
#define C2_BFC (gteRegs.CP2C.p[ 23 ].sd)
#define C2_OFX (gteRegs.CP2C.p[ 24 ].sd)
#define C2_OFY (gteRegs.CP2C.p[ 25 ].sd)
#define C2_H (gteRegs.CP2C.p[ 26 ].sw.l)
#define C2_DQA (gteRegs.CP2C.p[ 27 ].sw.l)
#define C2_DQB (gteRegs.CP2C.p[ 28 ].sd)
#define C2_ZSF3 (gteRegs.CP2C.p[ 29 ].sw.l)
#define C2_ZSF4 (gteRegs.CP2C.p[ 30 ].sw.l)
#define C2_FLAG (gteRegs.CP2C.p[ 31 ].d)
#endif

View File

@ -1,719 +0,0 @@
#ifndef INLINE_C_H
#define INLINE_C_H
#if defined(_LANGUAGE_C_PLUS_PLUS)||defined(__cplusplus)||defined(c_plusplus)
extern "C" {
#endif
/* Psy-X specific calls */
/* sets cop2 data register value. LWC2 is the same kind*/
extern void MTC2(unsigned int value, int reg);
extern void MTC2_S(int value, int reg);
/* sets cop2 control register value */
extern void CTC2(unsigned int value, int reg);
extern void CTC2_S(int value, int reg);
/* returns cop2 register value. SWC2 is the same kind */
extern unsigned int MFC2(int reg);
extern int MFC2_S(int reg);
/* returns cop2 control register value */
extern unsigned int CFC2(int reg);
extern int CFC2_S(int reg);
/* performs cop2 opcode */
extern int doCOP2(int op);
#if defined(_LANGUAGE_C_PLUS_PLUS)||defined(__cplusplus)||defined(c_plusplus)
}
#endif
/*
* Type 1 functions
*/
// ctc2 21-23
#define gte_ldfc( r0 ) \
{ CTC2(*(uint*)((char*)r0+0), 21);\
CTC2(*(uint*)((char*)r0+4), 22);\
CTC2(*(uint*)((char*)r0+8), 23);}
// mtc2 0-1
#define gte_ldv0( r0 )\
{ MTC2(*(uint*)((char*)r0+0), 0);\
MTC2(*(uint*)((char*)r0+4), 1);}
// mtc2 2-3
#define gte_ldv1( r0 )\
{ MTC2(*(uint*)((char*)r0+0), 2);\
MTC2(*(uint*)((char*)r0+4), 3);}
// mtc2 4-5
#define gte_ldv2( r0 )\
{ MTC2(*(uint*)((char*)r0+0), 4);\
MTC2(*(uint*)((char*)r0+4), 5);}
// mtc2 0-5
#define gte_ldv3( r0, r1, r2 ) \
{ MTC2(*(uint*)((char*)r0+0), 0);\
MTC2(*(uint*)((char*)r0+4), 1);\
MTC2(*(uint*)((char*)r1+0), 2);\
MTC2(*(uint*)((char*)r1+4), 3);\
MTC2(*(uint*)((char*)r2+0), 4);\
MTC2(*(uint*)((char*)r2+4), 5);}
// load mtc2 9,10,11
#define gte_ldclmv( r0 ) \
{ MTC2(*(ushort*)((char*)r0), 9); \
MTC2(*(ushort*)((char*)r0+6), 10); \
MTC2(*(ushort*)((char*)r0+12), 11); }
// lwc2 9-11
#define gte_ldlvl( r0 ) \
{ MTC2(*(uint*)((char*)r0), 9); \
MTC2(*(uint*)((char*)r0 + 4), 10);\
MTC2(*(uint*)((char*)r0 + 8), 11);}
// mtc2 9,10,11
#define gte_ldsv( r0 ) \
{ MTC2((*(ushort*)((char*)r0), 9);\
MTC2((*(ushort*)((char*)r0 + 2), 10);\
MTC2((*(ushort*)((char*)r0 + 4), 11); }
// mtc2 9,10
#define gte_ldbv( r0 ) \
{ MTC2(*((char*)r0), 9);\
MTC2(*((char*)r0 + 1), 10); }
// mtc2 9,10,11
#define gte_ldcv( r0 ) \
{ MTC2((*((char*)r0), 9);\
MTC2((*((char*)r0 + 1), 10);\
MTC2((*((char*)r0 + 2), 11); }
// lwc2 6
#define gte_ldrgb( r0 ) \
{ MTC2(*(uint*)((char*)r0), 6); }
// lwc2 6,20,21,22
#define gte_ldrgb3( r0, r1, r2 ) \
{ MTC2(*(uint*)((char*)r0), 20); \
MTC2(*(uint*)((char*)r1), 21); \
MTC2(*(uint*)((char*)r2), 22); \
MTC2(*(uint*)((char*)r2), 6); }
// mtc2 0, lwc2 1
#define gte_ldlv0( r0 ) \
{ MTC2((*(ushort*)((char*)r0 + 4) << 16) | *(ushort*)((char*)r0));\
MTC2(*(ushort*)((char*)r0 + 8) << 16); }
// mtc2 8
#define gte_lddp( r0 ) \
{ MTC2(*(uint*)r0, 8); }
// ctc2 13 14 15
#define gte_ldbkdir( r0, r1, r2 ) \
{ CTC2(r0, 13); \
CTC2(r1, 14); \
CTC2(r2, 15); }
// mtc2 12,13,14
#define gte_ldsxy3( r0, r1, r2 )\
{ MTC2(*(uint*)r0, 12); \
MTC2(*(uint*)r2, 14); \
MTC2(*(uint*)r1, 13); }
// mtc2 12,13,14
#define gte_ldsxy3c( r0 ) \
{ MTC2(*(uint*)((char*)r0+0), 12 ); \
MTC2(*(uint*)((char*)r0+4), 13 ); \
MTC2(*(uint*)((char*)r0+8), 14 ); }
// mtc2 17,18,19
#define gte_ldsz3( r0, r1, r2 ) \
{ MTC2(*(uint*)((char*)r0), 17 ); \
MTC2(*(uint*)((char*)r1), 18 ); \
MTC2(*(uint*)((char*)r2), 19 ); }
// mtc2 16,17,18,19
#define gte_ldsz4( r0, r1, r2, r3 ) \
{ MTC2(*(uint*)((char*)r0), 16 ); \
MTC2(*(uint*)((char*)r1), 17 ); \
MTC2(*(uint*)((char*)r2), 18 ); \
MTC2(*(uint*)((char*)r3), 19 ); }
// ctc2 0,2,4
#define gte_ldopv1( r0 ) \
{ CTC2(*(uint*)((char*)r0), 0);\
CTC2(*(uint*)((char*)r0 + 4), 2);\
CTC2(*(uint*)((char*)r0 + 8), 4);}
// lwc2 9,10,11
#define gte_ldopv2( r0 ) \
{ MTC2(*(uint*)((char*)r0), 9);\
MTC2(*(uint*)((char*)r0 + 4), 10);\
MTC2(*(uint*)((char*)r0 + 8), 11);}
// ctc2 26
#define gte_SetGeomScreen( r0 ) \
{ CTC2(r0, 26); }
// ctc2 24,25
#define gte_SetGeomOffset( r0, r1 )\
{ CTC2(r0 << 16, 24); \
CTC2(r1 << 16, 25);}
// ctc2 13,14,15
#define gte_SetBackColor( r0, r1, r2 ) \
{ CTC2(r0 << 4, 13); \
CTC2(r1 << 4, 14); \
CTC2(r2 << 4, 15); }
// ctc2 21, 22, 23
#define gte_SetFarColor( r0, r1, r2 ) \
{ CTC2(r0 << 4, 21); \
CTC2(r1 << 4, 22); \
CTC2(r2 << 4, 23); }
// load ctc2 8-11
#define gte_SetLightMatrix( r0 ) \
{ CTC2(*(uint*)((char*)r0), 8);\
CTC2(*(uint*)((char*)r0+4), 9);\
CTC2(*(uint*)((char*)r0+8), 10);\
CTC2(*(uint*)((char*)r0+12), 11);\
CTC2(*(uint*)((char*)r0+16), 12);}
// load ctc2 16-20
#define gte_SetColorMatrix( r0 ) \
{ CTC2(*(uint*)((char*)r0), 16);\
CTC2(*(uint*)((char*)r0+4), 17);\
CTC2(*(uint*)((char*)r0+8), 18);\
CTC2(*(uint*)((char*)r0+12), 19);\
CTC2(*(uint*)((char*)r0+16), 20);}
// load ctc2 0-4
#define gte_SetRotMatrix( r0 ) \
{ CTC2(*(uint*)((char*)r0), 0);\
CTC2(*(uint*)((char*)r0+4), 1);\
CTC2(*(uint*)((char*)r0+8), 2);\
CTC2(*(uint*)((char*)r0+12), 3);\
CTC2(*(uint*)((char*)r0+16), 4);}
// load ctc2 5-7
#define gte_SetTransVector( r0 )\
{ CTC2_S(*(int*)((char*)r0+0), 5);\
CTC2_S(*(int*)((char*)r0+4), 6);\
CTC2_S(*(int*)((char*)r0+8), 7);}
// load ctc2 5-7
#define gte_SetTransMatrix( r0 ) \
{ CTC2(*(uint*)((char*)r0+20), 5);\
CTC2(*(uint*)((char*)r0+24), 6);\
CTC2(*(uint*)((char*)r0+28), 7);}
// ctc2 8-12
#define gte_SetLightMatrix( r0 )\
{ CTC2(*(uint*)((char*)r0), 8);\
CTC2(*(uint*)((char*)r0+4), 9);\
CTC2(*(uint*)((char*)r0+8), 10);\
CTC2(*(uint*)((char*)r0+12), 11);\
CTC2(*(uint*)((char*)r0+16), 12);}
// ctc2 16-20
#define gte_SetColorMatrix( r0 )\
{ CTC2(*(uint*)((char*)r0), 16);\
CTC2(*(uint*)((char*)r0+4), 17);\
CTC2(*(uint*)((char*)r0+8), 18);\
CTC2(*(uint*)((char*)r0+12), 19);\
CTC2(*(uint*)((char*)r0+16), 20);}
// mtc2 9,10,11
#define gte_ldopv2SV( r0 ) \
{ MTC2(*(ushort*)((char*)r0), 9);\
MTC2(*(ushort*)((char*)r0 + 2), 10);\
MTC2(*(ushort*)((char*)r0 + 4), 11);}
// ctc2 0,2,4
#define gte_ldopv1SV( r0 )\
{ CTC2(*(ushort*)((char*)r0), 0);\
CTC2(*(ushort*)((char*)r0 + 2), 2);\
CTC2(*(ushort*)((char*)r0 + 4), 4);}
// mtc2 30
#define gte_ldlzc( r0 ) \
MTC2(*(uint*)((char*)r0), 30);
/*
* Type 2 functions
*/
// FIXME: there is lack of some macros
// please refer to official Psy-Q PSX SDK headers
// and this: https://github.com/ogamespec/pops-gte/blob/master/docs/gte.txt
#define gte_nop()
#define gte_rtps() doCOP2(0x0180001);
#define gte_rtpt() doCOP2(0x0280030);
#define gte_rt() doCOP2(0x0480012);
#define gte_rtv0() doCOP2(0x0486012);
#define gte_rtv1() doCOP2(0x048E012);
#define gte_rtv2() doCOP2(0x0496012);
#define gte_rtir() doCOP2(0x049E012);
#define gte_rtir_sf0() doCOP2(0x041E012);
#define gte_rtv0tr() doCOP2(0x0480012);
#define gte_rtv1tr() doCOP2(0x0488012);
#define gte_rtv2tr() doCOP2(0x0490012);
#define gte_rtirtr() op2 0x0498012);
#define gte_rtv0bk() doCOP2(0x0482012);
#define gte_rtv1bk() doCOP2(0x048A012);
#define gte_rtv2bk() doCOP2(0x0492012);
#define gte_rtirbk() doCOP2(0x049A012);
#define gte_ll() doCOP2(0x04A6412);
#define gte_llv0() doCOP2(0x04A6012);
#define gte_llv1() doCOP2(0x04AE012);
#define gte_llv2() doCOP2(0x04B6012);
#define gte_llir() doCOP2(0x04BE012);
#define gte_llv0tr() doCOP2(0x04A0012);
#define gte_llv1tr() doCOP2(0x04A8012);
#define gte_llv2tr() doCOP2(0x04B0012);
#define gte_llirtr() doCOP2(0x04B8012);
#define gte_llv0bk() doCOP2(0x04A2012);
#define gte_llv1bk() doCOP2(0x4AA012);
#define gte_llv2bk() doCOP2(0x04B2012);
#define gte_llirbk() doCOP2(0x04BA012);
#define gte_lc() doCOP2(0x04DA412);
#define gte_lcv0() doCOP2(0x04C6012);
#define gte_lcv1() doCOP2(0x04CE012);
#define gte_lcv2() doCOP2(0x04D6012);
#define gte_lcir() doCOP2(0x04DE012);
#define gte_lcv0tr() doCOP2(0x04C0012);
#define gte_lcv1tr() doCOP2(0x04C8012);
#define gte_lcv2tr() doCOP2(0x04D0012);
#define gte_lcirtr() doCOP2(0x04D8012);
#define gte_lcv0bk() doCOP2(0x04C2012);
#define gte_lcv1bk() doCOP2(0x04CA012);
#define gte_lcv2bk() doCOP2(0x04D2012);
#define gte_lcirbk() doCOP2(0x04DA012);
#define gte_dpcl() doCOP2(0x0680029);
#define gte_dpcs() doCOP2(0x0780010);
#define gte_dpct() doCOP2(0x0F8002A);
#define gte_intpl() doCOP2(0x0980011);
#define gte_sqr12() doCOP2(0x0A80428);
#define gte_sqr0() doCOP2(0x0A00428);
#define gte_ncs() doCOP2(0x0C8041E);
#define gte_nct() doCOP2(0x0D80420);
#define gte_ncds() doCOP2(0x0E80413);
#define gte_ncdt() doCOP2(0x0F80416);
#define gte_nccs() doCOP2(0x0108041B);
#define gte_ncct() doCOP2(0x0118043F);
#define gte_cdp() doCOP2(0x01280414);
#define gte_cc() doCOP2(0x0138041C);
#define gte_nclip() doCOP2(0x01400006);
#define gte_avsz3() doCOP2(0x0158002D);
#define gte_avsz4() doCOP2(0x0168002E);
#define gte_op12() doCOP2(0x0178000C);
#define gte_op0() doCOP2(0x0170000C);
#define gte_gpf12() doCOP2(0x0198003D);
#define gte_gpf0() doCOP2(0x0190003D);
#define gte_gpl12() doCOP2(0x01A8003E);
#define gte_gpl0() doCOP2(0x01A0003E0);
#define gte_mvmva_core( r0 ) doCOP2(r0)
#define gte_mvmva(sf,mx,v,cv,lm) gte_mvmva_core( 0x0400012 | \
((sf)<<19) | ((mx)<<17) | ((v)<<15) | ((cv)<<13) | ((lm)<<10) )
/*
* Type 2 functions without nop
*/
#define gte_rtps_b() doCOP2(0x0180001);
#define gte_rtpt_b() doCOP2(0x0280030);
#define gte_rt_b() doCOP2(0x0480012);
#define gte_rtv0_b() doCOP2(0x0486012);
#define gte_rtv1_b() doCOP2(0x048E012);
#define gte_rtv2_b() doCOP2(0x0496012);
#define gte_rtir_b() doCOP2(0x049E012);
#define gte_rtir_sf0_b() doCOP2(0x041E012);
#define gte_rtv0tr_b() doCOP2(0x0480012);
#define gte_rtv1tr_b() doCOP2(0x0488012);
#define gte_rtv2tr_b() doCOP2(0x0490012);
#define gte_rtirtr_b() doCOP2(0x0498012);
#define gte_rtv0bk_b() doCOP2(0x0482012);
#define gte_rtv1bk_b() doCOP2(0x048A012);
#define gte_rtv2bk_b() doCOP2(0x0492012);
#define gte_rtirbk_b() doCOP2(0x049A012);
#define gte_ll_b() doCOP2(0x04A6412);
#define gte_llv0_b() doCOP2(0x04A6012);
#define gte_llv1_b() doCOP2(0x04AE012);
#define gte_llv2_b() doCOP2(0x04B6012);
#define gte_llir_b() doCOP2(0x04BE012);
#define gte_llv0tr_b() doCOP2(0x04A0012);
#define gte_llv1tr_b() doCOP2(0x04A8012);
#define gte_llv2tr_b() doCOP2(0x04B0012);
#define gte_llirtr_b() doCOP2(0x04B8012);
#define gte_llv0bk_b() doCOP2(0x04A2012);
#define gte_llv1bk_b() doCOP2(0x4AA012);
#define gte_llv2bk_b() doCOP2(0x04B2012);
#define gte_llirbk_b() doCOP2(0x04BA012);
#define gte_lc_b() doCOP2(0x04DA412);
#define gte_lcv0_b() doCOP2(0x04C6012);
#define gte_lcv1_b() doCOP2(0x04CE012);
#define gte_lcv2_b() doCOP2(0x04D6012);
#define gte_lcir_b() doCOP2(0x04DE012);
#define gte_lcv0tr_b() doCOP2(0x04C0012);
#define gte_lcv1tr_b() doCOP2(0x04C8012);
#define gte_lcv2tr_b() doCOP2(0x04D0012);
#define gte_lcirtr_b() doCOP2(0x04D8012);
#define gte_lcv0bk_b() doCOP2(0x04C2012);
#define gte_lcv1bk_b() doCOP2(0x04CA012);
#define gte_lcv2bk_b() doCOP2(0x04D2012);
#define gte_lcirbk_b() doCOP2(0x04DA012);
#define gte_dpcl_b() doCOP2(0x0680029);
#define gte_dpcs_b() doCOP2(0x0780010);
#define gte_dpct_b() doCOP2(0x0F8002A);
#define gte_intpl_b() doCOP2(0x0980011);
#define gte_sqr12_b() doCOP2(0x0A80428);
#define gte_sqr0_b() doCOP2(0x0A00428);
#define gte_ncs_b() doCOP2(0x0C8041E);
#define gte_nct_b() doCOP2(0x0D80420);
#define gte_ncds_b() doCOP2(0x0E80413);
#define gte_ncdt_b() doCOP2(0x0F80416);
#define gte_nccs_b() doCOP2(0x0108041B);
#define gte_ncct_b() doCOP2(0x0118043F);
#define gte_cdp_b() doCOP2(0x01280414);
#define gte_cc_b() doCOP2(0x0138041C);
#define gte_nclip_b() doCOP2(0x01400006);
#define gte_avsz3_b() doCOP2(0x0158002D);
#define gte_avsz4_b() doCOP2(0x0168002E);
#define gte_op12_b() doCOP2(0x0178000C);
#define gte_op0_b() doCOP2(0x0170000C);
#define gte_gpf12_b() doCOP2(0x0198003D);
#define gte_gpf0_b() doCOP2(0x0190003D);
#define gte_gpl12_b() doCOP2(0x01A8003E);
#define gte_gpl0_b() doCOP2(0x01A0003E0);
#define gte_mvmva_core_b( r0 ) doCOP2(r0)
#define gte_mvmva_b(sf,mx,v,cv,lm) gte_mvmva_core_b( 0x0400012 | \
((sf)<<19) | ((mx)<<17) | ((v)<<15) | ((cv)<<13) | ((lm)<<10) )
/*
* Type 3 functions
*/
// store mfc2 9,10,11
#define gte_stclmv( r0 ) \
{ *(ushort*)((char*)r0) = MFC2(9) & 0xFFFF; \
*(ushort*)((char*)r0 + 6) = MFC2(10) & 0xFFFF; \
*(ushort*)((char*)r0 + 12) = MFC2(11) & 0xFFFF;}
#if defined(USE_PGXP)
// swc2 14
#define gte_stsxy( r0 ) \
{*(uint*)((char*)r0) = *(uint*)&g_FP_SXYZ2.x;}
// mfc2 12-14
#define gte_stsxy3( r0, r1, r2 ) \
{ *(uint*)((char*)r0) = *(uint*)&g_FP_SXYZ0.x;\
*(uint*)((char*)r1) = *(uint*)&g_FP_SXYZ1.x;\
*(uint*)((char*)r2) = *(uint*)&g_FP_SXYZ2.x;}
// swc2 14
#define gte_stsxy2( r0 ) gte_stsxy(r0)
// swc2 13
#define gte_stsxy1( r0 ) \
{ *(uint*)((char*)r0) = *(uint*)&g_FP_SXYZ1.x;}
// swc2 12
#define gte_stsxy0( r0 ) \
{ *(uint*)((char*)r0) = *(uint*)&g_FP_SXYZ0.x;}
#else
// swc2 14
#define gte_stsxy( r0 ) \
{ *(uint*)((char*)r0) = MFC2(14);}
// mfc2 12-14
#define gte_stsxy3( r0, r1, r2 ) \
{ *(uint*)((char*)r0) = MFC2(12);\
*(uint*)((char*)r1) = MFC2(13);\
*(uint*)((char*)r2) = MFC2(14);}
// swc2 14
#define gte_stsxy2( r0 ) gte_stsxy(r0)
// swc2 13
#define gte_stsxy1( r0 ) \
{ *(uint*)((char*)r0) = MFC2(13);}
// swc2 12
#define gte_stsxy0( r0 ) \
{ *(uint*)((char*)r0) = MFC2(12);}
#endif // USE_PGXP
// swc2 8
#define gte_stdp( r0 ) \
{ *(uint*)((char*)r0) = MFC2(8);}
// cfc2 31
#define gte_stflg( r0 ) \
{ *(uint*)((char*)r0) = CFC2(31);}
// swc2 7
#define gte_stotz( r0 ) \
{ *(uint*)((char*)r0) = MFC2(7);}
// mfc2 19
#define gte_stszotz( r0 ) \
{ *(uint*)((char*)r0) = MFC2(19) >> 2;}
// swc2 24
#define gte_stopz( r0 ) \
{ *(uint*)((char*)r0) = MFC2(24);}
// swc2 19
#define gte_stsz( r0 ) \
{ *(uint*)((char*)r0) = MFC2(19);}
// swc2 9-11
#define gte_stlvl( r0 ) \
{ *(uint*)((char*)r0) = MFC2(9); \
*(uint*)((char*)r0 + 4) = MFC2(10);\
*(uint*)((char*)r0 + 8) = MFC2(11);}
// mfc2 9, 10, 11
#define gte_stsv( r0 ) \
{ *(ushort*)((char*)r0) = MFC2(9) & 0xFFFF; \
*(ushort*)((char*)r0 + 2) = MFC2(10) & 0xFFFF;\
*(ushort*)((char*)r0 + 4) = MFC2(11) & 0xFFFF;}
// mfc2 9,10
#define gte_stbv( r0 ) \
{ *((char*)r0) = MFC2(9) & 0xFF; \
*((char*)r0 + 1) = MFC2(10) & 0xFF;}
// mfc2 9,10,11
#define gte_stcv( r0 ) \
{ *((char*)r0) = MFC2(9) & 0xFF; \
*((char*)r0 + 1) = MFC2(10) & 0xFF;\
*((char*)r0 + 2) = MFC2(11) & 0xFF;}
// swc2 17,18,19
#define gte_stsz3( r0, r1, r2 ) \
{ *(uint*)((char*)r0) = MFC2(17);\
*(uint*)((char*)r1) = MFC2(18);\
*(uint*)((char*)r2) = MFC2(19);}
// swc2 25,26,27
#define gte_stlvnl( r0 ) \
{ *(uint*)((char*)r0 + 0) = MFC2(25);\
*(uint*)((char*)r0 + 4) = MFC2(26);\
*(uint*)((char*)r0 + 8) = MFC2(27);}
// ctc2 5,6,7
#define gte_ldtr( r0, r1, r2 ) \
{ CTC2(r0, 5);\
CTC2(r1, 6);\
CTC2(r2, 7);}
// cfc2 5,6,7
#define gte_sttr( r0 ) \
{ *(uint*)((char*)r0 + 0) = CFC2(5);\
*(uint*)((char*)r0 + 4) = CFC2(6);\
*(uint*)((char*)r0 + 8) = CFC2(7);}
// swc2 22
#define gte_strgb( r0 )\
{ *(uint*)((char*)r0) = MFC2(22);}
// swc2 20 21 22
#define gte_strgb3( r0, r1, r2 )\
{ *(uint*)((char*)r0) = MFC2(20);\
*(uint*)((char*)r1) = MFC2(21);\
*(uint*)((char*)r2) = MFC2(22);}
// store cfc2 0-7
#define gte_ReadRotMatrix( r0 ) \
{ *(uint*)((char*)r0) = CFC2(0); \
*(uint*)((char*)r0 + 4) = CFC2(1); \
*(uint*)((char*)r0 + 8) = CFC2(2); \
*(uint*)((char*)r0 + 12) = CFC2(3); \
*(uint*)((char*)r0 + 16) = CFC2(4); \
*(uint*)((char*)r0 + 20) = CFC2(5); \
*(uint*)((char*)r0 + 24) = CFC2(6); \
*(uint*)((char*)r0 + 28) = CFC2(7);}
// cfc2 16-23
#define gte_ReadColorMatrix( r0 ) \
{ *(uint*)((char*)r0) = CFC2(16); \
*(uint*)((char*)r0 + 4) = CFC2(17); \
*(uint*)((char*)r0 + 8) = CFC2(18); \
*(uint*)((char*)r0 + 12) = CFC2(19); \
*(uint*)((char*)r0 + 16) = CFC2(20); \
*(uint*)((char*)r0 + 20) = CFC2(21); \
*(uint*)((char*)r0 + 24) = CFC2(22); \
*(uint*)((char*)r0 + 28) = CFC2(23);}
// cfc2 8-15
#define gte_ReadLightMatrix( r0 ) \
{ *(uint*)((char*)r0) = CFC2(8); \
*(uint*)((char*)r0 + 4) = CFC2(9); \
*(uint*)((char*)r0 + 8) = CFC2(10); \
*(uint*)((char*)r0 + 12) = CFC2(11); \
*(uint*)((char*)r0 + 16) = CFC2(12); \
*(uint*)((char*)r0 + 20) = CFC2(13); \
*(uint*)((char*)r0 + 24) = CFC2(14); \
*(uint*)((char*)r0 + 28) = CFC2(15);}
// swc2 31
#define gte_stlzc( r0 ) \
*(ushort*)((char*)r0) = MFC2(31);
// cfc2 21,22,23
#define gte_stfc( r0 )\
{ *(uint*)((char*)r0 + 0) = CFC2(21);\
*(uint*)((char*)r0 + 4) = CFC2(22);\
*(uint*)((char*)r0 + 8) = CFC2(23);}
#endif

View File

@ -1,157 +0,0 @@
#ifndef KERNEL_H
#define KERNEL_H
#ifndef R3000_H
#include "r3000.h"
#endif
#ifndef ASM_H
#include "asm.h"
#endif
#define DescMask 0xff000000
#define DescTH DescMask
#define DescHW 0xf0000000
#define DescEV 0xf1000000
#define DescRC 0xf2000000
#define DescUEV 0xf3000000
#define DescSW 0xf4000000
#define HwVBLANK (DescHW|0x01)
#define HwGPU (DescHW|0x02)
#define HwCdRom (DescHW|0x03)
#define HwDMAC (DescHW|0x04)
#define HwRTC0 (DescHW|0x05)
#define HwRTC1 (DescHW|0x06)
#define HwRTC2 (DescHW|0x07)
#define HwCNTL (DescHW|0x08)
#define HwSPU (DescHW|0x09)
#define HwPIO (DescHW|0x0a)
#define HwSIO (DescHW|0x0b)
#define HwCPU (DescHW|0x10)
#define HwCARD (DescHW|0x11)
#define HwCARD_0 (DescHW|0x12)
#define HwCARD_1 (DescHW|0x13)
#define SwCARD (DescSW|0x01)
#define SwMATH (DescSW|0x02)
#define RCntCNT0 (DescRC|0x00)
#define RCntCNT1 (DescRC|0x01)
#define RCntCNT2 (DescRC|0x02)
#define RCntCNT3 (DescRC|0x03)
#define RCntMdINTR 0x1000
#define RCntMdNOINTR 0x2000
#define RCntMdSC 0x0001
#define RCntMdSP 0x0000
#define RCntMdFR 0x0000
#define RCntMdGATE 0x0010
#define EvSpCZ 0x0001 /* counter becomes zero */
#define EvSpINT 0x0002 /* interrupted */
#define EvSpIOE 0x0004 /* end of i/o */
#define EvSpCLOSE 0x0008 /* file was closed */
#define EvSpACK 0x0010 /* command acknowledged */
#define EvSpCOMP 0x0020 /* command completed */
#define EvSpDR 0x0040 /* data ready */
#define EvSpDE 0x0080 /* data end */
#define EvSpTIMOUT 0x0100 /* time out */
#define EvSpUNKNOWN 0x0200 /* unknown command */
#define EvSpIOER 0x0400 /* end of read buffer */
#define EvSpIOEW 0x0800 /* end of write buffer */
#define EvSpTRAP 0x1000 /* general interrupt */
#define EvSpNEW 0x2000 /* new device */
#define EvSpSYSCALL 0x4000 /* system call instruction */
#define EvSpERROR 0x8000 /* error happned */
#define EvSpPERROR 0x8001 /* previous write error happned */
#define EvSpEDOM 0x0301 /* domain error in libmath */
#define EvSpERANGE 0x0302 /* range error in libmath */
#define EvMdINTR 0x1000
#define EvMdNOINTR 0x2000
#define EvStUNUSED 0x0000
#define EvStWAIT 0x1000
#define EvStACTIVE 0x2000
#define EvStALREADY 0x4000
#define TcbMdRT 0x1000 /* reserved by system */
#define TcbMdPRI 0x2000 /* reserved by system */
#define TcbStUNUSED 0x1000
#define TcbStACTIVE 0x4000
struct ToT {
unsigned long *head;
long size;
};
struct TCBH {
struct TCB *entry; /* NULL */
long flag;
};
struct TCB {
long status;
long mode;
unsigned long reg[NREGS]; /* never change the offset of this */
long system[6]; /* reserved by system */
};
struct EvCB {
unsigned long desc;
long status;
long spec;
long mode;
long (*FHandler)();
long system[2]; /* reserved by system */
};
//#if !defined(D3D9)
#if 0///@FIXME Really not defined D3D9 :/
struct EXEC {
unsigned long pc0;
unsigned long gp0;
unsigned long t_addr;
unsigned long t_size;
unsigned long d_addr;
unsigned long d_size;
unsigned long b_addr;
unsigned long b_size;
unsigned long s_addr;
unsigned long s_size;
unsigned long sp,fp,gp,ret,base;
};
struct XF_HDR {
char key[8];
unsigned long text;
unsigned long data;
struct EXEC exec;
char title[60]; /* "PlayStation(tm) Executable A1" */
};
#endif
struct DIRENTRY {
char name[20];
long attr;
long size;
struct DIRENTRY *next;
long head;
char system[4];
};
extern struct ToT SysToT[32];
extern long SysClearRCnt[];
#ifndef NULL
#define NULL (0)
#endif
#endif /* _KERNEL_H */

View File

@ -1,116 +0,0 @@
#ifndef LIBAPI_H
#define LIBAPI_H
#ifndef KERNEL_H
#include "kernel.h"
#endif
#if defined(_LANGUAGE_C_PLUS_PLUS)||defined(__cplusplus)||defined(c_plusplus)
extern "C" {
#endif
extern long SetRCnt(long spec, unsigned short target, long mode);
extern long GetRCnt(long spec);
extern long ResetRCnt(long spec);
extern long StartRCnt(long spec);
extern long StopRCnt(long spec);
extern long OpenEvent(unsigned long desc,long spec,long mode,long(*func)());
extern long CloseEvent(unsigned long event);
extern long WaitEvent(unsigned long event);
extern long TestEvent(unsigned long event);
extern long EnableEvent(unsigned long event);
extern long DisableEvent(unsigned long event);
extern void DeliverEvent(unsigned long ev1, long ev2);
extern void UnDeliverEvent(unsigned long ev1, long ev2);
extern long OpenTh(long (*func)(), unsigned long , unsigned long);
extern int CloseTh(long unk00);
extern int ChangeTh(long unk00);
/*
extern long open(char* unk00, unsigned long);
extern long close(long unk00);
extern long lseek(long unk00, long, long);
extern long read(long unk00, void *, long);
extern long write(long unk00, void *, long);
extern long ioctl(long unk00, long, long);
extern struct DIRENTRY* firstfile(char* unk00, struct DIRENTRY *);
extern struct DIRENTRY* nextfile(struct DIRENTRY* unk00);
extern long erase(char* unk00);
extern long undelete(char* unk00);
extern long format(char* unk00);
extern long rename(char* unk00, char *);
extern long cd(char* unk00);
*/
extern long LoadTest(char* unk00, struct EXEC *);
extern long Load(char * unk00, struct EXEC *);
extern long Exec(struct EXEC * unk00, long, char **);
extern long LoadExec(char * unk00, unsigned long, unsigned long);
extern long InitPAD(char * unk00,long ,char *,long);
extern long StartPAD();
extern void StopPAD();
extern void EnablePAD();
extern void DisablePAD();
extern void FlushCache();
extern void ReturnFromException();
extern int EnterCriticalSection();
extern void ExitCriticalSection();
extern void Exception();
extern void SwEnterCriticalSection();
extern void SwExitCriticalSection();
extern unsigned long SetSp(unsigned long newsp);
extern unsigned long GetSp();
extern unsigned long GetGp();
extern unsigned long GetCr();
extern unsigned long GetSr();
extern unsigned long GetSysSp();
extern long SetConf(unsigned long,unsigned long,unsigned long);
extern void GetConf(unsigned long *,unsigned long *,unsigned long *);
/*
extern long _get_errno(void);
extern long _get_error(long);
*/
extern void SystemError( char, long);
extern void SetMem(long);
extern long Krom2RawAdd( unsigned long );
extern long Krom2RawAdd2(unsigned short);
extern void _96_init(void);
extern void _96_remove(void);
extern void _boot(void);
extern void ChangeClearPAD( long );
/* prototypes added by shino 96/05/22 */
extern void InitCARD(long val);
extern long StartCARD();
extern long StopCARD();
extern void _bu_init();
extern long _card_info(long chan);
extern long _card_clear(long chan);
extern long _card_load(long chan);
extern long _card_auto(long val);
extern void _new_card();
extern long _card_status(long drv);
extern long _card_wait(long drv);
extern unsigned long _card_chan(void);
extern long _card_write(long chan, long block, unsigned char *buf);
extern long _card_read(long chan, long block, unsigned char *buf);
extern long _card_format(long chan);
#if defined(_LANGUAGE_C_PLUS_PLUS)||defined(__cplusplus)||defined(c_plusplus)
}
#endif
#endif

View File

@ -1,262 +0,0 @@
#ifndef LIBCD_H
#define LIBCD_H
#include "types.h"
#define DECODE_BCD(x) (((x) >> 4) * 10 + ((x) & 0xF))
#define ENCODE_BCD(x) ((((x) / 10) << 4) | ((x) % 10))
#define CdlModeStream 0x100 /* Normal Streaming */
#define CdlModeStream2 0x120 /* SUB HEADER information includes */
#define CdlModeSpeed 0x80 /* 0: normal speed 1: double speed */
#define CdlModeRT 0x40 /* 0: ADPCM off 1: ADPCM on */
#define CdlModeSize1 0x20 /* 0: 2048 byte 1: 2340byte */
#define CdlModeSize0 0x10 /* 0: - 1: 2328byte */
#define CdlModeSF 0x08 /* 0: Channel off 1: Channel on */
#define CdlModeRept 0x04 /* 0: Report off 1: Report on */
#define CdlModeAP 0x02 /* 0: AutoPause off 1: AutoPause on */
#define CdlModeDA 0x01 /* 0: CD-DA off 1: CD-DA on */
/*
* Status Contents
*/
#define CdlStatPlay 0x80 /* playing CD-DA */
#define CdlStatSeek 0x40 /* seeking */
#define CdlStatRead 0x20 /* reading data sectors */
#define CdlStatShellOpen 0x10 /* once shell open */
#define CdlStatSeekError 0x04 /* seek error detected */
#define CdlStatStandby 0x02 /* spindle motor rotating */
#define CdlStatError 0x01 /* command error detected */
/*
* Macros for CdGetDiskType()
*/
#define CdlStatNoDisk 0
#define CdlOtherFormat 1
#define CdlCdromFormat 2
/*
* CD-ROM Primitive Commands
*/
#define CdlNop 0x01
#define CdlSetloc 0x02
#define CdlPlay 0x03
#define CdlForward 0x04
#define CdlBackward 0x05
#define CdlReadN 0x06
#define CdlStandby 0x07
#define CdlStop 0x08
#define CdlPause 0x09
#define CdlMute 0x0b
#define CdlDemute 0x0c
#define CdlSetfilter 0x0d
#define CdlSetmode 0x0e
#define CdlGetparam 0x0f
#define CdlGetlocL 0x10
#define CdlGetlocP 0x11
#define CdlGetTN 0x13
#define CdlGetTD 0x14
#define CdlSeekL 0x15
#define CdlSeekP 0x16
#define CdlReadS 0x1B
/*
* Interrupts
*/
#define CdlNoIntr 0x00 /* No interrupt */
#define CdlDataReady 0x01 /* Data Ready */
#define CdlComplete 0x02 /* Command Complete */
#define CdlAcknowledge 0x03 /* Acknowledge (reserved) */
#define CdlDataEnd 0x04 /* End of Data Detected */
#define CdlDiskError 0x05 /* Error Detected */
/*
* Library Macros
*/
#ifndef btoi
#define btoi(b) ((b)/16*10 + (b)%16) /* BCD to u_char */
#endif
#ifndef itob
#define itob(i) ((i)/10*16 + (i)%10) /* u_char to BCD */
#endif
#define CdSeekL(p) CdControl(CdlSeekL, (u_char *)p, 0)
#define CdSeekP(p) CdControl(CdlSeekP, (u_char *)p, 0)
#define CdStandby() CdControl(CdlStandby, 0, 0)
#define CdPause() CdControl(CdlPause, 0, 0)
#define CdStop() CdControl(CdlStop, 0, 0)
#define CdMute() CdControl(CdlMute, 0, 0)
#define CdDeMute() CdControl(CdlDemute, 0, 0)
#define CdForward() CdControl(CdlForward, 0, 0)
#define CdBackward() CdControl(CdlBackward, 0, 0)
/*
* Position
*/
#define CdlMAXTOC 100
/*
* Callback
*/
typedef void (*CdlCB)(u_char,u_char *);
/*
* Location
*/
typedef struct {
u_char minute; /* minute (BCD) */
u_char second; /* second (BCD) */
u_char sector; /* sector (BCD) */
u_char track; /* track (void) */
} CdlLOC;
/*
* ADPCM Filter
*/
typedef struct {
u_char file; /* file ID (always 1) */
u_char chan; /* channel ID */
u_short pad;
} CdlFILTER;
/*
* Attenuator
*/
typedef struct {
u_char val0; /* volume for CD(L) -> SPU (L) */
u_char val1; /* volume for CD(L) -> SPU (R) */
u_char val2; /* volume for CD(R) -> SPU (L) */
u_char val3; /* volume for CD(R) -> SPU (R) */
} CdlATV;
/*
* Low Level File System for CdSearchFile()
*/
#define CdlMAXFILE 64 /* max number of files in a diRECT16ory */
#define CdlMAXDIR 128 /* max number of total diRECT16ories */
#define CdlMAXLEVEL 8 /* max levels of diRECT16ories */
typedef struct {
CdlLOC pos; /* file location */
u_long size; /* file size */
char name[16]; /* file name (body) */
} CdlFILE;
/*#define MULTI_INTERRUPT */
#ifndef MULTI_INTERRUPT
#define pauseMULI()
#define restartMULI()
#endif
/*
* Streaming Structures
*/
typedef struct {
u_short id;
u_short type;
u_short secCount;
u_short nSectors;
u_long frameCount;
u_long frameSize;
u_short width;
u_short height;
u_long dummy1;
u_long dummy2;
CdlLOC loc;
} StHEADER; /* CD-ROM STR structure */
#define StFREE 0x0000
#define StREWIND 0x0001
#define StCOMPLETE 0x0002
#define StBUSY 0x0003
#define StLOCK 0x0004
#define EDC 0
#define SECTOR_SIZE (512) /* Sector Size (word) */
#define HEADER_SIZE (8) /* Header Size (word) */
#define StSTATUS 0x00
#define StVER 0x00
#define StTYPE 0x01
#define StSECTOR_OFFSET 0x02
#define StSECTOR_SIZE 0x03
#define StFRAME_NO 0x04
#define StFRAME_SIZE 0x06
#define StMOVIE_WIDTH 0x08
#define StMOVIE_HEIGHT 0x09
#if defined(_LANGUAGE_C_PLUS_PLUS)||defined(__cplusplus)||defined(c_plusplus)
extern "C" {
#endif
/* Initializes CD filesystem using ISO 9660 compliant file */
extern void PsyX_CDFS_Init(const char* imageFileName, int track /*= 0*/, int sectorSize /*= 0*/);
/* Initializes CD filesystem using ISO 9660 compliant stream */
extern void PsyX_CDFS_Init_Mem(const u_long* data, int size, int track /*= 0*/, int sectorSize /*= 0*/);
void StSetRing(u_long *ring_addr,u_long ring_size);
void StClearRing(void);
void StUnSetRing(void);
void StSetStream(u_long mode,u_long start_frame,u_long end_frame,
void (*func1)(),void (*func2)());
void StSetEmulate(u_long *addr,u_long mode,u_long start_frame,
u_long end_frame,void (*func1)(),void (*func2)());
u_long StFreeRing(u_long *base);
u_long StGetNext(u_long **addr,u_long **header);
u_long StGetNextS(u_long **addr,u_long **header);
u_short StNextStatus(u_long **addr,u_long **header);
void StRingStatus(short *free_sectors,short *over_sectors);
void StSetMask(u_long mask,u_long start,u_long end);
void StCdInterrupt(void);
int StGetBackloc(CdlLOC *loc);
int StSetChannel(u_long channel);
void CdFlush(void);
CdlFILE *CdSearchFile(CdlFILE *fp, char *name);
CdlLOC *CdIntToPos(int i, CdlLOC *p) ;
char *CdComstr(u_char com);
char *CdIntstr(u_char intr);
int CdControl(u_char com, u_char *param, u_char *result);
int CdControlB(u_char com, u_char *param, u_char *result);
int CdControlF(u_char com, u_char *param);
int CdGetSector(void *madr, int size);
int CdGetSector2( void* madr, int size );
int CdDataSync(int mode);
int CdGetToc(CdlLOC *loc) ;
int CdPlay(int mode, int *track, int offset);
int CdMix(CdlATV *vol);
int CdPosToInt(CdlLOC *p);
int CdRead(int sectors, u_long *buf, int mode);
int CdRead2(long mode);
int CdReadFile(char *file, u_long *addr, int nbyte);
int CdReadSync(int mode, u_char *result);
int CdReady(int mode, u_char *result) ;
int CdSetDebug(int level);
int CdSync(int mode, u_char *result) ;
void (*CdDataCallback(void (*func)()));
CdlCB CdReadCallback(CdlCB func);
CdlCB CdReadyCallback(CdlCB func);
CdlCB CdSyncCallback(CdlCB func);
int CdInit(void);
int CdReset(int mode);
int CdStatus(void);
int CdLastCom(void);
CdlLOC *CdLastPos(void);
int CdMode(void);
int CdDiskReady( int mode );
int CdGetDiskType( void );
struct EXEC *CdReadExec(char *file);
void CdReadBreak( void );
#if defined(_LANGUAGE_C_PLUS_PLUS)||defined(__cplusplus)||defined(c_plusplus)
}
#endif
#endif

View File

@ -1,67 +0,0 @@
#ifndef LIBETC_H
#define LIBETC_H
#include "types.h"
extern int PadIdentifier;
#define PADLup (1<<12)
#define PADLdown (1<<14)
#define PADLleft (1<<15)
#define PADLright (1<<13)
#define PADRup (1<< 4)
#define PADRdown (1<< 6)
#define PADRleft (1<< 7)
#define PADRright (1<< 5)
#define PADi (1<< 9)
#define PADj (1<<10)
#define PADk (1<< 8)
#define PADl (1<< 3)
#define PADm (1<< 1)
#define PADn (1<< 2)
#define PADo (1<< 0)
#define PADh (1<<11)
#define PADL1 PADn
#define PADL2 PADo
#define PADR1 PADl
#define PADR2 PADm
#define PADstart PADh
#define PADselect PADk
#define MOUSEleft (1<<3)
#define MOUSEright (1<<2)
#define _PAD(x,y) ((y)<<((x)<<4))
#define getScratchAddr(offset) ((u_long *)(_scratchData+(offset)*4))
#define MODE_NTSC 0
#define MODE_PAL 1
#if defined(_LANGUAGE_C_PLUS_PLUS)||defined(__cplusplus)||defined(c_plusplus)
extern "C" {
#endif
extern char* _scratchData;
extern int CheckCallback(void);
extern void PadInit(int mode);
extern int ResetCallback(void);
extern int RestartCallback(void);
extern int StopCallback(void);
extern int VSync(int mode);
extern int VSyncCallback(void (*f)(void)) ;
extern long GetVideoMode (void);
extern long SetVideoMode (long mode);
extern u_long PadRead(int id);
extern void PadStop(void);
extern void(*vsync_callback)(void);
#if defined(_LANGUAGE_C_PLUS_PLUS)||defined(__cplusplus)||defined(c_plusplus)
}
#endif
#endif

View File

@ -1,853 +0,0 @@
#ifndef LIBGPU_H
#define LIBGPU_H
#include "types.h"
#include "PsyX/common/pgxp_defs.h"
extern int (*GPU_printf)(const char *fmt, ...);
#define WAIT_TIME 0x800000
#define limitRange(x, l, h) ((x)=((x)<(l)?(l):(x)>(h)?(h):(x)))
#define setVector(v, _x, _y, _z) \
(v)->vx = _x, (v)->vy = _y, (v)->vz = _z
#define applyVector(v, _x, _y, _z, op) \
(v)->vx op _x, (v)->vy op _y, (v)->vz op _z
#define copyVector(v0, v1) \
(v0)->vx = (v1)->vx, (v0)->vy = (v1)->vy, (v0)->vz = (v1)->vz
#define addVector(v0, v1) \
(v0)->vx += (v1)->vx, \
(v0)->vy += (v1)->vy, \
(v0)->vz += (v1)->vz
#define dumpVector(str, v) \
GPU_printf("%s=(%d,%d,%d)\n", str, (v)->vx, (v)->vy, (v)->vz)
#define dumpMatrix(x) \
GPU_printf("\t%5d,%5d,%5d\n",(x)->m[0][0],(x)->m[0][1],(x)->m[0][2]),\
GPU_printf("\t%5d,%5d,%5d\n",(x)->m[1][0],(x)->m[1][1],(x)->m[1][2]),\
GPU_printf("\t%5d,%5d,%5d\n",(x)->m[2][0],(x)->m[2][1],(x)->m[2][2])
#define setRECT(r, _x, _y, _w, _h) \
(r)->x = (_x),(r)->y = (_y),(r)->w = (_w),(r)->h = (_h)
/*
* Set Primitive Attributes
*/
#define setTPage(p,tp,abr,x,y) \
((p)->tpage = getTPage(tp,abr,x,y))
#define setClut(p,x,y) \
((p)->clut = getClut(x,y))
/*
* Set Primitive Colors
*/
#define setRGB0(p,_r0,_g0,_b0) \
(p)->r0 = _r0,(p)->g0 = _g0,(p)->b0 = _b0
#define setRGB1(p,_r1,_g1,_b1) \
(p)->r1 = _r1,(p)->g1 = _g1,(p)->b1 = _b1
#define setRGB2(p,_r2,_g2,_b2) \
(p)->r2 = _r2,(p)->g2 = _g2,(p)->b2 = _b2
#define setRGB3(p,_r3,_g3,_b3) \
(p)->r3 = _r3,(p)->g3 = _g3,(p)->b3 = _b3
#define setRGBP0(p,_r0,_g0,_b0,_p0) \
(p)->r0 = _r0,(p)->g0 = _g0,(p)->b0 = _b0,(p)->p0 = _p0
#define setRGBP1(p,_r1,_g1,_b1,_p1) \
(p)->r1 = _r1,(p)->g1 = _g1,(p)->b1 = _b1,(p)->p1 = _p1
#define setRGBP2(p,_r2,_g2,_b2,_p2) \
(p)->r2 = _r2,(p)->g2 = _g2,(p)->b2 = _b2,(p)->p2 = _p2
#define setRGBP3(p,_r3,_g3,_b3,_p3) \
(p)->r3 = _r3,(p)->g3 = _g3,(p)->b3 = _b3,(p)->p3 = _p3
/*
* Set Primitive Screen Points
*/
#define setXY0(p,_x0,_y0) \
(p)->x0 = (_x0), (p)->y0 = (_y0) \
#define setXY2(p,_x0,_y0,_x1,_y1) \
(p)->x0 = (_x0), (p)->y0 = (_y0), \
(p)->x1 = (_x1), (p)->y1 = (_y1)
#define setXY3(p,_x0,_y0,_x1,_y1,_x2,_y2) \
(p)->x0 = (_x0), (p)->y0 = (_y0), \
(p)->x1 = (_x1), (p)->y1 = (_y1), \
(p)->x2 = (_x2), (p)->y2 = (_y2)
#define setXY4(p,_x0,_y0,_x1,_y1,_x2,_y2,_x3,_y3) \
(p)->x0 = (_x0), (p)->y0 = (_y0), \
(p)->x1 = (_x1), (p)->y1 = (_y1), \
(p)->x2 = (_x2), (p)->y2 = (_y2), \
(p)->x3 = (_x3), (p)->y3 = (_y3)
#define setXYWH(p,_x0,_y0,_w,_h) \
(p)->x0 = (_x0), (p)->y0 = (_y0), \
(p)->x1 = (_x0)+(_w), (p)->y1 = (_y0), \
(p)->x2 = (_x0), (p)->y2 = (_y0)+(_h), \
(p)->x3 = (_x0)+(_w), (p)->y3 = (_y0)+(_h)
/*
* Set Primitive Width/Height
*/
#define setWH(p,_w,_h) (p)->w = _w, (p)->h = _h
/*
* Set Primitive Texture Points
*/
#define setUV0(p,_u0,_v0) \
(p)->u0 = (_u0), (p)->v0 = (_v0) \
#define setUV3(p,_u0,_v0,_u1,_v1,_u2,_v2) \
(p)->u0 = (_u0), (p)->v0 = (_v0), \
(p)->u1 = (_u1), (p)->v1 = (_v1), \
(p)->u2 = (_u2), (p)->v2 = (_v2)
#define setUV4(p,_u0,_v0,_u1,_v1,_u2,_v2,_u3,_v3) \
(p)->u0 = (_u0), (p)->v0 = (_v0), \
(p)->u1 = (_u1), (p)->v1 = (_v1), \
(p)->u2 = (_u2), (p)->v2 = (_v2), \
(p)->u3 = (_u3), (p)->v3 = (_v3)
#define setUVWH(p,_u0,_v0,_w,_h) \
(p)->u0 = (_u0), (p)->v0 = (_v0), \
(p)->u1 = (_u0)+(_w), (p)->v1 = (_v0), \
(p)->u2 = (_u0), (p)->v2 = (_v0)+(_h), \
(p)->u3 = (_u0)+(_w), (p)->v3 = (_v0)+(_h)
/*
* Dump Primivie Parameters
*/
#define dumpRECT16(r) \
GPU_printf("(%d,%d)-(%d,%d)\n", (r)->x,(r)->y,(r)->w,(r)->h)
#define dumpWH(p) GPU_printf("(%d,%d)\n", (p)->w, (p)->h )
#define dumpXY0(p) GPU_printf("(%d,%d)\n", (p)->x0, (p)->y0)
#define dumpUV0(p) GPU_printf("(%d,%d)\n", (p)->u0, (p)->v0)
#define dumpXY2(p) \
GPU_printf("(%d,%d)-(%d,%d)\n", \
(p)->x0, (p)->y0, (p)->x1, (p)->y1)
#define dumpXY3(p) \
GPU_printf("(%d,%d)-(%d,%d)-(%d,%d)\n", \
(p)->x0, (p)->y0, (p)->x1, (p)->y1, \
(p)->x2, (p)->y2)
#define dumpUV3(p) \
GPU_printf("(%d,%d)-(%d,%d)-(%d,%d)\n", \
(p)->u0, (p)->v0, (p)->u1, (p)->v1, \
(p)->u2, (p)->v2)
#define dumpXY4(p) \
GPU_printf("(%d,%d)-(%d,%d)-(%d,%d)-(%d,%d)\n", \
(p)->x0, (p)->y0, (p)->x1, (p)->y1, \
(p)->x2, (p)->y2, (p)->x3, (p)->y3)
#define dumpUV4(p) \
GPU_printf("(%d,%d)-(%d,%d)-(%d,%d)-(%d,%d)\n", \
(p)->u0, (p)->v0, (p)->u1, (p)->v1, \
(p)->u2, (p)->v2, (p)->u3, (p)->v3)
#define dumpRGB0(p) \
GPU_printf("(%3d,%3d,%3d)\n", (p)->r0, (p)->g0, (p)->b0)
#define dumpRGB1(p) \
GPU_printf("(%3d,%3d,%3d)\n", (p)->r1, (p)->g1, (p)->b1)
#define dumpRGB2(p) \
GPU_printf("(%3d,%3d,%3d)\n", (p)->r2, (p)->g2, (p)->b2)
#define dumpRGB3(p) \
GPU_printf("(%3d,%3d,%3d)\n", (p)->r3, (p)->g3, (p)->b3)
/*
* Primitive Handling Macros
*/
#if defined(USE_EXTENDED_PRIM_POINTERS)
#define isendprim(p) ((((P_TAG *)(p))->addr) == &prim_terminator)
#define nextPrim(p) (void *)(((P_TAG *)(p))->addr)
#define setaddr(p, _addr) (((P_TAG *)(p))->addr = (uintptr_t)((u_long*)_addr))
#define getaddr(p) (uintptr_t)(((P_TAG *)(p))->addr)
#else
#define isendprim(p) ((((P_TAG *)(p))->addr)==0xffffff)
#define nextPrim(p) (void *)((((P_TAG *)(p))->addr)|0x80000000)
#define setaddr(p, _addr) (((P_TAG *)(p))->addr = (u_long)((u_long*)_addr))
#define getaddr(p) (u_long)(((P_TAG *)(p))->addr)
#endif
#define setlen( p, _len) (((P_TAG *)(p))->len = (u_char)(_len))
#define setcode(p, _code) (((P_TAG *)(p))->code = (u_char)(_code))
#define getlen(p) (u_char)(((P_TAG *)(p))->len)
#define getcode(p) (u_char)(((P_TAG *)(p))->code)
#if defined(USE_PGXP) && defined(USE_EXTENDED_PRIM_POINTERS)
#define setpgxpindex(p, i) (((P_TAG *)(p))->pgxp_index = (u_short)(i))
#define addPrim(ot, p) setaddr(p, getaddr(ot)), setaddr(ot, p), setpgxpindex(p, PGXP_GetIndex())
#else
#define addPrim(ot, p) setaddr(p, getaddr(ot)), setaddr(ot, p)
#endif
#define addPrims(ot, p0, p1) setaddr(p1, getaddr(ot)),setaddr(ot, p0)
#define catPrim(p0, p1) setaddr(p0, p1)
#define termPrim(p) setaddr(p, &prim_terminator)
#define setSemiTrans(p, abe) \
((abe)?setcode(p, getcode(p)|0x02):setcode(p, getcode(p)&~0x02))
#define setShadeTex(p, tge) \
((tge)?setcode(p, getcode(p)|0x01):setcode(p, getcode(p)&~0x01))
#define getTPage(tp, abr, x, y) \
((((tp)&0x3)<<7)|(((abr)&0x3)<<5)|(((y)&0x100)>>4)|(((x)&0x3ff)>>6)| \
(((y)&0x200)<<2))
#define getClut(x, y) \
(((y)<<6)|(((x)>>4)&0x3f))
#define dumpTPage(tpage) \
GPU_printf("tpage: (%d,%d,%d,%d)\n", \
((tpage)>>7)&0x3,((tpage)>>5)&0x3, \
((tpage)<<6)&0x3c0, \
(((tpage)<<4)&0x100)+(((tpage)>>2)&0x200))
#define dumpClut(clut) \
GPU_printf("clut: (%d,%d)\n", (clut&0x3f)<<4, (clut>>6))
#define _get_mode(dfe, dtd, tpage) \
((0xe1000000)|((dtd)?0x0200:0)| \
((dfe)?0x0400:0)|((tpage)&0x9ff))
#if defined(USE_EXTENDED_PRIM_POINTERS)
#define setDrawTPage(p, dfe, dtd, tpage) \
setlen(p, 1), \
((u_long *)(p))[2] = _get_mode(dfe, dtd, tpage)
#else
#define setDrawTPage(p, dfe, dtd, tpage) \
setlen(p, 1), \
((u_long *)(p))[1] = _get_mode(dfe, dtd, tpage)
#endif
#define _get_tw(tw) \
(tw ? ((0xe2000000)|((((tw)->y&0xff)>>3)<<15)| \
((((tw)->x&0xff)>>3)<<10)|(((~((tw)->h-1)&0xff)>>3)<<5)| \
(((~((tw)->w-1)&0xff)>>3))) : 0)
#define setTexWindow(p, tw) \
setlen(p, 2), \
((u_long *)(p))[1] = _get_tw(tw), \
((u_long *)(p))[2] = 0
#define _get_len(RECT16) \
(((RECT16)->w*(RECT16)->h+1)/2+4)
#define setDrawLoad(pt, RECT16) \
(_get_len(RECT16) <= 16) ? ( \
(setlen(pt, _get_len(RECT16))), \
((pt)->code[0] = 0xa0000000), \
((pt)->code[1] = *((u_long *)&(RECT16)->x)), \
((pt)->code[2] = *((u_long *)&(RECT16)->w)), \
((pt)->p[_get_len(RECT16)-4] = 0x01000000) \
) : ( \
(setlen(pt,0)) \
)
#define setDrawStp(p, pbw) \
setlen(p, 2), \
((u_long *)p)[1] = 0xe6000000|(pbw?0x01:0), \
((u_long *)p)[2] = 0
#if defined(USE_EXTENDED_PRIM_POINTERS)
#define setDrawMode(p, dfe, dtd, tpage, tw) \
setlen(p, 3), \
((u_long *)p)[2] = _get_mode(dfe, dtd, tpage), \
((u_long *)p)[3] = _get_tw((RECT16 *)tw)
#else
#define setDrawMode(p, dfe, dtd, tpage, tw) \
setlen(p, 2), \
((u_long *)p)[1] = _get_mode(dfe, dtd, tpage), \
((u_long *)p)[2] = _get_tw((RECT16 *)tw)
#endif
/* Primitive Lentgh Code */
/*-------------------------------------------------------------------- */
/* */
#define setPolyF3(p) setlen(p, 4), setcode(p, 0x20)
#define setPolyFT3(p) setlen(p, 7), setcode(p, 0x24)
#define setPolyG3(p) setlen(p, 6), setcode(p, 0x30)
#define setPolyGT3(p) setlen(p, 9), setcode(p, 0x34)
#define setPolyF4(p) setlen(p, 5), setcode(p, 0x28)
#define setPolyFT4(p) setlen(p, 9), setcode(p, 0x2c)
#define setPolyG4(p) setlen(p, 8), setcode(p, 0x38)
#define setPolyGT4(p) setlen(p, 12), setcode(p, 0x3c)
#define setSprt8(p) setlen(p, 3), setcode(p, 0x74)
#define setSprt16(p) setlen(p, 3), setcode(p, 0x7c)
#define setSprt(p) setlen(p, 4), setcode(p, 0x64)
#define setTile1(p) setlen(p, 2), setcode(p, 0x68)
#define setTile8(p) setlen(p, 2), setcode(p, 0x70)
#define setTile16(p) setlen(p, 2), setcode(p, 0x78)
#define setTile(p) setlen(p, 3), setcode(p, 0x60)
#define setLineF2(p) setlen(p, 3), setcode(p, 0x40)
#define setLineG2(p) setlen(p, 4), setcode(p, 0x50)
#define setLineF3(p) setlen(p, 5), setcode(p, 0x48),(p)->pad = 0x55555555
#define setLineG3(p) setlen(p, 7), setcode(p, 0x58),(p)->pad = 0x55555555, \
(p)->p2 = 0
#define setLineF4(p) setlen(p, 6), setcode(p, 0x4c),(p)->pad = 0x55555555
#define setLineG4(p) setlen(p, 9), setcode(p, 0x5c),(p)->pad = 0x55555555, \
(p)->p2 = 0, (p)->p3 = 0
/*
* RECT16angle:
*/
#pragma pack(push,1)
typedef struct _RECT16 {
short x, y; /* offset point on VRAM */
short w, h; /* width and height */
} RECT16;
// Psy-X custom struct to handle polygons
#if defined(USE_EXTENDED_PRIM_POINTERS)
#if defined(_M_X64) || defined(__amd64__)
#define DECLARE_P_ADDR \
uintptr_t addr; \
uint len : 16; \
uint pgxp_index : 16;
#define P_LEN 3 // 4 longs
#else
#define DECLARE_P_ADDR \
uintptr_t addr; \
uint len : 16; \
uint pgxp_index : 16;
#define P_LEN 2 // 2 longs
#endif
#else // just don't use that, okay... it's just for reference
#define DECLARE_P_ADDR \
unsigned addr : 24; \
unsigned len : 8;
#define P_LEN 1 // 1 long
#endif
/*
* Polygon Primitive Definitions
*/
typedef struct {
DECLARE_P_ADDR
} OT_TAG;
typedef struct {
DECLARE_P_ADDR
u_char r0, g0, b0, code;
} P_TAG;
typedef struct {
DECLARE_P_ADDR
u_char r0, g0, b0, code;
VERTTYPE x0, y0;
VERTTYPE x1, y1;
VERTTYPE x2, y2;
} POLY_F3; /* Flat Triangle */
typedef struct {
DECLARE_P_ADDR
u_char r0, g0, b0, code;
VERTTYPE x0, y0;
VERTTYPE x1, y1;
VERTTYPE x2, y2;
VERTTYPE x3, y3;
} POLY_F4; /* Flat Quadrangle */
typedef struct {
DECLARE_P_ADDR
u_char r0, g0, b0, code;
VERTTYPE x0, y0;
u_char u0, v0; u_short clut;
VERTTYPE x1, y1;
u_char u1, v1; u_short tpage;
VERTTYPE x2, y2;
u_char u2, v2; u_short pad1;
} POLY_FT3; /* Flat Textured Triangle */
typedef struct {
DECLARE_P_ADDR
u_char r0, g0, b0, code;
VERTTYPE x0, y0;
u_char u0, v0; u_short clut;
VERTTYPE x1, y1;
u_char u1, v1; u_short tpage;
VERTTYPE x2, y2;
u_char u2, v2; u_short pad1;
VERTTYPE x3, y3;
u_char u3, v3; u_short pad2;
} POLY_FT4; /* Flat Textured Quadrangle */
typedef struct {
DECLARE_P_ADDR
u_char r0, g0, b0, code;
VERTTYPE x0, y0;
u_char r1, g1, b1, pad1;
VERTTYPE x1, y1;
u_char r2, g2, b2, pad2;
VERTTYPE x2, y2;
} POLY_G3; /* Gouraud Triangle */
typedef struct {
DECLARE_P_ADDR
u_char r0, g0, b0, code;
VERTTYPE x0, y0;
u_char r1, g1, b1, pad1;
VERTTYPE x1, y1;
u_char r2, g2, b2, pad2;
VERTTYPE x2, y2;
u_char r3, g3, b3, pad3;
VERTTYPE x3, y3;
} POLY_G4; /* Gouraud Quadrangle */
typedef struct {
DECLARE_P_ADDR
u_char r0, g0, b0, code;
VERTTYPE x0, y0;
u_char u0, v0; u_short clut;
u_char r1, g1, b1, p1;
VERTTYPE x1, y1;
u_char u1, v1; u_short tpage;
u_char r2, g2, b2, p2;
VERTTYPE x2, y2;
u_char u2, v2; u_short pad2;
} POLY_GT3; /* Gouraud Textured Triangle */
typedef struct {
DECLARE_P_ADDR
u_char r0, g0, b0, code;
VERTTYPE x0, y0;
u_char u0, v0; u_short clut;
u_char r1, g1, b1, p1;
VERTTYPE x1, y1;
u_char u1, v1; u_short tpage;
u_char r2, g2, b2, p2;
VERTTYPE x2, y2;
u_char u2, v2; u_short pad2;
u_char r3, g3, b3, p3;//10
VERTTYPE x3, y3;//11
u_char u3, v3; u_short pad3;
} POLY_GT4; /* Gouraud Textured Quadrangle */
/*
* Line Primitive Definitions
*/
typedef struct {
DECLARE_P_ADDR
u_char r0, g0, b0, code;
VERTTYPE x0, y0;
VERTTYPE x1, y1;
} LINE_F2; /* Unconnected Flat Line */
typedef struct {
DECLARE_P_ADDR
u_char r0, g0, b0, code;
VERTTYPE x0, y0;
u_char r1, g1, b1, p1;
VERTTYPE x1, y1;
} LINE_G2; /* Unconnected Gouraud Line */
typedef struct {
DECLARE_P_ADDR
u_char r0, g0, b0, code;
VERTTYPE x0, y0;
VERTTYPE x1, y1;
VERTTYPE x2, y2;
u_long pad;
} LINE_F3; /* 2 connected Flat Line */
typedef struct {
DECLARE_P_ADDR
u_char r0, g0, b0, code;
VERTTYPE x0, y0;
u_char r1, g1, b1, p1;
VERTTYPE x1, y1;
u_char r2, g2, b2, p2;
VERTTYPE x2, y2;
u_long pad;
} LINE_G3; /* 2 connected Gouraud Line */
typedef struct {
DECLARE_P_ADDR
u_char r0, g0, b0, code;
VERTTYPE x0, y0;
VERTTYPE x1, y1;
VERTTYPE x2, y2;
VERTTYPE x3, y3;
u_long pad;
} LINE_F4; /* 3 connected Flat Line Quadrangle */
typedef struct {
DECLARE_P_ADDR
u_char r0, g0, b0, code;
VERTTYPE x0, y0;
u_char r1, g1, b1, p1;
VERTTYPE x1, y1;
u_char r2, g2, b2, p2;
VERTTYPE x2, y2;
u_char r3, g3, b3, p3;
VERTTYPE x3, y3;
u_long pad;
} LINE_G4; /* 3 connected Gouraud Line */
/*
* Sprite Primitive Definitions
*/
typedef struct {
DECLARE_P_ADDR
u_char r0, g0, b0, code;
VERTTYPE x0, y0;
u_char u0, v0; u_short clut;
VERTTYPE w, h;
} SPRT; /* free size Sprite */
typedef struct {
DECLARE_P_ADDR
u_char r0, g0, b0, code;
VERTTYPE x0, y0;
u_char u0, v0; u_short clut;
} SPRT_16; /* 16x16 Sprite */
typedef struct {
DECLARE_P_ADDR
u_char r0, g0, b0, code;
VERTTYPE x0, y0;
u_char u0, v0; u_short clut;
} SPRT_8; /* 8x8 Sprite */
/*
* Tile Primitive Definitions
*/
typedef struct {
DECLARE_P_ADDR
u_char r0, g0, b0, code;
VERTTYPE x0, y0;
VERTTYPE w, h;
} TILE; /* free size Tile */
typedef struct {
DECLARE_P_ADDR
u_char r0, g0, b0, code;
VERTTYPE x0, y0;
} TILE_16; /* 16x16 Tile */
typedef struct {
DECLARE_P_ADDR
u_char r0, g0, b0, code;
VERTTYPE x0, y0;
} TILE_8; /* 8x8 Tile */
typedef struct {
DECLARE_P_ADDR
u_char r0, g0, b0, code;
VERTTYPE x0, y0;
} TILE_1; /* 1x1 Tile */
/*
* Special Primitive Definitions
*/
typedef struct {
DECLARE_P_ADDR
u_long code[2];
} DR_MODE; /* Drawing Mode */
typedef struct {
DECLARE_P_ADDR
u_long code[2];
} DR_TWIN; /* Texture Window */
typedef struct {
DECLARE_P_ADDR
u_long code[2];
} DR_AREA; /* Drawing Area */
typedef struct {
DECLARE_P_ADDR
u_long code[2];
} DR_OFFSET; /* Drawing Offset */
typedef struct { /* MoveImage */
DECLARE_P_ADDR
u_long code[5];
} DR_MOVE;
typedef struct { /* LoadImage */
DECLARE_P_ADDR
u_long code[3];
u_long p[13];
} DR_LOAD;
typedef struct {
DECLARE_P_ADDR
u_long code[1];
} DR_TPAGE; /* Drawing TPage */
typedef struct {
DECLARE_P_ADDR
u_long code[2];
} DR_STP; /* Drawing STP */
/*
* PSY-X commands
*/
typedef struct {
DECLARE_P_ADDR
u_long code[1];
} DR_PSYX_TEX;
/*
* Environment
*/
typedef struct {
DECLARE_P_ADDR
u_long code[15];
} DR_ENV; /* Packed Drawing Environment */
typedef struct {
RECT16 clip; /* clip area */
short ofs[2]; /* drawing offset */
RECT16 tw; /* texture window */
u_short tpage; /* texture page */
u_char dtd; /* dither flag (0:off, 1:on) */
u_char dfe; /* flag to draw on display area (0:off 1:on) */
u_char drt;
u_char isbg; /* enable to auto-clear */
u_char r0, g0, b0; /* initital background color */
DR_ENV dr_env; /* reserved */
} DRAWENV;
typedef struct {
RECT16 disp; /* display area */
RECT16 screen; /* display start point */
u_char isinter; /* interlace 0: off 1: on */
u_char isrgb24; /* RGB24 bit mode */
u_char pad0, pad1; /* reserved */
} DISPENV;
/*
* Font Stream Parameters
*/
#define FNT_MAX_ID 8 /* max number of stream ID */
#define FNT_MAX_SPRT 1024 /* max number of sprites in all streams */
/*
* Multi-purpose Sony-TMD primitive
*/
typedef struct {
u_long id;
u_char r0, g0, b0, p0; /* Color of vertex 0 */
u_char r1, g1, b1, p1; /* Color of vertex 1 */
u_char r2, g2, b2, p2; /* Color of vertex 2 */
u_char r3, g3, b3, p3; /* Color of vertex 3 */
u_short tpage, clut; /* texture page ID, clut ID */
u_char u0, v0, u1, v1; /* texture corner point */
u_char u2, v2, u3, v3;
/* independent vertex model */
SVECTOR x0, x1, x2, x3; /* 3D corner point */
SVECTOR n0, n1, n2, n3; /* 3D corner normal vector */
/* Common vertex model */
SVECTOR *v_ofs; /* offset to vertex database */
SVECTOR *n_ofs; /* offset to normal database */
u_short vert0, vert1; /* index of vertex */
u_short vert2, vert3;
u_short norm0, norm1; /* index of normal */
u_short norm2, norm3;
} TMD_PRIM;
/*
* Multi-purpose TIM image
*/
typedef struct {
u_long mode; /* pixel mode */
RECT16 *cRECT16; /* CLUT RECT16angle on frame buffer */
u_long *caddr; /* CLUT address on main memory */
RECT16 *pRECT16; /* texture image RECT16angle on frame buffer */
u_long *paddr; /* texture image address on main memory */
} TIM_IMAGE;
#pragma pack(pop)
#if defined(_LANGUAGE_C_PLUS_PLUS)||defined(__cplusplus)||defined(c_plusplus)
extern "C" {
#endif
#ifdef LoadImage
#undef LoadImage
#endif
/*
* Prototypes
*/
#ifndef _FNTPRINT_
#define _FNTPRINT_
extern int FntPrint(char* text, ...);
#endif /* _FNTPRINT_ */
#ifndef _KANJIFNTPRINT_
#define _KANJIFNTPRINT_
extern int KanjiFntPrint(char* text, ...);
#endif /* _KANJIFNTPRINT_ */
extern DISPENV *GetDispEnv(DISPENV *env);
extern DISPENV *PutDispEnv(DISPENV *env);
extern DISPENV *SetDefDispEnv(DISPENV *env, int x, int y, int w, int h);
extern DRAWENV *GetDrawEnv(DRAWENV *env);
extern DRAWENV *PutDrawEnv(DRAWENV *env);
extern DRAWENV *SetDefDrawEnv(DRAWENV *env, int x, int y, int w, int h);
extern TIM_IMAGE *ReadTIM(TIM_IMAGE *timimg);
extern TMD_PRIM *ReadTMD(TMD_PRIM *tmdprim);
extern int CheckPrim(char *s, u_long *p);
extern int ClearImage(RECT16 *RECT16, u_char r, u_char g, u_char b);
extern int ClearImage2(RECT16 *RECT16, u_char r, u_char g, u_char b);
extern int DrawSync(int mode);
extern int FntOpen(int x, int y, int w, int h, int isbg, int n);
extern int GetGraphDebug(void);
extern int GetTimSize(u_char *sjis);
extern int IsEndPrim(void *p);
extern int KanjiFntOpen(int x, int y, int w, int h, int dx, int dy, int cx, int cy, int isbg, int n);
extern void KanjiFntClose(void);
extern int Krom2Tim(u_char *sjis, u_long *taddr, int dx, int dy, int cdx, int cdy, u_int fg, u_int bg);
extern int LoadImagePSX(RECT16 *rect, u_long *p);
extern int LoadImage(RECT16* rect, u_long* p);
extern int LoadImage2(RECT16* rect, u_long* p);
extern int MargePrim(void *p0, void *p1);
extern int MoveImage(RECT16* rect, int x, int y);
extern int OpenTIM(u_long *addr);
extern int OpenTMD(u_long *tmd, int obj_no);
extern int ResetGraph(int mode);
extern int SetGraphDebug(int level);
extern int StoreImage(RECT16 *rect, u_long *p);
extern u_long *ClearOTag(u_long *ot, int n);
extern u_long *ClearOTagR(u_long *ot, int n);
extern u_long *FntFlush(int id);
extern u_long *KanjiFntFlush(int id);
extern u_long DrawSyncCallback(void (*func)(void));
extern u_short GetClut(int x, int y);
extern u_short GetTPage(int tp, int abr, int x, int y);
extern u_short LoadClut(u_long *clut, int x, int y);
extern u_short LoadClut2(u_long *clut, int x, int y);
extern u_short LoadTPage(u_long *pix, int tp, int abr, int x, int y, int w, int h);
extern void *NextPrim(void *p);
extern void AddPrim(void *ot, void *p);
extern void AddPrims(void *ot, void *p0, void *p1);
extern void CatPrim(void *p0, void *p1);
extern void DrawOTag(u_long *p);
extern void DrawOTagIO(u_long *p);
extern void DrawOTagEnv(u_long *p, DRAWENV *env);
extern void DrawPrim(void *p);
extern void DumpClut(u_short clut);
extern void DumpDispEnv(DISPENV *env);
extern void DumpDrawEnv(DRAWENV *env);
extern void DumpOTag(u_long *p);
extern void DumpTPage(u_short tpage);
extern void FntLoad(int tx, int ty);
extern void SetDispMask(int mask);
extern void SetDrawArea(DR_AREA *p, RECT16 *r);
extern void SetDrawEnv(DR_ENV *dr_env, DRAWENV *env);
extern void SetDrawLoad(DR_LOAD *p, RECT16 *RECT16);
extern void SetDrawMode(DR_MODE *p, int dfe, int dtd, int tpage, RECT16 *tw);
extern void SetDrawTPage(DR_TPAGE *p, int dfe, int dtd, int tpage);
extern void SetDrawMove(DR_MOVE *p, RECT16 *RECT16, int x, int y);
extern void SetDrawOffset(DR_OFFSET *p, u_short *ofs);
extern void SetDrawStp(DR_STP *p, int pbw);
extern void SetDumpFnt(int id);
extern void SetLineF2(LINE_F2 *p);
extern void SetLineF3(LINE_F3 *p);
extern void SetLineF4(LINE_F4 *p);
extern void SetLineG2(LINE_G2 *p);
extern void SetLineG3(LINE_G3 *p);
extern void SetLineG4(LINE_G4 *p);
extern void SetPolyF3(POLY_F3 *p);
extern void SetPolyF4(POLY_F4 *p);
extern void SetPolyFT3(POLY_FT3 *p);
extern void SetPolyFT4(POLY_FT4 *p);
extern void SetPolyG3(POLY_G3 *p);
extern void SetPolyG4(POLY_G4 *p);
extern void SetPolyGT3(POLY_GT3 *p);
extern void SetPolyGT4(POLY_GT4 *p);
extern void SetSemiTrans(void *p, int abe);
extern void SetShadeTex(void *p, int tge);
extern void SetSprt(SPRT *p);
extern void SetSprt16(SPRT_16 *p);
extern void SetSprt8(SPRT_8 *p);
extern void SetTexWindow(DR_TWIN *p, RECT16 *tw);
extern void SetTile(TILE *p);
extern void SetTile1(TILE_1 *p);
extern void SetTile16(TILE_16 *p);
extern void SetTile8(TILE_8 *p);
extern void TermPrim(void *p);
extern u_long *BreakDraw(void);
extern void ContinueDraw(u_long *insaddr, u_long *contaddr);
extern int IsIdleGPU(int max_count);
extern int GetODE(void);
extern int LoadImage2(RECT16 *RECT16, u_long *p);
extern int StoreImage2(RECT16 *RECT16, u_long *p);
extern int MoveImage2(RECT16 *RECT16, int x, int y);
extern int DrawOTag2(u_long *p);
extern void GetDrawMode(DR_MODE *p);
extern void GetTexWindow(DR_TWIN *p);
extern void GetDrawArea(DR_AREA *p);
extern void GetDrawOffset(DR_OFFSET *p);
extern void GetDrawEnv2(DR_ENV *p);
/*
* PSY-X commands
*/
extern void SetPsyXTexture(DR_PSYX_TEX *p, uint grTextureId);
#if defined(_LANGUAGE_C_PLUS_PLUS)||defined(__cplusplus)||defined(c_plusplus)
}
#endif
#endif

View File

@ -1,92 +0,0 @@
#ifndef LIBGTE_H
#define LIBGTE_H
#include "types.h"
#include "PsyX/common/pgxp_defs.h"
typedef struct {
short m[3][3]; /* 3x3 rotation matrix */
long t[3]; /* transfer vector */
} MATRIX;
typedef struct { /* long word type 3D vector */
long vx, vy;
long vz, pad;
} VECTOR;
typedef struct { /* short word type 3D vector */
short vx, vy;
short vz, pad;
} SVECTOR;
typedef struct { /* color type vector */
unsigned char r, g, b, cd;
} CVECTOR;
typedef struct { /* 2D short vector */
short vx, vy;
} DVECTOR;
#if defined(_LANGUAGE_C_PLUS_PLUS)||defined(__cplusplus)||defined(c_plusplus)
extern "C" {
#endif
extern void InitGeom();
extern void SetGeomOffset(int ofx, int ofy);
extern void SetGeomScreen(int h);
extern void SetRotMatrix(MATRIX* m);
extern void SetLightMatrix(MATRIX* m);
extern void SetColorMatrix(MATRIX* m);
extern void SetTransMatrix(MATRIX* m);
extern void PushMatrix();
extern void PopMatrix();
VECTOR *ApplyMatrix(MATRIX *m, SVECTOR *v0, VECTOR *v1);
VECTOR *ApplyRotMatrix(SVECTOR *v0, VECTOR *v1);
VECTOR *ApplyRotMatrixLV(VECTOR *v0, VECTOR *v1);
SVECTOR *ApplyMatrixSV(MATRIX *m, SVECTOR *v0, SVECTOR *v1);
VECTOR *ApplyMatrixLV(MATRIX *m, VECTOR *v0, VECTOR *v1);
extern void RotTrans(SVECTOR* v0, VECTOR* v1, long* flag);
extern void RotTransSV(SVECTOR* v0, SVECTOR* v1, long* flag);
extern long RotTransPers(SVECTOR* v0, long* sxy, long* p, long* flag);
extern long RotTransPers3(SVECTOR* v0, SVECTOR* v1, SVECTOR* v2, long* sxy0, long* sxy1, long* sxy2, long* p, long* flag);
extern long RotTransPers4(SVECTOR* v0, SVECTOR* v1, SVECTOR* v2, SVECTOR* v3, long* sxy0, long* sxy1, long* sxy2, long* sxy3, long* p, long* flag);
extern void NormalColor(SVECTOR* v0, CVECTOR* v1);
extern void NormalColor3(SVECTOR* v0, SVECTOR* v1, SVECTOR* v2, CVECTOR* v3, CVECTOR* v4, CVECTOR* v5);
extern void NormalColorDpq(SVECTOR* v0, CVECTOR* v1, long p, CVECTOR* v2);
extern void NormalColorCol(SVECTOR* v0, CVECTOR* v1, CVECTOR* v2);
extern void NormalColorCol3(SVECTOR* v0, SVECTOR* v1, SVECTOR* v2, CVECTOR* v3, CVECTOR* v4, CVECTOR* v5, CVECTOR* v6);
extern void LocalLight(SVECTOR* v0, VECTOR* v1);
extern long RotAverageNclip4(SVECTOR* v0, SVECTOR* v1, SVECTOR* v2, SVECTOR* v3, long* sxy0/*arg_10*/, long* sxy1/*arg_14*/, long* sxy2/*arg_18*/, long* sxy3/*arg_1C*/, long* p/*arg_20*/, long* otz/*arg_24*/, long* flag/*arg_28*/);
extern MATRIX* MulMatrix0(MATRIX* m0, MATRIX* m1, MATRIX* m2);
extern MATRIX* MulMatrix(MATRIX* m0, MATRIX* m1);
extern MATRIX* MulMatrix2(MATRIX* m0, MATRIX* m1);
extern void SetBackColor(long rbk, long gbk, long bbk);
extern void SetFarColor(long rfc, long gfc, long bfc);
extern MATRIX* RotMatrix(SVECTOR* r, MATRIX* m);
extern MATRIX* RotMatrixYXZ(SVECTOR* r, MATRIX* m);
extern MATRIX* RotMatrixZYX_gte(SVECTOR* r, MATRIX* m);
extern MATRIX* RotMatrixX(long r, MATRIX *m);
extern MATRIX* RotMatrixY(long r, MATRIX *m);
extern MATRIX* RotMatrixZ(long r, MATRIX *m);
extern MATRIX* TransMatrix(MATRIX* m, VECTOR* v);
extern MATRIX* ScaleMatrix(MATRIX* m, VECTOR* v);
extern MATRIX* MulRotMatrix(MATRIX* m0);
extern void ColorDpq(VECTOR* v0, CVECTOR* v1, long p, CVECTOR* v2);
extern void ColorCol(VECTOR* v0, CVECTOR* v1, CVECTOR* v2);
extern long NormalClip(long sxy0, long sxy1, long sxy2);
extern void SetDQA(int iDQA);
extern void SetDQB(int iDQB);
extern void SetFogNear(long a, long h);
extern void SetFogNearFar(long a, long b, long h);
extern long SquareRoot0(long a);
extern int rsin(int a);
extern int rcos(int a);
extern long ratan2(long y, long x);
#if defined(_LANGUAGE_C_PLUS_PLUS)||defined(__cplusplus)||defined(c_plusplus)
}
#endif
#endif

View File

@ -1,12 +0,0 @@
#ifndef LIBMATH_H
#define LIBMATH_H
#define _USE_MATH_DEFINES
#ifdef __GNUC__
#include <stdint.h>
#endif
#include <math.h>
#endif

View File

@ -1,53 +0,0 @@
#ifndef LIBMCRD_H
#define LIBMCRD_H
#include "kernel.h"
typedef void (*MemCB)( long cmds, long rslt );
#define McFuncExist (1)
#define McFuncAccept (2)
#define McFuncReadFile (3)
#define McFuncWriteFile (4)
#define McFuncReadData (5)
#define McFuncWriteData (6)
#define McErrNone (0)
#define McErrCardNotExist (1)
#define McErrCardInvalid (2)
#define McErrNewCard (3)
#define McErrNotFormat (4)
#define McErrFileNotExist (5)
#define McErrAlreadyExist (6)
#define McErrBlockFull (7)
#define McErrExtend (0x8000)
#if defined(_LANGUAGE_C_PLUS_PLUS)||defined(__cplusplus)||defined(c_plusplus)
extern "C" {
#endif
extern void MemCardInit( long val );
extern void MemCardEnd( void );
extern void MemCardStart(void);
extern void MemCardStop(void);
extern long MemCardExist( long chan );
extern long MemCardAccept( long chan );
extern long MemCardOpen( long chan, char* file, long flag );
extern void MemCardClose(void);
extern long MemCardReadData( unsigned long* adrs, long ofs, long bytes );
extern long MemCardReadFile( long chan, char* file, unsigned long* adrs, long ofs, long bytes );
extern long MemCardWriteData( unsigned long* adrs, long ofs, long bytes );
extern long MemCardWriteFile( long chan, char* file, unsigned long* adrs, long ofs ,long bytes );
extern long MemCardCreateFile( long chan, char* file, long blocks );
extern long MemCardDeleteFile( long chan, char* file );
extern long MemCardFormat( long chan );
extern long MemCardUnformat(long chan);
extern long MemCardSync( long mode, long* cmds, long* rslt );
extern MemCB MemCardCallback( MemCB func );
extern long MemCardGetDirentry( long chan, char* name, struct DIRENTRY* dir, long* files, long ofs, long max );
#if defined(_LANGUAGE_C_PLUS_PLUS)||defined(__cplusplus)||defined(c_plusplus)
}
#endif
#endif

View File

@ -1,61 +0,0 @@
#ifndef LIBPAD_H
#define LIBPAD_H
#define PadStateDiscon 0
#define PadStateFindPad 1
#define PadStateFindCTP1 2
#define PadStateFindCTP2 3
#define PadStateReqInfo 4
#define PadStateExecCmd 5
#define PadStateStable 6
#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 PadMaxCurr 60
#define PadCurrCTP1 10
#define MAX_CONTROLLERS 2 // TODO: multi-tap (2 ports * 5 taps (1st is Direct))
typedef struct PADRAW
{
unsigned char status; // size=0, offset=0
unsigned char id; // size=0, offset=1
unsigned char buttons[2]; // size=2, offset=2
unsigned char analog[4]; // size=4, offset=4
} *LPPADRAW;
#if defined(_LANGUAGE_C_PLUS_PLUS)||defined(__cplusplus)||defined(c_plusplus)
extern "C" {
#endif
extern void PadInitDirect(unsigned char* pad1, unsigned char* pad2);
extern void PadInitMtap(unsigned char* unk00, unsigned char* unk01);
extern void PadInitGun(unsigned char* unk00, int unk01);
extern int PadChkVsync();
extern void PadStartCom();
extern void PadStopCom();
extern unsigned int PadEnableCom(unsigned int unk00);
extern void PadEnableGun(unsigned char unk00);
extern void PadRemoveGun();
extern int PadGetState(int port);
extern int PadInfoMode(int port, int term, int offs);
extern int PadInfoAct(int port, int acno, int term);
extern int PadInfoComb(int unk00, int, int unk01);
extern int PadSetActAlign(int port, unsigned char* table);
extern int PadSetMainMode(int socket, int offs, int lock);
extern void PadSetAct(int port, unsigned char* table, int len);
#if defined(_LANGUAGE_C_PLUS_PLUS)||defined(__cplusplus)||defined(c_plusplus)
}
#endif
#endif

View File

@ -1,21 +0,0 @@
#ifndef LIBPRESS_H
#define LIBPRESS_H
#if defined(_LANGUAGE_C_PLUS_PLUS)||defined(__cplusplus)||defined(c_plusplus)
extern "C" {
#endif
extern void DecDCTReset(int mode);
extern int DecDCTBufSize(u_long *bs);
extern void DecDCTvlc(u_long *bs, u_long *buf);
extern void DecDCTin(u_long *buf, int mode);
extern void DecDCTout(u_long *buf, int size);
extern int DecDCTinSync( int mode) ;
extern int DecDCToutSync( int mode) ;
#if defined(_LANGUAGE_C_PLUS_PLUS)||defined(__cplusplus)||defined(c_plusplus)
}
#endif
#endif

View File

@ -1,23 +0,0 @@
#ifndef LIBSN_H
#define LIBSN_H
#include <stdint.h>
#if defined(_LANGUAGE_C_PLUS_PLUS)||defined(__cplusplus)||defined(c_plusplus)
extern "C" {
#endif
extern int PCinit();
extern uintptr_t PCopen(char* name, int flags, int perms);
extern int PCcreat(char* name, int perms);
extern int PClseek(uintptr_t fd, int offset, int mode);
extern int PCread(uintptr_t fd, char* buff, int len);
extern int PCwrite(uintptr_t fd, char* buff, int len);
extern int PCclose(uintptr_t fd);
#if defined(_LANGUAGE_C_PLUS_PLUS)||defined(__cplusplus)||defined(c_plusplus)
}
#endif
#endif

View File

@ -1,533 +0,0 @@
#ifndef LIBSPU_H
#define LIBSPU_H
/* ----------------------------------------------------------------
* CONSTANT
* ---------------------------------------------------------------- */
#define SPU_SUCCESS 0
#define SPU_INVALID_ARGS (-3)
#define SPU_DIAG (-2)
#define SPU_CHECK (-1)
#define SPU_OFF 0
#define SPU_ON 1
#define SPU_CLEAR 2
#define SPU_RESET 3
#define SPU_DONT_CARE 4
#define SPU_ALL 0
#define SPU_CDONLY 5
#define SPU_VOICEONLY 6
#define SPU_CONT 7
#define SPU_BIT 8
#define SPU_NULL 0
/* Macros below will be obsoleted. */
#define SpuDiag SPU_DIAG
#define SpuCheck SPU_CHECK
#define SpuOff SPU_OFF
#define SpuOn SPU_ON
#define SpuClear SPU_CLEAR
#define SpuReset SPU_RESET
#define SpuDontCare SPU_DONT_CARE
#define SpuALL SPU_ALL
#define SpuCDOnly SPU_CDONLY
#define SpuVoiceOnly SPU_VOICEONLY
#define SpuCont SPU_CONT
#define SpuNull SPU_NULL
#define SPU_OFF_ENV_ON 2
#define SPU_ON_ENV_OFF 3
/* Macros below will be obsoleted. */
#define SpuOffEnvOn SPU_OFF_ENV_ON
#define SpuOnEnvOff SPU_ON_ENV_OFF
#define SPU_ERROR (-1)
/* Macros below will be obsoleted. */
#define SpuError SPU_ERROR
#define SPU_TRANSFER_BY_DMA 0L
#define SPU_TRANSFER_BY_IO 1L
/* Macros below will be obsoleted. */
#define SpuTransferByDMA SPU_TRANSFER_BY_DMA
#define SpuTransferByIO SPU_TRANSFER_BY_IO
#define SpuTransByDMA SpuTransferByDMA
#define SpuTransByIO SpuTransferByIO
#define SPU_TRANSFER_WAIT 1
#define SPU_TRANSFER_PEEK 0
#define SPU_TRANSFER_GLANCE SPU_TRANSFER_PEEK
/*
* Voice designate
*/
#ifndef __SPU_VOICE
#define __SPU_VOICE
#define SPU_00CH (0x1L<< 0)
#define SPU_01CH (0x1L<< 1)
#define SPU_02CH (0x1L<< 2)
#define SPU_03CH (0x1L<< 3)
#define SPU_04CH (0x1L<< 4)
#define SPU_05CH (0x1L<< 5)
#define SPU_06CH (0x1L<< 6)
#define SPU_07CH (0x1L<< 7)
#define SPU_08CH (0x1L<< 8)
#define SPU_09CH (0x1L<< 9)
#define SPU_10CH (0x1L<<10)
#define SPU_11CH (0x1L<<11)
#define SPU_12CH (0x1L<<12)
#define SPU_13CH (0x1L<<13)
#define SPU_14CH (0x1L<<14)
#define SPU_15CH (0x1L<<15)
#define SPU_16CH (0x1L<<16)
#define SPU_17CH (0x1L<<17)
#define SPU_18CH (0x1L<<18)
#define SPU_19CH (0x1L<<19)
#define SPU_20CH (0x1L<<20)
#define SPU_21CH (0x1L<<21)
#define SPU_22CH (0x1L<<22)
#define SPU_23CH (0x1L<<23)
#define SPU_0CH SPU_00CH
#define SPU_1CH SPU_01CH
#define SPU_2CH SPU_02CH
#define SPU_3CH SPU_03CH
#define SPU_4CH SPU_04CH
#define SPU_5CH SPU_05CH
#define SPU_6CH SPU_06CH
#define SPU_7CH SPU_07CH
#define SPU_8CH SPU_08CH
#define SPU_9CH SPU_09CH
#define SPU_ALLCH (SPU_00CH | SPU_01CH | SPU_02CH | SPU_03CH | SPU_04CH | \
SPU_05CH | SPU_06CH | SPU_07CH | SPU_08CH | SPU_09CH | \
SPU_10CH | SPU_11CH | SPU_12CH | SPU_13CH | SPU_14CH | \
SPU_15CH | SPU_16CH | SPU_17CH | SPU_18CH | SPU_19CH | \
SPU_20CH | SPU_21CH | SPU_22CH | SPU_23CH)
#define SPU_KEYCH(x) (0x1L<<(x))
#define SPU_VOICECH(x) SPU_KEYCH(x)
#endif /* __SPU_VOICE */
/* for Voice setting */
#define SPU_VOICE_VOLL (0x01 << 0) /* volume (left) */
#define SPU_VOICE_VOLR (0x01 << 1) /* volume (right) */
#define SPU_VOICE_VOLMODEL (0x01 << 2) /* volume mode (left) */
#define SPU_VOICE_VOLMODER (0x01 << 3) /* volume mode (right) */
#define SPU_VOICE_PITCH (0x01 << 4) /* tone (pitch setting) */
#define SPU_VOICE_NOTE (0x01 << 5) /* tone (note setting) */
#define SPU_VOICE_SAMPLE_NOTE (0x01 << 6) /* waveform data sample note */
#define SPU_VOICE_WDSA (0x01 << 7) /* waveform data start address */
#define SPU_VOICE_ADSR_AMODE (0x01 << 8) /* ADSR Attack rate mode */
#define SPU_VOICE_ADSR_SMODE (0x01 << 9) /* ADSR Sustain rate mode */
#define SPU_VOICE_ADSR_RMODE (0x01 << 10) /* ADSR Release rate mode */
#define SPU_VOICE_ADSR_AR (0x01 << 11) /* ADSR Attack rate */
#define SPU_VOICE_ADSR_DR (0x01 << 12) /* ADSR Decay rate */
#define SPU_VOICE_ADSR_SR (0x01 << 13) /* ADSR Sustain rate */
#define SPU_VOICE_ADSR_RR (0x01 << 14) /* ADSR Release rate */
#define SPU_VOICE_ADSR_SL (0x01 << 15) /* ADSR Sustain level */
#define SPU_VOICE_LSAX (0x01 << 16) /* start address for loop */
#define SPU_VOICE_ADSR_ADSR1 (0x01 << 17) /* ADSR adsr1 for `VagAtr' */
#define SPU_VOICE_ADSR_ADSR2 (0x01 << 18) /* ADSR adsr2 for `VagAtr' */
#define SPU_VOICE_DIRECT16 0
#define SPU_VOICE_LINEARIncN 1
#define SPU_VOICE_LINEARIncR 2
#define SPU_VOICE_LINEARDecN 3
#define SPU_VOICE_LINEARDecR 4
#define SPU_VOICE_EXPIncN 5
#define SPU_VOICE_EXPIncR 6
#define SPU_VOICE_EXPDec 7
#define SPU_VOICE_EXPDecN SPU_VOICE_EXPDec
#define SPU_VOICE_EXPDecR SPU_VOICE_EXPDec
#define SPU_DECODED_FIRSTHALF 0
#define SPU_DECODED_SECONDHALF 1
#define SPU_DECODE_FIRSTHALF SPU_DECODED_FIRSTHALF
#define SPU_DECODE_SECONDHALF SPU_DECODED_SECONDHALF
#define SPU_COMMON_MVOLL (0x01 << 0) /* master volume (left) */
#define SPU_COMMON_MVOLR (0x01 << 1) /* master volume (right) */
#define SPU_COMMON_MVOLMODEL (0x01 << 2) /* master volume mode (left) */
#define SPU_COMMON_MVOLMODER (0x01 << 3) /* master volume mode (right) */
#define SPU_COMMON_RVOLL (0x01 << 4) /* reverb volume (left) */
#define SPU_COMMON_RVOLR (0x01 << 5) /* reverb volume (right) */
#define SPU_COMMON_CDVOLL (0x01 << 6) /* CD input volume (left) */
#define SPU_COMMON_CDVOLR (0x01 << 7) /* CD input volume (right) */
#define SPU_COMMON_CDREV (0x01 << 8) /* CD input reverb on/off */
#define SPU_COMMON_CDMIX (0x01 << 9) /* CD input on/off */
#define SPU_COMMON_EXTVOLL (0x01 << 10) /* external digital input volume (left) */
#define SPU_COMMON_EXTVOLR (0x01 << 11) /* external digital input volume (right) */
#define SPU_COMMON_EXTREV (0x01 << 12) /* external digital input reverb on/off */
#define SPU_COMMON_EXTMIX (0x01 << 13) /* external digital input on/off */
/* for Reverb setting */
#define SPU_REV_MODE (0x01 << 0) /* mode setting */
#define SPU_REV_DEPTHL (0x01 << 1) /* reverb depth (left) */
#define SPU_REV_DEPTHR (0x01 << 2) /* reverb depth (right) */
#define SPU_REV_DELAYTIME (0x01 << 3) /* Delay Time (ECHO, DELAY only) */
#define SPU_REV_FEEDBACK (0x01 << 4) /* Feedback (ECHO only) */
#define SPU_REV_MODE_CHECK (-1)
#define SPU_REV_MODE_OFF 0
#define SPU_REV_MODE_ROOM 1
#define SPU_REV_MODE_STUDIO_A 2
#define SPU_REV_MODE_STUDIO_B 3
#define SPU_REV_MODE_STUDIO_C 4
#define SPU_REV_MODE_HALL 5
#define SPU_REV_MODE_SPACE 6
#define SPU_REV_MODE_ECHO 7
#define SPU_REV_MODE_DELAY 8
#define SPU_REV_MODE_PIPE 9
#define SPU_REV_MODE_MAX 10
#define SPU_REV_MODE_CLEAR_WA 0x100
/* ----------------------------------------------------------------
* Event flushing
* ---------------------------------------------------------------- */
#define SPU_EVENT_KEY (0x01 << 0)
#define SPU_EVENT_PITCHLFO (0x01 << 1)
#define SPU_EVENT_NOISE (0x01 << 2)
#define SPU_EVENT_REVERB (0x01 << 3)
#define SPU_EVENT_ALL 0
/* ----------------------------------------------------------------
* Structure
* ---------------------------------------------------------------- */
typedef struct {
short left; /* Lch */
short right; /* Rch */
} SpuVolume;
typedef struct {
unsigned long voice; /* set voice:
SpuSetVoiceAttr: each voice is a bit array
SpuGetVoiceAttr: voice is a bit value */
unsigned long mask; /* settings attribute bit (invalid with Get) */
SpuVolume volume; /* volume */
SpuVolume volmode; /* volume mode */
SpuVolume volumex; /* current volume (invalid with Set) */
unsigned short pitch; /* tone (pitch setting) */
unsigned short note; /* tone (note setting) */
unsigned short sample_note; /* tone (note setting) */
short envx; /* current envelope value (invalid with Set) */
unsigned long addr; /* waveform data start address */
unsigned long loop_addr; /* loop start address */
long a_mode; /* Attack rate mode */
long s_mode; /* Sustain rate mode */
long r_mode; /* Release rate mode */
unsigned short ar; /* Attack rate */
unsigned short dr; /* Decay rate */
unsigned short sr; /* Sustain rate */
unsigned short rr; /* Release rate */
unsigned short sl; /* Sustain level */
unsigned short adsr1; /* adsr1 for `VagAtr' */
unsigned short adsr2; /* adsr2 for `VagAtr' */
} SpuVoiceAttr;
typedef struct {
short voiceNum; /* voice number */
short pad; /* padding */
SpuVoiceAttr attr; /* voice attribute */
} SpuLVoiceAttr;
typedef struct {
unsigned long mask; /* settings mask */
long mode; /* reverb mode */
SpuVolume depth; /* reverb depth */
long delay; /* Delay Time (ECHO, DELAY only) */
long feedback; /* Feedback (ECHO only) */
} SpuReverbAttr;
#define SPU_DECODEDDATA_SIZE 0x200
#define SPU_DECODEDATA_SIZE SPU_DECODEDDATA_SIZE
typedef struct {
short cd_left [SPU_DECODEDDATA_SIZE];
short cd_right [SPU_DECODEDDATA_SIZE];
short voice1 [SPU_DECODEDDATA_SIZE];
short voice3 [SPU_DECODEDDATA_SIZE];
} SpuDecodedData;
typedef SpuDecodedData SpuDecodeData;
typedef struct {
SpuVolume volume; /* volume */
long reverb; /* reverb on/off */
long mix; /* mixing on/off */
} SpuExtAttr;
typedef struct {
unsigned long mask; /* settings mask */
SpuVolume mvol; /* master volume */
SpuVolume mvolmode; /* master volume mode */
SpuVolume mvolx; /* current master volume */
SpuExtAttr cd; /* CD input attributes */
SpuExtAttr ext; /* external digital input attributes */
} SpuCommonAttr;
#ifndef __SPU_IRQCALLBACK_PROC
#define __SPU_IRQCALLBACK_PROC
typedef void (*SpuIRQCallbackProc)(void);
#endif /* __SPU_IRQCALLBACK_PROC */
#ifndef __SPU_TRANSFERCALLBACK_PROC
#define __SPU_TRANSFERCALLBACK_PROC
typedef void (*SpuTransferCallbackProc)(void);
#endif /* __SPU_TRANSFERCALLBACK_PROC */
/* ----------------------------------------------------------------
* for SPU Malloc (used in SpuInitMalloc())
* ---------------------------------------------------------------- */
#define SPU_MALLOC_RECSIZ 8
/* ----------------------------------------------------------------
* User specifiable global environment
* ---------------------------------------------------------------- */
typedef struct {
unsigned long mask;
unsigned long queueing;
} SpuEnv;
#define SPU_ENV_EVENT_QUEUEING (0x01 << 0)
/* ----------------------------------------------------------------
* prototype declaration
* ---------------------------------------------------------------- */
#if defined(_LANGUAGE_C_PLUS_PLUS) || defined(__cplusplus) || defined(c_plusplus)
extern "C" {
#endif
extern void SpuInit (void);
extern void SpuInitHot (void);
extern void SpuStart (void);
extern void SpuQuit (void);
extern long SpuSetMute (long on_off);
extern long SpuGetMute (void);
extern void SpuSetEnv (SpuEnv *env);
extern long SpuSetNoiseClock (long n_clock);
extern long SpuGetNoiseClock (void);
extern unsigned long SpuSetNoiseVoice (long on_off, unsigned long voice_bit);
extern unsigned long SpuGetNoiseVoice (void);
extern long SpuSetReverb (long on_off);
extern long SpuGetReverb (void);
extern long SpuSetReverbModeParam (SpuReverbAttr *attr);
extern void SpuGetReverbModeParam (SpuReverbAttr *attr);
extern long SpuSetReverbDepth (SpuReverbAttr *attr);
extern long SpuReserveReverbWorkArea (long on_off);
extern long SpuIsReverbWorkAreaReserved (long on_off);
extern unsigned long SpuSetReverbVoice (long on_off, unsigned long voice_bit);
extern unsigned long SpuGetReverbVoice (void);
extern long SpuClearReverbWorkArea (long mode);
extern unsigned long SpuWrite (unsigned char *addr, unsigned long size);
extern unsigned long SpuWrite0 (unsigned long size);
extern unsigned long SpuRead (unsigned char *addr, unsigned long size);
extern long SpuSetTransferMode (long mode);
#define SpuSetTransMode(mode) SpuSetTransferMode((mode))
extern long SpuGetTransferMode (void);
#define SpuGetTransMode() SpuGetTransferMode()
extern unsigned long SpuSetTransferStartAddr (unsigned long addr);
#define SpuSetTransStartAddr(addr) SpuSetTransferStartAddr((addr))
extern unsigned long SpuGetTransferStartAddr (void);
#define SpuGetTransStartAddr() SpuGetTransferStartAddr()
extern unsigned long SpuWritePartly (unsigned char *addr, unsigned long size);
extern long SpuIsTransferCompleted (long flag);
extern SpuTransferCallbackProc SpuSetTransferCallback (SpuTransferCallbackProc func);
extern long SpuReadDecodedData (SpuDecodedData *d_data, long flag);
#define SpuReadDecodeData(d_data,flag) SpuReadDecodedData((d_data), (flag))
extern long SpuSetIRQ (long on_off);
extern long SpuGetIRQ (void);
extern unsigned long SpuSetIRQAddr (unsigned long);
extern unsigned long SpuGetIRQAddr (void);
extern SpuIRQCallbackProc SpuSetIRQCallback (SpuIRQCallbackProc);
extern void SpuSetVoiceAttr (SpuVoiceAttr *arg);
extern void SpuGetVoiceAttr (SpuVoiceAttr *arg);
extern void SpuSetKey (long on_off, unsigned long voice_bit);
extern void SpuSetKeyOnWithAttr (SpuVoiceAttr *attr);
extern long SpuGetKeyStatus (unsigned long voice_bit);
extern void SpuGetAllKeysStatus (char *status);
extern unsigned long SpuFlush (unsigned long ev);
extern unsigned long SpuSetPitchLFOVoice (long on_off, unsigned long voice_bit);
extern unsigned long SpuGetPitchLFOVoice (void);
extern void SpuSetCommonAttr (SpuCommonAttr *attr);
extern void SpuGetCommonAttr (SpuCommonAttr *attr);
extern long SpuInitMalloc (long num, char *top);
extern long SpuMalloc (long size);
extern long SpuMallocWithStartAddr (unsigned long addr, long size);
extern void SpuFree (unsigned long addr);
extern long SpuRGetAllKeysStatus (long min_, long max_, char *status);
extern long SpuRSetVoiceAttr (long min_, long max_, SpuVoiceAttr *arg);
extern void SpuNSetVoiceAttr (int vNum, SpuVoiceAttr *arg);
extern void SpuNGetVoiceAttr (int vNum, SpuVoiceAttr *arg);
extern void SpuLSetVoiceAttr (int num, SpuLVoiceAttr *argList);
extern void SpuSetVoiceVolume (int vNum, short volL, short volR);
extern void SpuSetVoiceVolumeAttr (int vNum, short volL, short volR,
short volModeL, short volModeR);
extern void SpuSetVoicePitch (int vNum, unsigned short pitch);
extern void SpuSetVoiceNote (int vNum, unsigned short note);
extern void SpuSetVoiceSampleNote (int vNum, unsigned short sampleNote);
extern void SpuSetVoiceStartAddr (int vNum, unsigned long startAddr);
extern void SpuSetVoiceLoopStartAddr (int vNum, unsigned long lsa);
extern void SpuSetVoiceAR (int vNum, unsigned short AR);
extern void SpuSetVoiceDR (int vNum, unsigned short DR);
extern void SpuSetVoiceSR (int vNum, unsigned short SR);
extern void SpuSetVoiceRR (int vNum, unsigned short RR);
extern void SpuSetVoiceSL (int vNum, unsigned short SL);
extern void SpuSetVoiceARAttr (int vNum, unsigned short AR, long ARmode);
extern void SpuSetVoiceSRAttr (int vNum, unsigned short SR, long SRmode);
extern void SpuSetVoiceRRAttr (int vNum, unsigned short RR, long RRmode);
extern void SpuSetVoiceADSR (int vNum, unsigned short AR, unsigned short DR,
unsigned short SR, unsigned short RR,
unsigned short SL);
extern void SpuSetVoiceADSRAttr (int vNum,
unsigned short AR, unsigned short DR,
unsigned short SR, unsigned short RR,
unsigned short SL,
long ARmode, long SRmode, long RRmode);
extern void SpuGetVoiceVolume (int vNum, short *volL, short *volR);
extern void SpuGetVoiceVolumeAttr (int vNum, short *volL, short *volR,
short *volModeL, short *volModeR);
extern void SpuGetVoiceVolumeX (int vNum, short *volXL, short *volXR);
extern void SpuGetVoicePitch (int vNum, unsigned short *pitch);
extern void SpuGetVoiceNote (int vNum, unsigned short *note);
extern void SpuGetVoiceSampleNote (int vNum, unsigned short *sampleNote);
extern void SpuGetVoiceEnvelope (int vNum, short *envx);
extern void SpuGetVoiceStartAddr (int vNum, unsigned long *startAddr);
extern void SpuGetVoiceLoopStartAddr (int vNum, unsigned long *loopStartAddr);
extern void SpuGetVoiceAR (int vNum, unsigned short *AR);
extern void SpuGetVoiceDR (int vNum, unsigned short *DR);
extern void SpuGetVoiceSR (int vNum, unsigned short *SR);
extern void SpuGetVoiceRR (int vNum, unsigned short *RR);
extern void SpuGetVoiceSL (int vNum, unsigned short *SL);
extern void SpuGetVoiceARAttr (int vNum, unsigned short *AR, long *ARmode);
extern void SpuGetVoiceSRAttr (int vNum, unsigned short *SR, long *SRmode);
extern void SpuGetVoiceRRAttr (int vNum, unsigned short *RR, long *RRmode);
extern void SpuGetVoiceADSR (int vNum,
unsigned short *AR, unsigned short *DR,
unsigned short *SR, unsigned short *RR,
unsigned short *SL);
extern void SpuGetVoiceADSRAttr (int vNum,
unsigned short *AR, unsigned short *DR,
unsigned short *SR, unsigned short *RR,
unsigned short *SL,
long *ARmode, long *SRmode, long *RRmode);
extern void SpuGetVoiceEnvelopeAttr (int vNum, long *keyStat, short *envx );
extern void SpuSetCommonMasterVolume (short mvol_left, short mvol_right);
extern void SpuSetCommonMasterVolumeAttr (short mvol_left, short mvol_right,
short mvolmode_left,
short mvolmode_right);
extern void SpuSetCommonCDMix (long cd_mix);
extern void SpuSetCommonCDVolume (short cd_left, short cd_right);
extern void SpuSetCommonCDReverb (long cd_reverb);
extern void SpuGetCommonMasterVolume (short *mvol_left, short *mvol_right);
extern void SpuGetCommonMasterVolumeX (short *mvolx_left, short *mvolx_right);
extern void SpuGetCommonMasterVolumeAttr (short *mvol_left, short *mvol_right,
short *mvolmode_left,
short *mvolmode_right);
extern void SpuGetCommonCDMix (long *cd_mix);
extern void SpuGetCommonCDVolume (short *cd_left, short *cd_right);
extern void SpuGetCommonCDReverb (long *cd_reverb);
extern long SpuSetReverbModeType (long mode);
extern void SpuSetReverbModeDepth (short depth_left, short depth_right);
extern void SpuSetReverbModeDelayTime (long delay);
extern void SpuSetReverbModeFeedback (long feedback);
extern void SpuGetReverbModeType (long *mode);
extern void SpuGetReverbModeDepth (short *depth_left, short *depth_right);
extern void SpuGetReverbModeDelayTime (long *delay);
extern void SpuGetReverbModeFeedback (long *feedback);
extern void SpuSetESA( long revAddr );
#if defined(_LANGUAGE_C_PLUS_PLUS) || defined(__cplusplus) || defined(c_plusplus)
}
#endif
/* ---------------------------------------------------------------- */
#define SPU_ST_NOT_AVAILABLE 0
#define SPU_ST_ACCEPT 1
#define SPU_ST_ERROR (-1)
#define SPU_ST_INVALID_ARGUMENT (-2)
#define SPU_ST_WRONG_STATUS (-3)
#define SPU_ST_STOP 2
#define SPU_ST_IDLE 3
#define SPU_ST_PREPARE 4
#define SPU_ST_START 5
#define SPU_ST_PLAY 6
#define SPU_ST_TRANSFER 7
#define SPU_ST_FINAL 8
/* VAG's header size */
#define SPU_ST_VAG_HEADER_SIZE 0x30
typedef struct {
char status; /* stream status */
char pad1; /* padding */
char pad2; /* padding */
char pad3; /* padding */
long last_size; /* the size of last transferring
(last_size <= (size / 2)) */
unsigned long buf_addr; /* The start address of stream buffer */
unsigned long data_addr; /* The start address of SPU streaming
data in main memory */
} SpuStVoiceAttr;
typedef struct {
long size; /* The size of stream buffer */
long low_priority; /* transfer priority */
SpuStVoiceAttr voice [24];
} SpuStEnv;
#ifndef __SPU_ST_TRANSFERCALLBACK_PROC
#define __SPU_ST_TRANSFERCALLBACK_PROC
typedef void (*SpuStCallbackProc)(unsigned long, long);
#endif /* __SPU_TRANSFERCALLBACK_PROC */
#if defined(_LANGUAGE_C_PLUS_PLUS) || defined(__cplusplus) || defined(c_plusplus)
extern "C" {
#endif
extern SpuStEnv *SpuStInit (long);
extern long SpuStQuit (void);
extern long SpuStGetStatus (void);
extern unsigned long SpuStGetVoiceStatus (void);
extern long SpuStTransfer (long flag, unsigned long voice_bit);
extern SpuStCallbackProc SpuStSetPreparationFinishedCallback (SpuStCallbackProc func);
extern SpuStCallbackProc SpuStSetTransferFinishedCallback (SpuStCallbackProc func);
extern SpuStCallbackProc SpuStSetStreamFinishedCallback (SpuStCallbackProc func);
#if defined(_LANGUAGE_C_PLUS_PLUS) || defined(__cplusplus) || defined(c_plusplus)
}
#endif
/* ----------------------------------------------------------------
* End on File
* ---------------------------------------------------------------- */
#endif /* _LIBSPU_H_ */
/* DON'T ADD STUFF AFTER THIS */

View File

@ -1,235 +0,0 @@
#ifndef R3000_H
#define R3000_H
#define K0BASE 0x80000000
#define K0SIZE 0x20000000
#define K1BASE 0xA0000000
#define K1SIZE 0x20000000
#define K2BASE 0xC0000000
#define K2SIZE 0x20000000
#define UT_VEC K0BASE /* utlbmiss vector */
#define E_VEC (K0BASE+0x80) /* exception vector */
#define R_VEC (K1BASE+0x1fc00000) /* reset vector */
/*
* Address conversion macros
*/
#define K0_TO_K1(x) ((unsigned)(x)|0xA0000000) /* kseg0 to kseg1 */
#define K1_TO_K0(x) ((unsigned)(x)&0x9FFFFFFF) /* kseg1 to kseg0 */
#define K0_TO_PHYS(x) ((unsigned)(x)&0x1FFFFFFF) /* kseg0 to physical */
#define K1_TO_PHYS(x) ((unsigned)(x)&0x1FFFFFFF) /* kseg1 to physical */
#define PHYS_TO_K0(x) ((unsigned)(x)|0x80000000) /* physical to kseg0 */
#define PHYS_TO_K1(x) ((unsigned)(x)|0xA0000000) /* physical to kseg1 */
/*
* Address predicates
*/
#define IS_KSEG0(x) ((unsigned)(x) >= K0BASE && (unsigned)(x) < K1BASE)
#define IS_KSEG1(x) ((unsigned)(x) >= K1BASE && (unsigned)(x) < K2BASE)
#define IS_KSEG2(x) ((unsigned)(x) >= K2BASE && (unsigned)(x) < KPTEBASE)
#define IS_KPTESEG(x) ((unsigned)(x) >= KPTEBASE)
#define IS_KUSEG(x) ((unsigned)(x) < K0BASE)
/*
* Cache size constants
*/
#define MINCACHE +(4*1024) /* leading plus for mas's benefit */
#define MAXCACHE +(64*1024) /* leading plus for mas's benefit */
/*
* Status register
*/
#define SR_CUMASK 0xf0000000 /* coproc usable bits */
#define SR_CU3 0x80000000 /* Coprocessor 3 usable */
#define SR_CU2 0x40000000 /* Coprocessor 2 usable */
#define SR_CU1 0x20000000 /* Coprocessor 1 usable */
#define SR_CU0 0x10000000 /* Coprocessor 0 usable */
#define SR_BEV 0x00400000 /* use boot exception vectors */
/* Cache control bits */
#define SR_TS 0x00200000 /* TLB shutdown */
#define SR_PE 0x00100000 /* cache parity error */
#define SR_CM 0x00080000 /* cache miss */
#define SR_PZ 0x00040000 /* cache parity zero */
#define SR_SWC 0x00020000 /* swap cache */
#define SR_ISC 0x00010000 /* Isolate data cache */
#define SR_MM_MODE 0x00010000 /* lwl/swl/etc become scache/etc */
#define lcache lwl
#define scache swl
#define flush lwr $0,
#define inval swr $0,
/*
* Interrupt enable bits
* (NOTE: bits set to 1 enable the corresponding level interrupt)
*/
#define SR_IMASK 0x0000ff00 /* Interrupt mask */
#define SR_IMASK8 0x00000000 /* mask level 8 */
#define SR_IMASK7 0x00008000 /* mask level 7 */
#define SR_IMASK6 0x0000c000 /* mask level 6 */
#define SR_IMASK5 0x0000e000 /* mask level 5 */
#define SR_IMASK4 0x0000f000 /* mask level 4 */
#define SR_IMASK3 0x0000f800 /* mask level 3 */
#define SR_IMASK2 0x0000fc00 /* mask level 2 */
#define SR_IMASK1 0x0000fe00 /* mask level 1 */
#define SR_IMASK0 0x0000ff00 /* mask level 0 */
#define SR_IBIT8 0x00008000 /* bit level 8 */
#define SR_IBIT7 0x00004000 /* bit level 7 */
#define SR_IBIT6 0x00002000 /* bit level 6 */
#define SR_IBIT5 0x00001000 /* bit level 5 */
#define SR_IBIT4 0x00000800 /* bit level 4 */
#define SR_IBIT3 0x00000400 /* bit level 3 */
#define SR_IBIT2 0x00000200 /* bit level 2 */
#define SR_IBIT1 0x00000100 /* bit level 1 */
#define SR_KUO 0x00000020 /* old kernel/user, 0 => k, 1 => u */
#define SR_IEO 0x00000010 /* old interrupt enable, 1 => enable */
#define SR_KUP 0x00000008 /* prev kernel/user, 0 => k, 1 => u */
#define SR_IEP 0x00000004 /* prev interrupt enable, 1 => enable */
#define SR_KUC 0x00000002 /* cur kernel/user, 0 => k, 1 => u */
#define SR_IEC 0x00000001 /* cur interrupt enable, 1 => enable */
#define SR_IMASKSHIFT 8
#define SR_FMT "\20\40BD\26TS\25PE\24CM\23PZ\22SwC\21IsC\20IM7\17IM6\16IM5\15IM4\14IM3\13IM2\12IM1\11IM0\6KUo\5IEo\4KUp\3IEp\2KUc\1IEc"
/*
* Cause Register
*/
#define CAUSE_BD 0x80000000 /* Branch delay slot */
#define CAUSE_CEMASK 0x30000000 /* coprocessor error */
#define CAUSE_CESHIFT 28
/* Interrupt pending bits */
#define CAUSE_IP8 0x00008000 /* External level 8 pending */
#define CAUSE_IP7 0x00004000 /* External level 7 pending */
#define CAUSE_IP6 0x00002000 /* External level 6 pending */
#define CAUSE_IP5 0x00001000 /* External level 5 pending */
#define CAUSE_IP4 0x00000800 /* External level 4 pending */
#define CAUSE_IP3 0x00000400 /* External level 3 pending */
#define CAUSE_SW2 0x00000200 /* Software level 2 pending */
#define CAUSE_SW1 0x00000100 /* Software level 1 pending */
#define CAUSE_IPMASK 0x0000FF00 /* Pending interrupt mask */
#define CAUSE_IPSHIFT 8
#define CAUSE_EXCMASK 0x0000003C /* Cause code bits */
#define CAUSE_EXCSHIFT 2
#define CAUSE_FMT "\20\40BD\36CE1\35CE0\20IP8\17IP7\16IP6\15IP5\14IP4\13IP3\12SW2\11SW1\1INT"
/* Cause register exception codes */
#define EXC_CODE(x) ((x)<<2)
/* Hardware exception codes */
#define EXC_INT EXC_CODE(0) /* interrupt */
#define EXC_MOD EXC_CODE(1) /* TLB mod */
#define EXC_RMISS EXC_CODE(2) /* Read TLB Miss */
#define EXC_WMISS EXC_CODE(3) /* Write TLB Miss */
#define EXC_RADE EXC_CODE(4) /* Read Address Error */
#define EXC_WADE EXC_CODE(5) /* Write Address Error */
#define EXC_IBE EXC_CODE(6) /* Instruction Bus Error */
#define EXC_DBE EXC_CODE(7) /* Data Bus Error */
#define EXC_SYSCALL EXC_CODE(8) /* SYSCALL */
#define EXC_BREAK EXC_CODE(9) /* BREAKpoint */
#define EXC_II EXC_CODE(10) /* Illegal Instruction */
#define EXC_CPU EXC_CODE(11) /* CoProcessor Unusable */
#define EXC_OV EXC_CODE(12) /* OVerflow */
/* software exception codes */
#define SEXC_SEGV EXC_CODE(16) /* Software detected seg viol */
#define SEXC_RESCHED EXC_CODE(17) /* resched request */
#define SEXC_PAGEIN EXC_CODE(18) /* page-in request */
#define SEXC_CPU EXC_CODE(19) /* coprocessor unusable */
/*
* Coprocessor 0 registers
*/
#define C0_INX $0 /* tlb index */
#define C0_RAND $1 /* tlb random */
#define C0_TLBLO $2 /* tlb entry low */
#define C0_CTXT $4 /* tlb context */
#define C0_PIDMASK $6 /* Mips2 */
#define C0_BADVADDR $8 /* bad virtual address */
#define C0_TLBHI $10 /* tlb entry hi */
#define C0_PID $10 /* Mips2 */
#define C0_SR $12 /* status register */
#define C0_CAUSE $13 /* exception cause */
#define C0_EPC $14 /* exception pc */
#define C0_PRID $15 /* revision identifier */
#define C0_ERREG $16 /* Mips2 */
/*
* Coprocessor 0 operations
*/
#define C0_READI 0x1 /* read ITLB entry addressed by C0_INDEX */
#define C0_WRITEI 0x2 /* write ITLB entry addressed by C0_INDEX */
#define C0_WRITER 0x6 /* write ITLB entry addressed by C0_RAND */
#define C0_PROBE 0x8 /* probe for ITLB entry addressed by TLBHI */
#define C0_RFE 0x10 /* restore for exception */
/*
* Flags for the nofault handler. 0 means no fault is expected.
*/
#define NF_BADADDR 1 /* badaddr, wbadaddr */
#define NF_COPYIO 2 /* copyin, copyout */
#define NF_ADDUPC 3 /* addupc */
#define NF_FSUMEM 4 /* fubyte, subyte, fuword, suword */
#define NF_USERACC 5 /* useracc */
#define NF_SOFTFP 6 /* softfp */
#define NF_REVID 7 /* revision ids */
#define NF_NENTRIES 8
/*
* TLB size constants
*/
#define TLBWIREDBASE 0 /* WAG for now */
#define NWIREDENTRIES 8 /* WAG for now */
#define TLBRANDOMBASE NWIREDENTRIES
#define NRANDOMENTRIES (NTLBENTRIES-NWIREDENTRIES)
#define NTLBENTRIES 64 /* WAG for now */
#define TLBRAND_RANDMASK 0x00003f00
#define TLBRAND_RANDSHIFT 8
/*
* Chip interrupt vector
*/
#define NC0VECS 8
#ifndef LOCORE
#ifdef KERNEL
#if defined(_LANGUAGE_C_PLUS_PLUS)||defined(__cplusplus)||defined(c_plusplus)
extern "C" {
#endif
extern int (*c0vec_tbl[])();
#if defined(_LANGUAGE_C_PLUS_PLUS)||defined(__cplusplus)||defined(c_plusplus)
}
#endif
#endif
#endif /* !LOCORE */
#define BRK_KERNEL 0xf1
#define EXCEPT_NORM 1
#define EXCEPT_UTLB 2
#define EXCEPT_BRKPT 3
#define EXCEPT_DB 4
#define EXCEPT_GDB 4
#define EXCEPT_INT 9
#define EXCEPT_ELSE 0xff
#endif /* _R3000_H */

View File

@ -1,7 +0,0 @@
#ifndef RAND_H
#define RAND_H
#include <stdint.h>
#include <stdlib.h>
#endif

View File

@ -1,7 +0,0 @@
#ifndef STRINGS_H
#define STRINGS_H
#include <string.h> // temp
#include <ctype.h> // temp
#endif

View File

@ -1,54 +0,0 @@
#ifndef TYPES_H
#define TYPES_H
#include "PsyX/PsyX_config.h"
#include <stdint.h>
#include <stddef.h>
#if !defined(__APPLE__)
/* major part of a device */
#define major(x) ((int)(((unsigned)(x)>>8)&0377))
/* minor part of a device */
#define minor(x) ((int)((x)&0377))
/* make a device number */
#define makedev(x,y) ((dev_t)(((x)<<8) | (y)))
#endif
#ifndef _UCHAR_T
#define _UCHAR_T
typedef unsigned char u_char;
#endif
#ifndef _USHORT_T
#define _USHORT_T
typedef unsigned short u_short;
#endif
#ifndef _UINT_T
#define _UINT_T
typedef unsigned int u_int;
#endif
#ifndef _ULONG_T
#define _ULONG_T
typedef unsigned long u_long;
#endif
#ifndef _SYSIII_USHORT
#define _SYSIII_USHORT
typedef unsigned short ushort; /* sys III compat */
#endif
#ifndef __psx__
#ifndef _SYSV_UINT
#define _SYSV_UINT
typedef unsigned int uint; /* sys V compat */
#endif
#ifndef _SYSV_ULONG
#define _SYSV_ULONG
typedef unsigned long ulong; /* sys V compat */
#endif
#endif /* ! __psx__ */
#define NBBY 8
#endif

View File

@ -1,71 +0,0 @@
-- Psy-Cross layer
project "PsyCross"
kind "StaticLib"
language "C++"
targetdir "bin/%{cfg.buildcfg}"
defines { GAME_REGION }
files {
"**.h",
"**.H",
"**.c",
"**.C",
"**.cpp",
"**.CPP",
}
defines { }
includedirs {
SDL2_DIR.."/include",
OPENAL_DIR.."/include",
"include"
}
filter "system:Windows"
defines { "_WINDOWS" }
links {
"opengl32",
"SDL2",
"OpenAL32"
}
filter {"system:Windows", "platforms:x86"}
libdirs {
SDL2_DIR.."/lib/x86",
OPENAL_DIR.."/libs/Win32",
}
filter {"system:Windows", "platforms:x86_64"}
libdirs {
SDL2_DIR.."/lib/x64",
OPENAL_DIR.."/libs/Win64",
}
filter "system:linux"
includedirs {
"/usr/include/SDL2"
}
links {
"GL",
"openal",
"SDL2",
}
filter "configurations:Release"
optimize "Speed"
filter "configurations:Release_dev"
optimize "Speed"
--filter { "files:**.c", "files:**.C" }
-- compileas "C++"
usage "PsyCross"
links "PsyCross"
includedirs {
"include",
"include/psx"
}

View File

@ -1,987 +0,0 @@
#include "PsyX_main.h"
#include "PsyX/PsyX_version.h"
#include "PsyX/PsyX_globals.h"
#include "PsyX/PsyX_public.h"
#include "PsyX/util/timer.h"
#include "gpu/PsyX_GPU.h"
#include "platform.h"
#include "util/crash_handler.h"
#include "psx/libetc.h"
#include "psx/libgte.h"
#include "psx/libgpu.h"
#include "psx/libspu.h"
#include <assert.h>
#include <string.h>
#define FIXED_TIME_STEP_NTSC (1.0/60.0) // 60 FPS clock
#define FIXED_TIME_STEP_PAL (1.0/50.0) // 50 FPS clock
#include <stdio.h>
#include <SDL.h>
#include "PsyX/PsyX_render.h"
#ifdef _WIN32
#include <pla.h>
#endif // _WIN32
#ifdef __EMSCRIPTEN__
int strcasecmp(const char* _l, const char* _r)
{
const u_char* l = (u_char*)_l, * r = (u_char*)_r;
for (; *l && *r && (*l == *r || tolower(*l) == tolower(*r)); l++, r++);
return tolower(*l) - tolower(*r);
}
#elif !defined(_WIN32)
#include <strings.h>
#endif
SDL_Window* g_window = NULL;
int g_swapInterval = 1;
int g_enableSwapInterval = 1;
int g_skipSwapInterval = 0;
PsyXKeyboardMapping g_keyboard_mapping;
PsyXControllerMapping g_controller_mapping;
timerCtx_t g_vblTimer;
enum EPsxCounters
{
PsxCounter_VBLANK,
PsxCounter_Num
};
volatile int g_psxSysCounters[PsxCounter_Num];
SDL_Thread* g_intrThread = NULL;
SDL_mutex* g_intrMutex = NULL;
volatile char g_stopIntrThread = 0;
#if defined(_LANGUAGE_C_PLUS_PLUS)||defined(__cplusplus)||defined(c_plusplus)
extern "C" {
#endif
extern void(*vsync_callback)(void);
#if defined(_LANGUAGE_C_PLUS_PLUS)||defined(__cplusplus)||defined(c_plusplus)
}
#endif
extern int PsyX_Pad_InitSystem();
extern void PsyX_Pad_Event_ControllerRemoved(Sint32 deviceId);
extern void PsyX_Pad_Event_ControllerAdded(Sint32 deviceId);
extern int GR_InitialisePSX();
extern int GR_InitialiseRender(char* windowName, int width, int height, int fullscreen);
extern void GR_ResetDevice();
extern void GR_Shutdown();
extern void GR_BeginScene();
extern void GR_EndScene();
long g_vmode = -1;
int g_frameSkip = 0;
#ifdef __EMSCRIPTEN__
long g_emIntrInterval = -1;
long g_intrVMode = MODE_NTSC;
double g_emOldDate = 0;
void emIntrCallback(void* userData)
{
double timestep = g_vmode == MODE_NTSC ? FIXED_TIME_STEP_NTSC : FIXED_TIME_STEP_PAL;
int newVBlank = (Util_GetHPCTime(&g_vblTimer, 0) / timestep) + g_frameSkip;
int diff = newVBlank - g_psxSysCounters[PsxCounter_VBLANK];
while (diff--)
{
if (vsync_callback)
vsync_callback();
g_psxSysCounters[PsxCounter_VBLANK]++;
}
}
EM_BOOL emIntrCallback2(double time, void* userData)
{
emIntrCallback(userData);
return g_stopIntrThread ? EM_FALSE : EM_TRUE;
}
#endif
long PsyX_Sys_SetVMode(long mode)
{
long old = g_vmode;
g_vmode = mode;
#ifdef __EMSCRIPTEN__
if (old != g_vmode)
{
//if(g_emIntrInterval != -1)
// emscripten_clear_interval(g_emIntrInterval);
g_stopIntrThread = 1;
emscripten_sleep(100);
g_stopIntrThread = 0;
emscripten_set_timeout_loop(emIntrCallback2, 1.0, NULL);
}
#endif
return old;
}
int PsyX_Sys_GetVBlankCount()
{
if (g_skipSwapInterval)
{
// extra speedup.
// does not affect `vsync_callback` count
g_psxSysCounters[PsxCounter_VBLANK] += 1;
g_frameSkip++;
}
return g_psxSysCounters[PsxCounter_VBLANK];
}
int intrThreadMain(void* data)
{
Util_InitHPCTimer(&g_vblTimer);
while (!g_stopIntrThread)
{
// step counters
{
double timestep = g_vmode == MODE_NTSC ? FIXED_TIME_STEP_NTSC : FIXED_TIME_STEP_PAL;
double vblDelta = Util_GetHPCTime(&g_vblTimer, 0);
if (vblDelta > timestep)
{
SDL_LockMutex(g_intrMutex);
if (vsync_callback)
vsync_callback();
SDL_UnlockMutex(g_intrMutex);
// do vblank events
g_psxSysCounters[PsxCounter_VBLANK]++;
Util_GetHPCTime(&g_vblTimer, 1);
}
}
}
return 0;
}
static int PsyX_Sys_InitialiseCore()
{
#ifdef __EMSCRIPTEN__
Util_InitHPCTimer(&g_vblTimer);
#else
g_intrThread = SDL_CreateThread(intrThreadMain, "psyX_intr", NULL);
if (NULL == g_intrThread)
{
eprinterr("SDL_CreateThread failed: %s\n", SDL_GetError());
return 0;
}
g_intrMutex = SDL_CreateMutex();
if (NULL == g_intrMutex)
{
eprinterr("SDL_CreateMutex failed: %s\n", SDL_GetError());
return 0;
}
#endif
return 1;
}
static void PsyX_Sys_InitialiseInput()
{
g_keyboard_mapping.kc_square = SDL_SCANCODE_X;
g_keyboard_mapping.kc_circle = SDL_SCANCODE_V;
g_keyboard_mapping.kc_triangle = SDL_SCANCODE_Z;
g_keyboard_mapping.kc_cross = SDL_SCANCODE_C;
g_keyboard_mapping.kc_l1 = SDL_SCANCODE_LSHIFT;
g_keyboard_mapping.kc_l2 = SDL_SCANCODE_LCTRL;
g_keyboard_mapping.kc_l3 = SDL_SCANCODE_LEFTBRACKET;
g_keyboard_mapping.kc_r1 = SDL_SCANCODE_RSHIFT;
g_keyboard_mapping.kc_r2 = SDL_SCANCODE_RCTRL;
g_keyboard_mapping.kc_r3 = SDL_SCANCODE_RIGHTBRACKET;
g_keyboard_mapping.kc_dpad_up = SDL_SCANCODE_UP;
g_keyboard_mapping.kc_dpad_down = SDL_SCANCODE_DOWN;
g_keyboard_mapping.kc_dpad_left = SDL_SCANCODE_LEFT;
g_keyboard_mapping.kc_dpad_right = SDL_SCANCODE_RIGHT;
g_keyboard_mapping.kc_select = SDL_SCANCODE_SPACE;
g_keyboard_mapping.kc_start = SDL_SCANCODE_RETURN;
//----------------
g_controller_mapping.gc_square = SDL_CONTROLLER_BUTTON_X;
g_controller_mapping.gc_circle = SDL_CONTROLLER_BUTTON_B;
g_controller_mapping.gc_triangle = SDL_CONTROLLER_BUTTON_Y;
g_controller_mapping.gc_cross = SDL_CONTROLLER_BUTTON_A;
g_controller_mapping.gc_l1 = SDL_CONTROLLER_BUTTON_LEFTSHOULDER;
g_controller_mapping.gc_l2 = SDL_CONTROLLER_AXIS_TRIGGERLEFT | CONTROLLER_MAP_FLAG_AXIS;
g_controller_mapping.gc_l3 = SDL_CONTROLLER_BUTTON_LEFTSTICK;
g_controller_mapping.gc_r1 = SDL_CONTROLLER_BUTTON_RIGHTSHOULDER;
g_controller_mapping.gc_r2 = SDL_CONTROLLER_AXIS_TRIGGERRIGHT | CONTROLLER_MAP_FLAG_AXIS;
g_controller_mapping.gc_r3 = SDL_CONTROLLER_BUTTON_RIGHTSTICK;
g_controller_mapping.gc_dpad_up = SDL_CONTROLLER_BUTTON_DPAD_UP;
g_controller_mapping.gc_dpad_down = SDL_CONTROLLER_BUTTON_DPAD_DOWN;
g_controller_mapping.gc_dpad_left = SDL_CONTROLLER_BUTTON_DPAD_LEFT;
g_controller_mapping.gc_dpad_right = SDL_CONTROLLER_BUTTON_DPAD_RIGHT;
g_controller_mapping.gc_select = SDL_CONTROLLER_BUTTON_BACK;
g_controller_mapping.gc_start = SDL_CONTROLLER_BUTTON_START;
g_controller_mapping.gc_axis_left_x = SDL_CONTROLLER_AXIS_LEFTX | CONTROLLER_MAP_FLAG_AXIS;
g_controller_mapping.gc_axis_left_y = SDL_CONTROLLER_AXIS_LEFTY | CONTROLLER_MAP_FLAG_AXIS;
g_controller_mapping.gc_axis_right_x = SDL_CONTROLLER_AXIS_RIGHTX | CONTROLLER_MAP_FLAG_AXIS;
g_controller_mapping.gc_axis_right_y = SDL_CONTROLLER_AXIS_RIGHTY | CONTROLLER_MAP_FLAG_AXIS;
PsyX_Pad_InitSystem();
}
#ifdef __GNUC__
#define _stricmp(s1, s2) strcasecmp(s1, s2)
#endif
// Keyboard mapping lookup
int PsyX_LookupKeyboardMapping(const char* str, int default_value)
{
const char* scancodeName;
int i;
if (str)
{
if (!_stricmp("NONE", str))
return SDL_SCANCODE_UNKNOWN;
for (i = 0; i < SDL_NUM_SCANCODES; i++)
{
scancodeName = SDL_GetScancodeName((SDL_Scancode)i);
if (strlen(scancodeName) && !_stricmp(scancodeName, str))
{
return i;
}
}
}
return default_value;
}
// Game controller mapping lookup
// Available controller binds(refer to SDL2 game controller)
//
// Axes:
// leftx lefty
// rightx righty
// lefttrigger righttrigger
//
// NOTE: adding `-` before axis names makes it inverse, so `-leftx` inverse left stick X axis
//
// Buttons:
// a, b, x, y
// back guide start
// leftstick rightstick
// leftshoulder rightshoulder
// dpup dpdown dpleft dpright
int PsyX_LookupGameControllerMapping(const char* str, int default_value)
{
const char* axisStr;
const char* buttonOrAxisName;
int i, axisFlags;
if (str)
{
axisFlags = CONTROLLER_MAP_FLAG_AXIS;
axisStr = str;
if (*axisStr == '-')
{
axisFlags |= CONTROLLER_MAP_FLAG_INVERSE;
axisStr++;
}
if (!_stricmp("NONE", str))
return SDL_CONTROLLER_BUTTON_INVALID;
// check buttons
for (i = 0; i < SDL_CONTROLLER_BUTTON_MAX; i++)
{
buttonOrAxisName = SDL_GameControllerGetStringForButton((SDL_GameControllerButton)i);
if (strlen(buttonOrAxisName) && !_stricmp(buttonOrAxisName, str))
{
return i;
}
}
// Check axes
for (i = 0; i < SDL_CONTROLLER_AXIS_MAX; i++)
{
buttonOrAxisName = SDL_GameControllerGetStringForAxis((SDL_GameControllerAxis)i);
if (strlen(buttonOrAxisName) && !_stricmp(buttonOrAxisName, axisStr))
{
return i | axisFlags;
}
}
}
return default_value;
}
char* g_appNameStr = NULL;
void PsyX_GetWindowName(char* buffer)
{
#ifdef _DEBUG
sprintf(buffer, "%s | Debug", g_appNameStr);
#else
sprintf(buffer, "%s", g_appNameStr);
#endif
}
FILE* g_logStream = NULL;
// intialise logging
void PsyX_Log_Initialise()
{
char appLogFilename[128];
sprintf(appLogFilename, "%s.log", g_appNameStr);
g_logStream = fopen(appLogFilename, "wb");
if (!g_logStream)
eprinterr("Error - cannot create log file '%s'\n", appLogFilename);
}
void PsyX_Log_Finalise()
{
PsyX_Log_Warning("---- LOG CLOSED ----\n");
if (g_logStream)
fclose(g_logStream);
g_logStream = NULL;
}
void PsyX_Log_Flush()
{
if (g_logStream)
fflush(g_logStream);
}
// spew types
typedef enum
{
SPEW_NORM,
SPEW_INFO,
SPEW_WARNING,
SPEW_ERROR,
SPEW_SUCCESS,
}SpewType_t;
#ifdef _WIN32
static unsigned short g_InitialColor = 0xFFFF;
static unsigned short g_LastColor = 0xFFFF;
static unsigned short g_BadColor = 0xFFFF;
static WORD g_BackgroundFlags = 0xFFFF;
CRITICAL_SECTION g_SpewCS;
char g_bSpewCSInitted = 0;
static void Spew_GetInitialColors()
{
// Get the old background attributes.
CONSOLE_SCREEN_BUFFER_INFO oldInfo;
GetConsoleScreenBufferInfo(GetStdHandle(STD_OUTPUT_HANDLE), &oldInfo);
g_InitialColor = g_LastColor = oldInfo.wAttributes & (FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE | FOREGROUND_INTENSITY);
g_BackgroundFlags = oldInfo.wAttributes & (BACKGROUND_RED | BACKGROUND_GREEN | BACKGROUND_BLUE | BACKGROUND_INTENSITY);
g_BadColor = 0;
if (g_BackgroundFlags & BACKGROUND_RED)
g_BadColor |= FOREGROUND_RED;
if (g_BackgroundFlags & BACKGROUND_GREEN)
g_BadColor |= FOREGROUND_GREEN;
if (g_BackgroundFlags & BACKGROUND_BLUE)
g_BadColor |= FOREGROUND_BLUE;
if (g_BackgroundFlags & BACKGROUND_INTENSITY)
g_BadColor |= FOREGROUND_INTENSITY;
}
static WORD Spew_SetConsoleTextColor(int red, int green, int blue, int intensity)
{
WORD ret = g_LastColor;
g_LastColor = 0;
if (red) g_LastColor |= FOREGROUND_RED;
if (green) g_LastColor |= FOREGROUND_GREEN;
if (blue) g_LastColor |= FOREGROUND_BLUE;
if (intensity) g_LastColor |= FOREGROUND_INTENSITY;
// Just use the initial color if there's a match...
if (g_LastColor == g_BadColor)
g_LastColor = g_InitialColor;
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), g_LastColor | g_BackgroundFlags);
return ret;
}
static void Spew_RestoreConsoleTextColor(WORD color)
{
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), color | g_BackgroundFlags);
g_LastColor = color;
}
void Spew_ConDebugSpew(SpewType_t type, char* text)
{
// Hopefully two threads won't call this simultaneously right at the start!
if (!g_bSpewCSInitted)
{
Spew_GetInitialColors();
InitializeCriticalSection(&g_SpewCS);
g_bSpewCSInitted = 1;
}
WORD old;
EnterCriticalSection(&g_SpewCS);
{
if (type == SPEW_NORM)
{
old = Spew_SetConsoleTextColor(1, 1, 1, 0);
}
else if (type == SPEW_WARNING)
{
old = Spew_SetConsoleTextColor(1, 1, 0, 1);
}
else if (type == SPEW_SUCCESS)
{
old = Spew_SetConsoleTextColor(0, 1, 0, 1);
}
else if (type == SPEW_ERROR)
{
old = Spew_SetConsoleTextColor(1, 0, 0, 1);
}
else if (type == SPEW_INFO)
{
old = Spew_SetConsoleTextColor(0, 1, 1, 1);
}
else
{
old = Spew_SetConsoleTextColor(1, 1, 1, 1);
}
OutputDebugStringA(text);
printf("%s", text);
Spew_RestoreConsoleTextColor(old);
}
LeaveCriticalSection(&g_SpewCS);
}
#endif
void PrintMessageToOutput(SpewType_t spewtype, char const* pMsgFormat, va_list args)
{
static char pTempBuffer[4096];
int len = 0;
vsprintf(&pTempBuffer[len], pMsgFormat, args);
#ifdef WIN32
Spew_ConDebugSpew(spewtype, pTempBuffer);
#elif defined(__EMSCRIPTEN__)
if (spewtype == SPEW_INFO)
{
EM_ASM({
console.info(UTF8ToString($0));
}, pTempBuffer);
}
else if (spewtype == SPEW_WARNING)
{
EM_ASM({
console.warn(UTF8ToString($0));
}, pTempBuffer);
}
else if (spewtype == SPEW_ERROR)
{
EM_ASM({
console.error(UTF8ToString($0));
}, pTempBuffer);
}
else
{
EM_ASM({
console.log(UTF8ToString($0));
}, pTempBuffer);
}
#else
printf(pTempBuffer);
#endif
if(g_logStream)
fprintf(g_logStream, pTempBuffer);
}
void PsyX_Log(const char* fmt, ...)
{
va_list argptr;
va_start(argptr, fmt);
PrintMessageToOutput(SPEW_NORM, fmt, argptr);
va_end(argptr);
}
void PsyX_Log_Info(const char* fmt, ...)
{
va_list argptr;
va_start(argptr, fmt);
PrintMessageToOutput(SPEW_INFO, fmt, argptr);
va_end(argptr);
}
void PsyX_Log_Warning(const char* fmt, ...)
{
va_list argptr;
va_start(argptr, fmt);
PrintMessageToOutput(SPEW_WARNING, fmt, argptr);
va_end(argptr);
}
void PsyX_Log_Error(const char* fmt, ...)
{
va_list argptr;
va_start(argptr, fmt);
PrintMessageToOutput(SPEW_ERROR, fmt, argptr);
va_end(argptr);
}
void PsyX_Log_Success(const char* fmt, ...)
{
va_list argptr;
va_start(argptr, fmt);
PrintMessageToOutput(SPEW_SUCCESS, fmt, argptr);
va_end(argptr);
}
void PsyX_Initialise(char* appName, int width, int height, int fullscreen)
{
char windowNameStr[128];
g_appNameStr = appName;
InstallExceptionHandler();
PsyX_Log_Initialise();
PsyX_GetWindowName(windowNameStr);
#if defined(_WIN32) && defined(_DEBUG)
if (AllocConsole())
{
freopen("CONOUT$", "w", stdout);
SetConsoleTitleA(windowNameStr);
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_GREEN | FOREGROUND_BLUE | FOREGROUND_RED);
}
#endif
eprintinfo("Initialising Psy-X %d.%d\n", PSYX_MAJOR_VERSION, PSYX_MINOR_VERSION);
eprintinfo("Build date: %s:%s\n", PSYX_COMPILE_DATE, PSYX_COMPILE_TIME);
#if defined(__EMSCRIPTEN__)
SDL_SetHint(SDL_HINT_EMSCRIPTEN_ASYNCIFY, "0");
#endif
if (SDL_Init(SDL_INIT_VIDEO) != 0)
{
eprinterr("Failed to initialise SDL\n");
PsyX_Shutdown();
return;
}
if (!GR_InitialiseRender(windowNameStr, width, height, fullscreen))
{
eprinterr("Failed to Intialise Window\n");
PsyX_Shutdown();
return;
}
if (!PsyX_Sys_InitialiseCore())
{
eprinterr("Failed to Intialise Psy-X Core.\n");
PsyX_Shutdown();
return;
}
if (!GR_InitialisePSX())
{
eprinterr("Failed to Intialise PSX.\n");
PsyX_Shutdown();
return;
}
PsyX_Sys_InitialiseInput();
// set shutdown function (PSX apps usualy don't exit)
atexit(PsyX_Shutdown);
// disable cursor visibility
SDL_ShowCursor(0);
}
void PsyX_GetScreenSize(int* screenWidth, int* screenHeight)
{
SDL_GetWindowSize(g_window, screenWidth, screenHeight);
}
void PsyX_SetCursorPosition(int x, int y)
{
SDL_WarpMouseInWindow(g_window, x, y);
}
void PsyX_Sys_DoDebugKeys(int nKey, char down); // forward decl
void PsyX_Sys_DoDebugMouseMotion(int x, int y);
void PsyX_Exit();
GameDebugKeysHandlerFunc gameDebugKeys = NULL;
GameDebugMouseHandlerFunc gameDebugMouse = NULL;
GameOnTextInputHandler gameOnTextInput = NULL;
int g_activeKeyboardControllers = 0x1;
int g_altKeyState = 0;
void PsyX_Sys_DoPollEvent()
{
SDL_Event event;
while (SDL_PollEvent(&event))
{
switch (event.type)
{
case SDL_CONTROLLERDEVICEADDED:
PsyX_Pad_Event_ControllerAdded(event.cdevice.which);
break;
case SDL_CONTROLLERDEVICEREMOVED:
PsyX_Pad_Event_ControllerRemoved(event.cdevice.which);
break;
case SDL_QUIT:
PsyX_Exit();
break;
case SDL_WINDOWEVENT:
switch (event.window.event)
{
case SDL_WINDOWEVENT_RESIZED:
g_windowWidth = event.window.data1;
g_windowHeight = event.window.data2;
GR_ResetDevice();
break;
case SDL_WINDOWEVENT_CLOSE:
PsyX_Exit();
break;
}
break;
case SDL_MOUSEMOTION:
PsyX_Sys_DoDebugMouseMotion(event.motion.x, event.motion.y);
break;
case SDL_KEYDOWN:
case SDL_KEYUP:
{
int nKey = event.key.keysym.scancode;
if (nKey == SDL_SCANCODE_RALT)
{
g_altKeyState = (event.type == SDL_KEYDOWN);
}
else if (nKey == SDL_SCANCODE_RETURN)
{
if (g_altKeyState && event.type == SDL_KEYDOWN)
{
int fullscreen = SDL_GetWindowFlags(g_window) & SDL_WINDOW_FULLSCREEN > 0;
SDL_SetWindowFullscreen(g_window, fullscreen ? 0 : SDL_WINDOW_FULLSCREEN_DESKTOP);
SDL_GetWindowSize(g_window, &g_windowWidth, &g_windowHeight);
GR_ResetDevice();
}
break;
}
// lshift/right shift
if (nKey == SDL_SCANCODE_RSHIFT)
nKey = SDL_SCANCODE_LSHIFT;
else if (nKey == SDL_SCANCODE_RCTRL)
nKey = SDL_SCANCODE_LCTRL;
else if (nKey == SDL_SCANCODE_RALT)
nKey = SDL_SCANCODE_LALT;
if (gameOnTextInput && nKey == SDL_SCANCODE_BACKSPACE && event.type == SDL_KEYDOWN)
{
(gameOnTextInput)(NULL);
}
PsyX_Sys_DoDebugKeys(nKey, (event.type == SDL_KEYUP) ? 0 : 1);
break;
}
case SDL_TEXTINPUT:
{
if(gameOnTextInput)
(gameOnTextInput)(event.text.text);
break;
}
}
}
}
char begin_scene_flag = 0;
char PsyX_BeginScene()
{
PsyX_Sys_DoPollEvent();
if (begin_scene_flag)
return 0;
assert(!begin_scene_flag);
GR_BeginScene();
begin_scene_flag = 1;
PsyX_Log_Flush();
return 1;
}
uint PsyX_CalcFPS();
void PsyX_EndScene()
{
if (!begin_scene_flag)
return;
assert(begin_scene_flag);
begin_scene_flag = 0;
GR_EndScene();
GR_StoreFrameBuffer(activeDispEnv.disp.x, activeDispEnv.disp.y, activeDispEnv.disp.w, activeDispEnv.disp.h);
GR_SwapWindow();
}
#if !defined(__EMSCRIPTEN__) && !defined(__ANDROID__)
void PsyX_TakeScreenshot()
{
u_char* pixels = (u_char*)malloc(g_windowWidth * g_windowHeight * 4);
#if defined(RENDERER_OGL)
glReadPixels(0, 0, g_windowWidth, g_windowHeight, GL_BGRA, GL_UNSIGNED_BYTE, pixels);
#elif defined(RENDERER_OGLES)
glReadPixels(0, 0, g_windowWidth, g_windowHeight, GL_RGBA, GL_UNSIGNED_BYTE, pixels); // FIXME: is that correct format?
#endif
SDL_Surface* surface = SDL_CreateRGBSurfaceFrom(pixels, g_windowWidth, g_windowHeight, 8 * 4, g_windowWidth * 4, 0, 0, 0, 0);
SDL_SaveBMP(surface, "SCREENSHOT.BMP");
SDL_FreeSurface(surface);
free(pixels);
}
#endif
void PsyX_Sys_DoDebugMouseMotion(int x, int y)
{
if (gameDebugMouse)
gameDebugMouse(x, y);
}
void PsyX_Sys_DoDebugKeys(int nKey, char down)
{
if (gameDebugKeys)
gameDebugKeys(nKey, down);
#ifdef _DEBUG
if (nKey == SDL_SCANCODE_BACKSPACE)
{
if (down)
g_skipSwapInterval = 1;
else
g_skipSwapInterval = 0;
}
#endif
if (!down)
{
switch (nKey)
{
#ifdef _DEBUG
case SDL_SCANCODE_F1:
g_wireframeMode ^= 1;
eprintwarn("wireframe mode: %d\n", g_wireframeMode);
break;
case SDL_SCANCODE_F2:
g_texturelessMode ^= 1;
eprintwarn("textureless mode: %d\n", g_texturelessMode);
break;
case SDL_SCANCODE_UP:
case SDL_SCANCODE_DOWN:
if (g_emulatorPaused)
{
g_polygonSelected += (nKey == SDL_SCANCODE_UP) ? 3 : -3;
}
break;
case SDL_SCANCODE_F10:
eprintwarn("saving VRAM.TGA\n");
GR_SaveVRAM("VRAM.TGA", 0, 0, VRAM_WIDTH, VRAM_HEIGHT, 1);
break;
#endif
#if !defined(__EMSCRIPTEN__) && !defined(__ANDROID__)
case SDL_SCANCODE_F12:
eprintwarn("Saving screenshot...\n");
PsyX_TakeScreenshot();
break;
#endif
case SDL_SCANCODE_F3:
g_bilinearFiltering ^= 1;
eprintwarn("filtering mode: %d\n", g_bilinearFiltering);
break;
case SDL_SCANCODE_F4:
g_activeKeyboardControllers++;
g_activeKeyboardControllers = g_activeKeyboardControllers % 4;
if (g_activeKeyboardControllers == 0)
g_activeKeyboardControllers++;
eprintwarn("Active keyboard controller: %d\n", g_activeKeyboardControllers);
break;
case SDL_SCANCODE_F5:
g_pgxpTextureCorrection ^= 1;
break;
case SDL_SCANCODE_F6:
g_pgxpZBuffer ^= 1;
break;
}
}
}
void PsyX_UpdateInput()
{
// also poll events here
PsyX_Sys_DoPollEvent();
if(!g_altKeyState)
PsyX_Pad_InternalPadUpdates();
}
uint PsyX_CalcFPS()
{
#define FPS_INTERVAL 1.0
static unsigned int lastTime = 0;
static unsigned int currentFps = 0;
static unsigned int passedFrames = 0;
lastTime = SDL_GetTicks();
passedFrames++;
if (lastTime < SDL_GetTicks() - FPS_INTERVAL * 1000)
{
lastTime = SDL_GetTicks();
currentFps = passedFrames;
passedFrames = 0;
}
return currentFps;
}
void PsyX_WaitForTimestep(int count)
{
#if 0 // defined(RENDERER_OGL) || defined(RENDERER_OGLES)
glFinish(); // best time to complete GPU drawing
#endif
// wait for vblank
if (!g_skipSwapInterval)
{
static int swapLastVbl = 0;
int vbl;
do
{
#ifdef __EMSCRIPTEN__
emscripten_sleep(0);
#endif
vbl = PsyX_Sys_GetVBlankCount();
}
while (vbl - swapLastVbl < count);
swapLastVbl = PsyX_Sys_GetVBlankCount();
}
}
void PsyX_Exit()
{
exit(0);
}
void PsyX_Shutdown()
{
if (!g_window)
return;
// quit vblank thread
if (g_intrThread)
{
g_stopIntrThread = 1;
int returnValue;
SDL_WaitThread(g_intrThread, &returnValue);
SDL_DestroyMutex(g_intrMutex);
}
SDL_DestroyWindow(g_window);
g_window = NULL;
GR_Shutdown();
SDL_QuitSubSystem(SDL_INIT_GAMECONTROLLER);
SDL_Quit();
UnInstallExceptionHandler();
PsyX_Log_Finalise();
}

View File

@ -1,24 +0,0 @@
#ifndef EMULATOR_SETUP_H
#define EMULATOR_SETUP_H
#include "platform.h"
//Disc image filename to load for disc image builds
#define DISC_CUE_FILENAME "IMAGE.CUE"
#if defined(_LANGUAGE_C_PLUS_PLUS)||defined(__cplusplus)||defined(c_plusplus)
extern "C" {
#endif
extern unsigned int g_swapTime;
extern long g_vmode;
extern int g_activeKeyboardControllers;
extern int PsyX_Sys_GetVBlankCount();
extern long PsyX_Sys_SetVMode(long mode);
#if defined(_LANGUAGE_C_PLUS_PLUS)||defined(__cplusplus)||defined(c_plusplus)
}
#endif
#endif

File diff suppressed because it is too large Load Diff

View File

@ -1,29 +0,0 @@
#ifndef PSYX_GPU_H
#define PSYX_GPU_H
#include "psx/libgte.h"
#include "psx/libgpu.h"
#include "psx/types.h"
#include "PsyX/common/pgxp_defs.h"
#if defined(_LANGUAGE_C_PLUS_PLUS)||defined(__cplusplus)||defined(c_plusplus)
extern "C" {
#endif
extern OT_TAG prim_terminator; // P_TAG with zero length
extern int g_splitIndex;
extern DISPENV activeDispEnv;
extern DRAWENV activeDrawEnv;
extern int g_GPUDisabledState;
void ClearSplits();
void ParsePrimitivesToSplits(u_long* p, int singlePrimitive);
void DrawAllSplits();
#if defined(_LANGUAGE_C_PLUS_PLUS)||defined(__cplusplus)||defined(c_plusplus)
}
#endif
#endif

View File

@ -1,136 +0,0 @@
char fontTpageData[] =
{
0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x10,0x10,0x00,0x00,0x00,0x00,0x00,
0x00,0x10,0x11,0x00,0x00,0x11,0x11,0x01,0x00,0x10,0x00,0x00,0x00,0x10,0x01,0x00,
0x00,0x00,0x00,0x01,0x00,0x01,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x10,0x10,0x00,0x00,0x10,0x10,0x00,
0x00,0x01,0x01,0x01,0x00,0x11,0x00,0x01,0x00,0x01,0x01,0x00,0x00,0x11,0x00,0x00,
0x00,0x00,0x10,0x00,0x00,0x10,0x00,0x00,0x00,0x01,0x01,0x01,0x00,0x00,0x01,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,
0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x11,0x11,0x01,
0x00,0x01,0x01,0x00,0x00,0x00,0x10,0x00,0x00,0x01,0x01,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x01,0x00,0x00,0x00,0x01,0x00,0x00,0x10,0x11,0x00,0x00,0x00,0x01,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x10,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x10,0x10,0x00,
0x00,0x10,0x11,0x00,0x00,0x00,0x01,0x00,0x00,0x10,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x01,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x01,0x00,0x00,0x11,0x11,0x01,
0x00,0x00,0x00,0x00,0x00,0x11,0x11,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x10,0x10,0x00,
0x00,0x00,0x01,0x01,0x00,0x10,0x00,0x00,0x00,0x01,0x01,0x01,0x00,0x00,0x00,0x00,
0x00,0x00,0x01,0x00,0x00,0x00,0x01,0x00,0x00,0x10,0x11,0x00,0x00,0x00,0x01,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x10,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x11,0x11,0x01,
0x00,0x01,0x01,0x01,0x00,0x01,0x10,0x01,0x00,0x01,0x10,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x10,0x00,0x00,0x10,0x00,0x00,0x00,0x01,0x01,0x01,0x00,0x00,0x01,0x00,
0x00,0x10,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x10,0x01,0x00,0x00,0x01,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x10,0x10,0x00,
0x00,0x10,0x11,0x00,0x00,0x01,0x10,0x01,0x00,0x10,0x01,0x01,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x01,0x00,0x01,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,
0x00,0x10,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x10,0x01,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x11,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x10,0x11,0x00,0x00,0x00,0x01,0x00,0x00,0x10,0x11,0x00,0x00,0x10,0x11,0x00,
0x00,0x00,0x10,0x00,0x00,0x11,0x11,0x01,0x00,0x00,0x11,0x00,0x00,0x11,0x11,0x01,
0x00,0x10,0x11,0x00,0x00,0x10,0x11,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x10,0x11,0x00,
0x00,0x01,0x00,0x01,0x00,0x10,0x01,0x00,0x00,0x01,0x00,0x01,0x00,0x01,0x00,0x01,
0x00,0x00,0x11,0x00,0x00,0x01,0x00,0x00,0x00,0x10,0x00,0x00,0x00,0x00,0x00,0x01,
0x00,0x01,0x00,0x01,0x00,0x01,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x10,0x00,0x00,0x00,0x01,0x00,0x01,
0x00,0x01,0x10,0x01,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x01,
0x00,0x10,0x10,0x00,0x00,0x11,0x11,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x10,0x00,
0x00,0x01,0x00,0x01,0x00,0x01,0x00,0x01,0x00,0x10,0x01,0x00,0x00,0x10,0x01,0x00,
0x00,0x00,0x01,0x00,0x00,0x11,0x11,0x01,0x00,0x00,0x01,0x00,0x00,0x00,0x10,0x00,
0x00,0x01,0x01,0x01,0x00,0x00,0x01,0x00,0x00,0x00,0x10,0x00,0x00,0x00,0x11,0x00,
0x00,0x01,0x10,0x00,0x00,0x00,0x00,0x01,0x00,0x11,0x11,0x00,0x00,0x00,0x10,0x00,
0x00,0x10,0x11,0x00,0x00,0x10,0x11,0x01,0x00,0x10,0x01,0x00,0x00,0x10,0x01,0x00,
0x00,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x10,0x00,0x00,0x00,0x01,0x00,
0x00,0x11,0x00,0x01,0x00,0x00,0x01,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x01,
0x00,0x11,0x11,0x01,0x00,0x00,0x00,0x01,0x00,0x01,0x00,0x01,0x00,0x00,0x01,0x00,
0x00,0x01,0x00,0x01,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x01,0x00,0x00,0x11,0x11,0x01,0x00,0x00,0x01,0x00,0x00,0x00,0x01,0x00,
0x00,0x01,0x00,0x01,0x00,0x00,0x01,0x00,0x00,0x10,0x00,0x00,0x00,0x01,0x00,0x01,
0x00,0x00,0x10,0x00,0x00,0x01,0x00,0x01,0x00,0x01,0x00,0x01,0x00,0x00,0x01,0x00,
0x00,0x01,0x00,0x01,0x00,0x00,0x10,0x00,0x00,0x10,0x01,0x00,0x00,0x10,0x01,0x00,
0x00,0x00,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x10,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x10,0x11,0x00,0x00,0x10,0x11,0x00,0x00,0x11,0x11,0x01,0x00,0x10,0x11,0x00,
0x00,0x00,0x10,0x00,0x00,0x10,0x11,0x00,0x00,0x10,0x11,0x00,0x00,0x00,0x01,0x00,
0x00,0x10,0x11,0x00,0x00,0x10,0x01,0x00,0x00,0x10,0x01,0x00,0x00,0x10,0x01,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x11,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x10,0x11,0x00,0x00,0x10,0x11,0x00,0x00,0x11,0x11,0x00,0x00,0x10,0x11,0x00,
0x00,0x11,0x11,0x00,0x00,0x11,0x11,0x01,0x00,0x11,0x11,0x01,0x00,0x10,0x11,0x00,
0x00,0x01,0x00,0x01,0x00,0x10,0x11,0x00,0x00,0x00,0x00,0x01,0x00,0x01,0x00,0x01,
0x00,0x01,0x00,0x00,0x00,0x01,0x00,0x01,0x00,0x01,0x00,0x01,0x00,0x10,0x11,0x00,
0x00,0x01,0x00,0x01,0x00,0x01,0x00,0x01,0x00,0x01,0x00,0x01,0x00,0x01,0x00,0x01,
0x00,0x10,0x00,0x01,0x00,0x01,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x01,0x00,0x01,
0x00,0x01,0x00,0x01,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x01,0x00,0x01,0x10,0x00,
0x00,0x01,0x00,0x00,0x00,0x11,0x10,0x01,0x00,0x01,0x00,0x01,0x00,0x01,0x00,0x01,
0x00,0x01,0x11,0x01,0x00,0x01,0x00,0x01,0x00,0x01,0x00,0x01,0x00,0x01,0x00,0x00,
0x00,0x10,0x00,0x01,0x00,0x01,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x01,0x00,0x00,
0x00,0x01,0x00,0x01,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x01,0x00,0x01,0x01,0x00,
0x00,0x01,0x00,0x00,0x00,0x01,0x01,0x01,0x00,0x11,0x00,0x01,0x00,0x01,0x00,0x01,
0x00,0x01,0x01,0x01,0x00,0x11,0x11,0x01,0x00,0x11,0x11,0x00,0x00,0x01,0x00,0x00,
0x00,0x10,0x00,0x01,0x00,0x11,0x11,0x00,0x00,0x11,0x11,0x00,0x00,0x01,0x00,0x00,
0x00,0x11,0x11,0x01,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x01,0x00,0x11,0x00,0x00,
0x00,0x01,0x00,0x00,0x00,0x01,0x00,0x01,0x00,0x01,0x01,0x01,0x00,0x01,0x00,0x01,
0x00,0x01,0x11,0x01,0x00,0x01,0x00,0x01,0x00,0x01,0x00,0x01,0x00,0x01,0x00,0x00,
0x00,0x10,0x00,0x01,0x00,0x01,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x01,0x10,0x01,
0x00,0x01,0x00,0x01,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x01,0x00,0x01,0x01,0x00,
0x00,0x01,0x00,0x00,0x00,0x01,0x00,0x01,0x00,0x01,0x10,0x01,0x00,0x01,0x00,0x01,
0x00,0x01,0x00,0x00,0x00,0x01,0x00,0x01,0x00,0x01,0x00,0x01,0x00,0x01,0x00,0x01,
0x00,0x10,0x00,0x01,0x00,0x01,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x01,0x00,0x01,
0x00,0x01,0x00,0x01,0x00,0x00,0x01,0x00,0x00,0x01,0x00,0x01,0x00,0x01,0x10,0x00,
0x00,0x01,0x00,0x00,0x00,0x01,0x00,0x01,0x00,0x01,0x00,0x01,0x00,0x01,0x00,0x01,
0x00,0x10,0x11,0x00,0x00,0x01,0x00,0x01,0x00,0x11,0x11,0x00,0x00,0x10,0x11,0x00,
0x00,0x11,0x11,0x00,0x00,0x11,0x11,0x01,0x00,0x01,0x00,0x00,0x00,0x10,0x11,0x00,
0x00,0x01,0x00,0x01,0x00,0x10,0x11,0x00,0x00,0x10,0x11,0x00,0x00,0x01,0x00,0x01,
0x00,0x11,0x11,0x01,0x00,0x01,0x00,0x01,0x00,0x01,0x00,0x01,0x00,0x10,0x11,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x11,0x11,0x00,0x00,0x10,0x11,0x00,0x00,0x11,0x11,0x00,0x00,0x10,0x11,0x00,
0x00,0x11,0x11,0x01,0x00,0x01,0x00,0x01,0x00,0x01,0x00,0x01,0x00,0x01,0x00,0x01,
0x00,0x01,0x00,0x01,0x00,0x01,0x00,0x01,0x00,0x11,0x11,0x01,0x00,0x00,0x01,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x10,0x10,0x00,0x00,0x00,0x00,0x00,
0x00,0x01,0x00,0x01,0x00,0x01,0x00,0x01,0x00,0x01,0x00,0x01,0x00,0x01,0x00,0x01,
0x00,0x00,0x01,0x00,0x00,0x01,0x00,0x01,0x00,0x01,0x00,0x01,0x00,0x01,0x00,0x01,
0x00,0x01,0x00,0x01,0x00,0x01,0x00,0x01,0x00,0x00,0x00,0x01,0x00,0x00,0x01,0x00,
0x00,0x01,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x01,0x00,0x01,0x00,0x00,0x00,0x00,
0x00,0x01,0x00,0x01,0x00,0x01,0x00,0x01,0x00,0x01,0x00,0x01,0x00,0x01,0x00,0x00,
0x00,0x00,0x01,0x00,0x00,0x01,0x00,0x01,0x00,0x01,0x00,0x01,0x00,0x01,0x00,0x01,
0x00,0x10,0x10,0x00,0x00,0x10,0x10,0x00,0x00,0x00,0x10,0x00,0x00,0x00,0x01,0x00,
0x00,0x10,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x11,0x11,0x00,0x00,0x01,0x00,0x01,0x00,0x11,0x11,0x00,0x00,0x10,0x11,0x00,
0x00,0x00,0x01,0x00,0x00,0x01,0x00,0x01,0x00,0x01,0x00,0x01,0x00,0x01,0x00,0x01,
0x00,0x00,0x01,0x00,0x00,0x00,0x01,0x00,0x00,0x11,0x11,0x01,0x00,0x00,0x01,0x00,
0x00,0x00,0x01,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x01,0x00,0x00,0x00,0x01,0x01,0x01,0x00,0x01,0x01,0x00,0x00,0x00,0x00,0x01,
0x00,0x00,0x01,0x00,0x00,0x01,0x00,0x01,0x00,0x10,0x10,0x00,0x00,0x01,0x01,0x01,
0x00,0x10,0x10,0x00,0x00,0x00,0x01,0x00,0x00,0x10,0x00,0x00,0x00,0x00,0x01,0x00,
0x00,0x00,0x10,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x01,0x00,0x00,0x00,0x01,0x10,0x00,0x00,0x01,0x10,0x00,0x00,0x01,0x00,0x01,
0x00,0x00,0x01,0x00,0x00,0x01,0x00,0x01,0x00,0x10,0x10,0x00,0x00,0x11,0x10,0x01,
0x00,0x01,0x00,0x01,0x00,0x00,0x01,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x01,0x00,
0x00,0x00,0x00,0x01,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x01,0x00,0x00,0x00,0x10,0x01,0x01,0x00,0x01,0x00,0x01,0x00,0x10,0x11,0x00,
0x00,0x00,0x01,0x00,0x00,0x10,0x11,0x00,0x00,0x00,0x01,0x00,0x00,0x01,0x00,0x01,
0x00,0x01,0x00,0x01,0x00,0x00,0x01,0x00,0x00,0x11,0x11,0x01,0x00,0x00,0x01,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x11,0x01,
0x00,0x00,0x00,0x00,0x00,0x11,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
};
unsigned char fontClutData[] = {
0x00, 0x00, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
};

View File

@ -1,918 +0,0 @@
#include "PsyX_GTE.h"
#include "psx/libgte.h"
#include "psx/gtereg.h"
#include <math.h>
GTERegisters gteRegs;
#define GTE_SF(op) ((op >> 19) & 1)
#define GTE_MX(op) ((op >> 17) & 3)
#define GTE_V(op) ((op >> 15) & 3)
#define GTE_CV(op) ((op >> 13) & 3)
#define GTE_LM(op) ((op >> 10) & 1)
#define GTE_FUNCT(op) (op & 63)
#define gteop(code) (code & 0x1ffffff)
#define VX(n) (n < 3 ? gteRegs.CP2D.p[ n << 1 ].sw.l : C2_IR1)
#define VY(n) (n < 3 ? gteRegs.CP2D.p[ n << 1 ].sw.h : C2_IR2)
#define VZ(n) (n < 3 ? gteRegs.CP2D.p[ (n << 1) + 1 ].sw.l : C2_IR3)
#define MX11(n) (n < 3 ? gteRegs.CP2C.p[ (n << 3) ].sw.l : -C2_R << 4)
#define MX12(n) (n < 3 ? gteRegs.CP2C.p[ (n << 3) ].sw.h : C2_R << 4)
#define MX13(n) (n < 3 ? gteRegs.CP2C.p[ (n << 3) + 1 ].sw.l : C2_IR0)
#define MX21(n) (n < 3 ? gteRegs.CP2C.p[ (n << 3) + 1 ].sw.h : C2_R13)
#define MX22(n) (n < 3 ? gteRegs.CP2C.p[ (n << 3) + 2 ].sw.l : C2_R13)
#define MX23(n) (n < 3 ? gteRegs.CP2C.p[ (n << 3) + 2 ].sw.h : C2_R13)
#define MX31(n) (n < 3 ? gteRegs.CP2C.p[ (n << 3) + 3 ].sw.l : C2_R22)
#define MX32(n) (n < 3 ? gteRegs.CP2C.p[ (n << 3) + 3 ].sw.h : C2_R22)
#define MX33(n) (n < 3 ? gteRegs.CP2C.p[ (n << 3) + 4 ].sw.l : C2_R22)
#define CV1(n) (n < 3 ? gteRegs.CP2C.p[ (n << 3) + 5 ].sd : 0)
#define CV2(n) (n < 3 ? gteRegs.CP2C.p[ (n << 3) + 6 ].sd : 0)
#define CV3(n) (n < 3 ? gteRegs.CP2C.p[ (n << 3) + 7 ].sd : 0)
#ifndef max
# define max(a, b) ((a) > (b) ? (a) : (b))
#endif
#ifndef min
# define min(a, b) ((a) < (b) ? (a) : (b))
#endif
static int m_sf;
static long long m_mac0;
static long long m_mac3;
unsigned int gte_leadingzerocount(unsigned int lzcs)
{
#if 0 // OLD AND SLOW WAY
unsigned int lzcr = 0;
if ((lzcs & 0x80000000) == 0)
lzcs = ~lzcs;
while ((lzcs & 0x80000000) != 0) {
lzcr++;
lzcs <<= 1;
}
return lzcr;
#endif
if (!lzcs)
return 32;
// perform fast bit scan
unsigned int lzcr = lzcs;
static char debruijn32[32] = {
0, 31, 9, 30, 3, 8, 13, 29, 2, 5, 7, 21, 12, 24, 28, 19,
1, 10, 4, 14, 6, 22, 25, 20, 11, 15, 23, 26, 16, 27, 17, 18
};
lzcr |= lzcr >> 1;
lzcr |= lzcr >> 2;
lzcr |= lzcr >> 4;
lzcr |= lzcr >> 8;
lzcr |= lzcr >> 16;
lzcr++;
return debruijn32[lzcr * 0x076be629 >> 27];
}
int LIM(int value, int max, int min, unsigned int flag) {
if (value > max) {
C2_FLAG |= flag;
return max;
}
else if (value < min) {
C2_FLAG |= flag;
return min;
}
return value;
}
#define _oB_ (gteRegs.GPR.r[_Rs_] + _Imm_)
inline long long gte_shift(long long a, int sf) {
if (sf > 0)
return a >> 12;
else if (sf < 0)
return a << 12;
return a;
}
int BOUNDS(/*int44*/long long value, int max_flag, int min_flag) {
if (value/*.positive_overflow()*/ > (long long)0x7ffffffffff)
C2_FLAG |= max_flag;
if (value/*.negative_overflow()*/ < (long long)-0x8000000000)
C2_FLAG |= min_flag;
return int(gte_shift(value/*.value()*/, m_sf));
}
unsigned int gte_divide(unsigned short numerator, unsigned short denominator)
{
if (numerator < (denominator * 2))
{
static unsigned char table[] =
{
0xff, 0xfd, 0xfb, 0xf9, 0xf7, 0xf5, 0xf3, 0xf1, 0xef, 0xee, 0xec, 0xea, 0xe8, 0xe6, 0xe4, 0xe3,
0xe1, 0xdf, 0xdd, 0xdc, 0xda, 0xd8, 0xd6, 0xd5, 0xd3, 0xd1, 0xd0, 0xce, 0xcd, 0xcb, 0xc9, 0xc8,
0xc6, 0xc5, 0xc3, 0xc1, 0xc0, 0xbe, 0xbd, 0xbb, 0xba, 0xb8, 0xb7, 0xb5, 0xb4, 0xb2, 0xb1, 0xb0,
0xae, 0xad, 0xab, 0xaa, 0xa9, 0xa7, 0xa6, 0xa4, 0xa3, 0xa2, 0xa0, 0x9f, 0x9e, 0x9c, 0x9b, 0x9a,
0x99, 0x97, 0x96, 0x95, 0x94, 0x92, 0x91, 0x90, 0x8f, 0x8d, 0x8c, 0x8b, 0x8a, 0x89, 0x87, 0x86,
0x85, 0x84, 0x83, 0x82, 0x81, 0x7f, 0x7e, 0x7d, 0x7c, 0x7b, 0x7a, 0x79, 0x78, 0x77, 0x75, 0x74,
0x73, 0x72, 0x71, 0x70, 0x6f, 0x6e, 0x6d, 0x6c, 0x6b, 0x6a, 0x69, 0x68, 0x67, 0x66, 0x65, 0x64,
0x63, 0x62, 0x61, 0x60, 0x5f, 0x5e, 0x5d, 0x5d, 0x5c, 0x5b, 0x5a, 0x59, 0x58, 0x57, 0x56, 0x55,
0x54, 0x53, 0x53, 0x52, 0x51, 0x50, 0x4f, 0x4e, 0x4d, 0x4d, 0x4c, 0x4b, 0x4a, 0x49, 0x48, 0x48,
0x47, 0x46, 0x45, 0x44, 0x43, 0x43, 0x42, 0x41, 0x40, 0x3f, 0x3f, 0x3e, 0x3d, 0x3c, 0x3c, 0x3b,
0x3a, 0x39, 0x39, 0x38, 0x37, 0x36, 0x36, 0x35, 0x34, 0x33, 0x33, 0x32, 0x31, 0x31, 0x30, 0x2f,
0x2e, 0x2e, 0x2d, 0x2c, 0x2c, 0x2b, 0x2a, 0x2a, 0x29, 0x28, 0x28, 0x27, 0x26, 0x26, 0x25, 0x24,
0x24, 0x23, 0x22, 0x22, 0x21, 0x20, 0x20, 0x1f, 0x1e, 0x1e, 0x1d, 0x1d, 0x1c, 0x1b, 0x1b, 0x1a,
0x19, 0x19, 0x18, 0x18, 0x17, 0x16, 0x16, 0x15, 0x15, 0x14, 0x14, 0x13, 0x12, 0x12, 0x11, 0x11,
0x10, 0x0f, 0x0f, 0x0e, 0x0e, 0x0d, 0x0d, 0x0c, 0x0c, 0x0b, 0x0a, 0x0a, 0x09, 0x09, 0x08, 0x08,
0x07, 0x07, 0x06, 0x06, 0x05, 0x05, 0x04, 0x04, 0x03, 0x03, 0x02, 0x02, 0x01, 0x01, 0x00, 0x00,
0x00
};
int shift = gte_leadingzerocount(denominator) - 16;
int r1 = (denominator << shift) & 0x7fff;
int r2 = table[((r1 + 0x40) >> 7)] + 0x101;
int r3 = ((0x80 - (r2 * (r1 + 0x8000))) >> 8) & 0x1ffff;
unsigned int reciprocal = ((r2 * r3) + 0x80) >> 8;
return (unsigned int)((((unsigned long long)reciprocal * (numerator << shift)) + 0x8000) >> 16);
}
return 0xffffffff;
}
/* Setting bits 12 & 19-22 in FLAG does not set bit 31 */
int A1(/*int44*/long long a) { return BOUNDS(a, (1 << 31) | (1 << 30), (1 << 31) | (1 << 27)); }
int A2(/*int44*/long long a) { return BOUNDS(a, (1 << 31) | (1 << 29), (1 << 31) | (1 << 26)); }
int A3(/*int44*/long long a) { m_mac3 = a; return BOUNDS(a, (1 << 31) | (1 << 28), (1 << 31) | (1 << 25)); }
int Lm_B1(int a, int lm) { return LIM(a, 0x7fff, -0x8000 * !lm, (1 << 31) | (1 << 24)); }
int Lm_B2(int a, int lm) { return LIM(a, 0x7fff, -0x8000 * !lm, (1 << 31) | (1 << 23)); }
int Lm_B3(int a, int lm) { return LIM(a, 0x7fff, -0x8000 * !lm, (1 << 22)); }
int Lm_B3_sf(long long value, int sf, int lm) {
int value_sf = int(gte_shift(value, sf));
int value_12 = int(gte_shift(value, 1));
int max = 0x7fff;
int min = 0;
if (lm == 0)
min = -0x8000;
if (value_12 < -0x8000 || value_12 > 0x7fff)
C2_FLAG |= (1 << 22);
if (value_sf > max)
return max;
else if (value_sf < min)
return min;
return value_sf;
}
int Lm_C1(int a) { return LIM(a, 0x00ff, 0x0000, (1 << 21)); }
int Lm_C2(int a) { return LIM(a, 0x00ff, 0x0000, (1 << 20)); }
int Lm_C3(int a) { return LIM(a, 0x00ff, 0x0000, (1 << 19)); }
int Lm_D(long long a, int sf) { return LIM(int(gte_shift(a, sf)), 0xffff, 0x0000, (1 << 31) | (1 << 18)); }
unsigned int Lm_E(unsigned int result) {
if (result == 0xffffffff) {
C2_FLAG |= (1 << 31) | (1 << 17);
return 0x1ffff;
}
if (result > 0x1ffff)
return 0x1ffff;
return result;
}
long long F(long long a) {
m_mac0 = a;
if (a > 0x7fffffffLL)
C2_FLAG |= (1 << 31) | (1 << 16);
if (a < -0x80000000LL)
C2_FLAG |= (1 << 31) | (1 << 15);
return a;
}
int Lm_G1(long long a) {
if (a > 0x3ff) {
C2_FLAG |= (1 << 31) | (1 << 14);
return 0x3ff;
}
if (a < -0x400) {
C2_FLAG |= (1 << 31) | (1 << 14);
return -0x400;
}
return int(a);
}
int Lm_G2(long long a) {
if (a > 0x3ff) {
C2_FLAG |= (1 << 31) | (1 << 13);
return 0x3ff;
}
if (a < -0x400) {
C2_FLAG |= (1 << 31) | (1 << 13);
return -0x400;
}
return int(a);
}
int Lm_G1_ia(long long a) {
if (a > 0x3ffffff)
return 0x3ffffff;
if (a < -0x4000000)
return -0x4000000;
return int(a);
}
int Lm_G2_ia(long long a) {
if (a > 0x3ffffff)
return 0x3ffffff;
if (a < -0x4000000)
return -0x4000000;
return int(a);
}
int Lm_H(long long value, int sf) {
long long value_sf = gte_shift(value, sf);
int value_12 = int(gte_shift(value, 1));
int max = 0x1000;
int min = 0x0000;
if (value_sf < min || value_sf > max)
C2_FLAG |= (1 << 12);
if (value_12 > max)
return max;
if (value_12 < min)
return min;
return value_12;
}
#ifdef USE_PGXP
PGXPVector3D g_FP_SXYZ0; // direct access PGXP without table lookup
PGXPVector3D g_FP_SXYZ1;
PGXPVector3D g_FP_SXYZ2;
PGXPVData g_pgxpCache[1 << sizeof(ushort)*8];
ushort g_pgxpVertexIndex = 0;
int g_pgxpTransformed = 0;
// "render" states
float g_pgxpZOffset = 0.0f;
float g_pgxpZScale = 1.0f;
void PGXP_ClearCache()
{
g_pgxpVertexIndex = 0;
}
ushort PGXP_GetIndex()
{
if (g_pgxpTransformed)
{
g_pgxpTransformed = 0;
return g_pgxpVertexIndex;
}
return 0xFFFF;
}
ushort PGXP_EmitCacheData(PGXPVData* newData)
{
g_pgxpCache[g_pgxpVertexIndex++] = *newData;
g_pgxpTransformed = 1;
return g_pgxpVertexIndex;
}
void PGXP_SetZOffsetScale(float offset, float scale)
{
g_pgxpZOffset = offset;
g_pgxpZScale = scale;
}
// sets copy of cached vertex data to out
int PGXP_GetCacheData(PGXPVData* out, uint lookup, ushort indexhint)
{
if (indexhint == 0xFFFF)
{
out->px = 0.0f;
out->py = 0.0f;
out->pz = 1.0f;
out->scr_h = 0.0f;
out->ofx = 0.0f;
out->ofx = 0.0f;
return 0;
}
// index hint allows us to start from specific index
ushort start = max(0, indexhint - 8);
ushort end = g_pgxpVertexIndex;
for (ushort i = start; i < end; i++)
{
if (g_pgxpCache[i].lookup == lookup)
{
*out = g_pgxpCache[i];
return 1;
}
}
out->px = 0.0f;
out->py = 0.0f;
out->pz = 1.0f;
out->scr_h = 0.0f;
out->ofx = 0.0f;
out->ofx = 0.0f;
return 0;
}
#endif // USE_PGXP
int GTE_RotTransPers(int idx, int lm)
{
int h_over_sz3;
C2_MAC1 = A1(/*int44*/(long long)((long long)C2_TRX << 12) + (C2_R11 * VX(idx)) + (C2_R12 * VY(idx)) + (C2_R13 * VZ(idx)));
C2_MAC2 = A2(/*int44*/(long long)((long long)C2_TRY << 12) + (C2_R21 * VX(idx)) + (C2_R22 * VY(idx)) + (C2_R23 * VZ(idx)));
C2_MAC3 = A3(/*int44*/(long long)((long long)C2_TRZ << 12) + (C2_R31 * VX(idx)) + (C2_R32 * VY(idx)) + (C2_R33 * VZ(idx)));
C2_IR1 = Lm_B1(C2_MAC1, lm);
C2_IR2 = Lm_B2(C2_MAC2, lm);
C2_IR3 = Lm_B3_sf(m_mac3, m_sf, lm);
C2_SZ0 = C2_SZ1;
C2_SZ1 = C2_SZ2;
C2_SZ2 = C2_SZ3;
C2_SZ3 = Lm_D(m_mac3, 1);
h_over_sz3 = Lm_E(gte_divide(C2_H, C2_SZ3));
C2_SXY0 = C2_SXY1;
C2_SXY1 = C2_SXY2;
C2_SX2 = Lm_G1(F((long long)C2_OFX + ((long long)C2_IR1 * h_over_sz3)) >> 16);
C2_SY2 = Lm_G2(F((long long)C2_OFY + ((long long)C2_IR2 * h_over_sz3)) >> 16);
#if defined(USE_PGXP)
// perform the same but in floating point
double fMAC1 = (/*int44*/(double)((float)C2_TRX * 4096.0f) + ((float)C2_R11 * (float)VX(idx)) + ((float)C2_R12 * (float)VY(idx)) + ((float)C2_R13 * (float)VZ(idx)));
double fMAC2 = (/*int44*/(double)((float)C2_TRY * 4096.0f) + ((float)C2_R21 * (float)VX(idx)) + ((float)C2_R22 * (float)VY(idx)) + ((float)C2_R23 * (float)VZ(idx)));
double fMAC3 = (/*int44*/(double)((float)C2_TRZ * 4096.0f) + ((float)C2_R31 * (float)VX(idx)) + ((float)C2_R32 * (float)VY(idx)) + ((float)C2_R33 * (float)VZ(idx)));
const double one_by_v = 1.0 / (512.0 * 1024.0);
g_FP_SXYZ0 = g_FP_SXYZ1;
g_FP_SXYZ1 = g_FP_SXYZ2;
// calculate projected values for cache
PGXPVector3D temp;
temp.px = (double(C2_OFX) + double(float(C2_IR1) * float(h_over_sz3))) / float(1 << 16);
temp.py = (double(C2_OFY) + double(float(C2_IR2) * float(h_over_sz3))) / float(1 << 16);
temp.pz = float(max(C2_SZ3, C2_H / 2)) / float(1 << 16);
// make half-float equivalents
temp.x = temp.px;
temp.y = temp.py;
temp.z = temp.pz;
g_FP_SXYZ2 = temp;
// do not perform perspective multiplication so it stays in object space
// perspective is performed exclusively in shader
PGXPVData vdata;
vdata.lookup = PGXP_LOOKUP_VALUE(temp.x, temp.y); // hash short values
// FIXME: actually we scaling here entire geometry, is that correct?
vdata.px = fMAC1 * one_by_v * g_pgxpZScale + g_pgxpZOffset;
vdata.py = fMAC2 * one_by_v * g_pgxpZScale + g_pgxpZOffset;
vdata.pz = fMAC3 * one_by_v * g_pgxpZScale + g_pgxpZOffset;
vdata.ofx = float(C2_OFX) / float(1 << 16);
vdata.ofy = float(C2_OFY) / float(1 << 16);
vdata.scr_h = float(C2_H);
g_pgxpCache[g_pgxpVertexIndex++] = vdata;
g_pgxpTransformed = 1;
#endif
return h_over_sz3;
}
int GTE_operator(int op)
{
int v;
int lm;
int cv;
int mx;
int h_over_sz3 = 0;
lm = GTE_LM(gteop(op));
m_sf = GTE_SF(gteop(op));
C2_FLAG = 0;
switch (GTE_FUNCT(gteop(op)))
{
case 0x00:
case 0x01:
#ifdef GTE_LOG
GTELOG("%08x RTPS", op);
#endif
h_over_sz3 = GTE_RotTransPers(0, lm);
C2_MAC0 = int(F((long long)C2_DQB + ((long long)C2_DQA * h_over_sz3)));
C2_IR0 = Lm_H(m_mac0, 1);
return 1;
case 0x06:
#ifdef GTE_LOG
GTELOG("%08x NCLIP", op);
#endif
#ifdef USE_PGXP
{
float fSX0 = g_FP_SXYZ0.px;
float fSY0 = g_FP_SXYZ0.py;
float fSX1 = g_FP_SXYZ1.px;
float fSY1 = g_FP_SXYZ1.py;
float fSX2 = g_FP_SXYZ2.px;
float fSY2 = g_FP_SXYZ2.py;
float nclip = (fSX0 * fSY1) + (fSX1 * fSY2) + (fSX2 * fSY0) - (fSX0 * fSY2) - (fSX1 * fSY0) - (fSX2 * fSY1);
float absNclip = fabs(nclip);
if ((0.1f < absNclip) && (absNclip < 1.0f))
nclip += (nclip < 0.0f) ? -1.0f : 1.0f;
C2_MAC0 = nclip;
}
#else
C2_MAC0 = int(F((long long)(C2_SX0 * C2_SY1) + (C2_SX1 * C2_SY2) + (C2_SX2 * C2_SY0) - (C2_SX0 * C2_SY2) - (C2_SX1 * C2_SY0) - (C2_SX2 * C2_SY1)));
#endif
C2_FLAG = 0;
return 1;
case 0x0c:
#ifdef GTE_LOG
GTELOG("%08x OP", op);
#endif
C2_MAC1 = A1((long long)(C2_R22 * C2_IR3) - (C2_R33 * C2_IR2));
C2_MAC2 = A2((long long)(C2_R33 * C2_IR1) - (C2_R11 * C2_IR3));
C2_MAC3 = A3((long long)(C2_R11 * C2_IR2) - (C2_R22 * C2_IR1));
C2_IR1 = Lm_B1(C2_MAC1, lm);
C2_IR2 = Lm_B2(C2_MAC2, lm);
C2_IR3 = Lm_B3(C2_MAC3, lm);
return 1;
case 0x10:
#ifdef GTE_LOG
GTELOG("%08x DPCS", op);
#endif
C2_MAC1 = A1((C2_R << 16) + (C2_IR0 * Lm_B1(A1(((long long)C2_RFC << 12) - (C2_R << 16)), 0)));
C2_MAC2 = A2((C2_G << 16) + (C2_IR0 * Lm_B2(A2(((long long)C2_GFC << 12) - (C2_G << 16)), 0)));
C2_MAC3 = A3((C2_B << 16) + (C2_IR0 * Lm_B3(A3(((long long)C2_BFC << 12) - (C2_B << 16)), 0)));
C2_IR1 = Lm_B1(C2_MAC1, lm);
C2_IR2 = Lm_B2(C2_MAC2, lm);
C2_IR3 = Lm_B3(C2_MAC3, lm);
C2_RGB0 = C2_RGB1;
C2_RGB1 = C2_RGB2;
C2_CD2 = C2_CODE;
C2_R2 = Lm_C1(C2_MAC1 >> 4);
C2_G2 = Lm_C2(C2_MAC2 >> 4);
C2_B2 = Lm_C3(C2_MAC3 >> 4);
return 1;
case 0x11:
#ifdef GTE_LOG
GTELOG("%08x INTPL", op);
#endif
C2_MAC1 = A1((C2_IR1 << 12) + (C2_IR0 * Lm_B1(A1(((long long)C2_RFC << 12) - (C2_IR1 << 12)), 0)));
C2_MAC2 = A2((C2_IR2 << 12) + (C2_IR0 * Lm_B2(A2(((long long)C2_GFC << 12) - (C2_IR2 << 12)), 0)));
C2_MAC3 = A3((C2_IR3 << 12) + (C2_IR0 * Lm_B3(A3(((long long)C2_BFC << 12) - (C2_IR3 << 12)), 0)));
C2_IR1 = Lm_B1(C2_MAC1, lm);
C2_IR2 = Lm_B2(C2_MAC2, lm);
C2_IR3 = Lm_B3(C2_MAC3, lm);
C2_RGB0 = C2_RGB1;
C2_RGB1 = C2_RGB2;
C2_CD2 = C2_CODE;
C2_R2 = Lm_C1(C2_MAC1 >> 4);
C2_G2 = Lm_C2(C2_MAC2 >> 4);
C2_B2 = Lm_C3(C2_MAC3 >> 4);
return 1;
case 0x12:
#ifdef GTE_LOG
GTELOG("%08x MVMVA", op);
#endif
mx = GTE_MX(gteop(op));
v = GTE_V(gteop(op));
cv = GTE_CV(gteop(op));
switch (cv) {
case 2:
C2_MAC1 = A1((long long)(MX12(mx) * VY(v)) + (MX13(mx) * VZ(v)));
C2_MAC2 = A2((long long)(MX22(mx) * VY(v)) + (MX23(mx) * VZ(v)));
C2_MAC3 = A3((long long)(MX32(mx) * VY(v)) + (MX33(mx) * VZ(v)));
Lm_B1(A1(((long long)CV1(cv) << 12) + (MX11(mx) * VX(v))), 0);
Lm_B2(A2(((long long)CV2(cv) << 12) + (MX21(mx) * VX(v))), 0);
Lm_B3(A3(((long long)CV3(cv) << 12) + (MX31(mx) * VX(v))), 0);
break;
default:
C2_MAC1 = A1(/*int44*/(long long)((long long)CV1(cv) << 12) + (MX11(mx) * VX(v)) + (MX12(mx) * VY(v)) + (MX13(mx) * VZ(v)));
C2_MAC2 = A2(/*int44*/(long long)((long long)CV2(cv) << 12) + (MX21(mx) * VX(v)) + (MX22(mx) * VY(v)) + (MX23(mx) * VZ(v)));
C2_MAC3 = A3(/*int44*/(long long)((long long)CV3(cv) << 12) + (MX31(mx) * VX(v)) + (MX32(mx) * VY(v)) + (MX33(mx) * VZ(v)));
break;
}
C2_IR1 = Lm_B1(C2_MAC1, lm);
C2_IR2 = Lm_B2(C2_MAC2, lm);
C2_IR3 = Lm_B3(C2_MAC3, lm);
return 1;
case 0x13:
#ifdef GTE_LOG
GTELOG("%08x NCDS", op);
#endif
C2_MAC1 = A1((long long)(C2_L11 * C2_VX0) + (C2_L12 * C2_VY0) + (C2_L13 * C2_VZ0));
C2_MAC2 = A2((long long)(C2_L21 * C2_VX0) + (C2_L22 * C2_VY0) + (C2_L23 * C2_VZ0));
C2_MAC3 = A3((long long)(C2_L31 * C2_VX0) + (C2_L32 * C2_VY0) + (C2_L33 * C2_VZ0));
C2_IR1 = Lm_B1(C2_MAC1, lm);
C2_IR2 = Lm_B2(C2_MAC2, lm);
C2_IR3 = Lm_B3(C2_MAC3, lm);
C2_MAC1 = A1(/*int44*/(long long)((long long)C2_RBK << 12) + (C2_LR1 * C2_IR1) + (C2_LR2 * C2_IR2) + (C2_LR3 * C2_IR3));
C2_MAC2 = A2(/*int44*/(long long)((long long)C2_GBK << 12) + (C2_LG1 * C2_IR1) + (C2_LG2 * C2_IR2) + (C2_LG3 * C2_IR3));
C2_MAC3 = A3(/*int44*/(long long)((long long)C2_BBK << 12) + (C2_LB1 * C2_IR1) + (C2_LB2 * C2_IR2) + (C2_LB3 * C2_IR3));
C2_IR1 = Lm_B1(C2_MAC1, lm);
C2_IR2 = Lm_B2(C2_MAC2, lm);
C2_IR3 = Lm_B3(C2_MAC3, lm);
C2_MAC1 = A1(((C2_R << 4) * C2_IR1) + (C2_IR0 * Lm_B1(A1(((long long)C2_RFC << 12) - ((C2_R << 4) * C2_IR1)), 0)));
C2_MAC2 = A2(((C2_G << 4) * C2_IR2) + (C2_IR0 * Lm_B2(A2(((long long)C2_GFC << 12) - ((C2_G << 4) * C2_IR2)), 0)));
C2_MAC3 = A3(((C2_B << 4) * C2_IR3) + (C2_IR0 * Lm_B3(A3(((long long)C2_BFC << 12) - ((C2_B << 4) * C2_IR3)), 0)));
C2_IR1 = Lm_B1(C2_MAC1, lm);
C2_IR2 = Lm_B2(C2_MAC2, lm);
C2_IR3 = Lm_B3(C2_MAC3, lm);
C2_RGB0 = C2_RGB1;
C2_RGB1 = C2_RGB2;
C2_CD2 = C2_CODE;
C2_R2 = Lm_C1(C2_MAC1 >> 4);
C2_G2 = Lm_C2(C2_MAC2 >> 4);
C2_B2 = Lm_C3(C2_MAC3 >> 4);
return 1;
case 0x14:
#ifdef GTE_LOG
GTELOG("%08x CDP", op);
#endif
C2_MAC1 = A1(/*int44*/(long long)((long long)C2_RBK << 12) + (C2_LR1 * C2_IR1) + (C2_LR2 * C2_IR2) + (C2_LR3 * C2_IR3));
C2_MAC2 = A2(/*int44*/(long long)((long long)C2_GBK << 12) + (C2_LG1 * C2_IR1) + (C2_LG2 * C2_IR2) + (C2_LG3 * C2_IR3));
C2_MAC3 = A3(/*int44*/(long long)((long long)C2_BBK << 12) + (C2_LB1 * C2_IR1) + (C2_LB2 * C2_IR2) + (C2_LB3 * C2_IR3));
C2_IR1 = Lm_B1(C2_MAC1, lm);
C2_IR2 = Lm_B2(C2_MAC2, lm);
C2_IR3 = Lm_B3(C2_MAC3, lm);
C2_MAC1 = A1(((C2_R << 4) * C2_IR1) + (C2_IR0 * Lm_B1(A1(((long long)C2_RFC << 12) - ((C2_R << 4) * C2_IR1)), 0)));
C2_MAC2 = A2(((C2_G << 4) * C2_IR2) + (C2_IR0 * Lm_B2(A2(((long long)C2_GFC << 12) - ((C2_G << 4) * C2_IR2)), 0)));
C2_MAC3 = A3(((C2_B << 4) * C2_IR3) + (C2_IR0 * Lm_B3(A3(((long long)C2_BFC << 12) - ((C2_B << 4) * C2_IR3)), 0)));
C2_IR1 = Lm_B1(C2_MAC1, lm);
C2_IR2 = Lm_B2(C2_MAC2, lm);
C2_IR3 = Lm_B3(C2_MAC3, lm);
C2_RGB0 = C2_RGB1;
C2_RGB1 = C2_RGB2;
C2_CD2 = C2_CODE;
C2_R2 = Lm_C1(C2_MAC1 >> 4);
C2_G2 = Lm_C2(C2_MAC2 >> 4);
C2_B2 = Lm_C3(C2_MAC3 >> 4);
return 1;
case 0x16:
#ifdef GTE_LOG
GTELOG("%08x NCDT", op);
#endif
for (v = 0; v < 3; v++) {
C2_MAC1 = A1((long long)(C2_L11 * VX(v)) + (C2_L12 * VY(v)) + (C2_L13 * VZ(v)));
C2_MAC2 = A2((long long)(C2_L21 * VX(v)) + (C2_L22 * VY(v)) + (C2_L23 * VZ(v)));
C2_MAC3 = A3((long long)(C2_L31 * VX(v)) + (C2_L32 * VY(v)) + (C2_L33 * VZ(v)));
C2_IR1 = Lm_B1(C2_MAC1, lm);
C2_IR2 = Lm_B2(C2_MAC2, lm);
C2_IR3 = Lm_B3(C2_MAC3, lm);
C2_MAC1 = A1(/*int44*/(long long)((long long)C2_RBK << 12) + (C2_LR1 * C2_IR1) + (C2_LR2 * C2_IR2) + (C2_LR3 * C2_IR3));
C2_MAC2 = A2(/*int44*/(long long)((long long)C2_GBK << 12) + (C2_LG1 * C2_IR1) + (C2_LG2 * C2_IR2) + (C2_LG3 * C2_IR3));
C2_MAC3 = A3(/*int44*/(long long)((long long)C2_BBK << 12) + (C2_LB1 * C2_IR1) + (C2_LB2 * C2_IR2) + (C2_LB3 * C2_IR3));
C2_IR1 = Lm_B1(C2_MAC1, lm);
C2_IR2 = Lm_B2(C2_MAC2, lm);
C2_IR3 = Lm_B3(C2_MAC3, lm);
C2_MAC1 = A1(((C2_R << 4) * C2_IR1) + (C2_IR0 * Lm_B1(A1(((long long)C2_RFC << 12) - ((C2_R << 4) * C2_IR1)), 0)));
C2_MAC2 = A2(((C2_G << 4) * C2_IR2) + (C2_IR0 * Lm_B2(A2(((long long)C2_GFC << 12) - ((C2_G << 4) * C2_IR2)), 0)));
C2_MAC3 = A3(((C2_B << 4) * C2_IR3) + (C2_IR0 * Lm_B3(A3(((long long)C2_BFC << 12) - ((C2_B << 4) * C2_IR3)), 0)));
C2_IR1 = Lm_B1(C2_MAC1, lm);
C2_IR2 = Lm_B2(C2_MAC2, lm);
C2_IR3 = Lm_B3(C2_MAC3, lm);
C2_RGB0 = C2_RGB1;
C2_RGB1 = C2_RGB2;
C2_CD2 = C2_CODE;
C2_R2 = Lm_C1(C2_MAC1 >> 4);
C2_G2 = Lm_C2(C2_MAC2 >> 4);
C2_B2 = Lm_C3(C2_MAC3 >> 4);
}
return 1;
case 0x1b:
#ifdef GTE_LOG
GTELOG("%08x NCCS", op);
#endif
C2_MAC1 = A1((long long)(C2_L11 * C2_VX0) + (C2_L12 * C2_VY0) + (C2_L13 * C2_VZ0));
C2_MAC2 = A2((long long)(C2_L21 * C2_VX0) + (C2_L22 * C2_VY0) + (C2_L23 * C2_VZ0));
C2_MAC3 = A3((long long)(C2_L31 * C2_VX0) + (C2_L32 * C2_VY0) + (C2_L33 * C2_VZ0));
C2_IR1 = Lm_B1(C2_MAC1, lm);
C2_IR2 = Lm_B2(C2_MAC2, lm);
C2_IR3 = Lm_B3(C2_MAC3, lm);
C2_MAC1 = A1(/*int44*/(long long)((long long)C2_RBK << 12) + (C2_LR1 * C2_IR1) + (C2_LR2 * C2_IR2) + (C2_LR3 * C2_IR3));
C2_MAC2 = A2(/*int44*/(long long)((long long)C2_GBK << 12) + (C2_LG1 * C2_IR1) + (C2_LG2 * C2_IR2) + (C2_LG3 * C2_IR3));
C2_MAC3 = A3(/*int44*/(long long)((long long)C2_BBK << 12) + (C2_LB1 * C2_IR1) + (C2_LB2 * C2_IR2) + (C2_LB3 * C2_IR3));
C2_IR1 = Lm_B1(C2_MAC1, lm);
C2_IR2 = Lm_B2(C2_MAC2, lm);
C2_IR3 = Lm_B3(C2_MAC3, lm);
C2_MAC1 = A1((C2_R << 4) * C2_IR1);
C2_MAC2 = A2((C2_G << 4) * C2_IR2);
C2_MAC3 = A3((C2_B << 4) * C2_IR3);
C2_IR1 = Lm_B1(C2_MAC1, lm);
C2_IR2 = Lm_B2(C2_MAC2, lm);
C2_IR3 = Lm_B3(C2_MAC3, lm);
C2_RGB0 = C2_RGB1;
C2_RGB1 = C2_RGB2;
C2_CD2 = C2_CODE;
C2_R2 = Lm_C1(C2_MAC1 >> 4);
C2_G2 = Lm_C2(C2_MAC2 >> 4);
C2_B2 = Lm_C3(C2_MAC3 >> 4);
return 1;
case 0x1c:
#ifdef GTE_LOG
GTELOG("%08x CC", op);
#endif
C2_MAC1 = A1(/*int44*/(long long)(((long long)C2_RBK) << 12) + (C2_LR1 * C2_IR1) + (C2_LR2 * C2_IR2) + (C2_LR3 * C2_IR3));
C2_MAC2 = A2(/*int44*/(long long)(((long long)C2_GBK) << 12) + (C2_LG1 * C2_IR1) + (C2_LG2 * C2_IR2) + (C2_LG3 * C2_IR3));
C2_MAC3 = A3(/*int44*/(long long)(((long long)C2_BBK) << 12) + (C2_LB1 * C2_IR1) + (C2_LB2 * C2_IR2) + (C2_LB3 * C2_IR3));
C2_IR1 = Lm_B1(C2_MAC1, lm);
C2_IR2 = Lm_B2(C2_MAC2, lm);
C2_IR3 = Lm_B3(C2_MAC3, lm);
C2_MAC1 = A1((C2_R << 4) * C2_IR1);
C2_MAC2 = A2((C2_G << 4) * C2_IR2);
C2_MAC3 = A3((C2_B << 4) * C2_IR3);
C2_IR1 = Lm_B1(C2_MAC1, lm);
C2_IR2 = Lm_B2(C2_MAC2, lm);
C2_IR3 = Lm_B3(C2_MAC3, lm);
C2_RGB0 = C2_RGB1;
C2_RGB1 = C2_RGB2;
C2_CD2 = C2_CODE;
C2_R2 = Lm_C1(C2_MAC1 >> 4);
C2_G2 = Lm_C2(C2_MAC2 >> 4);
C2_B2 = Lm_C3(C2_MAC3 >> 4);
return 1;
case 0x1e:
#ifdef GTE_LOG
GTELOG("%08x NCS", op);
#endif
C2_MAC1 = A1((long long)(C2_L11 * C2_VX0) + (C2_L12 * C2_VY0) + (C2_L13 * C2_VZ0));
C2_MAC2 = A2((long long)(C2_L21 * C2_VX0) + (C2_L22 * C2_VY0) + (C2_L23 * C2_VZ0));
C2_MAC3 = A3((long long)(C2_L31 * C2_VX0) + (C2_L32 * C2_VY0) + (C2_L33 * C2_VZ0));
C2_IR1 = Lm_B1(C2_MAC1, lm);
C2_IR2 = Lm_B2(C2_MAC2, lm);
C2_IR3 = Lm_B3(C2_MAC3, lm);
C2_MAC1 = A1(/*int44*/(long long)((long long)C2_RBK << 12) + (C2_LR1 * C2_IR1) + (C2_LR2 * C2_IR2) + (C2_LR3 * C2_IR3));
C2_MAC2 = A2(/*int44*/(long long)((long long)C2_GBK << 12) + (C2_LG1 * C2_IR1) + (C2_LG2 * C2_IR2) + (C2_LG3 * C2_IR3));
C2_MAC3 = A3(/*int44*/(long long)((long long)C2_BBK << 12) + (C2_LB1 * C2_IR1) + (C2_LB2 * C2_IR2) + (C2_LB3 * C2_IR3));
C2_IR1 = Lm_B1(C2_MAC1, lm);
C2_IR2 = Lm_B2(C2_MAC2, lm);
C2_IR3 = Lm_B3(C2_MAC3, lm);
C2_RGB0 = C2_RGB1;
C2_RGB1 = C2_RGB2;
C2_CD2 = C2_CODE;
C2_R2 = Lm_C1(C2_MAC1 >> 4);
C2_G2 = Lm_C2(C2_MAC2 >> 4);
C2_B2 = Lm_C3(C2_MAC3 >> 4);
return 1;
case 0x20:
#ifdef GTE_LOG
GTELOG("%08x NCT", op);
#endif
for (v = 0; v < 3; v++) {
C2_MAC1 = A1((long long)(C2_L11 * VX(v)) + (C2_L12 * VY(v)) + (C2_L13 * VZ(v)));
C2_MAC2 = A2((long long)(C2_L21 * VX(v)) + (C2_L22 * VY(v)) + (C2_L23 * VZ(v)));
C2_MAC3 = A3((long long)(C2_L31 * VX(v)) + (C2_L32 * VY(v)) + (C2_L33 * VZ(v)));
C2_IR1 = Lm_B1(C2_MAC1, lm);
C2_IR2 = Lm_B2(C2_MAC2, lm);
C2_IR3 = Lm_B3(C2_MAC3, lm);
C2_MAC1 = A1(/*int44*/(long long)((long long)C2_RBK << 12) + (C2_LR1 * C2_IR1) + (C2_LR2 * C2_IR2) + (C2_LR3 * C2_IR3));
C2_MAC2 = A2(/*int44*/(long long)((long long)C2_GBK << 12) + (C2_LG1 * C2_IR1) + (C2_LG2 * C2_IR2) + (C2_LG3 * C2_IR3));
C2_MAC3 = A3(/*int44*/(long long)((long long)C2_BBK << 12) + (C2_LB1 * C2_IR1) + (C2_LB2 * C2_IR2) + (C2_LB3 * C2_IR3));
C2_IR1 = Lm_B1(C2_MAC1, lm);
C2_IR2 = Lm_B2(C2_MAC2, lm);
C2_IR3 = Lm_B3(C2_MAC3, lm);
C2_RGB0 = C2_RGB1;
C2_RGB1 = C2_RGB2;
C2_CD2 = C2_CODE;
C2_R2 = Lm_C1(C2_MAC1 >> 4);
C2_G2 = Lm_C2(C2_MAC2 >> 4);
C2_B2 = Lm_C3(C2_MAC3 >> 4);
}
return 1;
case 0x28:
#ifdef GTE_LOG
GTELOG("%08x SQR", op);
#endif
C2_MAC1 = A1(C2_IR1 * C2_IR1);
C2_MAC2 = A2(C2_IR2 * C2_IR2);
C2_MAC3 = A3(C2_IR3 * C2_IR3);
C2_IR1 = Lm_B1(C2_MAC1, lm);
C2_IR2 = Lm_B2(C2_MAC2, lm);
C2_IR3 = Lm_B3(C2_MAC3, lm);
return 1;
case 0x29:
#ifdef GTE_LOG
GTELOG("%08x DPCL", op);
#endif
C2_MAC1 = A1(((C2_R << 4) * C2_IR1) + (C2_IR0 * Lm_B1(A1(((long long)C2_RFC << 12) - ((C2_R << 4) * C2_IR1)), 0)));
C2_MAC2 = A2(((C2_G << 4) * C2_IR2) + (C2_IR0 * Lm_B2(A2(((long long)C2_GFC << 12) - ((C2_G << 4) * C2_IR2)), 0)));
C2_MAC3 = A3(((C2_B << 4) * C2_IR3) + (C2_IR0 * Lm_B3(A3(((long long)C2_BFC << 12) - ((C2_B << 4) * C2_IR3)), 0)));
C2_IR1 = Lm_B1(C2_MAC1, lm);
C2_IR2 = Lm_B2(C2_MAC2, lm);
C2_IR3 = Lm_B3(C2_MAC3, lm);
C2_RGB0 = C2_RGB1;
C2_RGB1 = C2_RGB2;
C2_CD2 = C2_CODE;
C2_R2 = Lm_C1(C2_MAC1 >> 4);
C2_G2 = Lm_C2(C2_MAC2 >> 4);
C2_B2 = Lm_C3(C2_MAC3 >> 4);
return 1;
case 0x2a:
#ifdef GTE_LOG
GTELOG("%08x DPCT", op);
#endif
for (v = 0; v < 3; v++) {
C2_MAC1 = A1((C2_R0 << 16) + (C2_IR0 * Lm_B1(A1(((long long)C2_RFC << 12) - (C2_R0 << 16)), 0)));
C2_MAC2 = A2((C2_G0 << 16) + (C2_IR0 * Lm_B2(A2(((long long)C2_GFC << 12) - (C2_G0 << 16)), 0)));
C2_MAC3 = A3((C2_B0 << 16) + (C2_IR0 * Lm_B3(A3(((long long)C2_BFC << 12) - (C2_B0 << 16)), 0)));
C2_IR1 = Lm_B1(C2_MAC1, lm);
C2_IR2 = Lm_B2(C2_MAC2, lm);
C2_IR3 = Lm_B3(C2_MAC3, lm);
C2_RGB0 = C2_RGB1;
C2_RGB1 = C2_RGB2;
C2_CD2 = C2_CODE;
C2_R2 = Lm_C1(C2_MAC1 >> 4);
C2_G2 = Lm_C2(C2_MAC2 >> 4);
C2_B2 = Lm_C3(C2_MAC3 >> 4);
}
return 1;
case 0x2d:
#ifdef GTE_LOG
GTELOG("%08x AVSZ3", op);
#endif
C2_MAC0 = int(F((long long)(C2_ZSF3 * C2_SZ1) + (C2_ZSF3 * C2_SZ2) + (C2_ZSF3 * C2_SZ3)));
C2_OTZ = Lm_D(m_mac0, 1);
return 1;
case 0x2e:
#ifdef GTE_LOG
GTELOG("%08x AVSZ4", op);
#endif
C2_MAC0 = int(F((long long)(C2_ZSF4 * C2_SZ0) + (C2_ZSF4 * C2_SZ1) + (C2_ZSF4 * C2_SZ2) + (C2_ZSF4 * C2_SZ3)));
C2_OTZ = Lm_D(m_mac0, 1);
return 1;
case 0x30:
#ifdef GTE_LOG
GTELOG("%08x RTPT", op);
#endif
for (v = 0; v < 3; v++)
h_over_sz3 = GTE_RotTransPers(v, lm);
C2_MAC0 = int(F((long long)C2_DQB + ((long long)C2_DQA * h_over_sz3)));
C2_IR0 = Lm_H(m_mac0, 1);
return 1;
case 0x3d:
#ifdef GTE_LOG
GTELOG("%08x GPF", op);
#endif
C2_MAC1 = A1(C2_IR0 * C2_IR1);
C2_MAC2 = A2(C2_IR0 * C2_IR2);
C2_MAC3 = A3(C2_IR0 * C2_IR3);
C2_IR1 = Lm_B1(C2_MAC1, lm);
C2_IR2 = Lm_B2(C2_MAC2, lm);
C2_IR3 = Lm_B3(C2_MAC3, lm);
C2_RGB0 = C2_RGB1;
C2_RGB1 = C2_RGB2;
C2_CD2 = C2_CODE;
C2_R2 = Lm_C1(C2_MAC1 >> 4);
C2_G2 = Lm_C2(C2_MAC2 >> 4);
C2_B2 = Lm_C3(C2_MAC3 >> 4);
return 1;
case 0x3e:
#ifdef GTE_LOG
GTELOG("%08x GPL", op);
#endif
C2_MAC1 = A1(gte_shift(C2_MAC1, -m_sf) + (C2_IR0 * C2_IR1));
C2_MAC2 = A2(gte_shift(C2_MAC2, -m_sf) + (C2_IR0 * C2_IR2));
C2_MAC3 = A3(gte_shift(C2_MAC3, -m_sf) + (C2_IR0 * C2_IR3));
C2_IR1 = Lm_B1(C2_MAC1, lm);
C2_IR2 = Lm_B2(C2_MAC2, lm);
C2_IR3 = Lm_B3(C2_MAC3, lm);
C2_RGB0 = C2_RGB1;
C2_RGB1 = C2_RGB2;
C2_CD2 = C2_CODE;
C2_R2 = Lm_C1(C2_MAC1 >> 4);
C2_G2 = Lm_C2(C2_MAC2 >> 4);
C2_B2 = Lm_C3(C2_MAC3 >> 4);
return 1;
case 0x3f:
#ifdef GTE_LOG
GTELOG("%08x NCCT", op);
#endif
for (v = 0; v < 3; v++) {
C2_MAC1 = A1((long long)(C2_L11 * VX(v)) + (C2_L12 * VY(v)) + (C2_L13 * VZ(v)));
C2_MAC2 = A2((long long)(C2_L21 * VX(v)) + (C2_L22 * VY(v)) + (C2_L23 * VZ(v)));
C2_MAC3 = A3((long long)(C2_L31 * VX(v)) + (C2_L32 * VY(v)) + (C2_L33 * VZ(v)));
C2_IR1 = Lm_B1(C2_MAC1, lm);
C2_IR2 = Lm_B2(C2_MAC2, lm);
C2_IR3 = Lm_B3(C2_MAC3, lm);
C2_MAC1 = A1(/*int44*/(long long)((long long)C2_RBK << 12) + (C2_LR1 * C2_IR1) + (C2_LR2 * C2_IR2) + (C2_LR3 * C2_IR3));
C2_MAC2 = A2(/*int44*/(long long)((long long)C2_GBK << 12) + (C2_LG1 * C2_IR1) + (C2_LG2 * C2_IR2) + (C2_LG3 * C2_IR3));
C2_MAC3 = A3(/*int44*/(long long)((long long)C2_BBK << 12) + (C2_LB1 * C2_IR1) + (C2_LB2 * C2_IR2) + (C2_LB3 * C2_IR3));
C2_IR1 = Lm_B1(C2_MAC1, lm);
C2_IR2 = Lm_B2(C2_MAC2, lm);
C2_IR3 = Lm_B3(C2_MAC3, lm);
C2_MAC1 = A1((C2_R << 4) * C2_IR1);
C2_MAC2 = A2((C2_G << 4) * C2_IR2);
C2_MAC3 = A3((C2_B << 4) * C2_IR3);
C2_IR1 = Lm_B1(C2_MAC1, lm);
C2_IR2 = Lm_B2(C2_MAC2, lm);
C2_IR3 = Lm_B3(C2_MAC3, lm);
C2_RGB0 = C2_RGB1;
C2_RGB1 = C2_RGB2;
C2_CD2 = C2_CODE;
C2_R2 = Lm_C1(C2_MAC1 >> 4);
C2_G2 = Lm_C2(C2_MAC2 >> 4);
C2_B2 = Lm_C3(C2_MAC3 >> 4);
}
return 1;
}
return 0;
}

View File

@ -1,16 +0,0 @@
#ifndef PSYX_GTE_H
#define PSYX_GTE_H
//----------------------------------------------------------------------------------------------------------------
#if defined(_LANGUAGE_C_PLUS_PLUS)||defined(__cplusplus)||defined(c_plusplus)
extern "C" {
#endif
extern unsigned int gte_leadingzerocount(unsigned int lzcs);
#if defined(_LANGUAGE_C_PLUS_PLUS)||defined(__cplusplus)||defined(c_plusplus)
}
#endif
#endif

View File

@ -1,96 +0,0 @@
#include "PsyX/common/half_float.h"
#include "psx/types.h"
// see https://gist.github.com/rygorous/2156668
union FP32
{
uint u;
float f;
struct
{
uint Mantissa : 23;
uint Exponent : 8;
uint Sign : 1;
};
};
union FP16
{
unsigned short u;
struct
{
uint Mantissa : 10;
uint Exponent : 5;
uint Sign : 1;
};
};
short to_half_float(const float x)
{
// this is a approximate solution
FP32 f = *(FP32*)&x;
FP32 f32infty = { 255 << 23 };
FP32 f16max = { (127 + 16) << 23 };
FP32 magic = { 15 << 23 };
FP32 expinf = { (255 ^ 31) << 23 };
uint sign_mask = 0x80000000u;
FP16 o = { 0 };
uint sign = f.u & sign_mask;
f.u ^= sign;
if (!(f.f < f32infty.u)) // Inf or NaN
o.u = f.u ^ expinf.u;
else
{
if (f.f > f16max.f) f.f = f16max.f;
f.f *= magic.f;
}
o.u = f.u >> 13; // Take the mantissa bits
o.u |= sign >> 16;
return o.u;
}
float from_half_float(const short x)
{
FP16 h = { x };
static const FP32 magic = { 113 << 23 };
static const uint shifted_exp = 0x7c00 << 13; // exponent mask after shift
FP32 o;
o.u = (h.u & 0x7fff) << 13; // exponent/mantissa bits
uint exp = shifted_exp & o.u; // just the exponent
o.u += (127 - 15) << 23; // exponent adjust
// handle exponent special cases
if (exp == shifted_exp) // Inf/NaN?
o.u += (128 - 16) << 23; // extra exp adjust
else if (exp == 0) // Zero/Denormal?
{
o.u += 1 << 23; // extra exp adjust
o.f -= magic.f; // renormalize
}
o.u |= (h.u & 0x8000) << 16; // sign bit
return o.f;
}
// C++ parts
half::half(const float x)
{
sh = to_half_float(x);
}
half::half(const half& other)
{
sh = other.sh;
}
half::operator float() const
{
return from_half_float(sh);
}

View File

@ -1,259 +0,0 @@
short ratan_tbl[1025] = {
0x000, 0x001, 0x002, 0x002,
0x003, 0x003, 0x004, 0x005,
0x005, 0x006, 0x007, 0x007,
0x008, 0x009, 0x009, 0x00A,
0x00A, 0x00B, 0x00C, 0x00C,
0x00D, 0x00E, 0x00E, 0x00F,
0x010, 0x010, 0x011, 0x011,
0x012, 0x013, 0x013, 0x014,
0x015, 0x015, 0x016, 0x017,
0x017, 0x018, 0x018, 0x019,
0x01A, 0x01A, 0x01B, 0x01C,
0x01C, 0x01D, 0x01E, 0x01E,
0x01F, 0x01F, 0x020, 0x021,
0x021, 0x022, 0x023, 0x023,
0x024, 0x024, 0x025, 0x026,
0x026, 0x027, 0x028, 0x028,
0x029, 0x02A, 0x02A, 0x02B,
0x02B, 0x02C, 0x02D, 0x02D,
0x02E, 0x02F, 0x02F, 0x030,
0x031, 0x031, 0x032, 0x032,
0x033, 0x034, 0x034, 0x035,
0x036, 0x036, 0x037, 0x037,
0x038, 0x039, 0x039, 0x03A,
0x03B, 0x03B, 0x03C, 0x03D,
0x03D, 0x03E, 0x03E, 0x03F,
0x040, 0x040, 0x041, 0x042,
0x042, 0x043, 0x043, 0x044,
0x045, 0x045, 0x046, 0x047,
0x047, 0x048, 0x049, 0x049,
0x04A, 0x04A, 0x04B, 0x04C,
0x04C, 0x04D, 0x04E, 0x04E,
0x04F, 0x04F, 0x050, 0x051,
0x051, 0x052, 0x053, 0x053,
0x054, 0x054, 0x055, 0x056,
0x056, 0x057, 0x058, 0x058,
0x059, 0x059, 0x05A, 0x05B,
0x05B, 0x05C, 0x05D, 0x05D,
0x05E, 0x05E, 0x05F, 0x060,
0x060, 0x061, 0x062, 0x062,
0x063, 0x063, 0x064, 0x065,
0x065, 0x066, 0x067, 0x067,
0x068, 0x068, 0x069, 0x06A,
0x06A, 0x06B, 0x06B, 0x06C,
0x06D, 0x06D, 0x06E, 0x06F,
0x06F, 0x070, 0x070, 0x071,
0x072, 0x072, 0x073, 0x074,
0x074, 0x075, 0x075, 0x076,
0x077, 0x077, 0x078, 0x078,
0x079, 0x07A, 0x07A, 0x07B,
0x07C, 0x07C, 0x07D, 0x07D,
0x07E, 0x07F, 0x07F, 0x080,
0x080, 0x081, 0x082, 0x082,
0x083, 0x083, 0x084, 0x085,
0x085, 0x086, 0x087, 0x087,
0x088, 0x088, 0x089, 0x08A,
0x08A, 0x08B, 0x08B, 0x08C,
0x08D, 0x08D, 0x08E, 0x08E,
0x08F, 0x090, 0x090, 0x091,
0x091, 0x092, 0x093, 0x093,
0x094, 0x094, 0x095, 0x096,
0x096, 0x097, 0x098, 0x098,
0x099, 0x099, 0x09A, 0x09B,
0x09B, 0x09C, 0x09C, 0x09D,
0x09E, 0x09E, 0x09F, 0x09F,
0x0A0, 0x0A1, 0x0A1, 0x0A2,
0x0A2, 0x0A3, 0x0A4, 0x0A4,
0x0A5, 0x0A5, 0x0A6, 0x0A6,
0x0A7, 0x0A8, 0x0A8, 0x0A9,
0x0A9, 0x0AA, 0x0AB, 0x0AB,
0x0AC, 0x0AC, 0x0AD, 0x0AE,
0x0AE, 0x0AF, 0x0AF, 0x0B0,
0x0B1, 0x0B1, 0x0B2, 0x0B2,
0x0B3, 0x0B4, 0x0B4, 0x0B5,
0x0B5, 0x0B6, 0x0B6, 0x0B7,
0x0B8, 0x0B8, 0x0B9, 0x0B9,
0x0BA, 0x0BB, 0x0BB, 0x0BC,
0x0BC, 0x0BD, 0x0BE, 0x0BE,
0x0BF, 0x0BF, 0x0C0, 0x0C0,
0x0C1, 0x0C2, 0x0C2, 0x0C3,
0x0C3, 0x0C4, 0x0C5, 0x0C5,
0x0C6, 0x0C6, 0x0C7, 0x0C7,
0x0C8, 0x0C9, 0x0C9, 0x0CA,
0x0CA, 0x0CB, 0x0CB, 0x0CC,
0x0CD, 0x0CD, 0x0CE, 0x0CE,
0x0CF, 0x0CF, 0x0D0, 0x0D1,
0x0D1, 0x0D2, 0x0D2, 0x0D3,
0x0D3, 0x0D4, 0x0D5, 0x0D5,
0x0D6, 0x0D6, 0x0D7, 0x0D7,
0x0D8, 0x0D9, 0x0D9, 0x0DA,
0x0DA, 0x0DB, 0x0DB, 0x0DC,
0x0DD, 0x0DD, 0x0DE, 0x0DE,
0x0DF, 0x0DF, 0x0E0, 0x0E1,
0x0E1, 0x0E2, 0x0E2, 0x0E3,
0x0E3, 0x0E4, 0x0E4, 0x0E5,
0x0E6, 0x0E6, 0x0E7, 0x0E7,
0x0E8, 0x0E8, 0x0E9, 0x0EA,
0x0EA, 0x0EB, 0x0EB, 0x0EC,
0x0EC, 0x0ED, 0x0ED, 0x0EE,
0x0EF, 0x0EF, 0x0F0, 0x0F0,
0x0F1, 0x0F1, 0x0F2, 0x0F2,
0x0F3, 0x0F4, 0x0F4, 0x0F5,
0x0F5, 0x0F6, 0x0F6, 0x0F7,
0x0F7, 0x0F8, 0x0F8, 0x0F9,
0x0FA, 0x0FA, 0x0FB, 0x0FB,
0x0FC, 0x0FC, 0x0FD, 0x0FD,
0x0FE, 0x0FE, 0x0FF, 0x100,
0x100, 0x101, 0x101, 0x102,
0x102, 0x103, 0x103, 0x104,
0x104, 0x105, 0x106, 0x106,
0x107, 0x107, 0x108, 0x108,
0x109, 0x109, 0x10A, 0x10A,
0x10B, 0x10B, 0x10C, 0x10D,
0x10D, 0x10E, 0x10E, 0x10F,
0x10F, 0x110, 0x110, 0x111,
0x111, 0x112, 0x112, 0x113,
0x113, 0x114, 0x114, 0x115,
0x116, 0x116, 0x117, 0x117,
0x118, 0x118, 0x119, 0x119,
0x11A, 0x11A, 0x11B, 0x11B,
0x11C, 0x11C, 0x11D, 0x11D,
0x11E, 0x11E, 0x11F, 0x120,
0x120, 0x121, 0x121, 0x122,
0x122, 0x123, 0x123, 0x124,
0x124, 0x125, 0x125, 0x126,
0x126, 0x127, 0x127, 0x128,
0x128, 0x129, 0x129, 0x12A,
0x12A, 0x12B, 0x12B, 0x12C,
0x12C, 0x12D, 0x12D, 0x12E,
0x12E, 0x12F, 0x12F, 0x130,
0x130, 0x131, 0x131, 0x132,
0x133, 0x133, 0x134, 0x134,
0x135, 0x135, 0x136, 0x136,
0x137, 0x137, 0x138, 0x138,
0x139, 0x139, 0x13A, 0x13A,
0x13B, 0x13B, 0x13C, 0x13C,
0x13D, 0x13D, 0x13E, 0x13E,
0x13F, 0x13F, 0x140, 0x140,
0x141, 0x141, 0x142, 0x142,
0x142, 0x143, 0x143, 0x144,
0x144, 0x145, 0x145, 0x146,
0x146, 0x147, 0x147, 0x148,
0x148, 0x149, 0x149, 0x14A,
0x14A, 0x14B, 0x14B, 0x14C,
0x14C, 0x14D, 0x14D, 0x14E,
0x14E, 0x14F, 0x14F, 0x150,
0x150, 0x151, 0x151, 0x152,
0x152, 0x153, 0x153, 0x154,
0x154, 0x154, 0x155, 0x155,
0x156, 0x156, 0x157, 0x157,
0x158, 0x158, 0x159, 0x159,
0x15A, 0x15A, 0x15B, 0x15B,
0x15C, 0x15C, 0x15D, 0x15D,
0x15D, 0x15E, 0x15E, 0x15F,
0x15F, 0x160, 0x160, 0x161,
0x161, 0x162, 0x162, 0x163,
0x163, 0x164, 0x164, 0x164,
0x165, 0x165, 0x166, 0x166,
0x167, 0x167, 0x168, 0x168,
0x169, 0x169, 0x16A, 0x16A,
0x16A, 0x16B, 0x16B, 0x16C,
0x16C, 0x16D, 0x16D, 0x16E,
0x16E, 0x16F, 0x16F, 0x170,
0x170, 0x170, 0x171, 0x171,
0x172, 0x172, 0x173, 0x173,
0x174, 0x174, 0x174, 0x175,
0x175, 0x176, 0x176, 0x177,
0x177, 0x178, 0x178, 0x179,
0x179, 0x179, 0x17A, 0x17A,
0x17B, 0x17B, 0x17C, 0x17C,
0x17D, 0x17D, 0x17D, 0x17E,
0x17E, 0x17F, 0x17F, 0x180,
0x180, 0x181, 0x181, 0x181,
0x182, 0x182, 0x183, 0x183,
0x184, 0x184, 0x184, 0x185,
0x185, 0x186, 0x186, 0x187,
0x187, 0x187, 0x188, 0x188,
0x189, 0x189, 0x18A, 0x18A,
0x18B, 0x18B, 0x18B, 0x18C,
0x18C, 0x18D, 0x18D, 0x18E,
0x18E, 0x18E, 0x18F, 0x18F,
0x190, 0x190, 0x191, 0x191,
0x191, 0x192, 0x192, 0x193,
0x193, 0x193, 0x194, 0x194,
0x195, 0x195, 0x196, 0x196,
0x196, 0x197, 0x197, 0x198,
0x198, 0x199, 0x199, 0x199,
0x19A, 0x19A, 0x19B, 0x19B,
0x19B, 0x19C, 0x19C, 0x19D,
0x19D, 0x19D, 0x19E, 0x19E,
0x19F, 0x19F, 0x1A0, 0x1A0,
0x1A0, 0x1A1, 0x1A1, 0x1A2,
0x1A2, 0x1A2, 0x1A3, 0x1A3,
0x1A4, 0x1A4, 0x1A4, 0x1A5,
0x1A5, 0x1A6, 0x1A6, 0x1A6,
0x1A7, 0x1A7, 0x1A8, 0x1A8,
0x1A9, 0x1A9, 0x1A9, 0x1AA,
0x1AA, 0x1AB, 0x1AB, 0x1AB,
0x1AC, 0x1AC, 0x1AD, 0x1AD,
0x1AD, 0x1AE, 0x1AE, 0x1AF,
0x1AF, 0x1AF, 0x1B0, 0x1B0,
0x1B0, 0x1B1, 0x1B1, 0x1B2,
0x1B2, 0x1B2, 0x1B3, 0x1B3,
0x1B4, 0x1B4, 0x1B4, 0x1B5,
0x1B5, 0x1B6, 0x1B6, 0x1B6,
0x1B7, 0x1B7, 0x1B8, 0x1B8,
0x1B8, 0x1B9, 0x1B9, 0x1B9,
0x1BA, 0x1BA, 0x1BB, 0x1BB,
0x1BB, 0x1BC, 0x1BC, 0x1BD,
0x1BD, 0x1BD, 0x1BE, 0x1BE,
0x1BE, 0x1BF, 0x1BF, 0x1C0,
0x1C0, 0x1C0, 0x1C1, 0x1C1,
0x1C2, 0x1C2, 0x1C2, 0x1C3,
0x1C3, 0x1C3, 0x1C4, 0x1C4,
0x1C5, 0x1C5, 0x1C5, 0x1C6,
0x1C6, 0x1C6, 0x1C7, 0x1C7,
0x1C8, 0x1C8, 0x1C8, 0x1C9,
0x1C9, 0x1C9, 0x1CA, 0x1CA,
0x1CB, 0x1CB, 0x1CB, 0x1CC,
0x1CC, 0x1CC, 0x1CD, 0x1CD,
0x1CD, 0x1CE, 0x1CE, 0x1CF,
0x1CF, 0x1CF, 0x1D0, 0x1D0,
0x1D0, 0x1D1, 0x1D1, 0x1D1,
0x1D2, 0x1D2, 0x1D3, 0x1D3,
0x1D3, 0x1D4, 0x1D4, 0x1D4,
0x1D5, 0x1D5, 0x1D5, 0x1D6,
0x1D6, 0x1D7, 0x1D7, 0x1D7,
0x1D8, 0x1D8, 0x1D8, 0x1D9,
0x1D9, 0x1D9, 0x1DA, 0x1DA,
0x1DA, 0x1DB, 0x1DB, 0x1DC,
0x1DC, 0x1DC, 0x1DD, 0x1DD,
0x1DD, 0x1DE, 0x1DE, 0x1DE,
0x1DF, 0x1DF, 0x1DF, 0x1E0,
0x1E0, 0x1E0, 0x1E1, 0x1E1,
0x1E1, 0x1E2, 0x1E2, 0x1E3,
0x1E3, 0x1E3, 0x1E4, 0x1E4,
0x1E4, 0x1E5, 0x1E5, 0x1E5,
0x1E6, 0x1E6, 0x1E6, 0x1E7,
0x1E7, 0x1E7, 0x1E8, 0x1E8,
0x1E8, 0x1E9, 0x1E9, 0x1E9,
0x1EA, 0x1EA, 0x1EA, 0x1EB,
0x1EB, 0x1EB, 0x1EC, 0x1EC,
0x1EC, 0x1ED, 0x1ED, 0x1ED,
0x1EE, 0x1EE, 0x1EE, 0x1EF,
0x1EF, 0x1EF, 0x1F0, 0x1F0,
0x1F0, 0x1F1, 0x1F1, 0x1F1,
0x1F2, 0x1F2, 0x1F2, 0x1F3,
0x1F3, 0x1F3, 0x1F4, 0x1F4,
0x1F4, 0x1F5, 0x1F5, 0x1F5,
0x1F6, 0x1F6, 0x1F6, 0x1F7,
0x1F7, 0x1F7, 0x1F8, 0x1F8,
0x1F8, 0x1F9, 0x1F9, 0x1F9,
0x1FA, 0x1FA, 0x1FA, 0x1FB,
0x1FB, 0x1FB, 0x1FC, 0x1FC,
0x1FC, 0x1FD, 0x1FD, 0x1FD,
0x1FE, 0x1FE, 0x1FE, 0x1FF,
0x1FF, 0x1FF, 0x1FF, 0x200,
0x200
};

View File

@ -1,833 +0,0 @@
#ifdef _MSC_VER
#pragma warning(disable: 4309)
#pragma warning(disable: 4838)
#endif
// LUT for cos and sin
// 8192 entries, even entry = Sin, odd entry = Cos
// take TR angle (between 0 and 65535), shift R by 3 (to get between 0 and 8191), and with 8190 (to get between 0 and 8190)
// if you want Cos, add 1 to the index
// you then get value between -4096 and 4096, which you can divide by 4096f to get between -1 and 1
short rcossin_tbl[8192] =
{
0x0000, 0x1000, 0x0006, 0x1000, 0x000D, 0x1000, 0x0013, 0x1000, 0x0019, 0x1000,
0x001F, 0x1000, 0x0026, 0x1000, 0x002C, 0x1000, 0x0032, 0x1000, 0x0039, 0x1000,
0x003F, 0x1000, 0x0045, 0x0FFF, 0x004B, 0x0FFF, 0x0052, 0x0FFF, 0x0058, 0x0FFF,
0x005E, 0x0FFF, 0x0065, 0x0FFF, 0x006B, 0x0FFF, 0x0071, 0x0FFE, 0x0077, 0x0FFE,
0x007E, 0x0FFE, 0x0084, 0x0FFE, 0x008A, 0x0FFE, 0x0090, 0x0FFD, 0x0097, 0x0FFD,
0x009D, 0x0FFD, 0x00A3, 0x0FFD, 0x00AA, 0x0FFC, 0x00B0, 0x0FFC, 0x00B6, 0x0FFC,
0x00BC, 0x0FFC, 0x00C3, 0x0FFB, 0x00C9, 0x0FFB, 0x00CF, 0x0FFB, 0x00D6, 0x0FFA,
0x00DC, 0x0FFA, 0x00E2, 0x0FFA, 0x00E8, 0x0FF9, 0x00EF, 0x0FF9, 0x00F5, 0x0FF9,
0x00FB, 0x0FF8, 0x0101, 0x0FF8, 0x0108, 0x0FF8, 0x010E, 0x0FF7, 0x0114, 0x0FF7,
0x011B, 0x0FF6, 0x0121, 0x0FF6, 0x0127, 0x0FF5, 0x012D, 0x0FF5, 0x0134, 0x0FF4,
0x013A, 0x0FF4, 0x0140, 0x0FF3, 0x0146, 0x0FF3, 0x014D, 0x0FF2, 0x0153, 0x0FF2,
0x0159, 0x0FF1, 0x015F, 0x0FF1, 0x0166, 0x0FF0, 0x016C, 0x0FF0, 0x0172, 0x0FEF,
0x0178, 0x0FEF, 0x017F, 0x0FEE, 0x0185, 0x0FED, 0x018B, 0x0FED, 0x0191, 0x0FEC,
0x0198, 0x0FEC, 0x019E, 0x0FEB, 0x01A4, 0x0FEA, 0x01AA, 0x0FEA, 0x01B1, 0x0FE9,
0x01B7, 0x0FE8, 0x01BD, 0x0FE8, 0x01C3, 0x0FE7, 0x01CA, 0x0FE6, 0x01D0, 0x0FE6,
0x01D6, 0x0FE5, 0x01DC, 0x0FE4, 0x01E3, 0x0FE3, 0x01E9, 0x0FE3, 0x01EF, 0x0FE2,
0x01F5, 0x0FE1, 0x01FC, 0x0FE0, 0x0202, 0x0FE0, 0x0208, 0x0FDF, 0x020E, 0x0FDE,
0x0215, 0x0FDD, 0x021B, 0x0FDC, 0x0221, 0x0FDC, 0x0227, 0x0FDB, 0x022D, 0x0FDA,
0x0234, 0x0FD9, 0x023A, 0x0FD8, 0x0240, 0x0FD7, 0x0246, 0x0FD6, 0x024D, 0x0FD5,
0x0253, 0x0FD5, 0x0259, 0x0FD4, 0x025F, 0x0FD3, 0x0265, 0x0FD2, 0x026C, 0x0FD1,
0x0272, 0x0FD0, 0x0278, 0x0FCF, 0x027E, 0x0FCE, 0x0284, 0x0FCD, 0x028B, 0x0FCC,
0x0291, 0x0FCB, 0x0297, 0x0FCA, 0x029D, 0x0FC9, 0x02A3, 0x0FC8, 0x02AA, 0x0FC7,
0x02B0, 0x0FC6, 0x02B6, 0x0FC5, 0x02BC, 0x0FC4, 0x02C2, 0x0FC3, 0x02C9, 0x0FC2,
0x02CF, 0x0FC0, 0x02D5, 0x0FBF, 0x02DB, 0x0FBE, 0x02E1, 0x0FBD, 0x02E8, 0x0FBC,
0x02EE, 0x0FBB, 0x02F4, 0x0FBA, 0x02FA, 0x0FB8, 0x0300, 0x0FB7, 0x0306, 0x0FB6,
0x030D, 0x0FB5, 0x0313, 0x0FB4, 0x0319, 0x0FB3, 0x031F, 0x0FB1, 0x0325, 0x0FB0,
0x032B, 0x0FAF, 0x0332, 0x0FAE, 0x0338, 0x0FAC, 0x033E, 0x0FAB, 0x0344, 0x0FAA,
0x034A, 0x0FA8, 0x0350, 0x0FA7, 0x0356, 0x0FA6, 0x035D, 0x0FA5, 0x0363, 0x0FA3,
0x0369, 0x0FA2, 0x036F, 0x0FA1, 0x0375, 0x0F9F, 0x037B, 0x0F9E, 0x0381, 0x0F9C,
0x0388, 0x0F9B, 0x038E, 0x0F9A, 0x0394, 0x0F98, 0x039A, 0x0F97, 0x03A0, 0x0F95,
0x03A6, 0x0F94, 0x03AC, 0x0F93, 0x03B2, 0x0F91, 0x03B9, 0x0F90, 0x03BF, 0x0F8E,
0x03C5, 0x0F8D, 0x03CB, 0x0F8B, 0x03D1, 0x0F8A, 0x03D7, 0x0F88, 0x03DD, 0x0F87,
0x03E3, 0x0F85, 0x03E9, 0x0F84, 0x03EF, 0x0F82, 0x03F6, 0x0F81, 0x03FC, 0x0F7F,
0x0402, 0x0F7D, 0x0408, 0x0F7C, 0x040E, 0x0F7A, 0x0414, 0x0F79, 0x041A, 0x0F77,
0x0420, 0x0F76, 0x0426, 0x0F74, 0x042C, 0x0F72, 0x0432, 0x0F71, 0x0438, 0x0F6F,
0x043E, 0x0F6D, 0x0444, 0x0F6C, 0x044B, 0x0F6A, 0x0451, 0x0F68, 0x0457, 0x0F67,
0x045D, 0x0F65, 0x0463, 0x0F63, 0x0469, 0x0F61, 0x046F, 0x0F60, 0x0475, 0x0F5E,
0x047B, 0x0F5C, 0x0481, 0x0F5A, 0x0487, 0x0F59, 0x048D, 0x0F57, 0x0493, 0x0F55,
0x0499, 0x0F53, 0x049F, 0x0F51, 0x04A5, 0x0F50, 0x04AB, 0x0F4E, 0x04B1, 0x0F4C,
0x04B7, 0x0F4A, 0x04BD, 0x0F48, 0x04C3, 0x0F46, 0x04C9, 0x0F45, 0x04CF, 0x0F43,
0x04D5, 0x0F41, 0x04DB, 0x0F3F, 0x04E1, 0x0F3D, 0x04E7, 0x0F3B, 0x04ED, 0x0F39,
0x04F3, 0x0F37, 0x04F9, 0x0F35, 0x04FF, 0x0F33, 0x0505, 0x0F31, 0x050B, 0x0F2F,
0x0511, 0x0F2D, 0x0517, 0x0F2B, 0x051D, 0x0F29, 0x0523, 0x0F27, 0x0529, 0x0F25,
0x052F, 0x0F23, 0x0534, 0x0F21, 0x053A, 0x0F1F, 0x0540, 0x0F1D, 0x0546, 0x0F1B,
0x054C, 0x0F19, 0x0552, 0x0F17, 0x0558, 0x0F15, 0x055E, 0x0F13, 0x0564, 0x0F11,
0x056A, 0x0F0E, 0x0570, 0x0F0C, 0x0576, 0x0F0A, 0x057C, 0x0F08, 0x0581, 0x0F06,
0x0587, 0x0F04, 0x058D, 0x0F02, 0x0593, 0x0EFF, 0x0599, 0x0EFD, 0x059F, 0x0EFB,
0x05A5, 0x0EF9, 0x05AB, 0x0EF7, 0x05B1, 0x0EF4, 0x05B6, 0x0EF2, 0x05BC, 0x0EF0,
0x05C2, 0x0EEE, 0x05C8, 0x0EEB, 0x05CE, 0x0EE9, 0x05D4, 0x0EE7, 0x05DA, 0x0EE4,
0x05DF, 0x0EE2, 0x05E5, 0x0EE0, 0x05EB, 0x0EDD, 0x05F1, 0x0EDB, 0x05F7, 0x0ED9,
0x05FD, 0x0ED6, 0x0602, 0x0ED4, 0x0608, 0x0ED2, 0x060E, 0x0ECF, 0x0614, 0x0ECD,
0x061A, 0x0ECB, 0x061F, 0x0EC8, 0x0625, 0x0EC6, 0x062B, 0x0EC3, 0x0631, 0x0EC1,
0x0637, 0x0EBF, 0x063C, 0x0EBC, 0x0642, 0x0EBA, 0x0648, 0x0EB7, 0x064E, 0x0EB5,
0x0654, 0x0EB2, 0x0659, 0x0EB0, 0x065F, 0x0EAD, 0x0665, 0x0EAB, 0x066B, 0x0EA8,
0x0670, 0x0EA6, 0x0676, 0x0EA3, 0x067C, 0x0EA1, 0x0682, 0x0E9E, 0x0687, 0x0E9B,
0x068D, 0x0E99, 0x0693, 0x0E96, 0x0699, 0x0E94, 0x069E, 0x0E91, 0x06A4, 0x0E8F,
0x06AA, 0x0E8C, 0x06AF, 0x0E89, 0x06B5, 0x0E87, 0x06BB, 0x0E84, 0x06C1, 0x0E81,
0x06C6, 0x0E7F, 0x06CC, 0x0E7C, 0x06D2, 0x0E79, 0x06D7, 0x0E77, 0x06DD, 0x0E74,
0x06E3, 0x0E71, 0x06E8, 0x0E6F, 0x06EE, 0x0E6C, 0x06F4, 0x0E69, 0x06F9, 0x0E66,
0x06FF, 0x0E64, 0x0705, 0x0E61, 0x070A, 0x0E5E, 0x0710, 0x0E5B, 0x0715, 0x0E59,
0x071B, 0x0E56, 0x0721, 0x0E53, 0x0726, 0x0E50, 0x072C, 0x0E4D, 0x0732, 0x0E4B,
0x0737, 0x0E48, 0x073D, 0x0E45, 0x0742, 0x0E42, 0x0748, 0x0E3F, 0x074E, 0x0E3C,
0x0753, 0x0E3A, 0x0759, 0x0E37, 0x075E, 0x0E34, 0x0764, 0x0E31, 0x076A, 0x0E2E,
0x076F, 0x0E2B, 0x0775, 0x0E28, 0x077A, 0x0E25, 0x0780, 0x0E22, 0x0785, 0x0E1F,
0x078B, 0x0E1C, 0x0790, 0x0E19, 0x0796, 0x0E16, 0x079B, 0x0E13, 0x07A1, 0x0E10,
0x07A6, 0x0E0D, 0x07AC, 0x0E0A, 0x07B2, 0x0E07, 0x07B7, 0x0E04, 0x07BD, 0x0E01,
0x07C2, 0x0DFE, 0x07C8, 0x0DFB, 0x07CD, 0x0DF8, 0x07D2, 0x0DF5, 0x07D8, 0x0DF2,
0x07DD, 0x0DEF, 0x07E3, 0x0DEC, 0x07E8, 0x0DE9, 0x07EE, 0x0DE6, 0x07F3, 0x0DE3,
0x07F9, 0x0DDF, 0x07FE, 0x0DDC, 0x0804, 0x0DD9, 0x0809, 0x0DD6, 0x080E, 0x0DD3,
0x0814, 0x0DD0, 0x0819, 0x0DCC, 0x081F, 0x0DC9, 0x0824, 0x0DC6, 0x082A, 0x0DC3,
0x082F, 0x0DC0, 0x0834, 0x0DBC, 0x083A, 0x0DB9, 0x083F, 0x0DB6, 0x0845, 0x0DB3,
0x084A, 0x0DB0, 0x084F, 0x0DAC, 0x0855, 0x0DA9, 0x085A, 0x0DA6, 0x085F, 0x0DA2,
0x0865, 0x0D9F, 0x086A, 0x0D9C, 0x086F, 0x0D99, 0x0875, 0x0D95, 0x087A, 0x0D92,
0x087F, 0x0D8F, 0x0885, 0x0D8B, 0x088A, 0x0D88, 0x088F, 0x0D85, 0x0895, 0x0D81,
0x089A, 0x0D7E, 0x089F, 0x0D7A, 0x08A5, 0x0D77, 0x08AA, 0x0D74, 0x08AF, 0x0D70,
0x08B4, 0x0D6D, 0x08BA, 0x0D69, 0x08BF, 0x0D66, 0x08C4, 0x0D62, 0x08C9, 0x0D5F,
0x08CF, 0x0D5C, 0x08D4, 0x0D58, 0x08D9, 0x0D55, 0x08DE, 0x0D51, 0x08E4, 0x0D4E,
0x08E9, 0x0D4A, 0x08EE, 0x0D47, 0x08F3, 0x0D43, 0x08F8, 0x0D40, 0x08FE, 0x0D3C,
0x0903, 0x0D39, 0x0908, 0x0D35, 0x090D, 0x0D32, 0x0912, 0x0D2E, 0x0918, 0x0D2A,
0x091D, 0x0D27, 0x0922, 0x0D23, 0x0927, 0x0D20, 0x092C, 0x0D1C, 0x0931, 0x0D18,
0x0937, 0x0D15, 0x093C, 0x0D11, 0x0941, 0x0D0E, 0x0946, 0x0D0A, 0x094B, 0x0D06,
0x0950, 0x0D03, 0x0955, 0x0CFF, 0x095A, 0x0CFB, 0x095F, 0x0CF8, 0x0965, 0x0CF4,
0x096A, 0x0CF0, 0x096F, 0x0CED, 0x0974, 0x0CE9, 0x0979, 0x0CE5, 0x097E, 0x0CE1,
0x0983, 0x0CDE, 0x0988, 0x0CDA, 0x098D, 0x0CD6, 0x0992, 0x0CD2, 0x0997, 0x0CCF,
0x099C, 0x0CCB, 0x09A1, 0x0CC7, 0x09A6, 0x0CC3, 0x09AB, 0x0CC0, 0x09B0, 0x0CBC,
0x09B5, 0x0CB8, 0x09BA, 0x0CB4, 0x09BF, 0x0CB0, 0x09C4, 0x0CAC, 0x09C9, 0x0CA9,
0x09CE, 0x0CA5, 0x09D3, 0x0CA1, 0x09D8, 0x0C9D, 0x09DD, 0x0C99, 0x09E2, 0x0C95,
0x09E7, 0x0C91, 0x09EC, 0x0C8E, 0x09F1, 0x0C8A, 0x09F6, 0x0C86, 0x09FB, 0x0C82,
0x09FF, 0x0C7E, 0x0A04, 0x0C7A, 0x0A09, 0x0C76, 0x0A0E, 0x0C72, 0x0A13, 0x0C6E,
0x0A18, 0x0C6A, 0x0A1D, 0x0C66, 0x0A22, 0x0C62, 0x0A26, 0x0C5E, 0x0A2B, 0x0C5A,
0x0A30, 0x0C56, 0x0A35, 0x0C52, 0x0A3A, 0x0C4E, 0x0A3F, 0x0C4A, 0x0A44, 0x0C46,
0x0A48, 0x0C42, 0x0A4D, 0x0C3E, 0x0A52, 0x0C3A, 0x0A57, 0x0C36, 0x0A5C, 0x0C32,
0x0A60, 0x0C2E, 0x0A65, 0x0C2A, 0x0A6A, 0x0C26, 0x0A6F, 0x0C22, 0x0A73, 0x0C1E,
0x0A78, 0x0C19, 0x0A7D, 0x0C15, 0x0A82, 0x0C11, 0x0A86, 0x0C0D, 0x0A8B, 0x0C09,
0x0A90, 0x0C05, 0x0A95, 0x0C01, 0x0A99, 0x0BFC, 0x0A9E, 0x0BF8, 0x0AA3, 0x0BF4,
0x0AA7, 0x0BF0, 0x0AAC, 0x0BEC, 0x0AB1, 0x0BE8, 0x0AB5, 0x0BE3, 0x0ABA, 0x0BDF,
0x0ABF, 0x0BDB, 0x0AC3, 0x0BD7, 0x0AC8, 0x0BD2, 0x0ACD, 0x0BCE, 0x0AD1, 0x0BCA,
0x0AD6, 0x0BC6, 0x0ADB, 0x0BC1, 0x0ADF, 0x0BBD, 0x0AE4, 0x0BB9, 0x0AE8, 0x0BB5,
0x0AED, 0x0BB0, 0x0AF2, 0x0BAC, 0x0AF6, 0x0BA8, 0x0AFB, 0x0BA3, 0x0AFF, 0x0B9F,
0x0B04, 0x0B9B, 0x0B08, 0x0B97, 0x0B0D, 0x0B92, 0x0B11, 0x0B8E, 0x0B16, 0x0B89,
0x0B1B, 0x0B85, 0x0B1F, 0x0B81, 0x0B24, 0x0B7C, 0x0B28, 0x0B78, 0x0B2D, 0x0B74,
0x0B31, 0x0B6F, 0x0B36, 0x0B6B, 0x0B3A, 0x0B66, 0x0B3E, 0x0B62, 0x0B43, 0x0B5E,
0x0B47, 0x0B59, 0x0B4C, 0x0B55, 0x0B50, 0x0B50, 0x0B55, 0x0B4C, 0x0B59, 0x0B47,
0x0B5E, 0x0B43, 0x0B62, 0x0B3E, 0x0B66, 0x0B3A, 0x0B6B, 0x0B36, 0x0B6F, 0x0B31,
0x0B74, 0x0B2D, 0x0B78, 0x0B28, 0x0B7C, 0x0B24, 0x0B81, 0x0B1F, 0x0B85, 0x0B1B,
0x0B89, 0x0B16, 0x0B8E, 0x0B11, 0x0B92, 0x0B0D, 0x0B97, 0x0B08, 0x0B9B, 0x0B04,
0x0B9F, 0x0AFF, 0x0BA3, 0x0AFB, 0x0BA8, 0x0AF6, 0x0BAC, 0x0AF2, 0x0BB0, 0x0AED,
0x0BB5, 0x0AE8, 0x0BB9, 0x0AE4, 0x0BBD, 0x0ADF, 0x0BC1, 0x0ADB, 0x0BC6, 0x0AD6,
0x0BCA, 0x0AD1, 0x0BCE, 0x0ACD, 0x0BD2, 0x0AC8, 0x0BD7, 0x0AC3, 0x0BDB, 0x0ABF,
0x0BDF, 0x0ABA, 0x0BE3, 0x0AB5, 0x0BE8, 0x0AB1, 0x0BEC, 0x0AAC, 0x0BF0, 0x0AA7,
0x0BF4, 0x0AA3, 0x0BF8, 0x0A9E, 0x0BFC, 0x0A99, 0x0C01, 0x0A95, 0x0C05, 0x0A90,
0x0C09, 0x0A8B, 0x0C0D, 0x0A86, 0x0C11, 0x0A82, 0x0C15, 0x0A7D, 0x0C19, 0x0A78,
0x0C1E, 0x0A73, 0x0C22, 0x0A6F, 0x0C26, 0x0A6A, 0x0C2A, 0x0A65, 0x0C2E, 0x0A60,
0x0C32, 0x0A5C, 0x0C36, 0x0A57, 0x0C3A, 0x0A52, 0x0C3E, 0x0A4D, 0x0C42, 0x0A48,
0x0C46, 0x0A44, 0x0C4A, 0x0A3F, 0x0C4E, 0x0A3A, 0x0C52, 0x0A35, 0x0C56, 0x0A30,
0x0C5A, 0x0A2B, 0x0C5E, 0x0A26, 0x0C62, 0x0A22, 0x0C66, 0x0A1D, 0x0C6A, 0x0A18,
0x0C6E, 0x0A13, 0x0C72, 0x0A0E, 0x0C76, 0x0A09, 0x0C7A, 0x0A04, 0x0C7E, 0x09FF,
0x0C82, 0x09FB, 0x0C86, 0x09F6, 0x0C8A, 0x09F1, 0x0C8E, 0x09EC, 0x0C91, 0x09E7,
0x0C95, 0x09E2, 0x0C99, 0x09DD, 0x0C9D, 0x09D8, 0x0CA1, 0x09D3, 0x0CA5, 0x09CE,
0x0CA9, 0x09C9, 0x0CAC, 0x09C4, 0x0CB0, 0x09BF, 0x0CB4, 0x09BA, 0x0CB8, 0x09B5,
0x0CBC, 0x09B0, 0x0CC0, 0x09AB, 0x0CC3, 0x09A6, 0x0CC7, 0x09A1, 0x0CCB, 0x099C,
0x0CCF, 0x0997, 0x0CD2, 0x0992, 0x0CD6, 0x098D, 0x0CDA, 0x0988, 0x0CDE, 0x0983,
0x0CE1, 0x097E, 0x0CE5, 0x0979, 0x0CE9, 0x0974, 0x0CED, 0x096F, 0x0CF0, 0x096A,
0x0CF4, 0x0965, 0x0CF8, 0x095F, 0x0CFB, 0x095A, 0x0CFF, 0x0955, 0x0D03, 0x0950,
0x0D06, 0x094B, 0x0D0A, 0x0946, 0x0D0E, 0x0941, 0x0D11, 0x093C, 0x0D15, 0x0937,
0x0D18, 0x0931, 0x0D1C, 0x092C, 0x0D20, 0x0927, 0x0D23, 0x0922, 0x0D27, 0x091D,
0x0D2A, 0x0918, 0x0D2E, 0x0912, 0x0D32, 0x090D, 0x0D35, 0x0908, 0x0D39, 0x0903,
0x0D3C, 0x08FE, 0x0D40, 0x08F8, 0x0D43, 0x08F3, 0x0D47, 0x08EE, 0x0D4A, 0x08E9,
0x0D4E, 0x08E4, 0x0D51, 0x08DE, 0x0D55, 0x08D9, 0x0D58, 0x08D4, 0x0D5C, 0x08CF,
0x0D5F, 0x08C9, 0x0D62, 0x08C4, 0x0D66, 0x08BF, 0x0D69, 0x08BA, 0x0D6D, 0x08B4,
0x0D70, 0x08AF, 0x0D74, 0x08AA, 0x0D77, 0x08A5, 0x0D7A, 0x089F, 0x0D7E, 0x089A,
0x0D81, 0x0895, 0x0D85, 0x088F, 0x0D88, 0x088A, 0x0D8B, 0x0885, 0x0D8F, 0x087F,
0x0D92, 0x087A, 0x0D95, 0x0875, 0x0D99, 0x086F, 0x0D9C, 0x086A, 0x0D9F, 0x0865,
0x0DA2, 0x085F, 0x0DA6, 0x085A, 0x0DA9, 0x0855, 0x0DAC, 0x084F, 0x0DB0, 0x084A,
0x0DB3, 0x0845, 0x0DB6, 0x083F, 0x0DB9, 0x083A, 0x0DBC, 0x0834, 0x0DC0, 0x082F,
0x0DC3, 0x082A, 0x0DC6, 0x0824, 0x0DC9, 0x081F, 0x0DCC, 0x0819, 0x0DD0, 0x0814,
0x0DD3, 0x080E, 0x0DD6, 0x0809, 0x0DD9, 0x0804, 0x0DDC, 0x07FE, 0x0DDF, 0x07F9,
0x0DE3, 0x07F3, 0x0DE6, 0x07EE, 0x0DE9, 0x07E8, 0x0DEC, 0x07E3, 0x0DEF, 0x07DD,
0x0DF2, 0x07D8, 0x0DF5, 0x07D2, 0x0DF8, 0x07CD, 0x0DFB, 0x07C8, 0x0DFE, 0x07C2,
0x0E01, 0x07BD, 0x0E04, 0x07B7, 0x0E07, 0x07B2, 0x0E0A, 0x07AC, 0x0E0D, 0x07A6,
0x0E10, 0x07A1, 0x0E13, 0x079B, 0x0E16, 0x0796, 0x0E19, 0x0790, 0x0E1C, 0x078B,
0x0E1F, 0x0785, 0x0E22, 0x0780, 0x0E25, 0x077A, 0x0E28, 0x0775, 0x0E2B, 0x076F,
0x0E2E, 0x076A, 0x0E31, 0x0764, 0x0E34, 0x075E, 0x0E37, 0x0759, 0x0E3A, 0x0753,
0x0E3C, 0x074E, 0x0E3F, 0x0748, 0x0E42, 0x0742, 0x0E45, 0x073D, 0x0E48, 0x0737,
0x0E4B, 0x0732, 0x0E4D, 0x072C, 0x0E50, 0x0726, 0x0E53, 0x0721, 0x0E56, 0x071B,
0x0E59, 0x0715, 0x0E5B, 0x0710, 0x0E5E, 0x070A, 0x0E61, 0x0705, 0x0E64, 0x06FF,
0x0E66, 0x06F9, 0x0E69, 0x06F4, 0x0E6C, 0x06EE, 0x0E6F, 0x06E8, 0x0E71, 0x06E3,
0x0E74, 0x06DD, 0x0E77, 0x06D7, 0x0E79, 0x06D2, 0x0E7C, 0x06CC, 0x0E7F, 0x06C6,
0x0E81, 0x06C1, 0x0E84, 0x06BB, 0x0E87, 0x06B5, 0x0E89, 0x06AF, 0x0E8C, 0x06AA,
0x0E8F, 0x06A4, 0x0E91, 0x069E, 0x0E94, 0x0699, 0x0E96, 0x0693, 0x0E99, 0x068D,
0x0E9B, 0x0687, 0x0E9E, 0x0682, 0x0EA1, 0x067C, 0x0EA3, 0x0676, 0x0EA6, 0x0670,
0x0EA8, 0x066B, 0x0EAB, 0x0665, 0x0EAD, 0x065F, 0x0EB0, 0x0659, 0x0EB2, 0x0654,
0x0EB5, 0x064E, 0x0EB7, 0x0648, 0x0EBA, 0x0642, 0x0EBC, 0x063C, 0x0EBF, 0x0637,
0x0EC1, 0x0631, 0x0EC3, 0x062B, 0x0EC6, 0x0625, 0x0EC8, 0x061F, 0x0ECB, 0x061A,
0x0ECD, 0x0614, 0x0ECF, 0x060E, 0x0ED2, 0x0608, 0x0ED4, 0x0602, 0x0ED6, 0x05FD,
0x0ED9, 0x05F7, 0x0EDB, 0x05F1, 0x0EDD, 0x05EB, 0x0EE0, 0x05E5, 0x0EE2, 0x05DF,
0x0EE4, 0x05DA, 0x0EE7, 0x05D4, 0x0EE9, 0x05CE, 0x0EEB, 0x05C8, 0x0EEE, 0x05C2,
0x0EF0, 0x05BC, 0x0EF2, 0x05B6, 0x0EF4, 0x05B1, 0x0EF7, 0x05AB, 0x0EF9, 0x05A5,
0x0EFB, 0x059F, 0x0EFD, 0x0599, 0x0EFF, 0x0593, 0x0F02, 0x058D, 0x0F04, 0x0587,
0x0F06, 0x0581, 0x0F08, 0x057C, 0x0F0A, 0x0576, 0x0F0C, 0x0570, 0x0F0E, 0x056A,
0x0F11, 0x0564, 0x0F13, 0x055E, 0x0F15, 0x0558, 0x0F17, 0x0552, 0x0F19, 0x054C,
0x0F1B, 0x0546, 0x0F1D, 0x0540, 0x0F1F, 0x053A, 0x0F21, 0x0534, 0x0F23, 0x052F,
0x0F25, 0x0529, 0x0F27, 0x0523, 0x0F29, 0x051D, 0x0F2B, 0x0517, 0x0F2D, 0x0511,
0x0F2F, 0x050B, 0x0F31, 0x0505, 0x0F33, 0x04FF, 0x0F35, 0x04F9, 0x0F37, 0x04F3,
0x0F39, 0x04ED, 0x0F3B, 0x04E7, 0x0F3D, 0x04E1, 0x0F3F, 0x04DB, 0x0F41, 0x04D5,
0x0F43, 0x04CF, 0x0F45, 0x04C9, 0x0F46, 0x04C3, 0x0F48, 0x04BD, 0x0F4A, 0x04B7,
0x0F4C, 0x04B1, 0x0F4E, 0x04AB, 0x0F50, 0x04A5, 0x0F51, 0x049F, 0x0F53, 0x0499,
0x0F55, 0x0493, 0x0F57, 0x048D, 0x0F59, 0x0487, 0x0F5A, 0x0481, 0x0F5C, 0x047B,
0x0F5E, 0x0475, 0x0F60, 0x046F, 0x0F61, 0x0469, 0x0F63, 0x0463, 0x0F65, 0x045D,
0x0F67, 0x0457, 0x0F68, 0x0451, 0x0F6A, 0x044B, 0x0F6C, 0x0444, 0x0F6D, 0x043E,
0x0F6F, 0x0438, 0x0F71, 0x0432, 0x0F72, 0x042C, 0x0F74, 0x0426, 0x0F76, 0x0420,
0x0F77, 0x041A, 0x0F79, 0x0414, 0x0F7A, 0x040E, 0x0F7C, 0x0408, 0x0F7D, 0x0402,
0x0F7F, 0x03FC, 0x0F81, 0x03F6, 0x0F82, 0x03EF, 0x0F84, 0x03E9, 0x0F85, 0x03E3,
0x0F87, 0x03DD, 0x0F88, 0x03D7, 0x0F8A, 0x03D1, 0x0F8B, 0x03CB, 0x0F8D, 0x03C5,
0x0F8E, 0x03BF, 0x0F90, 0x03B9, 0x0F91, 0x03B2, 0x0F93, 0x03AC, 0x0F94, 0x03A6,
0x0F95, 0x03A0, 0x0F97, 0x039A, 0x0F98, 0x0394, 0x0F9A, 0x038E, 0x0F9B, 0x0388,
0x0F9C, 0x0381, 0x0F9E, 0x037B, 0x0F9F, 0x0375, 0x0FA1, 0x036F, 0x0FA2, 0x0369,
0x0FA3, 0x0363, 0x0FA5, 0x035D, 0x0FA6, 0x0356, 0x0FA7, 0x0350, 0x0FA8, 0x034A,
0x0FAA, 0x0344, 0x0FAB, 0x033E, 0x0FAC, 0x0338, 0x0FAE, 0x0332, 0x0FAF, 0x032B,
0x0FB0, 0x0325, 0x0FB1, 0x031F, 0x0FB3, 0x0319, 0x0FB4, 0x0313, 0x0FB5, 0x030D,
0x0FB6, 0x0306, 0x0FB7, 0x0300, 0x0FB8, 0x02FA, 0x0FBA, 0x02F4, 0x0FBB, 0x02EE,
0x0FBC, 0x02E8, 0x0FBD, 0x02E1, 0x0FBE, 0x02DB, 0x0FBF, 0x02D5, 0x0FC0, 0x02CF,
0x0FC2, 0x02C9, 0x0FC3, 0x02C2, 0x0FC4, 0x02BC, 0x0FC5, 0x02B6, 0x0FC6, 0x02B0,
0x0FC7, 0x02AA, 0x0FC8, 0x02A3, 0x0FC9, 0x029D, 0x0FCA, 0x0297, 0x0FCB, 0x0291,
0x0FCC, 0x028B, 0x0FCD, 0x0284, 0x0FCE, 0x027E, 0x0FCF, 0x0278, 0x0FD0, 0x0272,
0x0FD1, 0x026C, 0x0FD2, 0x0265, 0x0FD3, 0x025F, 0x0FD4, 0x0259, 0x0FD5, 0x0253,
0x0FD5, 0x024D, 0x0FD6, 0x0246, 0x0FD7, 0x0240, 0x0FD8, 0x023A, 0x0FD9, 0x0234,
0x0FDA, 0x022D, 0x0FDB, 0x0227, 0x0FDC, 0x0221, 0x0FDC, 0x021B, 0x0FDD, 0x0215,
0x0FDE, 0x020E, 0x0FDF, 0x0208, 0x0FE0, 0x0202, 0x0FE0, 0x01FC, 0x0FE1, 0x01F5,
0x0FE2, 0x01EF, 0x0FE3, 0x01E9, 0x0FE3, 0x01E3, 0x0FE4, 0x01DC, 0x0FE5, 0x01D6,
0x0FE6, 0x01D0, 0x0FE6, 0x01CA, 0x0FE7, 0x01C3, 0x0FE8, 0x01BD, 0x0FE8, 0x01B7,
0x0FE9, 0x01B1, 0x0FEA, 0x01AA, 0x0FEA, 0x01A4, 0x0FEB, 0x019E, 0x0FEC, 0x0198,
0x0FEC, 0x0191, 0x0FED, 0x018B, 0x0FED, 0x0185, 0x0FEE, 0x017F, 0x0FEF, 0x0178,
0x0FEF, 0x0172, 0x0FF0, 0x016C, 0x0FF0, 0x0166, 0x0FF1, 0x015F, 0x0FF1, 0x0159,
0x0FF2, 0x0153, 0x0FF2, 0x014D, 0x0FF3, 0x0146, 0x0FF3, 0x0140, 0x0FF4, 0x013A,
0x0FF4, 0x0134, 0x0FF5, 0x012D, 0x0FF5, 0x0127, 0x0FF6, 0x0121, 0x0FF6, 0x011B,
0x0FF7, 0x0114, 0x0FF7, 0x010E, 0x0FF8, 0x0108, 0x0FF8, 0x0101, 0x0FF8, 0x00FB,
0x0FF9, 0x00F5, 0x0FF9, 0x00EF, 0x0FF9, 0x00E8, 0x0FFA, 0x00E2, 0x0FFA, 0x00DC,
0x0FFA, 0x00D6, 0x0FFB, 0x00CF, 0x0FFB, 0x00C9, 0x0FFB, 0x00C3, 0x0FFC, 0x00BC,
0x0FFC, 0x00B6, 0x0FFC, 0x00B0, 0x0FFC, 0x00AA, 0x0FFD, 0x00A3, 0x0FFD, 0x009D,
0x0FFD, 0x0097, 0x0FFD, 0x0090, 0x0FFE, 0x008A, 0x0FFE, 0x0084, 0x0FFE, 0x007E,
0x0FFE, 0x0077, 0x0FFE, 0x0071, 0x0FFF, 0x006B, 0x0FFF, 0x0065, 0x0FFF, 0x005E,
0x0FFF, 0x0058, 0x0FFF, 0x0052, 0x0FFF, 0x004B, 0x0FFF, 0x0045, 0x1000, 0x003F,
0x1000, 0x0039, 0x1000, 0x0032, 0x1000, 0x002C, 0x1000, 0x0026, 0x1000, 0x001F,
0x1000, 0x0019, 0x1000, 0x0013, 0x1000, 0x000D, 0x1000, 0x0006, 0x1000, 0x0000,
0x1000, 0xFFFA, 0x1000, 0xFFF3, 0x1000, 0xFFED, 0x1000, 0xFFE7, 0x1000, 0xFFE1,
0x1000, 0xFFDA, 0x1000, 0xFFD4, 0x1000, 0xFFCE, 0x1000, 0xFFC7, 0x1000, 0xFFC1,
0x0FFF, 0xFFBB, 0x0FFF, 0xFFB5, 0x0FFF, 0xFFAE, 0x0FFF, 0xFFA8, 0x0FFF, 0xFFA2,
0x0FFF, 0xFF9B, 0x0FFF, 0xFF95, 0x0FFE, 0xFF8F, 0x0FFE, 0xFF89, 0x0FFE, 0xFF82,
0x0FFE, 0xFF7C, 0x0FFE, 0xFF76, 0x0FFD, 0xFF70, 0x0FFD, 0xFF69, 0x0FFD, 0xFF63,
0x0FFD, 0xFF5D, 0x0FFC, 0xFF56, 0x0FFC, 0xFF50, 0x0FFC, 0xFF4A, 0x0FFC, 0xFF44,
0x0FFB, 0xFF3D, 0x0FFB, 0xFF37, 0x0FFB, 0xFF31, 0x0FFA, 0xFF2A, 0x0FFA, 0xFF24,
0x0FFA, 0xFF1E, 0x0FF9, 0xFF18, 0x0FF9, 0xFF11, 0x0FF9, 0xFF0B, 0x0FF8, 0xFF05,
0x0FF8, 0xFEFF, 0x0FF8, 0xFEF8, 0x0FF7, 0xFEF2, 0x0FF7, 0xFEEC, 0x0FF6, 0xFEE5,
0x0FF6, 0xFEDF, 0x0FF5, 0xFED9, 0x0FF5, 0xFED3, 0x0FF4, 0xFECC, 0x0FF4, 0xFEC6,
0x0FF3, 0xFEC0, 0x0FF3, 0xFEBA, 0x0FF2, 0xFEB3, 0x0FF2, 0xFEAD, 0x0FF1, 0xFEA7,
0x0FF1, 0xFEA1, 0x0FF0, 0xFE9A, 0x0FF0, 0xFE94, 0x0FEF, 0xFE8E, 0x0FEF, 0xFE88,
0x0FEE, 0xFE81, 0x0FED, 0xFE7B, 0x0FED, 0xFE75, 0x0FEC, 0xFE6F, 0x0FEC, 0xFE68,
0x0FEB, 0xFE62, 0x0FEA, 0xFE5C, 0x0FEA, 0xFE56, 0x0FE9, 0xFE4F, 0x0FE8, 0xFE49,
0x0FE8, 0xFE43, 0x0FE7, 0xFE3D, 0x0FE6, 0xFE36, 0x0FE6, 0xFE30, 0x0FE5, 0xFE2A,
0x0FE4, 0xFE24, 0x0FE3, 0xFE1D, 0x0FE3, 0xFE17, 0x0FE2, 0xFE11, 0x0FE1, 0xFE0B,
0x0FE0, 0xFE04, 0x0FE0, 0xFDFE, 0x0FDF, 0xFDF8, 0x0FDE, 0xFDF2, 0x0FDD, 0xFDEB,
0x0FDC, 0xFDE5, 0x0FDC, 0xFDDF, 0x0FDB, 0xFDD9, 0x0FDA, 0xFDD3, 0x0FD9, 0xFDCC,
0x0FD8, 0xFDC6, 0x0FD7, 0xFDC0, 0x0FD6, 0xFDBA, 0x0FD5, 0xFDB3, 0x0FD5, 0xFDAD,
0x0FD4, 0xFDA7, 0x0FD3, 0xFDA1, 0x0FD2, 0xFD9B, 0x0FD1, 0xFD94, 0x0FD0, 0xFD8E,
0x0FCF, 0xFD88, 0x0FCE, 0xFD82, 0x0FCD, 0xFD7C, 0x0FCC, 0xFD75, 0x0FCB, 0xFD6F,
0x0FCA, 0xFD69, 0x0FC9, 0xFD63, 0x0FC8, 0xFD5D, 0x0FC7, 0xFD56, 0x0FC6, 0xFD50,
0x0FC5, 0xFD4A, 0x0FC4, 0xFD44, 0x0FC3, 0xFD3E, 0x0FC2, 0xFD37, 0x0FC0, 0xFD31,
0x0FBF, 0xFD2B, 0x0FBE, 0xFD25, 0x0FBD, 0xFD1F, 0x0FBC, 0xFD18, 0x0FBB, 0xFD12,
0x0FBA, 0xFD0C, 0x0FB8, 0xFD06, 0x0FB7, 0xFD00, 0x0FB6, 0xFCFA, 0x0FB5, 0xFCF3,
0x0FB4, 0xFCED, 0x0FB3, 0xFCE7, 0x0FB1, 0xFCE1, 0x0FB0, 0xFCDB, 0x0FAF, 0xFCD5,
0x0FAE, 0xFCCE, 0x0FAC, 0xFCC8, 0x0FAB, 0xFCC2, 0x0FAA, 0xFCBC, 0x0FA8, 0xFCB6,
0x0FA7, 0xFCB0, 0x0FA6, 0xFCAA, 0x0FA5, 0xFCA3, 0x0FA3, 0xFC9D, 0x0FA2, 0xFC97,
0x0FA1, 0xFC91, 0x0F9F, 0xFC8B, 0x0F9E, 0xFC85, 0x0F9C, 0xFC7F, 0x0F9B, 0xFC78,
0x0F9A, 0xFC72, 0x0F98, 0xFC6C, 0x0F97, 0xFC66, 0x0F95, 0xFC60, 0x0F94, 0xFC5A,
0x0F93, 0xFC54, 0x0F91, 0xFC4E, 0x0F90, 0xFC47, 0x0F8E, 0xFC41, 0x0F8D, 0xFC3B,
0x0F8B, 0xFC35, 0x0F8A, 0xFC2F, 0x0F88, 0xFC29, 0x0F87, 0xFC23, 0x0F85, 0xFC1D,
0x0F84, 0xFC17, 0x0F82, 0xFC11, 0x0F81, 0xFC0A, 0x0F7F, 0xFC04, 0x0F7D, 0xFBFE,
0x0F7C, 0xFBF8, 0x0F7A, 0xFBF2, 0x0F79, 0xFBEC, 0x0F77, 0xFBE6, 0x0F76, 0xFBE0,
0x0F74, 0xFBDA, 0x0F72, 0xFBD4, 0x0F71, 0xFBCE, 0x0F6F, 0xFBC8, 0x0F6D, 0xFBC2,
0x0F6C, 0xFBBC, 0x0F6A, 0xFBB5, 0x0F68, 0xFBAF, 0x0F67, 0xFBA9, 0x0F65, 0xFBA3,
0x0F63, 0xFB9D, 0x0F61, 0xFB97, 0x0F60, 0xFB91, 0x0F5E, 0xFB8B, 0x0F5C, 0xFB85,
0x0F5A, 0xFB7F, 0x0F59, 0xFB79, 0x0F57, 0xFB73, 0x0F55, 0xFB6D, 0x0F53, 0xFB67,
0x0F51, 0xFB61, 0x0F50, 0xFB5B, 0x0F4E, 0xFB55, 0x0F4C, 0xFB4F, 0x0F4A, 0xFB49,
0x0F48, 0xFB43, 0x0F46, 0xFB3D, 0x0F45, 0xFB37, 0x0F43, 0xFB31, 0x0F41, 0xFB2B,
0x0F3F, 0xFB25, 0x0F3D, 0xFB1F, 0x0F3B, 0xFB19, 0x0F39, 0xFB13, 0x0F37, 0xFB0D,
0x0F35, 0xFB07, 0x0F33, 0xFB01, 0x0F31, 0xFAFB, 0x0F2F, 0xFAF5, 0x0F2D, 0xFAEF,
0x0F2B, 0xFAE9, 0x0F29, 0xFAE3, 0x0F27, 0xFADD, 0x0F25, 0xFAD7, 0x0F23, 0xFAD1,
0x0F21, 0xFACC, 0x0F1F, 0xFAC6, 0x0F1D, 0xFAC0, 0x0F1B, 0xFABA, 0x0F19, 0xFAB4,
0x0F17, 0xFAAE, 0x0F15, 0xFAA8, 0x0F13, 0xFAA2, 0x0F11, 0xFA9C, 0x0F0E, 0xFA96,
0x0F0C, 0xFA90, 0x0F0A, 0xFA8A, 0x0F08, 0xFA84, 0x0F06, 0xFA7F, 0x0F04, 0xFA79,
0x0F02, 0xFA73, 0x0EFF, 0xFA6D, 0x0EFD, 0xFA67, 0x0EFB, 0xFA61, 0x0EF9, 0xFA5B,
0x0EF7, 0xFA55, 0x0EF4, 0xFA4F, 0x0EF2, 0xFA4A, 0x0EF0, 0xFA44, 0x0EEE, 0xFA3E,
0x0EEB, 0xFA38, 0x0EE9, 0xFA32, 0x0EE7, 0xFA2C, 0x0EE4, 0xFA26, 0x0EE2, 0xFA21,
0x0EE0, 0xFA1B, 0x0EDD, 0xFA15, 0x0EDB, 0xFA0F, 0x0ED9, 0xFA09, 0x0ED6, 0xFA03,
0x0ED4, 0xF9FE, 0x0ED2, 0xF9F8, 0x0ECF, 0xF9F2, 0x0ECD, 0xF9EC, 0x0ECB, 0xF9E6,
0x0EC8, 0xF9E1, 0x0EC6, 0xF9DB, 0x0EC3, 0xF9D5, 0x0EC1, 0xF9CF, 0x0EBF, 0xF9C9,
0x0EBC, 0xF9C4, 0x0EBA, 0xF9BE, 0x0EB7, 0xF9B8, 0x0EB5, 0xF9B2, 0x0EB2, 0xF9AC,
0x0EB0, 0xF9A7, 0x0EAD, 0xF9A1, 0x0EAB, 0xF99B, 0x0EA8, 0xF995, 0x0EA6, 0xF990,
0x0EA3, 0xF98A, 0x0EA1, 0xF984, 0x0E9E, 0xF97E, 0x0E9B, 0xF979, 0x0E99, 0xF973,
0x0E96, 0xF96D, 0x0E94, 0xF967, 0x0E91, 0xF962, 0x0E8F, 0xF95C, 0x0E8C, 0xF956,
0x0E89, 0xF951, 0x0E87, 0xF94B, 0x0E84, 0xF945, 0x0E81, 0xF93F, 0x0E7F, 0xF93A,
0x0E7C, 0xF934, 0x0E79, 0xF92E, 0x0E77, 0xF929, 0x0E74, 0xF923, 0x0E71, 0xF91D,
0x0E6F, 0xF918, 0x0E6C, 0xF912, 0x0E69, 0xF90C, 0x0E66, 0xF907, 0x0E64, 0xF901,
0x0E61, 0xF8FB, 0x0E5E, 0xF8F6, 0x0E5B, 0xF8F0, 0x0E59, 0xF8EB, 0x0E56, 0xF8E5,
0x0E53, 0xF8DF, 0x0E50, 0xF8DA, 0x0E4D, 0xF8D4, 0x0E4B, 0xF8CE, 0x0E48, 0xF8C9,
0x0E45, 0xF8C3, 0x0E42, 0xF8BE, 0x0E3F, 0xF8B8, 0x0E3C, 0xF8B2, 0x0E3A, 0xF8AD,
0x0E37, 0xF8A7, 0x0E34, 0xF8A2, 0x0E31, 0xF89C, 0x0E2E, 0xF896, 0x0E2B, 0xF891,
0x0E28, 0xF88B, 0x0E25, 0xF886, 0x0E22, 0xF880, 0x0E1F, 0xF87B, 0x0E1C, 0xF875,
0x0E19, 0xF870, 0x0E16, 0xF86A, 0x0E13, 0xF865, 0x0E10, 0xF85F, 0x0E0D, 0xF85A,
0x0E0A, 0xF854, 0x0E07, 0xF84E, 0x0E04, 0xF849, 0x0E01, 0xF843, 0x0DFE, 0xF83E,
0x0DFB, 0xF838, 0x0DF8, 0xF833, 0x0DF5, 0xF82E, 0x0DF2, 0xF828, 0x0DEF, 0xF823,
0x0DEC, 0xF81D, 0x0DE9, 0xF818, 0x0DE6, 0xF812, 0x0DE3, 0xF80D, 0x0DDF, 0xF807,
0x0DDC, 0xF802, 0x0DD9, 0xF7FC, 0x0DD6, 0xF7F7, 0x0DD3, 0xF7F2, 0x0DD0, 0xF7EC,
0x0DCC, 0xF7E7, 0x0DC9, 0xF7E1, 0x0DC6, 0xF7DC, 0x0DC3, 0xF7D6, 0x0DC0, 0xF7D1,
0x0DBC, 0xF7CC, 0x0DB9, 0xF7C6, 0x0DB6, 0xF7C1, 0x0DB3, 0xF7BB, 0x0DB0, 0xF7B6,
0x0DAC, 0xF7B1, 0x0DA9, 0xF7AB, 0x0DA6, 0xF7A6, 0x0DA2, 0xF7A1, 0x0D9F, 0xF79B,
0x0D9C, 0xF796, 0x0D99, 0xF791, 0x0D95, 0xF78B, 0x0D92, 0xF786, 0x0D8F, 0xF781,
0x0D8B, 0xF77B, 0x0D88, 0xF776, 0x0D85, 0xF771, 0x0D81, 0xF76B, 0x0D7E, 0xF766,
0x0D7A, 0xF761, 0x0D77, 0xF75B, 0x0D74, 0xF756, 0x0D70, 0xF751, 0x0D6D, 0xF74C,
0x0D69, 0xF746, 0x0D66, 0xF741, 0x0D62, 0xF73C, 0x0D5F, 0xF737, 0x0D5C, 0xF731,
0x0D58, 0xF72C, 0x0D55, 0xF727, 0x0D51, 0xF722, 0x0D4E, 0xF71C, 0x0D4A, 0xF717,
0x0D47, 0xF712, 0x0D43, 0xF70D, 0x0D40, 0xF708, 0x0D3C, 0xF702, 0x0D39, 0xF6FD,
0x0D35, 0xF6F8, 0x0D32, 0xF6F3, 0x0D2E, 0xF6EE, 0x0D2A, 0xF6E8, 0x0D27, 0xF6E3,
0x0D23, 0xF6DE, 0x0D20, 0xF6D9, 0x0D1C, 0xF6D4, 0x0D18, 0xF6CF, 0x0D15, 0xF6C9,
0x0D11, 0xF6C4, 0x0D0E, 0xF6BF, 0x0D0A, 0xF6BA, 0x0D06, 0xF6B5, 0x0D03, 0xF6B0,
0x0CFF, 0xF6AB, 0x0CFB, 0xF6A6, 0x0CF8, 0xF6A1, 0x0CF4, 0xF69B, 0x0CF0, 0xF696,
0x0CED, 0xF691, 0x0CE9, 0xF68C, 0x0CE5, 0xF687, 0x0CE1, 0xF682, 0x0CDE, 0xF67D,
0x0CDA, 0xF678, 0x0CD6, 0xF673, 0x0CD2, 0xF66E, 0x0CCF, 0xF669, 0x0CCB, 0xF664,
0x0CC7, 0xF65F, 0x0CC3, 0xF65A, 0x0CC0, 0xF655, 0x0CBC, 0xF650, 0x0CB8, 0xF64B,
0x0CB4, 0xF646, 0x0CB0, 0xF641, 0x0CAC, 0xF63C, 0x0CA9, 0xF637, 0x0CA5, 0xF632,
0x0CA1, 0xF62D, 0x0C9D, 0xF628, 0x0C99, 0xF623, 0x0C95, 0xF61E, 0x0C91, 0xF619,
0x0C8E, 0xF614, 0x0C8A, 0xF60F, 0x0C86, 0xF60A, 0x0C82, 0xF605, 0x0C7E, 0xF601,
0x0C7A, 0xF5FC, 0x0C76, 0xF5F7, 0x0C72, 0xF5F2, 0x0C6E, 0xF5ED, 0x0C6A, 0xF5E8,
0x0C66, 0xF5E3, 0x0C62, 0xF5DE, 0x0C5E, 0xF5DA, 0x0C5A, 0xF5D5, 0x0C56, 0xF5D0,
0x0C52, 0xF5CB, 0x0C4E, 0xF5C6, 0x0C4A, 0xF5C1, 0x0C46, 0xF5BC, 0x0C42, 0xF5B8,
0x0C3E, 0xF5B3, 0x0C3A, 0xF5AE, 0x0C36, 0xF5A9, 0x0C32, 0xF5A4, 0x0C2E, 0xF5A0,
0x0C2A, 0xF59B, 0x0C26, 0xF596, 0x0C22, 0xF591, 0x0C1E, 0xF58D, 0x0C19, 0xF588,
0x0C15, 0xF583, 0x0C11, 0xF57E, 0x0C0D, 0xF57A, 0x0C09, 0xF575, 0x0C05, 0xF570,
0x0C01, 0xF56B, 0x0BFC, 0xF567, 0x0BF8, 0xF562, 0x0BF4, 0xF55D, 0x0BF0, 0xF559,
0x0BEC, 0xF554, 0x0BE8, 0xF54F, 0x0BE3, 0xF54B, 0x0BDF, 0xF546, 0x0BDB, 0xF541,
0x0BD7, 0xF53D, 0x0BD2, 0xF538, 0x0BCE, 0xF533, 0x0BCA, 0xF52F, 0x0BC6, 0xF52A,
0x0BC1, 0xF525, 0x0BBD, 0xF521, 0x0BB9, 0xF51C, 0x0BB5, 0xF518, 0x0BB0, 0xF513,
0x0BAC, 0xF50E, 0x0BA8, 0xF50A, 0x0BA3, 0xF505, 0x0B9F, 0xF501, 0x0B9B, 0xF4FC,
0x0B97, 0xF4F8, 0x0B92, 0xF4F3, 0x0B8E, 0xF4EF, 0x0B89, 0xF4EA, 0x0B85, 0xF4E5,
0x0B81, 0xF4E1, 0x0B7C, 0xF4DC, 0x0B78, 0xF4D8, 0x0B74, 0xF4D3, 0x0B6F, 0xF4CF,
0x0B6B, 0xF4CA, 0x0B66, 0xF4C6, 0x0B62, 0xF4C2, 0x0B5E, 0xF4BD, 0x0B59, 0xF4B9,
0x0B55, 0xF4B4, 0x0B50, 0xF4B0, 0x0B4C, 0xF4AB, 0x0B47, 0xF4A7, 0x0B43, 0xF4A2,
0x0B3E, 0xF49E, 0x0B3A, 0xF49A, 0x0B36, 0xF495, 0x0B31, 0xF491, 0x0B2D, 0xF48C,
0x0B28, 0xF488, 0x0B24, 0xF484, 0x0B1F, 0xF47F, 0x0B1B, 0xF47B, 0x0B16, 0xF477,
0x0B11, 0xF472, 0x0B0D, 0xF46E, 0x0B08, 0xF469, 0x0B04, 0xF465, 0x0AFF, 0xF461,
0x0AFB, 0xF45D, 0x0AF6, 0xF458, 0x0AF2, 0xF454, 0x0AED, 0xF450, 0x0AE8, 0xF44B,
0x0AE4, 0xF447, 0x0ADF, 0xF443, 0x0ADB, 0xF43F, 0x0AD6, 0xF43A, 0x0AD1, 0xF436,
0x0ACD, 0xF432, 0x0AC8, 0xF42E, 0x0AC3, 0xF429, 0x0ABF, 0xF425, 0x0ABA, 0xF421,
0x0AB5, 0xF41D, 0x0AB1, 0xF418, 0x0AAC, 0xF414, 0x0AA7, 0xF410, 0x0AA3, 0xF40C,
0x0A9E, 0xF408, 0x0A99, 0xF404, 0x0A95, 0xF3FF, 0x0A90, 0xF3FB, 0x0A8B, 0xF3F7,
0x0A86, 0xF3F3, 0x0A82, 0xF3EF, 0x0A7D, 0xF3EB, 0x0A78, 0xF3E7, 0x0A73, 0xF3E2,
0x0A6F, 0xF3DE, 0x0A6A, 0xF3DA, 0x0A65, 0xF3D6, 0x0A60, 0xF3D2, 0x0A5C, 0xF3CE,
0x0A57, 0xF3CA, 0x0A52, 0xF3C6, 0x0A4D, 0xF3C2, 0x0A48, 0xF3BE, 0x0A44, 0xF3BA,
0x0A3F, 0xF3B6, 0x0A3A, 0xF3B2, 0x0A35, 0xF3AE, 0x0A30, 0xF3AA, 0x0A2B, 0xF3A6,
0x0A26, 0xF3A2, 0x0A22, 0xF39E, 0x0A1D, 0xF39A, 0x0A18, 0xF396, 0x0A13, 0xF392,
0x0A0E, 0xF38E, 0x0A09, 0xF38A, 0x0A04, 0xF386, 0x09FF, 0xF382, 0x09FB, 0xF37E,
0x09F6, 0xF37A, 0x09F1, 0xF376, 0x09EC, 0xF372, 0x09E7, 0xF36F, 0x09E2, 0xF36B,
0x09DD, 0xF367, 0x09D8, 0xF363, 0x09D3, 0xF35F, 0x09CE, 0xF35B, 0x09C9, 0xF357,
0x09C4, 0xF354, 0x09BF, 0xF350, 0x09BA, 0xF34C, 0x09B5, 0xF348, 0x09B0, 0xF344,
0x09AB, 0xF340, 0x09A6, 0xF33D, 0x09A1, 0xF339, 0x099C, 0xF335, 0x0997, 0xF331,
0x0992, 0xF32E, 0x098D, 0xF32A, 0x0988, 0xF326, 0x0983, 0xF322, 0x097E, 0xF31F,
0x0979, 0xF31B, 0x0974, 0xF317, 0x096F, 0xF313, 0x096A, 0xF310, 0x0965, 0xF30C,
0x095F, 0xF308, 0x095A, 0xF305, 0x0955, 0xF301, 0x0950, 0xF2FD, 0x094B, 0xF2FA,
0x0946, 0xF2F6, 0x0941, 0xF2F2, 0x093C, 0xF2EF, 0x0937, 0xF2EB, 0x0931, 0xF2E8,
0x092C, 0xF2E4, 0x0927, 0xF2E0, 0x0922, 0xF2DD, 0x091D, 0xF2D9, 0x0918, 0xF2D6,
0x0912, 0xF2D2, 0x090D, 0xF2CE, 0x0908, 0xF2CB, 0x0903, 0xF2C7, 0x08FE, 0xF2C4,
0x08F8, 0xF2C0, 0x08F3, 0xF2BD, 0x08EE, 0xF2B9, 0x08E9, 0xF2B6, 0x08E4, 0xF2B2,
0x08DE, 0xF2AF, 0x08D9, 0xF2AB, 0x08D4, 0xF2A8, 0x08CF, 0xF2A4, 0x08C9, 0xF2A1,
0x08C4, 0xF29E, 0x08BF, 0xF29A, 0x08BA, 0xF297, 0x08B4, 0xF293, 0x08AF, 0xF290,
0x08AA, 0xF28C, 0x08A5, 0xF289, 0x089F, 0xF286, 0x089A, 0xF282, 0x0895, 0xF27F,
0x088F, 0xF27B, 0x088A, 0xF278, 0x0885, 0xF275, 0x087F, 0xF271, 0x087A, 0xF26E,
0x0875, 0xF26B, 0x086F, 0xF267, 0x086A, 0xF264, 0x0865, 0xF261, 0x085F, 0xF25E,
0x085A, 0xF25A, 0x0855, 0xF257, 0x084F, 0xF254, 0x084A, 0xF250, 0x0845, 0xF24D,
0x083F, 0xF24A, 0x083A, 0xF247, 0x0834, 0xF244, 0x082F, 0xF240, 0x082A, 0xF23D,
0x0824, 0xF23A, 0x081F, 0xF237, 0x0819, 0xF234, 0x0814, 0xF230, 0x080E, 0xF22D,
0x0809, 0xF22A, 0x0804, 0xF227, 0x07FE, 0xF224, 0x07F9, 0xF221, 0x07F3, 0xF21D,
0x07EE, 0xF21A, 0x07E8, 0xF217, 0x07E3, 0xF214, 0x07DD, 0xF211, 0x07D8, 0xF20E,
0x07D2, 0xF20B, 0x07CD, 0xF208, 0x07C8, 0xF205, 0x07C2, 0xF202, 0x07BD, 0xF1FF,
0x07B7, 0xF1FC, 0x07B2, 0xF1F9, 0x07AC, 0xF1F6, 0x07A6, 0xF1F3, 0x07A1, 0xF1F0,
0x079B, 0xF1ED, 0x0796, 0xF1EA, 0x0790, 0xF1E7, 0x078B, 0xF1E4, 0x0785, 0xF1E1,
0x0780, 0xF1DE, 0x077A, 0xF1DB, 0x0775, 0xF1D8, 0x076F, 0xF1D5, 0x076A, 0xF1D2,
0x0764, 0xF1CF, 0x075E, 0xF1CC, 0x0759, 0xF1C9, 0x0753, 0xF1C6, 0x074E, 0xF1C4,
0x0748, 0xF1C1, 0x0742, 0xF1BE, 0x073D, 0xF1BB, 0x0737, 0xF1B8, 0x0732, 0xF1B5,
0x072C, 0xF1B3, 0x0726, 0xF1B0, 0x0721, 0xF1AD, 0x071B, 0xF1AA, 0x0715, 0xF1A7,
0x0710, 0xF1A5, 0x070A, 0xF1A2, 0x0705, 0xF19F, 0x06FF, 0xF19C, 0x06F9, 0xF19A,
0x06F4, 0xF197, 0x06EE, 0xF194, 0x06E8, 0xF191, 0x06E3, 0xF18F, 0x06DD, 0xF18C,
0x06D7, 0xF189, 0x06D2, 0xF187, 0x06CC, 0xF184, 0x06C6, 0xF181, 0x06C1, 0xF17F,
0x06BB, 0xF17C, 0x06B5, 0xF179, 0x06AF, 0xF177, 0x06AA, 0xF174, 0x06A4, 0xF171,
0x069E, 0xF16F, 0x0699, 0xF16C, 0x0693, 0xF16A, 0x068D, 0xF167, 0x0687, 0xF165,
0x0682, 0xF162, 0x067C, 0xF15F, 0x0676, 0xF15D, 0x0670, 0xF15A, 0x066B, 0xF158,
0x0665, 0xF155, 0x065F, 0xF153, 0x0659, 0xF150, 0x0654, 0xF14E, 0x064E, 0xF14B,
0x0648, 0xF149, 0x0642, 0xF146, 0x063C, 0xF144, 0x0637, 0xF141, 0x0631, 0xF13F,
0x062B, 0xF13D, 0x0625, 0xF13A, 0x061F, 0xF138, 0x061A, 0xF135, 0x0614, 0xF133,
0x060E, 0xF131, 0x0608, 0xF12E, 0x0602, 0xF12C, 0x05FD, 0xF12A, 0x05F7, 0xF127,
0x05F1, 0xF125, 0x05EB, 0xF123, 0x05E5, 0xF120, 0x05DF, 0xF11E, 0x05DA, 0xF11C,
0x05D4, 0xF119, 0x05CE, 0xF117, 0x05C8, 0xF115, 0x05C2, 0xF112, 0x05BC, 0xF110,
0x05B6, 0xF10E, 0x05B1, 0xF10C, 0x05AB, 0xF109, 0x05A5, 0xF107, 0x059F, 0xF105,
0x0599, 0xF103, 0x0593, 0xF101, 0x058D, 0xF0FE, 0x0587, 0xF0FC, 0x0581, 0xF0FA,
0x057C, 0xF0F8, 0x0576, 0xF0F6, 0x0570, 0xF0F4, 0x056A, 0xF0F2, 0x0564, 0xF0EF,
0x055E, 0xF0ED, 0x0558, 0xF0EB, 0x0552, 0xF0E9, 0x054C, 0xF0E7, 0x0546, 0xF0E5,
0x0540, 0xF0E3, 0x053A, 0xF0E1, 0x0534, 0xF0DF, 0x052F, 0xF0DD, 0x0529, 0xF0DB,
0x0523, 0xF0D9, 0x051D, 0xF0D7, 0x0517, 0xF0D5, 0x0511, 0xF0D3, 0x050B, 0xF0D1,
0x0505, 0xF0CF, 0x04FF, 0xF0CD, 0x04F9, 0xF0CB, 0x04F3, 0xF0C9, 0x04ED, 0xF0C7,
0x04E7, 0xF0C5, 0x04E1, 0xF0C3, 0x04DB, 0xF0C1, 0x04D5, 0xF0BF, 0x04CF, 0xF0BD,
0x04C9, 0xF0BB, 0x04C3, 0xF0BA, 0x04BD, 0xF0B8, 0x04B7, 0xF0B6, 0x04B1, 0xF0B4,
0x04AB, 0xF0B2, 0x04A5, 0xF0B0, 0x049F, 0xF0AF, 0x0499, 0xF0AD, 0x0493, 0xF0AB,
0x048D, 0xF0A9, 0x0487, 0xF0A7, 0x0481, 0xF0A6, 0x047B, 0xF0A4, 0x0475, 0xF0A2,
0x046F, 0xF0A0, 0x0469, 0xF09F, 0x0463, 0xF09D, 0x045D, 0xF09B, 0x0457, 0xF099,
0x0451, 0xF098, 0x044B, 0xF096, 0x0444, 0xF094, 0x043E, 0xF093, 0x0438, 0xF091,
0x0432, 0xF08F, 0x042C, 0xF08E, 0x0426, 0xF08C, 0x0420, 0xF08A, 0x041A, 0xF089,
0x0414, 0xF087, 0x040E, 0xF086, 0x0408, 0xF084, 0x0402, 0xF083, 0x03FC, 0xF081,
0x03F6, 0xF07F, 0x03EF, 0xF07E, 0x03E9, 0xF07C, 0x03E3, 0xF07B, 0x03DD, 0xF079,
0x03D7, 0xF078, 0x03D1, 0xF076, 0x03CB, 0xF075, 0x03C5, 0xF073, 0x03BF, 0xF072,
0x03B9, 0xF070, 0x03B2, 0xF06F, 0x03AC, 0xF06D, 0x03A6, 0xF06C, 0x03A0, 0xF06B,
0x039A, 0xF069, 0x0394, 0xF068, 0x038E, 0xF066, 0x0388, 0xF065, 0x0381, 0xF064,
0x037B, 0xF062, 0x0375, 0xF061, 0x036F, 0xF05F, 0x0369, 0xF05E, 0x0363, 0xF05D,
0x035D, 0xF05B, 0x0356, 0xF05A, 0x0350, 0xF059, 0x034A, 0xF058, 0x0344, 0xF056,
0x033E, 0xF055, 0x0338, 0xF054, 0x0332, 0xF052, 0x032B, 0xF051, 0x0325, 0xF050,
0x031F, 0xF04F, 0x0319, 0xF04D, 0x0313, 0xF04C, 0x030D, 0xF04B, 0x0306, 0xF04A,
0x0300, 0xF049, 0x02FA, 0xF048, 0x02F4, 0xF046, 0x02EE, 0xF045, 0x02E8, 0xF044,
0x02E1, 0xF043, 0x02DB, 0xF042, 0x02D5, 0xF041, 0x02CF, 0xF040, 0x02C9, 0xF03E,
0x02C2, 0xF03D, 0x02BC, 0xF03C, 0x02B6, 0xF03B, 0x02B0, 0xF03A, 0x02AA, 0xF039,
0x02A3, 0xF038, 0x029D, 0xF037, 0x0297, 0xF036, 0x0291, 0xF035, 0x028B, 0xF034,
0x0284, 0xF033, 0x027E, 0xF032, 0x0278, 0xF031, 0x0272, 0xF030, 0x026C, 0xF02F,
0x0265, 0xF02E, 0x025F, 0xF02D, 0x0259, 0xF02C, 0x0253, 0xF02B, 0x024D, 0xF02B,
0x0246, 0xF02A, 0x0240, 0xF029, 0x023A, 0xF028, 0x0234, 0xF027, 0x022D, 0xF026,
0x0227, 0xF025, 0x0221, 0xF024, 0x021B, 0xF024, 0x0215, 0xF023, 0x020E, 0xF022,
0x0208, 0xF021, 0x0202, 0xF020, 0x01FC, 0xF020, 0x01F5, 0xF01F, 0x01EF, 0xF01E,
0x01E9, 0xF01D, 0x01E3, 0xF01D, 0x01DC, 0xF01C, 0x01D6, 0xF01B, 0x01D0, 0xF01A,
0x01CA, 0xF01A, 0x01C3, 0xF019, 0x01BD, 0xF018, 0x01B7, 0xF018, 0x01B1, 0xF017,
0x01AA, 0xF016, 0x01A4, 0xF016, 0x019E, 0xF015, 0x0198, 0xF014, 0x0191, 0xF014,
0x018B, 0xF013, 0x0185, 0xF013, 0x017F, 0xF012, 0x0178, 0xF011, 0x0172, 0xF011,
0x016C, 0xF010, 0x0166, 0xF010, 0x015F, 0xF00F, 0x0159, 0xF00F, 0x0153, 0xF00E,
0x014D, 0xF00E, 0x0146, 0xF00D, 0x0140, 0xF00D, 0x013A, 0xF00C, 0x0134, 0xF00C,
0x012D, 0xF00B, 0x0127, 0xF00B, 0x0121, 0xF00A, 0x011B, 0xF00A, 0x0114, 0xF009,
0x010E, 0xF009, 0x0108, 0xF008, 0x0101, 0xF008, 0x00FB, 0xF008, 0x00F5, 0xF007,
0x00EF, 0xF007, 0x00E8, 0xF007, 0x00E2, 0xF006, 0x00DC, 0xF006, 0x00D6, 0xF006,
0x00CF, 0xF005, 0x00C9, 0xF005, 0x00C3, 0xF005, 0x00BC, 0xF004, 0x00B6, 0xF004,
0x00B0, 0xF004, 0x00AA, 0xF004, 0x00A3, 0xF003, 0x009D, 0xF003, 0x0097, 0xF003,
0x0090, 0xF003, 0x008A, 0xF002, 0x0084, 0xF002, 0x007E, 0xF002, 0x0077, 0xF002,
0x0071, 0xF002, 0x006B, 0xF001, 0x0065, 0xF001, 0x005E, 0xF001, 0x0058, 0xF001,
0x0052, 0xF001, 0x004B, 0xF001, 0x0045, 0xF001, 0x003F, 0xF000, 0x0039, 0xF000,
0x0032, 0xF000, 0x002C, 0xF000, 0x0026, 0xF000, 0x001F, 0xF000, 0x0019, 0xF000,
0x0013, 0xF000, 0x000D, 0xF000, 0x0006, 0xF000, 0x0000, 0xF000, 0xFFFA, 0xF000,
0xFFF3, 0xF000, 0xFFED, 0xF000, 0xFFE7, 0xF000, 0xFFE1, 0xF000, 0xFFDA, 0xF000,
0xFFD4, 0xF000, 0xFFCE, 0xF000, 0xFFC7, 0xF000, 0xFFC1, 0xF000, 0xFFBB, 0xF001,
0xFFB5, 0xF001, 0xFFAE, 0xF001, 0xFFA8, 0xF001, 0xFFA2, 0xF001, 0xFF9B, 0xF001,
0xFF95, 0xF001, 0xFF8F, 0xF002, 0xFF89, 0xF002, 0xFF82, 0xF002, 0xFF7C, 0xF002,
0xFF76, 0xF002, 0xFF70, 0xF003, 0xFF69, 0xF003, 0xFF63, 0xF003, 0xFF5D, 0xF003,
0xFF56, 0xF004, 0xFF50, 0xF004, 0xFF4A, 0xF004, 0xFF44, 0xF004, 0xFF3D, 0xF005,
0xFF37, 0xF005, 0xFF31, 0xF005, 0xFF2A, 0xF006, 0xFF24, 0xF006, 0xFF1E, 0xF006,
0xFF18, 0xF007, 0xFF11, 0xF007, 0xFF0B, 0xF007, 0xFF05, 0xF008, 0xFEFF, 0xF008,
0xFEF8, 0xF008, 0xFEF2, 0xF009, 0xFEEC, 0xF009, 0xFEE5, 0xF00A, 0xFEDF, 0xF00A,
0xFED9, 0xF00B, 0xFED3, 0xF00B, 0xFECC, 0xF00C, 0xFEC6, 0xF00C, 0xFEC0, 0xF00D,
0xFEBA, 0xF00D, 0xFEB3, 0xF00E, 0xFEAD, 0xF00E, 0xFEA7, 0xF00F, 0xFEA1, 0xF00F,
0xFE9A, 0xF010, 0xFE94, 0xF010, 0xFE8E, 0xF011, 0xFE88, 0xF011, 0xFE81, 0xF012,
0xFE7B, 0xF013, 0xFE75, 0xF013, 0xFE6F, 0xF014, 0xFE68, 0xF014, 0xFE62, 0xF015,
0xFE5C, 0xF016, 0xFE56, 0xF016, 0xFE4F, 0xF017, 0xFE49, 0xF018, 0xFE43, 0xF018,
0xFE3D, 0xF019, 0xFE36, 0xF01A, 0xFE30, 0xF01A, 0xFE2A, 0xF01B, 0xFE24, 0xF01C,
0xFE1D, 0xF01D, 0xFE17, 0xF01D, 0xFE11, 0xF01E, 0xFE0B, 0xF01F, 0xFE04, 0xF020,
0xFDFE, 0xF020, 0xFDF8, 0xF021, 0xFDF2, 0xF022, 0xFDEB, 0xF023, 0xFDE5, 0xF024,
0xFDDF, 0xF024, 0xFDD9, 0xF025, 0xFDD3, 0xF026, 0xFDCC, 0xF027, 0xFDC6, 0xF028,
0xFDC0, 0xF029, 0xFDBA, 0xF02A, 0xFDB3, 0xF02B, 0xFDAD, 0xF02B, 0xFDA7, 0xF02C,
0xFDA1, 0xF02D, 0xFD9B, 0xF02E, 0xFD94, 0xF02F, 0xFD8E, 0xF030, 0xFD88, 0xF031,
0xFD82, 0xF032, 0xFD7C, 0xF033, 0xFD75, 0xF034, 0xFD6F, 0xF035, 0xFD69, 0xF036,
0xFD63, 0xF037, 0xFD5D, 0xF038, 0xFD56, 0xF039, 0xFD50, 0xF03A, 0xFD4A, 0xF03B,
0xFD44, 0xF03C, 0xFD3E, 0xF03D, 0xFD37, 0xF03E, 0xFD31, 0xF040, 0xFD2B, 0xF041,
0xFD25, 0xF042, 0xFD1F, 0xF043, 0xFD18, 0xF044, 0xFD12, 0xF045, 0xFD0C, 0xF046,
0xFD06, 0xF048, 0xFD00, 0xF049, 0xFCFA, 0xF04A, 0xFCF3, 0xF04B, 0xFCED, 0xF04C,
0xFCE7, 0xF04D, 0xFCE1, 0xF04F, 0xFCDB, 0xF050, 0xFCD5, 0xF051, 0xFCCE, 0xF052,
0xFCC8, 0xF054, 0xFCC2, 0xF055, 0xFCBC, 0xF056, 0xFCB6, 0xF058, 0xFCB0, 0xF059,
0xFCAA, 0xF05A, 0xFCA3, 0xF05B, 0xFC9D, 0xF05D, 0xFC97, 0xF05E, 0xFC91, 0xF05F,
0xFC8B, 0xF061, 0xFC85, 0xF062, 0xFC7F, 0xF064, 0xFC78, 0xF065, 0xFC72, 0xF066,
0xFC6C, 0xF068, 0xFC66, 0xF069, 0xFC60, 0xF06B, 0xFC5A, 0xF06C, 0xFC54, 0xF06D,
0xFC4E, 0xF06F, 0xFC47, 0xF070, 0xFC41, 0xF072, 0xFC3B, 0xF073, 0xFC35, 0xF075,
0xFC2F, 0xF076, 0xFC29, 0xF078, 0xFC23, 0xF079, 0xFC1D, 0xF07B, 0xFC17, 0xF07C,
0xFC11, 0xF07E, 0xFC0A, 0xF07F, 0xFC04, 0xF081, 0xFBFE, 0xF083, 0xFBF8, 0xF084,
0xFBF2, 0xF086, 0xFBEC, 0xF087, 0xFBE6, 0xF089, 0xFBE0, 0xF08A, 0xFBDA, 0xF08C,
0xFBD4, 0xF08E, 0xFBCE, 0xF08F, 0xFBC8, 0xF091, 0xFBC2, 0xF093, 0xFBBC, 0xF094,
0xFBB5, 0xF096, 0xFBAF, 0xF098, 0xFBA9, 0xF099, 0xFBA3, 0xF09B, 0xFB9D, 0xF09D,
0xFB97, 0xF09F, 0xFB91, 0xF0A0, 0xFB8B, 0xF0A2, 0xFB85, 0xF0A4, 0xFB7F, 0xF0A6,
0xFB79, 0xF0A7, 0xFB73, 0xF0A9, 0xFB6D, 0xF0AB, 0xFB67, 0xF0AD, 0xFB61, 0xF0AF,
0xFB5B, 0xF0B0, 0xFB55, 0xF0B2, 0xFB4F, 0xF0B4, 0xFB49, 0xF0B6, 0xFB43, 0xF0B8,
0xFB3D, 0xF0BA, 0xFB37, 0xF0BB, 0xFB31, 0xF0BD, 0xFB2B, 0xF0BF, 0xFB25, 0xF0C1,
0xFB1F, 0xF0C3, 0xFB19, 0xF0C5, 0xFB13, 0xF0C7, 0xFB0D, 0xF0C9, 0xFB07, 0xF0CB,
0xFB01, 0xF0CD, 0xFAFB, 0xF0CF, 0xFAF5, 0xF0D1, 0xFAEF, 0xF0D3, 0xFAE9, 0xF0D5,
0xFAE3, 0xF0D7, 0xFADD, 0xF0D9, 0xFAD7, 0xF0DB, 0xFAD1, 0xF0DD, 0xFACC, 0xF0DF,
0xFAC6, 0xF0E1, 0xFAC0, 0xF0E3, 0xFABA, 0xF0E5, 0xFAB4, 0xF0E7, 0xFAAE, 0xF0E9,
0xFAA8, 0xF0EB, 0xFAA2, 0xF0ED, 0xFA9C, 0xF0EF, 0xFA96, 0xF0F2, 0xFA90, 0xF0F4,
0xFA8A, 0xF0F6, 0xFA84, 0xF0F8, 0xFA7F, 0xF0FA, 0xFA79, 0xF0FC, 0xFA73, 0xF0FE,
0xFA6D, 0xF101, 0xFA67, 0xF103, 0xFA61, 0xF105, 0xFA5B, 0xF107, 0xFA55, 0xF109,
0xFA4F, 0xF10C, 0xFA4A, 0xF10E, 0xFA44, 0xF110, 0xFA3E, 0xF112, 0xFA38, 0xF115,
0xFA32, 0xF117, 0xFA2C, 0xF119, 0xFA26, 0xF11C, 0xFA21, 0xF11E, 0xFA1B, 0xF120,
0xFA15, 0xF123, 0xFA0F, 0xF125, 0xFA09, 0xF127, 0xFA03, 0xF12A, 0xF9FE, 0xF12C,
0xF9F8, 0xF12E, 0xF9F2, 0xF131, 0xF9EC, 0xF133, 0xF9E6, 0xF135, 0xF9E1, 0xF138,
0xF9DB, 0xF13A, 0xF9D5, 0xF13D, 0xF9CF, 0xF13F, 0xF9C9, 0xF141, 0xF9C4, 0xF144,
0xF9BE, 0xF146, 0xF9B8, 0xF149, 0xF9B2, 0xF14B, 0xF9AC, 0xF14E, 0xF9A7, 0xF150,
0xF9A1, 0xF153, 0xF99B, 0xF155, 0xF995, 0xF158, 0xF990, 0xF15A, 0xF98A, 0xF15D,
0xF984, 0xF15F, 0xF97E, 0xF162, 0xF979, 0xF165, 0xF973, 0xF167, 0xF96D, 0xF16A,
0xF967, 0xF16C, 0xF962, 0xF16F, 0xF95C, 0xF171, 0xF956, 0xF174, 0xF951, 0xF177,
0xF94B, 0xF179, 0xF945, 0xF17C, 0xF93F, 0xF17F, 0xF93A, 0xF181, 0xF934, 0xF184,
0xF92E, 0xF187, 0xF929, 0xF189, 0xF923, 0xF18C, 0xF91D, 0xF18F, 0xF918, 0xF191,
0xF912, 0xF194, 0xF90C, 0xF197, 0xF907, 0xF19A, 0xF901, 0xF19C, 0xF8FB, 0xF19F,
0xF8F6, 0xF1A2, 0xF8F0, 0xF1A5, 0xF8EB, 0xF1A7, 0xF8E5, 0xF1AA, 0xF8DF, 0xF1AD,
0xF8DA, 0xF1B0, 0xF8D4, 0xF1B3, 0xF8CE, 0xF1B5, 0xF8C9, 0xF1B8, 0xF8C3, 0xF1BB,
0xF8BE, 0xF1BE, 0xF8B8, 0xF1C1, 0xF8B2, 0xF1C4, 0xF8AD, 0xF1C6, 0xF8A7, 0xF1C9,
0xF8A2, 0xF1CC, 0xF89C, 0xF1CF, 0xF896, 0xF1D2, 0xF891, 0xF1D5, 0xF88B, 0xF1D8,
0xF886, 0xF1DB, 0xF880, 0xF1DE, 0xF87B, 0xF1E1, 0xF875, 0xF1E4, 0xF870, 0xF1E7,
0xF86A, 0xF1EA, 0xF865, 0xF1ED, 0xF85F, 0xF1F0, 0xF85A, 0xF1F3, 0xF854, 0xF1F6,
0xF84E, 0xF1F9, 0xF849, 0xF1FC, 0xF843, 0xF1FF, 0xF83E, 0xF202, 0xF838, 0xF205,
0xF833, 0xF208, 0xF82E, 0xF20B, 0xF828, 0xF20E, 0xF823, 0xF211, 0xF81D, 0xF214,
0xF818, 0xF217, 0xF812, 0xF21A, 0xF80D, 0xF21D, 0xF807, 0xF221, 0xF802, 0xF224,
0xF7FC, 0xF227, 0xF7F7, 0xF22A, 0xF7F2, 0xF22D, 0xF7EC, 0xF230, 0xF7E7, 0xF234,
0xF7E1, 0xF237, 0xF7DC, 0xF23A, 0xF7D6, 0xF23D, 0xF7D1, 0xF240, 0xF7CC, 0xF244,
0xF7C6, 0xF247, 0xF7C1, 0xF24A, 0xF7BB, 0xF24D, 0xF7B6, 0xF250, 0xF7B1, 0xF254,
0xF7AB, 0xF257, 0xF7A6, 0xF25A, 0xF7A1, 0xF25E, 0xF79B, 0xF261, 0xF796, 0xF264,
0xF791, 0xF267, 0xF78B, 0xF26B, 0xF786, 0xF26E, 0xF781, 0xF271, 0xF77B, 0xF275,
0xF776, 0xF278, 0xF771, 0xF27B, 0xF76B, 0xF27F, 0xF766, 0xF282, 0xF761, 0xF286,
0xF75B, 0xF289, 0xF756, 0xF28C, 0xF751, 0xF290, 0xF74C, 0xF293, 0xF746, 0xF297,
0xF741, 0xF29A, 0xF73C, 0xF29E, 0xF737, 0xF2A1, 0xF731, 0xF2A4, 0xF72C, 0xF2A8,
0xF727, 0xF2AB, 0xF722, 0xF2AF, 0xF71C, 0xF2B2, 0xF717, 0xF2B6, 0xF712, 0xF2B9,
0xF70D, 0xF2BD, 0xF708, 0xF2C0, 0xF702, 0xF2C4, 0xF6FD, 0xF2C7, 0xF6F8, 0xF2CB,
0xF6F3, 0xF2CE, 0xF6EE, 0xF2D2, 0xF6E8, 0xF2D6, 0xF6E3, 0xF2D9, 0xF6DE, 0xF2DD,
0xF6D9, 0xF2E0, 0xF6D4, 0xF2E4, 0xF6CF, 0xF2E8, 0xF6C9, 0xF2EB, 0xF6C4, 0xF2EF,
0xF6BF, 0xF2F2, 0xF6BA, 0xF2F6, 0xF6B5, 0xF2FA, 0xF6B0, 0xF2FD, 0xF6AB, 0xF301,
0xF6A6, 0xF305, 0xF6A1, 0xF308, 0xF69B, 0xF30C, 0xF696, 0xF310, 0xF691, 0xF313,
0xF68C, 0xF317, 0xF687, 0xF31B, 0xF682, 0xF31F, 0xF67D, 0xF322, 0xF678, 0xF326,
0xF673, 0xF32A, 0xF66E, 0xF32E, 0xF669, 0xF331, 0xF664, 0xF335, 0xF65F, 0xF339,
0xF65A, 0xF33D, 0xF655, 0xF340, 0xF650, 0xF344, 0xF64B, 0xF348, 0xF646, 0xF34C,
0xF641, 0xF350, 0xF63C, 0xF354, 0xF637, 0xF357, 0xF632, 0xF35B, 0xF62D, 0xF35F,
0xF628, 0xF363, 0xF623, 0xF367, 0xF61E, 0xF36B, 0xF619, 0xF36F, 0xF614, 0xF372,
0xF60F, 0xF376, 0xF60A, 0xF37A, 0xF605, 0xF37E, 0xF601, 0xF382, 0xF5FC, 0xF386,
0xF5F7, 0xF38A, 0xF5F2, 0xF38E, 0xF5ED, 0xF392, 0xF5E8, 0xF396, 0xF5E3, 0xF39A,
0xF5DE, 0xF39E, 0xF5DA, 0xF3A2, 0xF5D5, 0xF3A6, 0xF5D0, 0xF3AA, 0xF5CB, 0xF3AE,
0xF5C6, 0xF3B2, 0xF5C1, 0xF3B6, 0xF5BC, 0xF3BA, 0xF5B8, 0xF3BE, 0xF5B3, 0xF3C2,
0xF5AE, 0xF3C6, 0xF5A9, 0xF3CA, 0xF5A4, 0xF3CE, 0xF5A0, 0xF3D2, 0xF59B, 0xF3D6,
0xF596, 0xF3DA, 0xF591, 0xF3DE, 0xF58D, 0xF3E2, 0xF588, 0xF3E7, 0xF583, 0xF3EB,
0xF57E, 0xF3EF, 0xF57A, 0xF3F3, 0xF575, 0xF3F7, 0xF570, 0xF3FB, 0xF56B, 0xF3FF,
0xF567, 0xF404, 0xF562, 0xF408, 0xF55D, 0xF40C, 0xF559, 0xF410, 0xF554, 0xF414,
0xF54F, 0xF418, 0xF54B, 0xF41D, 0xF546, 0xF421, 0xF541, 0xF425, 0xF53D, 0xF429,
0xF538, 0xF42E, 0xF533, 0xF432, 0xF52F, 0xF436, 0xF52A, 0xF43A, 0xF525, 0xF43F,
0xF521, 0xF443, 0xF51C, 0xF447, 0xF518, 0xF44B, 0xF513, 0xF450, 0xF50E, 0xF454,
0xF50A, 0xF458, 0xF505, 0xF45D, 0xF501, 0xF461, 0xF4FC, 0xF465, 0xF4F8, 0xF469,
0xF4F3, 0xF46E, 0xF4EF, 0xF472, 0xF4EA, 0xF477, 0xF4E5, 0xF47B, 0xF4E1, 0xF47F,
0xF4DC, 0xF484, 0xF4D8, 0xF488, 0xF4D3, 0xF48C, 0xF4CF, 0xF491, 0xF4CA, 0xF495,
0xF4C6, 0xF49A, 0xF4C2, 0xF49E, 0xF4BD, 0xF4A2, 0xF4B9, 0xF4A7, 0xF4B4, 0xF4AB,
0xF4B0, 0xF4B0, 0xF4AB, 0xF4B4, 0xF4A7, 0xF4B9, 0xF4A2, 0xF4BD, 0xF49E, 0xF4C2,
0xF49A, 0xF4C6, 0xF495, 0xF4CA, 0xF491, 0xF4CF, 0xF48C, 0xF4D3, 0xF488, 0xF4D8,
0xF484, 0xF4DC, 0xF47F, 0xF4E1, 0xF47B, 0xF4E5, 0xF477, 0xF4EA, 0xF472, 0xF4EF,
0xF46E, 0xF4F3, 0xF469, 0xF4F8, 0xF465, 0xF4FC, 0xF461, 0xF501, 0xF45D, 0xF505,
0xF458, 0xF50A, 0xF454, 0xF50E, 0xF450, 0xF513, 0xF44B, 0xF518, 0xF447, 0xF51C,
0xF443, 0xF521, 0xF43F, 0xF525, 0xF43A, 0xF52A, 0xF436, 0xF52F, 0xF432, 0xF533,
0xF42E, 0xF538, 0xF429, 0xF53D, 0xF425, 0xF541, 0xF421, 0xF546, 0xF41D, 0xF54B,
0xF418, 0xF54F, 0xF414, 0xF554, 0xF410, 0xF559, 0xF40C, 0xF55D, 0xF408, 0xF562,
0xF404, 0xF567, 0xF3FF, 0xF56B, 0xF3FB, 0xF570, 0xF3F7, 0xF575, 0xF3F3, 0xF57A,
0xF3EF, 0xF57E, 0xF3EB, 0xF583, 0xF3E7, 0xF588, 0xF3E2, 0xF58D, 0xF3DE, 0xF591,
0xF3DA, 0xF596, 0xF3D6, 0xF59B, 0xF3D2, 0xF5A0, 0xF3CE, 0xF5A4, 0xF3CA, 0xF5A9,
0xF3C6, 0xF5AE, 0xF3C2, 0xF5B3, 0xF3BE, 0xF5B8, 0xF3BA, 0xF5BC, 0xF3B6, 0xF5C1,
0xF3B2, 0xF5C6, 0xF3AE, 0xF5CB, 0xF3AA, 0xF5D0, 0xF3A6, 0xF5D5, 0xF3A2, 0xF5DA,
0xF39E, 0xF5DE, 0xF39A, 0xF5E3, 0xF396, 0xF5E8, 0xF392, 0xF5ED, 0xF38E, 0xF5F2,
0xF38A, 0xF5F7, 0xF386, 0xF5FC, 0xF382, 0xF601, 0xF37E, 0xF605, 0xF37A, 0xF60A,
0xF376, 0xF60F, 0xF372, 0xF614, 0xF36F, 0xF619, 0xF36B, 0xF61E, 0xF367, 0xF623,
0xF363, 0xF628, 0xF35F, 0xF62D, 0xF35B, 0xF632, 0xF357, 0xF637, 0xF354, 0xF63C,
0xF350, 0xF641, 0xF34C, 0xF646, 0xF348, 0xF64B, 0xF344, 0xF650, 0xF340, 0xF655,
0xF33D, 0xF65A, 0xF339, 0xF65F, 0xF335, 0xF664, 0xF331, 0xF669, 0xF32E, 0xF66E,
0xF32A, 0xF673, 0xF326, 0xF678, 0xF322, 0xF67D, 0xF31F, 0xF682, 0xF31B, 0xF687,
0xF317, 0xF68C, 0xF313, 0xF691, 0xF310, 0xF696, 0xF30C, 0xF69B, 0xF308, 0xF6A1,
0xF305, 0xF6A6, 0xF301, 0xF6AB, 0xF2FD, 0xF6B0, 0xF2FA, 0xF6B5, 0xF2F6, 0xF6BA,
0xF2F2, 0xF6BF, 0xF2EF, 0xF6C4, 0xF2EB, 0xF6C9, 0xF2E8, 0xF6CF, 0xF2E4, 0xF6D4,
0xF2E0, 0xF6D9, 0xF2DD, 0xF6DE, 0xF2D9, 0xF6E3, 0xF2D6, 0xF6E8, 0xF2D2, 0xF6EE,
0xF2CE, 0xF6F3, 0xF2CB, 0xF6F8, 0xF2C7, 0xF6FD, 0xF2C4, 0xF702, 0xF2C0, 0xF708,
0xF2BD, 0xF70D, 0xF2B9, 0xF712, 0xF2B6, 0xF717, 0xF2B2, 0xF71C, 0xF2AF, 0xF722,
0xF2AB, 0xF727, 0xF2A8, 0xF72C, 0xF2A4, 0xF731, 0xF2A1, 0xF737, 0xF29E, 0xF73C,
0xF29A, 0xF741, 0xF297, 0xF746, 0xF293, 0xF74C, 0xF290, 0xF751, 0xF28C, 0xF756,
0xF289, 0xF75B, 0xF286, 0xF761, 0xF282, 0xF766, 0xF27F, 0xF76B, 0xF27B, 0xF771,
0xF278, 0xF776, 0xF275, 0xF77B, 0xF271, 0xF781, 0xF26E, 0xF786, 0xF26B, 0xF78B,
0xF267, 0xF791, 0xF264, 0xF796, 0xF261, 0xF79B, 0xF25E, 0xF7A1, 0xF25A, 0xF7A6,
0xF257, 0xF7AB, 0xF254, 0xF7B1, 0xF250, 0xF7B6, 0xF24D, 0xF7BB, 0xF24A, 0xF7C1,
0xF247, 0xF7C6, 0xF244, 0xF7CC, 0xF240, 0xF7D1, 0xF23D, 0xF7D6, 0xF23A, 0xF7DC,
0xF237, 0xF7E1, 0xF234, 0xF7E7, 0xF230, 0xF7EC, 0xF22D, 0xF7F2, 0xF22A, 0xF7F7,
0xF227, 0xF7FC, 0xF224, 0xF802, 0xF221, 0xF807, 0xF21D, 0xF80D, 0xF21A, 0xF812,
0xF217, 0xF818, 0xF214, 0xF81D, 0xF211, 0xF823, 0xF20E, 0xF828, 0xF20B, 0xF82E,
0xF208, 0xF833, 0xF205, 0xF838, 0xF202, 0xF83E, 0xF1FF, 0xF843, 0xF1FC, 0xF849,
0xF1F9, 0xF84E, 0xF1F6, 0xF854, 0xF1F3, 0xF85A, 0xF1F0, 0xF85F, 0xF1ED, 0xF865,
0xF1EA, 0xF86A, 0xF1E7, 0xF870, 0xF1E4, 0xF875, 0xF1E1, 0xF87B, 0xF1DE, 0xF880,
0xF1DB, 0xF886, 0xF1D8, 0xF88B, 0xF1D5, 0xF891, 0xF1D2, 0xF896, 0xF1CF, 0xF89C,
0xF1CC, 0xF8A2, 0xF1C9, 0xF8A7, 0xF1C6, 0xF8AD, 0xF1C4, 0xF8B2, 0xF1C1, 0xF8B8,
0xF1BE, 0xF8BE, 0xF1BB, 0xF8C3, 0xF1B8, 0xF8C9, 0xF1B5, 0xF8CE, 0xF1B3, 0xF8D4,
0xF1B0, 0xF8DA, 0xF1AD, 0xF8DF, 0xF1AA, 0xF8E5, 0xF1A7, 0xF8EB, 0xF1A5, 0xF8F0,
0xF1A2, 0xF8F6, 0xF19F, 0xF8FB, 0xF19C, 0xF901, 0xF19A, 0xF907, 0xF197, 0xF90C,
0xF194, 0xF912, 0xF191, 0xF918, 0xF18F, 0xF91D, 0xF18C, 0xF923, 0xF189, 0xF929,
0xF187, 0xF92E, 0xF184, 0xF934, 0xF181, 0xF93A, 0xF17F, 0xF93F, 0xF17C, 0xF945,
0xF179, 0xF94B, 0xF177, 0xF951, 0xF174, 0xF956, 0xF171, 0xF95C, 0xF16F, 0xF962,
0xF16C, 0xF967, 0xF16A, 0xF96D, 0xF167, 0xF973, 0xF165, 0xF979, 0xF162, 0xF97E,
0xF15F, 0xF984, 0xF15D, 0xF98A, 0xF15A, 0xF990, 0xF158, 0xF995, 0xF155, 0xF99B,
0xF153, 0xF9A1, 0xF150, 0xF9A7, 0xF14E, 0xF9AC, 0xF14B, 0xF9B2, 0xF149, 0xF9B8,
0xF146, 0xF9BE, 0xF144, 0xF9C4, 0xF141, 0xF9C9, 0xF13F, 0xF9CF, 0xF13D, 0xF9D5,
0xF13A, 0xF9DB, 0xF138, 0xF9E1, 0xF135, 0xF9E6, 0xF133, 0xF9EC, 0xF131, 0xF9F2,
0xF12E, 0xF9F8, 0xF12C, 0xF9FE, 0xF12A, 0xFA03, 0xF127, 0xFA09, 0xF125, 0xFA0F,
0xF123, 0xFA15, 0xF120, 0xFA1B, 0xF11E, 0xFA21, 0xF11C, 0xFA26, 0xF119, 0xFA2C,
0xF117, 0xFA32, 0xF115, 0xFA38, 0xF112, 0xFA3E, 0xF110, 0xFA44, 0xF10E, 0xFA4A,
0xF10C, 0xFA4F, 0xF109, 0xFA55, 0xF107, 0xFA5B, 0xF105, 0xFA61, 0xF103, 0xFA67,
0xF101, 0xFA6D, 0xF0FE, 0xFA73, 0xF0FC, 0xFA79, 0xF0FA, 0xFA7F, 0xF0F8, 0xFA84,
0xF0F6, 0xFA8A, 0xF0F4, 0xFA90, 0xF0F2, 0xFA96, 0xF0EF, 0xFA9C, 0xF0ED, 0xFAA2,
0xF0EB, 0xFAA8, 0xF0E9, 0xFAAE, 0xF0E7, 0xFAB4, 0xF0E5, 0xFABA, 0xF0E3, 0xFAC0,
0xF0E1, 0xFAC6, 0xF0DF, 0xFACC, 0xF0DD, 0xFAD1, 0xF0DB, 0xFAD7, 0xF0D9, 0xFADD,
0xF0D7, 0xFAE3, 0xF0D5, 0xFAE9, 0xF0D3, 0xFAEF, 0xF0D1, 0xFAF5, 0xF0CF, 0xFAFB,
0xF0CD, 0xFB01, 0xF0CB, 0xFB07, 0xF0C9, 0xFB0D, 0xF0C7, 0xFB13, 0xF0C5, 0xFB19,
0xF0C3, 0xFB1F, 0xF0C1, 0xFB25, 0xF0BF, 0xFB2B, 0xF0BD, 0xFB31, 0xF0BB, 0xFB37,
0xF0BA, 0xFB3D, 0xF0B8, 0xFB43, 0xF0B6, 0xFB49, 0xF0B4, 0xFB4F, 0xF0B2, 0xFB55,
0xF0B0, 0xFB5B, 0xF0AF, 0xFB61, 0xF0AD, 0xFB67, 0xF0AB, 0xFB6D, 0xF0A9, 0xFB73,
0xF0A7, 0xFB79, 0xF0A6, 0xFB7F, 0xF0A4, 0xFB85, 0xF0A2, 0xFB8B, 0xF0A0, 0xFB91,
0xF09F, 0xFB97, 0xF09D, 0xFB9D, 0xF09B, 0xFBA3, 0xF099, 0xFBA9, 0xF098, 0xFBAF,
0xF096, 0xFBB5, 0xF094, 0xFBBC, 0xF093, 0xFBC2, 0xF091, 0xFBC8, 0xF08F, 0xFBCE,
0xF08E, 0xFBD4, 0xF08C, 0xFBDA, 0xF08A, 0xFBE0, 0xF089, 0xFBE6, 0xF087, 0xFBEC,
0xF086, 0xFBF2, 0xF084, 0xFBF8, 0xF083, 0xFBFE, 0xF081, 0xFC04, 0xF07F, 0xFC0A,
0xF07E, 0xFC11, 0xF07C, 0xFC17, 0xF07B, 0xFC1D, 0xF079, 0xFC23, 0xF078, 0xFC29,
0xF076, 0xFC2F, 0xF075, 0xFC35, 0xF073, 0xFC3B, 0xF072, 0xFC41, 0xF070, 0xFC47,
0xF06F, 0xFC4E, 0xF06D, 0xFC54, 0xF06C, 0xFC5A, 0xF06B, 0xFC60, 0xF069, 0xFC66,
0xF068, 0xFC6C, 0xF066, 0xFC72, 0xF065, 0xFC78, 0xF064, 0xFC7F, 0xF062, 0xFC85,
0xF061, 0xFC8B, 0xF05F, 0xFC91, 0xF05E, 0xFC97, 0xF05D, 0xFC9D, 0xF05B, 0xFCA3,
0xF05A, 0xFCAA, 0xF059, 0xFCB0, 0xF058, 0xFCB6, 0xF056, 0xFCBC, 0xF055, 0xFCC2,
0xF054, 0xFCC8, 0xF052, 0xFCCE, 0xF051, 0xFCD5, 0xF050, 0xFCDB, 0xF04F, 0xFCE1,
0xF04D, 0xFCE7, 0xF04C, 0xFCED, 0xF04B, 0xFCF3, 0xF04A, 0xFCFA, 0xF049, 0xFD00,
0xF048, 0xFD06, 0xF046, 0xFD0C, 0xF045, 0xFD12, 0xF044, 0xFD18, 0xF043, 0xFD1F,
0xF042, 0xFD25, 0xF041, 0xFD2B, 0xF040, 0xFD31, 0xF03E, 0xFD37, 0xF03D, 0xFD3E,
0xF03C, 0xFD44, 0xF03B, 0xFD4A, 0xF03A, 0xFD50, 0xF039, 0xFD56, 0xF038, 0xFD5D,
0xF037, 0xFD63, 0xF036, 0xFD69, 0xF035, 0xFD6F, 0xF034, 0xFD75, 0xF033, 0xFD7C,
0xF032, 0xFD82, 0xF031, 0xFD88, 0xF030, 0xFD8E, 0xF02F, 0xFD94, 0xF02E, 0xFD9B,
0xF02D, 0xFDA1, 0xF02C, 0xFDA7, 0xF02B, 0xFDAD, 0xF02B, 0xFDB3, 0xF02A, 0xFDBA,
0xF029, 0xFDC0, 0xF028, 0xFDC6, 0xF027, 0xFDCC, 0xF026, 0xFDD3, 0xF025, 0xFDD9,
0xF024, 0xFDDF, 0xF024, 0xFDE5, 0xF023, 0xFDEB, 0xF022, 0xFDF2, 0xF021, 0xFDF8,
0xF020, 0xFDFE, 0xF020, 0xFE04, 0xF01F, 0xFE0B, 0xF01E, 0xFE11, 0xF01D, 0xFE17,
0xF01D, 0xFE1D, 0xF01C, 0xFE24, 0xF01B, 0xFE2A, 0xF01A, 0xFE30, 0xF01A, 0xFE36,
0xF019, 0xFE3D, 0xF018, 0xFE43, 0xF018, 0xFE49, 0xF017, 0xFE4F, 0xF016, 0xFE56,
0xF016, 0xFE5C, 0xF015, 0xFE62, 0xF014, 0xFE68, 0xF014, 0xFE6F, 0xF013, 0xFE75,
0xF013, 0xFE7B, 0xF012, 0xFE81, 0xF011, 0xFE88, 0xF011, 0xFE8E, 0xF010, 0xFE94,
0xF010, 0xFE9A, 0xF00F, 0xFEA1, 0xF00F, 0xFEA7, 0xF00E, 0xFEAD, 0xF00E, 0xFEB3,
0xF00D, 0xFEBA, 0xF00D, 0xFEC0, 0xF00C, 0xFEC6, 0xF00C, 0xFECC, 0xF00B, 0xFED3,
0xF00B, 0xFED9, 0xF00A, 0xFEDF, 0xF00A, 0xFEE5, 0xF009, 0xFEEC, 0xF009, 0xFEF2,
0xF008, 0xFEF8, 0xF008, 0xFEFF, 0xF008, 0xFF05, 0xF007, 0xFF0B, 0xF007, 0xFF11,
0xF007, 0xFF18, 0xF006, 0xFF1E, 0xF006, 0xFF24, 0xF006, 0xFF2A, 0xF005, 0xFF31,
0xF005, 0xFF37, 0xF005, 0xFF3D, 0xF004, 0xFF44, 0xF004, 0xFF4A, 0xF004, 0xFF50,
0xF004, 0xFF56, 0xF003, 0xFF5D, 0xF003, 0xFF63, 0xF003, 0xFF69, 0xF003, 0xFF70,
0xF002, 0xFF76, 0xF002, 0xFF7C, 0xF002, 0xFF82, 0xF002, 0xFF89, 0xF002, 0xFF8F,
0xF001, 0xFF95, 0xF001, 0xFF9B, 0xF001, 0xFFA2, 0xF001, 0xFFA8, 0xF001, 0xFFAE,
0xF001, 0xFFB5, 0xF001, 0xFFBB, 0xF000, 0xFFC1, 0xF000, 0xFFC7, 0xF000, 0xFFCE,
0xF000, 0xFFD4, 0xF000, 0xFFDA, 0xF000, 0xFFE1, 0xF000, 0xFFE7, 0xF000, 0xFFED,
0xF000, 0xFFF3, 0xF000, 0xFFFA, 0xF000, 0x0000, 0xF000, 0x0006, 0xF000, 0x000D,
0xF000, 0x0013, 0xF000, 0x0019, 0xF000, 0x001F, 0xF000, 0x0026, 0xF000, 0x002C,
0xF000, 0x0032, 0xF000, 0x0039, 0xF000, 0x003F, 0xF001, 0x0045, 0xF001, 0x004B,
0xF001, 0x0052, 0xF001, 0x0058, 0xF001, 0x005E, 0xF001, 0x0065, 0xF001, 0x006B,
0xF002, 0x0071, 0xF002, 0x0077, 0xF002, 0x007E, 0xF002, 0x0084, 0xF002, 0x008A,
0xF003, 0x0090, 0xF003, 0x0097, 0xF003, 0x009D, 0xF003, 0x00A3, 0xF004, 0x00AA,
0xF004, 0x00B0, 0xF004, 0x00B6, 0xF004, 0x00BC, 0xF005, 0x00C3, 0xF005, 0x00C9,
0xF005, 0x00CF, 0xF006, 0x00D6, 0xF006, 0x00DC, 0xF006, 0x00E2, 0xF007, 0x00E8,
0xF007, 0x00EF, 0xF007, 0x00F5, 0xF008, 0x00FB, 0xF008, 0x0101, 0xF008, 0x0108,
0xF009, 0x010E, 0xF009, 0x0114, 0xF00A, 0x011B, 0xF00A, 0x0121, 0xF00B, 0x0127,
0xF00B, 0x012D, 0xF00C, 0x0134, 0xF00C, 0x013A, 0xF00D, 0x0140, 0xF00D, 0x0146,
0xF00E, 0x014D, 0xF00E, 0x0153, 0xF00F, 0x0159, 0xF00F, 0x015F, 0xF010, 0x0166,
0xF010, 0x016C, 0xF011, 0x0172, 0xF011, 0x0178, 0xF012, 0x017F, 0xF013, 0x0185,
0xF013, 0x018B, 0xF014, 0x0191, 0xF014, 0x0198, 0xF015, 0x019E, 0xF016, 0x01A4,
0xF016, 0x01AA, 0xF017, 0x01B1, 0xF018, 0x01B7, 0xF018, 0x01BD, 0xF019, 0x01C3,
0xF01A, 0x01CA, 0xF01A, 0x01D0, 0xF01B, 0x01D6, 0xF01C, 0x01DC, 0xF01D, 0x01E3,
0xF01D, 0x01E9, 0xF01E, 0x01EF, 0xF01F, 0x01F5, 0xF020, 0x01FC, 0xF020, 0x0202,
0xF021, 0x0208, 0xF022, 0x020E, 0xF023, 0x0215, 0xF024, 0x021B, 0xF024, 0x0221,
0xF025, 0x0227, 0xF026, 0x022D, 0xF027, 0x0234, 0xF028, 0x023A, 0xF029, 0x0240,
0xF02A, 0x0246, 0xF02B, 0x024D, 0xF02B, 0x0253, 0xF02C, 0x0259, 0xF02D, 0x025F,
0xF02E, 0x0265, 0xF02F, 0x026C, 0xF030, 0x0272, 0xF031, 0x0278, 0xF032, 0x027E,
0xF033, 0x0284, 0xF034, 0x028B, 0xF035, 0x0291, 0xF036, 0x0297, 0xF037, 0x029D,
0xF038, 0x02A3, 0xF039, 0x02AA, 0xF03A, 0x02B0, 0xF03B, 0x02B6, 0xF03C, 0x02BC,
0xF03D, 0x02C2, 0xF03E, 0x02C9, 0xF040, 0x02CF, 0xF041, 0x02D5, 0xF042, 0x02DB,
0xF043, 0x02E1, 0xF044, 0x02E8, 0xF045, 0x02EE, 0xF046, 0x02F4, 0xF048, 0x02FA,
0xF049, 0x0300, 0xF04A, 0x0306, 0xF04B, 0x030D, 0xF04C, 0x0313, 0xF04D, 0x0319,
0xF04F, 0x031F, 0xF050, 0x0325, 0xF051, 0x032B, 0xF052, 0x0332, 0xF054, 0x0338,
0xF055, 0x033E, 0xF056, 0x0344, 0xF058, 0x034A, 0xF059, 0x0350, 0xF05A, 0x0356,
0xF05B, 0x035D, 0xF05D, 0x0363, 0xF05E, 0x0369, 0xF05F, 0x036F, 0xF061, 0x0375,
0xF062, 0x037B, 0xF064, 0x0381, 0xF065, 0x0388, 0xF066, 0x038E, 0xF068, 0x0394,
0xF069, 0x039A, 0xF06B, 0x03A0, 0xF06C, 0x03A6, 0xF06D, 0x03AC, 0xF06F, 0x03B2,
0xF070, 0x03B9, 0xF072, 0x03BF, 0xF073, 0x03C5, 0xF075, 0x03CB, 0xF076, 0x03D1,
0xF078, 0x03D7, 0xF079, 0x03DD, 0xF07B, 0x03E3, 0xF07C, 0x03E9, 0xF07E, 0x03EF,
0xF07F, 0x03F6, 0xF081, 0x03FC, 0xF083, 0x0402, 0xF084, 0x0408, 0xF086, 0x040E,
0xF087, 0x0414, 0xF089, 0x041A, 0xF08A, 0x0420, 0xF08C, 0x0426, 0xF08E, 0x042C,
0xF08F, 0x0432, 0xF091, 0x0438, 0xF093, 0x043E, 0xF094, 0x0444, 0xF096, 0x044B,
0xF098, 0x0451, 0xF099, 0x0457, 0xF09B, 0x045D, 0xF09D, 0x0463, 0xF09F, 0x0469,
0xF0A0, 0x046F, 0xF0A2, 0x0475, 0xF0A4, 0x047B, 0xF0A6, 0x0481, 0xF0A7, 0x0487,
0xF0A9, 0x048D, 0xF0AB, 0x0493, 0xF0AD, 0x0499, 0xF0AF, 0x049F, 0xF0B0, 0x04A5,
0xF0B2, 0x04AB, 0xF0B4, 0x04B1, 0xF0B6, 0x04B7, 0xF0B8, 0x04BD, 0xF0BA, 0x04C3,
0xF0BB, 0x04C9, 0xF0BD, 0x04CF, 0xF0BF, 0x04D5, 0xF0C1, 0x04DB, 0xF0C3, 0x04E1,
0xF0C5, 0x04E7, 0xF0C7, 0x04ED, 0xF0C9, 0x04F3, 0xF0CB, 0x04F9, 0xF0CD, 0x04FF,
0xF0CF, 0x0505, 0xF0D1, 0x050B, 0xF0D3, 0x0511, 0xF0D5, 0x0517, 0xF0D7, 0x051D,
0xF0D9, 0x0523, 0xF0DB, 0x0529, 0xF0DD, 0x052F, 0xF0DF, 0x0534, 0xF0E1, 0x053A,
0xF0E3, 0x0540, 0xF0E5, 0x0546, 0xF0E7, 0x054C, 0xF0E9, 0x0552, 0xF0EB, 0x0558,
0xF0ED, 0x055E, 0xF0EF, 0x0564, 0xF0F2, 0x056A, 0xF0F4, 0x0570, 0xF0F6, 0x0576,
0xF0F8, 0x057C, 0xF0FA, 0x0581, 0xF0FC, 0x0587, 0xF0FE, 0x058D, 0xF101, 0x0593,
0xF103, 0x0599, 0xF105, 0x059F, 0xF107, 0x05A5, 0xF109, 0x05AB, 0xF10C, 0x05B1,
0xF10E, 0x05B6, 0xF110, 0x05BC, 0xF112, 0x05C2, 0xF115, 0x05C8, 0xF117, 0x05CE,
0xF119, 0x05D4, 0xF11C, 0x05DA, 0xF11E, 0x05DF, 0xF120, 0x05E5, 0xF123, 0x05EB,
0xF125, 0x05F1, 0xF127, 0x05F7, 0xF12A, 0x05FD, 0xF12C, 0x0602, 0xF12E, 0x0608,
0xF131, 0x060E, 0xF133, 0x0614, 0xF135, 0x061A, 0xF138, 0x061F, 0xF13A, 0x0625,
0xF13D, 0x062B, 0xF13F, 0x0631, 0xF141, 0x0637, 0xF144, 0x063C, 0xF146, 0x0642,
0xF149, 0x0648, 0xF14B, 0x064E, 0xF14E, 0x0654, 0xF150, 0x0659, 0xF153, 0x065F,
0xF155, 0x0665, 0xF158, 0x066B, 0xF15A, 0x0670, 0xF15D, 0x0676, 0xF15F, 0x067C,
0xF162, 0x0682, 0xF165, 0x0687, 0xF167, 0x068D, 0xF16A, 0x0693, 0xF16C, 0x0699,
0xF16F, 0x069E, 0xF171, 0x06A4, 0xF174, 0x06AA, 0xF177, 0x06AF, 0xF179, 0x06B5,
0xF17C, 0x06BB, 0xF17F, 0x06C1, 0xF181, 0x06C6, 0xF184, 0x06CC, 0xF187, 0x06D2,
0xF189, 0x06D7, 0xF18C, 0x06DD, 0xF18F, 0x06E3, 0xF191, 0x06E8, 0xF194, 0x06EE,
0xF197, 0x06F4, 0xF19A, 0x06F9, 0xF19C, 0x06FF, 0xF19F, 0x0705, 0xF1A2, 0x070A,
0xF1A5, 0x0710, 0xF1A7, 0x0715, 0xF1AA, 0x071B, 0xF1AD, 0x0721, 0xF1B0, 0x0726,
0xF1B3, 0x072C, 0xF1B5, 0x0732, 0xF1B8, 0x0737, 0xF1BB, 0x073D, 0xF1BE, 0x0742,
0xF1C1, 0x0748, 0xF1C4, 0x074E, 0xF1C6, 0x0753, 0xF1C9, 0x0759, 0xF1CC, 0x075E,
0xF1CF, 0x0764, 0xF1D2, 0x076A, 0xF1D5, 0x076F, 0xF1D8, 0x0775, 0xF1DB, 0x077A,
0xF1DE, 0x0780, 0xF1E1, 0x0785, 0xF1E4, 0x078B, 0xF1E7, 0x0790, 0xF1EA, 0x0796,
0xF1ED, 0x079B, 0xF1F0, 0x07A1, 0xF1F3, 0x07A6, 0xF1F6, 0x07AC, 0xF1F9, 0x07B2,
0xF1FC, 0x07B7, 0xF1FF, 0x07BD, 0xF202, 0x07C2, 0xF205, 0x07C8, 0xF208, 0x07CD,
0xF20B, 0x07D2, 0xF20E, 0x07D8, 0xF211, 0x07DD, 0xF214, 0x07E3, 0xF217, 0x07E8,
0xF21A, 0x07EE, 0xF21D, 0x07F3, 0xF221, 0x07F9, 0xF224, 0x07FE, 0xF227, 0x0804,
0xF22A, 0x0809, 0xF22D, 0x080E, 0xF230, 0x0814, 0xF234, 0x0819, 0xF237, 0x081F,
0xF23A, 0x0824, 0xF23D, 0x082A, 0xF240, 0x082F, 0xF244, 0x0834, 0xF247, 0x083A,
0xF24A, 0x083F, 0xF24D, 0x0845, 0xF250, 0x084A, 0xF254, 0x084F, 0xF257, 0x0855,
0xF25A, 0x085A, 0xF25E, 0x085F, 0xF261, 0x0865, 0xF264, 0x086A, 0xF267, 0x086F,
0xF26B, 0x0875, 0xF26E, 0x087A, 0xF271, 0x087F, 0xF275, 0x0885, 0xF278, 0x088A,
0xF27B, 0x088F, 0xF27F, 0x0895, 0xF282, 0x089A, 0xF286, 0x089F, 0xF289, 0x08A5,
0xF28C, 0x08AA, 0xF290, 0x08AF, 0xF293, 0x08B4, 0xF297, 0x08BA, 0xF29A, 0x08BF,
0xF29E, 0x08C4, 0xF2A1, 0x08C9, 0xF2A4, 0x08CF, 0xF2A8, 0x08D4, 0xF2AB, 0x08D9,
0xF2AF, 0x08DE, 0xF2B2, 0x08E4, 0xF2B6, 0x08E9, 0xF2B9, 0x08EE, 0xF2BD, 0x08F3,
0xF2C0, 0x08F8, 0xF2C4, 0x08FE, 0xF2C7, 0x0903, 0xF2CB, 0x0908, 0xF2CE, 0x090D,
0xF2D2, 0x0912, 0xF2D6, 0x0918, 0xF2D9, 0x091D, 0xF2DD, 0x0922, 0xF2E0, 0x0927,
0xF2E4, 0x092C, 0xF2E8, 0x0931, 0xF2EB, 0x0937, 0xF2EF, 0x093C, 0xF2F2, 0x0941,
0xF2F6, 0x0946, 0xF2FA, 0x094B, 0xF2FD, 0x0950, 0xF301, 0x0955, 0xF305, 0x095A,
0xF308, 0x095F, 0xF30C, 0x0965, 0xF310, 0x096A, 0xF313, 0x096F, 0xF317, 0x0974,
0xF31B, 0x0979, 0xF31F, 0x097E, 0xF322, 0x0983, 0xF326, 0x0988, 0xF32A, 0x098D,
0xF32E, 0x0992, 0xF331, 0x0997, 0xF335, 0x099C, 0xF339, 0x09A1, 0xF33D, 0x09A6,
0xF340, 0x09AB, 0xF344, 0x09B0, 0xF348, 0x09B5, 0xF34C, 0x09BA, 0xF350, 0x09BF,
0xF354, 0x09C4, 0xF357, 0x09C9, 0xF35B, 0x09CE, 0xF35F, 0x09D3, 0xF363, 0x09D8,
0xF367, 0x09DD, 0xF36B, 0x09E2, 0xF36F, 0x09E7, 0xF372, 0x09EC, 0xF376, 0x09F1,
0xF37A, 0x09F6, 0xF37E, 0x09FB, 0xF382, 0x09FF, 0xF386, 0x0A04, 0xF38A, 0x0A09,
0xF38E, 0x0A0E, 0xF392, 0x0A13, 0xF396, 0x0A18, 0xF39A, 0x0A1D, 0xF39E, 0x0A22,
0xF3A2, 0x0A26, 0xF3A6, 0x0A2B, 0xF3AA, 0x0A30, 0xF3AE, 0x0A35, 0xF3B2, 0x0A3A,
0xF3B6, 0x0A3F, 0xF3BA, 0x0A44, 0xF3BE, 0x0A48, 0xF3C2, 0x0A4D, 0xF3C6, 0x0A52,
0xF3CA, 0x0A57, 0xF3CE, 0x0A5C, 0xF3D2, 0x0A60, 0xF3D6, 0x0A65, 0xF3DA, 0x0A6A,
0xF3DE, 0x0A6F, 0xF3E2, 0x0A73, 0xF3E7, 0x0A78, 0xF3EB, 0x0A7D, 0xF3EF, 0x0A82,
0xF3F3, 0x0A86, 0xF3F7, 0x0A8B, 0xF3FB, 0x0A90, 0xF3FF, 0x0A95, 0xF404, 0x0A99,
0xF408, 0x0A9E, 0xF40C, 0x0AA3, 0xF410, 0x0AA7, 0xF414, 0x0AAC, 0xF418, 0x0AB1,
0xF41D, 0x0AB5, 0xF421, 0x0ABA, 0xF425, 0x0ABF, 0xF429, 0x0AC3, 0xF42E, 0x0AC8,
0xF432, 0x0ACD, 0xF436, 0x0AD1, 0xF43A, 0x0AD6, 0xF43F, 0x0ADB, 0xF443, 0x0ADF,
0xF447, 0x0AE4, 0xF44B, 0x0AE8, 0xF450, 0x0AED, 0xF454, 0x0AF2, 0xF458, 0x0AF6,
0xF45D, 0x0AFB, 0xF461, 0x0AFF, 0xF465, 0x0B04, 0xF469, 0x0B08, 0xF46E, 0x0B0D,
0xF472, 0x0B11, 0xF477, 0x0B16, 0xF47B, 0x0B1B, 0xF47F, 0x0B1F, 0xF484, 0x0B24,
0xF488, 0x0B28, 0xF48C, 0x0B2D, 0xF491, 0x0B31, 0xF495, 0x0B36, 0xF49A, 0x0B3A,
0xF49E, 0x0B3E, 0xF4A2, 0x0B43, 0xF4A7, 0x0B47, 0xF4AB, 0x0B4C, 0xF4B0, 0x0B50,
0xF4B4, 0x0B55, 0xF4B9, 0x0B59, 0xF4BD, 0x0B5E, 0xF4C2, 0x0B62, 0xF4C6, 0x0B66,
0xF4CA, 0x0B6B, 0xF4CF, 0x0B6F, 0xF4D3, 0x0B74, 0xF4D8, 0x0B78, 0xF4DC, 0x0B7C,
0xF4E1, 0x0B81, 0xF4E5, 0x0B85, 0xF4EA, 0x0B89, 0xF4EF, 0x0B8E, 0xF4F3, 0x0B92,
0xF4F8, 0x0B97, 0xF4FC, 0x0B9B, 0xF501, 0x0B9F, 0xF505, 0x0BA3, 0xF50A, 0x0BA8,
0xF50E, 0x0BAC, 0xF513, 0x0BB0, 0xF518, 0x0BB5, 0xF51C, 0x0BB9, 0xF521, 0x0BBD,
0xF525, 0x0BC1, 0xF52A, 0x0BC6, 0xF52F, 0x0BCA, 0xF533, 0x0BCE, 0xF538, 0x0BD2,
0xF53D, 0x0BD7, 0xF541, 0x0BDB, 0xF546, 0x0BDF, 0xF54B, 0x0BE3, 0xF54F, 0x0BE8,
0xF554, 0x0BEC, 0xF559, 0x0BF0, 0xF55D, 0x0BF4, 0xF562, 0x0BF8, 0xF567, 0x0BFC,
0xF56B, 0x0C01, 0xF570, 0x0C05, 0xF575, 0x0C09, 0xF57A, 0x0C0D, 0xF57E, 0x0C11,
0xF583, 0x0C15, 0xF588, 0x0C19, 0xF58D, 0x0C1E, 0xF591, 0x0C22, 0xF596, 0x0C26,
0xF59B, 0x0C2A, 0xF5A0, 0x0C2E, 0xF5A4, 0x0C32, 0xF5A9, 0x0C36, 0xF5AE, 0x0C3A,
0xF5B3, 0x0C3E, 0xF5B8, 0x0C42, 0xF5BC, 0x0C46, 0xF5C1, 0x0C4A, 0xF5C6, 0x0C4E,
0xF5CB, 0x0C52, 0xF5D0, 0x0C56, 0xF5D5, 0x0C5A, 0xF5DA, 0x0C5E, 0xF5DE, 0x0C62,
0xF5E3, 0x0C66, 0xF5E8, 0x0C6A, 0xF5ED, 0x0C6E, 0xF5F2, 0x0C72, 0xF5F7, 0x0C76,
0xF5FC, 0x0C7A, 0xF601, 0x0C7E, 0xF605, 0x0C82, 0xF60A, 0x0C86, 0xF60F, 0x0C8A,
0xF614, 0x0C8E, 0xF619, 0x0C91, 0xF61E, 0x0C95, 0xF623, 0x0C99, 0xF628, 0x0C9D,
0xF62D, 0x0CA1, 0xF632, 0x0CA5, 0xF637, 0x0CA9, 0xF63C, 0x0CAC, 0xF641, 0x0CB0,
0xF646, 0x0CB4, 0xF64B, 0x0CB8, 0xF650, 0x0CBC, 0xF655, 0x0CC0, 0xF65A, 0x0CC3,
0xF65F, 0x0CC7, 0xF664, 0x0CCB, 0xF669, 0x0CCF, 0xF66E, 0x0CD2, 0xF673, 0x0CD6,
0xF678, 0x0CDA, 0xF67D, 0x0CDE, 0xF682, 0x0CE1, 0xF687, 0x0CE5, 0xF68C, 0x0CE9,
0xF691, 0x0CED, 0xF696, 0x0CF0, 0xF69B, 0x0CF4, 0xF6A1, 0x0CF8, 0xF6A6, 0x0CFB,
0xF6AB, 0x0CFF, 0xF6B0, 0x0D03, 0xF6B5, 0x0D06, 0xF6BA, 0x0D0A, 0xF6BF, 0x0D0E,
0xF6C4, 0x0D11, 0xF6C9, 0x0D15, 0xF6CF, 0x0D18, 0xF6D4, 0x0D1C, 0xF6D9, 0x0D20,
0xF6DE, 0x0D23, 0xF6E3, 0x0D27, 0xF6E8, 0x0D2A, 0xF6EE, 0x0D2E, 0xF6F3, 0x0D32,
0xF6F8, 0x0D35, 0xF6FD, 0x0D39, 0xF702, 0x0D3C, 0xF708, 0x0D40, 0xF70D, 0x0D43,
0xF712, 0x0D47, 0xF717, 0x0D4A, 0xF71C, 0x0D4E, 0xF722, 0x0D51, 0xF727, 0x0D55,
0xF72C, 0x0D58, 0xF731, 0x0D5C, 0xF737, 0x0D5F, 0xF73C, 0x0D62, 0xF741, 0x0D66,
0xF746, 0x0D69, 0xF74C, 0x0D6D, 0xF751, 0x0D70, 0xF756, 0x0D74, 0xF75B, 0x0D77,
0xF761, 0x0D7A, 0xF766, 0x0D7E, 0xF76B, 0x0D81, 0xF771, 0x0D85, 0xF776, 0x0D88,
0xF77B, 0x0D8B, 0xF781, 0x0D8F, 0xF786, 0x0D92, 0xF78B, 0x0D95, 0xF791, 0x0D99,
0xF796, 0x0D9C, 0xF79B, 0x0D9F, 0xF7A1, 0x0DA2, 0xF7A6, 0x0DA6, 0xF7AB, 0x0DA9,
0xF7B1, 0x0DAC, 0xF7B6, 0x0DB0, 0xF7BB, 0x0DB3, 0xF7C1, 0x0DB6, 0xF7C6, 0x0DB9,
0xF7CC, 0x0DBC, 0xF7D1, 0x0DC0, 0xF7D6, 0x0DC3, 0xF7DC, 0x0DC6, 0xF7E1, 0x0DC9,
0xF7E7, 0x0DCC, 0xF7EC, 0x0DD0, 0xF7F2, 0x0DD3, 0xF7F7, 0x0DD6, 0xF7FC, 0x0DD9,
0xF802, 0x0DDC, 0xF807, 0x0DDF, 0xF80D, 0x0DE3, 0xF812, 0x0DE6, 0xF818, 0x0DE9,
0xF81D, 0x0DEC, 0xF823, 0x0DEF, 0xF828, 0x0DF2, 0xF82E, 0x0DF5, 0xF833, 0x0DF8,
0xF838, 0x0DFB, 0xF83E, 0x0DFE, 0xF843, 0x0E01, 0xF849, 0x0E04, 0xF84E, 0x0E07,
0xF854, 0x0E0A, 0xF85A, 0x0E0D, 0xF85F, 0x0E10, 0xF865, 0x0E13, 0xF86A, 0x0E16,
0xF870, 0x0E19, 0xF875, 0x0E1C, 0xF87B, 0x0E1F, 0xF880, 0x0E22, 0xF886, 0x0E25,
0xF88B, 0x0E28, 0xF891, 0x0E2B, 0xF896, 0x0E2E, 0xF89C, 0x0E31, 0xF8A2, 0x0E34,
0xF8A7, 0x0E37, 0xF8AD, 0x0E3A, 0xF8B2, 0x0E3C, 0xF8B8, 0x0E3F, 0xF8BE, 0x0E42,
0xF8C3, 0x0E45, 0xF8C9, 0x0E48, 0xF8CE, 0x0E4B, 0xF8D4, 0x0E4D, 0xF8DA, 0x0E50,
0xF8DF, 0x0E53, 0xF8E5, 0x0E56, 0xF8EB, 0x0E59, 0xF8F0, 0x0E5B, 0xF8F6, 0x0E5E,
0xF8FB, 0x0E61, 0xF901, 0x0E64, 0xF907, 0x0E66, 0xF90C, 0x0E69, 0xF912, 0x0E6C,
0xF918, 0x0E6F, 0xF91D, 0x0E71, 0xF923, 0x0E74, 0xF929, 0x0E77, 0xF92E, 0x0E79,
0xF934, 0x0E7C, 0xF93A, 0x0E7F, 0xF93F, 0x0E81, 0xF945, 0x0E84, 0xF94B, 0x0E87,
0xF951, 0x0E89, 0xF956, 0x0E8C, 0xF95C, 0x0E8F, 0xF962, 0x0E91, 0xF967, 0x0E94,
0xF96D, 0x0E96, 0xF973, 0x0E99, 0xF979, 0x0E9B, 0xF97E, 0x0E9E, 0xF984, 0x0EA1,
0xF98A, 0x0EA3, 0xF990, 0x0EA6, 0xF995, 0x0EA8, 0xF99B, 0x0EAB, 0xF9A1, 0x0EAD,
0xF9A7, 0x0EB0, 0xF9AC, 0x0EB2, 0xF9B2, 0x0EB5, 0xF9B8, 0x0EB7, 0xF9BE, 0x0EBA,
0xF9C4, 0x0EBC, 0xF9C9, 0x0EBF, 0xF9CF, 0x0EC1, 0xF9D5, 0x0EC3, 0xF9DB, 0x0EC6,
0xF9E1, 0x0EC8, 0xF9E6, 0x0ECB, 0xF9EC, 0x0ECD, 0xF9F2, 0x0ECF, 0xF9F8, 0x0ED2,
0xF9FE, 0x0ED4, 0xFA03, 0x0ED6, 0xFA09, 0x0ED9, 0xFA0F, 0x0EDB, 0xFA15, 0x0EDD,
0xFA1B, 0x0EE0, 0xFA21, 0x0EE2, 0xFA26, 0x0EE4, 0xFA2C, 0x0EE7, 0xFA32, 0x0EE9,
0xFA38, 0x0EEB, 0xFA3E, 0x0EEE, 0xFA44, 0x0EF0, 0xFA4A, 0x0EF2, 0xFA4F, 0x0EF4,
0xFA55, 0x0EF7, 0xFA5B, 0x0EF9, 0xFA61, 0x0EFB, 0xFA67, 0x0EFD, 0xFA6D, 0x0EFF,
0xFA73, 0x0F02, 0xFA79, 0x0F04, 0xFA7F, 0x0F06, 0xFA84, 0x0F08, 0xFA8A, 0x0F0A,
0xFA90, 0x0F0C, 0xFA96, 0x0F0E, 0xFA9C, 0x0F11, 0xFAA2, 0x0F13, 0xFAA8, 0x0F15,
0xFAAE, 0x0F17, 0xFAB4, 0x0F19, 0xFABA, 0x0F1B, 0xFAC0, 0x0F1D, 0xFAC6, 0x0F1F,
0xFACC, 0x0F21, 0xFAD1, 0x0F23, 0xFAD7, 0x0F25, 0xFADD, 0x0F27, 0xFAE3, 0x0F29,
0xFAE9, 0x0F2B, 0xFAEF, 0x0F2D, 0xFAF5, 0x0F2F, 0xFAFB, 0x0F31, 0xFB01, 0x0F33,
0xFB07, 0x0F35, 0xFB0D, 0x0F37, 0xFB13, 0x0F39, 0xFB19, 0x0F3B, 0xFB1F, 0x0F3D,
0xFB25, 0x0F3F, 0xFB2B, 0x0F41, 0xFB31, 0x0F43, 0xFB37, 0x0F45, 0xFB3D, 0x0F46,
0xFB43, 0x0F48, 0xFB49, 0x0F4A, 0xFB4F, 0x0F4C, 0xFB55, 0x0F4E, 0xFB5B, 0x0F50,
0xFB61, 0x0F51, 0xFB67, 0x0F53, 0xFB6D, 0x0F55, 0xFB73, 0x0F57, 0xFB79, 0x0F59,
0xFB7F, 0x0F5A, 0xFB85, 0x0F5C, 0xFB8B, 0x0F5E, 0xFB91, 0x0F60, 0xFB97, 0x0F61,
0xFB9D, 0x0F63, 0xFBA3, 0x0F65, 0xFBA9, 0x0F67, 0xFBAF, 0x0F68, 0xFBB5, 0x0F6A,
0xFBBC, 0x0F6C, 0xFBC2, 0x0F6D, 0xFBC8, 0x0F6F, 0xFBCE, 0x0F71, 0xFBD4, 0x0F72,
0xFBDA, 0x0F74, 0xFBE0, 0x0F76, 0xFBE6, 0x0F77, 0xFBEC, 0x0F79, 0xFBF2, 0x0F7A,
0xFBF8, 0x0F7C, 0xFBFE, 0x0F7D, 0xFC04, 0x0F7F, 0xFC0A, 0x0F81, 0xFC11, 0x0F82,
0xFC17, 0x0F84, 0xFC1D, 0x0F85, 0xFC23, 0x0F87, 0xFC29, 0x0F88, 0xFC2F, 0x0F8A,
0xFC35, 0x0F8B, 0xFC3B, 0x0F8D, 0xFC41, 0x0F8E, 0xFC47, 0x0F90, 0xFC4E, 0x0F91,
0xFC54, 0x0F93, 0xFC5A, 0x0F94, 0xFC60, 0x0F95, 0xFC66, 0x0F97, 0xFC6C, 0x0F98,
0xFC72, 0x0F9A, 0xFC78, 0x0F9B, 0xFC7F, 0x0F9C, 0xFC85, 0x0F9E, 0xFC8B, 0x0F9F,
0xFC91, 0x0FA1, 0xFC97, 0x0FA2, 0xFC9D, 0x0FA3, 0xFCA3, 0x0FA5, 0xFCAA, 0x0FA6,
0xFCB0, 0x0FA7, 0xFCB6, 0x0FA8, 0xFCBC, 0x0FAA, 0xFCC2, 0x0FAB, 0xFCC8, 0x0FAC,
0xFCCE, 0x0FAE, 0xFCD5, 0x0FAF, 0xFCDB, 0x0FB0, 0xFCE1, 0x0FB1, 0xFCE7, 0x0FB3,
0xFCED, 0x0FB4, 0xFCF3, 0x0FB5, 0xFCFA, 0x0FB6, 0xFD00, 0x0FB7, 0xFD06, 0x0FB8,
0xFD0C, 0x0FBA, 0xFD12, 0x0FBB, 0xFD18, 0x0FBC, 0xFD1F, 0x0FBD, 0xFD25, 0x0FBE,
0xFD2B, 0x0FBF, 0xFD31, 0x0FC0, 0xFD37, 0x0FC2, 0xFD3E, 0x0FC3, 0xFD44, 0x0FC4,
0xFD4A, 0x0FC5, 0xFD50, 0x0FC6, 0xFD56, 0x0FC7, 0xFD5D, 0x0FC8, 0xFD63, 0x0FC9,
0xFD69, 0x0FCA, 0xFD6F, 0x0FCB, 0xFD75, 0x0FCC, 0xFD7C, 0x0FCD, 0xFD82, 0x0FCE,
0xFD88, 0x0FCF, 0xFD8E, 0x0FD0, 0xFD94, 0x0FD1, 0xFD9B, 0x0FD2, 0xFDA1, 0x0FD3,
0xFDA7, 0x0FD4, 0xFDAD, 0x0FD5, 0xFDB3, 0x0FD5, 0xFDBA, 0x0FD6, 0xFDC0, 0x0FD7,
0xFDC6, 0x0FD8, 0xFDCC, 0x0FD9, 0xFDD3, 0x0FDA, 0xFDD9, 0x0FDB, 0xFDDF, 0x0FDC,
0xFDE5, 0x0FDC, 0xFDEB, 0x0FDD, 0xFDF2, 0x0FDE, 0xFDF8, 0x0FDF, 0xFDFE, 0x0FE0,
0xFE04, 0x0FE0, 0xFE0B, 0x0FE1, 0xFE11, 0x0FE2, 0xFE17, 0x0FE3, 0xFE1D, 0x0FE3,
0xFE24, 0x0FE4, 0xFE2A, 0x0FE5, 0xFE30, 0x0FE6, 0xFE36, 0x0FE6, 0xFE3D, 0x0FE7,
0xFE43, 0x0FE8, 0xFE49, 0x0FE8, 0xFE4F, 0x0FE9, 0xFE56, 0x0FEA, 0xFE5C, 0x0FEA,
0xFE62, 0x0FEB, 0xFE68, 0x0FEC, 0xFE6F, 0x0FEC, 0xFE75, 0x0FED, 0xFE7B, 0x0FED,
0xFE81, 0x0FEE, 0xFE88, 0x0FEF, 0xFE8E, 0x0FEF, 0xFE94, 0x0FF0, 0xFE9A, 0x0FF0,
0xFEA1, 0x0FF1, 0xFEA7, 0x0FF1, 0xFEAD, 0x0FF2, 0xFEB3, 0x0FF2, 0xFEBA, 0x0FF3,
0xFEC0, 0x0FF3, 0xFEC6, 0x0FF4, 0xFECC, 0x0FF4, 0xFED3, 0x0FF5, 0xFED9, 0x0FF5,
0xFEDF, 0x0FF6, 0xFEE5, 0x0FF6, 0xFEEC, 0x0FF7, 0xFEF2, 0x0FF7, 0xFEF8, 0x0FF8,
0xFEFF, 0x0FF8, 0xFF05, 0x0FF8, 0xFF0B, 0x0FF9, 0xFF11, 0x0FF9, 0xFF18, 0x0FF9,
0xFF1E, 0x0FFA, 0xFF24, 0x0FFA, 0xFF2A, 0x0FFA, 0xFF31, 0x0FFB, 0xFF37, 0x0FFB,
0xFF3D, 0x0FFB, 0xFF44, 0x0FFC, 0xFF4A, 0x0FFC, 0xFF50, 0x0FFC, 0xFF56, 0x0FFC,
0xFF5D, 0x0FFD, 0xFF63, 0x0FFD, 0xFF69, 0x0FFD, 0xFF70, 0x0FFD, 0xFF76, 0x0FFE,
0xFF7C, 0x0FFE, 0xFF82, 0x0FFE, 0xFF89, 0x0FFE, 0xFF8F, 0x0FFE, 0xFF95, 0x0FFF,
0xFF9B, 0x0FFF, 0xFFA2, 0x0FFF, 0xFFA8, 0x0FFF, 0xFFAE, 0x0FFF, 0xFFB5, 0x0FFF,
0xFFBB, 0x0FFF, 0xFFC1, 0x1000, 0xFFC7, 0x1000, 0xFFCE, 0x1000, 0xFFD4, 0x1000,
0xFFDA, 0x1000, 0xFFE1, 0x1000, 0xFFE7, 0x1000, 0xFFED, 0x1000, 0xFFF3, 0x1000,
0xFFFA, 0x1000,
};

View File

@ -1,26 +0,0 @@
short SQRT[] = {
0x1000, 0x101f, 0x103f, 0x105e, 0x107e, 0x109c, 0x10bb, 0x10da,
0x10f8, 0x1116, 0x1134, 0x1152, 0x116f, 0x118c, 0x11a9, 0x11c6,
0x11e3, 0x1200, 0x121c, 0x1238, 0x1254, 0x1270, 0x128c, 0x12a7,
0x12c2, 0x12de, 0x12f9, 0x1314, 0x132e, 0x1349, 0x1364, 0x137e,
0x1398, 0x13b2, 0x13cc, 0x13e6, 0x1400, 0x1419, 0x1432, 0x144c,
0x1465, 0x147e, 0x1497, 0x14b0, 0x14c8, 0x14e1, 0x14f9, 0x1512,
0x152a, 0x1542, 0x155a, 0x1572, 0x158a, 0x15a2, 0x15b9, 0x15d1,
0x15e8, 0x1600, 0x1617, 0x162e, 0x1645, 0x165c, 0x1673, 0x1689,
0x16a0, 0x16b7, 0x16cd, 0x16e4, 0x16fa, 0x1710, 0x1726, 0x173c,
0x1752, 0x1768, 0x177e, 0x1794, 0x17aa, 0x17bf, 0x17d5, 0x17ea,
0x1800, 0x1815, 0x182a, 0x183f, 0x1854, 0x1869, 0x187e, 0x1893,
0x18a8, 0x18bd, 0x18d1, 0x18e6, 0x18fa, 0x190f, 0x1923, 0x1938,
0x194c, 0x1960, 0x1974, 0x1988, 0x199c, 0x19b0, 0x19c4, 0x19d8,
0x19ec, 0x1a00, 0x1a13, 0x1a27, 0x1a3a, 0x1a4e, 0x1a61, 0x1a75,
0x1a88, 0x1a9b, 0x1aae, 0x1ac2, 0x1ad5, 0x1ae8, 0x1afb, 0x1b0e,
0x1b21, 0x1b33, 0x1b46, 0x1b59, 0x1b6c, 0x1b7e, 0x1b91, 0x1ba3,
0x1bb6, 0x1bc8, 0x1bdb, 0x1bed, 0x1c00, 0x1c12, 0x1c24, 0x1c36,
0x1c48, 0x1c5a, 0x1c6c, 0x1c7e, 0x1c90, 0x1ca2, 0x1cb4, 0x1cc6,
0x1cd8, 0x1ce9, 0x1cfb, 0x1d0d, 0x1d1e, 0x1d30, 0x1d41, 0x1d53,
0x1d64, 0x1d76, 0x1d87, 0x1d98, 0x1daa, 0x1dbb, 0x1dcc, 0x1ddd,
0x1dee, 0x1e00, 0x1e11, 0x1e22, 0x1e33, 0x1e43, 0x1e54, 0x1e65,
0x1e76, 0x1e87, 0x1e98, 0x1ea8, 0x1eb9, 0x1eca, 0x1eda, 0x1eeb,
0x1efb, 0x1f0c, 0x1f1c, 0x1f2d, 0x1f3d, 0x1f4e, 0x1f5e, 0x1f6e,
0x1f7e, 0x1f8f, 0x1f9f, 0x1faf, 0x1fbf, 0x1fcf, 0x1fdf, 0x1fef
};

View File

@ -1,97 +0,0 @@
#ifndef ISO9660_H
#define ISO9660_H
/*
* Sub-header info
*
+----------------------+--------------------------------------------------+
| | Interleaved file (1 byte)
| | 1 if this file is interleaved, or 0 if not
| byte 1 |
+-- --+------------------------------------------------------------+
| | Channel number (1 byte)
| | The sub-channel in this 'file'. Video, audio and data
| | sectors can be mixed into the same channel or can be
| | on separate channels. Usually used for multiple audio
| | tracks (e.g. 5 different songs in the same 'file', on
| | channels 0, 1, 2, 3 and 4)
| byte 2 |
+-- --+------------------------------------------------------------+
| | Submode (1 byte)
| | bit 7: eof_marker -- set if this sector is the end
| | of the 'file'
| | bit 6: real_time -- always set in PSX STR streams
| | bit 5: form -- 0 = Form 1 (2048 user data bytes)
| | 1 = Form 2 (2324 user data bytes)
| | bit 4: trigger -- for use by reader application
| | (unimportant)
| | bit 3: DATA -- set to indicate DATA sector
| | bit 2: AUDIO -- set to indicate AUDIO sector
| | bit 1: VIDEO -- set to indicate VIDEO sector
| | bit 0: end_audio -- end of audio frame
| | (rarely set in PSX STR streams)
| |
| | bits 1, 2 and 3 are mutually exclusive
| byte 3 |
+-- --+------------------------------------------------------------+
| | Coding info (1 byte)
| | If Submode.AUDIO bit is set:
| | bit 7: reserved -- should always be 0
| | bit 6: emphasis -- boost audio volume (ignored by us)
| | bit 5: bitssamp -- must always be 0
| | bit 4: bitssamp -- 0 for mode B/C
| | (4 bits/sample, 8 sound sectors)
| | 1 for mode A
| | (8 bits/sample, 4 sound sectors)
| | bit 3: samprate -- must always be 0
| | bit 2: samprate -- 0 for 37.8kHz playback
| | 1 for 18.9kHz playback
| | bit 1: stereo -- must always be 0
| | bit 0: stereo -- 0 for mono sound, 1 for stereo sound
| |
| | If Submode.AUDIO bit is NOT set, this byte can be ignored
| byte 4 |
+-- --+------------------------------------------------------------+
| byte 5-8 | Duplicated
*/
#define CD_ROOT_DIRECTORY_SECTOR 22
#define CD_SECTOR_SIZE 2048
#define CD_SECTOR_SIZE_MODE2 2352 // MODE2/2352
#pragma pack(push, 1)
typedef struct
{
u_char tocEntryLength;
u_char extEntryLength;
u_int sectorPosition[2];
u_int fileSize[2];
u_char date[7];
u_char flags;
u_char fileUnitSize;
u_char interleaveGapSize;
u_short volSeqNum[2];
u_char nameLength;
} TOC;
typedef struct
{
u_char sync[12]; /// Sync pattern (usually 00 FF FF FF FF FF FF FF FF FF FF 00)
u_char addr[3]; /// Sector address (see below for encoding details)
u_char mode; /// Mode (usually 2 for Mode 2 Form 1/2 sectors)
u_char subHead[8]; /// Sub-header (00 00 08 00 00 00 08 00 for Form 1 data sectors). See below for more
u_char data[2048]; /// Data (form 1)
u_char edc[4]; /// Error-detection code (CRC32 of data area)
u_char ecc[276]; /// Error-correction code (uses Reed-Solomon ECC algorithm)
} Sector;
typedef struct
{
u_char sync[12]; /// Sync pattern (usually 00 FF FF FF FF FF FF FF FF FF FF 00)
u_char addr[3]; /// Sector address (a 24-bit big-endian integer. starts at 200, 201 an onwards)
u_char mode; /// Mode (usually 2 for Mode 2 Form 1/2 sectors)
u_char data[2336]; /// 8 bytes Subheader, 2324 bytes Data (form 2), and 4 bytes ECC
} AudioSector;
#pragma pack(pop)
#endif

View File

@ -1,455 +0,0 @@
#include "psx/libpad.h"
#include "psx/libetc.h"
#include "../PsyX_main.h"
#include "PsyX_pad.h"
#include "PsyX/PsyX_public.h"
#include <string.h>
extern "C"
{
extern int g_padCommEnable;
}
typedef struct
{
Sint32 deviceId; // linked device Id
SDL_GameController* gc;
u_char* padData;
bool switchingAnalog;
} PsyXController;
PsyXController g_controllers[MAX_CONTROLLERS];
int g_controllerToSlotMapping[MAX_CONTROLLERS] = { -1, -1 };
const u_char* g_sdlKeyboardState = NULL;
u_short PsyX_Pad_UpdateKeyboardInput();
void PsyX_Pad_UpdateGameControllerInput(SDL_GameController* cont, LPPADRAW pad);
// Initializes SDL controllers
int PsyX_Pad_InitSystem()
{
// do not init second time!
if (g_sdlKeyboardState != NULL)
return 1;
memset(g_controllers, 0, sizeof(g_controllers));
// init keyboard state
g_sdlKeyboardState = SDL_GetKeyboardState(NULL);
if (SDL_InitSubSystem(SDL_INIT_GAMECONTROLLER | SDL_INIT_HAPTIC) < 0)
{
eprinterr("Failed to initialise SDL GameController subsystem!\n");
return 0;
}
// Add more controllers from custom file
SDL_GameControllerAddMappingsFromFile("gamecontrollerdb.txt");
return 1;
}
// Prints controller list into console
void PsyX_Pad_Debug_ListControllers()
{
int numJoysticks = SDL_NumJoysticks();
int numHaptics = SDL_NumHaptics();
if (numJoysticks)
{
eprintf("SDL GameController list:\n");
for (int i = 0; i < numJoysticks; i++)
{
if (SDL_IsGameController(i))
{
eprintinfo(" %d '%s'\n", i, SDL_GameControllerNameForIndex(i));
}
}
}
else
eprintwarn("No SDL GameControllers found!\n");
if (numHaptics)
{
eprintf("SDL haptic list:\n");
for (int i = 0; i < numHaptics; i++)
{
eprintinfo(" %d '%s'\n", i, SDL_HapticName(i));
}
}
else
eprintwarn("No SDL haptics found!\n");
}
// Opens specific system controller and assigns to specified slot
void PsyX_Pad_OpenController(Sint32 deviceId, int slot)
{
PsyXController* controller = &g_controllers[slot];
if (controller->gc)
{
return;
}
controller->gc = SDL_GameControllerOpen(deviceId);
controller->switchingAnalog = false;
if (controller->gc)
{
// assign device id automatically
if (controller->deviceId == -1)
controller->deviceId = deviceId;
}
}
// Closes controller in specific slot
void PsyX_Pad_CloseController(int slot)
{
PsyXController* controller = &g_controllers[slot];
SDL_GameControllerClose(controller->gc);
controller->gc = NULL;
}
// Called from LIBPAD
void PsyX_Pad_InitPad(int slot, u_char* padData)
{
PsyXController* controller = &g_controllers[slot];
controller->padData = padData;
controller->deviceId = g_controllerToSlotMapping[slot];
if (padData)
{
LPPADRAW pad = (LPPADRAW)padData;
bool wasConnected = (pad->id == 0x41 || pad->id == 0x73);
if(!wasConnected)
pad->id = slot == 0 ? 0x41 : 0xFF; // since keyboard is a main controller - it's always on
// only reset buttons
pad->buttons[0] = 0xFF;
pad->buttons[1] = 0xFF;
pad->analog[0] = 128;
pad->analog[1] = 128;
pad->analog[2] = 128;
pad->analog[3] = 128;
}
}
// called from Psy-X SDL events
void PsyX_Pad_Event_ControllerAdded(Sint32 deviceId)
{
int i;
PsyXController* controller;
// reinitialize haptics (why we still here?)
SDL_QuitSubSystem(SDL_INIT_HAPTIC); // FIXME: this will crash if you already have haptics
SDL_InitSubSystem(SDL_INIT_HAPTIC);
PsyX_Pad_Debug_ListControllers();
// find mapping and open
for (i = 0; i < MAX_CONTROLLERS; i++)
{
controller = &g_controllers[i];
if (controller->deviceId == -1 || controller->deviceId == deviceId)
{
PsyX_Pad_OpenController(deviceId, i);
break;
}
}
}
// called from Psy-X SDL events
void PsyX_Pad_Event_ControllerRemoved(Sint32 deviceId)
{
int i;
PsyXController* controller;
PsyX_Pad_Debug_ListControllers();
// find mapping and close
for (int i = 0; i < MAX_CONTROLLERS; i++)
{
controller = &g_controllers[i];
if (controller->deviceId == deviceId)
{
PsyX_Pad_CloseController(i);
}
}
}
void PsyX_Pad_InternalPadUpdates()
{
PsyXController* controller;
LPPADRAW pad;
u_short kbInputs;
if (g_padCommEnable == 0)
return;
kbInputs = PsyX_Pad_UpdateKeyboardInput();
for (int i = 0; i < MAX_CONTROLLERS; i++)
{
controller = &g_controllers[i];
if (controller->padData)
{
pad = (LPPADRAW)controller->padData;
PsyX_Pad_UpdateGameControllerInput(controller->gc, pad);
ushort test = *(u_short*)pad->buttons;
// In order to switch From/To analog user has to use left gamepad stick
// Select + Start pressed
if ((test & 0x1) == 0 && (test & 0x8) == 0)
{
*(u_short*)pad->buttons = 0xffff;
if (!controller->switchingAnalog)
{
// switch to analog state
if (pad->id == 0x41)
{
eprintf("Port %d ANALOG: ON\n", i + 1);
pad->id = 0x73;
}
else
{
eprintf("Port %d ANALOG: OFF\n", i + 1);
pad->id = 0x41;
}
}
controller->switchingAnalog = true;
}
else
{
controller->switchingAnalog = false;
}
// Update keyboard for PAD
if ((g_activeKeyboardControllers & (1 << i)) && kbInputs != 0xffff)
{
pad->status = 0; // PadStateStable?
if (pad->id != 0x41)
{
if(pad->id != 0x73)
eprintf("Port %d ANALOG: OFF\n", i + 1);
pad->id = 0x41; // force disable analog
}
*(u_short*)pad->buttons &= kbInputs;
}
}
}
#if defined(__ANDROID__)
///@TODO SDL_NumJoysticks always reports > 0 for some reason on Android.
#endif
}
int GetControllerButtonState(SDL_GameController* cont, int buttonOrAxis)
{
if (buttonOrAxis & CONTROLLER_MAP_FLAG_AXIS)
{
int value = SDL_GameControllerGetAxis(cont, (SDL_GameControllerAxis)(buttonOrAxis & ~(CONTROLLER_MAP_FLAG_AXIS | CONTROLLER_MAP_FLAG_INVERSE)));
if (abs(value) > 500 && (buttonOrAxis & CONTROLLER_MAP_FLAG_INVERSE))
value *= -1;
return value;
}
return SDL_GameControllerGetButton(cont, (SDL_GameControllerButton)buttonOrAxis) * 32767;
}
void PsyX_Pad_UpdateGameControllerInput(SDL_GameController* cont, LPPADRAW pad)
{
short leftX, leftY, rightX, rightY;
u_short ret = 0xFFFF;
if (!cont)
{
pad->analog[0] = 127;
pad->analog[1] = 127;
pad->analog[2] = 127;
pad->analog[3] = 127;
*(u_short*)pad->buttons = ret;
return;
}
if (GetControllerButtonState(cont, g_controller_mapping.gc_square) > 16384)//Square
ret &= ~0x8000;
if (GetControllerButtonState(cont, g_controller_mapping.gc_circle) > 16384)//Circle
ret &= ~0x2000;
if (GetControllerButtonState(cont, g_controller_mapping.gc_triangle) > 16384)//Triangle
ret &= ~0x1000;
if (GetControllerButtonState(cont, g_controller_mapping.gc_cross) > 16384)//Cross
ret &= ~0x4000;
if (GetControllerButtonState(cont, g_controller_mapping.gc_l1) > 16384)//L1
ret &= ~0x400;
if (GetControllerButtonState(cont, g_controller_mapping.gc_r1) > 16384)//R1
ret &= ~0x800;
if (GetControllerButtonState(cont, g_controller_mapping.gc_l2) > 16384)//L2
ret &= ~0x100;
if (GetControllerButtonState(cont, g_controller_mapping.gc_r2) > 16384)//R2
ret &= ~0x200;
if (GetControllerButtonState(cont, g_controller_mapping.gc_dpad_up) > 16384)//UP
ret &= ~0x10;
if (GetControllerButtonState(cont, g_controller_mapping.gc_dpad_down) > 16384)//DOWN
ret &= ~0x40;
if (GetControllerButtonState(cont, g_controller_mapping.gc_dpad_left) > 16384)//LEFT
ret &= ~0x80;
if (GetControllerButtonState(cont, g_controller_mapping.gc_dpad_right) > 16384)//RIGHT
ret &= ~0x20;
if (GetControllerButtonState(cont, g_controller_mapping.gc_l3) > 16384)//L3
ret &= ~0x2;
if (GetControllerButtonState(cont, g_controller_mapping.gc_r3) > 16384)//R3
ret &= ~0x4;
if (GetControllerButtonState(cont, g_controller_mapping.gc_select) > 16384)//SELECT
ret &= ~0x1;
if (GetControllerButtonState(cont, g_controller_mapping.gc_start) > 16384)//START
ret &= ~0x8;
leftX = GetControllerButtonState(cont, g_controller_mapping.gc_axis_left_x);
leftY = GetControllerButtonState(cont, g_controller_mapping.gc_axis_left_y);
rightX = GetControllerButtonState(cont, g_controller_mapping.gc_axis_right_x);
rightY = GetControllerButtonState(cont, g_controller_mapping.gc_axis_right_y);
*(u_short*)pad->buttons = ret;
// map to range
pad->analog[0] = (rightX / 256) + 128;
pad->analog[1] = (rightY / 256) + 128;
pad->analog[2] = (leftX / 256) + 128;
pad->analog[3] = (leftY / 256) + 128;
}
u_short PsyX_Pad_UpdateKeyboardInput()
{
u_short ret = 0xFFFF;
//Not initialised yet
if (g_sdlKeyboardState == NULL)
return ret;
SDL_PumpEvents();
if (g_sdlKeyboardState[g_keyboard_mapping.kc_square])//Square
ret &= ~0x8000;
if (g_sdlKeyboardState[g_keyboard_mapping.kc_circle])//Circle
ret &= ~0x2000;
if (g_sdlKeyboardState[g_keyboard_mapping.kc_triangle])//Triangle
ret &= ~0x1000;
if (g_sdlKeyboardState[g_keyboard_mapping.kc_cross])//Cross
ret &= ~0x4000;
if (g_sdlKeyboardState[g_keyboard_mapping.kc_l1])//L1
ret &= ~0x400;
if (g_sdlKeyboardState[g_keyboard_mapping.kc_l2])//L2
ret &= ~0x100;
if (g_sdlKeyboardState[g_keyboard_mapping.kc_l3])//L3
ret &= ~0x2;
if (g_sdlKeyboardState[g_keyboard_mapping.kc_r1])//R1
ret &= ~0x800;
if (g_sdlKeyboardState[g_keyboard_mapping.kc_r2])//R2
ret &= ~0x200;
if (g_sdlKeyboardState[g_keyboard_mapping.kc_r3])//R3
ret &= ~0x4;
if (g_sdlKeyboardState[g_keyboard_mapping.kc_dpad_up])//UP
ret &= ~0x10;
if (g_sdlKeyboardState[g_keyboard_mapping.kc_dpad_down])//DOWN
ret &= ~0x40;
if (g_sdlKeyboardState[g_keyboard_mapping.kc_dpad_left])//LEFT
ret &= ~0x80;
if (g_sdlKeyboardState[g_keyboard_mapping.kc_dpad_right])//RIGHT
ret &= ~0x20;
if (g_sdlKeyboardState[g_keyboard_mapping.kc_select])//SELECT
ret &= ~0x1;
if (g_sdlKeyboardState[g_keyboard_mapping.kc_start])//START
ret &= ~0x8;
return ret;
}
int PsyX_Pad_GetStatus(int mtap, int slot)
{
PsyXController* controller;
if (slot == 0)
return 1; // keyboard always here
controller = &g_controllers[slot];
if (controller->gc && SDL_GameControllerGetAttached(controller->gc))
return 1;
return 0;
}
void PsyX_Pad_Vibrate(int mtap, int slot, unsigned char* table, int len)
{
PsyXController* controller = &g_controllers[slot];
if (len == 0)
return;
Uint16 freq_high = table[0] * 255;
Uint16 freq_low = len > 1 ? table[1] * 255 : 0;
// apply minimal shake
if(freq_low != 0 && freq_low < 4096)
freq_low = 4096;
if (freq_high != 0 && freq_high < 4096)
freq_high = 4096;
SDL_GameControllerRumble(controller->gc, freq_low, freq_high, 200);
}

View File

@ -1,16 +0,0 @@
#ifndef PSYX_PAD_H
#define PSYX_PAD_H
#if defined(_LANGUAGE_C_PLUS_PLUS)||defined(__cplusplus)||defined(c_plusplus)
extern "C" {
#endif
extern void PsyX_Pad_InitPad(int slot, u_char* padData);
extern void PsyX_Pad_Vibrate(int mtap, int slot, unsigned char* table, int len);
extern int PsyX_Pad_GetStatus(int mtap, int slot);
#if defined(_LANGUAGE_C_PLUS_PLUS)||defined(__cplusplus)||defined(c_plusplus)
}
#endif
#endif // PSYX_PAD_H

View File

@ -1,54 +0,0 @@
#ifndef PLATFORM_SETUP_H
#define PLATFORM_SETUP_H
#ifndef _CRT_SECURE_NO_WARNINGS
#define _CRT_SECURE_NO_WARNINGS
#endif
#include <stdio.h>
//-----------------------------------------------------------------------
#if defined(__APPLE__)
# include <SDL2/SDL.h>
#elif defined(__EMSCRIPTEN__)
# include <emscripten/emscripten.h>
# include <emscripten/html5.h>
# include <SDL2/SDL.h>
#elif defined(_WINDOWS) || defined(__MINGW32__) || defined(__linux__) || defined(__ANDROID__) || defined(__RPI__)
# include <SDL.h>
#endif
//-----------------------------------------------------------------------
#ifdef _MSC_VER
#define FUNCNAME __FUNCTION__
#else
#define FUNCNAME __func__
#endif
#include "PsyX/PsyX_globals.h"
#if defined(__ANDROID__)
# include <android/log.h>
# define LOG_TAG_EMU "[PsyX] "
# define eprintf(fmt, ...) __android_log_print(ANDROID_LOG_DEBUG, LOG_TAG_EMU, fmt, ##__VA_ARGS__)
# define eprintinfof(fmt, ...) __android_log_print(ANDROID_LOG_DEBUG, LOG_TAG_EMU " [INFO]", fmt, ##__VA_ARGS__)
# define eprintwarnf(fmt, ...) __android_log_print(ANDROID_LOG_DEBUG, LOG_TAG_EMU " [WARN]", fmt, ##__VA_ARGS__)
# define eprinterr(fmt, ...) eprintf("[%s] - " fmt, FUNCNAME, ##__VA_ARGS__);
#else
# define eprintf(fmt, ...) PsyX_Log("[Psy-X] " fmt, ##__VA_ARGS__)
# define eprintinfo(fmt, ...) PsyX_Log_Info("[Psy-X] " fmt, ##__VA_ARGS__)
# define eprintwarn(fmt, ...) PsyX_Log_Warning("[Psy-X] " fmt, ##__VA_ARGS__)
# define eprinterr(fmt, ...) PsyX_Log_Error("[Psy-X] [%s] - " fmt, FUNCNAME, ##__VA_ARGS__);
#endif
//-----------------------------------------------------------------------
#if defined(__EMSCRIPTEN__) || !defined(_DEBUG)
# define PSYX_UNIMPLEMENTED()
#else
# define PSYX_UNIMPLEMENTED() eprinterr("Unimplemented!\n");
#endif
#endif

View File

@ -1,8 +0,0 @@
#include "psx/abs.h"
// this is definitely NOT in psx runtime libs
int fst_abs(int x)
{
const int mask = x >> 31;
return (x ^ mask) - mask;
}

View File

@ -1,186 +0,0 @@
#include "psx/inline_c.h"
#include "psx/libgte.h"
#include "psx/gtereg.h"
#include "../gte/PsyX_GTE.h"
unsigned int MFC2(int reg)
{
switch (reg) {
case 1:
case 3:
case 5:
case 8:
case 9:
case 10:
case 11:
gteRegs.CP2D.p[reg].d = (int)gteRegs.CP2D.p[reg].sw.l;
break;
case 7:
case 16:
case 17:
case 18:
case 19:
gteRegs.CP2D.p[reg].d = (unsigned int)gteRegs.CP2D.p[reg].w.l;
break;
case 15:
gteRegs.CP2D.p[reg].d = C2_SXY2;
break;
case 28:
case 29:
gteRegs.CP2D.p[reg].d = LIM(C2_IR1 >> 7, 0x1f, 0, 0) | (LIM(C2_IR2 >> 7, 0x1f, 0, 0) << 5) | (LIM(C2_IR3 >> 7, 0x1f, 0, 0) << 10);
break;
}
return gteRegs.CP2D.p[reg].d;
}
int MFC2_S(int reg)
{
// FIXME: Is that modifiers should be signed too?
switch (reg) {
case 1:
case 3:
case 5:
case 8:
case 9:
case 10:
case 11:
gteRegs.CP2D.p[reg].d = (int)gteRegs.CP2D.p[reg].sw.l;
break;
case 7:
case 16:
case 17:
case 18:
case 19:
gteRegs.CP2D.p[reg].d = (unsigned int)gteRegs.CP2D.p[reg].w.l;
break;
case 15:
gteRegs.CP2D.p[reg].d = C2_SXY2;
break;
case 28:
case 29:
gteRegs.CP2D.p[reg].d = LIM(C2_IR1 >> 7, 0x1f, 0, 0) | (LIM(C2_IR2 >> 7, 0x1f, 0, 0) << 5) | (LIM(C2_IR3 >> 7, 0x1f, 0, 0) << 10);
break;
}
return gteRegs.CP2D.p[reg].sd;
}
void MTC2(unsigned int value, int reg) {
switch (reg) {
case 15:
C2_SXY0 = C2_SXY1;
C2_SXY1 = C2_SXY2;
C2_SXY2 = value;
break;
case 28:
C2_IR1 = (value & 0x1f) << 7;
C2_IR2 = (value & 0x3e0) << 2;
C2_IR3 = (value & 0x7c00) >> 3;
break;
case 30:
C2_LZCR = gte_leadingzerocount(value);
break;
case 31:
return;
}
gteRegs.CP2D.p[reg].d = value;
}
void MTC2_S(int value, int reg) {
switch (reg) {
case 15:
C2_SXY0 = C2_SXY1;
C2_SXY1 = C2_SXY2;
C2_SXY2 = value;
break;
case 28:
C2_IR1 = (value & 0x1f) << 7;
C2_IR2 = (value & 0x3e0) << 2;
C2_IR3 = (value & 0x7c00) >> 3;
break;
case 30:
C2_LZCR = gte_leadingzerocount(value);
break;
case 31:
return;
}
gteRegs.CP2D.p[reg].sd = value;
}
void CTC2(unsigned int value, int reg) {
switch (reg) {
case 4:
case 12:
case 20:
case 26:
case 27:
case 29:
case 30:
value = (int)(short)value;
break;
case 31:
value = value & 0x7ffff000;
if ((value & 0x7f87e000) != 0)
value |= 0x80000000;
break;
}
gteRegs.CP2C.p[reg].d = value;
}
void CTC2_S(int value, int reg) {
switch (reg) {
case 4:
case 12:
case 20:
case 26:
case 27:
case 29:
case 30:
value = (int)(short)value;
break;
case 31:
value = value & 0x7ffff000;
if ((value & 0x7f87e000) != 0)
value |= 0x80000000;
break;
}
gteRegs.CP2C.p[reg].sd = value;
}
unsigned int CFC2(int reg)
{
// TODO: correct functionality
return gteRegs.CP2C.p[reg].d;
}
int CFC2_S(int reg)
{
// TODO: correct functionality
return gteRegs.CP2C.p[reg].sd;
}
int doCOP2(int op)
{
return GTE_operator(op);
}

View File

@ -1,557 +0,0 @@
#include "psx/libapi.h"
#include <stdio.h>
#include "../PsyX_main.h"
int sp = 0;
int dword_300[] = { 0x20, 0xD, 0x0, 0x0 };
int dword_308[] = { 0x10, 0x20, 0x40, 0x1 };
#define CTR_RUNNING (0)
#define CTR_STOPPED (1)
#define CTR_MODE_TO_FFFF (0)
#define CTR_MODE_TO_TARG (1)
#define CTR_CLOCK_SYS (0)
#define CTR_CLOCK_PIXEL (1)
#define CTR_HORIZ_RETRACE (1)
#define CTR_CLOCK_SYS_ONE (0)
#define CTR_CLOCK_SYS_ONE_EIGHTH (1)
typedef struct
{
unsigned int i_cycle;
union
{
unsigned short cycle;
unsigned short unk00;
};
unsigned int i_value;
union
{
unsigned short value;
unsigned short unk01;
};
unsigned int i_target;
union
{
unsigned short target;
unsigned short unk02;
};
unsigned int padding00;
unsigned int padding01;
} SysCounter;
extern SysCounter counters[3];
SysCounter counters[3] = { 0 };
long SetRCnt(long spec, unsigned short target, long mode)//(F)
{
int value = 0x48;
spec &= 0xFFFF;
if (spec > 2)
{
return 0;
}
counters[spec].value = 0;
counters[spec].target = target;
if (spec < 2)
{
if ((mode & 0x10))
{
value = 0x49;
}
else if ((mode & 0x1))//loc_148
{
value |= 0x100;
}
}
else
{
//loc_158
if (spec == 2 && !(mode & 1))
{
value = 0x248;
}//loc_174
}
//loc_174
if ((mode & 0x1000))
{
value |= 0x10;
}//loc_180
counters[spec].value = value;
return 1;
}
long GetRCnt(long spec)//(F)
{
spec &= 0xFFFF;
if (spec > 2)
{
return 0;
}
return counters[spec].cycle;
}
long ResetRCnt(long spec)//(F)
{
spec &= 0xFFFF;
if (spec > 2)
{
return 0;
}
counters[spec].cycle = 0;
return 1;
}
long StartRCnt(long spec)//(F)
{
spec &= 0xFFFF;
dword_300[1] |= dword_308[spec];
return spec < 3 ? 1 : 0;
}
long StopRCnt(long spec)//TODO
{
return 0;
}
#undef OpenEvent
long OpenEvent(unsigned long event, long unk01, long unk02, long(*func)())
{
PSYX_UNIMPLEMENTED();
return 0;
}
long CloseEvent(unsigned long event)
{
PSYX_UNIMPLEMENTED();
return 0;
}
long EnableEvent(unsigned long event)
{
PSYX_UNIMPLEMENTED();
return 0;
}
long DisableEvent(unsigned long event)
{
PSYX_UNIMPLEMENTED();
return 0;
}
long WaitEvent(unsigned long event)
{
PSYX_UNIMPLEMENTED();
return 0;
}
long TestEvent(unsigned long event)
{
PSYX_UNIMPLEMENTED();
return 0;
}
void DeliverEvent(unsigned long ev1, long ev2)
{
PSYX_UNIMPLEMENTED();
}
void UnDeliverEvent(unsigned long ev1, long ev2)
{
PSYX_UNIMPLEMENTED();
}
long OpenTh(long(*func)(), unsigned long unk01, unsigned long unk02)
{
PSYX_UNIMPLEMENTED();
return 0;
}
int CloseTh(long unk00)
{
PSYX_UNIMPLEMENTED();
return 0;
}
int ChangeTh(long unk00)
{
PSYX_UNIMPLEMENTED();
return 0;
}
/*
long open(char* unk00, unsigned long unk01)
{
PSYX_UNIMPLEMENTED();
return 0;
}
long close(long unk00)
{
PSYX_UNIMPLEMENTED();
return 0;
}
long lseek(long unk00, long unk01, long unk02)
{
PSYX_UNIMPLEMENTED();
return 0;
}
long read(long unk00, void* unk01, long unk02)
{
PSYX_UNIMPLEMENTED();
return 0;
}
long write(long unk00, void* unk01, long unk02)
{
PSYX_UNIMPLEMENTED();
return 0;
}
long ioctl(long unk00, long unk01, long unk02)
{
PSYX_UNIMPLEMENTED();
return 0;
}
struct DIRENTRY* firstfile(char* unk00, struct DIRENTRY* unk01)
{
PSYX_UNIMPLEMENTED();
return 0;
}
struct DIRENTRY* nextfile(struct DIRENTRY* unk00)
{
PSYX_UNIMPLEMENTED();
return 0;
}
long erase(char* unk00)
{
PSYX_UNIMPLEMENTED();
return 0;
}
long undelete(char* unk00)
{
PSYX_UNIMPLEMENTED();
return 0;
}
long format(char* unk00)
{
PSYX_UNIMPLEMENTED();
return 0;
}
long rename(char* unk00, char* unk01)
{
PSYX_UNIMPLEMENTED();
return 0;
}
long cd(char* unk00)
{
PSYX_UNIMPLEMENTED();
return 0;
}
*/
long LoadTest(char* unk00, struct EXEC* unk01)
{
PSYX_UNIMPLEMENTED();
return 0;
}
long Load(char * unk00, struct EXEC* unk01)
{
PSYX_UNIMPLEMENTED();
return 0;
}
long Exec(struct EXEC * unk00, long unk01, char** unk02)
{
PSYX_UNIMPLEMENTED();
return 0;
}
long LoadExec(char * unk00, unsigned long unk01, unsigned long unk02)
{
PSYX_UNIMPLEMENTED();
return 0;
}
long InitPAD(char * unk00, long unk01, char* unk02, long unk03)
{
PSYX_UNIMPLEMENTED();
return 0;
}
long StartPAD()
{
PSYX_UNIMPLEMENTED();
return 0;
}
void StopPAD()
{
PSYX_UNIMPLEMENTED();
}
void EnablePAD()
{
PSYX_UNIMPLEMENTED();
}
void DisablePAD()
{
PSYX_UNIMPLEMENTED();
}
void FlushCache()
{
PSYX_UNIMPLEMENTED();
}
void ReturnFromException()
{
PSYX_UNIMPLEMENTED();
}
int EnterCriticalSection()
{
PSYX_UNIMPLEMENTED();
return 0;
}
void ExitCriticalSection()
{
PSYX_UNIMPLEMENTED();
}
void Exception()
{
PSYX_UNIMPLEMENTED();
}
void SwEnterCriticalSection()
{
PSYX_UNIMPLEMENTED();
}
void SwExitCriticalSection()
{
PSYX_UNIMPLEMENTED();
}
unsigned long SetSp(unsigned long newsp)//(F)
{
unsigned long old_sp = sp;
sp = newsp;
return old_sp;
}
unsigned long GetSp()
{
PSYX_UNIMPLEMENTED();
return 0;
}
unsigned long GetGp()
{
PSYX_UNIMPLEMENTED();
return 0;
}
unsigned long GetCr()
{
PSYX_UNIMPLEMENTED();
return 0;
}
unsigned long GetSr()
{
PSYX_UNIMPLEMENTED();
return 0;
}
unsigned long GetSysSp()
{
PSYX_UNIMPLEMENTED();
return 0;
}
long SetConf(unsigned long unk00, unsigned long unk01, unsigned long unk02)
{
PSYX_UNIMPLEMENTED();
return 0;
}
void GetConf(unsigned long* unk00, unsigned long* unk01, unsigned long* unk02)
{
PSYX_UNIMPLEMENTED();
}
/*
long _get_errno(void)
{
PSYX_UNIMPLEMENTED();
return 0;
}
long _get_error(long unk00)
{
PSYX_UNIMPLEMENTED();
return 0;
}
*/
void SystemError(char unk00, long unk01)
{
PSYX_UNIMPLEMENTED();
}
void SetMem(long unk00)
{
PSYX_UNIMPLEMENTED();
}
long Krom2RawAdd(unsigned long unk00)
{
PSYX_UNIMPLEMENTED();
return 0;
}
long Krom2RawAdd2(unsigned short unk00)
{
PSYX_UNIMPLEMENTED();
return 0;
}
void _96_init(void)
{
PSYX_UNIMPLEMENTED();
}
void _96_remove(void)
{
PSYX_UNIMPLEMENTED();
}
void _boot(void)
{
PSYX_UNIMPLEMENTED();
}
void ChangeClearPAD(long unk00)
{
PSYX_UNIMPLEMENTED();
}
void InitCARD(long val)
{
PSYX_UNIMPLEMENTED();
}
long StartCARD()
{
PSYX_UNIMPLEMENTED();
return 0;
}
long StopCARD()
{
PSYX_UNIMPLEMENTED();
return 0;
}
void _bu_init()
{
PSYX_UNIMPLEMENTED();
}
long _card_info(long chan)
{
PSYX_UNIMPLEMENTED();
return 0;
}
long _card_clear(long chan)
{
PSYX_UNIMPLEMENTED();
return 0;
}
long _card_load(long chan)
{
PSYX_UNIMPLEMENTED();
return 0;
}
long _card_auto(long val)
{
PSYX_UNIMPLEMENTED();
return 0;
}
void _new_card()
{
PSYX_UNIMPLEMENTED();
}
long _card_status(long drv)
{
PSYX_UNIMPLEMENTED();
return 0;
}
long _card_wait(long drv)
{
PSYX_UNIMPLEMENTED();
return 0;
}
unsigned long _card_chan(void)
{
PSYX_UNIMPLEMENTED();
return 0;
}
long _card_write(long chan, long block, unsigned char *buf)
{
PSYX_UNIMPLEMENTED();
return 0;
}
long _card_read(long chan, long block, unsigned char *buf)
{
PSYX_UNIMPLEMENTED();
return 0;
}
long _card_format(long chan)
{
PSYX_UNIMPLEMENTED();
return 0;
}

File diff suppressed because it is too large Load Diff

View File

@ -1,93 +0,0 @@
#include "psx/libetc.h"
#include "../PsyX_main.h"
#include "PsyX/PsyX_public.h"
#include <SDL_timer.h>
#ifdef DEBUG
char scratchData[4096 + 8];
char* _scratchData = scratchData + 4;
#else
char scratchData[4096];
char* _scratchData = scratchData;
#endif
void(*vsync_callback)(void) = NULL;
int StopCallback(void)
{
PSYX_UNIMPLEMENTED();
return 0;
}
int ResetCallback(void)
{
int old = (int)vsync_callback;
vsync_callback = NULL;
return old;
}
int VSync(int mode)
{
if (mode < 0)
{
// don't wait but still return vblank count
return PsyX_Sys_GetVBlankCount();
}
if (mode == 0)
{
PsyX_WaitForTimestep(1);
}
else if (mode > 0)
{
// FIXME: wait many times?
}
return PsyX_Sys_GetVBlankCount();
}
int VSyncCallback(void(*f)(void))
{
int old = (int)vsync_callback;
vsync_callback = f;
return old;
}
long SetVideoMode(long mode)
{
#ifdef DEBUG
// debug marks for overflow cheks
*(uint*)&scratchData[0] = 0xdeadb33f;
*(uint*)&scratchData[4096 + 4] = 0xdeadb33f;
#endif
return PsyX_Sys_SetVMode(mode);
}
long GetVideoMode()
{
return g_vmode;
}
void PadInit(int mode)
{
PSYX_UNIMPLEMENTED();
// TODO: call PadInitDirect
}
u_long PadRead(int id)
{
PSYX_UNIMPLEMENTED();
// TODO: return pad data as u_long
}
void PadStop(void)
{
PSYX_UNIMPLEMENTED();
// TODO: stop pad reads
}

View File

@ -1,649 +0,0 @@
#include "psx/libgte.h"
#include "psx/libgpu.h"
#include "psx/libetc.h"
#include "../gpu/PsyX_GPU.h"
#include "PsyX/PsyX_render.h"
#include "PsyX/PsyX_public.h"
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#include "PsyX/PsyX_globals.h"
#include "../PsyX_main.h"
//#include "../gpu/font.h"
//#define DEBUG_POLY_COUNT
#if defined(DEBUG_POLY_COUNT)
static int polygon_count = 0;
#endif
void(*drawsync_callback)(void) = NULL;
int ClearImage(RECT16* rect, u_char r, u_char g, u_char b)
{
GR_ClearVRAM(rect->x, rect->y, rect->w, rect->h, r, g, b);
// TODO: clear all affected backbuffers
GR_Clear(rect->x, rect->y, rect->w, rect->h, r, g, b);
return 0;
}
int ClearImage2(RECT16* rect, u_char r, u_char g, u_char b)
{
GR_ClearVRAM(rect->x, rect->y, rect->w, rect->h, r, g, b);
// TODO: clear all affected backbuffers
GR_Clear(rect->x, rect->y, rect->w, rect->h, r, g, b);
return 0;
}
int DrawSync(int mode)
{
// Update VRAM seems needed to be here
GR_UpdateVRAM();
GR_ReadFramebufferDataToVRAM();
if (g_splitIndex > 0)// && g_GPUDisabledState == 0) // don't do flips if nothing to draw.
{
DrawAllSplits();
//PsyX_EndScene();
}
if (drawsync_callback != NULL)
{
drawsync_callback();
}
return 0;
}
int LoadImagePSX(RECT16* rect, u_long* p)
{
GR_CopyVRAM((unsigned short*)p, 0, 0, rect->w, rect->h, rect->x, rect->y);
return 0;
}
int LoadImage(RECT16* rect, u_long* p)
{
LoadImagePSX(rect, p);
return 0;
}
int LoadImage2(RECT16* rect, u_long* p)
{
LoadImagePSX(rect, p);
// simulate immediate mode
GR_UpdateVRAM();
GR_ReadFramebufferDataToVRAM();
return 0;
}
int MargePrim(void* p0, void* p1)
{
#if 0
int v0 = ((unsigned char*)p0)[3];
int v1 = ((unsigned char*)p1)[3];
v0 += v1;
v1 = v0 + 1;
if (v1 < 0x11)
{
((char*)p0)[3] = v1;
((int*)p1)[0] = 0;
return 0;
}
return -1;
#endif //0
#if defined(USE_EXTENDED_PRIM_POINTERS)
int v0 = ((int*)p0)[1];
int v1 = ((int*)p1)[1];
#else
int v0 = ((unsigned char*)p0)[3];
int v1 = ((unsigned char*)p1)[3];
#endif
v0 += v1;
v1 = v0 + 1;
#if defined(USE_EXTENDED_PRIM_POINTERS)
if (v1 < 0x12)
#else
if (v1 < 0x11)
#endif
{
#if defined(USE_EXTENDED_PRIM_POINTERS)
((int*)p0)[1] = v1;
((int*)p1)[1] = 0;
#else
((char*)p0)[3] = v1;
((int*)p1)[0] = 0;
#endif
return 0;
}
return -1;
}
int MoveImage(RECT16* rect, int x, int y)
{
GR_CopyVRAM(NULL, rect->x, rect->y, rect->w, rect->h, x, y);
return 0;
}
int ResetGraph(int mode)
{
if(mode == 0)
{
// reset GPU state
g_GPUDisabledState = 0;
ClearImage(&activeDrawEnv.clip, 0, 0, 0);
ClearSplits();
#ifdef USE_PGXP
PGXP_ClearCache();
#endif
PsyX_EndScene();
}
else if (mode == 1)
{
// cancell all rendering
ClearSplits();
#ifdef USE_PGXP
PGXP_ClearCache();
#endif
PsyX_EndScene();
}
else if (mode == 3)
{
}
return 0;
}
int SetGraphDebug(int level)
{
PSYX_UNIMPLEMENTED();
return 0;
}
int StoreImage(RECT16* rect, u_long* p)
{
GR_ReadVRAM((unsigned short*)p, rect->x, rect->y, rect->w, rect->h);
return 0;
}
int StoreImage2(RECT16 *RECT16, u_long *p)
{
int result = StoreImage(RECT16, p);
// GPU reset?
return result;
}
u_long* ClearOTag(u_long* ot, int n)
{
if (n == 0)
return NULL;
// last is aspecial terminator
setaddr(&ot[n - P_LEN], &prim_terminator);
setlen(&ot[n - P_LEN], 0);
// make a linked list with it's next items
for (int i = (n-1) * P_LEN; i >= 0; i -= P_LEN)
{
setaddr(&ot[i], &ot[i + P_LEN]);
setlen(&ot[i], 0);
}
return NULL;
}
u_long* ClearOTagR(u_long* ot, int n)
{
if (n == 0)
return NULL;
// first is a special terminator
setaddr(ot, &prim_terminator);
setlen(ot, 0);
// initialize a linked list with it's previous items
for (int i = 1 * P_LEN; i < n * P_LEN; i += P_LEN)
{
setaddr(&ot[i], &ot[i - P_LEN]);
setlen(&ot[i], 0);
}
return NULL;
}
void SetDispMask(int mask)
{
g_GPUDisabledState = (mask == 0);
}
int FntPrint(char* text, ...)
{
PSYX_UNIMPLEMENTED();
return 0;
}
int GetODE(void)
{
return 0;
}
DISPENV* GetDispEnv(DISPENV* env)//(F)
{
memcpy(env, &activeDispEnv, sizeof(DISPENV));
return env;
}
DISPENV* PutDispEnv(DISPENV* env)//To Finish
{
memcpy((char*)&activeDispEnv, env, sizeof(DISPENV));
return 0;
}
DISPENV* SetDefDispEnv(DISPENV* env, int x, int y, int w, int h)//(F)
{
env->disp.x = x;
env->disp.y = y;
env->disp.w = w;
env->disp.h = h;
env->screen.x = 0;
env->screen.y = 0;
env->screen.w = 0;
env->screen.h = 0;
env->isrgb24 = 0;
env->isinter = 0;
env->pad1 = 0;
env->pad0 = 0;
return 0;
}
DRAWENV* GetDrawEnv(DRAWENV* env)
{
PSYX_UNIMPLEMENTED();
return NULL;
}
DRAWENV* PutDrawEnv(DRAWENV* env)//Guessed
{
memcpy((char*)&activeDrawEnv, env, sizeof(DRAWENV));
return 0;
}
DRAWENV* SetDefDrawEnv(DRAWENV* env, int x, int y, int w, int h)//(F)
{
env->clip.x = x;
env->clip.y = y;
env->clip.w = w;
env->clip.h = h;
env->tw.x = 0;
env->tw.y = 0;
env->tw.w = 0;
env->tw.h = 0;
env->r0 = 0;
env->g0 = 0;
env->b0 = 0;
env->dtd = 1;
if (GetVideoMode() == MODE_NTSC)
env->dfe = h < 289 ? 1 : 0;
else
env->dfe = h < 257 ? 1 : 0;
env->ofs[0] = x;
env->ofs[1] = y;
env->tpage = 10;
env->isbg = 0;
return env;
}
void SetDrawEnv(DR_ENV* dr_env, DRAWENV* env)
{
dr_env->code[0] = ((env->clip.y & 0x3FF) << 10) | env->clip.x & 0x3FF | 0xE3000000;
dr_env->code[1] = (((env->clip.y + env->clip.h - 1) & 0x3FF) << 10) | (env->clip.x + env->clip.w - 1) & 0x3FF | 0xE4000000;
dr_env->code[2] = ((env->ofs[1] & 0x3FF) << 11) | env->ofs[0] & 0x7FF | 0xE5000000;
dr_env->code[3] = 32 * (((256 - env->tw.h) >> 3) & 0x1F) | ((256 - env->tw.w) >> 3) & 0x1F | (((env->tw.y >> 3) & 0x1F) << 15) | (((env->tw.x >> 3) & 0x1F) << 10) | 0xE2000000;
dr_env->code[4] = ((env->dtd != 0) << 9) | ((env->dfe != 0) << 10) | env->tpage & 0x1FF | 0xE1000000;
// TODO: add missing logic when env->isbg != 0
setlen(dr_env, 5);
}
void SetDrawMode(DR_MODE* p, int dfe, int dtd, int tpage, RECT16* tw)
{
setDrawMode(p, dfe, dtd, tpage, tw);
}
void SetDrawArea(DR_AREA *p, RECT16 *r)
{
p->code[0] = (r->x & 0x3FF | ((r->y & 0x3FF) << 10)) | 0xE3000000;
p->code[1] = (((r->x + r->w) & 0x3FF) | (((r->y + r->h) & 0x3FF) << 10)) | 0xE4000000;
setlen(p, 2);
}
void SetDrawMove(DR_MOVE* p, RECT16* rect, int x, int y)
{
char len;
len = 5;
if (rect->w == 0 || rect->h == 0)
len = 0;
p->code[0] = 0x1000000;
p->code[1] = 0x80000000;
p->code[2] = *(ulong*)&rect->x;
p->code[3] = y << 0x10 | x & 0xffffU;
p->code[4] = *(ulong *)&rect->w;
setlen(p, len);
}
void SetDrawLoad(DR_LOAD* p, RECT16* RECT16)
{
setDrawLoad(p, RECT16);
}
void SetDrawTPage(DR_TPAGE* p, int dfe, int dtd, int tpage)
{
setDrawTPage(p, dfe, dtd, tpage);
}
u_long DrawSyncCallback(void(*func)(void))
{
drawsync_callback = func;
return 0;
}
u_short GetClut(int x, int y)
{
return getClut(x, y);
}
//------------------------------------------------------------------
void DrawOTagEnv(u_long* p, DRAWENV* env)
{
PutDrawEnv(env);
DrawOTag(p);
}
void DrawOTag(u_long* p)
{
do
{
if (g_GPUDisabledState)
{
ClearSplits();
#ifdef USE_PGXP
PGXP_ClearCache();
#endif
return;
}
if (PsyX_BeginScene())
{
ClearSplits();
}
#if defined(DEBUG_POLY_COUNT)
polygon_count = 0;
#endif
if (activeDrawEnv.isbg)
ClearImage(&activeDrawEnv.clip, activeDrawEnv.r0, activeDrawEnv.g0, activeDrawEnv.b0);
ParsePrimitivesToSplits(p, 0);
DrawAllSplits();
} while (g_emulatorPaused);
}
void DrawPrim(void* p)
{
if (g_GPUDisabledState)
{
ClearSplits();
#ifdef USE_PGXP
PGXP_ClearCache();
#endif
return;
}
if (PsyX_BeginScene())
{
ClearSplits();
}
#if defined(DEBUG_POLY_COUNT)
polygon_count = 0;
#endif
if (activeDrawEnv.isbg)
ClearImage(&activeDrawEnv.clip, activeDrawEnv.r0, activeDrawEnv.g0, activeDrawEnv.b0);
ParsePrimitivesToSplits((u_long*)p, 1);
}
void SetSprt16(SPRT_16* p)
{
setSprt16(p);
}
void SetSprt8(SPRT_8* p)
{
setSprt8(p);
}
void SetTile(TILE* p)
{
setTile(p);
}
void SetPolyGT4(POLY_GT4* p)
{
setPolyGT4(p);
}
void SetSemiTrans(void* p, int abe)
{
setSemiTrans(p, abe);
}
void SetShadeTex(void* p, int tge)
{
setShadeTex(p, tge);
}
void SetSprt(SPRT* p)
{
setSprt(p);
}
void SetDumpFnt(int id)
{
PSYX_UNIMPLEMENTED();
}
void SetLineF3(LINE_F3* p)
{
setLineF3(p);
}
void FntLoad(int tx, int ty)
{
PSYX_UNIMPLEMENTED();
/*
g_debugFntClut = LoadClut2((u_long*)fontClutData, tx, ty + 0x80);
g_debugFontTpage = LoadTPage((u_long*)fontTpageData, 0, 0, tx, ty, 0x80, 0x20);
idx = 0;
memset(&fontTiles, 0, 0x180);*/
}
void AddPrim(void* ot, void* p)
{
addPrim(ot, p);
}
void AddPrims(void* ot, void* p0, void* p1)
{
addPrims(ot, p0, p1);
}
void CatPrim(void* p0, void* p1)
{
catPrim(p0, p1);
}
u_short LoadTPage(u_long* pix, int tp, int abr, int x, int y, int w, int h)
{
RECT16 imageArea;
imageArea.x = x;
imageArea.y = y;
imageArea.h = h;
enum
{
TP_4BIT,
TP_8BIT,
TP_16BIT
};
switch (tp)
{
case TP_4BIT:
{
//loc_278
if (w >= 0)
{
imageArea.w = w >> 2;
}
else
{
imageArea.w = (w + 3) >> 2;
}
break;
}
case TP_8BIT:
{
//loc_290
imageArea.w = (w + (w >> 31)) >> 1;
break;
}
case TP_16BIT:
{
//loc_2A4
imageArea.w = w;
break;
}
}
//loc_2AC
LoadImagePSX(&imageArea, pix);
return GetTPage(tp, abr, x, y) & 0xFFFF;
}
u_short GetTPage(int tp, int abr, int x, int y)
{
return getTPage(tp, abr, x, y);
}
u_short LoadClut(u_long* clut, int x, int y)
{
RECT16 rect;//&var_18
setRECT(&rect, x, y, 256, 1);
LoadImagePSX(&rect, clut);
return GetClut(x, y) & 0xFFFF;
}
u_short LoadClut2(u_long* clut, int x, int y)
{
RECT16 drawArea;
drawArea.x = x;
drawArea.y = y;
drawArea.w = 16;
drawArea.h = 1;
LoadImagePSX(&drawArea, clut);
return getClut(x, y);
}
u_long* KanjiFntFlush(int id)
{
PSYX_UNIMPLEMENTED();
return 0;
}
u_long* FntFlush(int id)
{
PSYX_UNIMPLEMENTED();
return 0;
}
int KanjiFntOpen(int x, int y, int w, int h, int dx, int dy, int cx, int cy, int isbg, int n)
{
PSYX_UNIMPLEMENTED();
return 0;
}
int FntOpen(int x, int y, int w, int h, int isbg, int n)
{
PSYX_UNIMPLEMENTED();
return 0;
}
void SetPolyF4(POLY_F4* p)
{
setPolyF4(p);
}
void SetPolyFT4(POLY_FT4* p)
{
setPolyFT4(p);
}
void SetPolyG4(POLY_G4* p)
{
setPolyG4(p);
}
void TermPrim(void* p)
{
termPrim(p);
}
void SetPsyXTexture(DR_PSYX_TEX* p, uint grTextureId)
{
setlen(p, 1);
p->code[0] = 0xB1000000 | grTextureId;
}

File diff suppressed because it is too large Load Diff

View File

@ -1,309 +0,0 @@
#include "../PsyX_main.h"
#include "psx/libmcrd.h"
#include <stdio.h>
#include <string.h>
#define MC_HEADER_FRAME_INDEX (0)
#pragma pack(push,1)
typedef struct MemoryCardFrame
{
unsigned int attr;
unsigned int size;
unsigned short unknown;
char name[20];
char padding[98];
} MemoryCardFrame_s, *MemoryCardFrame_p;
#pragma pack(pop)
int bIsInitialised = 0;
int bCanUseMemoryCardFuncs = 0;
int memoryCardStatus = -1;
FILE* memoryCards[2];
int memoryCardsNew[2];
int memoryCardCmds = -1;
int memoryCardResult = -1;
int openFrameIndex = 0;
int currentlyOpenedMemoryCard = -1;
void MemCardInit(long val)
{
bIsInitialised = 1;
bCanUseMemoryCardFuncs = 0;
memoryCardStatus = -1;
memoryCardCmds = -1;
memoryCardResult = -1;
memoryCardsNew[0] = 1;
memoryCardsNew[1] = 1;
}
void MemCardEnd()
{
if (!bCanUseMemoryCardFuncs)
return;
}
void MemCardStart()
{
bCanUseMemoryCardFuncs = 1;
}
void MemCardStop()
{
if (!bCanUseMemoryCardFuncs)
return;
bCanUseMemoryCardFuncs = 0;
memoryCardStatus = -1;
memoryCardCmds = -1;
memoryCardResult = -1;
memoryCardsNew[0] = 1;
memoryCardsNew[1] = 1;
if (memoryCards[0] != NULL)
{
fclose(memoryCards[0]);
}
if (memoryCards[1] != NULL)
{
fclose(memoryCards[1]);
}
}
long MemCardExist(long chan)
{
if (!bCanUseMemoryCardFuncs)
return 0;
char buf[16];
sprintf(&buf[0], "%ld.MCD", chan);
memoryCards[chan] = fopen(&buf[0], "rb");
memoryCardCmds = McFuncExist;
if (memoryCards[chan] == NULL)
{
memoryCardStatus = -1;//CHECKME
memoryCardResult = McErrCardNotExist;//CHECKME
return 0;
}
else
{
fclose(memoryCards[chan]);
if (memoryCardResult == McErrNewCard)
{
memoryCardResult = McErrNone;
memoryCardStatus = 0;
}
else
{
memoryCardResult = McErrNewCard;
memoryCardStatus = 1;
}
}
return 1;
}
long MemCardAccept(long chan)
{
if (!bCanUseMemoryCardFuncs)
return 0;
char buf[16];
sprintf(&buf[0], "%ld.MCD", chan);
memoryCards[chan] = fopen(&buf[0], "rb");
memoryCardCmds = McFuncAccept;
unsigned int fileMagic = 0;
fread(&fileMagic, 4, 1, memoryCards[chan]);
fclose(memoryCards[chan]);
//Is this card formatted?
if (fileMagic != 0x0000434D)
{
//If not, this is a new card!
memoryCardResult = McErrNewCard;
memoryCardsNew[chan] = 0;
return 0;
}
memoryCardResult = 3;
memoryCardStatus = 1;
return 1;
}
long MemCardOpen(long chan, char* file, long flag)
{
if (!bCanUseMemoryCardFuncs)
return 0;
char buf[16];
sprintf(&buf[0], "%ld.MCD", chan);
switch (flag)
{
case 1:
memoryCards[chan] = fopen(&buf[0], "rb");
break;
case 2://Unchecked
memoryCards[chan] = fopen(&buf[0], "wb");
break;
}
fseek(memoryCards[chan], 0, SEEK_SET);
currentlyOpenedMemoryCard = chan;
for (int i = 0; i < 16; i++)
{
struct MemoryCardFrame frame;
fread(&frame, sizeof(struct MemoryCardFrame), 1, memoryCards[chan]);
if (i > MC_HEADER_FRAME_INDEX && frame.name[0] != '\0')
{
if (strcmp(&frame.name[0], file) == 0)
{
break;
}
openFrameIndex += frame.attr & 0x7;
}
}
return 0;
}
void MemCardClose()
{
openFrameIndex = -1;
fclose(memoryCards[currentlyOpenedMemoryCard]);
}
long MemCardReadData(unsigned long* adrs, long ofs, long bytes)
{
memoryCardCmds = McFuncReadData;
if (bytes % 128)
{
return 0;
}
fseek(memoryCards[currentlyOpenedMemoryCard], (64 * 128) + (openFrameIndex * 16384) + ofs, SEEK_SET);
fread(adrs, bytes, 1, memoryCards[currentlyOpenedMemoryCard]);
return 1;
}
long MemCardReadFile(long chan, char* file, unsigned long* adrs, long ofs, long bytes)
{
memoryCardCmds = McFuncReadFile;
return 0;
}
long MemCardWriteData(unsigned long* adrs, long ofs, long bytes)
{
memoryCardCmds = McFuncWriteData;
return 0;
}
long MemCardWriteFile(long chan, char* file, unsigned long* adrs, long ofs, long bytes)
{
memoryCardCmds = McFuncWriteFile;
return 0;
}
long MemCardCreateFile(long chan, char* file, long blocks)
{
PSYX_UNIMPLEMENTED();
return 0;
}
long MemCardDeleteFile(long chan, char* file)
{
PSYX_UNIMPLEMENTED();
return 0;
}
long MemCardFormat(long chan)
{
PSYX_UNIMPLEMENTED();
return 0;
}
long MemCardUnformat(long chan)
{
PSYX_UNIMPLEMENTED();
return 0;
}
long MemCardSync(long mode, long* cmds, long* rslt)
{
static int timesCalled = 0;
//if (timesCalled++ >= 4) //Doesn't work o.o
{
timesCalled = 0;
if (memoryCardCmds != -1)
{
*cmds = memoryCardCmds;
}
if (memoryCardResult != -1)
{
*rslt = memoryCardResult;
}
if (mode == 1)
{
return memoryCardStatus;
}
}
return -1;
}
MemCB MemCardCallback(MemCB func)
{
PSYX_UNIMPLEMENTED();
return 0;
}
long MemCardGetDirentry(long chan, char* name, struct DIRENTRY* dir, long* files, long ofs, long max)
{
char buf[16];
sprintf(&buf[0], "%ld.MCD", chan);
memoryCards[chan] = fopen(&buf[0], "rb");///@FIXME potential bug, if this is called twice then we can open a card twice. Maybe add a flag for whether memcard is open or not if original SDK did this.
fseek(memoryCards[chan], 0, SEEK_SET);
if (strcmp(name, "*") == 0)
{
for (int i = 0, head = -64; i < 16; i++, head += 128)
{
struct MemoryCardFrame frame;
fread(&frame, sizeof(struct MemoryCardFrame), 1, memoryCards[chan]);
if (i > MC_HEADER_FRAME_INDEX && frame.name[0] != '\0')
{
memcpy(dir->name, &frame.name[0], 20);
dir->attr = frame.attr & 0xF0;
dir->size = frame.size;
dir->next = (struct DIRENTRY*)9;
dir->head = head;
dir->system[0] = 9;
dir++;
files[0]++;
}
}
}
memoryCardCmds = McFuncExist;
memoryCardResult = 0;
memoryCardStatus = 1;
return 0;
}

View File

@ -1,106 +0,0 @@
#include "psx/libpad.h"
#include "psx/libetc.h"
#include "../PsyX_main.h"
#include "../pad/PsyX_pad.h"
#include "PsyX/PsyX_public.h"
#include <string.h>
int g_padCommEnable = 0;
void PadInitDirect(unsigned char* pad1, unsigned char* pad2)
{
PsyX_Pad_InitPad(0, pad1);
PsyX_Pad_InitPad(1, pad2);
}
void PadInitMtap(unsigned char* unk00, unsigned char* unk01)
{
PSYX_UNIMPLEMENTED();
}
void PadInitGun(unsigned char* unk00, int unk01)
{
PSYX_UNIMPLEMENTED();
}
int PadChkVsync()
{
PSYX_UNIMPLEMENTED();
return 0;
}
void PadStartCom()
{
g_padCommEnable = 1;
}
void PadStopCom()
{
g_padCommEnable = 0;
}
unsigned int PadEnableCom(unsigned int unk00)
{
PSYX_UNIMPLEMENTED();
return 0;
}
void PadEnableGun(unsigned char unk00)
{
PSYX_UNIMPLEMENTED();
}
void PadRemoveGun()
{
PSYX_UNIMPLEMENTED();
}
int PadGetState(int port)
{
int mtap, slot;
mtap = port & 3;
slot = (mtap * 2) + (port >> 4) & 1;
return PsyX_Pad_GetStatus(mtap, slot) ? PadStateStable : PadStateDiscon;
}
int PadInfoMode(int port, int term, int offs)
{
return 7;//?
}
int PadInfoAct(int port, int acno, int term)
{
return 0;
}
int PadInfoComb(int unk00, int unk01, int unk02)
{
PSYX_UNIMPLEMENTED();
return 0;
}
int PadSetActAlign(int port, unsigned char* table)
{
return 1;
}
int PadSetMainMode(int socket, int offs, int lock)
{
PSYX_UNIMPLEMENTED();
return 0;
}
void PadSetAct(int port, unsigned char* table, int len)
{
int mtap, slot;
mtap = port & 3;
slot = (mtap * 2) + (port >> 4) & 1;
PsyX_Pad_Vibrate(mtap, slot, table, len);
}

View File

@ -1,70 +0,0 @@
#include "psx/libsn.h"
#include <stdio.h>
uintptr_t fileHandle = 0;
#define INVALID_FILE_HANDLE (-1)
int PCinit()
{
//PSYX_UNIMPLEMENTED();
return 0;
}
uintptr_t PCopen(char* name, int flags, int perms)
{
//TOMB5 hack for CUTSEQ.JIZ
if (name[0] == '\\')
{
++name;
}
#if defined(__ANDROID__)
char buff[64];
sprintf(&buff[0], "/storage/emulated/0/TOMB5/%s", name);
name = &buff[0];
#endif
switch (flags)
{
case 0:
fileHandle = (uintptr_t)fopen(name, "rb");
break;
case 1:
fileHandle = (uintptr_t)fopen(name, "wb");
break;
case 2:
fileHandle = (uintptr_t)fopen(name, "rwb");
break;
}
return fileHandle == 0 ? INVALID_FILE_HANDLE : fileHandle;
}
int PCcreat(char* name, int perms)
{
//PSYX_UNIMPLEMENTED();
return 0;
}
int PClseek(uintptr_t fd, int offset, int mode)
{
fseek((FILE*)fd, offset, mode);
return ftell((FILE*)fd);
}
int PCread(uintptr_t fd, char* buff, int len)
{
return fread(buff, len, 1, (FILE*)fd);
}
int PCwrite(uintptr_t fd, char* buff, int len)
{
return fwrite(buff, len, 1, (FILE*)fd);
}
int PCclose(uintptr_t fd)
{
return fclose((FILE*)fd);
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,199 +0,0 @@
#ifdef _WINDOWS
#include <windows.h>
#include <Dbghelp.h>
#include <tchar.h>
#include <stdio.h>
typedef BOOL(WINAPI *MINIDUMPWRITEDUMP)(HANDLE hProcess, DWORD dwPid, HANDLE hFile, MINIDUMP_TYPE DumpType, CONST PMINIDUMP_EXCEPTION_INFORMATION ExceptionParam, CONST PMINIDUMP_USER_STREAM_INFORMATION UserStreamParam, CONST PMINIDUMP_CALLBACK_INFORMATION CallbackParam);
typedef struct exception_codes_s {
DWORD exCode;
const char* exName;
const char* exDescription;
} exception_codes;
exception_codes except_info[] = {
{EXCEPTION_ACCESS_VIOLATION, "ACCESS VIOLATION",
"The thread tried to read from or write to a virtual address for which it does not have the appropriate access."},
{EXCEPTION_ARRAY_BOUNDS_EXCEEDED, "ARRAY BOUNDS EXCEEDED",
"The thread tried to access an array element that is out of bounds and the underlying hardware supports bounds checking."},
{EXCEPTION_BREAKPOINT, "BREAKPOINT",
"A breakpoint was encountered."},
{EXCEPTION_DATATYPE_MISALIGNMENT, "DATATYPE MISALIGNMENT",
"The thread tried to read or write data that is misaligned on hardware that does not provide alignment. For example, 16-bit values must be aligned on 2-byte boundaries; 32-bit values on 4-byte boundaries, and so on."},
{EXCEPTION_FLT_DENORMAL_OPERAND, "FLT DENORMAL OPERAND",
"One of the operands in a floating-point operation is denormal. A denormal value is one that is too small to represent as a standard floating-point value. "},
{EXCEPTION_FLT_DIVIDE_BY_ZERO, "FLT DIVIDE BY ZERO",
"The thread tried to divide a floating-point value by a floating-point divisor of zero. "},
{EXCEPTION_FLT_INEXACT_RESULT, "FLT INEXACT RESULT",
"The result of a floating-point operation cannot be represented exactly as a decimal fraction. "},
{EXCEPTION_FLT_INVALID_OPERATION, "FLT INVALID OPERATION",
"This exception represents any floating-point exception not included in this list. "},
{EXCEPTION_FLT_OVERFLOW, "FLT OVERFLOW",
"The exponent of a floating-point operation is greater than the magnitude allowed by the corresponding type. "},
{EXCEPTION_FLT_STACK_CHECK, "FLT STACK CHECK",
"The stack overflowed or underflowed as the result of a floating-point operation. "},
{EXCEPTION_FLT_UNDERFLOW, "FLT UNDERFLOW",
"The exponent of a floating-point operation is less than the magnitude allowed by the corresponding type. "},
{EXCEPTION_ILLEGAL_INSTRUCTION, "ILLEGAL INSTRUCTION",
"The thread tried to execute an invalid instruction. "},
{EXCEPTION_IN_PAGE_ERROR, "IN PAGE ERROR",
"The thread tried to access a page that was not present, and the system was unable to load the page. For example, this exception might occur if a network connection is lost while running a program over the network. "},
{EXCEPTION_INT_DIVIDE_BY_ZERO, "INT DIVIDE BY ZERO",
"The thread tried to divide an integer value by an integer divisor of zero. "},
{EXCEPTION_INT_OVERFLOW, "INT OVERFLOW",
"The result of an integer operation caused a carry out of the most significant bit of the result. "},
{EXCEPTION_INVALID_DISPOSITION, "INVALID DISPOSITION",
"An exception handler returned an invalid disposition to the exception dispatcher. Programmers using a high-level language such as C should never encounter this exception. "},
{EXCEPTION_NONCONTINUABLE_EXCEPTION,"NONCONTINUABLE EXCEPTION",
"The thread tried to continue execution after a noncontinuable exception occurred. "},
{EXCEPTION_PRIV_INSTRUCTION, "PRIV INSTRUCTION",
"The thread tried to execute an instruction whose operation is not allowed in the current machine mode. "},
{EXCEPTION_SINGLE_STEP, "SINGLE STEP",
"A trace trap or other single-instruction mechanism signaled that one instruction has been executed. "},
{EXCEPTION_STACK_OVERFLOW, "STACK OVERFLOW",
"The thread used up its stack. "}
};
void GetExceptionStrings(DWORD code, const char** pName, const char** pDescription)
{
int i;
int count = sizeof(except_info) / sizeof(exception_codes);
for (i = 0; i < count; i++)
{
if (code == except_info[i].exCode)
{
*pName = except_info[i].exName;
*pDescription = except_info[i].exDescription;
return;
}
}
*pName = "Unknown exception";
*pDescription = "n/a";
}
extern char* g_appNameStr;
void CreateMiniDump(struct _EXCEPTION_POINTERS* exceptionInfo)
{
char tmpStr[256];
sprintf(tmpStr, "%s.dmp", g_appNameStr);
HMODULE mhLib = LoadLibraryA("dbghelp.dll");
MINIDUMPWRITEDUMP pDump = (MINIDUMPWRITEDUMP)::GetProcAddress(mhLib, "MiniDumpWriteDump");
HANDLE hFile = CreateFileA(tmpStr, GENERIC_WRITE, FILE_SHARE_WRITE, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
_MINIDUMP_EXCEPTION_INFORMATION ExInfo;
ExInfo.ThreadId = GetCurrentThreadId();
ExInfo.ExceptionPointers = exceptionInfo;
ExInfo.ClientPointers = FALSE;
pDump(GetCurrentProcess(), GetCurrentProcessId(), hFile, MiniDumpNormal, &ExInfo, NULL, NULL);
CloseHandle(hFile);
}
LONG WINAPI unhandled_handler(struct _EXCEPTION_POINTERS* exceptionInfo)
{
EXCEPTION_RECORD* pRecord = exceptionInfo->ExceptionRecord;
const char* pName, * pDescription;
GetExceptionStrings(pRecord->ExceptionCode, &pName, &pDescription);
char tmp[2048];
sprintf(tmp, "Exception code: %s (0x%x)\nAddress: %p\n\n\n",
pName, pRecord->ExceptionCode, pRecord->ExceptionAddress);
if (pRecord->ExceptionCode == EXCEPTION_ACCESS_VIOLATION)
{
if (pRecord->ExceptionInformation[0])
{
sprintf(tmp, "%s (0x%x)\nAddress: %p\n\n\nThe thread attempted to write to an inaccessible address %p\nMinidump '%s.dmp' will be saved.",
pName, pRecord->ExceptionCode, pRecord->ExceptionAddress, pRecord->ExceptionInformation[1], g_appNameStr);
}
else
{
sprintf(tmp, "%s (0x%x)\nAddress: %p\n\n\nThe thread attempted to read the inaccessible data at %p\nMinidump '%s.dmp' will be saved.",
pName, pRecord->ExceptionCode, pRecord->ExceptionAddress, pRecord->ExceptionInformation[1], g_appNameStr);
}
}
else
{
sprintf(tmp, "%s (0x%x)\nAddress: %p\n\n\nMinidump '%s.dmp' will be saved.",
pName, pRecord->ExceptionCode, pRecord->ExceptionAddress, g_appNameStr);
}
MessageBoxA(NULL, tmp, "Unhandled exception!", MB_OK | MB_ICONERROR);
CreateMiniDump(exceptionInfo);
return EXCEPTION_CONTINUE_SEARCH;
}
typedef LONG(WINAPI* EXCEPTHANDLER)(EXCEPTION_POINTERS* ExceptionInfo);
static EXCEPTHANDLER oldHandler = NULL;
static int handler_installed = 0;
static _purecall_handler oldPureCall = NULL;
void pure_call_handler()
{
MessageBoxA(NULL, "Pure virtual function call", "FATAL ERROR", MB_OK | MB_ICONERROR);
}
void InstallExceptionHandler()
{
oldHandler = SetUnhandledExceptionFilter(unhandled_handler);
oldPureCall = _get_purecall_handler();
_set_purecall_handler(pure_call_handler);
handler_installed = 1;
}
void UnInstallExceptionHandler()
{
if (handler_installed)
{
SetUnhandledExceptionFilter(oldHandler);
_set_purecall_handler(oldPureCall);
}
}
#else
void InstallExceptionHandler()
{
}
void UnInstallExceptionHandler()
{
}
#endif

View File

@ -1,7 +0,0 @@
#ifndef CRASH_HANDLER_H
#define CRASH_HANDLER_H
void InstallExceptionHandler();
void UnInstallExceptionHandler();
#endif

View File

@ -1,44 +0,0 @@
#ifdef _WIN32
#include <windows.h>
#else
#include <stddef.h>
#endif // _WIN32
#include "PsyX/util/timer.h"
void Util_InitHPCTimer(timerCtx_t* timer)
{
#ifdef _WIN32
QueryPerformanceCounter((LARGE_INTEGER*)&timer->clockStart); // as it represents 64 bit value, it's safe to use
#else
gettimeofday(&timer->timeStart, NULL);
#endif // _WIN32
}
double Util_GetHPCTime(timerCtx_t* timer, int reset)
{
double value;
#ifdef _WIN32
LARGE_INTEGER curr;
LARGE_INTEGER performanceFrequency;
QueryPerformanceFrequency(&performanceFrequency);
QueryPerformanceCounter(&curr);
value = (double)(curr.QuadPart - timer->clockStart) / (double)(performanceFrequency.QuadPart);
if (reset)
timer->clockStart = curr.QuadPart;
#else
struct timeval curr;
gettimeofday(&curr, NULL);
value = ((double)(curr.tv_sec - timer->timeStart.tv_sec) + (double)(curr.tv_usec - timer->timeStart.tv_usec) * 0.000001);
if (reset)
timer->timeStart = curr;
#endif // _WIN32
return value;
}