diff --git a/.appveyor/Install.sh b/.appveyor/Install.sh index 009a112e..afe2e976 100755 --- a/.appveyor/Install.sh +++ b/.appveyor/Install.sh @@ -9,7 +9,7 @@ curl "$linux_premake_url" -Lo premake5.tar.gz tar xvf premake5.tar.gz sudo apt-get update -qq -y -sudo apt-get install --no-install-recommends -y g++-7-multilib gcc-7-multilib +sudo apt-get install --no-install-recommends -y gcc-multilib g++-multilib sudo apt-get install -qq aptitude -y # fix Ubuntu's broken mess of packages using aptitude diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 00000000..bd736094 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "src_rebuild/PsyCross"] + path = src_rebuild/PsyCross + url = https://github.com/OpenDriver2/PsyCross.git \ No newline at end of file diff --git a/PSXToolchain/CDSrc/licensea.dat b/PSXToolchain/CDSrc/licensea.dat deleted file mode 100644 index 8773d1f8..00000000 Binary files a/PSXToolchain/CDSrc/licensea.dat and /dev/null differ diff --git a/PSXToolchain/CDSrc/pack.bat b/PSXToolchain/CDSrc/pack.bat new file mode 100644 index 00000000..f049e170 --- /dev/null +++ b/PSXToolchain/CDSrc/pack.bat @@ -0,0 +1,2 @@ +mkpsxiso.exe redriver2_cd.xml -y +pause \ No newline at end of file diff --git a/PSXToolchain/CDSrc/redriver2_cd.xml b/PSXToolchain/CDSrc/redriver2_cd.xml index 660b3656..494dc6e7 100644 --- a/PSXToolchain/CDSrc/redriver2_cd.xml +++ b/PSXToolchain/CDSrc/redriver2_cd.xml @@ -1,128 +1,240 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/PSXToolchain/CDSrc/unpack.bat b/PSXToolchain/CDSrc/unpack.bat new file mode 100644 index 00000000..eab939f8 --- /dev/null +++ b/PSXToolchain/CDSrc/unpack.bat @@ -0,0 +1,2 @@ +dumpsxiso.exe Driver2CD2.bin -s CD.xml +pause \ No newline at end of file diff --git a/PSXToolchain/psx_build.bat b/PSXToolchain/psx_build.bat index e1118960..bebe8ea6 100644 --- a/PSXToolchain/psx_build.bat +++ b/PSXToolchain/psx_build.bat @@ -1,3 +1,5 @@ +echo off +cls set REDRIVER_FOLDER=%cd%\.. rem Make a symlink diff --git a/PSXToolchain/psx_makecd.bat b/PSXToolchain/psx_makecd.bat deleted file mode 100644 index d49f5afc..00000000 --- a/PSXToolchain/psx_makecd.bat +++ /dev/null @@ -1,4 +0,0 @@ -cd CDSrc -mkpsxiso.exe -lba2 redriver2.txt -lba redriver2_.txt redriver2_cd.xml - -pause \ No newline at end of file diff --git a/appveyor.yml b/appveyor.yml index fb9e629b..9757870f 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -16,18 +16,20 @@ environment: project_folder: '%APPVEYOR_BUILD_FOLDER%\\src_rebuild' dependency_folder: '%APPVEYOR_BUILD_FOLDER%\dependencies' # Dependency URLs - windows_premake_url: 'https://github.com/premake/premake-core/releases/download/v5.0.0-alpha15/premake-5.0.0-alpha15-windows.zip' + windows_premake_url: 'https://github.com/premake/premake-core/releases/download/v5.0.0-beta1/premake-5.0.0-beta1-windows.zip' windows_jpeg_url: 'http://www.ijg.org/files/jpegsr9d.zip' windows_openal_url: 'https://openal-soft.org/openal-binaries/openal-soft-1.21.1-bin.zip' - windows_sdl2_url: 'https://www.libsdl.org/release/SDL2-devel-2.0.14-VC.zip' - linux_premake_url: 'https://github.com/premake/premake-core/releases/download/v5.0.0-alpha15/premake-5.0.0-alpha15-linux.tar.gz' + windows_sdl2_url: 'https://www.libsdl.org/release/SDL2-devel-2.0.20-VC.zip' + linux_premake_url: 'https://github.com/premake/premake-core/releases/download/v5.0.0-beta1/premake-5.0.0-beta1-linux.tar.gz' # Dependency Directories windows_jpeg_dir: '%dependency_folder%\jpeg-9d' windows_openal_dir: '%dependency_folder%\openal-soft-1.21.1-bin' - windows_sdl2_dir: '%dependency_folder%\SDL2-2.0.14' + windows_sdl2_dir: '%dependency_folder%\SDL2-2.0.20' install: + - git submodule init + - git submodule update - cmd: '%APPVEYOR_BUILD_FOLDER%\.appveyor\Install.bat' - sh: '${APPVEYOR_BUILD_FOLDER}/.appveyor/Install.sh' diff --git a/data/config.ini b/data/config.ini index 9ef40a0a..e21c8079 100644 --- a/data/config.ini +++ b/data/config.ini @@ -97,7 +97,7 @@ start=w select=H [cdfs] -image=install/Driver2CD1.bin +#image=install/Driver2CD1.bin mode=1,2,2352 # track, mode, sector size. DO NOT MODIFY [pad] @@ -107,7 +107,10 @@ pad2device=-1 # player 2 controller device; -1 for automatic assignment [render] windowWidth=1280 windowHeight=720 -fullscreen=0 # enable full screen mode; it takes screen resolution +fullscreen=0 # enable full screen mode +screenWidth=1280 # screen resolution when fullscreen is on +screenHeight=720 +vsync=1 # Prevents screen tearing in Full screen. Turn it off if you have framerate problems. pgxpTextureMapping=1 bilinearFiltering=1 # "smooth" textures pgxpZbuffer=1 # full Z-buffer on PSX polygons @@ -121,5 +124,4 @@ freeCamera=1 # Press F7 in game to enable fastLoadingScreens=1 widescreenOverlays=1 # set 1 to see map, bars and stats aligned to screen corners driver1music=0 # put Driver 1's MUSIC.BIN as D1MUSIC.BIN to DRIVER2\SOUNDS folder -overrideContent=0 # this enables texture and car model modding -userChases=RacingFreak,Snoopi,Olanov,Vortex,Fireboyd78 \ No newline at end of file +overrideContent=0 # this enables texture and car model modding \ No newline at end of file diff --git a/src_rebuild/DebugOverlay.cpp b/src_rebuild/DebugOverlay.cpp index 2986884e..bd4a6377 100644 --- a/src_rebuild/DebugOverlay.cpp +++ b/src_rebuild/DebugOverlay.cpp @@ -40,13 +40,8 @@ void DrawDebugOverlays() gte_SetRotMatrix(&inv_camera_matrix); SVECTOR a, b; - a.vx = ld.posA.vx - camera_position.vx; - a.vy = ld.posA.vy - camera_position.vy; - a.vz = ld.posA.vz - camera_position.vz; - - b.vx = ld.posB.vx - camera_position.vx; - b.vy = ld.posB.vy - camera_position.vy; - b.vz = ld.posB.vz - camera_position.vz; + VecSubtract(&a, &ld.posA, &camera_position); + VecSubtract(&b, &ld.posB, &camera_position); gte_ldv3(&a, &b, &b); diff --git a/src_rebuild/Game/ASM/rndrasm.c b/src_rebuild/Game/ASM/rndrasm.c index 4e0f726a..0bb1c759 100644 --- a/src_rebuild/Game/ASM/rndrasm.c +++ b/src_rebuild/Game/ASM/rndrasm.c @@ -34,15 +34,13 @@ int Apply_InvCameraMatrixSetTrans(VECTOR_NOPAD* pos) { VECTOR vfc; VECTOR vec; - VECTOR local; + SVECTOR local; gte_stfc(&vfc); - local.vx = (pos->vx - vfc.vx) << 0x10 >> 0x10; - local.vy = (pos->vy - vfc.vy) << 0x10 >> 0x10; - local.vz = (pos->vz - vfc.vz) << 0x10 >> 0x10; + VecSubtract(&local, pos, &vfc); #ifdef PSX - gte_ldlvl(&local); + gte_ldsv(&local); gte_lcir(); gte_stlvl(&vec); #else @@ -67,15 +65,13 @@ int Apply_InvCameraMatrixAndSetMatrix(VECTOR_NOPAD* pos, MATRIX2* mtx) { VECTOR vfc; VECTOR vec; - VECTOR local; + SVECTOR local; gte_stfc(&vfc); - local.vx = (pos->vx - vfc.vx) << 0x10 >> 0x10; - local.vy = (pos->vy - vfc.vy) << 0x10 >> 0x10; - local.vz = (pos->vz - vfc.vz) << 0x10 >> 0x10; + VecSubtract(&local, pos, &vfc); #ifdef PSX - gte_ldlvl(&local); + gte_ldsv(&local); gte_lcir(); gte_stlvl(&vec); #else @@ -92,8 +88,6 @@ int Apply_InvCameraMatrixAndSetMatrix(VECTOR_NOPAD* pos, MATRIX2* mtx) gte_SetRotMatrix(mtx); gte_SetTransVector(&vec); - - if (vec.vx >> 1 < 0) return vec.vz - vec.vx; @@ -103,19 +97,16 @@ int Apply_InvCameraMatrixAndSetMatrix(VECTOR_NOPAD* pos, MATRIX2* mtx) // [D] [T] int FrustrumCheck16(PACKED_CELL_OBJECT* pcop, int bounding_sphere) { - VECTOR local; - local.vx = (pcop->pos.vx - camera_position.vx) << 0x10 >> 0x11; - local.vy = (pcop->pos.vy - camera_position.vy) << 0x10 >> 0x11; - local.vz = (pcop->pos.vz - camera_position.vz) << 0x10 >> 0x11; - - gte_ldlvl(&local); + VECTOR result; + SVECTOR local; + VecSubtract(&local, &pcop->pos, &camera_position); + gte_ldsv(&local); gte_llir(); - VECTOR result; gte_stlvnl(&result); - int ang = frustrum_matrix.t[0] - (bounding_sphere >> 1); + int ang = frustrum_matrix.t[0] - bounding_sphere; if (ang <= result.vx && ang <= result.vy && ang <= result.vz) return 0; @@ -126,19 +117,16 @@ int FrustrumCheck16(PACKED_CELL_OBJECT* pcop, int bounding_sphere) // [D] [T] int FrustrumCheck(VECTOR* pos, int bounding_sphere) { - VECTOR local; - local.vx = (pos->vx - camera_position.vx) << 0x10 >> 0x11; - local.vy = (pos->vy - camera_position.vy) << 0x10 >> 0x11; - local.vz = (pos->vz - camera_position.vz) << 0x10 >> 0x11; - - gte_ldlvl(&local); + VECTOR result; + SVECTOR local; + VecSubtract(&local, pos, &camera_position); + gte_ldsv(&local); gte_llir(); - VECTOR result; gte_stlvnl(&result); - int ang = frustrum_matrix.t[0] - (bounding_sphere >> 1); + int ang = frustrum_matrix.t[0] - bounding_sphere; if (ang <= result.vx && ang <= result.vy && ang <= result.vz) return 0; diff --git a/src_rebuild/Game/C/E3stuff.c b/src_rebuild/Game/C/E3stuff.c index 2271bfa8..d82b6642 100644 --- a/src_rebuild/Game/C/E3stuff.c +++ b/src_rebuild/Game/C/E3stuff.c @@ -387,8 +387,6 @@ void FadeOutHiresScreen(void) PutDispEnv(&disp); PutDrawEnv(&draw); - //g_wireframeMode = 1; - DrawSync(0); SetDispMask(1); @@ -524,8 +522,6 @@ void SetPleaseWait(char *buffer) ResetCityType(); #else - ResetCityType(); - PsyX_EndScene(); #endif // PSX diff --git a/src_rebuild/Game/C/ai.h b/src_rebuild/Game/C/ai.h index afa59607..dabf4f91 100644 --- a/src_rebuild/Game/C/ai.h +++ b/src_rebuild/Game/C/ai.h @@ -1,7 +1,6 @@ #ifndef AI_H #define AI_H - extern void StoreGameFlags(); // 0x0001BBB8 extern int TannerCanEnterCar(CAR_DATA *cp, int distToCarSq); // 0x0001BBE8 extern int TannerStuckInCar(int doSpeedCheck, int player_id); // 0x0001BA90 diff --git a/src_rebuild/Game/C/camera.c b/src_rebuild/Game/C/camera.c index 9466cbb3..2dfc3a07 100644 --- a/src_rebuild/Game/C/camera.c +++ b/src_rebuild/Game/C/camera.c @@ -365,6 +365,10 @@ int CameraCollisionCheck(void) // [D] [T] void TurnHead(PLAYER *lp) { + LPPEDESTRIAN pPlayerPed; + + pPlayerPed = lp->pPed; + // [A] handle REDRIVER2 dedicated look back button if ((paddCamera & CAMERA_PAD_LOOK_BACK) == CAMERA_PAD_LOOK_BACK || (paddCamera & CAMERA_PAD_LOOK_BACK_DED)) { @@ -444,10 +448,15 @@ void PlaceCameraFollowCar(PLAYER *lp) if(car_cos) { + int addDist; + carheight = car_cos->colBox.vy * -3 + 85; + // [A] default just adds 248, but it's too close for big vehicles + addDist = MAX(248, car_cos->colBox.vy * 3); + if (gCameraMaxDistance == 0) - maxCameraDist = car_cos->colBox.vz * 2 + car_cos->colBox.vy + 248; + maxCameraDist = car_cos->colBox.vz * 2 + car_cos->colBox.vy + addDist; else maxCameraDist = gCameraMaxDistance; diff --git a/src_rebuild/Game/C/cars.c b/src_rebuild/Game/C/cars.c index a0b14a3a..e1aebfc9 100644 --- a/src_rebuild/Game/C/cars.c +++ b/src_rebuild/Game/C/cars.c @@ -20,6 +20,20 @@ #include "glaunch.h" #include "ASM/rndrasm.h" +struct plotCarGlobals +{ + u_char* primptr; + OTTYPE* ot; + u_int intensity; + u_short* pciv_clut; + u_int ShineyTPageASL16; + u_int ShineyClutASL16; + u_char* damageLevel; + u_char* shineyTable; + int ghost; +}; + + #ifndef PSX #define CAR_LOD_SWITCH_DISTANCE switch_detail_distance #else @@ -46,7 +60,6 @@ MODEL* gDamWheelModelPtr; CAR_DATA* active_car_list[MAX_CARS]; BOUND_BOX bbox[MAX_CARS]; u_char lightsOnDelay[MAX_CARS]; -u_short civ_clut[8][32][6]; short FrontWheelRotation[MAX_CARS]; // offset 0x0 short BackWheelRotation[MAX_CARS]; // offset 0x30 @@ -63,6 +76,10 @@ MODEL* gCarLowModelPtr[MAX_CAR_MODELS]; MODEL* gCarDamModelPtr[MAX_CAR_MODELS]; MODEL* gCarCleanModelPtr[MAX_CAR_MODELS]; +// pedestrian palette at 0 and next are cars +// model_id, texture_number, palette +u_short civ_clut[8][32][6]; + int whichCP = 0; int baseSpecCP = 0; CAR_POLY carPolyBuffer[2001]; @@ -327,11 +344,12 @@ void setupLightingMatrices(void) if (gTimeOfDay == 3) { - gte_ldbkdir(0x400, 0x400, 0x400); - return; + gte_SetBackColor(64, 64, 64); + } + else + { + gte_SetBackColor(140, 140, 140); } - - gte_ldbkdir(0x8c0, 0x8c0, 0x8c0); } // [D] [T] @@ -564,7 +582,7 @@ void DrawCarWheels(CAR_DATA *cp, MATRIX *RearMatrix, VECTOR *pos, int zclip) MODEL *WheelModelBack; MODEL *WheelModelFront; -#ifdef PSX +#if 0 //def PSX MATRIX& FrontMatrix = *(MATRIX*)(u_char*)getScratchAddr(0); MATRIX& SteerMatrix = *(MATRIX*)((u_char*)getScratchAddr(0) + sizeof(MATRIX)); VECTOR& WheelPos = *(VECTOR*)((u_char*)getScratchAddr(0) + sizeof(MATRIX) * 2); @@ -785,7 +803,7 @@ void PlayerCarFX(CAR_DATA *cp) // [D] [T] void plotNewCarModel(CAR_MODEL* car, int palette) { -#ifdef PSX +#if 0 //def PSX plotCarGlobals& _pg = *(plotCarGlobals*)(u_char*)getScratchAddr(0); #else plotCarGlobals _pg; @@ -874,8 +892,7 @@ void buildNewCars(void) // [D] [T] void buildNewCarFromModel(CAR_MODEL *car, MODEL *model, int first) { - u_char ptype; - u_char clut; + u_char ptype, clut; u_char *polyList; CAR_POLY *cp; @@ -908,10 +925,9 @@ void buildNewCarFromModel(CAR_MODEL *car, MODEL *model, int first) else if (pass == 2) car->pB3 = carPolyBuffer + whichCP; - i = 0; newNumPolys = whichCP; - while (newNumPolys < 2000 && i < model->num_polys) + for (i = 0; newNumPolys < 2000 && i < model->num_polys; i++) { ptype = *polyList; @@ -936,7 +952,7 @@ void buildNewCarFromModel(CAR_MODEL *car, MODEL *model, int first) cp->vindices = M_INT_4R(polyList[4], polyList[5], polyList[6], 0); cp->originalindex = i; - cp = carPolyBuffer + newNumPolys + 1; + cp++; cp->vindices = M_INT_4R(polyList[4], polyList[6], polyList[7], 0); cp->originalindex = i; @@ -969,7 +985,7 @@ void buildNewCarFromModel(CAR_MODEL *car, MODEL *model, int first) cp->uv3_uv2 = *(ushort*)&pft4->uv2; cp->originalindex = i; - cp = carPolyBuffer + newNumPolys + 1; + cp++; cp->vindices = M_INT_4R(pft4->v0, pft4->v2, pft4->v3, 0); cp->clut_uv0 = M_INT_2(texture_cluts[polyList[1]][polyList[2]], *(ushort*)&pft4->uv0); @@ -1013,7 +1029,7 @@ void buildNewCarFromModel(CAR_MODEL *car, MODEL *model, int first) cp->uv3_uv2 = *(ushort*)&pgt4->uv2; cp->originalindex = i; - cp = carPolyBuffer + newNumPolys + 1; + cp++; cp->vindices = M_INT_4R(pgt4->v0, pgt4->v2, pgt4->v3, 0); cp->nindices = M_INT_4R(pgt4->n0, pgt4->n2, pgt4->n3, 0); @@ -1027,7 +1043,6 @@ void buildNewCarFromModel(CAR_MODEL *car, MODEL *model, int first) } polyList += PolySizes[ptype & 0x1f]; - i++; } if (pass == 1) @@ -1047,13 +1062,10 @@ void MangleWheelModels(void) { UV_INFO tmpUV2; u_char tmpUV; - int i; - u_int v0; - u_int v1; - u_int v2; + u_int v0, v1, v2; POLYFT4*src; MODEL *m; - int j; + int i, j; for (i = 0; i < 3; i++) { diff --git a/src_rebuild/Game/C/cell.c b/src_rebuild/Game/C/cell.c index c164edba..15b14727 100644 --- a/src_rebuild/Game/C/cell.c +++ b/src_rebuild/Game/C/cell.c @@ -181,8 +181,6 @@ CELL_OBJECT* UnpackCellObject(PACKED_CELL_OBJECT* ppco, XZPAIR* near) // [D] [T] void QuickUnpackCellObject(PACKED_CELL_OBJECT* ppco, XZPAIR* near, CELL_OBJECT* pco) { - cell_object_index = cell_object_index + 1 & 0x3ff; - pco->pos.vx = near->x + (((ppco->pos.vx - near->x) << 0x10) >> 0x10); pco->pos.vz = near->z + (((ppco->pos.vz - near->z) << 0x10) >> 0x10); diff --git a/src_rebuild/Game/C/civ_ai.c b/src_rebuild/Game/C/civ_ai.c index a833c7f3..b5a037f9 100644 --- a/src_rebuild/Game/C/civ_ai.c +++ b/src_rebuild/Game/C/civ_ai.c @@ -152,7 +152,6 @@ int InitCar(CAR_DATA* cp, int direction, LONGVECTOR4* startPos, unsigned char co case CONTROL_TYPE_LEAD_AI: // free roamer lead car InitLead(cp); - leadCarId = cp->id; cp->hndType = 5; break; } @@ -2173,8 +2172,8 @@ int PingInCivCar(int minPingInDist) } else { - i = 0; - while (i < numLanes) + + for (i = 0; i < numLanes; i++) { // collect the lanes. allowedToPark = ROAD_IS_PARKING_ALLOWED_AT(&roadInfo, i); @@ -2187,8 +2186,6 @@ int PingInCivCar(int minPingInDist) // pick only non-parkable driveable lanes if parked cars not requested if (tryPingInParkedCars && allowedToPark || ROAD_IS_AI_LANE(&roadInfo, i) && !allowedToPark) possibleLanes[numPossibleLanes++] = i; - - i++; } if (numPossibleLanes == 0) @@ -3674,8 +3671,7 @@ int CivControl(CAR_DATA* cp) if (cp->ai.c.thrustState != 3) steer = CivSteerAngle(cp); - // reduce acceleration when steering is applied - thrust = CivAccel(cp) - MAX(ABS(steer), 4) * 3; + thrust = CivAccel(cp) - MAX(ABS(steer), 4) * 3; // [A] reduce acceleration when steering is applied if (thrust < 0 && cp->hd.wheel_speed < 5) thrust = 0; diff --git a/src_rebuild/Game/C/civ_ai.h b/src_rebuild/Game/C/civ_ai.h index 22bc5bc0..069ebf00 100644 --- a/src_rebuild/Game/C/civ_ai.h +++ b/src_rebuild/Game/C/civ_ai.h @@ -1,6 +1,17 @@ #ifndef CIV_AI_H #define CIV_AI_H +typedef struct _EXTRA_CIV_DATA +{ + int surfInd; + int distAlongSegment; + short angle; + u_short ctrlState; + int thrustState; + u_char palette; + u_char controlFlags; +} EXTRA_CIV_DATA; + extern const u_char speedLimits[3]; extern unsigned char reservedSlots[MAX_CARS]; extern int frameStart; diff --git a/src_rebuild/Game/C/cop_ai.c b/src_rebuild/Game/C/cop_ai.c index 9241bfd7..ad14cd86 100644 --- a/src_rebuild/Game/C/cop_ai.c +++ b/src_rebuild/Game/C/cop_ai.c @@ -19,6 +19,14 @@ #include "pedest.h" #include "pres.h" +enum AIZone +{ + zoneFrnt = 0, + zoneBack = 1, + zoneLeft = 2, + zoneRght = 3, +}; + struct iVectNT { int n; @@ -846,7 +854,7 @@ void ControlCopDetection(void) } // [A] also check player elevation from cops (block cops vision from bridges, tunnels etc) - if (spotted && ABS(cp->hd.where.t[1] - vec.vy) < 1500) + if (spotted && ABS(cp->hd.where.t[1] - vec.vy) < 1000) { CopsCanSeePlayer = 1; break; diff --git a/src_rebuild/Game/C/cop_ai.h b/src_rebuild/Game/C/cop_ai.h index 92023b22..a5905cfd 100644 --- a/src_rebuild/Game/C/cop_ai.h +++ b/src_rebuild/Game/C/cop_ai.h @@ -1,6 +1,13 @@ #ifndef COP_AI_H #define COP_AI_H +struct COP_SIGHT_DATA +{ + short surroundViewDistance; + short frontViewDistance; + short frontViewAngle; +}; + extern COP_DATA gCopData; extern COP_SIGHT_DATA copSightData; extern VECTOR roadblockLoc; diff --git a/src_rebuild/Game/C/cutrecorder.c b/src_rebuild/Game/C/cutrecorder.c index 201dedf5..85aadd83 100644 --- a/src_rebuild/Game/C/cutrecorder.c +++ b/src_rebuild/Game/C/cutrecorder.c @@ -42,6 +42,7 @@ int gChaseStuckTimer = 0; int gCutsceneAsReplay_ReChaseLoaded = 0; int gCutsceneAsReplay = 0; +int gCutsceneAsReplay_NumReplayStreams = 0; int gCutsceneAsReplay_PlayerId = 0; int gCutsceneAsReplay_PlayerChanged = 0; int gCutsceneAsReplay_ReserveSlots = 2; @@ -251,10 +252,10 @@ void CutRec_NextPlayer(int dir) else if (dir < 0) gCutsceneAsReplay_PlayerId--; - if (gCutsceneAsReplay_PlayerId >= NumReplayStreams) - gCutsceneAsReplay_PlayerId -= NumReplayStreams; + if (gCutsceneAsReplay_PlayerId >= gCutsceneAsReplay_NumReplayStreams) + gCutsceneAsReplay_PlayerId -= gCutsceneAsReplay_NumReplayStreams; else if (gCutsceneAsReplay_PlayerId < 0) - gCutsceneAsReplay_PlayerId += NumReplayStreams; + gCutsceneAsReplay_PlayerId += gCutsceneAsReplay_NumReplayStreams; if (old_player != gCutsceneAsReplay_PlayerId) gCutsceneAsReplay_PlayerChanged = 1; @@ -364,6 +365,8 @@ void InitCutsceneRecorder(char* configFilename) return; } + gCutsceneAsReplay_NumReplayStreams = NumReplayStreams; + gLoadedReplay = 1; CurrentGameMode = GAMEMODE_REPLAY; } @@ -375,10 +378,10 @@ void InitCutsceneRecorder(char* configFilename) InitPadRecording(); - ini_sget(config, "settings", "streams", "%d", &NumReplayStreams); + ini_sget(config, "settings", "streams", "%d", &gCutsceneAsReplay_NumReplayStreams); // initialize all streams - for (i = 0; i < NumReplayStreams; i++) + for (i = 0; i < gCutsceneAsReplay_NumReplayStreams; i++) { stream = &ReplayStreams[i].SourceType; sprintf(curStreamName, "stream%d", i); @@ -470,15 +473,22 @@ void CutRec_CheckInvalidatePing(int carId, int howHard) int CutRec_InitPlayers() { + STREAM_SOURCE* temp; if (gCutsceneAsReplay == 0) return 0; - for (int i = 0; i < NumReplayStreams; i++) + for (int i = 0; i < gCutsceneAsReplay_NumReplayStreams; i++) { PlayerStartInfo[i] = &ReplayStreams[i].SourceType; + PlayerStartInfo[i]->controlType = CONTROL_TYPE_CUTSCENE; } - numPlayersToCreate = NumReplayStreams; + temp = PlayerStartInfo[0]; + PlayerStartInfo[0] = PlayerStartInfo[gCutsceneAsReplay_PlayerId]; + PlayerStartInfo[gCutsceneAsReplay_PlayerId] = temp; + + NumReplayStreams = gCutsceneAsReplay_NumReplayStreams; + numPlayersToCreate = gCutsceneAsReplay_NumReplayStreams; return 1; } @@ -765,9 +775,9 @@ int CutRec_SaveChase() return 0; } -int CutRec_RecordPad(CAR_DATA* cp, uint* t0, char* t1, char* t2) +int CutRec_RecordCarPad(CAR_DATA* cp, uint* t0, char* t1, char* t2) { - if (gCutsceneAsReplay == 0 || NoPlayerControl || cp->id != gCutsceneAsReplay_PlayerId) + if (gCutsceneAsReplay == 0 || NoPlayerControl || (-*cp->ai.padid) != gCutsceneAsReplay_PlayerId) return 0; *t0 = Pads[0].mapped; // [A] padid might be wrong @@ -790,6 +800,27 @@ int CutRec_RecordPad(CAR_DATA* cp, uint* t0, char* t1, char* t2) return 1; } +int CutRec_RecordPad(PLAYER* pl, uint* t0, char* t1, char* t2) +{ + if (gCutsceneAsReplay == 0 || NoPlayerControl || (-pl->padid) != gCutsceneAsReplay_PlayerId) + return 0; + + *t0 = Pads[0].mapped; + *t1 = Pads[0].mapanalog[2]; + *t2 = Pads[0].type & 4; + + // [A] handle REDRIVER2 dedicated car entry button + if (*t0 & TANNER_PAD_ACTION_DED) + { + *t0 &= ~TANNER_PAD_ACTION_DED; + *t0 |= TANNER_PAD_ACTION; + } + + cjpRecord(-pl->padid, t0, t1, t2); + + return 1; +} + int CutRec_IsRecording() { if (gCutsceneAsReplay == 0) diff --git a/src_rebuild/Game/C/cutrecorder.h b/src_rebuild/Game/C/cutrecorder.h index 58eb4ea0..4863b529 100644 --- a/src_rebuild/Game/C/cutrecorder.h +++ b/src_rebuild/Game/C/cutrecorder.h @@ -25,7 +25,8 @@ extern void CutRec_ReserveSlots(); extern void CutRec_HandleCarRequest(); extern int CutRec_InitPlayers(); extern int CutRec_InitMission(char* filename); -extern int CutRec_RecordPad(CAR_DATA* cp, uint* t0, char* t1, char* t2); +extern int CutRec_RecordCarPad(CAR_DATA* cp, uint* t0, char* t1, char* t2); +extern int CutRec_RecordPad(PLAYER* pl, uint* t0, char* t1, char* t2); extern int CutRec_SaveChase(); #ifdef CUTSCENE_RECORDER @@ -40,10 +41,11 @@ extern int CutRec_SaveChase(); #define _CutRec_StorePingInfo(a,b) CutRec_StorePingInfo(a,b) #define _CutRec_CheckInvalidatePing(a,b) CutRec_CheckInvalidatePing(a, b) #define _CutRec_NextChase(a) CutRec_NextChase(a) -#define _CutRec_ReserveSlots() CutRec_ReserveSlots +#define _CutRec_ReserveSlots() CutRec_ReserveSlots() #define _CutRec_HandleCarRequest() CutRec_HandleCarRequest() #define _CutRec_InitPlayers() CutRec_InitPlayers() #define _CutRec_InitMission(a) CutRec_InitMission(a) +#define _CutRec_RecordCarPad(a, b, c, d) CutRec_RecordCarPad(a, b, c, d) #define _CutRec_RecordPad(a, b, c, d) CutRec_RecordPad(a, b, c, d) #else @@ -62,6 +64,7 @@ extern int CutRec_SaveChase(); #define _CutRec_HandleCarRequest() (0) #define _CutRec_InitPlayers() (0) #define _CutRec_InitMission(a) (0) +#define _CutRec_RecordCarPad(a, b, c, d) (0) #define _CutRec_RecordPad(a, b, c, d) (0) #endif diff --git a/src_rebuild/Game/C/cutscene.c b/src_rebuild/Game/C/cutscene.c index d8d981f9..1e5451e4 100644 --- a/src_rebuild/Game/C/cutscene.c +++ b/src_rebuild/Game/C/cutscene.c @@ -23,6 +23,20 @@ #include "xaplay.h" #include "overlay.h" +struct CUTSCENE_BUFFER +{ + int numResident; + u_char residentCutscenes[4]; + char(*residentPointers[4]); + + char* buffer; + char* currentPointer; + + int bytesFree; + int reservedSize; + // char buffer[32*1024]; // was 8192, but we have some free mem now even for PSX. Using malloc. +}; + int gSkipInGameCutscene = 0; int gInGameCutsceneActive = 0; @@ -270,7 +284,7 @@ void DrawInGameCutscene(void) tile->w = 1200; #endif - tile->y0 = 256 - BlackBorderHeight; + tile->y0 = SCREEN_H - BlackBorderHeight; tile->h = BlackBorderHeight; addPrim(current->ot, tile); diff --git a/src_rebuild/Game/C/cutscene.h b/src_rebuild/Game/C/cutscene.h index 46f16d2e..53531424 100644 --- a/src_rebuild/Game/C/cutscene.h +++ b/src_rebuild/Game/C/cutscene.h @@ -1,6 +1,18 @@ #ifndef CUTSCENE_H #define CUTSCENE_H +struct CUTSCENE_INFO +{ + u_short offset; + u_short size; +}; + +struct CUTSCENE_HEADER +{ + int maxsize; + CUTSCENE_INFO data[15]; +}; + #ifndef PSX #define MAX_USER_REPLAYS 16 @@ -9,9 +21,7 @@ extern int gNumUserChases; extern void InitUserReplays(const char* str); -#endif - -extern CUTSCENE_BUFFER CutsceneBuffer; +#endif // PSX extern int NumCutsceneStreams; extern int gSkipInGameCutscene; diff --git a/src_rebuild/Game/C/director.c b/src_rebuild/Game/C/director.c index f7592681..e7b83668 100644 --- a/src_rebuild/Game/C/director.c +++ b/src_rebuild/Game/C/director.c @@ -17,6 +17,7 @@ #include "pres.h" #include "sound.h" #include "system.h" +#include "pad.h" struct REPLAY_ICON { @@ -1053,27 +1054,27 @@ void ControlReplay(void) } // register pads - if ((padd & 0x8000) && debounce == 0) + if ((padd & MPAD_D_LEFT) && debounce == 0) { move = 2; debounce = 1; } - if ((padd & 0x2000) && debounce == 0) + if ((padd & MPAD_D_RIGHT) && debounce == 0) { move = 1; debounce = 1; } - if ((padd & 0x1000) && debounce == 0) + if ((padd & MPAD_D_UP) && debounce == 0) { move = 3; debounce = 1; } - if ((padd & 0x4000) && debounce == 0) + if ((padd & MPAD_D_DOWN) && debounce == 0) { move = 4; debounce = 1; } - if ((padd & 0x40) && debounce == 0) + if ((padd & MPAD_CROSS) && debounce == 0) { if (DirectorMenuActive == 0) pauseflag = 1; @@ -1085,14 +1086,14 @@ void ControlReplay(void) debounce = 1; } - if ((padd & 0x100) && debounce == 0) + if ((padd & MPAD_SELECT) && debounce == 0) // [A] { // Retro: Press Select to toggle overlays gDoOverlays ^= 1; debounce = 1; } - - if ((padd & 0x8000) == 0 && (padd & 0x7140) == 0) + + if ((padd & (MPAD_D_LEFT | MPAD_CROSS | MPAD_SELECT | MPAD_D_DOWN | MPAD_D_RIGHT | MPAD_D_UP)) == 0) { debounce = 0; } @@ -1103,7 +1104,7 @@ void ControlReplay(void) move = 0; speed = 1; - if (padd & 8) + if (padd & MPAD_R1) speed = 8; // control camera position and rotation @@ -1111,12 +1112,12 @@ void ControlReplay(void) if (EditMode == 1) { // edit start time - if ((padd & 0x2000U) != 0 && LastChange->FrameCnt < CameraCnt) + if ((padd & MPAD_D_RIGHT) != 0 && LastChange->FrameCnt < CameraCnt) { LastChange->FrameCnt++; } - if ((padd & 0x8000U) != 0 && PlaybackCamera[LastChange->prev].FrameCnt < LastChange->FrameCnt) + if ((padd & MPAD_D_LEFT) != 0 && PlaybackCamera[LastChange->prev].FrameCnt < LastChange->FrameCnt) { LastChange->FrameCnt--; } @@ -1124,30 +1125,30 @@ void ControlReplay(void) else if (EditMode == 2) { // Chase camera angle - if ((padd & 0x1000) != 0 && gCameraDistance > 500) + if ((padd & MPAD_D_UP) != 0 && gCameraDistance > 500) { gCameraDistance -= speed * 16; // [A] restore gCameraMaxDistance -= speed * 16; player[0].cameraDist = gCameraDistance; } - if ((padd & 0x4000) != 0 && gCameraDistance < 2750) + if ((padd & MPAD_D_DOWN) != 0 && gCameraDistance < 2750) { gCameraDistance += speed * 16; // [A] restore gCameraMaxDistance += speed * 16; player[0].cameraDist = gCameraDistance; } - if ((padd & 0x8000) != 0) + if ((padd & MPAD_D_LEFT) != 0) gCameraAngle = gCameraAngle + speed * 16; - if ((padd & 0x2000) != 0) + if ((padd & MPAD_D_RIGHT) != 0) gCameraAngle = gCameraAngle - speed * 16; - if ((padd & 4) && gCameraOffset.vy > -840) + if ((padd & MPAD_L1) && gCameraOffset.vy > -840) gCameraOffset.vy -= speed * 16; - if ((padd & 1) && gCameraOffset.vy < 50) + if ((padd & MPAD_L2) && gCameraOffset.vy < 50) gCameraOffset.vy += speed * 16; // OBSOLETE DRIVER 1 CODE @@ -1217,28 +1218,28 @@ void ControlReplay(void) else dir = ratan2(dz, dx); - if (padd & 2) + if (padd & MPAD_R2) // [A] use R2 as a modifier hor camera Y offset { - if ((padd & 0x1000U) && gCameraOffset.vy > -150) + if ((padd & MPAD_D_UP) && gCameraOffset.vy > -150) gCameraOffset.vy -= speed * 16; - if ((padd & 0x4000) && gCameraOffset.vy < 150) + if ((padd & MPAD_D_DOWN) && gCameraOffset.vy < 150) gCameraOffset.vy += speed * 16; } else { - if ((padd & 0x1000) != 0 && (tracking_car == 0 || d > 500)) + if ((padd & MPAD_D_UP) != 0 && (tracking_car == 0 || d > 500)) x = speed * -16; - if ((padd & 0x4000) != 0) + if ((padd & MPAD_D_DOWN) != 0) x = speed * 16; } - if ((padd & 0x8000) != 0 && (tracking_car == 0 || d > 500)) + if ((padd & MPAD_D_LEFT) != 0 && (tracking_car == 0 || d > 500)) z = speed * -16; - if ((padd & 0x2000) != 0) + if ((padd & MPAD_D_RIGHT) != 0) z = speed * 16; if (tracking_car == 0) @@ -1271,10 +1272,10 @@ void ControlReplay(void) player[0].cameraPos.vz = old_camera.vz; } - if (padd & 4) + if (padd & MPAD_L1) player[0].cameraPos.vy -= speed * 16; - if (padd & 1) + if (padd & MPAD_L2) player[0].cameraPos.vy += speed * 16; height = -MapHeight(&tmpPos); @@ -1303,7 +1304,7 @@ void ControlReplay(void) { // Tripod camera angle - if(padd & 0x1000) + if(padd & MPAD_D_UP) { camera_angle.vx += speed * 4; @@ -1311,7 +1312,7 @@ void ControlReplay(void) camera_angle.vx = 300; } - if (padd & 0x4000) + if (padd & MPAD_D_DOWN) { camera_angle.vx -= speed * 4; @@ -1319,10 +1320,10 @@ void ControlReplay(void) camera_angle.vx = 3900; } - if (padd & 0x8000) + if (padd & MPAD_D_LEFT) camera_angle.vy += speed * 4; - if (padd & 0x2000) + if (padd & MPAD_D_RIGHT) camera_angle.vy -= speed * 4; camera_angle.vx = camera_angle.vx & 0xfff; @@ -1331,7 +1332,7 @@ void ControlReplay(void) } else if (EditMode == 5) { - if(padd & 0x1000) + if(padd & MPAD_D_UP) { scr_z += speed * 4; @@ -1339,7 +1340,7 @@ void ControlReplay(void) scr_z = 1000; } - if (padd & 0x4000) + if (padd & MPAD_D_DOWN) { scr_z -= speed * 4; @@ -1558,7 +1559,7 @@ void ControlReplay(void) break; } - if ((padd & 0x40U) == 0) + if ((padd & MPAD_CROSS) == 0) { first_time = 0; CursorY = 0; diff --git a/src_rebuild/Game/C/dr2roads.c b/src_rebuild/Game/C/dr2roads.c index c04ba24d..236d0f90 100644 --- a/src_rebuild/Game/C/dr2roads.c +++ b/src_rebuild/Game/C/dr2roads.c @@ -11,9 +11,9 @@ #include "main.h" #include "ASM/d2mapasm.h" -sdPlane default_plane = { 0, 0, 0, 0, 2048 }; +sdPlane default_plane = { SURF_CONCRETE, 0, 0, 0, 2048 }; -sdPlane sea_plane = { 9, 0, 16384, 0, 2048 }; // a default surface if FindSurfaceD2 fails +sdPlane sea_plane = { SURF_DEEPWATER, 0, 16384, 0, 2048 }; // a default surface if FindSurfaceD2 fails sdPlane* GetSeaPlane() { diff --git a/src_rebuild/Game/C/draw.c b/src_rebuild/Game/C/draw.c index 865bbc41..e5756978 100644 --- a/src_rebuild/Game/C/draw.c +++ b/src_rebuild/Game/C/draw.c @@ -116,6 +116,11 @@ int gDrawDistance = 441; _pct& plotContext = *(_pct*)((u_char*)getScratchAddr(0) + 1024 - sizeof(_pct)); // orig offset: 0x1f800020 #endif +struct MVERTEX5x5 +{ + MVERTEX verts[5][5]; +}; + // [D] [T] [A] void addSubdivSpriteShadow(POLYFT4* src, SVECTOR* verts, int z) { @@ -123,7 +128,7 @@ void addSubdivSpriteShadow(POLYFT4* src, SVECTOR* verts, int z) m = 4; -#ifdef PSX +#if 0 //def PSX MVERTEX5x5& subdiVerts = *(MVERTEX5x5*)(u_char*)getScratchAddr(0); #else MVERTEX5x5 subdiVerts; @@ -165,16 +170,14 @@ void DrawSprites(PACKED_CELL_OBJECT** sprites, int numFound) { int i; int z; - u_int spriteColour; - u_int lightdd; + u_int spriteColour, lightdd; u_char lightLevel; MODEL* model; PACKED_CELL_OBJECT* pco; PACKED_CELL_OBJECT** list; int numShadows; - int count; -#ifdef PSX +#if 0 //def PSX MVERTEX5x5& subdiVerts = *(MVERTEX5x5*)(u_char*)getScratchAddr(0); #else MVERTEX5x5 subdiVerts; @@ -214,8 +217,7 @@ void DrawSprites(PACKED_CELL_OBJECT** sprites, int numFound) shadowMatrix.m[i][0] = inv_camera_matrix.m[i][2]; shadowMatrix.m[i][1] = -inv_camera_matrix.m[i][0]; shadowMatrix.m[i][2] = inv_camera_matrix.m[i][0]; - i--; - } while (i >= 0); + } while (i--); plotContext.primptr = current->primptr; @@ -230,9 +232,8 @@ void DrawSprites(PACKED_CELL_OBJECT** sprites, int numFound) plotContext.current = current; numShadows = 0; - count = numFound - 1; - while (count != -1) + while (numFound--) { pco = *list; list++; @@ -298,8 +299,6 @@ void DrawSprites(PACKED_CELL_OBJECT** sprites, int numFound) plotContext.ot += 133; } - count--; - #ifdef PSX #define MAX_TREE_SHADOW_DISTANCE 7000 #else @@ -329,9 +328,7 @@ void DrawSprites(PACKED_CELL_OBJECT** sprites, int numFound) // [D] [T] void SetupPlaneColours(u_int ambient) { - u_int r; - u_int g; - u_int b; + u_int r, g, b; if ((gWeather - 1U > 1) && gTimeOfDay != 0 && gTimeOfDay != 2) { @@ -580,10 +577,7 @@ void DrawAllTheCars(int view) // [D] [T] u_int normalIndex(SVECTOR* verts, u_int vidx) { - SVECTOR* v0; - SVECTOR* v1; - SVECTOR* v2; - + SVECTOR* v0, *v1, *v2; int x, y; int th23; @@ -645,31 +639,32 @@ u_int normalIndex(SVECTOR* verts, u_int vidx) return th23 | 0x80; } -void PlotBuildingModel(MODEL* model, int rot, _pct* pc) +// [A] +void ConvertPolygonTypes(MODEL* model, _pct* pc) { - int opz; - int Z; - PL_POLYFT4* polys; - int i; - int r; - u_char temp; - u_char ptype; - POLY_FT4* prims; SVECTOR* srcVerts; - int combo; + PL_POLYFT4* polys; + u_char temp, ptype; + int i; + + // [A] we are storing the processing flag here + if (model->tri_verts & 0x8000) + { + return; + } + + model->tri_verts |= 0x8000; srcVerts = (SVECTOR*)model->vertices; polys = (PL_POLYFT4*)model->poly_block; - - combo = combointensity; - i = model->num_polys; - while (i > 0) + + // pre-process vertices + while (i-- > 0) { - // iterate through polygons - // with skipping ptype = polys->id & 0x1f; + // convert poly types if ((ptype & 0x1) == 0 && ptype != 8) // is FT3 triangle? { temp = polys->uv2.v; @@ -685,7 +680,44 @@ void PlotBuildingModel(MODEL* model, int rot, _pct* pc) if (ptype != 11 && ptype != 21 && ptype != 23) { polys = (PL_POLYFT4*)((char*)polys + pc->polySizes[ptype]); - i--; + continue; + } + + // also precalculate normal index + if (ptype != 21 && (polys->th & 0x80) == 0) + { + polys->th = normalIndex(srcVerts, *(u_int*)&polys->v0); + } + polys = (PL_POLYFT4*)((char*)polys + pc->polySizes[ptype]); + } +} + +void PlotBuildingModel(MODEL* model, int rot, _pct* pc) +{ + int opz, Z, r; + PL_POLYFT4* polys; + int i; + u_char ptype; + POLY_FT4* prims; + SVECTOR* srcVerts; + int combo; + + srcVerts = (SVECTOR*)model->vertices; + polys = (PL_POLYFT4*)model->poly_block; + + combo = combointensity; + + ConvertPolygonTypes(model, pc); + + i = model->num_polys; + while (i-- > 0) + { + ptype = polys->id & 0x1f; + + // skip certain polygons + if (ptype != 11 && ptype != 21 && ptype != 23) + { + polys = (PL_POLYFT4*)((char*)polys + pc->polySizes[ptype]); continue; } @@ -705,12 +737,7 @@ void PlotBuildingModel(MODEL* model, int rot, _pct* pc) } else { - temp = polys->th; - - if ((polys->th & 0x80) == 0) // cache normal index if it were not - temp = polys->th = normalIndex(srcVerts, *(u_int*)&polys->v0); - - pc->colour = pc->f4colourTable[(r >> 3) * 4 - temp & 31]; + pc->colour = pc->f4colourTable[(r >> 3) * 4 - polys->th & 31]; } if (opz > 0) @@ -718,13 +745,6 @@ void PlotBuildingModel(MODEL* model, int rot, _pct* pc) pc->tpage = (*pc->ptexture_pages)[polys->texture_set]; pc->clut = (*pc->ptexture_cluts)[polys->texture_set][polys->texture_id]; - ushort uv0, uv1, uv2, uv3; - - uv0 = *(ushort*)&polys->uv0; - uv1 = *(ushort*)&polys->uv1; - uv2 = *(ushort*)&polys->uv2; - uv3 = *(ushort*)&polys->uv3; - prims = (POLY_FT4*)pc->primptr; setPolyFT4(prims); @@ -745,10 +765,10 @@ void PlotBuildingModel(MODEL* model, int rot, _pct* pc) prims->tpage = pc->tpage; prims->clut = pc->clut; - *(ushort*)&prims->u0 = uv0; - *(ushort*)&prims->u1 = uv1; - *(ushort*)&prims->u2 = uv3; - *(ushort*)&prims->u3 = uv2; + *(ushort*)&prims->u0 = *(ushort*)&polys->uv0; + *(ushort*)&prims->u1 = *(ushort*)&polys->uv1; + *(ushort*)&prims->u2 = *(ushort*)&polys->uv3; + *(ushort*)&prims->u3 = *(ushort*)&polys->uv2; addPrim(pc->ot + (Z >> 1), prims); @@ -756,26 +776,22 @@ void PlotBuildingModel(MODEL* model, int rot, _pct* pc) } polys = (PL_POLYFT4*)((char*)polys + pc->polySizes[ptype]); - i--; } } // [D] [T] [A] custom void PlotBuildingModelSubdivNxN(MODEL* model, int rot, _pct* pc, int n) { - int opz; + int opz, Z, r; int diff, minZ, maxZ; - int Z; PL_POLYFT4* polys; int i; - int r; - u_char temp; u_char ptype; POLY_FT4* prims; SVECTOR* srcVerts; int combo; -#ifdef PSX +#if 0//def PSX MVERTEX5x5& subdiVerts = *(MVERTEX5x5*)(u_char*)getScratchAddr(0); #else MVERTEX5x5 subdiVerts; @@ -786,29 +802,18 @@ void PlotBuildingModelSubdivNxN(MODEL* model, int rot, _pct* pc, int n) combo = combointensity; + ConvertPolygonTypes(model, pc); + i = model->num_polys; - while (i > 0) + while (i-- > 0) { // iterate through polygons // with skipping ptype = polys->id & 0x1f; - if ((ptype & 0x1) == 0 && ptype != 8) // is FT3 triangle? - { - temp = polys->uv2.v; - polys->uv3.u = polys->uv2.u; - polys->uv3.v = temp; - - polys->v3 = polys->v2; - - polys->id |= 1; - ptype |= 1; - } - if (ptype != 11 && ptype != 21 && ptype != 23) { polys = (PL_POLYFT4*)((char*)polys + pc->polySizes[ptype]); - i--; continue; } @@ -828,12 +833,7 @@ void PlotBuildingModelSubdivNxN(MODEL* model, int rot, _pct* pc, int n) } else { - temp = polys->th; - - if ((polys->th & 0x80) == 0) // cache normal index if it were not - temp = polys->th = normalIndex(srcVerts, *(u_int*)&polys->v0); - - pc->colour = pc->f4colourTable[(r >> 3) * 4 - temp & 31]; + pc->colour = pc->f4colourTable[(r >> 3) * 4 - polys->th & 31]; } if (opz > 0) @@ -937,7 +937,6 @@ void PlotBuildingModelSubdivNxN(MODEL* model, int rot, _pct* pc, int n) } polys = (PL_POLYFT4*)((char*)polys + pc->polySizes[ptype]); - i--; } } @@ -945,15 +944,12 @@ void PlotBuildingModelSubdivNxN(MODEL* model, int rot, _pct* pc, int n) // [D] [T] int DrawAllBuildings(CELL_OBJECT** objects, int num_buildings) { - int mat; - int zbias; + int i, mat, prev_mat; + int Z, zbias; int drawlimit; MODEL* model; OTTYPE* ot; CELL_OBJECT* cop; - int i; - int Z; - int prev_mat; prev_mat = -1; @@ -974,9 +970,7 @@ int DrawAllBuildings(CELL_OBJECT** objects, int num_buildings) ot = plotContext.current->ot + 8; - i = 0; - - while (i < num_buildings) + while (num_buildings--) { cop = (CELL_OBJECT*)*objects; mat = cop->yang; @@ -987,8 +981,7 @@ int DrawAllBuildings(CELL_OBJECT** objects, int num_buildings) } else { - Z = Apply_InvCameraMatrixAndSetMatrix(&cop->pos, &CompoundMatrix[mat]); - prev_mat = mat; + Z = Apply_InvCameraMatrixAndSetMatrix(&cop->pos, &CompoundMatrix[prev_mat = mat]); } model = Z > DRAW_LOD_DIST_LOW ? pLodModels[cop->type] : modelpointers[cop->type]; @@ -1009,8 +1002,6 @@ int DrawAllBuildings(CELL_OBJECT** objects, int num_buildings) if (PRIMTAB_SIZE - drawlimit < 60000) break; - - i++; objects++; } @@ -1036,7 +1027,7 @@ void PlotModelSubdivNxN(MODEL* model, int rot, _pct* pc, int n) SVECTOR* srcVerts; int combo; -#ifdef PSX +#if 0//def PSX MVERTEX5x5& subdiVerts = *(MVERTEX5x5*)(u_char*)getScratchAddr(0); #else MVERTEX5x5 subdiVerts; @@ -1382,10 +1373,10 @@ void DrawMapPSX(int* comp_val) else distScale = goFaster & 31; - i = (gDrawDistance >> distScale) - 1; // [A] + i = (gDrawDistance >> distScale); // [A] // walk through all cells - while (i >= 0) + do { if (ABS(hloop) + ABS(vloop) < 21) { @@ -1511,49 +1502,32 @@ void DrawMapPSX(int* comp_val) drawData.leftPlane += drawData.leftcos; drawData.backPlane += drawData.backcos; drawData.rightPlane += drawData.rightcos; - - hloop++; - - if (hloop + vloop == 1) - dir = 1; + dir = (++hloop + vloop == 1) ? 1 : dir; } else if (dir == 1) { drawData.leftPlane += drawData.leftsin; drawData.backPlane += drawData.backsin; drawData.rightPlane += drawData.rightsin; - vloop++; - //PVS_ptr += pvs_square; - - if (hloop == vloop) - dir = 2; + dir = (hloop == ++vloop) ? 2 : dir; } else if (dir == 2) { - hloop--; drawData.leftPlane -= drawData.leftcos; drawData.backPlane -= drawData.backcos; drawData.rightPlane -= drawData.rightcos; - - if (hloop + vloop == 0) - dir = 3; + dir = (--hloop + vloop == 0) ? 3 : dir; } else { drawData.leftPlane -= drawData.leftsin; drawData.backPlane -= drawData.backsin; drawData.rightPlane -= drawData.rightsin; - vloop--; - //PVS_ptr -= pvs_square; - - if (hloop == vloop) - dir = 0; + dir = (hloop == --vloop) ? 0 : dir; } - - i--; - } + }while (i-- > 0); #if 0 char tempBuf[512]; diff --git a/src_rebuild/Game/C/draw.h b/src_rebuild/Game/C/draw.h index 1866a329..26477a77 100644 --- a/src_rebuild/Game/C/draw.h +++ b/src_rebuild/Game/C/draw.h @@ -1,6 +1,26 @@ #ifndef DRAW_H #define DRAW_H +// Primitive plot context used in scratchpad +struct _pct +{ + struct DB* current; + u_short(*ptexture_pages)[128]; + u_short(*ptexture_cluts)[128][32]; + int f4colourTable[32]; + int* polySizes; + char* primptr; + OTTYPE* ot; + u_int clut; + u_int tpage; + u_int colour; + int flags; + SVECTOR* verts; + u_int lastTexInfo; + int scribble[8]; + int model; +}; + extern SVECTOR day_vectors[4]; extern SVECTOR night_vectors[4]; extern SVECTOR day_colours[4]; diff --git a/src_rebuild/Game/C/envsound.c b/src_rebuild/Game/C/envsound.c index 3a3ea374..0ee19dc8 100644 --- a/src_rebuild/Game/C/envsound.c +++ b/src_rebuild/Game/C/envsound.c @@ -11,67 +11,67 @@ void AddEnvSounds(int level, int time) switch (level) { case 0: - AddEnvSnd(1, 0, 4, 2, 0, -225275, 674800, -207350, 657910); - AddEnvSnd(1, 0, 4, 2, 0, 73730, -359430, 88070, -387080); - AddEnvSnd(1, 0x10, 4, 3, 0, 177700, 77500, 222200, 61700); + AddEnvSnd(1, 0, SOUND_BANK_ENVIRONMENT, 2, 0, -225275, 674800, -207350, 657910); + AddEnvSnd(1, 0, SOUND_BANK_ENVIRONMENT, 2, 0, 73730, -359430, 88070, -387080); + AddEnvSnd(1, 0x10, SOUND_BANK_ENVIRONMENT, 3, 0, 177700, 77500, 222200, 61700); case 4: - AddEnvSnd(1, 0x10, 4, 0, -5000, 36250, -167050, 70250, -275700); - AddEnvSnd(1, 0x10, 4, 0, -5000, 36250, -157500, 70250, -126900); - AddEnvSnd(1, 0x10, 4, 0, -5000, 36250, -79500, 70250, -113500); + AddEnvSnd(1, 0x10, SOUND_BANK_ENVIRONMENT, 0, -5000, 36250, -167050, 70250, -275700); + AddEnvSnd(1, 0x10, SOUND_BANK_ENVIRONMENT, 0, -5000, 36250, -157500, 70250, -126900); + AddEnvSnd(1, 0x10, SOUND_BANK_ENVIRONMENT, 0, -5000, 36250, -79500, 70250, -113500); break; case 1: - AddEnvSnd(3, 0, 4, 2, 2000, -232360, -266390, -232360, -266390); - AddEnvSnd(3, 0, 4, 2, 2000, 252200, -119500, 252200, -119500); + AddEnvSnd(3, 0, SOUND_BANK_ENVIRONMENT, 2, 2000, -232360, -266390, -232360, -266390); + AddEnvSnd(3, 0, SOUND_BANK_ENVIRONMENT, 2, 2000, 252200, -119500, 252200, -119500); case 5: - AddEnvSnd(1, 0, 4, 4, -3500, 324150, -363950, 339500, -323200); - AddEnvSnd(1, 0, 4, 4, -3500, 339500, -326600, 354100, -332600); + AddEnvSnd(1, 0, SOUND_BANK_ENVIRONMENT, 4, -3500, 324150, -363950, 339500, -323200); + AddEnvSnd(1, 0, SOUND_BANK_ENVIRONMENT, 4, -3500, 339500, -326600, 354100, -332600); if (level == 5) { - AddEnvSnd(1, 0x10, 4, 3, -4500, -113900, -181000, -82500, -2424832); - AddEnvSnd(1, 0x10, 4, 3, -4500, -100700, -258250, -89500, -292600); - AddEnvSnd(1, 0x10, 4, 3, -4500, -186100, -321800, -89500, -292600); - AddEnvSnd(1, 0x10, 4, 3, -4500, -282100, -302500, -191100, -321800); - AddEnvSnd(1, 0x10, 4, 3, -4500, -273000, -301500, -294000, -247500); - AddEnvSnd(1, 0x10, 4, 3, -4500, -3145728, -208600, -282500, -246500); - AddEnvSnd(1, 0x10, 4, 3, -4500, -142500, -128100, -90300, -163500); - AddEnvSnd(1, 0x10, 4, 3, -4500, -272700, -114500, -157500, -151900); - AddEnvSnd(1, 0x10, 4, 3, -4500, -154200, -126300, -134700, -65950); + AddEnvSnd(1, 0x10, SOUND_BANK_ENVIRONMENT, 3, -4500, -113900, -181000, -82500, -2424832); + AddEnvSnd(1, 0x10, SOUND_BANK_ENVIRONMENT, 3, -4500, -100700, -258250, -89500, -292600); + AddEnvSnd(1, 0x10, SOUND_BANK_ENVIRONMENT, 3, -4500, -186100, -321800, -89500, -292600); + AddEnvSnd(1, 0x10, SOUND_BANK_ENVIRONMENT, 3, -4500, -282100, -302500, -191100, -321800); + AddEnvSnd(1, 0x10, SOUND_BANK_ENVIRONMENT, 3, -4500, -273000, -301500, -294000, -247500); + AddEnvSnd(1, 0x10, SOUND_BANK_ENVIRONMENT, 3, -4500, -3145728, -208600, -282500, -246500); + AddEnvSnd(1, 0x10, SOUND_BANK_ENVIRONMENT, 3, -4500, -142500, -128100, -90300, -163500); + AddEnvSnd(1, 0x10, SOUND_BANK_ENVIRONMENT, 3, -4500, -272700, -114500, -157500, -151900); + AddEnvSnd(1, 0x10, SOUND_BANK_ENVIRONMENT, 3, -4500, -154200, -126300, -134700, -65950); } break; case 2: case 6: - AddEnvSnd(1, 0x10, 4, 1, -6000, 177100, 918100, 207600, 874100); - AddEnvSnd(1, 0x10, 4, 1, -6000, 17000, 785500, -598016, 985750); + AddEnvSnd(1, 0x10, SOUND_BANK_ENVIRONMENT, 1, -6000, 177100, 918100, 207600, 874100); + AddEnvSnd(1, 0x10, SOUND_BANK_ENVIRONMENT, 1, -6000, 17000, 785500, -598016, 985750); break; case 3: case 7: - AddEnvSnd(1, 0x10, 4, 3, -5000, -330600, 156700, -199100, 73750); - AddEnvSnd(1, 0x10, 4, 3, -5000, -84500, 406700, 256500, 378400); - AddEnvSnd(1, 0x10, 4, 3, -5000, -226200, -520600, 32300, -533400); - AddEnvSnd(1, 0x10, 4, 3, -5000, 37250, -402500, 561152, -533400); - AddEnvSnd(4, 0x18, 4, 3, -5000, 38000, -397500, 165000, -305000); - AddEnvSnd(1, 0x10, 4, 3, -5000, 162300, -1245184, 265250, -192500); - AddEnvSnd(3, 0, 4, 0, -1000, 176400, -196000, 265250, -192500); - AddEnvSnd(3, 0, 4, 0, -1000, 162500, -195400, 265250, -192500); - AddEnvSnd(3, 0, 4, 0, -1000, -479232, -370100, 265250, -192500); - AddEnvSnd(3, 0, 4, 0, -1000, -602112, -370700, 265250, -192500); - AddEnvSnd(3, 0, 4, 0, -1000, -110800, -371700, 265250, -192500); - AddEnvSnd(3, 0, 4, 0, -1000, -124300, -385000, 265250, -192500); - AddEnvSnd(3, 0, 4, 0, -1000, -143900, -385000, 265250, -192500); - AddEnvSnd(3, 0, 4, 0, -1000, -163600, -383700, 265250, -192500); - AddEnvSnd(3, 0, 4, 0, -1000, -187100, -384100, 265250, -192500); - AddEnvSnd(3, 0, 4, 0, -1000, -192600, -381300, 265250, -192500); - AddEnvSnd(3, 0, 4, 0, -1000, -199000, -364700, 265250, -192500); - AddEnvSnd(3, 0, 4, 0, -1000, -210700, -363500, 265250, -192500); - AddEnvSnd(3, 0, 4, 0, -1000, -212700, -313800, 265250, -192500); - AddEnvSnd(3, 0, 4, 0, -1000, -211800, -266500, 265250, -192500); - AddEnvSnd(3, 0, 4, 0, -1000, -117450, -279600, 265250, -192500); - AddEnvSnd(3, 0, 4, 0, -1000, -130100, -300200, 265250, -192500); - AddEnvSnd(3, 0, 4, 0, -1000, -141300, -329500, 265250, -192500); - AddEnvSnd(3, 0, 4, 0, -1000, -109850, -331800, 265250, -192500); - AddEnvSnd(3, 0, 4, 0, -1000, -87350, -332450, 265250, -192500); - AddEnvSnd(3, 0, 4, 0, -1000, -76150, -336150, 265250, -192500); + AddEnvSnd(1, 0x10, SOUND_BANK_ENVIRONMENT, 3, -5000, -330600, 156700, -199100, 73750); + AddEnvSnd(1, 0x10, SOUND_BANK_ENVIRONMENT, 3, -5000, -84500, 406700, 256500, 378400); + AddEnvSnd(1, 0x10, SOUND_BANK_ENVIRONMENT, 3, -5000, -226200, -520600, 32300, -533400); + AddEnvSnd(1, 0x10, SOUND_BANK_ENVIRONMENT, 3, -5000, 37250, -402500, 561152, -533400); + AddEnvSnd(4, 0x18, SOUND_BANK_ENVIRONMENT, 3, -5000, 38000, -397500, 165000, -305000); + AddEnvSnd(1, 0x10, SOUND_BANK_ENVIRONMENT, 3, -5000, 162300, -1245184, 265250, -192500); + AddEnvSnd(3, 0, SOUND_BANK_ENVIRONMENT, 0, -1000, 176400, -196000, 265250, -192500); + AddEnvSnd(3, 0, SOUND_BANK_ENVIRONMENT, 0, -1000, 162500, -195400, 265250, -192500); + AddEnvSnd(3, 0, SOUND_BANK_ENVIRONMENT, 0, -1000, -479232, -370100, 265250, -192500); + AddEnvSnd(3, 0, SOUND_BANK_ENVIRONMENT, 0, -1000, -602112, -370700, 265250, -192500); + AddEnvSnd(3, 0, SOUND_BANK_ENVIRONMENT, 0, -1000, -110800, -371700, 265250, -192500); + AddEnvSnd(3, 0, SOUND_BANK_ENVIRONMENT, 0, -1000, -124300, -385000, 265250, -192500); + AddEnvSnd(3, 0, SOUND_BANK_ENVIRONMENT, 0, -1000, -143900, -385000, 265250, -192500); + AddEnvSnd(3, 0, SOUND_BANK_ENVIRONMENT, 0, -1000, -163600, -383700, 265250, -192500); + AddEnvSnd(3, 0, SOUND_BANK_ENVIRONMENT, 0, -1000, -187100, -384100, 265250, -192500); + AddEnvSnd(3, 0, SOUND_BANK_ENVIRONMENT, 0, -1000, -192600, -381300, 265250, -192500); + AddEnvSnd(3, 0, SOUND_BANK_ENVIRONMENT, 0, -1000, -199000, -364700, 265250, -192500); + AddEnvSnd(3, 0, SOUND_BANK_ENVIRONMENT, 0, -1000, -210700, -363500, 265250, -192500); + AddEnvSnd(3, 0, SOUND_BANK_ENVIRONMENT, 0, -1000, -212700, -313800, 265250, -192500); + AddEnvSnd(3, 0, SOUND_BANK_ENVIRONMENT, 0, -1000, -211800, -266500, 265250, -192500); + AddEnvSnd(3, 0, SOUND_BANK_ENVIRONMENT, 0, -1000, -117450, -279600, 265250, -192500); + AddEnvSnd(3, 0, SOUND_BANK_ENVIRONMENT, 0, -1000, -130100, -300200, 265250, -192500); + AddEnvSnd(3, 0, SOUND_BANK_ENVIRONMENT, 0, -1000, -141300, -329500, 265250, -192500); + AddEnvSnd(3, 0, SOUND_BANK_ENVIRONMENT, 0, -1000, -109850, -331800, 265250, -192500); + AddEnvSnd(3, 0, SOUND_BANK_ENVIRONMENT, 0, -1000, -87350, -332450, 265250, -192500); + AddEnvSnd(3, 0, SOUND_BANK_ENVIRONMENT, 0, -1000, -76150, -336150, 265250, -192500); break; } } diff --git a/src_rebuild/Game/C/event.c b/src_rebuild/Game/C/event.c index 2632287f..64da3c7c 100644 --- a/src_rebuild/Game/C/event.c +++ b/src_rebuild/Game/C/event.c @@ -23,6 +23,102 @@ #include "ASM/rndrasm.h" #include "cutrecorder.h" +struct FixedEvent // same as EVENT but different fields +{ + VECTOR position; + short rotation; + short active; + u_short initialRotation; + u_short finalRotation; + u_short minSpeed; + u_short maxSpeed; + short flags; + short radius; + int model; + EVENT* next; + char* modelName; +}; + +struct MissionTrain +{ + EVENT* engine; + int* node; + int cornerSpeed; + int initialStraightSpeed; + int finalStraightSpeed; + int start; + int startDir; +}; + +struct Foam +{ + MODEL* model; + int rotate; +}; + +struct EventCarriage +{ + short rotation; + short vel; +}; + +struct MultiCar +{ + EVENT* event; + int count; +}; + +struct Helicopter +{ + int speed; + short pitch; + short dp; + short roll; + short dr; + int lastX; + int lastZ; + TEXTURE_DETAILS rotorTexture; + short rotorrot; + short rotorvel; + int cleanModel; + int deadModel; +}; + +struct Detonator +{ + int timer; + int count; +}; + +struct CameraDelay +{ + int delay; + int type; +}; + +enum VisType +{ + VIS_INIT = 0, + VIS_SORT = 1, + VIS_ADD = 2, + VIS_NEXT = 3, +}; + +struct EventCamera +{ + VECTOR position; + short yAng; + MATRIX matrix; + int rotate; +}; + +enum Station +{ + EVENT_NO_STATION = 0, + EVENT_APPROACHING = 1, + EVENT_LEAVING = 2, +}; + #define PATH_NODE_WRAP 0x80000000 // go back to first node without interpolation #define PATH_NODE_CYCLE 0x80000001 // cycle nodes with interpolation #define PATH_NODE_STATION 0x80000002 // stop point @@ -458,6 +554,8 @@ EVENT* event; static EventCamera eventCamera; +void MakeEventTrackable(EVENT* ev); + // [D] [T] int GetVisValue(int index, int zDir) { diff --git a/src_rebuild/Game/C/event.h b/src_rebuild/Game/C/event.h index bd62f8d9..69ffc48a 100644 --- a/src_rebuild/Game/C/event.h +++ b/src_rebuild/Game/C/event.h @@ -1,6 +1,37 @@ #ifndef EVENT_H #define EVENT_H +enum SpecialCamera +{ + SPECIAL_CAMERA_SET = 0, + SPECIAL_CAMERA_SET2 = 1, + SPECIAL_CAMERA_RESET = 2, + SPECIAL_CAMERA_WAIT = 3, +}; + +typedef struct _EVENT EVENT; + +struct _EVENT +{ + VECTOR position; + short rotation; + short timer; + int* data; + int* node; + short flags; + short radius; + int model; + EVENT* next; +}; + +struct EventGlobal +{ + int camera; + int draw; + EVENT** track; + EVENT* cameraEvent; +}; + extern EventGlobal events; extern CELL_OBJECT *EventCop; @@ -12,11 +43,6 @@ extern void InitEvents(); // 0x0004BBD4 extern void SetUpEvents(int full); // 0x00046258 extern VECTOR* TriggerEvent(int i); -extern void InitEventCamera(); // 0x0004BF54 -extern void ResetEventCamera(); // 0x0004C014 - -extern void SetCamera(EVENT *ev); // 0x00047538 - extern void EventCollisions(CAR_DATA *cp, int type); // 0x0004BC50 extern void StepEvents(); // 0x00048A60 @@ -27,14 +53,10 @@ extern void EventCameraOffset(SVECTOR* offset); extern sdPlane* EventSurface(VECTOR *pos, sdPlane *plane); // 0x0004A688 -extern void MakeEventTrackable(EVENT *ev); // 0x0004BD6C - extern void OffsetTarget(VECTOR *target); // 0x0004BD2C extern void SetSpecialCamera(SpecialCamera type, int change); // 0x0004B29C -extern void ScreenShake(int count, SVECTOR *ang); // 0x0004C280 - extern int DetonatorTimer(); // 0x0004B5FC extern void MultiCarEvent(MS_TARGET *target); // 0x0004BAB0 diff --git a/src_rebuild/Game/C/fmvplay.h b/src_rebuild/Game/C/fmvplay.h index 460c2cf5..903d0a08 100644 --- a/src_rebuild/Game/C/fmvplay.h +++ b/src_rebuild/Game/C/fmvplay.h @@ -1,6 +1,22 @@ #ifndef FMVPLAY_H #define FMVPLAY_H +struct RENDER_ARG +{ + u_char render; + u_char credits; + u_short recap; +}; + +struct RENDER_ARGS +{ + u_char nRenders; + u_char subtitle; + char screenx; + char screeny; + RENDER_ARG Args[4]; +}; + extern int gSubtitles; extern int gNoFMV; diff --git a/src_rebuild/Game/C/gamesnd.c b/src_rebuild/Game/C/gamesnd.c index 6c0db351..1ed5e8a0 100644 --- a/src_rebuild/Game/C/gamesnd.c +++ b/src_rebuild/Game/C/gamesnd.c @@ -24,6 +24,51 @@ #include "debris.h" #include "felony.h" +typedef struct __othercarsound +{ + int car; + int chan; + char in_use; + char stopped; + char idle; +} othercarsound; + +typedef struct __bitfield64 +{ + int h; + int l; +} bitfield64; + +typedef struct __envsound +{ + u_char type; + u_char flags; + VECTOR pos; + VECTOR pos2; + int bank; + int sample; + int vol; +} envsound; + +typedef struct __envsoundtags +{ + int frame_cnt; + int func_cnt; + int num_envsnds; + int envsnd_cnt; +} envsoundtags; + +typedef struct __envsoundinfo +{ + VECTOR eff_pos[4]; + VECTOR cam_pos; + float g[4]; + int thisS[4]; + int playing_sound[4]; + int chan[4]; + u_int flags; +} envsoundinfo; + typedef void(*envsoundfunc)(envsound* ep /*$s1*/, envsoundinfo* E /*$a1*/, int pl /*$a2*/); void IdentifyZone(envsound* ep, envsoundinfo* E, int pl); @@ -250,7 +295,7 @@ int MapCarIndexToBank(int index) } static char cop_model = 0; -int gDoCopSpeech = 1; +int gDoCopSpeech = 1; // [A] // [D] [T] void LoadLevelSFX(int missionNum) @@ -457,14 +502,11 @@ void LoadLevelSFX(int missionNum) { gDoCopSpeech = 0; - i = 0; - - do { + for (i = 0; i < 3; i++) + { if (MissionHeader->residentModels[i] == MissionHeader->residentModels[3]) cop_model = i; - - i++; - } while (i < 3); + } } else { @@ -532,10 +574,7 @@ void StartGameSounds(void) TimeSinceLastSpeech = 0; lcp = player; - - i = 0; - - while (i < NumPlayers) + for (i = 0; i < NumPlayers; i++) { if (lcp->playerType == 1) { @@ -548,7 +587,6 @@ void StartGameSounds(void) lcp->revsvol = -10000; lcp->idlevol = -8000; lcp++; - i++; } if (NumPlayers == 1) @@ -894,22 +932,20 @@ void InitDopplerSFX(void) { int i; - i = 0; - do { + for (i = 0; i < MAX_SIREN_NOISES; i++) + { siren_noise[i].chan = -1; siren_noise[i].car = 20; siren_noise[i].in_use = 0; - i++; - } while (i < MAX_SIREN_NOISES); + } - i = 0; - do { + for (i = 0; i < MAX_CAR_NOISES; i++) + { car_noise[i].chan = -1; car_noise[i].chan = -1; car_noise[i].car = 20; car_noise[i].in_use = 0; - i++; - } while (i < MAX_CAR_NOISES); + } if (GameType == GAME_GETAWAY) loudhail_time = 245; @@ -970,11 +1006,9 @@ void DoDopplerSFX(void) } // sort cars by distance distance - i = 0; - while (i < num_noisy_cars - 1) + for (i = 0; i < num_noisy_cars - 1; i++) { - j = i + 1; - while (j < num_noisy_cars) + for (j = i + 1; j < num_noisy_cars; j++) { int tmpi; tmpi = indexlist[i]; @@ -984,11 +1018,7 @@ void DoDopplerSFX(void) indexlist[i] = indexlist[j]; indexlist[j] = tmpi; } - - j++; } - - i++; } car_flags = 0; @@ -1323,9 +1353,7 @@ void DoPoliceLoudhailer(int cars, ushort* indexlist, u_int* dist) else time = 275; - i = 0; - - while (i < cars) + for (i = 0; i < cars; i++) { CAR_DATA* car_ptr; @@ -1346,8 +1374,6 @@ void DoPoliceLoudhailer(int cars, ushort* indexlist, u_int* dist) loudhail_time = 0; break; } - - i++; } if (loudhail_time <= time) @@ -2033,7 +2059,7 @@ void IdentifyZone(envsound* ep, envsoundinfo* E, int pl) int tmp[4]; float _g[4]; - __bitfield64 zones; + bitfield64 zones; int snd; // [A] does it really needed? we don't have that much sounds to be played @@ -2097,9 +2123,9 @@ void IdentifyZone(envsound* ep, envsoundinfo* E, int pl) if (dist < vol) { if (i < 32) - zones.l |= 1 << (i & 0x1f); + zones.l |= 1 << (i & 31); else - zones.h |= 1 << (i & 0x1f); + zones.h |= 1 << (i & 31); tmp[j] = i; @@ -2111,9 +2137,9 @@ void IdentifyZone(envsound* ep, envsoundinfo* E, int pl) else { if (i < 32) - zones.l |= 1 << (i & 0x1f); + zones.l |= 1 << (i & 31); else - zones.h |= 1 << (i & 0x1f); + zones.h |= 1 << (i & 31); tmp[j] = i; j++; diff --git a/src_rebuild/Game/C/gamesnd.h b/src_rebuild/Game/C/gamesnd.h index 66d20385..9c7915ea 100644 --- a/src_rebuild/Game/C/gamesnd.h +++ b/src_rebuild/Game/C/gamesnd.h @@ -58,6 +58,16 @@ enum SoundBankIds SBK_COP_SIREN_START = 69, }; +struct SPEECH_QUEUE +{ + char allowed; + char chan; + char is_playing; + int count; + char reverb; + int slot[7]; +}; + extern int gDriver1Music; extern int TimeSinceLastSpeech; diff --git a/src_rebuild/Game/C/glaunch.c b/src_rebuild/Game/C/glaunch.c index d4549228..15f268f0 100644 --- a/src_rebuild/Game/C/glaunch.c +++ b/src_rebuild/Game/C/glaunch.c @@ -18,6 +18,14 @@ #include "Frontend/FEmain.h" +struct MISSION_STEP +{ + u_char flags : 3; + u_char recap : 5; + u_char data : 7; + u_char disc : 1; +}; + MISSION_STEP MissionLadder[68] = { { 1, 0, 1, 0 }, diff --git a/src_rebuild/Game/C/handling.c b/src_rebuild/Game/C/handling.c index 891b4773..77959c0d 100644 --- a/src_rebuild/Game/C/handling.c +++ b/src_rebuild/Game/C/handling.c @@ -840,22 +840,22 @@ void initOBox(CAR_DATA* cp) gte_stlvnl(&cp->hd.oBox.location); - VECTOR svx = { length, 0 ,0 }; - VECTOR svy = { 0, car_cos->colBox.vy ,0 }; - VECTOR svz = { 0, 0 ,car_cos->colBox.vz }; + SVECTOR svx = { length, 0 ,0 }; + SVECTOR svy = { 0, car_cos->colBox.vy ,0 }; + SVECTOR svz = { 0, 0 ,car_cos->colBox.vz }; - gte_ldlvl(&svx); + gte_ldsv(&svx); gte_rtir(); cp->hd.oBox.length[1] = car_cos->colBox.vy; gte_stsv(&cp->hd.oBox.radii[0]); - gte_ldlvl(&svy); + gte_ldsv(&svy); gte_rtir(); cp->hd.oBox.length[2] = car_cos->colBox.vz; gte_stsv(&cp->hd.oBox.radii[1]); - gte_ldlvl(&svz); + gte_ldsv(&svz); gte_rtir(); gte_stsv(&cp->hd.oBox.radii[2]); } @@ -1420,10 +1420,6 @@ void TerminateSkidding(int player_id) } } - -char rear_only = 0; -char continuous_track = 0; -int last_track_state = -1; char DebrisTimer = 0; // [D] [T] @@ -1486,19 +1482,13 @@ void jump_debris(CAR_DATA* cp) // [D] [T] void CheckCarEffects(CAR_DATA* cp, int player_id) { - int channel; + static char last_track_state[MAX_TYRE_PLAYERS][MAX_TYRE_TRACK_WHEELS] = { -1 }; + int skidsound, cnt; - int skidsound; - int cnt; - int wheels_on_ground; + char wheels_on_ground; char lay_down_tracks; char tracks_and_smoke; - char desired_skid; - char desired_wheel; - - wheels_on_ground = 0; - lay_down_tracks = 0; - tracks_and_smoke = 0; + char channel, desired_skid, desired_wheel; if (cp->controlType != CONTROL_TYPE_PLAYER && cp->controlType != CONTROL_TYPE_LEAD_AI && @@ -1514,10 +1504,14 @@ void CheckCarEffects(CAR_DATA* cp, int player_id) // [A] do hubcaps here HandlePlayerHubcaps(player_id); + wheels_on_ground = 0; + lay_down_tracks = 0; + tracks_and_smoke = 0; + for (cnt = 0; cnt < 4; cnt++) { if (cp->hd.wheel[cnt].susCompression != 0) - wheels_on_ground = 1; + wheels_on_ground |= 1 << cnt; } skidsound = 0; @@ -1529,10 +1523,9 @@ void CheckCarEffects(CAR_DATA* cp, int player_id) rear_vel = ABS(cp->hd.rear_vel); front_vel = ABS(cp->hd.front_vel); - if (rear_vel > 22000 || cp->wheelspin) + if ((wheels_on_ground & 5) && (rear_vel > 15000 || cp->wheelspin)) { - rear_only = 1; - lay_down_tracks = true; + lay_down_tracks |= 1; if (cp->wheelspin == 0) skidsound = (rear_vel - 11100) / 2 + 1; @@ -1542,13 +1535,13 @@ void CheckCarEffects(CAR_DATA* cp, int player_id) if (skidsound > 13000) skidsound = 13000; } - else if (front_vel > 50000) + + if ((wheels_on_ground & 10) && front_vel > 15000) { - rear_only = 0; - lay_down_tracks = true; + lay_down_tracks |= 2; } - tracks_and_smoke = (player_id < 2) && !(cp->hd.wheel[1].surface & 0x8) && !(cp->hd.wheel[3].surface & 0x8); + tracks_and_smoke = (player_id < MAX_TYRE_TRACK_PLAYERS) && !(cp->hd.wheel[1].surface & 0x8) && !(cp->hd.wheel[3].surface & 0x8); } desired_skid = -1; @@ -1671,23 +1664,52 @@ void CheckCarEffects(CAR_DATA* cp, int player_id) player[player_id].onGrass = 0; + // make tyre tracks GetTyreTrackPositions(cp, player_id); - // make tyre tracks - if (lay_down_tracks) +#define ADD_WHEEL_TYRE_TRACK(wheelNum, trackIdx) \ + if (wheels_on_ground & (1 << wheelNum)) { \ + AddTyreTrack(trackIdx, tracks_and_smoke, player_id, last_track_state[player_id][trackIdx] != -1); \ + last_track_state[player_id][trackIdx] = 1; \ + } else \ + last_track_state[player_id][trackIdx] = -1; + + if (lay_down_tracks & 1) // rear { - continuous_track = (last_track_state == rear_only); - - AddTyreTrack(player_id * 2, tracks_and_smoke, player_id); - AddTyreTrack(player_id * 2 + 1, tracks_and_smoke, player_id); - - last_track_state = rear_only; +#if MAX_TYRE_TRACK_WHEELS == 4 + ADD_WHEEL_TYRE_TRACK(0, 0) + ADD_WHEEL_TYRE_TRACK(2, 2) +#else + ADD_WHEEL_TYRE_TRACK(0, 0) + ADD_WHEEL_TYRE_TRACK(2, 1) +#endif } else { - last_track_state = -1; +#if MAX_TYRE_TRACK_WHEELS == 4 + last_track_state[player_id][0] = -1; + last_track_state[player_id][2] = -1; +#else + last_track_state[player_id][0] = -1; + last_track_state[player_id][1] = -1; +#endif } +#if MAX_TYRE_TRACK_WHEELS == 4 + if (lay_down_tracks & 2) // front + { + ADD_WHEEL_TYRE_TRACK(1, 1) + ADD_WHEEL_TYRE_TRACK(3, 3) + } + else + { + last_track_state[player_id][1] = -1; + last_track_state[player_id][3] = -1; + } +#endif + +#undef ADD_WHEEL_TYRE_TRACK + SetTyreTrackOldPositions(player_id); } diff --git a/src_rebuild/Game/C/handling.h b/src_rebuild/Game/C/handling.h index 36f5b268..381d9c53 100644 --- a/src_rebuild/Game/C/handling.h +++ b/src_rebuild/Game/C/handling.h @@ -4,7 +4,6 @@ extern int ghost_mode; extern int playerghost; extern int playerhitcopsanyway; -extern char continuous_track; extern void InitCarPhysics(CAR_DATA *cp, LONGVECTOR4* startpos, int direction); // 0x0005381C extern void TempBuildHandlingMatrix(CAR_DATA *cp, int init); // 0x000539E8 diff --git a/src_rebuild/Game/C/leadai.c b/src_rebuild/Game/C/leadai.c index 0bc42d1c..4f6fddde 100644 --- a/src_rebuild/Game/C/leadai.c +++ b/src_rebuild/Game/C/leadai.c @@ -33,6 +33,37 @@ static int pathParams[5] = { int road_s = 0; int road_c = 0; +struct MAP_DATA +{ + CAR_DATA* cp; + VECTOR* base; + VECTOR* pos; + VECTOR* vel; + VECTOR* size; + int intention; + int* map; + int* local; +}; + +enum LeadDriveState +{ + LeadDrive_Handbrake = 0, + LeadDrive_DropPedals = 1, + LeadDrive_CorrectOversteer = 2, + LeadDrive_NormalDrive = 3, + LeadDrive_Unstuck = 4, + LeadDrive_Panic = 5, + LeadDrive_EmergencyBrake = 6, + LeadDrive_Wheelspin = 7, + LeadDrive_FakeMotion = 8, +}; + +void CheckCurrentRoad(CAR_DATA* cp); +void UpdateRoadPosition(CAR_DATA* cp, VECTOR* basePos, int intention); +void FakeMotion(CAR_DATA* cp); +void SelectExit(CAR_DATA* cp, DRIVER2_JUNCTION* junction); +void SetTarget(CAR_DATA* cp, int curRoad, int heading, int* nextJunction); + // [D] [T] int leadRand(void) { @@ -50,7 +81,7 @@ void InitLead(CAR_DATA* cp) cp->hndType = 5; cp->controlType = CONTROL_TYPE_LEAD_AI; cp->ai.l.roadPosition = 512; - cp->ai.l.dstate = 3; + cp->ai.l.dstate = LeadDrive_NormalDrive; cp->ai.l.recoverTime = 40; cp->ai.l.nextExit = 2; cp->ai.l.roadForward = 5120; @@ -151,11 +182,11 @@ void LeadUpdateState(CAR_DATA* cp) || ABS(z - player[0].pos[2]) > 15900) { // request that we spool him in - cp->ai.l.dstate = 8; + cp->ai.l.dstate = LeadDrive_FakeMotion; return; } - if (cp->ai.l.dstate == 8) + if (cp->ai.l.dstate == LeadDrive_FakeMotion) { // don't spool him in until everything is loaded if (spoolactive) @@ -168,23 +199,23 @@ void LeadUpdateState(CAR_DATA* cp) InitCarPhysics(cp, (LONGVECTOR4*)&tmpStart, cp->ai.l.targetDir); // start him up - cp->ai.l.dstate = 3; + cp->ai.l.dstate = LeadDrive_NormalDrive; ResetTyreTracks(cp, GetPlayerId(cp)); } if (ABS(cp->ai.l.panicCount) > 0) - cp->ai.l.dstate = 5; + cp->ai.l.dstate = LeadDrive_Panic; - if (cp->ai.l.dstate == 6) - cp->ai.l.dstate = 3; + if (cp->ai.l.dstate == LeadDrive_EmergencyBrake) + cp->ai.l.dstate = LeadDrive_NormalDrive; if (cp->hd.speed < 10) ++cp->ai.l.stuckCount; else cp->ai.l.stuckCount = 0; - if (cp->ai.l.dstate == 4) + if (cp->ai.l.dstate == LeadDrive_Unstuck) { if (cp->ai.l.stuckCount > 20) { @@ -199,7 +230,7 @@ void LeadUpdateState(CAR_DATA* cp) { cp->ai.l.stuckCount = 0; cp->ai.l.recoverTime = 0; - cp->ai.l.dstate = 4; + cp->ai.l.dstate = LeadDrive_Unstuck; } } @@ -208,22 +239,22 @@ void LeadUpdateState(CAR_DATA* cp) switch (cp->ai.l.dstate) { - case 0: + case LeadDrive_Handbrake: { CheckCurrentRoad(cp); if (cp->hd.speed < 20) - cp->ai.l.dstate = 3; + cp->ai.l.dstate = LeadDrive_NormalDrive; if (ABS(end) < LeadValues.hEnd) { if (ABS(avel) > 150) - cp->ai.l.dstate = 1; + cp->ai.l.dstate = LeadDrive_DropPedals; } break; } - case 1: + case LeadDrive_DropPedals: { CheckCurrentRoad(cp); @@ -231,26 +262,26 @@ void LeadUpdateState(CAR_DATA* cp) { if (ABS(avel) < 24) { - cp->ai.l.dstate = 3; + cp->ai.l.dstate = LeadDrive_NormalDrive; } else { - cp->ai.l.dstate = 2; + cp->ai.l.dstate = LeadDrive_CorrectOversteer; } } break; } - case 2: + case LeadDrive_CorrectOversteer: { CheckCurrentRoad(cp); if (ABS(avel) < 24) - cp->ai.l.dstate = 3; + cp->ai.l.dstate = LeadDrive_NormalDrive; break; } - case 3: + case LeadDrive_NormalDrive: { volatile int dist; @@ -273,9 +304,9 @@ void LeadUpdateState(CAR_DATA* cp) int hDist = LeadValues.hDist + (cp->hd.speed - 100) * LeadValues.hDistMul; if (dist < hDist) - cp->ai.l.dstate = 3; // [A] was 6 + cp->ai.l.dstate = LeadDrive_NormalDrive; // [A] was LeadDrive_OversteerBrake else - cp->ai.l.dstate = 0; + cp->ai.l.dstate = LeadDrive_Handbrake; break; } @@ -285,7 +316,7 @@ void LeadUpdateState(CAR_DATA* cp) if (dist < tDist) { - cp->ai.l.dstate = 0; + cp->ai.l.dstate = LeadDrive_Handbrake; break; } } @@ -302,14 +333,14 @@ void LeadUpdateState(CAR_DATA* cp) lDist = LeadValues.tDist + cp->hd.speed * LeadValues.tDistMul; if (dist < lDist && cp->ai.l.roadForward > 0) - cp->ai.l.dstate = 7; + cp->ai.l.dstate = LeadDrive_Wheelspin; else - cp->ai.l.dstate = 6; + cp->ai.l.dstate = LeadDrive_EmergencyBrake; } break; } - case 4: + case LeadDrive_Unstuck: { pos.vx = cp->hd.where.t[0]; pos.vy = cp->hd.where.t[1]; @@ -321,30 +352,30 @@ void LeadUpdateState(CAR_DATA* cp) if (cp->ai.l.roadForward == 0) { - cp->ai.l.dstate = 3; + cp->ai.l.dstate = LeadDrive_NormalDrive; cp->ai.l.stuckCount = 0; } break; } - case 5: + case LeadDrive_Panic: { CheckCurrentRoad(cp); if (cp->ai.l.panicCount == 0) { if (ABS(end) < 200) - cp->ai.l.dstate = 2; + cp->ai.l.dstate = LeadDrive_CorrectOversteer; } break; } - case 7: + case LeadDrive_Wheelspin: { CheckCurrentRoad(cp); if (ABS(end) < cp->hd.speed + LeadValues.tEnd) - cp->ai.l.dstate = 2; + cp->ai.l.dstate = LeadDrive_CorrectOversteer; break; } @@ -416,7 +447,7 @@ u_int LeadPadResponse(CAR_DATA* cp) switch (cp->ai.l.dstate) { - case 0: + case LeadDrive_Handbrake: { int deltaAVel; @@ -436,7 +467,7 @@ u_int LeadPadResponse(CAR_DATA* cp) break; } - case 3: + case LeadDrive_NormalDrive: { volatile int dx, dz; volatile int deltaPos; @@ -474,18 +505,15 @@ u_int LeadPadResponse(CAR_DATA* cp) if (ABS(steerDelta) > 64) t0 |= CAR_PAD_FASTSTEER; - if (steerDelta + 31U <= 62) + if (steerDelta + 31U <= 62 && ABS(avel) <= 5) { - if (ABS(avel) <= 5) - { - if (t0 & CAR_PAD_ACCEL) - t0 |= CAR_PAD_WHEELSPIN; - } + if (t0 & CAR_PAD_ACCEL) + t0 |= CAR_PAD_WHEELSPIN; } break; } - case 4: + case LeadDrive_Unstuck: { volatile int deltaPos; @@ -508,7 +536,7 @@ u_int LeadPadResponse(CAR_DATA* cp) break; } - case 5: + case LeadDrive_Panic: { volatile int deltaAVel; @@ -560,7 +588,7 @@ u_int LeadPadResponse(CAR_DATA* cp) break; } - case 6: + case LeadDrive_EmergencyBrake: { t0 = (avel < 0) ? CAR_PAD_RIGHT : CAR_PAD_LEFT; //t0 |= ((deltaTh < 0) ? CAR_PAD_RIGHT : CAR_PAD_LEFT); @@ -572,7 +600,7 @@ u_int LeadPadResponse(CAR_DATA* cp) break; } - case 7: + case LeadDrive_Wheelspin: { if (ABS(avel) > LeadValues.tAvelLimit) { @@ -583,7 +611,7 @@ u_int LeadPadResponse(CAR_DATA* cp) t0 |= CAR_PAD_WHEELSPIN; break; } - case 8: + case LeadDrive_FakeMotion: { FakeMotion(cp); break; @@ -939,7 +967,7 @@ void BlockToMap(MAP_DATA* data) someVar = FIXEDH(ABS(data->size->vx * road_s) + ABS(data->size->vz * road_c)); - if (data->intention == 0 || data->cp->ai.l.dstate == 3) + if (data->intention == 0 || data->cp->ai.l.dstate == LeadDrive_NormalDrive) { v = (data->cp->hd.speed + 100) * 10; @@ -1383,8 +1411,8 @@ int IsOnMap(int x, int z, VECTOR* basePos, int intention, CAR_DATA* cp) dx = x - curve->Midx; dz = z - curve->Midz; - tangent = DIFF_ANGLES(cp->ai.l.base_Angle, ratan2(dx, dz)); // (((ratan2(dx, dz) - cp->ai.l.base_Angle) + 2048U & 0xfff) - 2048) * - cp->ai.l.base_Dir * ((curve->inside * 45056) / 28672); + tangent = DIFF_ANGLES(cp->ai.l.base_Angle, ratan2(dx, dz)) // (((ratan2(dx, dz) - cp->ai.l.base_Angle) + 2048U & 0xfff) - 2048) * + * cp->ai.l.base_Dir * ((curve->inside * 45056) / 28672); normal = (cp->ai.l.base_Normal - hypot(dx, dz)) * cp->ai.l.base_Dir; @@ -1634,8 +1662,8 @@ void UpdateRoadPosition(CAR_DATA* cp, VECTOR* basePos, int intention) BlockToMap(&data); - num_cb = num_cb + -1; - collide = collide + 1; + num_cb--; + collide++; } } ppco = GetNextPackedCop(&ci); @@ -1687,7 +1715,7 @@ void UpdateRoadPosition(CAR_DATA* cp, VECTOR* basePos, int intention) } // update panic - if (cp->ai.l.dstate != 4) + if (cp->ai.l.dstate != LeadDrive_Unstuck) { int left, right; int spd; @@ -2208,7 +2236,7 @@ void CheckCurrentRoad(CAR_DATA* cp) else fixedThresh = LeadValues.tDist + cp->hd.speed * LeadValues.tDistMul; - if (toGo < fixedThresh && cp->ai.l.offRoad == 0 && cp->ai.l.dstate != 5) + if (toGo < fixedThresh && cp->ai.l.offRoad == 0 && cp->ai.l.dstate != LeadDrive_Panic) { checkNext = 1; cp->ai.l.direction = 0; @@ -2743,7 +2771,7 @@ u_int FreeRoamer(CAR_DATA* cp) DamageBar.position = cp->totalDamage; - if (cp->ai.l.dstate != 8) + if (cp->ai.l.dstate != LeadDrive_FakeMotion) { // flipped? Or sinking in water? if (cp->hd.where.m[1][1] < 100 || (cp->hd.wheel[1].surface & 7) == 1 && (cp->hd.wheel[3].surface & 7) == 1) diff --git a/src_rebuild/Game/C/leadai.h b/src_rebuild/Game/C/leadai.h index 845b321b..a46abef9 100644 --- a/src_rebuild/Game/C/leadai.h +++ b/src_rebuild/Game/C/leadai.h @@ -1,42 +1,7 @@ #ifndef LEADAI_H #define LEADAI_H - -extern int leadRand(); // 0x000E70A0 - -extern void InitLead(CAR_DATA *cp); // 0x000E7128 - -extern void LeadUpdateState(CAR_DATA *cp); // 0x000E73E8 - -extern u_int LeadPadResponse(CAR_DATA *cp); // 0x000E7994 - -extern void FakeMotion(CAR_DATA *cp); // 0x000E7DE8 - -extern void PosToIndex(int *normal, int *tangent, int intention, CAR_DATA *cp); // 0x000E834C - -extern void BlockToMap(MAP_DATA *data); // 0x000E86BC - -extern int IsOnMap(int x, int z, VECTOR *basePos, int intention, CAR_DATA *cp); // 0x000E98A4 - -extern void UpdateRoadPosition(CAR_DATA *cp, VECTOR *basePos, int intention); // 0x000E9BB8 - -extern void slowWallTests() ; // 0x000E913C - -extern void asf() ; // 0x000E9158 - -extern void DoExtraWorkForNFrames() ; // 0x000E99AC - -extern void searchTarget() ; // 0x000E9AB8 - -extern void CheckCurrentRoad(CAR_DATA *cp); // 0x000EB1FC - -extern void SetTarget(CAR_DATA *cp, int cr, int heading, int *nextJunction); // 0x000EC1C4 - -extern void SelectExit(CAR_DATA *cp, DRIVER2_JUNCTION *junction); // 0x000EC5E4 - -extern u_int FreeRoamer(CAR_DATA *cp); // 0x000EC99C - -extern u_int hypot(int x, int y); // 0x000ECB28 - +extern void InitLead(CAR_DATA *cp); +extern u_int FreeRoamer(CAR_DATA *cp); #endif diff --git a/src_rebuild/Game/C/loadsave.c b/src_rebuild/Game/C/loadsave.c index 988e9f1e..d62f17e8 100644 --- a/src_rebuild/Game/C/loadsave.c +++ b/src_rebuild/Game/C/loadsave.c @@ -17,6 +17,37 @@ #include // getenv #endif // PSX +struct GAME_SAVE_HEADER +{ + u_int magic; + u_char gMissionLadderPos; + u_char pad1; + u_char pad2; + u_char pad3; + MISSION_DATA SavedData; + int reserved[8]; +}; + +struct CONFIG_SAVE_HEADER +{ + u_int magic; + int gMasterVolume; + int gMusicVolume; + int gSoundMode; + int gVibration; + int gCopDifficultyLevel; + int gFurthestMission; + MAPPING PadMapping[2]; + SCORE_TABLES ScoreTables; + int PALAdjustX; + int PALAdjustY; + int NTSCAdjustX; + int NTSCAdjustY; + int gSubtitles; + ACTIVE_CHEATS AvailableCheats; + int reserved[6]; +}; + // [A] void ShowSavingWaitMessage(char *message, int height) { @@ -146,7 +177,7 @@ void LoadCurrentProfile(int init) } // [A] saves config to file -void SaveCurrentProfile() +void SaveCurrentProfile(int showMessage) { #ifndef PSX int dataSize; @@ -157,8 +188,11 @@ void SaveCurrentProfile() strcat(filePath, "/config.dat"); - SetTextColour(128, 128, 64); - ShowSavingWaitMessage(G_LTXT(GTXT_SavingConfiguration), 0); + if (showMessage) + { + SetTextColour(128, 128, 64); + ShowSavingWaitMessage(G_LTXT(GTXT_SavingConfiguration), 0); + } dataSize = 0; if (SaveConfigData((char*)_other_buffer)) @@ -176,7 +210,7 @@ void SaveCurrentProfile() error = 0; } - if (error) + if (error && showMessage) { SetTextColour(128, 0, 0); ShowSavingWaitMessage(G_LTXT(GTXT_SavingError), 0); diff --git a/src_rebuild/Game/C/loadsave.h b/src_rebuild/Game/C/loadsave.h index d840f1a1..34785978 100644 --- a/src_rebuild/Game/C/loadsave.h +++ b/src_rebuild/Game/C/loadsave.h @@ -4,7 +4,7 @@ extern char gCurrentReplayFilename[64]; extern void LoadCurrentProfile(int init); -extern void SaveCurrentProfile(); +extern void SaveCurrentProfile(int showMessage); extern int LoadCurrentGame(); extern void SaveCurrentGame(); diff --git a/src_rebuild/Game/C/main.c b/src_rebuild/Game/C/main.c index 09729554..e0d0f9d8 100644 --- a/src_rebuild/Game/C/main.c +++ b/src_rebuild/Game/C/main.c @@ -406,12 +406,7 @@ void LoadGameLevel(void) sector = citylumps[GameLevel][CITYLUMP_DATA1].x / CDSECTOR_SIZE; nsectors = citylumps[GameLevel][CITYLUMP_DATA1].y / CDSECTOR_SIZE; -#ifdef PSX loadsectors((char*)_primTab1, sector, nsectors); -#else - extern char g_CurrentLevelFileName[64]; - loadsectorsPC(g_CurrentLevelFileName, (char*)_primTab1, sector, nsectors); -#endif // PSX sector += nsectors; @@ -428,12 +423,8 @@ void LoadGameLevel(void) malloc_lump = D_MALLOC(nsectors * CDSECTOR_SIZE); D_MALLOC_END(); -#ifdef PSX loadsectors(malloc_lump, sector, nsectors); -#else - extern char g_CurrentLevelFileName[64]; - loadsectorsPC(g_CurrentLevelFileName, malloc_lump, sector, nsectors); -#endif // PSX + sector += nsectors; // CITYLUMP_DATA2 - in-memory lump @@ -647,11 +638,10 @@ void State_GameInit(void* param) plStart = PlayerStartInfo[i]; padid = -i; + gStartOnFoot = (plStart->type == 2); + if (i < NumPlayers) - { - gStartOnFoot = (plStart->type == 2); padid = i; - } InitPlayer(&player[i], &car_data[i], plStart->controlType, plStart->rotation, (LONGVECTOR4 *)&plStart->position, plStart->model, plStart->palette, &padid); @@ -841,7 +831,6 @@ int num_active_cars = 0; u_int lead_pad = 0; int numInactiveCars = 0; -int leadCarId = 0; VECTOR leadcar_pos; @@ -882,7 +871,7 @@ void StepSim(void) pauseflag = 1; } - oldsp = SetSp((u_long)((u_char*)getScratchAddr(0) + 0x3e8)); // i don't know what this does + //oldsp = SetSp((u_long)((u_char*)getScratchAddr(0) + 0x3e8)); // i don't know what this does lead_pad = (u_int)controller_bits; @@ -1062,7 +1051,7 @@ void StepSim(void) break; case CONTROL_TYPE_CUTSCENE: - if (!_CutRec_RecordPad(cp, &t0, &t1, &t2)) + if (!_CutRec_RecordCarPad(cp, &t0, &t1, &t2)) cjpPlay(-*cp->ai.padid, &t0, &t1, &t2); ProcessCarPad(cp, t0, t1, t2); @@ -1073,7 +1062,7 @@ void StepSim(void) } // Update players - for (i = 0; i < 8; i++) + for (i = 0; i < MAX_PLAYERS; i++) { pl = &player[i]; @@ -1082,64 +1071,62 @@ void StepSim(void) stream = pl->padid; - if (stream < 0) + if (stream < 0) // Is cutscene stream? { - if (cjpPlay(-stream, &t0, &t1, &t2) != 0) + if (!_CutRec_RecordPad(pl, &t0, &t1, &t2) && cjpPlay(-stream, &t0, &t1, &t2) != 0) ProcessTannerPad(pl->pPed, t0, t1, t2); + + continue; + } + + if (Pads[stream].type == 4) + { + padAcc = Pads[stream].mapanalog[3]; + + // walk back + if (padAcc < -64) + { + if(padAcc < -100) + Pads[stream].mapped |= 0x1000; + else + Pads[stream].mapped |= 0x1008; + } + else if (padAcc > 32) + { + stream = pl->padid; + Pads[stream].mapped |= 0x4000; + } + } + + t0 = Pads[stream].mapped; + t1 = Pads[stream].mapanalog[2]; + t2 = Pads[stream].type & 4; + + // [A] handle REDRIVER2 dedicated car entry button + if (t0 & TANNER_PAD_ACTION_DED) + { + t0 &= ~TANNER_PAD_ACTION_DED; + t0 |= TANNER_PAD_ACTION; + } + + if (NoPlayerControl == 0) + { + if (gStopPadReads) + { + t2 = 0; + t1 = 0; + t0 = 0; + } + + cjpRecord(stream, &t0, &t1, &t2); } else { - if (Pads[stream].type == 4) - { - padAcc = Pads[stream].mapanalog[3]; - - // walk back - if (padAcc < -64) - { - if(padAcc < -100) - Pads[stream].mapped |= 0x1000; - else - Pads[stream].mapped |= 0x1008; - } - else if (padAcc > 32) - { - stream = pl->padid; - Pads[stream].mapped |= 0x4000; - } - } - - stream = pl->padid; - - t0 = Pads[stream].mapped; - t1 = Pads[stream].mapanalog[2]; - t2 = Pads[stream].type & 4; - - // [A] handle REDRIVER2 dedicated car entry button - if (t0 & TANNER_PAD_ACTION_DED) - { - t0 &= ~TANNER_PAD_ACTION_DED; - t0 |= TANNER_PAD_ACTION; - } - - if (NoPlayerControl == 0) - { - if (gStopPadReads) - { - t2 = 0; - t1 = 0; - t0 = 0; - } - - cjpRecord(stream, &t0, &t1, &t2); - } - else - { - if (cjpPlay(stream, &t0, &t1, &t2) == 0) - continue; - } - - ProcessTannerPad(pl->pPed, t0, t1, t2); + if (cjpPlay(stream, &t0, &t1, &t2) == 0) + continue; } + + ProcessTannerPad(pl->pPed, t0, t1, t2); } if (requestStationaryCivCar == 1 && (numCivCars < maxCivCars || (PingOutCar(&car_data[furthestCivID]), numCivCars < maxCivCars))) @@ -1161,7 +1148,7 @@ void StepSim(void) DoScenaryCollisions(); CheckPlayerMiscFelonies(); - SetSp(oldsp); + //SetSp(oldsp); CameraCnt++; @@ -1212,15 +1199,27 @@ void StepSim(void) static int stupid_logic[4]; - // "Car Bomb"? - if (gInGameCutsceneActive != 0 && gCurrentMissionNumber == 23 && gInGameCutsceneID == 0) - stupid_logic[0] = 2; +#if MAX_TYRE_TRACK_PLAYERS > 2 + if (gInGameCutsceneActive != 0) + { + for (i = 0; i < 4; i++) + { + stupid_logic[i] = player[i + NumPlayers].playerCarId; + } + } else - stupid_logic[0] = player[0].playerCarId; +#endif + { + // "Car Bomb"? + if (gInGameCutsceneActive != 0 && gCurrentMissionNumber == 23 && gInGameCutsceneID == 0) + stupid_logic[0] = 2; + else + stupid_logic[0] = player[0].playerCarId; - stupid_logic[1] = player[1].playerCarId; - stupid_logic[2] = gThePlayerCar; - stupid_logic[3] = leadCarId; + stupid_logic[1] = player[1].playerCarId; + stupid_logic[2] = gThePlayerCar; + stupid_logic[3] = player[0].targetCarId; // [A] + } for (i = 0; i < 3; i++) { @@ -1231,7 +1230,7 @@ void StepSim(void) } } - for (car = 0, i = 0; car < 4 && i < 2; car++) + for (car = 0, i = 0; car < 4; car++) { if (stupid_logic[car] != -1 && SilenceThisCar(car) == 0) { @@ -1306,19 +1305,15 @@ void StepGame(void) if ((padd & 0x2000U) && (padd & 0x8000U)) padd &= ~0xA000; - i = NumPlayers; controller_bits = padd; - pl = player; - while (i >= 0) + for (i = 0; i < NumPlayers; i++) { + pl = &player[i]; if (pl->horn.time == 0 || pl->horn.on == 0) pl->horn.time = 0; else pl->horn.time--; - - i--; - pl++; } ModifyCamera(); @@ -1493,12 +1488,12 @@ void CheckForPause(void) { if (NumPlayers == 1) { - if (paddp == 0x800 && bMissionTitleFade == 0) // [A] && gInGameCutsceneActive == 0) // allow pausing during cutscene + if (paddp == MPAD_START && bMissionTitleFade == 0) // [A] && gInGameCutsceneActive == 0) // allow pausing during cutscene { EnablePause(PAUSEMODE_PAUSE); } } - else if (paddp == 0x800) + else if (paddp == MPAD_START) { EnablePause(PAUSEMODE_PAUSEP1); } @@ -2121,7 +2116,7 @@ int redriver2_main(int argc, char** argv) DoStateLoop(); #ifndef PSX - SaveCurrentProfile(); + SaveCurrentProfile(1); #endif return 1; @@ -2323,7 +2318,7 @@ void RenderGame2(int view) colour = 32 - colour; SetTextColour((colour & 0x1f) << 3, 0, 0); - PrintString(G_LTXT(GTXT_DEMO), 32, 15); + PrintString(G_LTXT(GTXT_DEMO), gOverlayXPos, 15); } for (i = 0; i < 2; i++) diff --git a/src_rebuild/Game/C/main.h b/src_rebuild/Game/C/main.h index 073a6330..d1da426b 100644 --- a/src_rebuild/Game/C/main.h +++ b/src_rebuild/Game/C/main.h @@ -18,7 +18,6 @@ extern int numInactiveCars; extern int gLightsOn; extern int NightAmbient; extern int wetness; -extern int leadCarId; extern int scr_z; diff --git a/src_rebuild/Game/C/map.c b/src_rebuild/Game/C/map.c index a1aa8d9b..0ed0bd52 100644 --- a/src_rebuild/Game/C/map.c +++ b/src_rebuild/Game/C/map.c @@ -230,10 +230,8 @@ int CheckUnpackNewRegions(void) int x, z; int i, j; int sortcount; - int leftright_unpack; - int topbottom_unpack; - int target_region; - int region_to_unpack; + int leftright_unpack, topbottom_unpack; + int target_region, region_to_unpack; int num_regions_to_unpack; int force_load_boundary; AREA_LOAD_INFO regions_to_unpack[3]; @@ -318,11 +316,8 @@ int CheckUnpackNewRegions(void) num_regions_to_unpack = 3; } - i = 0; - sortcount = 0; - // get next region a space - while (i < num_regions_to_unpack) + for (i = 0, sortcount = 0; i < num_regions_to_unpack; i++) { x = regions_to_unpack[i].xoffset; z = regions_to_unpack[i].zoffset; @@ -353,11 +348,9 @@ int CheckUnpackNewRegions(void) sortcount++; } } - i++; } - i = 0; - while (i < sortcount) + for (i = 0; i < sortcount; i++) { if (sortcount > (i + 1)) { @@ -380,8 +373,6 @@ int CheckUnpackNewRegions(void) } UnpackRegion(sortregions[sortorder[i]].vx, sortregions[sortorder[i]].vy); - - i++; } return 1; @@ -406,7 +397,7 @@ void ControlMap(void) region_to_unpack = region_x + region_z * regions_across; if (current_region == -1) - UnpackRegion(region_to_unpack, region_x & 1U | (region_z & 1U) * 2); // is that ever valid for 'target_barrel_region'? + UnpackRegion(region_to_unpack, region_x & 1U | (region_z & 1U) * 2); current_region = region_to_unpack; diff --git a/src_rebuild/Game/C/mc_snd.c b/src_rebuild/Game/C/mc_snd.c index 63feb98d..b70b1417 100644 --- a/src_rebuild/Game/C/mc_snd.c +++ b/src_rebuild/Game/C/mc_snd.c @@ -394,7 +394,7 @@ void InitializeMissionSound(void) { es_mobile[0] = AddEnvSnd(3, 0x20, SOUND_BANK_MISSION, GetMissionSound(14), 0, -10000, 0, 0, 0); } - else if (gCurrentMissionNumber == 0x14) + else if (gCurrentMissionNumber == 20) { jericho_in_back = 1; } diff --git a/src_rebuild/Game/C/mdraw.c b/src_rebuild/Game/C/mdraw.c index 4c150ae7..a234ca38 100644 --- a/src_rebuild/Game/C/mdraw.c +++ b/src_rebuild/Game/C/mdraw.c @@ -14,6 +14,7 @@ #include "dr2roads.h" #include "cars.h" #include "targets.h" +#include "system.h" int gDisplayPosition = 0; @@ -98,8 +99,8 @@ void DrawMission(void) } else { - PrintScaledString(64, string, 32 - (g321GoDelay & 0x1f)); - PrintScaledString(192, string, 32 - (g321GoDelay & 0x1f)); + PrintScaledString(SCREEN_H / 4, string, 32 - (g321GoDelay & 0x1f)); + PrintScaledString(SCREEN_H / 2 + SCREEN_H / 4, string, 32 - (g321GoDelay & 0x1f)); } } else if (!pauseflag) @@ -109,11 +110,11 @@ void DrawMission(void) if (NumPlayers == 1) DrawMessage(96, Mission.message_string[0]); else - DrawMessage(64, Mission.message_string[0]); + DrawMessage(SCREEN_H / 4, Mission.message_string[0]); } if (Mission.message_timer[1] != 0) - DrawMessage(192, Mission.message_string[1]); + DrawMessage(SCREEN_H / 2 + SCREEN_H / 4, Mission.message_string[1]); } if (Mission.active && !NoPlayerControl) @@ -130,7 +131,7 @@ void DrawMission(void) if (gOutOfTape) { SetTextColour(128, 128, 64); - PrintString(G_LTXT(GTXT_OutOfTape), gOverlayXPos, 236); + PrintString(G_LTXT(GTXT_OutOfTape), gOverlayXPos, SCREEN_H - 20); } } } diff --git a/src_rebuild/Game/C/mission.c b/src_rebuild/Game/C/mission.c index 4f0706e0..414a2e06 100644 --- a/src_rebuild/Game/C/mission.c +++ b/src_rebuild/Game/C/mission.c @@ -536,7 +536,7 @@ void LoadMission(int missionnum) Mission.timer[0].x = Mission.timer[1].x = 124; Mission.timer[0].y = 16; - Mission.timer[1].y = 136; + Mission.timer[1].y = SCREEN_H / 2 + 8; if (MissionHeader->timer || (MissionHeader->timerFlags & MISSIONTIMER_FLAG_COUNTER)) { @@ -1170,8 +1170,7 @@ void SetMissionMessage(char *message, int priority, int seconds) if (message == MissionStrings - 1 || message == NULL || NumPlayers == 0) return; - i = 0; - while (i < NumPlayers) + for (i = 0; i < NumPlayers; i++) { if (Mission.message_timer[i] == 0 || Mission.message_priority[i] <= priority) { @@ -1187,8 +1186,6 @@ void SetMissionMessage(char *message, int priority, int seconds) Mission.message_timer[i] = seconds * 30; } } - - i++; } } @@ -1664,6 +1661,10 @@ int MRCommand(MR_THREAD *thread, u_int cmd) AvailableCheats.cheat4 = 1; } +#ifndef PSX + SaveCurrentProfile(0); +#endif + return 1; } else if (cmd == 0x1000090) // SetRaining diff --git a/src_rebuild/Game/C/motion_c.c b/src_rebuild/Game/C/motion_c.c index b488ed20..d76ec758 100644 --- a/src_rebuild/Game/C/motion_c.c +++ b/src_rebuild/Game/C/motion_c.c @@ -464,14 +464,14 @@ void ProcessMotionLump(char* lump_ptr, int lump_size) } // [D] [T] -void SetupPedMotionData(PEDESTRIAN* pPed) +void SetupPedMotionData(LPPEDESTRIAN pPed) { pPed->motion = MotionCaptureData[pPed->type]; } // [D] [T] -void SetupPedestrian(PEDESTRIAN* pedptr) +void SetupPedestrian(LPPEDESTRIAN pedptr) { pedptr->velocity.vy = 10; pedptr->speed = 10; @@ -487,7 +487,7 @@ int bDoingShadow = 0; int gCurrentZ; // [D] [T] [A] -void DrawBodySprite(PEDESTRIAN* pDrawingPed, int boneId, VERTTYPE v1[2], VERTTYPE v2[2], int sz, int sy) +void DrawBodySprite(LPPEDESTRIAN pDrawingPed, int boneId, VERTTYPE v1[2], VERTTYPE v2[2], int sz, int sy) { #if 0 // debug code @@ -788,11 +788,7 @@ void DrawBodySprite(PEDESTRIAN* pDrawingPed, int boneId, VERTTYPE v1[2], VERTTYP if (bDoingShadow != 0) { - addPrim(current->ot + 0x107f, prims); - -#ifdef PGXP - prims->pgxp_index = 0xffff; -#endif + addPrim(current->ot + OTSIZE - 1, prims); } else { @@ -894,7 +890,7 @@ int bodyShiftValue = BODY_OFFSET; int torsoShiftValue = TORSO_OFFSET; // [D] [T] -void SetupTannerSkeleton(PEDESTRIAN* pDrawingPed) +void SetupTannerSkeleton(LPPEDESTRIAN pDrawingPed) { int i; BONE* pBone; @@ -1007,7 +1003,7 @@ void SetupTannerSkeleton(PEDESTRIAN* pDrawingPed) } // [A] - was inlined in newShowTanner -void DrawSprite(PEDESTRIAN* pDrawingPed, BONE* pBone, VECTOR* vJPos) +void DrawSprite(LPPEDESTRIAN pDrawingPed, BONE* pBone, VECTOR* vJPos) { VERTTYPE t0[2], t1[2]; // [A] was two longs int z, z1, z2; @@ -1044,7 +1040,7 @@ void DrawSprite(PEDESTRIAN* pDrawingPed, BONE* pBone, VECTOR* vJPos) int bAllreadyRotated = 0; // [D] [T] -void newShowTanner(PEDESTRIAN* pDrawingPed) +void newShowTanner(LPPEDESTRIAN pDrawingPed) { int i, j; int draw; @@ -1257,7 +1253,7 @@ void newShowTanner(PEDESTRIAN* pDrawingPed) } // [D] [T] -SVECTOR* GetModelVertPtr(PEDESTRIAN* pDrawingPed, int boneId, int modelType) +SVECTOR* GetModelVertPtr(LPPEDESTRIAN pDrawingPed, int boneId, int modelType) { int startVertex; @@ -1297,7 +1293,7 @@ SVECTOR* GetModelVertPtr(PEDESTRIAN* pDrawingPed, int boneId, int modelType) } // [D] [T] -void newRotateBones(PEDESTRIAN* pDrawingPed, BONE* poBone) +void newRotateBones(LPPEDESTRIAN pDrawingPed, BONE* poBone) { SVECTOR* pVerts; MODEL* pModel; @@ -1424,7 +1420,7 @@ void newRotateBones(PEDESTRIAN* pDrawingPed, BONE* poBone) // [D] [T] -void DrawCiv(PEDESTRIAN* pPed) +void DrawCiv(LPPEDESTRIAN pPed) { SVECTOR* vert2; SVECTOR* vert1; @@ -1433,7 +1429,7 @@ void DrawCiv(PEDESTRIAN* pPed) int boneId; int frame; int i, j; - u_int phase; + int phase; SVECTOR pos; VECTOR pos1; SVECTOR rot; @@ -1563,7 +1559,7 @@ void DrawCiv(PEDESTRIAN* pPed) ppos.vy = pPed->position.vy; ppos.vz = pPed->position.vz; - phase = (pPed->frame1 & 0xf) * 2; + phase = (pPed->frame1 & 15) * 2; cv.b = 40; cv.g = 40; @@ -1616,7 +1612,7 @@ void SetSkelModelPointers(int type) int iCurrBone = 0; // [D] [T] -void DrawTanner(PEDESTRIAN* pPed) +void DrawTanner(LPPEDESTRIAN pPed) { int iVar1; VECTOR v; @@ -1668,7 +1664,7 @@ void DrawTanner(PEDESTRIAN* pPed) } // [D] [T] -int DrawCharacter(PEDESTRIAN* pPed) +int DrawCharacter(LPPEDESTRIAN pPed) { int fr; short size; @@ -1804,7 +1800,7 @@ void InitTannerShadow(void) } // [D] [T] -void TannerShadow(PEDESTRIAN* pDrawingPed, VECTOR* pPedPos, SVECTOR* pLightPos, CVECTOR* col, short angle) +void TannerShadow(LPPEDESTRIAN pDrawingPed, VECTOR* pPedPos, SVECTOR* pLightPos, CVECTOR* col, short angle) { DR_ENV* dr_env; SVECTOR vert[4]; @@ -1842,7 +1838,7 @@ void TannerShadow(PEDESTRIAN* pDrawingPed, VECTOR* pPedPos, SVECTOR* pLightPos, dr_env = (DR_ENV*)current->primptr; SetDrawEnv(dr_env, &drEnv); - addPrim(current->ot + 0x107f, dr_env); + addPrim(current->ot + OTSIZE - 1, dr_env); current->primptr += sizeof(DR_ENV); Tangle = ratan2(-pLightPos->vx, pLightPos->vz); @@ -1935,7 +1931,7 @@ void TannerShadow(PEDESTRIAN* pDrawingPed, VECTOR* pPedPos, SVECTOR* pLightPos, // clear to black and draw Tanner sprites newShowTanner(pDrawingPed); - addPrim(current->ot + 0x107f, &tileTannerClear[current->id]); + addPrim(current->ot + OTSIZE - 1, &tileTannerClear[current->id]); // restore vectors camera_position = cp; @@ -1955,12 +1951,12 @@ void TannerShadow(PEDESTRIAN* pDrawingPed, VECTOR* pPedPos, SVECTOR* pLightPos, dr_env = (DR_ENV*)current->primptr; SetDrawEnv(dr_env, &drEnv); - addPrim(current->ot + 0x107f, dr_env); + addPrim(current->ot + OTSIZE - 1, dr_env); current->primptr += sizeof(DR_ENV); } // [A] - totally custom function but it works pretty much same as original -void DoCivHead(PEDESTRIAN* pPed, SVECTOR* vert1, SVECTOR* vert2) +void DoCivHead(LPPEDESTRIAN pPed, SVECTOR* vert1, SVECTOR* vert2) { SVECTOR spos; VECTOR pos; diff --git a/src_rebuild/Game/C/motion_c.h b/src_rebuild/Game/C/motion_c.h index 233ee652..9dbf6ee7 100644 --- a/src_rebuild/Game/C/motion_c.h +++ b/src_rebuild/Game/C/motion_c.h @@ -16,21 +16,21 @@ extern int ThisMotion; extern void ProcessMotionLump(char *lump_ptr, int lump_size); // 0x00069A38 -extern void SetupPedMotionData(PEDESTRIAN *pPed); // 0x00069AB8 -extern void SetupPedestrian(PEDESTRIAN *pedptr); // 0x00069B6C +extern void SetupPedMotionData(LPPEDESTRIAN pPed); // 0x00069AB8 +extern void SetupPedestrian(LPPEDESTRIAN pedptr); // 0x00069B6C extern void StoreVertexLists(); // 0x0006594C -extern void DrawCiv(PEDESTRIAN *pPed); // 0x000670CC +extern void DrawCiv(LPPEDESTRIAN pPed); // 0x000670CC extern void SetSkelModelPointers(int type); // 0x00069AD8 -extern void DrawTanner(PEDESTRIAN *pPed); // 0x000678D0 -extern int DrawCharacter(PEDESTRIAN *pPed); // 0x00067D44 +extern void DrawTanner(LPPEDESTRIAN pPed); // 0x000678D0 +extern int DrawCharacter(LPPEDESTRIAN pPed); // 0x00067D44 extern void InitTannerShadow(); // 0x000681EC -extern void TannerShadow(PEDESTRIAN *pDrawingPed, VECTOR *pPedPos, SVECTOR *pLightPos, CVECTOR *col, short angle); // 0x00068358 +extern void TannerShadow(LPPEDESTRIAN pDrawingPed, VECTOR *pPedPos, SVECTOR *pLightPos, CVECTOR *col, short angle); // 0x00068358 -extern void DoCivHead(PEDESTRIAN *pPed, SVECTOR *vert1, SVECTOR *vert2); // 0x00068B2C +extern void DoCivHead(LPPEDESTRIAN pPed, SVECTOR *vert1, SVECTOR *vert2); // 0x00068B2C #endif diff --git a/src_rebuild/Game/C/objanim.c b/src_rebuild/Game/C/objanim.c index ea853d7c..89f11962 100644 --- a/src_rebuild/Game/C/objanim.c +++ b/src_rebuild/Game/C/objanim.c @@ -32,6 +32,13 @@ struct GARAGE_DOOR char yang; }; +struct CYCLE_OBJECT +{ + char* name; + short vx, vy; + short start1, stop1, speed1; + short start2, stop2, speed2; +}; CYCLE_OBJECT Lev0[2] = { @@ -410,21 +417,6 @@ void DrawAllAnimatingObjects(CELL_OBJECT** objects, int num_animated) // [A] optimized animate_object(cop, aop[model->normals].internal_id); - -#if 0 - type = model->instance_number == -1 ? type : model->instance_number; - for (j = 0; j < num_anim_objects; j++) - { - if (type == aop->model_num) - { - animate_object(cop, aop->internal_id); - aop -= j; - break; - } - - aop++; - } -#endif } } diff --git a/src_rebuild/Game/C/objcoll.c b/src_rebuild/Game/C/objcoll.c index b5a73c6a..f20ed818 100644 --- a/src_rebuild/Game/C/objcoll.c +++ b/src_rebuild/Game/C/objcoll.c @@ -336,7 +336,7 @@ char lineClear(VECTOR *v1, VECTOR *v2) int xd; // $a0 int zd; // $v1 -#ifdef PSX +#if 0 //def PSX CELL_ITERATOR& ci = *(CELL_ITERATOR*)((u_char*)getScratchAddr(0) + 1024 - sizeof(CELL_ITERATOR)); #else CELL_ITERATOR ci; diff --git a/src_rebuild/Game/C/overlay.c b/src_rebuild/Game/C/overlay.c index 90c107d8..ea17f043 100644 --- a/src_rebuild/Game/C/overlay.c +++ b/src_rebuild/Game/C/overlay.c @@ -87,7 +87,7 @@ void InitOverlays(void) { InitPercentageBar(&Player2DamageBar, MaxPlayerDamage[1], playerDamageColour, G_LTXT(GTXT_Damage)); Player2DamageBar.xpos = gOverlayXPos; - Player2DamageBar.ypos = 140; + Player2DamageBar.ypos = SCREEN_H / 2 + 12; Player2DamageBar.active = 1; } else @@ -555,19 +555,7 @@ void DrawDrivingGameOverlays(void) break; case GAME_CHECKPOINT: - if (NumPlayers > 1) - { - x = PrintString(G_LTXT(GTXT_Checks), gOverlayXPos, 36); - - sprintf(string, "%d/5", gPlayerScore.items); - PrintString(string, x + 3, 36); - - x = PrintString(G_LTXT(GTXT_Checks), gOverlayXPos, 150); - - sprintf(string, "%d/5", gPlayerScore.P2items); - PrintString(string, x + 3, 150); - } - else + if (NumPlayers == 1) { table = &ScoreTables.CheckpointTable[GameLevel][gSubGameNumber][0]; x = PrintStringRightAligned(G_LTXT(GTXT_Checks), gOverlayXOppPos + 70, 16); @@ -578,6 +566,18 @@ void DrawDrivingGameOverlays(void) x = PrintString(G_LTXT(GTXT_Best), gOverlayXPos, 36); PrintScoreTableTime(x + 3, 36, table->time); } + else + { + x = PrintString(G_LTXT(GTXT_Checks), gOverlayXPos, 36); + + sprintf(string, "%d/5", gPlayerScore.items); + PrintString(string, x + 3, 36); + + x = PrintString(G_LTXT(GTXT_Checks), gOverlayXPos, SCREEN_H / 2 + 22); + + sprintf(string, "%d/5", gPlayerScore.P2items); + PrintString(string, x + 3, SCREEN_H / 2 + 22); + } break; case GAME_GATERACE: @@ -602,10 +602,10 @@ void DrawDrivingGameOverlays(void) sprintf(string, "%d / %d", gPlayerScore.items, 100); PrintString(string, x + 3, 36); - x = PrintString(G_LTXT(GTXT_Gate), gOverlayXPos, 150); + x = PrintString(G_LTXT(GTXT_Gate), gOverlayXPos, SCREEN_H / 2 + 22); sprintf(string, "%d / %d", gPlayerScore.P2items, 100); - PrintString(string, x + 3, 150); + PrintString(string, x + 3, SCREEN_H / 2 + 22); } break; case GAME_TRAILBLAZER: @@ -635,13 +635,12 @@ void DrawDrivingGameOverlays(void) x = PrintString(G_LTXT(GTXT_Flags), gOverlayXPos, 132); sprintf(string, "%d", gPlayerScore.P2items); - PrintString(string, x + 3, 132); + PrintString(string, x + 3, SCREEN_H / 2 + 4); break; case GAME_SECRET: y = 36; - i = 0; - do + for (i = 0; i < gNumRaceTrackLaps; i++) { sprintf(string, "%s %d:", G_LTXT(GTXT_Lap), i+1); @@ -649,16 +648,14 @@ void DrawDrivingGameOverlays(void) PrintScoreTableTime(x + 3, y, gLapTimes[0][i]); y += 16; - i++; - } while (i < gNumRaceTrackLaps); + } if (NumPlayers > 1) { - y = 150; + y = SCREEN_H / 2 + 22; - i = 0; - do + for(i = 0; i < gNumRaceTrackLaps; i++) { sprintf(string, "%s %d:", G_LTXT(GTXT_Lap), i+1); @@ -666,8 +663,7 @@ void DrawDrivingGameOverlays(void) PrintScoreTableTime(x + 3, y, gLapTimes[1][i]); y += 16; - i++; - } while (i < gNumRaceTrackLaps); + } } break; } @@ -679,6 +675,27 @@ void DisplayOverlays(void) { short* felony; +#ifndef PSX + if (gWidescreenOverlayAlign) + { + // align to PSX-mapped screen coordinates + RECT16 emuViewport; + PsyX_GetPSXWidescreenMappedViewport(&emuViewport); + + // recalc pos + gOverlayXPos = 16 + emuViewport.x; + gOverlayXOppPos = emuViewport.w - 16 - PERCENTAGE_BAR_WIDTH; + gMapXOffset = emuViewport.w - 16 - MAP_SIZE_W; + + // set up + PlayerDamageBar.xpos = gOverlayXPos; + Player2DamageBar.xpos = gOverlayXPos; + FelonyBar.xpos = gOverlayXPos; + DamageBar.xpos = gOverlayXOppPos; + ProxyBar.xpos = gOverlayXPos; + } +#endif + if (NoPlayerControl || gInGameCutsceneActive || gInGameCutsceneDelay) return; @@ -699,27 +716,6 @@ void DisplayOverlays(void) if (!gDoOverlays) return; -#ifndef PSX - if (gWidescreenOverlayAlign) - { - // align to PSX-mapped screen coordinates - RECT16 emuViewport; - PsyX_GetPSXWidescreenMappedViewport(&emuViewport); - - // recalc pos - gOverlayXPos = 16 + emuViewport.x; - gOverlayXOppPos = emuViewport.w - 16 - PERCENTAGE_BAR_WIDTH; - gMapXOffset = emuViewport.w - 16 - MAP_SIZE_W; - - // set up - PlayerDamageBar.xpos = gOverlayXPos; - Player2DamageBar.xpos = gOverlayXPos; - FelonyBar.xpos = gOverlayXPos; - DamageBar.xpos = gOverlayXOppPos; - ProxyBar.xpos = gOverlayXPos; - } -#endif - if(!gInvincibleCar || ActiveCheats.cheat3) { DrawPercentageBar(&PlayerDamageBar); diff --git a/src_rebuild/Game/C/overlay.h b/src_rebuild/Game/C/overlay.h index d516af5a..0163251a 100644 --- a/src_rebuild/Game/C/overlay.h +++ b/src_rebuild/Game/C/overlay.h @@ -1,6 +1,24 @@ #ifndef OVERLAY_H #define OVERLAY_H +struct COLOUR_BAND +{ + CVECTOR colour; + int value; + int flags; +}; + +typedef struct _PERCENTAGE_BAR +{ + char* tag; + short xpos, ypos; + short width, height; + u_short position; + u_short max; + COLOUR_BAND* pColourBand; + int flags, active; +} PERCENTAGE_BAR, * LPPERCENTAGE_BAR; + extern PERCENTAGE_BAR PlayerDamageBar; extern PERCENTAGE_BAR Player2DamageBar; extern PERCENTAGE_BAR DamageBar; diff --git a/src_rebuild/Game/C/overmap.c b/src_rebuild/Game/C/overmap.c index ac17d082..16018e36 100644 --- a/src_rebuild/Game/C/overmap.c +++ b/src_rebuild/Game/C/overmap.c @@ -17,6 +17,20 @@ #include "pad.h" #include "ASM/rnc_2.h" +struct MAPTEX +{ + short u, w, v, h; +}; + +struct OVERMAP +{ + int x_offset, y_offset; + int width, height; + u_char toptile; + u_char dummy; + int scale; +}; + OVERMAP overlaidmaps[4] = { { 197, 318, 384, 672, 252, 0x99, 2145 }, @@ -101,8 +115,8 @@ void DrawTargetBlip(VECTOR *pos, u_char r, u_char g, u_char b, int flags) { WorldToMultiplayerMap(pos, &vec); - vec.vx += gMapXOffset; - vec.vz += 96; + vec.vx += map_minX; + vec.vz += map_minY; } else if (flags & 0x8) { @@ -286,7 +300,7 @@ void DrawPlayerDot(VECTOR *pos, short rot, u_char r, u_char g, u_char b, int fla WorldToMultiplayerMap(pos, &vec); vec.vx += gMapXOffset; - vec.vz += 96; + vec.vz += gMapYOffset; } else { @@ -682,9 +696,13 @@ void DrawBigCompass(VECTOR *root, int angle) // [D] [T] void CopIndicator(int xpos, int strength) { + int startH, endH; int str2; POLY_F3 *poly; + startH = SCREEN_H; + endH = SCREEN_H - 30; + if (strength > 255) strength = 255; @@ -700,11 +718,11 @@ void CopIndicator(int xpos, int strength) poly->g0 = str2; poly->b0 = str2; poly->x0 = xpos - 12; - poly->y0 = 256; + poly->y0 = startH; poly->x1 = xpos; - poly->y1 = 226; + poly->y1 = endH; poly->x2 = xpos + 12; - poly->y2 = 256; + poly->y2 = startH; addPrim(current->ot + 1, poly); current->primptr += sizeof(POLY_F3); @@ -723,10 +741,10 @@ void CopIndicator(int xpos, int strength) poly->b0 = str2; poly->x0 = xpos - 12; - poly->y0 = 256; - poly->y1 = 226; + poly->y0 = startH; + poly->y1 = endH; poly->x2 = xpos + 12; - poly->y2 = 256; + poly->y2 = startH; poly->x1 = xpos; addPrim(current->ot + 1, poly); @@ -890,14 +908,13 @@ void InitMultiplayerMap(void) // [D] [T] void InitOverheadMap(void) { - int d; - int c; + int c, d; int tpage; if (NumPlayers > 1) - gMapYOffset = 96; + gMapYOffset = (SCREEN_H - MAP_SIZE_H) / 2 - 2; else - gMapYOffset = 181; + gMapYOffset = SCREEN_H - MAP_SIZE_H - 15; if (gMultiplayerLevels) { @@ -977,26 +994,25 @@ void DrawMultiplayerMap(void) int i; u_char g; u_char r; - int yPos; + int xPos, yPos; VECTOR target; int px, py; map_x_offset = 0; map_z_offset = 0; - if (NumPlayers == 1) - yPos = gMapYOffset; - else - yPos = 96; + xPos = gMapXOffset; + yPos = gMapYOffset; DrawMultiplayerTargets(); - pl = player; r = 255; g = 0; - i = 0; - do { + for (i = 0; i < NumPlayers; i++) + { + pl = &player[i]; + target.vx = pl->pos[0]; target.vz = pl->pos[2]; @@ -1004,18 +1020,14 @@ void DrawMultiplayerMap(void) WorldToMultiplayerMap(&target, &target); - target.vx += gMapXOffset; + target.vx += xPos; target.vz += yPos; DrawPlayerDot(&target, -pl->dir, r, g, 0, 0x8); - pl++; - r++; g--; - - i++; - } while (i < NumPlayers); + } draw_box(yPos, 64); @@ -1024,12 +1036,12 @@ void DrawMultiplayerMap(void) setPolyFT4(poly); setSemiTrans(poly, 1); - poly->x0 = gMapXOffset; + poly->x0 = xPos; poly->y0 = yPos; - poly->x1 = gMapXOffset + MAP_SIZE_W; + poly->x1 = xPos + MAP_SIZE_W; poly->y1 = yPos; - poly->x2 = gMapXOffset; - poly->x3 = gMapXOffset + MAP_SIZE_W; + poly->x2 = xPos; + poly->x3 = xPos + MAP_SIZE_W; poly->y2 = yPos + 64; poly->y3 = yPos + 64; @@ -1346,7 +1358,7 @@ void DrawOverheadMap(void) th = MapTex[i].h - 1; #ifndef PSX // make map fully detailed when filtering is not available - if (!g_bilinearFiltering) + if (!g_cfg_bilinearFiltering) { tw += 1; th += 1; @@ -1503,7 +1515,7 @@ void DrawFullscreenMap(void) #ifndef PSX /* It will look funny when enabled // make map fully detailed when filtering is not available - if (!g_bilinearFiltering) + if (!g_cfg_bilinearFiltering) { tw += 1; th += 1; @@ -1799,7 +1811,7 @@ void DrawFullscreenMap(void) // print string with special characters representing some images inserted into it sprintf(str, "\x80 %s \x81 %s \x8a %s", G_LTXT(GTXT_Exit), G_LTXT(GTXT_Rotation), G_LTXT(GTXT_Move)); - PrintStringCentred(str, 226); + PrintStringCentred(str, SCREEN_H - 30); // 226 } // [D] [T] diff --git a/src_rebuild/Game/C/pad.c b/src_rebuild/Game/C/pad.c index c051e099..35153250 100644 --- a/src_rebuild/Game/C/pad.c +++ b/src_rebuild/Game/C/pad.c @@ -74,7 +74,7 @@ void InitControllers(void) for (j = 0; j < 16; j++) { - pad->mappings.button_lookup[j] = 1 << (j & 0x1f); + pad->mappings.button_lookup[j] = 1 << j; } pad->mappings.swap_analog = 0; @@ -186,36 +186,36 @@ void MapPad(int pad, PADRAW *pData) Pads[pad].diranalog[2] = pData->analog[2] - 128; Pads[pad].diranalog[3] = pData->analog[3] - 128; - if (Pads[pad].active) + if (!Pads[pad].active) + return; + + mapped = 0; + + for (i = 0; i < 16; i++) { - mapped = 0; - - for (i = 0; i < 16; i++) + if (((buttons >> i) & 1) != 0) { - if (((buttons >> i) & 1) != 0) - { - mapped |= Pads[pad].mappings.button_lookup[i]; - } + mapped |= Pads[pad].mappings.button_lookup[i]; } + } - Pads[pad].mapnew = mapped & ~Pads[pad].mapped; - Pads[pad].mapped = mapped; + Pads[pad].mapnew = mapped & ~Pads[pad].mapped; + Pads[pad].mapped = mapped; - if (Pads[pad].mappings.swap_analog == 0) - { - Pads[pad].mapanalog[1] = Pads[pad].diranalog[1]; - Pads[pad].mapanalog[2] = Pads[pad].diranalog[2]; - Pads[pad].mapanalog[3] = Pads[pad].diranalog[3]; - Pads[pad].mapanalog[0] = Pads[pad].diranalog[0]; - } - else - { - Pads[pad].mapanalog[1] = Pads[pad].diranalog[3]; - Pads[pad].mapanalog[2] = Pads[pad].diranalog[0]; - Pads[pad].mapanalog[3] = Pads[pad].diranalog[1]; - Pads[pad].mapanalog[0] = Pads[pad].diranalog[2]; - } + if (Pads[pad].mappings.swap_analog == 0) + { + Pads[pad].mapanalog[1] = Pads[pad].diranalog[1]; + Pads[pad].mapanalog[2] = Pads[pad].diranalog[2]; + Pads[pad].mapanalog[3] = Pads[pad].diranalog[3]; + Pads[pad].mapanalog[0] = Pads[pad].diranalog[0]; + } + else + { + Pads[pad].mapanalog[1] = Pads[pad].diranalog[3]; + Pads[pad].mapanalog[2] = Pads[pad].diranalog[0]; + Pads[pad].mapanalog[3] = Pads[pad].diranalog[1]; + Pads[pad].mapanalog[0] = Pads[pad].diranalog[2]; } } diff --git a/src_rebuild/Game/C/pad.h b/src_rebuild/Game/C/pad.h index 0c5c8893..cf1b879a 100644 --- a/src_rebuild/Game/C/pad.h +++ b/src_rebuild/Game/C/pad.h @@ -3,43 +3,104 @@ #define PADBUFFER_SIZE 34 +// mapped pad identifiers +#define MPAD_L2 0x1 +#define MPAD_R2 0x2 +#define MPAD_L1 0x4 +#define MPAD_R1 0x8 + +#define MPAD_TRIANGLE 0x10 +#define MPAD_CIRCLE 0x20 +#define MPAD_CROSS 0x40 +#define MPAD_SQUARE 0x80 + +#define MPAD_SELECT 0x100 +#define MPAD_L3 0x200 +#define MPAD_R3 0x400 +#define MPAD_START 0x800 + +#define MPAD_D_UP 0x1000 +#define MPAD_D_RIGHT 0x2000 +#define MPAD_D_DOWN 0x4000 +#define MPAD_D_LEFT 0x8000 + enum ECameraPad { - CAMERA_PAD_LOOK_LEFT = 0x1, - CAMERA_PAD_LOOK_RIGHT = 0x2, + CAMERA_PAD_LOOK_LEFT = MPAD_L2, + CAMERA_PAD_LOOK_RIGHT = MPAD_R2, - CAMERA_PAD_LOOK_BACK = CAMERA_PAD_LOOK_LEFT | CAMERA_PAD_LOOK_RIGHT, - CAMERA_PAD_LOOK_BACK_DED = 0x200 + CAMERA_PAD_LOOK_BACK = MPAD_L2 | MPAD_R2, + CAMERA_PAD_LOOK_BACK_DED = MPAD_L3 }; enum ETannerPad { - TANNER_PAD_ACTION = 0x10, - TANNER_PAD_POWER = 0x20, - TANNER_PAD_GOFORWARD = 0x40 | 0x1000, - TANNER_PAD_GOBACK = 0x80 | 0x4000, - TANNER_PAD_TURNLEFT = 0x8000, - TANNER_PAD_TURNRIGHT = 0x2000, + TANNER_PAD_ACTION = MPAD_TRIANGLE, + TANNER_PAD_POWER = MPAD_CIRCLE, + TANNER_PAD_GOFORWARD = MPAD_CROSS | MPAD_D_UP, + TANNER_PAD_GOBACK = MPAD_SQUARE | MPAD_D_DOWN, + TANNER_PAD_TURNLEFT = MPAD_D_LEFT, + TANNER_PAD_TURNRIGHT = MPAD_D_RIGHT, - TANNER_PAD_ACTION_DED = 0x400, // R3 mapped for car entrance + TANNER_PAD_ACTION_DED = MPAD_R3, // R3 mapped for car entrance }; enum ECarPads { - CAR_PAD_FASTSTEER = 0x4, - CAR_PAD_HANDBRAKE = 0x10, - CAR_PAD_WHEELSPIN = 0x20, - CAR_PAD_ACCEL = 0x40, - CAR_PAD_BRAKE = 0x80, - CAR_PAD_UP = 0x1000, - CAR_PAD_LEFT = 0x8000, - CAR_PAD_RIGHT = 0x2000, + CAR_PAD_FASTSTEER = MPAD_L1, + CAR_PAD_HANDBRAKE = MPAD_TRIANGLE, + CAR_PAD_WHEELSPIN = MPAD_CIRCLE, + CAR_PAD_ACCEL = MPAD_CROSS, + CAR_PAD_BRAKE = MPAD_SQUARE, + CAR_PAD_UP = MPAD_D_UP, + CAR_PAD_LEFT = MPAD_D_LEFT, + CAR_PAD_RIGHT = MPAD_D_RIGHT, - CAR_PAD_LEAVECAR_DED = 0x400, // R3 mapped + CAR_PAD_LEAVECAR_DED = MPAD_R3, // R3 mapped - CAR_PAD_LEAVECAR = (CAR_PAD_UP | CAR_PAD_HANDBRAKE), // fixme: combinations? + CAR_PAD_LEAVECAR = (MPAD_D_UP | MPAD_TRIANGLE), }; +struct DUPLICATION +{ + char* buffer; + int size; +}; + +typedef struct MAPPING +{ + u_short button_lookup[16]; + u_short swap_analog; + u_short reserved1; +} *LPMAPPING; + +typedef struct PAD +{ + u_char active; + u_char type; + u_char dualshock; + u_char reserved1; + u_short direct; + u_short dirnew; + char diranalog[4]; + u_short mapped; + u_short mapnew; + char mapanalog[4]; + MAPPING mappings; + u_char alarmShakeCounter; + u_char asd; + u_char sdf; + u_char dfg; + u_char delay; + u_char port; + u_char state; + u_char dsactive; + u_char* shakeptr; + u_char motors[2]; + u_char shake_type; + u_char vibrate; +} *LPPAD; + extern int pad_connected; extern int numPadsConnected; extern int gVibration; diff --git a/src_rebuild/Game/C/pathfind.c b/src_rebuild/Game/C/pathfind.c index 4aa5bca4..86409d87 100644 --- a/src_rebuild/Game/C/pathfind.c +++ b/src_rebuild/Game/C/pathfind.c @@ -514,9 +514,12 @@ void setDistance(tNode* n, ushort dist) { n->dist = dist | 1; // valid bit for this frame - distanceCache[(n->vx >> 2 & 0x3f80U | n->vz >> 9 & 0x7fU) ^ (n->vy & 1U) * 0x2040 ^ (n->vy & 2U) << 0xc] = dist | 1; + DISTMAP_V(n->vx, n->vy, n->vz) = dist | 1; } +// [A] +void SetNodeDistanceWithParents(tNode* startNode, ushort dist); + // [D] [T] void iterate(void) { @@ -626,29 +629,7 @@ void iterate(void) } } - dist &= 0xffff; - - // store distance and get to the next lesser node - if (numHeapEntries != 198) - { - setDistance(&pathNodes[dir + 1], dist); - - i = numHeapEntries + 1; - - pnode = i; - parent = i >> 1; - - while (parent != 0 && dist < heap[parent].dist) - { - heap[i] = heap[parent]; - - pnode = parent; - parent >>= 1; - } - - heap[pnode] = pathNodes[dir + 1]; - numHeapEntries++; - } + SetNodeDistanceWithParents(&pathNodes[dir + 1], dist); } } @@ -683,13 +664,10 @@ extern int sdLevel; // D2ROADS // [D] [T] int getInterpolatedDistance(VECTOR* pos) { - int res; - int x; - int dist; - int min; + int x, res; + int dist, min; int a,b,c; - int fx; - int fz; + int fx, fz; tNode n; VECTOR sp; @@ -700,8 +678,8 @@ int getInterpolatedDistance(VECTOR* pos) if (OMAP_GETVALUE(n.vx >> 8, n.vz >> 8) != 0) { - res = MapHeight((VECTOR*)&n); - n.vy = res ^ (res ^ sdLevel) & 3; + n.vy = MapHeight((VECTOR*)&n); + n.vy = n.vy ^ (n.vy ^ sdLevel) & 3; } else { @@ -714,7 +692,7 @@ int getInterpolatedDistance(VECTOR* pos) sp.vx = n.vx + 256; sp.vz = n.vz + 512; - n.dist = distanceCache[(n.vx >> 2 & 0x3f80U | n.vz >> 9 & 0x7fU) ^ (n.vy & 1U) * 0x2040 ^ (n.vy & 2U) << 0xc]; + n.dist = DISTMAP_V(n.vx, n.vy, n.vz); a = n.dist; n.vx = sp.vx; @@ -722,15 +700,15 @@ int getInterpolatedDistance(VECTOR* pos) if (OMAP_GETVALUE(sp.vx >> 8, sp.vz >> 8) != 0) { - res = MapHeight((VECTOR*)&n); - n.vy = res ^ (res ^ sdLevel) & 3; + n.vy = MapHeight((VECTOR*)&n); + n.vy = n.vy ^ (n.vy ^ sdLevel) & 3; } else { n.vy = 0; } - n.dist = distanceCache[(n.vx >> 2 & 0x3f80U | n.vz >> 9 & 0x7fU) ^ (n.vy & 1U) * 0x2040 ^ (n.vy & 2U) << 0xc]; + n.dist = DISTMAP_V(n.vx, n.vy, n.vz); b = n.dist; if (a < b) @@ -745,15 +723,15 @@ int getInterpolatedDistance(VECTOR* pos) if (OMAP_GETVALUE(n.vx >> 8, n.vz >> 8) != 0) { - res = MapHeight((VECTOR*)&n); - res = res ^ (res ^ sdLevel) & 3; + n.vy = MapHeight((VECTOR*)&n); + n.vy = n.vy ^ (n.vy ^ sdLevel) & 3; } else { - res = 0; + n.vy = 0; } - dist = distanceCache[(n.vx >> 2 & 0x3f80U | n.vz >> 9 & 0x7fU) ^ (res & 1) * 0x2040 ^ (res & 2) << 0xc]; + dist = DISTMAP_V(n.vx, n.vy, n.vz); if (min < dist) c = min; @@ -788,15 +766,15 @@ int getInterpolatedDistance(VECTOR* pos) if (OMAP_GETVALUE(n.vx >> 8, n.vz >> 8) != 0) { - res = MapHeight((VECTOR*)&n); - res = res ^ (res ^ sdLevel) & 3; + n.vy = MapHeight((VECTOR*)&n); + n.vy = n.vy ^ (n.vy ^ sdLevel) & 3; } else { - res = 0; + n.vy = 0; } - dist = distanceCache[(n.vx >> 2 & 0x3f80U | n.vz >> 9 & 0x7fU) ^ (res & 1) * 0x2040 ^ (res & 2) << 0xc]; + dist = DISTMAP_V(n.vx, n.vy, n.vz); if (min < dist) c = min; @@ -876,17 +854,58 @@ void addCivs(void) } while (cp < &car_data[MAX_CARS - 1]); } +// [A] +void SetNodeDistanceWithParents(tNode* startNode, ushort dist) +{ + int i; + u_int pnode, parent; + + if (numHeapEntries == 198) + return; + + setDistance(startNode, dist); + + i = numHeapEntries + 1; + + pnode = i; + parent = i >> 1; + + while (parent != 0 && dist < heap[parent].dist) + { + heap[i] = heap[parent]; + + pnode = parent; + parent >>= 1; + } + + heap[pnode] = *startNode; + numHeapEntries++; +} + +// [A] +void ComputeDistanceFromSearchTarget(tNode* startNode) +{ + u_short dist; + int i, dx, dz; + + if (numHeapEntries == 198) + return; + + dx = startNode->vx - searchTarget.vx; + dz = startNode->vz - searchTarget.vz; + + dist = SquareRoot0( dx * dx + dz * dz ) >> 1; + + SetNodeDistanceWithParents(startNode, dist); +} + // [D] [T] void UpdateCopMap(void) { - int d; - int dist; + int i, d; int dx, dy, dz; - int i, maxret; - int res; + int maxret, res; tNode startNode; - u_int pnode; - u_int parent; BloodyHell(); @@ -941,7 +960,7 @@ void UpdateCopMap(void) searchTarget.vy = cp->hd.where.t[1] + FIXEDH(cp->st.n.linearVelocity[1]) * 4; searchTarget.vz = cp->hd.where.t[2] + FIXEDH(cp->st.n.linearVelocity[2]) * 8; } - else if (searchTarget.vy == -0x304f) + else if (searchTarget.vy == -12367) { searchTarget.vx = player[0].pos[0]; searchTarget.vy = player[0].pos[1]; @@ -984,168 +1003,30 @@ void UpdateCopMap(void) if (dz < dx + dz / 2) { - dx = startNode.vx - searchTarget.vx; - dz = startNode.vz - searchTarget.vz; - - dist = SquareRoot0(dx * dx + (dz) * (dz)); - dist = dist / 2 & 0xffff; - - if (numHeapEntries != 198) - { - setDistance(&startNode, dist); - - i = numHeapEntries + 1; - - pnode = i; - parent = i >> 1; - - while (parent != 0 && dist < heap[parent].dist) - { - heap[i] = heap[parent]; - - pnode = parent; - parent >>= 1; - } - - heap[pnode] = startNode; - numHeapEntries++; - } + ComputeDistanceFromSearchTarget(&startNode); startNode.vx += 256; startNode.vz += 512; - dist = SquareRoot0((startNode.vx - searchTarget.vx) * (startNode.vx - searchTarget.vx) + (startNode.vz - searchTarget.vz) * (startNode.vz - searchTarget.vz)); - dist = dist / 2 & 0xffff; - - if (numHeapEntries != 198) - { - setDistance(&startNode, dist); - - i = numHeapEntries + 1; - - pnode = i; - parent = i >> 1; - - while (parent != 0 && dist < heap[parent].dist) - { - heap[i] = heap[parent]; - - pnode = parent; - parent >>= 1; - } - - heap[pnode] = startNode; - numHeapEntries++; - } + ComputeDistanceFromSearchTarget(&startNode); startNode.vx += 256; startNode.vz -= 512; - - dist = SquareRoot0((startNode.vx - searchTarget.vx) * (startNode.vx - searchTarget.vx) + (startNode.vz - searchTarget.vz) * (startNode.vz - searchTarget.vz)); - dist = dist / 2 & 0xffff; - if (numHeapEntries != 198) - { - setDistance(&startNode, dist); - - i = numHeapEntries + 1; - - pnode = i; - parent = i >> 1; - - while (parent != 0 && dist < heap[parent].dist) - { - heap[i] = heap[parent]; - - pnode = parent; - parent >>= 1; - } - - heap[pnode] = startNode; - numHeapEntries++; - } + ComputeDistanceFromSearchTarget(&startNode); } else { - dx = startNode.vx - searchTarget.vx; - dz = startNode.vz - searchTarget.vz; - - dist = SquareRoot0(dx * dx + dz * dz); - dist = dist / 2 & 0xffff; - - if (numHeapEntries != 198) - { - setDistance(&startNode, dist); - - i = numHeapEntries + 1; - - pnode = i; - parent = i >> 1; - - while (parent != 0 && dist < heap[parent].dist) - { - heap[i] = heap[parent]; - - pnode = parent; - parent >>= 1; - } - - heap[pnode] = startNode; - numHeapEntries++; - } + ComputeDistanceFromSearchTarget(&startNode); startNode.vx += 256; startNode.vz += 512; - dist = SquareRoot0((startNode.vx - searchTarget.vx) * (startNode.vx - searchTarget.vx) + (startNode.vz - searchTarget.vz) * (startNode.vz - searchTarget.vz)); - dist = dist / 2 & 0xffff; - - if (numHeapEntries != 198) - { - setDistance(&startNode, dist); - - i = numHeapEntries + 1; - - pnode = i; - parent = i >> 1; - - while (parent != 0 && dist < heap[parent].dist) - { - heap[i] = heap[parent]; - - pnode = parent; - parent >>= 1; - } - - heap[pnode] = startNode; - numHeapEntries++; - } + ComputeDistanceFromSearchTarget(&startNode); startNode.vx -= 512; - dist = SquareRoot0((startNode.vx - searchTarget.vx) * (startNode.vx - searchTarget.vx) + (startNode.vz - searchTarget.vz) * (startNode.vz - searchTarget.vz)); - dist = dist / 2 & 0xffff; - - if (numHeapEntries != 198) - { - setDistance(&startNode, dist); - - i = numHeapEntries + 1; - - pnode = i; - parent = i >> 1; - - while (parent != 0 && dist < heap[parent].dist) - { - heap[i] = heap[parent]; - - pnode = parent; - parent >>= 1; - } - - heap[pnode] = startNode; - numHeapEntries++; - } + ComputeDistanceFromSearchTarget(&startNode); } } diff --git a/src_rebuild/Game/C/pause.c b/src_rebuild/Game/C/pause.c index 60bc9f18..5e40c5ac 100644 --- a/src_rebuild/Game/C/pause.c +++ b/src_rebuild/Game/C/pause.c @@ -43,6 +43,29 @@ struct MENU_MESSAGE int show; } gDisplayedMessage = { NULL, NULL, 0 }; +typedef void(*pauseFunc)(int dir); + +struct MENU_ITEM; +struct MENU_HEADER; + +struct MENU_ITEM +{ + char* Text; + u_char Type; + u_char Justify; + pauseFunc func; + EXIT_VALUE ExitValue; + MENU_HEADER* SubMenu; +}; + +struct MENU_HEADER +{ + char* Title; + XYWH Bound; + u_char NumItems; + MENU_ITEM* MenuItems; +}; + static MENU_ITEM* ActiveItem[PAUSE_MENU_LEVELS]; static MENU_HEADER* VisibleMenus[PAUSE_MENU_LEVELS]; static MENU_HEADER* ActiveMenu; @@ -497,7 +520,7 @@ char* WaitForTextEntry(char* textBufPtr, int maxLength) #if !USE_PAD_INPUT // PsyX input handler - gameOnTextInput = ScoreNameInputHandler; + g_cfg_gameOnTextInput = ScoreNameInputHandler; gCurrentTextChar = 0; #endif @@ -667,7 +690,7 @@ char* WaitForTextEntry(char* textBufPtr, int maxLength) } while (true); #if !USE_PAD_INPUT - gameOnTextInput = NULL; + g_cfg_gameOnTextInput = NULL; #endif return username; @@ -831,7 +854,7 @@ void SetupMenu(MENU_HEADER *menu, int back) ActiveMenu->Bound.x = ((304 - len) / 2) - 4; ActiveMenu->Bound.w = len + 24; - ActiveMenu->Bound.y = MAX(48, ((numItems + 1) * -15 + 256) / 2); + ActiveMenu->Bound.y = MAX(48, (SCREEN_H - (numItems + 1) * 15) / 2); ActiveMenu->Bound.h = (numItems + 1) * 15 + 10; ActiveItem[VisibleMenu] = &ActiveMenu->MenuItems[ActiveMenuItem]; @@ -1178,7 +1201,7 @@ void ControlMenu(void) // toggle map off if (gShowMap) { - if (paddata & 0x50) + if (paddata & (MPAD_CROSS | MPAD_TRIANGLE)) PauseMap(0); return; @@ -1219,13 +1242,13 @@ void ControlMenu(void) #ifndef PSX // Pause fix for PC mapping - if ((paddata & 0x10) && paddata & (0x1000 | 0x4000)) + if ((paddata & MPAD_TRIANGLE) && paddata & (MPAD_D_UP | MPAD_D_DOWN)) { paddata = 0; } #endif - if (paddata & 0x1000) + if (paddata & MPAD_D_UP) { // go up ActiveMenuItem--; @@ -1235,7 +1258,7 @@ void ControlMenu(void) ActiveItem[VisibleMenu] = &ActiveMenu->MenuItems[ActiveMenuItem]; } - else if (paddata & 0x4000) + else if (paddata & MPAD_D_DOWN) { // go down ActiveMenuItem++; @@ -1245,7 +1268,7 @@ void ControlMenu(void) ActiveItem[VisibleMenu] = &ActiveMenu->MenuItems[ActiveMenuItem]; } - else if (paddata & 0x40) + else if (paddata & MPAD_CROSS) { // Enter submenu if (pItem->Type & PAUSE_TYPE_SUBMENU) @@ -1274,7 +1297,7 @@ void ControlMenu(void) else PauseReturnValue = pItem->ExitValue; } - else if ((paddata & 0x10) || (paddata & 0x800)) // Triangle or Start + else if ((paddata & MPAD_TRIANGLE) || (paddata & MPAD_START)) // Triangle or Start { // continue game if needed @@ -1282,7 +1305,7 @@ void ControlMenu(void) { #ifndef PSX // hack for keyboard swap - if(!(paddata & 0x800)) + if(!(paddata & MPAD_START)) return; #endif for (i = 0; i < ActiveMenu->NumItems; i++) diff --git a/src_rebuild/Game/C/pause.h b/src_rebuild/Game/C/pause.h index b0181e8d..b2514e66 100644 --- a/src_rebuild/Game/C/pause.h +++ b/src_rebuild/Game/C/pause.h @@ -1,6 +1,18 @@ #ifndef PAUSE_H #define PAUSE_H +enum EXIT_VALUE +{ + MENU_QUIT_NONE = 0, + MENU_QUIT_CONTINUE = 1, + MENU_QUIT_QUIT = 2, + MENU_QUIT_RESTART = 3, + MENU_QUIT_DIRECTOR = 4, + MENU_QUIT_QUICKREPLAY = 5, + MENU_QUIT_BACKMENU = 6, + MENU_QUIT_NEXTMISSION = 7, +}; + extern int gShowMap; extern int gDrawPauseMenus; extern int pauseflag; diff --git a/src_rebuild/Game/C/pedest.c b/src_rebuild/Game/C/pedest.c index b69f05eb..61ddf2e3 100644 --- a/src_rebuild/Game/C/pedest.c +++ b/src_rebuild/Game/C/pedest.c @@ -27,23 +27,38 @@ #include "ASM/rndrasm.h" +struct CAR_COLLISION_BOX +{ + int min_x, max_x; + int min_z, max_z; +}; + +typedef struct SEATED_PEDESTRIANS +{ + int x; + int z; + short rotation; + char index; + char pad; +} *SEATEDPTR; + MODEL* pmTannerModels[17] = { 0 }; MODEL* pmJerichoModels[6] = { 0 }; -void PedDoNothing(PEDESTRIAN* pPed); -void PedUserWalker(PEDESTRIAN* pPed); -void PedUserRunner(PEDESTRIAN* pPed); -void PedGetInCar(PEDESTRIAN* pPed); -void PedGetOutCar(PEDESTRIAN* pPed); -void PedCarryOutAnimation(PEDESTRIAN* pPed); -void CivPedDoNothing(PEDESTRIAN* pPed); -void CivPedWalk(PEDESTRIAN* pPed); -void CivPedSit(PEDESTRIAN* pPed); -void CivPedJump(PEDESTRIAN* pPed); -void PedPressButton(PEDESTRIAN* pPed); -void TannerSitDown(PEDESTRIAN* pPed); -void CopStand(PEDESTRIAN* pPed); -void CivGetIn(PEDESTRIAN* pPed); +void PedDoNothing(LPPEDESTRIAN pPed); +void PedUserWalker(LPPEDESTRIAN pPed); +void PedUserRunner(LPPEDESTRIAN pPed); +void PedGetInCar(LPPEDESTRIAN pPed); +void PedGetOutCar(LPPEDESTRIAN pPed); +void PedCarryOutAnimation(LPPEDESTRIAN pPed); +void CivPedDoNothing(LPPEDESTRIAN pPed); +void CivPedWalk(LPPEDESTRIAN pPed); +void CivPedSit(LPPEDESTRIAN pPed); +void CivPedJump(LPPEDESTRIAN pPed); +void PedPressButton(LPPEDESTRIAN pPed); +void TannerSitDown(LPPEDESTRIAN pPed); +void CopStand(LPPEDESTRIAN pPed); +void CivGetIn(LPPEDESTRIAN pPed); pedFunc fpPedPersonalityFunctions[] = { PedDoNothing, @@ -72,7 +87,7 @@ const int tannerTurnStep = 4; int bKillTanner = 0; -SEATED_PEDESTRIANS* seated_pedestrian; // lump +SEATEDPTR seated_pedestrian; // lump int seated_count; int maxSeated; static int numTannerPeds = 0; @@ -81,9 +96,9 @@ int pinginPedAngle = 0; PEDESTRIAN pedestrians[MAX_PEDESTRIANS]; -PEDESTRIAN* pUsedPeds = NULL; // linked list of pedestrians -PEDESTRIAN* pFreePeds = NULL; -PEDESTRIAN* pHold = NULL; +LPPEDESTRIAN pUsedPeds = NULL; // linked list of pedestrians +LPPEDESTRIAN pFreePeds = NULL; +LPPEDESTRIAN pHold = NULL; int max_pedestrians; int num_pedestrians; @@ -103,6 +118,11 @@ int bPower = 0; int oldWeather = 0; int powerCounter = 0; +extern int CheckForPlayerCar(LPPEDESTRIAN pedestrian, CAR_COLLISION_BOX* collision_box); // 0x000732C0 +extern SEATEDPTR FindSeated(); // 0x00072644 +extern SEATEDPTR FindTannerASeat(LPPEDESTRIAN pPed); // 0x000717AC +extern void add_seated(SEATEDPTR seatedptr, int seat_index); // 0x000718C8 + // [D] [T] void InitTanner(void) { @@ -142,7 +162,7 @@ void InitTanner(void) // [D] [T] void SetTannerPosition(VECTOR* pVec) { - PEDESTRIAN* pPed; + LPPEDESTRIAN pPed; pPed = pUsedPeds; while (pPed) @@ -166,18 +186,18 @@ void SetTannerPosition(VECTOR* pVec) void InitPedestrians(void) { int loop; - SEATED_PEDESTRIANS* seatedptr; + SEATEDPTR seatedptr; memset((u_char*)pedestrians, 0, sizeof(pedestrians)); DestroyPedestrians(); - PEDESTRIAN* lastPed = &pedestrians[0]; + LPPEDESTRIAN lastPed = &pedestrians[0]; lastPed->pPrev = NULL; for (loop = 1; loop < MAX_PEDESTRIANS; loop++) { - PEDESTRIAN* currPed = &pedestrians[loop]; + LPPEDESTRIAN currPed = &pedestrians[loop]; lastPed->pNext = currPed; currPed->pPrev = lastPed++; @@ -205,7 +225,6 @@ void InitPedestrians(void) maxSeated = seated_count; numTannerPeds = 0; pinginPedAngle = 0; - pPlayerPed = NULL; seated_count = 0; ping_in_pedestrians = 1; numCopPeds = 0; @@ -228,8 +247,8 @@ void DestroyPedestrians(void) // [D] [T] void DestroyCivPedestrians(void) { - PEDESTRIAN* pPed; - PEDESTRIAN* pHPed; + LPPEDESTRIAN pPed; + LPPEDESTRIAN pHPed; pPed = pUsedPeds; while (pPed != NULL) @@ -248,7 +267,7 @@ void DestroyCivPedestrians(void) // [D] [T] -void DestroyPedestrian(PEDESTRIAN* pPed) +void DestroyPedestrian(LPPEDESTRIAN pPed) { if (pPed->flags & 8) numCopPeds--; // or road block pedestrians @@ -307,9 +326,9 @@ int PedSurfaceType(VECTOR* ped_pos) } // [D] [T] -PEDESTRIAN* CreatePedestrian(void) +LPPEDESTRIAN CreatePedestrian(void) { - PEDESTRIAN* pNewPed; + LPPEDESTRIAN pNewPed; pNewPed = pFreePeds; if (pFreePeds != NULL) @@ -401,7 +420,7 @@ void PlaceRoadBlockCops(void) // [D] [T] int CreatePedAtLocation(LONGVECTOR4* pPos, int pedType) { - PEDESTRIAN* pPed; + LPPEDESTRIAN pPed; if (num_pedestrians >= MAX_PLACED_PEDS) return 0; @@ -457,7 +476,7 @@ int CreatePedAtLocation(LONGVECTOR4* pPos, int pedType) // [D] [T] void DrawAllPedestrians(void) { - PEDESTRIAN* pPed; + LPPEDESTRIAN pPed; pPed = pUsedPeds; while (pPed != NULL) @@ -505,7 +524,7 @@ void DrawAllPedestrians(void) // [D] [T] int TannerActionHappening(void) { - PEDESTRIAN* pPed = player[0].pPed; + LPPEDESTRIAN pPed = player[0].pPed; if (pPed && pPed->type == PED_ACTION_PRESSBUTTON) return pPed->frame1 == 14; @@ -520,8 +539,8 @@ int bAvoidBomb = -1; void ControlPedestrians(void) { CAR_DATA* pCar; - PEDESTRIAN* pPed; - PEDESTRIAN* pPedNext; + LPPEDESTRIAN pPed; + LPPEDESTRIAN pPedNext; pPed = pUsedPeds; @@ -584,7 +603,7 @@ void ControlPedestrians(void) // [D] [T] -void AnimatePed(PEDESTRIAN* pPed) +void AnimatePed(LPPEDESTRIAN pPed) { int dir; VECTOR vec; @@ -648,10 +667,13 @@ void AnimatePed(PEDESTRIAN* pPed) if ((pPed->pedType == TANNER_MODEL || (ActiveCheats.cheat12 && pPed->pedType == OTHER_MODEL)) && pPed->type < PED_ACTION_BACK) { int surfId; - surfId = PedSurfaceType((VECTOR*)&pPed->position); + surfId = PedSurfaceType(&vec); // play footstep sounds - if (surfId != 4 && surfId != 6 && surfId != 11 && surfId != 9) + if (surfId != SURF_GRASS && + surfId != SURF_WATER && + surfId != SURF_SAND && + surfId != SURF_DEEPWATER) { if (pPed->frame1 == 3) Start3DSoundVolPitch(-1, SOUND_BANK_TANNER, 0, pPed->position.vx, -pPed->position.vy, pPed->position.vz, -5000, 0x1000); @@ -674,7 +696,7 @@ void AnimatePed(PEDESTRIAN* pPed) // [D] [T] -void SetupDoNowt(PEDESTRIAN* pPed) +void SetupDoNowt(LPPEDESTRIAN pPed) { pPed->speed = 0; pPed->dir.vz = 0; @@ -686,7 +708,7 @@ void SetupDoNowt(PEDESTRIAN* pPed) } // [D] [T] -void SetupWalker(PEDESTRIAN* pPed) +void SetupWalker(LPPEDESTRIAN pPed) { pPed->type = PED_ACTION_WALK; pPed->speed = 14; @@ -696,7 +718,7 @@ void SetupWalker(PEDESTRIAN* pPed) } // [D] [T] -void SetupRunner(PEDESTRIAN* pPed) +void SetupRunner(LPPEDESTRIAN pPed) { pPed->type = PED_ACTION_RUN; pPed->frame1 = 0; @@ -707,7 +729,7 @@ void SetupRunner(PEDESTRIAN* pPed) } // [D] [T] -void SetupBack(PEDESTRIAN* pPed) +void SetupBack(LPPEDESTRIAN pPed) { pPed->type = PED_ACTION_WALK; pPed->frame1 = 0; @@ -720,7 +742,7 @@ void SetupBack(PEDESTRIAN* pPed) CAR_DATA* pCivCarToGetIn = NULL; // [D] [T] -void CivGetIn(PEDESTRIAN* pPed) // [A] UNUSED +void CivGetIn(LPPEDESTRIAN pPed) // [A] UNUSED { u_int padid; DRIVER2_CURVE* curve; @@ -742,7 +764,7 @@ void CivGetIn(PEDESTRIAN* pPed) // [A] UNUSED } // [D] [T] -void CopStand(PEDESTRIAN* pPed) +void CopStand(LPPEDESTRIAN pPed) { VECTOR v; v.vx = pPed->position.vx - player[0].pos[0]; @@ -755,7 +777,7 @@ void CopStand(PEDESTRIAN* pPed) int iAllowWatch = 0; // [D] [T] -void PedDoNothing(PEDESTRIAN* pPed) +void PedDoNothing(LPPEDESTRIAN pPed) { pPed->speed = 0; @@ -869,7 +891,7 @@ void PedDoNothing(PEDESTRIAN* pPed) } // [D] [T] -void PedUserRunner(PEDESTRIAN* pPed) +void PedUserRunner(LPPEDESTRIAN pPed) { if ((pPed->flags & 0x10U) == 0) { @@ -947,7 +969,7 @@ void PedUserRunner(PEDESTRIAN* pPed) } // [D] [T] -void PedUserWalker(PEDESTRIAN* pPed) +void PedUserWalker(LPPEDESTRIAN pPed) { if ((pPed->flags & 0x10) == 0) { @@ -987,7 +1009,7 @@ int bFreezeAnimation = 0; int allreadydone = 0; // [D] [T] -void PedCarryOutAnimation(PEDESTRIAN* pPed) +void PedCarryOutAnimation(LPPEDESTRIAN pPed) { pPed->speed = 0; @@ -1051,7 +1073,7 @@ CAR_DATA* carToGetIn; int bReverseYRotation = 0; // [D] [T] -void PedGetOutCar(PEDESTRIAN* pPed) +void PedGetOutCar(LPPEDESTRIAN pPed) { int playerId; @@ -1081,7 +1103,7 @@ void PedGetOutCar(PEDESTRIAN* pPed) int lastCarCameraView = 0; // [D] [T] -void SetupGetOutCar(PEDESTRIAN* pPed, CAR_DATA* pCar, int side) +void SetupGetOutCar(LPPEDESTRIAN pPed, CAR_DATA* pCar, int side) { bool entrySide; int sn, cs; @@ -1128,7 +1150,7 @@ void SetupGetOutCar(PEDESTRIAN* pPed, CAR_DATA* pCar, int side) // [D] [T] -void SetupGetInCar(PEDESTRIAN* pPed) +void SetupGetInCar(LPPEDESTRIAN pPed) { int sn, cs; int carDir; @@ -1191,7 +1213,7 @@ void SetupGetInCar(PEDESTRIAN* pPed) } // [D] [T] -void PedGetInCar(PEDESTRIAN* pPed) +void PedGetInCar(LPPEDESTRIAN pPed) { int playerID; @@ -1213,13 +1235,12 @@ void PedGetInCar(PEDESTRIAN* pPed) ChangePedPlayerToCar(playerID, carToGetIn); DestroyPedestrian(pPed); - pPlayerPed = NULL; numTannerPeds--; } } // [D] [T] -void SetupPressButton(PEDESTRIAN* pPed) +void SetupPressButton(LPPEDESTRIAN pPed) { pPed->type = PED_ACTION_PRESSBUTTON; SetupPedMotionData(pPed); @@ -1231,7 +1252,7 @@ void SetupPressButton(PEDESTRIAN* pPed) } // [D] [T] -void PedPressButton(PEDESTRIAN* pPed) +void PedPressButton(LPPEDESTRIAN pPed) { if (pPed->frame1 < 15) { @@ -1249,7 +1270,7 @@ void PedPressButton(PEDESTRIAN* pPed) // [D] [T] -void SetupTannerSitDown(PEDESTRIAN* pPed) +void SetupTannerSitDown(LPPEDESTRIAN pPed) { pPed->type = PED_ACTION_SIT; SetupPedMotionData(pPed); @@ -1261,7 +1282,7 @@ void SetupTannerSitDown(PEDESTRIAN* pPed) } // [D] [T] -void TannerCameraHandler(PEDESTRIAN* pPed) +void TannerCameraHandler(LPPEDESTRIAN pPed) { int value; int padSteer; @@ -1310,7 +1331,7 @@ void TannerCameraHandler(PEDESTRIAN* pPed) // [D] [T] -void TannerSitDown(PEDESTRIAN* pPed) +void TannerSitDown(LPPEDESTRIAN pPed) { if (oldCamView != 2 && player[pPed->padId].cameraView == 2) { @@ -1364,7 +1385,7 @@ void TannerSitDown(PEDESTRIAN* pPed) } // [D] [T] -void CivPedDoNothing(PEDESTRIAN* pPed) +void CivPedDoNothing(LPPEDESTRIAN pPed) { } @@ -1397,7 +1418,7 @@ void SetupCivPedRouteData(VECTOR* pPos) void PingInPedestrians(void) { int bFound; - PEDESTRIAN* pPed; + LPPEDESTRIAN pPed; int rnd; int pingInDist; int i; @@ -1517,7 +1538,7 @@ void PingInPedestrians(void) } // [D] [T] -void TannerCollision(PEDESTRIAN* pPed) +void TannerCollision(LPPEDESTRIAN pPed) { CAR_DATA* pcdTanner; @@ -1554,7 +1575,7 @@ void TannerCollision(PEDESTRIAN* pPed) } // [D] [T] -int FindPointOfCollision(CAR_DATA* pCar, PEDESTRIAN* pPed) +int FindPointOfCollision(CAR_DATA* pCar, LPPEDESTRIAN pPed) { int dx, dz; int minZ; @@ -1746,7 +1767,7 @@ int TannerCarCollisionCheck(VECTOR* pPos, int dir, int bQuick) } // [D] [T] -int PingOutPed(PEDESTRIAN* pPed) +int PingOutPed(LPPEDESTRIAN pPed) { int pz; int px; @@ -1764,7 +1785,7 @@ int PingOutPed(PEDESTRIAN* pPed) } // [D] [T] -void SetupCivJump(PEDESTRIAN* pPed, CAR_DATA* cp) +void SetupCivJump(LPPEDESTRIAN pPed, CAR_DATA* cp) { int dz; short scale; @@ -1844,7 +1865,7 @@ void SetupCivJump(PEDESTRIAN* pPed, CAR_DATA* cp) } // [D] [T] -void CivPedJump(PEDESTRIAN* pPed) +void CivPedJump(LPPEDESTRIAN pPed) { if (pPed->frame1 == 2) pPed->speed *= 2; @@ -1867,7 +1888,7 @@ void CivPedJump(PEDESTRIAN* pPed) } // [D] [T] -void SetupCivPedWalk(PEDESTRIAN* pPed) +void SetupCivPedWalk(LPPEDESTRIAN pPed) { pPed->flags |= 0x10; @@ -1882,7 +1903,7 @@ void SetupCivPedWalk(PEDESTRIAN* pPed) } // [D] [T] -void CivPedWalk(PEDESTRIAN* pPed) +void CivPedWalk(LPPEDESTRIAN pPed) { int dir; int turn; @@ -1962,7 +1983,7 @@ void CivPedWalk(PEDESTRIAN* pPed) } // [D] [T] -void CivPedSit(PEDESTRIAN* pPed) +void CivPedSit(LPPEDESTRIAN pPed) { pPed->frame1 = 0; } @@ -1979,7 +2000,7 @@ void HandlePedestrians(void) } // [D] [T] -void PedestrianActionInit_WalkToTarget(PEDESTRIAN* pPed) +void PedestrianActionInit_WalkToTarget(LPPEDESTRIAN pPed) { int dir; dir = CalcPedestrianDirection(0, (pPed->position).vx, (pPed->position).vz, &pPed->target); @@ -2002,7 +2023,7 @@ void PedestrianActionInit_WalkToTarget(PEDESTRIAN* pPed) } // [D] [T] -void CorrectPathPosition(PEDESTRIAN* pedestrian, VECTOR* position) +void CorrectPathPosition(LPPEDESTRIAN pedestrian, VECTOR* position) { } @@ -2094,7 +2115,7 @@ int CalcPedestrianDirection(int last_dir, int wx, int wz, VECTOR* target) } // [D] [T] -int IsPavement(int x, int y, int z, PEDESTRIAN* pPed) +int IsPavement(int x, int y, int z, LPPEDESTRIAN pPed) { int r; VECTOR v; @@ -2119,7 +2140,7 @@ int IsPavement(int x, int y, int z, PEDESTRIAN* pPed) } // [D] [T] -void SetPedestrianTurn(PEDESTRIAN* pedestrian, int turn) +void SetPedestrianTurn(LPPEDESTRIAN pedestrian, int turn) { int speed; int dir; @@ -2140,12 +2161,12 @@ void SetPedestrianTurn(PEDESTRIAN* pedestrian, int turn) } // [D] [T] -SEATED_PEDESTRIANS* FindSeated(void) +SEATEDPTR FindSeated(void) { int dz; int dx; int count1; - SEATED_PEDESTRIANS* seatedptr; + SEATEDPTR seatedptr; if (!seated_pedestrian) return NULL; @@ -2186,13 +2207,13 @@ SEATED_PEDESTRIANS* FindSeated(void) } // [D] [T] -SEATED_PEDESTRIANS* FindTannerASeat(PEDESTRIAN* pPed) +SEATEDPTR FindTannerASeat(LPPEDESTRIAN pPed) { int dx, dz; int distSqr; int bestSqr; - SEATED_PEDESTRIANS* seatedptr; - SEATED_PEDESTRIANS* theOne; + SEATEDPTR seatedptr; + SEATEDPTR theOne; theOne = NULL; bestSqr = 4096; @@ -2238,9 +2259,9 @@ SEATED_PEDESTRIANS* FindTannerASeat(PEDESTRIAN* pPed) } // [D] [T] -void add_seated(SEATED_PEDESTRIANS* seatedptr, int seat_index) +void add_seated(SEATEDPTR seatedptr, int seat_index) { - PEDESTRIAN* pedptr; + LPPEDESTRIAN pedptr; int rnd; if (num_pedestrians < MAX_SEATED_PEDS) @@ -2395,7 +2416,7 @@ void BuildCarCollisionBox(void) } // [D] [T] -CAR_DATA* CheckForCar(PEDESTRIAN* pedestrian) +CAR_DATA* CheckForCar(LPPEDESTRIAN pedestrian) { int count; @@ -2429,7 +2450,7 @@ CAR_DATA* CheckForCar(PEDESTRIAN* pedestrian) } // [D] [T] -int CheckForPlayerCar(PEDESTRIAN* pedestrian, CAR_COLLISION_BOX* collision_box) +int CheckForPlayerCar(LPPEDESTRIAN pedestrian, CAR_COLLISION_BOX* collision_box) { if (pedestrian->position.vx >= collision_box->min_x && pedestrian->position.vx <= collision_box->max_x && @@ -2445,7 +2466,7 @@ int CheckForPlayerCar(PEDESTRIAN* pedestrian, CAR_COLLISION_BOX* collision_box) int basic_car_interest; // [D] [T] -void CalculatePedestrianInterest(PEDESTRIAN* pPed) +void CalculatePedestrianInterest(LPPEDESTRIAN pPed) { CAR_DATA* pCar; int carId; @@ -2499,7 +2520,7 @@ void CalculatePedestrianInterest(PEDESTRIAN* pPed) // [D] [T] void ProcessChairLump(char* lump_file, int lump_size) { - seated_pedestrian = (SEATED_PEDESTRIANS*)lump_file; + seated_pedestrian = (SEATEDPTR)lump_file; } // [D] [T] @@ -2564,7 +2585,7 @@ void IHaveThePower(void) } // [D] [T] -void ProcessTannerPad(PEDESTRIAN* pPed, u_int pad, char PadSteer, char use_analogue) +void ProcessTannerPad(LPPEDESTRIAN pPed, u_int pad, char PadSteer, char use_analogue) { sdPlane* SurfacePtr; int direction; @@ -2759,7 +2780,7 @@ int ActivatePlayerPedestrian(CAR_DATA* pCar, char* padId, int direction, LONGVEC int wbody; int side; int dir; - PEDESTRIAN* pedptr; + LPPEDESTRIAN pedptr; int playerId; VECTOR* pos; VECTOR v; @@ -2886,8 +2907,6 @@ int ActivatePlayerPedestrian(CAR_DATA* pCar, char* padId, int direction, LONGVEC pedptr->dir.vx = 0; pedptr->dir.vy = dir; pedptr->head_rot = 0; - - pPlayerPed = pedptr; lp->headTimer = 0; pedptr->pedType = playerType; SetupPedestrian(pedptr); @@ -2962,7 +2981,7 @@ int ActivatePlayerPedestrian(CAR_DATA* pCar, char* padId, int direction, LONGVEC } // [D] [T] -void DeActivatePlayerPedestrian(PEDESTRIAN* pPed) +void DeActivatePlayerPedestrian(LPPEDESTRIAN pPed) { CAR_DATA* cp; int playerId; diff --git a/src_rebuild/Game/C/pedest.h b/src_rebuild/Game/C/pedest.h index ecc9dd03..b0d3af7e 100644 --- a/src_rebuild/Game/C/pedest.h +++ b/src_rebuild/Game/C/pedest.h @@ -3,33 +3,35 @@ #define TANNER_COLLIDER_CARID (MAX_CARS) +typedef struct SEATED_PEDESTRIANS* SEATEDPTR; + extern SVECTOR tannerLookAngle; extern MODEL* pmTannerModels[17]; extern MODEL* pmJerichoModels[6]; -extern SEATED_PEDESTRIANS *seated_pedestrian; +extern SEATEDPTR seated_pedestrian; extern int bKillTanner; extern int bReverseYRotation; -extern PEDESTRIAN *pUsedPeds; +extern LPPEDESTRIAN pUsedPeds; extern void ProcessChairLump(char *lump_file, int lump_size); // 0x00073328 extern void InitTanner(); // 0x0006E408 extern void SetTannerPosition(VECTOR *pVec); // 0x00072478 -extern void ProcessTannerPad(PEDESTRIAN *pPed, u_int pad, char PadSteer, char use_analogue); // 0x0006DF54 +extern void ProcessTannerPad(LPPEDESTRIAN pPed, u_int pad, char PadSteer, char use_analogue); // 0x0006DF54 extern void InitPedestrians(); // 0x0006E5C4 extern void DestroyPedestrians(); // 0x00071F54 extern void DestroyCivPedestrians(); // 0x00072FD0 -extern void DestroyPedestrian(PEDESTRIAN *pPed); // 0x00071FB4 +extern void DestroyPedestrian(LPPEDESTRIAN pPed); // 0x00071FB4 extern int ActivatePlayerPedestrian(CAR_DATA *pCar, char *padId, int direction, LONGVECTOR4* position, PED_MODEL_TYPES playerType); // 0x0006E6C4 -extern PEDESTRIAN * CreatePedestrian(); // 0x000720AC +extern LPPEDESTRIAN CreatePedestrian(); // 0x000720AC extern void PlaceRoadBlockCops(); // 0x0006EC88 extern int CreatePedAtLocation(LONGVECTOR4* pPos, int pedType); // 0x0006F00C @@ -39,50 +41,42 @@ extern int TannerActionHappening(); // 0x00072430 extern void ControlPedestrians(); // 0x0006F16C -extern void DeActivatePlayerPedestrian(PEDESTRIAN *pPed); // 0x0007216C +extern void DeActivatePlayerPedestrian(LPPEDESTRIAN pPed); // 0x0007216C extern void SetupCivPedRouteData(VECTOR *pPos); // 0x0007313C extern void PingInPedestrians(); // 0x0007047C -extern void TannerCollision(PEDESTRIAN *pPed); // 0x00072EE4 +extern void TannerCollision(LPPEDESTRIAN pPed); // 0x00072EE4 -extern int FindPointOfCollision(CAR_DATA *pCar, PEDESTRIAN* pPed); // 0x00070878 +extern int FindPointOfCollision(CAR_DATA *pCar, LPPEDESTRIAN pPed); // 0x00070878 extern int TannerCarCollisionCheck(VECTOR *pPos, int dir, int bQuick); // 0x00070A9C -extern int PingOutPed(PEDESTRIAN *pPed); // 0x000731F8 +extern int PingOutPed(LPPEDESTRIAN pPed); // 0x000731F8 -extern void SetupCivJump(PEDESTRIAN *pPed, CAR_DATA *cp); // 0x00071054 +extern void SetupCivJump(LPPEDESTRIAN pPed, CAR_DATA *cp); // 0x00071054 -extern void SetupCivPedWalk(PEDESTRIAN *pPed); // 0x00073270 +extern void SetupCivPedWalk(LPPEDESTRIAN pPed); // 0x00073270 extern void HandlePedestrians(); // 0x0007211C -extern void PedestrianActionInit_WalkToTarget(PEDESTRIAN *pPed); // 0x0007283C +extern void PedestrianActionInit_WalkToTarget(LPPEDESTRIAN pPed); // 0x0007283C -extern void CorrectPathPosition(PEDESTRIAN *pedestrian, VECTOR *position); // 0x000715FC +extern void CorrectPathPosition(LPPEDESTRIAN pedestrian, VECTOR *position); // 0x000715FC extern int CalcPedestrianDirection(int last_dir, int wx, int wz, VECTOR *target); // 0x00071608 -extern int IsPavement(int x, int y, int z, PEDESTRIAN *pPed); // 0x000725B8 +extern int IsPavement(int x, int y, int z, LPPEDESTRIAN pPed); // 0x000725B8 -extern void SetPedestrianTurn(PEDESTRIAN *pedestrian, int turn); // 0x00072500 - -extern SEATED_PEDESTRIANS * FindSeated(); // 0x00072644 - -extern SEATED_PEDESTRIANS * FindTannerASeat(PEDESTRIAN *pPed); // 0x000717AC - -extern void add_seated(SEATED_PEDESTRIANS *seatedptr, int seat_index); // 0x000718C8 +extern void SetPedestrianTurn(LPPEDESTRIAN pedestrian, int turn); // 0x00072500 extern void set_coll_box(int index, CAR_DATA *cp, int offset); // 0x00071A5C extern void BuildCarCollisionBox(); // 0x00071B7C -extern CAR_DATA * CheckForCar(PEDESTRIAN *pedestrian); // 0x00072738 +extern CAR_DATA* CheckForCar(LPPEDESTRIAN pedestrian); // 0x00072738 -extern int CheckForPlayerCar(PEDESTRIAN *pedestrian, CAR_COLLISION_BOX *collision_box); // 0x000732C0 - -extern void CalculatePedestrianInterest(PEDESTRIAN *pPed); // 0x00071E0C +extern void CalculatePedestrianInterest(LPPEDESTRIAN pPed); // 0x00071E0C #endif diff --git a/src_rebuild/Game/C/players.c b/src_rebuild/Game/C/players.c index 0c653405..18111b51 100644 --- a/src_rebuild/Game/C/players.c +++ b/src_rebuild/Game/C/players.c @@ -14,8 +14,7 @@ #include "felony.h" #include "shadow.h" -PEDESTRIAN *pPlayerPed = NULL; -PLAYER player[8]; +PLAYER player[MAX_PLAYERS]; // [D] [T] void InitPlayer(PLAYER *locPlayer, CAR_DATA *cp, char carCtrlType, int direction, LONGVECTOR4* startPos, int externModel, int palette, char *padid) @@ -62,8 +61,11 @@ void InitPlayer(PLAYER *locPlayer, CAR_DATA *cp, char carCtrlType, int direction } else { + LPPEDESTRIAN pPlayerPed; ActivatePlayerPedestrian(NULL, padid, direction, startPos, (PED_MODEL_TYPES)playerType); + pPlayerPed = locPlayer->pPed; + locPlayer->playerType = 2; locPlayer->spoolXZ = (VECTOR *)&pPlayerPed->position; locPlayer->playerCarId = -1; @@ -113,6 +115,9 @@ void ChangeCarPlayerToPed(int playerID) if (gInGameCutsceneActive == 0 && gInGameChaseActive == 0) { + LPPEDESTRIAN pPlayerPed; + pPlayerPed = locPlayer->pPed; + locPlayer->worldCentreCarId = -1; locPlayer->spoolXZ = (VECTOR *)&pPlayerPed->position; } @@ -241,17 +246,18 @@ void ChangePedPlayerToCar(int playerID, CAR_DATA *newCar) // [D] [T] void UpdatePlayers(void) { - int carId; - PEDESTRIAN *ped; - PLAYER *locPlayer; + int i, carId; + LPPEDESTRIAN ped; + PLAYER* locPlayer; CAR_DATA* cp; - if(CopsAllowed == 0) + if (CopsAllowed == 0) pedestrianFelony = 0; - locPlayer = player; + for (i = 0; i < MAX_PLAYERS; i++) + { + locPlayer = &player[i]; - do { if (gInGameCutsceneActive == 0) locPlayer->playerType = (locPlayer->pPed != NULL) ? 2 : 1; @@ -259,31 +265,29 @@ void UpdatePlayers(void) { carId = locPlayer->playerCarId; - if(locPlayer->worldCentreCarId >= 0) - locPlayer->spoolXZ = (VECTOR *)car_data[locPlayer->worldCentreCarId].hd.where.t; + if (locPlayer->worldCentreCarId >= 0) + locPlayer->spoolXZ = (VECTOR*)car_data[locPlayer->worldCentreCarId].hd.where.t; if (carId >= 0) { cp = &car_data[carId]; - + locPlayer->pos[0] = cp->hd.where.t[0]; locPlayer->pos[1] = cp->hd.where.t[1]; locPlayer->pos[2] = cp->hd.where.t[2]; locPlayer->dir = cp->hd.direction; } } - else if (locPlayer->playerType == 2) + else if (locPlayer->playerType == 2) { ped = locPlayer->pPed; - + locPlayer->pos[0] = ped->position.vx; locPlayer->pos[1] = -ped->position.vy; locPlayer->pos[2] = ped->position.vz; - locPlayer->dir = ped->dir.vy + -0x800; + locPlayer->dir = ped->dir.vy - 2048; } - - locPlayer++; - } while (locPlayer <= &player[7]); + } } // [D] [T] diff --git a/src_rebuild/Game/C/players.h b/src_rebuild/Game/C/players.h index 70000ce4..b418cbe7 100644 --- a/src_rebuild/Game/C/players.h +++ b/src_rebuild/Game/C/players.h @@ -1,8 +1,7 @@ #ifndef PLAYERS_H #define PLAYERS_H -extern PLAYER player[8]; -extern PEDESTRIAN *pPlayerPed; +extern PLAYER player[MAX_PLAYERS]; extern void InitPlayer(PLAYER *locPlayer, CAR_DATA *cp, char carCtrlType, int direction, LONGVECTOR4* startPos, int externModel, int palette, char *padid); // 0x000739D8 diff --git a/src_rebuild/Game/C/pres.c b/src_rebuild/Game/C/pres.c index 39c9ea15..928fed71 100644 --- a/src_rebuild/Game/C/pres.c +++ b/src_rebuild/Game/C/pres.c @@ -5,6 +5,12 @@ extern TEXTURE_DETAILS digit_texture; +struct FONT_DIGIT +{ + char xOffset; + char width; +}; + FONT_DIGIT fontDigit[] = { { 2, 14 }, { 17, 14}, @@ -117,7 +123,7 @@ void PrintStringCentred(char *pString, short y) void LoadFont(char *buffer) { int i; - ushort *clut; + ushort *clut, *pclut; int nchars; char *file; RECT16 dest; @@ -148,9 +154,10 @@ void LoadFont(char *buffer) fontclutid = GetClut(fontclutpos.x,fontclutpos.y); clut = (ushort*)file; + pclut = clut; for (i = 0; i < 16; i++) - *clut++ &= 0x7fff; + *pclut++ &= ~0x8000; clut[1] |= 0x8000; clut[2] |= 0x8000; @@ -159,7 +166,7 @@ void LoadFont(char *buffer) fonttpage = GetTPage(0,0, dest.x, dest.y); - LoadImage(&fontclutpos, (u_long *)file); // upload clut + LoadImage(&fontclutpos, (u_long *)clut); // upload clut LoadImage(&dest, (u_long *)(file + 32)); // upload font image DrawSync(0); @@ -186,20 +193,20 @@ void SetCLUT16Flags(ushort clutID, ushort mask, char transparent) int x, y; ushort buffer[16]; - x = (clutID & 0x3f) << 4; + x = (clutID & 63) * 16; y = (clutID >> 6); - StoreClut2((ulong *)buffer,x,y); + StoreClut2((ulong *)buffer, x, y); pCurrent = buffer; ctr = 1; while (pCurrent < &buffer[16]) { - if (mask >> (ctr & 1U) == 0) - *pCurrent &= 0x7fff; - else + if ((mask >> ctr) & 1 != 0) *pCurrent |= 0x8000; + else + *pCurrent &= ~0x8000; buffer[transparent] = 0; @@ -231,28 +238,25 @@ int PrintString(char *string, int x, int y) if (showMap != 0) font = (SPRT *)SetFontTPage(font); - chr = *string++; width = x; - while (chr) + while ((chr = *string++) != 0) { if (chr == 32) { width += 4; + continue; } - else if (chr < 32 || chr > 138 || chr < 128) + + if (chr < 32 || chr > 138 || chr < 128) { if (AsciiTable[chr] == -1) index = AsciiTable[63]; // place a question mark else index = AsciiTable[chr]; - chr = fontinfo[index].width; - setSprt(font); -#ifdef PSX setSemiTrans(font, 1); -#endif font->r0 = gFontColour.r; font->g0 = gFontColour.g; @@ -263,7 +267,7 @@ int PrintString(char *string, int x, int y) font->u0 = fontinfo[index].x; font->v0 = fontinfo[index].y - 46; - font->w = chr; + font->w = fontinfo[index].width; font->h = fontinfo[index].height; font->clut = fontclutid; @@ -278,7 +282,7 @@ int PrintString(char *string, int x, int y) } font++; - width += chr; + width += fontinfo[index].width; } else { @@ -291,8 +295,6 @@ int PrintString(char *string, int x, int y) if (showMap != 0) font = (SPRT *)SetFontTPage(font); } - - chr = *string++; } if (showMap == 0) @@ -315,11 +317,9 @@ short PrintDigit(int x, int y, char *string) char vOff, h; width = x; - chr = *string++; - font = (SPRT *)current->primptr; - while (chr != 0) + while ((chr = *string++) != 0) { if (chr == 58) index = 11; @@ -347,9 +347,7 @@ short PrintDigit(int x, int y, char *string) } setSprt(font); -#ifdef PSX setSemiTrans(font, 1); -#endif font->r0 = gFontColour.r; font->g0 = gFontColour.g; @@ -371,17 +369,13 @@ short PrintDigit(int x, int y, char *string) width += fixedWidth; font++; - - chr = *string++; } current->primptr = (char*)font; POLY_FT3* null = (POLY_FT3*)current->primptr; setPolyFT3(null); -#ifdef PSX setSemiTrans(null, 1); -#endif null->x0 = -1; null->y0 = -1; @@ -440,29 +434,28 @@ void PrintStringBoxed(char *string, int ix, int iy) if (c == ' ') { x += 4; + continue; } - else + + index = AsciiTable[c]; + + if (index != -1) { - index = AsciiTable[c]; + OUT_FONTINFO *pFontInfo = &fontinfo[index]; - if (index != -1) - { - OUT_FONTINFO *pFontInfo = &fontinfo[index]; + setSprt(font); - setSprt(font); - - setRGB0(font, gFontColour.r, gFontColour.g, gFontColour.b); - setXY0(font, x, y + pFontInfo->offy); - setUV0(font, pFontInfo->x, pFontInfo->y - 46); - setWH(font, pFontInfo->width, pFontInfo->height); + setRGB0(font, gFontColour.r, gFontColour.g, gFontColour.b); + setXY0(font, x, y + pFontInfo->offy); + setUV0(font, pFontInfo->x, pFontInfo->y - 46); + setWH(font, pFontInfo->width, pFontInfo->height); - font->clut = fontclutid; + font->clut = fontclutid; - addPrim(current->ot, font); - font++; + addPrim(current->ot, font); + font++; - x += pFontInfo->width; - } + x += pFontInfo->width; } } @@ -472,9 +465,7 @@ void PrintStringBoxed(char *string, int ix, int iy) POLY_FT3* null = (POLY_FT3*)font; setPolyFT3(null); -#ifdef PSX setSemiTrans(null, 1); -#endif null->x0 = -1; null->y0 = -1; @@ -494,11 +485,10 @@ void PrintStringBoxed(char *string, int ix, int iy) void InitButtonTextures(void) { int i; - i = 0; - while (i < 11) + + for (i = 0; i < 11; i++) { GetTextureDetails(button_names[i], &button_textures[i]); - i++; } } @@ -558,7 +548,6 @@ int PrintScaledString(int y, char *string, int scale) x1 = x + width; setPolyFT4(font); - setRGB0(font, gFontColour.r, gFontColour.g, gFontColour.b); font->x0 = x; // [A] no suitable macro in libgpu @@ -664,9 +653,7 @@ void* SetFontTPage(void *prim) POLY_FT3* null = (POLY_FT3*)prim; setPolyFT3(null); -#ifdef PSX setSemiTrans(null, 1); -#endif null->x0 = -1; null->y0 = -1; diff --git a/src_rebuild/Game/C/pres.h b/src_rebuild/Game/C/pres.h index 13277dac..821814c0 100644 --- a/src_rebuild/Game/C/pres.h +++ b/src_rebuild/Game/C/pres.h @@ -1,6 +1,17 @@ #ifndef PRES_H #define PRES_H +struct OUT_FONTINFO +{ + u_char x; + u_char y; + char offx; + char offy; + u_char width; + u_char height; + u_short pad; +}; + extern short fonttpage; extern void InitButtonTextures(); // 0x00074E54 diff --git a/src_rebuild/Game/C/replays.c b/src_rebuild/Game/C/replays.c index cacf7a37..94588282 100644 --- a/src_rebuild/Game/C/replays.c +++ b/src_rebuild/Game/C/replays.c @@ -21,7 +21,7 @@ int gOutOfTape = 0; REPLAY_PARAMETER_BLOCK *ReplayParameterPtr = NULL; -REPLAY_STREAM ReplayStreams[8]; +REPLAY_STREAM ReplayStreams[MAX_REPLAY_STREAMS]; int NumReplayStreams = 1; char *ReplayStart; diff --git a/src_rebuild/Game/C/replays.h b/src_rebuild/Game/C/replays.h index 9223bda4..15b91bcc 100644 --- a/src_rebuild/Game/C/replays.h +++ b/src_rebuild/Game/C/replays.h @@ -4,7 +4,7 @@ extern int gOutOfTape; extern REPLAY_PARAMETER_BLOCK *ReplayParameterPtr; -extern REPLAY_STREAM ReplayStreams[8]; +extern REPLAY_STREAM ReplayStreams[MAX_REPLAY_STREAMS]; extern int NumReplayStreams; extern char *ReplayStart; diff --git a/src_rebuild/Game/C/scores.c b/src_rebuild/Game/C/scores.c index 40733b27..f8e3490c 100644 --- a/src_rebuild/Game/C/scores.c +++ b/src_rebuild/Game/C/scores.c @@ -2,6 +2,7 @@ #include "scores.h" #include "glaunch.h" #include "mission.h" +#include "loadsave.h" SCORE_TABLES ScoreTables; PLAYER_SCORE gPlayerScore; @@ -55,6 +56,10 @@ void AddScoreToTable(SCORE_ENTRY *table, int entry) table->items = gPlayerScore.items; strcpy(table->name, gPlayerScore.name); + +#ifndef PSX + SaveCurrentProfile(1); +#endif } // [D] [T] diff --git a/src_rebuild/Game/C/shadow.c b/src_rebuild/Game/C/shadow.c index 67ffd1a8..6d3aee03 100644 --- a/src_rebuild/Game/C/shadow.c +++ b/src_rebuild/Game/C/shadow.c @@ -14,32 +14,41 @@ #include "mission.h" #include "tile.h" +struct TYRE_TRACK +{ + u_char type; + u_char shade; + u_char shade_type; + u_char surface; + SVECTOR_NOPAD p1; + SVECTOR_NOPAD p2; + SVECTOR_NOPAD p3; + SVECTOR_NOPAD p4; +}; + int gShadowTexturePage; int gShadowTextureNum; UV shadowuv; POLYFT4 shadowpoly; -VECTOR tyre_new_positions[4]; -VECTOR tyre_save_positions[4]; +VECTOR tyre_new_positions[MAX_TYRE_PLAYERS][MAX_TYRE_TRACK_WHEELS]; +VECTOR tyre_save_positions[MAX_TYRE_PLAYERS][MAX_TYRE_TRACK_WHEELS]; +int smoke_count[MAX_TYRE_PLAYERS][MAX_TYRE_TRACK_WHEELS]; -int tyre_track_offset[4]; -int num_tyre_tracks[4]; +int tyre_track_offset[MAX_TYRE_TRACK_PLAYERS][MAX_TYRE_TRACK_WHEELS]; +int num_tyre_tracks[MAX_TYRE_TRACK_PLAYERS][MAX_TYRE_TRACK_WHEELS]; -TYRE_TRACK track_buffer[4][64]; -int smoke_count[4]; +TYRE_TRACK track_buffer[MAX_TYRE_TRACK_PLAYERS][MAX_TYRE_TRACK_WHEELS][64]; // [D] [T] void InitTyreTracks(void) { int i; - - i = 0; - while (i < 4) + for (i = 0; i < MAX_TYRE_TRACK_PLAYERS; i++) { - num_tyre_tracks[i] = 0; - tyre_track_offset[i] = 0; - i++; + ClearMem((char*)num_tyre_tracks[i], sizeof(num_tyre_tracks[0])); + ClearMem((char*)tyre_track_offset[i], sizeof(tyre_track_offset[0])); } } @@ -47,7 +56,7 @@ void InitTyreTracks(void) void ResetTyreTracks(CAR_DATA* cp, int player_id) { // [A] reset tyre tracks - if (player_id >= 0 && player_id < 2 && cp->controlType != CONTROL_TYPE_NONE) + if (player_id >= 0 && player_id < MAX_TYRE_TRACK_PLAYERS && cp->controlType != CONTROL_TYPE_NONE) { GetTyreTrackPositions(cp, player_id); SetTyreTrackOldPositions(player_id); @@ -57,8 +66,7 @@ void ResetTyreTracks(CAR_DATA* cp, int player_id) // [D] [T] void GetTyreTrackPositions(CAR_DATA *cp, int player_id) { - int track; - u_int loop; + int loop, track, steps; CAR_COSMETICS *car_cos; VECTOR WheelPos; VECTOR CarPos; @@ -68,18 +76,20 @@ void GetTyreTrackPositions(CAR_DATA *cp, int player_id) CarPos.vz = cp->hd.where.t[2]; car_cos = cp->ap.carCos; - SetRotMatrix(&cp->hd.drawCarMat); + SetRotMatrix(&cp->hd.where); - loop = 0; + steps = 4 / MAX_TYRE_TRACK_WHEELS; - do { + for (loop = 0; loop < 4; loop += steps) + { + WheelPos.vx = car_cos->wheelDisp[loop].vx; if (loop & 2) - WheelPos.vx = car_cos->wheelDisp[loop].vx + 17; + WheelPos.vx += 17; else - WheelPos.vx = car_cos->wheelDisp[loop].vx - 17; + WheelPos.vx -= 17; WheelPos.vy = 0; - WheelPos.vz = -car_cos->wheelDisp[loop + 1 & 3].vz; + WheelPos.vz = car_cos->wheelDisp[loop + 1 & 3].vz; _MatrixRotate(&WheelPos); @@ -87,52 +97,39 @@ void GetTyreTrackPositions(CAR_DATA *cp, int player_id) WheelPos.vy = CarPos.vy; WheelPos.vz += CarPos.vz; - track = player_id * 2 + (loop / 2); + track = loop / steps; - tyre_new_positions[track].vx = WheelPos.vx; - tyre_new_positions[track].vz = WheelPos.vz; - tyre_new_positions[track].vy = MapHeight(&WheelPos); - - loop += 2; - } while (loop < 4); + tyre_new_positions[player_id][track].vx = WheelPos.vx; + tyre_new_positions[player_id][track].vz = WheelPos.vz; + tyre_new_positions[player_id][track].vy = MapHeight(&WheelPos); + } } // [D] [T] void SetTyreTrackOldPositions(int player_id) { - int idx = player_id * 2; - - tyre_save_positions[idx].vx = tyre_new_positions[idx].vx; - tyre_save_positions[idx].vy = tyre_new_positions[idx].vy; - tyre_save_positions[idx].vz = tyre_new_positions[idx].vz; - - tyre_save_positions[idx + 1].vx = tyre_new_positions[idx + 1].vx; - tyre_save_positions[idx + 1].vy = tyre_new_positions[idx + 1].vy; - tyre_save_positions[idx + 1].vz = tyre_new_positions[idx + 1].vz; + tyre_save_positions[player_id][0] = tyre_new_positions[player_id][0]; + tyre_save_positions[player_id][1] = tyre_new_positions[player_id][1]; + tyre_save_positions[player_id][2] = tyre_new_positions[player_id][2]; + tyre_save_positions[player_id][3] = tyre_new_positions[player_id][3]; } // [D] [T] -void AddTyreTrack(int wheel, int tracksAndSmoke, int padid) +void AddTyreTrack(int wheel, int tracksAndSmoke, int player_id, int continuous_track) { static int Cont[4] = { 0, 0, 0, 0 }; - short x; - short z; + short x, z; sdPlane *SurfaceDataPtr; char trackSurface; TYRE_TRACK *tt_p; VECTOR *newtp; VECTOR *oldtp; - VECTOR New1; - VECTOR New2; - VECTOR New3; - VECTOR New4; - VECTOR SmokeDrift; - VECTOR SmokePosition; - VECTOR grass_vector; + VECTOR New1, New2, New3, New4; + VECTOR SmokeDrift, SmokePosition, grass_vector; - newtp = &tyre_new_positions[wheel]; + newtp = &tyre_new_positions[player_id][wheel]; // [A] disabled due to MP and SP bugs /* @@ -142,35 +139,24 @@ void AddTyreTrack(int wheel, int tracksAndSmoke, int padid) if (newtp->vz - camera_position.vz + 20480 > 40960) return;*/ - if (tracksAndSmoke == 0) + if (tracksAndSmoke != 0) { - SurfaceDataPtr = sdGetCell(newtp); - trackSurface = 1; + oldtp = &tyre_save_positions[player_id][wheel]; - if (SurfaceDataPtr->surface == 6) - return; - - if (SurfaceDataPtr->surface == 4) - trackSurface = 2; - } - else - { - oldtp = &tyre_save_positions[wheel]; - - tt_p = track_buffer[wheel] + (tyre_track_offset[wheel] + num_tyre_tracks[wheel] & 0x3f); + tt_p = track_buffer[player_id][wheel] + (tyre_track_offset[player_id][wheel] + num_tyre_tracks[player_id][wheel] & 0x3f); SurfaceDataPtr = sdGetCell(newtp); // check surface type if (SurfaceDataPtr != NULL) { - if (SurfaceDataPtr->surface == 6) + if (SurfaceDataPtr->surface == SURF_WATER) return; - if (SurfaceDataPtr->surface == 4) + if (SurfaceDataPtr->surface == SURF_GRASS) { tt_p->surface = 2; - player[padid].onGrass = 1; + player[player_id].onGrass = 1; } else { @@ -184,13 +170,24 @@ void AddTyreTrack(int wheel, int tracksAndSmoke, int padid) trackSurface = tt_p->surface; } + else + { + SurfaceDataPtr = sdGetCell(newtp); + trackSurface = 1; + + if (SurfaceDataPtr->surface == SURF_WATER) + return; + + if (SurfaceDataPtr->surface == SURF_GRASS) + trackSurface = 2; + } SmokePosition.vx = newtp->vx; SmokePosition.vz = newtp->vz; SmokePosition.vy = -50 - newtp->vy; // make smoke - if ((smoke_count[wheel]++ & 3) == 1) + if ((smoke_count[player_id][wheel]++ & 3) == 1) { GetSmokeDrift(&SmokeDrift); @@ -234,14 +231,14 @@ void AddTyreTrack(int wheel, int tracksAndSmoke, int padid) New4.vx = New4.vx - x; New4.vz = New4.vz - z; - if (num_tyre_tracks[wheel] == 64) + if (num_tyre_tracks[player_id][wheel] == 64) { - tyre_track_offset[wheel]++; - tyre_track_offset[wheel] &= 63; + tyre_track_offset[player_id][wheel]++; + tyre_track_offset[player_id][wheel] &= 63; } else { - num_tyre_tracks[wheel]++; + num_tyre_tracks[player_id][wheel]++; } if (Cont[wheel] == 1 && continuous_track == 1) @@ -275,9 +272,8 @@ void DrawTyreTracks(void) char last_duff; POLY_FT4 *poly; TYRE_TRACK *tt_p; - int index; - int loop; - int wheel_loop; + int index, loop; + int player_id, wheel_loop; POLY_FT4 *lasttyre; SVECTOR ps[4]; int z; @@ -285,124 +281,123 @@ void DrawTyreTracks(void) gte_SetRotMatrix(&inv_camera_matrix); gte_SetTransVector(&dummy); - wheel_loop = 0; - - do { - lasttyre = NULL; - last_duff = 1; - index = tyre_track_offset[wheel_loop]; - - for (loop = 0; loop < num_tyre_tracks[wheel_loop]; loop++) + for (player_id = 0; player_id < MAX_TYRE_TRACK_PLAYERS; player_id++) + { + for (wheel_loop = 0; wheel_loop < MAX_TYRE_TRACK_WHEELS; wheel_loop++) { - tt_p = track_buffer[wheel_loop] + index; + lasttyre = NULL; + last_duff = 1; + index = tyre_track_offset[player_id][wheel_loop]; - index++; - - if (index == 64) - index = 0; - - if (tt_p->type == 2) - continue; - - ps[0].vx = tt_p->p1.vx - camera_position.vx; - ps[0].vy = -camera_position.vy - tt_p->p1.vy; - ps[0].vz = tt_p->p1.vz - camera_position.vz; - - ps[1].vx = tt_p->p2.vx - camera_position.vx; - ps[1].vy = -camera_position.vy - tt_p->p2.vy; - ps[1].vz = tt_p->p2.vz - camera_position.vz; - - ps[2].vx = tt_p->p3.vx - camera_position.vx; - ps[2].vy = -camera_position.vy - tt_p->p3.vy; - ps[2].vz = tt_p->p3.vz - camera_position.vz; - - ps[3].vx = tt_p->p4.vx - camera_position.vx; - ps[3].vy = -camera_position.vy - tt_p->p4.vy; - ps[3].vz = tt_p->p4.vz - camera_position.vz; - - poly = (POLY_FT4 *)current->primptr; - - z = 0; - - if (lasttyre != NULL && tt_p->type != 0 && !last_duff) + for (loop = 0; loop < num_tyre_tracks[player_id][wheel_loop]; loop++) { - last_duff = 1; + tt_p = track_buffer[player_id][wheel_loop] + index; - if (ps[2].vx + 9000 <= 18000 && ps[2].vz + 9000 <= 18000) + index++; + index &= 63; + + if (tt_p->type == 2) + continue; + + ps[0].vx = tt_p->p1.vx - camera_position.vx; + ps[0].vy = -camera_position.vy - tt_p->p1.vy; + ps[0].vz = tt_p->p1.vz - camera_position.vz; + + ps[1].vx = tt_p->p2.vx - camera_position.vx; + ps[1].vy = -camera_position.vy - tt_p->p2.vy; + ps[1].vz = tt_p->p2.vz - camera_position.vz; + + ps[2].vx = tt_p->p3.vx - camera_position.vx; + ps[2].vy = -camera_position.vy - tt_p->p3.vy; + ps[2].vz = tt_p->p3.vz - camera_position.vz; + + ps[3].vx = tt_p->p4.vx - camera_position.vx; + ps[3].vy = -camera_position.vy - tt_p->p4.vy; + ps[3].vz = tt_p->p4.vz - camera_position.vz; + + poly = (POLY_FT4*)current->primptr; + + z = 0; + + if (lasttyre != NULL && tt_p->type != 0 && !last_duff) { - gte_ldv0(&ps[2]); - gte_rtps(); + last_duff = 1; - gte_stsxy(&poly->x2); + if (ps[2].vx + 9000 <= 18000 && ps[2].vz + 9000 <= 18000) + { + gte_ldv0(&ps[2]); + gte_rtps(); - gte_stsz(&z); + gte_stsxy(&poly->x2); - gte_ldv0(&ps[3]); - gte_rtps(); + gte_stsz(&z); - *(u_int *)&poly->x0 = *(u_int *)&lasttyre->x2; - *(u_int *)&poly->x1 = *(u_int *)&lasttyre->x3; + gte_ldv0(&ps[3]); + gte_rtps(); - gte_stsxy(&poly->x3); - } - } - else - { - last_duff = 1; + *(u_int*)&poly->x0 = *(u_int*)&lasttyre->x2; + *(u_int*)&poly->x1 = *(u_int*)&lasttyre->x3; - if (ps[0].vx + 0x5000 <= 0xa000 && ps[0].vz + 0x5000 <= 0xa000) - { - gte_ldv3(&ps[0], &ps[1], &ps[2]); - gte_rtpt(); - - gte_stsxy3(&poly->x0, &poly->x1, &poly->x2); - - gte_stsz(&z); - - gte_ldv0(&ps[3]); - gte_rtps(); - - gte_stsxy(&poly->x3); + gte_stsxy(&poly->x3); + } } else { - tt_p->type = 2; + last_duff = 1; + + if (ps[0].vx + 0x5000 <= 0xa000 && ps[0].vz + 0x5000 <= 0xa000) + { + gte_ldv3(&ps[0], &ps[1], &ps[2]); + gte_rtpt(); + + gte_stsxy3(&poly->x0, &poly->x1, &poly->x2); + + gte_stsz(&z); + + gte_ldv0(&ps[3]); + gte_rtps(); + + gte_stsxy(&poly->x3); + } + else + { + tt_p->type = 2; + } } - } - if (z > 50) - { - setPolyFT4(poly); - setSemiTrans(poly, 1); - - if (tt_p->surface == 1) + if (z > 50) { - poly->r0 = poly->g0 = poly->b0 = 26; + setPolyFT4(poly); + setSemiTrans(poly, 1); + + if (tt_p->surface == 1) + { + poly->r0 = poly->g0 = poly->b0 = 26; + } + else + { + poly->r0 = 17; + poly->g0 = poly->b0 = 35; + } + + *(ushort*)&poly->u0 = *(ushort*)&gTyreTexture.coords.u0; + *(ushort*)&poly->u1 = *(ushort*)&gTyreTexture.coords.u1; + *(ushort*)&poly->u2 = *(ushort*)&gTyreTexture.coords.u2; + *(ushort*)&poly->u3 = *(ushort*)&gTyreTexture.coords.u3; + + poly->tpage = gTyreTexture.tpageid | 0x40; + poly->clut = gTyreTexture.clutid; + + addPrim(current->ot + (z >> 3), poly); + current->primptr += sizeof(POLY_FT4); + + lasttyre = poly; + last_duff = 0; } - else - { - poly->r0 = 17; - poly->g0 = poly->b0 = 35; - } - - *(ushort *)&poly->u0 = *(ushort *)&gTyreTexture.coords.u0; - *(ushort *)&poly->u1 = *(ushort *)&gTyreTexture.coords.u1; - *(ushort *)&poly->u2 = *(ushort *)&gTyreTexture.coords.u2; - *(ushort *)&poly->u3 = *(ushort *)&gTyreTexture.coords.u3; - - poly->tpage = gTyreTexture.tpageid | 0x40; - poly->clut = gTyreTexture.clutid; - - addPrim(current->ot + (z >> 3), poly); - current->primptr += sizeof(POLY_FT4); - - lasttyre = poly; - last_duff = 0; } } + } - wheel_loop++; - } while (wheel_loop < 4); } // [D] [T] [A] now better shadow code diff --git a/src_rebuild/Game/C/shadow.h b/src_rebuild/Game/C/shadow.h index 709bcf32..629a6338 100644 --- a/src_rebuild/Game/C/shadow.h +++ b/src_rebuild/Game/C/shadow.h @@ -12,7 +12,7 @@ extern void ResetTyreTracks(CAR_DATA* cp, int player_id); extern void GetTyreTrackPositions(CAR_DATA *cp, int player_id); // 0x00075408 extern void SetTyreTrackOldPositions(int player_id); // 0x00077558 -extern void AddTyreTrack(int wheel, int tracksAndSmoke, int padid); // 0x00075540 +extern void AddTyreTrack(int wheel, int tracksAndSmoke, int player_id, int continuous_track); // 0x00075540 extern void DrawTyreTracks(); // 0x000759E0 diff --git a/src_rebuild/Game/C/sky.c b/src_rebuild/Game/C/sky.c index 0031ae42..90bfd64d 100644 --- a/src_rebuild/Game/C/sky.c +++ b/src_rebuild/Game/C/sky.c @@ -24,7 +24,7 @@ struct FLAREREC short gapmod; }; -int sky_y_offset[4] = { 17, 17, 17, 17 }; +int sky_y_offset[4] = { -17, -17, -17, -17 }; unsigned char HorizonLookup[4][4] = { {0, 0, 20, 20}, @@ -824,10 +824,8 @@ DVECTORF scratchPad_skyVertices[35]; // 1f800044 #define scratchPad_skyVertices ((DVECTOR*)getScratchAddr(0x11)) // 1f800044 #endif -short scratchPad_zbuff[256]; - // [D] [T] -void PlotSkyPoly(POLYFT4* polys, int skytexnum, unsigned char r, unsigned char g, unsigned char b, int offset) +void PlotSkyPoly(POLYFT4* polys, int skytexnum, unsigned char r, unsigned char g, unsigned char b) { POLYFT4* src; POLY_FT4* poly; @@ -866,7 +864,7 @@ void PlotSkyPoly(POLYFT4* polys, int skytexnum, unsigned char r, unsigned char g poly->clut = skyclut[skytexnum]; poly->tpage = skytpage[skytexnum]; - addPrim(current->ot + 0x107f, poly); + addPrim(current->ot + OTSIZE - 1, poly); #if defined(USE_PGXP) && defined(USE_EXTENDED_PRIM_POINTERS) poly->pgxp_index = outpoints[src->v0].pgxp_index; @@ -882,57 +880,30 @@ void PlotHorizonMDL(MODEL* model, int horizontaboffset) SVECTOR* verts; #ifdef USE_PGXP - DVECTORF* dv0; - DVECTORF* dv1; - DVECTORF* dv2; + DVECTORF* dv; #else - DVECTOR* dv0; - DVECTOR* dv1; - DVECTOR* dv2; + DVECTOR* dv; #endif - SVECTOR* v0; - SVECTOR* v1; - SVECTOR* v2; - int count; - unsigned char* polys; - - int green; - int red; - int blue; - + int red, green, blue; int z; + z = -1; verts = (SVECTOR*)model->vertices; - count = 0; - - dv0 = scratchPad_skyVertices; - dv1 = scratchPad_skyVertices + 1; - dv2 = scratchPad_skyVertices + 2; - - v0 = verts; - v1 = verts + 1; - v2 = verts + 2; + dv = scratchPad_skyVertices; + count = model->num_vertices; #ifdef USE_PGXP PGXP_SetZOffsetScale(0.0f, 256.0f); #endif - while (count < model->num_vertices) + do { - SVECTOR sv0 = *v0; - SVECTOR sv1 = *v1; - SVECTOR sv2 = *v2; - - sv0.vy -= sky_y_offset[GameLevel]; - sv1.vy -= sky_y_offset[GameLevel]; - sv2.vy -= sky_y_offset[GameLevel]; - - gte_ldv3(&sv0, &sv1, &sv2); + gte_ldv3(verts, verts+1, verts+2); gte_rtpt(); - gte_stsxy3(dv0, dv1, dv2); + gte_stsxy3(dv, dv+1, dv+2); if(count == 15) gte_stszotz(&z); @@ -940,19 +911,12 @@ void PlotHorizonMDL(MODEL* model, int horizontaboffset) #ifdef USE_PGXP // store PGXP index // HACK: -1 is needed here for some reason - dv0->pgxp_index = dv1->pgxp_index = dv2->pgxp_index = PGXP_GetIndex() - 1; + dv[0].pgxp_index = dv[1].pgxp_index = dv[2].pgxp_index = PGXP_GetIndex() - 1; #endif - - dv2 += 3; - dv1 += 3; - dv0 += 3; - - v2 += 3; - v1 += 3; - v0 += 3; - - count += 3; - } + dv += 3; + verts += 3; + count -= 3; + } while (count); #ifdef USE_PGXP PGXP_SetZOffsetScale(0.0f, 1.0f); @@ -960,51 +924,59 @@ void PlotHorizonMDL(MODEL* model, int horizontaboffset) if (z > 0) { + int polySize; + u_char* horizonTex = &HorizonTextures[horizontaboffset]; polys = (unsigned char*)model->poly_block; + polySize = PolySizes[*polys]; red = skycolor.r; green = skycolor.g; blue = skycolor.b; - count = 0; - - while (count < model->num_polys) + // draw sky + count = model->num_polys; + do { - if (count == 12) - { - red /= 2; - green /= 2; - blue /= 2; - } + PlotSkyPoly((POLYFT4*)polys, *horizonTex++, red, green, blue); + polys += polySize; + } while (--count > 8); - PlotSkyPoly((POLYFT4*)polys, HorizonTextures[horizontaboffset + count], red, green, blue, 0); + red /= 2; + green /= 2; + blue /= 2; - polys += PolySizes[*polys]; - count++; - } + // draw it's reflection + do + { + PlotSkyPoly((POLYFT4*)polys, *horizonTex++, red, green, blue); + polys += polySize; + } while (--count); } } // [D] [T] void DrawSkyDome(void) { + VECTOR skyOfs = dummy; + skyOfs.vy = sky_y_offset[GameLevel]; + gte_SetRotMatrix(&inv_camera_matrix); - gte_SetTransVector(&dummy); + gte_SetTransVector(&skyOfs); calc_sky_brightness(); #ifdef PSX // FIXME: use frustrum angle instead? - if (((camera_angle.vy - 1450U) & 0xFFF) > 2250) + if (((camera_angle.vy - 1450U) & 4095) > 2250) PlotHorizonMDL(modelpointers[0], HorizonLookup[GameLevel][0]); - if (((camera_angle.vy - 651U) & 0xFFF) < 1799) + if (((camera_angle.vy - 651U) & 4095) < 1799) PlotHorizonMDL(modelpointers[2], HorizonLookup[GameLevel][1]); - if (((camera_angle.vy - 1701U) & 0xFFF) < 1749) + if (((camera_angle.vy - 1701U) & 4095) < 1749) PlotHorizonMDL(modelpointers[3], HorizonLookup[GameLevel][2]); - if (((camera_angle.vy - 400U) & 0xFFF) > 2300) + if (((camera_angle.vy - 400U) & 4095) > 2300) PlotHorizonMDL(modelpointers[1], HorizonLookup[GameLevel][3]); #else // draw full sky - no need in frustrum culling diff --git a/src_rebuild/Game/C/spool.c b/src_rebuild/Game/C/spool.c index 944fcdf8..6eec9cdd 100644 --- a/src_rebuild/Game/C/spool.c +++ b/src_rebuild/Game/C/spool.c @@ -24,6 +24,45 @@ #include "camera.h" #include "dr2roads.h" +struct SPOOLQ +{ + u_char type; + u_char data; + u_short nsectors; + u_int sector; + char* addr; + void (*func)(); +#ifdef _DEBUG + const char* requestby; + int requestbyline; +#endif +}; + +struct SPL_REGIONINFO +{ + u_short region_to_unpack; + u_short target_barrel_region; + int nsectors; + char* cell_addr; + char* roadm_addr; +}; + +struct AreaDataStr +{ + u_short gfx_offset; + u_short model_offset; + u_short music_offset; + u_short ambient_offset; + u_char model_size; + u_char pad; + u_char num_tpages; + u_char ambient_size; + u_char music_size; + u_char music_samples_size; + u_char music_id; + u_char ambient_id; +}; + int date_date = 0xA11; int date_time = 0x27220B; @@ -118,10 +157,7 @@ SPOOLQ spooldata[48]; #if USE_PC_FILESYSTEM #define SIMPLE_SPOOL - extern int gContentOverride; -extern char g_CurrentLevelFileName[64]; - #endif #if defined(_DEBUG) || defined(PSX) @@ -357,7 +393,7 @@ void RequestSpool(int type, int data, int offset, int loadsize, char *address, s next->type = type; next->data = data; - next->sector = (SpoolLumpOffset / 2048) + offset; + next->sector = (SpoolLumpOffset / CDSECTOR_SIZE) + offset; next->nsectors = loadsize; next->addr = address; next->func = func; @@ -744,7 +780,6 @@ void CheckLoadAreaData(int cellx, int cellz) else if (/*spoolptr->super_region == 0xFF ||*/ nAreas == 0) return; - // [A] Rev 1.1 patch #define BOUNDARY_MIN 15 #define BOUNDARY_MAX 17 @@ -806,14 +841,14 @@ void ClearRegion(int target_region) ushort *cell_ptrs_s; int loop; - loop = 1024; cell_ptrs_s = cell_ptrs + target_region * 1024; pvsptr = (int *)PVS_Buffers[target_region]; - do { + for (loop = 0; loop < 1024; loop++) + { *cell_ptrs_s++ = 0xffff; *pvsptr++ = 0; - } while (--loop != 0); + } ClearMem(PVS_Buffers[target_region]-4, pvsSize[target_region]); @@ -1016,7 +1051,7 @@ void ready_cb_textures(unsigned char intr, unsigned char *result) { CdGetSector(target_address, SECTOR_SIZE); - target_address += 2048; + target_address += CDSECTOR_SIZE; sectors_this_chunk--; current_sector++; sectors_to_read--; @@ -1067,7 +1102,7 @@ void ready_cb_regions(unsigned char intr, unsigned char *result) { CdGetSector(target_address, SECTOR_SIZE); - target_address += 2048; + target_address += CDSECTOR_SIZE; sectors_this_chunk--; current_sector++; sectors_to_read--; @@ -1182,7 +1217,7 @@ void ready_cb_misc(unsigned char intr, unsigned char *result) { CdGetSector(target_address, SECTOR_SIZE); - target_address += 2048; + target_address += CDSECTOR_SIZE; sectors_to_read--; current_sector++; @@ -1403,149 +1438,159 @@ void GotRegion(void) } } -// [D] [T] -void UpdateSpool(void) -{ -#if USE_PC_FILESYSTEM && defined(SIMPLE_SPOOL) - if(strlen(g_CurrentLevelFileName) > 0) - { - FILE* fp = fopen(g_CurrentLevelFileName, "rb"); +#if defined(SIMPLE_SPOOL) +extern char g_CurrentLevelFileName[64]; +extern char* g_CurrentLevelSpoolData; - if (!fp) - { -#if !defined(__EMSCRIPTEN__) - char errPrint[1024]; - sprintf(errPrint, "Cannot open '%s'\n", g_CurrentLevelFileName); - SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "ERROR", errPrint, NULL); -#endif - return; +int UpdateSpoolPC(void) +{ + if (g_CurrentLevelFileName[0] == 0) + return 0; + + // read entire spool data + if (g_CurrentLevelSpoolData == NULL) + { + int SpoolLumpSize; + SpoolLumpSize = 16 * 1024 * 1024; // allocate 16 MB of RAM for spoolable data + g_CurrentLevelSpoolData = (char*)malloc(16 * 1024 * 1024); + + loadsectors(g_CurrentLevelSpoolData, SpoolLumpOffset / CDSECTOR_SIZE, SpoolLumpSize); + } + + for (; spoolpos_reading < spoolcounter; spoolpos_reading++) + { + char* spoolDataPtr; + SPOOLQ* current; + current = &spooldata[spoolpos_reading]; + +#define SPL_READ(dest, nsectors) \ + { \ + int readSize = (nsectors)*CDSECTOR_SIZE; \ + memcpy(dest, spoolDataPtr, readSize); \ + spoolDataPtr += readSize; \ } - for (; spoolpos_reading < spoolcounter; spoolpos_reading++) - { - SPOOLQ* current = &spooldata[spoolpos_reading]; - #ifdef _DEBUG - char* nameType; - switch (current->type) - { - case 0: // regions - nameType = "REGION"; - break; - case 1: // textures - nameType = "TPAGE"; - break; - case 2: // sbk - nameType = "SBK"; - break; - case 3: // misc - nameType = "MISC"; - break; - } + char* nameType; + switch (current->type) + { + case 0: // regions + nameType = "REGION"; + break; + case 1: // textures + nameType = "TPAGE"; + break; + case 2: // sbk + nameType = "SBK"; + break; + case 3: // misc + nameType = "MISC"; + break; + } - SPOOL_WARNING("spool type=%s cb=%d sec=%d cnt=%d id=%d\n", nameType, current->func ? 1 : 0, current->sector, current->nsectors, spoolpos_reading); + SPOOL_WARNING("spool type=%s cb=%d sec=%d cnt=%d id=%d\n", nameType, current->func ? 1 : 0, current->sector, current->nsectors, spoolpos_reading); #endif // _DEBUG - // seek to required sector - fseek(fp, current->sector * 2048, SEEK_SET); + // seek to required sector + spoolDataPtr = g_CurrentLevelSpoolData - SpoolLumpOffset + current->sector * CDSECTOR_SIZE; - switch (current->type) + switch (current->type) + { + case 0: // regions + case 3: // misc + SPL_READ(current->addr, current->nsectors); + + if (current->func) + current->func(); + + break; + case 1: // textures + + // read cluts + nTPchunks = 0; + SPL_READ(current->addr + CDSECTOR_SIZE * 2 * 4, 1); + SendTPage(); + + nTPchunks++; + + // read tpage (4 sectors 4 times = 16) + for (int i = 0; i < 4; i++) { - case 0: // regions - fread(current->addr, 2048, current->nsectors, fp); - - if (current->func) - current->func(); - - break; - case 1: // textures - - // read cluts - nTPchunks = 0; - fread(current->addr + 0x4000, 2048, 1, fp); + SPL_READ(current->addr + (loadbank_write & 1U) * 256 * 32, 4); SendTPage(); nTPchunks++; - - // read tpage (4 sectors 4 times = 16) - for (int i = 0; i < 4; i++) - { - fread(current->addr + (loadbank_write & 1U) * 256 * 32, 2048, 4, fp); - SendTPage(); - - nTPchunks++; - } - - break; - case 2: // sbk - // nothing to do with this - break; - case 3: // misc - fread(current->addr, 2048, current->nsectors, fp); - - if (current->func) - current->func(); - - break; } + + break; + default: + break; } - spoolcounter = 0; - spoolpos_reading = 0; - spoolactive = 0; - - fclose(fp); - return; +#undef SPL_READ } + + spoolcounter = 0; + spoolpos_reading = 0; + spoolactive = 0; + + return 1; +} #endif +// [D] [T] +void UpdateSpool(void) +{ CdlLOC pos; + SPOOLQ* current; - SPOOLQ *current = &spooldata[spoolpos_reading]; +#if defined(SIMPLE_SPOOL) + if (UpdateSpoolPC()) + return; +#endif - if (!XAPrepared()) + if (XAPrepared()) + return; + + current = &spooldata[spoolpos_reading]; + target_address = current->addr; + + if (current->type == 0) // SPOOLTYPE_REGIONS { - target_address = current->addr; + sectors_this_chunk = current->nsectors; + sectors_to_read = spool_regioninfo[spool_regionpos].nsectors; - if (current->type == 0) // SPOOLTYPE_REGIONS - { - sectors_this_chunk = current->nsectors; - sectors_to_read = spool_regioninfo[spool_regionpos].nsectors; - - CdDataCallback(data_cb_regions); - CdReadyCallback(ready_cb_regions); - } - else if (current->type == 1) // SPOOLTYPE_TEXTURES - { - nTPchunks_reading = 0; - nTPchunks_writing = 0; - sectors_to_read = 17; - ntpages = tsetcounter; - sectors_this_chunk = 1; - - CdDataCallback(data_cb_textures); - CdReadyCallback(ready_cb_textures); - - target_address += 0x4000; - } - else if (current->type == 3) // SPOOLTYPE_MISC - { - sectors_to_read = (current->nsectors); - - CdDataCallback(data_cb_misc); - CdReadyCallback(ready_cb_misc); - } - - current_sector = current->sector; - - endchunk = 0; - - switch_spooltype = 0; - - // run sector reading - CdIntToPos(current_sector, &pos); - CdControlF(CdlReadS, (u_char*)&pos); + CdDataCallback(data_cb_regions); + CdReadyCallback(ready_cb_regions); } + else if (current->type == 1) // SPOOLTYPE_TEXTURES + { + nTPchunks_reading = 0; + nTPchunks_writing = 0; + sectors_to_read = 17; + ntpages = tsetcounter; + sectors_this_chunk = 1; + + CdDataCallback(data_cb_textures); + CdReadyCallback(ready_cb_textures); + + target_address += 0x4000; + } + else if (current->type == 3) // SPOOLTYPE_MISC + { + sectors_to_read = (current->nsectors); + + CdDataCallback(data_cb_misc); + CdReadyCallback(ready_cb_misc); + } + + current_sector = current->sector; + endchunk = 0; + switch_spooltype = 0; + + // run sector reading + CdIntToPos(current_sector, &pos); + CdControlF(CdlReadS, (u_char*)&pos); } // [D] [T] @@ -1616,14 +1661,16 @@ int RoadMapRegions[4]; // [D] [T] void UnpackRegion(int region_to_unpack, int target_barrel_region) { - if (loading_region[target_barrel_region] == -1) + if (loading_region[target_barrel_region] != -1) { - if (LoadRegionData(region_to_unpack, target_barrel_region)) - spool_regioncounter++; - - regions_unpacked[target_barrel_region] = region_to_unpack; - RoadMapRegions[target_barrel_region] = region_to_unpack; + return; } + + if (LoadRegionData(region_to_unpack, target_barrel_region)) + spool_regioncounter++; + + regions_unpacked[target_barrel_region] = region_to_unpack; + RoadMapRegions[target_barrel_region] = region_to_unpack; } @@ -1710,7 +1757,7 @@ void CleanModelSpooled(void) } // memcpy - while (loadaddr < (int*)(specLoadBuffer + 2048)) + while (loadaddr < (int*)(specLoadBuffer + CDSECTOR_SIZE)) *modelMemory++ = *loadaddr++; mem = (int*)((int)gCarCleanModelPtr[4] + gCarCleanModelPtr[4]->poly_block); // [A] pls check, might be invalid @@ -1759,7 +1806,7 @@ void DamagedModelSpooled(void) } // memcpy - while (loadaddr < (int*)(specLoadBuffer + 2048)) + while (loadaddr < (int*)(specLoadBuffer + CDSECTOR_SIZE)) *modelMemory++ = *loadaddr++; mem = (int*)((int)gCarDamModelPtr[4] + gCarDamModelPtr[4]->poly_block); // [A] pls check, might be invalid @@ -1771,7 +1818,7 @@ void DamagedModelSpooled(void) { // [A] vertices LoadCarModelFromFile((char*)gCarDamModelPtr[4], MissionHeader->residentModels[4], CAR_MODEL_DAMAGED); - } + } #endif specBlocksToLoad = 0; @@ -1806,7 +1853,7 @@ void LowModelSpooled(void) } // memcpy - while (loadaddr < (int*)(specLoadBuffer + 2048)) + while (loadaddr < (int*)(specLoadBuffer + CDSECTOR_SIZE)) *modelMemory++ = *loadaddr++; mem = (int*)((int)gCarLowModelPtr[4] + gCarLowModelPtr[4]->poly_block); // [A] pls check, might be invalid @@ -1850,7 +1897,7 @@ void CleanSpooled(void) int size_2 = ((int *)specmallocptr)[1]; int size_3 = ((int *)specmallocptr)[2]; - lastCleanBlock = size_1 + 2048 + 11; + lastCleanBlock = size_1 + CDSECTOR_SIZE + 11; lastCleanBlock >>= 11; firstDamBlock = size_1 + 12; @@ -1859,17 +1906,17 @@ void CleanSpooled(void) firstLowBlock = size_1 + size_2 + 12; firstLowBlock >>= 11; - int lastDamBlock = size_1 + size_2 + 2048 + 11; + int lastDamBlock = size_1 + size_2 + CDSECTOR_SIZE + 11; lastDamBlock >>= 11; lengthDamBlock = lastDamBlock - firstDamBlock; - damOffset = size_1 - (firstDamBlock * 2048 - 12); + damOffset = size_1 - (firstDamBlock * CDSECTOR_SIZE - 12); - int lastLowBlock = size_1 + size_2 + size_3 + 2048 + 11; + int lastLowBlock = size_1 + size_2 + size_3 + CDSECTOR_SIZE + 11; lastLowBlock >>= 11; lengthLowBlock = lastLowBlock - firstLowBlock; - lowOffset = size_1 + size_2 - (firstLowBlock * 2048 - 12); + lowOffset = size_1 + size_2 - (firstLowBlock * CDSECTOR_SIZE - 12); } model = (MODEL *)(specmallocptr + 12); @@ -2030,7 +2077,7 @@ void SpecialStartNextBlock(void) specialState++; } - fileSector = 0x1400 + (citystart[GameLevel] - SpoolLumpOffset / 2048) + (specspooldata[2]-1) * 42; + fileSector = 0x1400 + (citystart[GameLevel] - SpoolLumpOffset / CDSECTOR_SIZE) + (specspooldata[2]-1) * 42; switch (specialState) { @@ -2052,12 +2099,12 @@ void SpecialStartNextBlock(void) case 5: spoolFunc = CleanSpooled; fileSector += (41 - specBlocksToLoad); - loadaddr = specmallocptr + (7 - specBlocksToLoad) * 2048; + loadaddr = specmallocptr + (7 - specBlocksToLoad) * CDSECTOR_SIZE; break; case 6: spoolFunc = LowSpooled; fileSector += ((firstLowBlock + lengthLowBlock) - specBlocksToLoad) + 34; - loadaddr = specmallocptr + (lengthLowBlock - specBlocksToLoad) * 2048; + loadaddr = specmallocptr + (lengthLowBlock - specBlocksToLoad) * CDSECTOR_SIZE; break; case 7: spoolFunc = CleanModelSpooled; diff --git a/src_rebuild/Game/C/spool.h b/src_rebuild/Game/C/spool.h index f05c6cef..98aee7b7 100644 --- a/src_rebuild/Game/C/spool.h +++ b/src_rebuild/Game/C/spool.h @@ -1,6 +1,18 @@ #ifndef SPOOL_H #define SPOOL_H +struct Spool +{ + u_short offset; + u_char connected_areas[2]; + u_char pvs_size; + u_char cell_data_size[3]; + u_char super_region; + u_char num_connected_areas; + u_char roadm_size; + u_char roadh_size; +}; + extern int cell_objects_add[5]; extern int cell_slots_add[5]; diff --git a/src_rebuild/Game/C/system.c b/src_rebuild/Game/C/system.c index f18c91be..ac185f3d 100644 --- a/src_rebuild/Game/C/system.c +++ b/src_rebuild/Game/C/system.c @@ -170,6 +170,7 @@ XYPAIR citylumps[8][4]; #ifndef PSX int gContentOverride = 1; // use unpacked filesystem? char g_CurrentLevelFileName[64]; +char* g_CurrentLevelSpoolData = NULL; #endif // !PSX // TODO: to game vars @@ -373,7 +374,7 @@ int LoadfileSeg(char* name, char* addr, int offset, int loadsize) int remainingOffset; int sector; u_char result[8]; - char sectorbuffer[2048]; + char sectorbuffer[CDSECTOR_SIZE]; CdlLOC pos; sprintf(namebuffer, "\\%s%s;1", gDataFolder, name); @@ -395,7 +396,7 @@ int LoadfileSeg(char* name, char* addr, int offset, int loadsize) remainingBytes = loadsize; // seek to the sector - sector = offset / 2048 + CdPosToInt(¤tfileinfo.pos); + sector = offset / CDSECTOR_SIZE + CdPosToInt(¤tfileinfo.pos); // start reading sectors from CD while(remainingBytes > 0) @@ -405,7 +406,7 @@ int LoadfileSeg(char* name, char* addr, int offset, int loadsize) // if we don't have offset or we have more than 2048 bytes // - we can read into buffer directly (which is faster) - if (remainingBytes >= 2048 && remainingOffset == 0) + if (remainingBytes >= CDSECTOR_SIZE && remainingOffset == 0) sectorPtr = addr; else sectorPtr = sectorbuffer; @@ -428,7 +429,7 @@ int LoadfileSeg(char* name, char* addr, int offset, int loadsize) // copy bytes while (remainingBytes > 0 && - readPtr - sectorbuffer < 2048) // don't leave boundary + readPtr - sectorbuffer < CDSECTOR_SIZE) // don't leave boundary { *addr++ = *readPtr++; remainingBytes--; @@ -438,8 +439,8 @@ int LoadfileSeg(char* name, char* addr, int offset, int loadsize) } else { - addr += 2048; - remainingBytes -= 2048; + addr += CDSECTOR_SIZE; + remainingBytes -= CDSECTOR_SIZE; } // go to next sector @@ -499,7 +500,7 @@ void sector_ready(u_char intr, u_char* result) // read sector data CdGetSector(current_address, SECTOR_SIZE); - current_address += 2048; + current_address += CDSECTOR_SIZE; current_sector++; sectors_left--; @@ -528,6 +529,48 @@ void sector_ready(u_char intr, u_char* result) } } +#if USE_PC_FILESYSTEM + +// It has to be this way +int loadsectorsPC(char* addr, int sector, int nsectors) +{ + char namebuffer[64]; + + if (g_CurrentLevelFileName[0] == 0) + return 0; + + strcpy(namebuffer, g_CurrentLevelFileName); + FS_FixPathSlashes(namebuffer); + + FILE* fp = fopen(namebuffer, "rb"); + + if (fp) + { + // constrain nsectors to the maximum that can be read from the file + int maxSectors; + fseek(fp, 0, SEEK_END); + maxSectors = (ftell(fp) - (sector * CDSECTOR_SIZE)) / CDSECTOR_SIZE; + nsectors = MIN(nsectors, maxSectors); + + fseek(fp, sector * CDSECTOR_SIZE, SEEK_SET); + fread(addr, CDSECTOR_SIZE, nsectors, fp); + + fclose(fp); + + ShowLoading(); + return 1; + } + +#if USE_PC_FILESYSTEM && !defined(__EMSCRIPTEN__) + char errPrint[512]; + sprintf(errPrint, "loadsectorsPC: failed to open '%s'\n", namebuffer); + SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "ERROR", errPrint, NULL); +#endif // USE_PC_FILESYSTEM && !PSX + return 0; +} + +#endif // USE_PC_FILESYSTEM + // [D] [T] void loadsectors(char* addr, int sector, int nsectors) { @@ -537,6 +580,11 @@ void loadsectors(char* addr, int sector, int nsectors) if (nsectors == 0) return; +#if USE_PC_FILESYSTEM + if (loadsectorsPC(addr, sector, nsectors)) + return; +#endif + load_complete = 0; endread = 0; @@ -561,39 +609,6 @@ void loadsectors(char* addr, int sector, int nsectors) ShowLoading(); } -#if USE_PC_FILESYSTEM - -// It has to be this way -void loadsectorsPC(char* filename, char* addr, int sector, int nsectors) -{ - char namebuffer[64]; - strcpy(namebuffer, filename); - FS_FixPathSlashes(namebuffer); - - FILE* fp = fopen(namebuffer, "rb"); - - if (fp) - { - fseek(fp, sector * CDSECTOR_SIZE, SEEK_SET); - fread(addr, CDSECTOR_SIZE, nsectors, fp); - - fclose(fp); - - ShowLoading(); - return; - } -#if USE_CD_FILESYSTEM - // try using CD - loadsectors(addr, sector, nsectors); -#elif !defined(__EMSCRIPTEN__) - char errPrint[512]; - sprintf(errPrint, "loadsectorsPC: failed to open '%s'\n", namebuffer); - SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "ERROR", errPrint, NULL); -#endif // USE_CD_FILESYSTEM -} - -#endif // USE_PC_FILESYSTEM - // [D] [T] void EnableDisplay(void) { @@ -638,16 +653,16 @@ void SwapDrawBuffers(void) PutDrawEnv(¤t->draw); DrawOTag((u_long*)(current->ot + OTSIZE-1)); - if ((FrameCnt & 1U) == 0) - { - current = &MPBuff[0][1]; - last = &MPBuff[0][0]; - } - else + if ((FrameCnt & 1) != 0) { current = &MPBuff[0][0]; last = &MPBuff[0][1]; } + else + { + current = &MPBuff[0][1]; + last = &MPBuff[0][0]; + } ClearCurrentDrawBuffers(); } @@ -709,15 +724,16 @@ void SetupDrawBuffers(void) int i; RECT16 rect; - SetDefDispEnv(&MPBuff[0][0].disp, 0, 256, 320, 256); - SetDefDispEnv(&MPBuff[0][1].disp, 0, 0, 320, 256); + // PAL: 256 + // NTSC: 240 - MPBuff[0][0].disp.screen.h = 256; - MPBuff[0][1].disp.screen.h = 256; + SetDefDispEnv(&MPBuff[0][0].disp, 0, 256, 320, SCREEN_H); + SetDefDispEnv(&MPBuff[0][1].disp, 0, 0, 320, SCREEN_H); + + MPBuff[0][0].disp.screen.h = SCREEN_H; + MPBuff[0][1].disp.screen.h = SCREEN_H; MPBuff[0][0].disp.screen.x = draw_mode.framex; MPBuff[0][1].disp.screen.x = draw_mode.framex; - MPBuff[0][0].disp.screen.y = draw_mode.framey; - MPBuff[0][1].disp.screen.y = draw_mode.framey; if (NoPlayerControl == 0) SetupDrawBufferData(NumPlayers); @@ -745,17 +761,14 @@ void SetupDrawBuffers(void) // [D] [T] void SetupDrawBufferData(int num_players) { - int i; - int j; - int x[2]; - int y[2]; - int width, height; + int i, j; + int x[2], y[2]; + int height; int toggle; if (num_players == 1) { - width = 320; - height = 256; + height = SCREEN_H; // 240 on NTSC x[0] = 0; y[0] = 0; x[1] = 0; @@ -763,19 +776,18 @@ void SetupDrawBufferData(int num_players) } else if (num_players == 2) { - width = 320; - height = 127; + height = (SCREEN_H / 2 - 1); // 127; // 119 on NTSC x[0] = 0; y[0] = 0; x[1] = 0; - y[1] = 128; + y[1] = SCREEN_H / 2; // 120 on NTSC } else { D_CHECK_ERROR(true, "Erm... too many players selected. FATAL!"); } - SetGeomOffset(width / 2, height / 2); + SetGeomOffset(320 / 2, height / 2); toggle = 0; @@ -785,46 +797,50 @@ void SetupDrawBufferData(int num_players) { u_long* otpt; u_char* primpt; - u_char* PRIMpt; if (toggle) { otpt = (u_long*)_OT2; - primpt = PRIMpt = (u_char*)_primTab2; + primpt = (u_char*)_primTab2; // _primTab1 + PRIMTAB_SIZE } else { otpt = (u_long*)_OT1; - primpt = PRIMpt = (u_char*)_primTab1; + primpt = (u_char*)_primTab1; } toggle ^= 1; - InitaliseDrawEnv(MPBuff[j], x[j], y[j], width, height); + InitaliseDrawEnv(MPBuff[j], x[j], y[j], 320, height); - MPBuff[j][i].primtab = (char*)primpt; - MPBuff[j][i].primptr = (char*)PRIMpt; - MPBuff[j][i].ot = (OTTYPE*)otpt; + MPBuff[i][j].primtab = (char*)primpt; + MPBuff[i][j].primptr = (char*)primpt; + MPBuff[i][j].ot = (OTTYPE*)otpt; } } - aspect.m[0][0] = 4096; - aspect.m[0][1] = 0; - aspect.m[0][2] = 0; - - aspect.m[1][0] = 0; - aspect.m[1][1] = 4710; - aspect.m[1][2] = 0; - - aspect.m[2][0] = 0; - aspect.m[2][1] = 0; - aspect.m[2][2] = 4096; +#ifdef PAL_VERSION + InitMatrix(aspect); + aspect.m[1][1] = 4300; +#else + InitMatrix(aspect); + aspect.m[1][1] = 4096; +#endif } // [D] [T] void InitaliseDrawEnv(DB* pBuff, int x, int y, int w, int h) { - SetDefDrawEnv(&pBuff[0].draw, x, y + 256, w, h); - SetDefDrawEnv(&pBuff[1].draw, x, y, w, h); +#ifdef PSX +#define DB1 pBuff[0] +#define DB2 pBuff[1] +#else +// on PsyX we have to prevent flicker +#define DB1 pBuff[1] +#define DB2 pBuff[0] +#endif + + SetDefDrawEnv(&DB1.draw, x, y, w, h); + SetDefDrawEnv(&DB2.draw, x, y + 256, w, h); pBuff[0].id = 0; pBuff[0].draw.dfe = 1; @@ -849,6 +865,11 @@ void ResetCityType(void) { lasttype = (CITYTYPE)-1; lastcity = -1; + +#ifndef PSX + free(g_CurrentLevelSpoolData); + g_CurrentLevelSpoolData = NULL; +#endif // PSX } // [A] @@ -867,6 +888,8 @@ void SetCityType(CITYTYPE type) if (type == lasttype && GameLevel == lastcity) return; + ResetCityType(); + lastcity = GameLevel; lasttype = type; @@ -898,11 +921,11 @@ void SetCityType(CITYTYPE type) // store level name as it's required by loadsectorsPC strcpy(g_CurrentLevelFileName, filename); + // spool position is forced to 0 citystart[GameLevel] = 0; // skip LUMP type (37) and size, it's already hardcoded fseek(levFp, 8, SEEK_CUR); - fread(citylumps[GameLevel], 1, sizeof(citylumps[GameLevel]), levFp); fclose(levFp); @@ -937,7 +960,16 @@ void SetCityType(CITYTYPE type) while (CdSearchFile(&cdfile, filename) == NULL) { +#if USE_PC_FILESYSTEM +#ifndef __EMSCRIPTEN__ + char errPrint[512]; + sprintf(errPrint, "SetCityType: failed to open '%s'\n", filename); + SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "ERROR", errPrint, NULL); + exit(0); +#endif // !__EMSCRIPTEN__ +#else DoCDRetry(); +#endif // USE_PC_FILESYSTEM } sector = CdPosToInt((CdlLOC*)&cdfile); @@ -958,18 +990,16 @@ void SetCityType(CITYTYPE type) for (i = 0; i < 4; i++) { - citylumps[GameLevel][i].x = data[0] + sector * 2048; + citylumps[GameLevel][i].x = data[0] + sector * CDSECTOR_SIZE; citylumps[GameLevel][i].y = data[1]; data += 2; } #elif USE_PC_FILESYSTEM && !defined(__EMSCRIPTEN__) - char errPrint[1024]; sprintf(errPrint, "SetCityType: cannot open level '%s'\n", filename); SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "ERROR", errPrint, NULL); - #endif // PSX } diff --git a/src_rebuild/Game/C/system.h b/src_rebuild/Game/C/system.h index 96c78a27..5ab055e3 100644 --- a/src_rebuild/Game/C/system.h +++ b/src_rebuild/Game/C/system.h @@ -1,6 +1,32 @@ #ifndef SYSTEM_H #define SYSTEM_H +struct DRAW_MODE +{ + short x1, y1; + short x2, y2; + short width, height; + short framex, framey; +}; + +enum CDTYPE +{ + CDTYPE_NODISC = 0, + CDTYPE_SHELLOPEN = 1, + CDTYPE_DISCERROR = 2, + CDTYPE_WRONGDISC = 3, + CDTYPE_CORRECTDISC = 4, +}; + +enum CITYTYPE +{ + CITYTYPE_DAY = 0, + CITYTYPE_NIGHT = 1, + CITYTYPE_MULTI_DAY = 2, + CITYTYPE_MULTI_NIGHT = 3, +}; + + extern volatile char* _overlay_buffer; // 0x1C0000 extern volatile char* _frontend_buffer; // 0xFB400 extern volatile char* _other_buffer; // 0xF3000 @@ -40,7 +66,7 @@ extern void sys_freeall(); #endif #else -#define D_MALLOC(size) (char*)mallocptr; mallocptr += (size);// (char*)((int)mallocptr + size + 3 & 0xfffffffc); +#define D_MALLOC(size) (char*)mallocptr; mallocptr += (((size) + 3) & -4); #define D_TEMPALLOC(size) (char*)mallocptr #define D_TEMPFREE() #endif @@ -86,13 +112,26 @@ struct DB DISPENV disp; }; -extern DRAW_MODE draw_mode_pal; -extern DRAW_MODE draw_mode_ntsc; - extern DB MPBuff[2][2]; extern DB* last; extern DB* current; +extern DRAW_MODE draw_mode_pal; +extern DRAW_MODE draw_mode_ntsc; + +#define SCREEN_FB 512 +#define SCREEN_FB_H 256 + +#ifdef PAL_VERSION +#define SCREEN_H 256 +#define draw_mode draw_mode_pal +#define video_mode MODE_PAL +#else +#define SCREEN_H 240 +#define draw_mode draw_mode_ntsc +#define video_mode MODE_NTSC +#endif // PAL + // ordering table size #ifdef PSX #define OTSIZE 0x1080 @@ -114,14 +153,6 @@ extern DB* current; extern int citystart[8]; extern XYPAIR citylumps[8][4]; -#ifdef PAL_VERSION -#define draw_mode draw_mode_pal -#define video_mode MODE_PAL -#else -#define draw_mode draw_mode_ntsc -#define video_mode MODE_NTSC -#endif // PAL - #define CDSECTOR_SIZE 2048 extern void ClearMem(char *mem, int size); // 0x0007F3E8 @@ -136,11 +167,7 @@ extern int LoadfileSeg(char *name, char *addr, int offset, int loadsize); // 0x0 extern void ReportMode(int on); // 0x0007F8B8 -#ifdef PSX extern void loadsectors(char *addr, int sector, int nsectors); // 0x0007F904 -#else -extern void loadsectorsPC(char* filename, char *addr, int sector, int nsectors); -#endif // PSX extern void EnableDisplay(); // 0x0007F984 extern void DisableDisplay(); // 0x0007F9F0 diff --git a/src_rebuild/Game/C/texture.c b/src_rebuild/Game/C/texture.c index 251f7ba9..36658873 100644 --- a/src_rebuild/Game/C/texture.c +++ b/src_rebuild/Game/C/texture.c @@ -484,11 +484,7 @@ void LoadPermanentTPages(int *sector) for (i = 0; i < nperms; i++) nsectors += (permlist[i].y + 2047) / CDSECTOR_SIZE; -#ifdef PSX loadsectors(tpagebuffer, *sector, nsectors); -#else - loadsectorsPC(g_CurrentLevelFileName, tpagebuffer, *sector, nsectors); -#endif // PSX *sector += nsectors; @@ -532,12 +528,7 @@ void LoadPermanentTPages(int *sector) for (i = 0; i < nspecpages; i++) nsectors += (speclist[i].y + 2047) / CDSECTOR_SIZE; -#ifdef PSX loadsectors(tpagebuffer, *sector, nsectors); -#else - loadsectorsPC(g_CurrentLevelFileName, tpagebuffer, *sector, nsectors); -#endif // PSX - *sector += nsectors; diff --git a/src_rebuild/Game/C/tile.c b/src_rebuild/Game/C/tile.c index 4189c6cb..a655df4d 100644 --- a/src_rebuild/Game/C/tile.c +++ b/src_rebuild/Game/C/tile.c @@ -1,18 +1,17 @@ #include "driver2.h" -#include "tile.h" #include "models.h" #include "system.h" #include "mission.h" #include "draw.h" #include "texture.h" +#include "tile.h" #include "ASM/rndrasm.h" // [D] [T] [A] void Tile1x1(MODEL *model) { - int opz; - int Z; + int opz, Z; int ofse; PL_POLYFT4* polys; int i; @@ -24,7 +23,7 @@ void Tile1x1(MODEL *model) polys = (PL_POLYFT4*)model->poly_block; // grass should be under pavements and other things - if ((model->shape_flags & SHAPE_FLAG_WATER) || (model->flags2 & 0x4000)) + if ((model->shape_flags & SHAPE_FLAG_WATER) || (model->flags2 & MODEL_FLAG_GRASS)) ofse = 229; else ofse = 133; @@ -34,7 +33,7 @@ void Tile1x1(MODEL *model) #endif i = model->num_polys; - while (i > 0) + while (i-- > 0) { // iterate through polygons // with skipping @@ -81,7 +80,6 @@ void Tile1x1(MODEL *model) } polys = (PL_POLYFT4*)((char*)polys + plotContext.polySizes[ptype]); - i--; } #ifdef USE_PGXP @@ -97,21 +95,19 @@ void DrawTILES(PACKED_CELL_OBJECT** tiles, int tile_amount) { MODEL* pModel; PACKED_CELL_OBJECT *ppco; - int yang, dofse; + PACKED_CELL_OBJECT** tilePointers; + int previous_matrix, yang, dofse, Z; int model_number; - PACKED_CELL_OBJECT **tilePointers; - int previous_matrix; - int Z; if (gTimeOfDay > -1) { if (gTimeOfDay < 3) { - plotContext.colour = combointensity & 0xffffffU | 0x2c000000; + plotContext.colour = combointensity & 0xffffffU | 0x2C000000; } else if (gTimeOfDay == 3) { - plotContext.colour = ((combointensity >> 16 & 0xFF) / 3) << 16 | ((combointensity >> 8 & 0xFF) / 3) << 8 | (combointensity & 0xFF) / 3 | 0x2c000000U; + plotContext.colour = ((combointensity >> 16 & 255) / 3) << 16 | ((combointensity >> 8 & 255) / 3) << 8 | (combointensity & 255) / 3 | 0x2C000000U; } } @@ -121,11 +117,9 @@ void DrawTILES(PACKED_CELL_OBJECT** tiles, int tile_amount) { u_int col; col = plotContext.colour >> 2 & 0x3f; - plotContext.colour = col * 0x30000 | col * 0x300 | col * 3 | 0x2c000000; + plotContext.colour = col * 0x30000 | col * 0x300 | col * 3 | 0x2C000000; } - tile_amount--; - plotContext.ot = current->ot; plotContext.current = current; plotContext.primptr = current->primptr; @@ -137,16 +131,14 @@ void DrawTILES(PACKED_CELL_OBJECT** tiles, int tile_amount) tilePointers = (PACKED_CELL_OBJECT **)tiles; - while (tile_amount != -1) + while (tile_amount--) { - ppco = *tilePointers; + ppco = *tilePointers++; plotContext.f4colourTable[6] = ppco->pos.vx; plotContext.f4colourTable[7] = (ppco->pos.vy << 0x10) >> 0x11; plotContext.f4colourTable[8] = ppco->pos.vz; - tilePointers++; - yang = ppco->value & 0x3f; model_number = (ppco->value >> 6) | (ppco->pos.vy & 1) << 10; @@ -156,8 +148,7 @@ void DrawTILES(PACKED_CELL_OBJECT** tiles, int tile_amount) } else { - Z = Apply_InvCameraMatrixAndSetMatrix((VECTOR_NOPAD *)(plotContext.f4colourTable + 6), &CompoundMatrix[yang]); - previous_matrix = yang; + Z = Apply_InvCameraMatrixAndSetMatrix((VECTOR_NOPAD *)(plotContext.f4colourTable + 6), &CompoundMatrix[previous_matrix = yang]); } if (Z <= DRAW_LOD_DIST_HIGH) @@ -165,10 +156,12 @@ void DrawTILES(PACKED_CELL_OBJECT** tiles, int tile_amount) if (Low2HighDetailTable[model_number] != 0xffff) model_number = Low2HighDetailTable[model_number]; + pModel = modelpointers[model_number]; + if (Z < 2000) - TileNxN(modelpointers[model_number], 4, 75); + TileNxN(pModel, 4, 75); else - TileNxN(modelpointers[model_number], 2, 35); + TileNxN(pModel, 2, 35); } else { @@ -176,8 +169,6 @@ void DrawTILES(PACKED_CELL_OBJECT** tiles, int tile_amount) Tile1x1(pModel); } - - tile_amount--; } current->primptr = plotContext.primptr; } @@ -300,8 +291,7 @@ void makeMesh(MVERTEX(*VSP)[5][5], int m, int n) void drawMesh(MVERTEX(*VSP)[5][5], int m, int n, _pct *pc) { POLY_FT4* prim; - int z; - int opz; + int z, opz; prim = (POLY_FT4*)pc->primptr; @@ -401,58 +391,56 @@ void SubdivNxM(char *polys, int n, int m, int ofse) // [D] [T] void TileNxN(MODEL *model, int levels, int Dofse) { - u_int ttype; + u_int ttype, tileTypes; u_char *polys; - u_int tileTypes; int i; int ofse; - ttype = 0; - polys = (u_char *)model->poly_block; plotContext.verts = (SVECTOR *)model->vertices; - // tile types comes right after model header it seems + // WEIRD: tile types comes right after model header it seems tileTypes = *(u_int *)(model + 1) >> 2; // grass should be under pavements and other things - if((model->shape_flags & SHAPE_FLAG_WATER) || (model->flags2 & 0x4000)) + if((model->shape_flags & SHAPE_FLAG_WATER) || (model->flags2 & MODEL_FLAG_GRASS)) ofse = 229; else ofse = 133; - i = 0; + int _m[5] = { + levels, levels, 0, 1, levels + }; + int _ofse[5] = { + ofse, ofse, 0, Dofse, 133 + }; - while (i < model->num_polys) + i = model->num_polys; + ttype = 0; + while (i--) { - switch (ttype) +#ifdef USE_PGXP + switch (ttype) { - case 0: - case 1: -#ifdef USE_PGXP - PGXP_SetZOffsetScale(0.0f, ofse > 200 ? 1.008f : 0.995f); -#endif - SubdivNxM((char *)polys, levels, levels, ofse); - break; - case 3: -#ifdef USE_PGXP - PGXP_SetZOffsetScale(0.0f, ofse < 40 ? 1.0f : 0.991f); -#endif - SubdivNxM((char *)polys, levels, 1, Dofse); - break; - case 4: -#ifdef USE_PGXP - PGXP_SetZOffsetScale(0.0f, 1.0f); -#endif - SubdivNxM((char *)polys, levels, levels, 133); - break; + case 0: + case 1: + PGXP_SetZOffsetScale(0.0f, ofse > 200 ? 1.008f : 0.995f); + break; + case 3: + PGXP_SetZOffsetScale(0.0f, ofse < 40 ? 1.0f : 0.991f); + break; + case 4: + PGXP_SetZOffsetScale(0.0f, 1.0f); + break; } +#endif + + SubdivNxM((char*)polys, levels, _m[ttype], _ofse[ttype]); ttype = tileTypes & 7; tileTypes >>= 3; polys += plotContext.polySizes[*polys]; - i++; } #ifdef USE_PGXP diff --git a/src_rebuild/Game/C/tile.h b/src_rebuild/Game/C/tile.h index 45763390..8c6a927c 100644 --- a/src_rebuild/Game/C/tile.h +++ b/src_rebuild/Game/C/tile.h @@ -1,6 +1,27 @@ #ifndef TILE_H #define TILE_H +struct MVERTEX +{ + short vx; + short vy; + short vz; + union { + short val; + struct { + u_char u0; + u_char v0; + }s; + }uv; +}; + +struct VERTEX +{ + DVECTOR coord; + UV_INFO uv_coord; + u_char pad[2]; +}; + extern void DrawTILES(PACKED_CELL_OBJECT** tiles, int tile_amount); // 0x00041D7C extern void Tile1x1(MODEL *model); // 0x00041B10 diff --git a/src_rebuild/Game/C/wheelforces.c b/src_rebuild/Game/C/wheelforces.c index 34a90156..1be49ff7 100644 --- a/src_rebuild/Game/C/wheelforces.c +++ b/src_rebuild/Game/C/wheelforces.c @@ -253,7 +253,7 @@ void AddWheelForcesDriver1(CAR_DATA* cp, CAR_LOCALS* cl) friction_coef = (newCompression * (32400 - wetness) >> 15) + 500; if (SurfacePtr != NULL) - wheel->onGrass = SurfacePtr->surface == 4; + wheel->onGrass = SurfacePtr->surface == SURF_GRASS; else wheel->onGrass = 0; @@ -261,10 +261,10 @@ void AddWheelForcesDriver1(CAR_DATA* cp, CAR_LOCALS* cl) { switch (SurfacePtr->surface) { - case 4: - case 6: - case 9: - case 11: + case SURF_GRASS: + case SURF_WATER: + case SURF_DEEPWATER: + case SURF_SAND: wheel->surface = 0x80; break; default: @@ -277,14 +277,14 @@ void AddWheelForcesDriver1(CAR_DATA* cp, CAR_LOCALS* cl) switch (SurfacePtr->surface) { - case 8: + case SURF_ALLEY: wheel->surface |= 0x2; break; - case 6: - case 9: + case SURF_WATER: + case SURF_DEEPWATER: wheel->surface |= 0x1; break; - case 11: + case SURF_SAND: wheel->surface |= 0x3; break; } @@ -697,7 +697,7 @@ void StepOneCar(CAR_DATA* cp) Setup_Debris((VECTOR*)&deepestPoint, &direction, 10, 0); } - if (SurfacePtr && (SurfacePtr->surface != 9) && (SurfacePtr->surface != 6)) + if (SurfacePtr && (SurfacePtr->surface != SURF_DEEPWATER) && (SurfacePtr->surface != SURF_WATER)) { CollisionSound(GetPlayerId(cp), cp, (impulse / 6 + (impulse >> 0x1f) >> 3) - (impulse >> 0x1f), 0); } diff --git a/src_rebuild/Game/Frontend/FEmain.c b/src_rebuild/Game/Frontend/FEmain.c index a944f382..43b107b3 100644 --- a/src_rebuild/Game/Frontend/FEmain.c +++ b/src_rebuild/Game/Frontend/FEmain.c @@ -530,7 +530,7 @@ void SetVariable(int var) if (value == 0) { // [A] save configuration - SaveCurrentProfile(); + SaveCurrentProfile(1); } else { @@ -1227,19 +1227,19 @@ void NewSelection(short dir) addPrim(current->ot + 9, &In); #endif - if ((dir & 0x1000) != 0) + if ((dir & MPAD_D_UP) != 0) { btn = pCurrButton->u; } - else if ((dir & 0x4000) != 0) + else if ((dir & MPAD_D_DOWN) != 0) { btn = pCurrButton->d; } - else if ((dir & 0x8000) != 0) + else if ((dir & MPAD_D_LEFT) != 0) { btn = pCurrButton->l; } - else if ((dir & 0x2000) != 0) + else if ((dir & MPAD_D_RIGHT) != 0) { btn = pCurrButton->r; } @@ -1293,7 +1293,7 @@ int HandleKeyPress(void) } } - if (feNewPad & 0x40) + if (feNewPad & MPAD_CROSS) { int action = pCurrButton->action >> 8; @@ -1347,7 +1347,7 @@ int HandleKeyPress(void) } } } - else if (feNewPad & 0x10) + else if (feNewPad & MPAD_TRIANGLE) { if (ScreenDepth > 0) { @@ -1370,7 +1370,7 @@ int HandleKeyPress(void) else { // any d-pad buttons pressed? - if ((feNewPad & (0x8000 | 0x4000 | 0x2000 | 0x1000)) != 0) + if ((feNewPad & (MPAD_D_UP | MPAD_D_RIGHT | MPAD_D_DOWN | MPAD_D_LEFT)) != 0) { NewSelection(feNewPad); } @@ -1416,7 +1416,7 @@ void PadChecks(void) #ifndef PSX // [A] quit to system - if(feNewPad & 0x10) + if(feNewPad & MPAD_TRIANGLE) { if(ScreenDepth == 0) { @@ -1427,7 +1427,7 @@ void PadChecks(void) if(bQuitToSystem) { - if (feNewPad & 0x40) + if (feNewPad & MPAD_CROSS) { if(bQuitToSystemSel == 1) bQuitToSystem = 2; @@ -1436,7 +1436,7 @@ void PadChecks(void) FESound(2); } - else if ((feNewPad & 0x8000) || (feNewPad & 0x2000)) + else if ((feNewPad & MPAD_D_LEFT) || (feNewPad & MPAD_D_RIGHT)) { bQuitToSystemSel += 1; bQuitToSystemSel &= 1; @@ -1607,7 +1607,7 @@ void State_FrontEnd(void* param) { if (Pads[1].type < 2) { - feNewPad = ((feNewPad & 0x10) != 0) ? 0x10 : 0; + feNewPad = ((feNewPad & MPAD_TRIANGLE) != 0) ? MPAD_TRIANGLE : 0; } else { @@ -1761,9 +1761,7 @@ int FEPrintString(char *string, int x, int y, int justification, int r, int g, i pFontInfo = &feFont.CharInfo[let]; setSprt(font); -#ifdef PSX setSemiTrans(font, 1); -#endif setRGB0(font, r, g, b); setXY0(font, x, y); @@ -1833,9 +1831,7 @@ int FEPrintStringSized(char *string, int x, int y, int scale, int transparent, i h = (pFontInfo->h * scale) / 4096; setPolyFT4(font); -#ifdef PSX - setSemiTrans(font, transparent); -#endif + setSemiTrans(font, transparent); setRGB0(font, 128, 128, 128); setUVWH(font, pFontInfo->u, pFontInfo->v, pFontInfo->w - 1, pFontInfo->h - 1); @@ -1883,14 +1879,14 @@ int CentreScreen(int bSetup) FEPrintStringSized(text, 25, 75, 0xC00, 0, 128, 0, 0); #endif - if (feNewPad & 0x40) + if (feNewPad & MPAD_CROSS) { draw_mode_pal.framex = current->disp.screen.x / 2; draw_mode_pal.framey = current->disp.screen.y; draw_mode_ntsc.framex = current->disp.screen.x / 2; draw_mode_ntsc.framey = current->disp.screen.y; } - else if (feNewPad & 0x10) + else if (feNewPad & MPAD_TRIANGLE) { current->disp.screen.x = draw_mode.framex * 2; current->disp.screen.y = draw_mode.framey; @@ -1901,7 +1897,7 @@ int CentreScreen(int bSetup) { bool done = false; - if (feNewPad & 0x1000) + if (feNewPad & MPAD_D_UP) { if (current->disp.screen.y >= screen_limits[video_mode].miny) { @@ -1910,7 +1906,7 @@ int CentreScreen(int bSetup) done = true; } } - else if (feNewPad & 0x4000) + else if (feNewPad & MPAD_D_DOWN) { if (current->disp.screen.y <= screen_limits[video_mode].maxy) { @@ -1919,7 +1915,7 @@ int CentreScreen(int bSetup) done = true; } } - else if (feNewPad & 0x8000) + else if (feNewPad & MPAD_D_LEFT) { if (current->disp.screen.x >= screen_limits[video_mode].minx) { @@ -1928,7 +1924,7 @@ int CentreScreen(int bSetup) done = true; } } - else if (feNewPad & 0x2000) + else if (feNewPad & MPAD_D_RIGHT) { if (current->disp.screen.x <= screen_limits[video_mode].maxx) { @@ -1966,17 +1962,10 @@ int CarSelectScreen(int bSetup) // setup secret cars if (NumPlayers == 1) { -#if defined(DEBUG_OPTIONS) || defined(_DEBUG) - CarAvailability[0][9] = 1; - CarAvailability[1][9] = 1; - CarAvailability[2][9] = 1; - CarAvailability[3][9] = 1; -#else CarAvailability[0][9] = AvailableCheats.cheat5; CarAvailability[1][9] = AvailableCheats.cheat6; CarAvailability[2][9] = AvailableCheats.cheat7; CarAvailability[3][9] = AvailableCheats.cheat8; -#endif } // setup unlockable cars @@ -2049,7 +2038,7 @@ int CarSelectScreen(int bSetup) return 1; } - if (feNewPad & 0x10) + if (feNewPad & MPAD_TRIANGLE) { FESound(0); bDoneAllready = 1; @@ -2076,7 +2065,7 @@ int CarSelectScreen(int bSetup) iScreenSelect = SCREEN_NONE; } - else if (feNewPad & 0x40) + else if (feNewPad & MPAD_CROSS) { if (currSelIndex == 0) { @@ -2136,11 +2125,11 @@ int CarSelectScreen(int bSetup) EndFrame(); #endif } - else if (feNewPad & 0x1000) + else if (feNewPad & MPAD_D_UP) { currSelIndex = pCurrButton->u - 1; } - else if (feNewPad & 0x4000) + else if (feNewPad & MPAD_D_DOWN) { currSelIndex = pCurrButton->d - 1; } @@ -2157,15 +2146,15 @@ int CopDiffLevelScreen(int bSetup) return 1; } - if (feNewPad & 0x40) + if (feNewPad & MPAD_CROSS) { gCopDifficultyLevel = currSelIndex; } - else if (feNewPad & 0x1000) + else if (feNewPad & MPAD_D_UP) { currSelIndex = pCurrButton->u - 1; } - else if (feNewPad & 0x4000) + else if (feNewPad & MPAD_D_DOWN) { currSelIndex = pCurrButton->d - 1; } @@ -2183,15 +2172,15 @@ int VibroOnOffScreen(int bSetup) return 1; } - if (feNewPad & 0x40) + if (feNewPad & MPAD_CROSS) { gVibration = (currSelIndex ^ 1); } - else if (feNewPad & 0x1000) + else if (feNewPad & MPAD_D_UP) { currSelIndex = pCurrButton->u - 1; } - else if (feNewPad & 0x4000) + else if (feNewPad & MPAD_D_DOWN) { currSelIndex = pCurrButton->d - 1; } @@ -2376,7 +2365,7 @@ int MissionSelectScreen(int bSetup) return 1; } - if (feNewPad & 0x40) + if (feNewPad & MPAD_CROSS) { i = currMission; @@ -2413,16 +2402,16 @@ int MissionSelectScreen(int bSetup) return 1; } - else if (feNewPad & 0x10) + else if (feNewPad & MPAD_TRIANGLE) { missionSetup = 0; iScreenSelect = SCREEN_NONE; } - else if (feNewPad & 0x1000) + else if (feNewPad & MPAD_D_UP) { currSelIndex = pCurrButton->u - 1; } - else if (feNewPad & 0x4000) + else if (feNewPad & MPAD_D_DOWN) { currSelIndex = pCurrButton->d - 1; } @@ -2489,7 +2478,7 @@ int MissionCityScreen(int bSetup) return 0; } - if (feNewPad & 0x10) + if (feNewPad & MPAD_TRIANGLE) { // BUGFIX: unload city image loaded[0] = -1; @@ -2501,11 +2490,11 @@ int MissionCityScreen(int bSetup) } else { - if (feNewPad & 0x1000) + if (feNewPad & MPAD_D_UP) { currCity = pCurrButton->u - 1; } - else if (feNewPad & 0x4000) + else if (feNewPad & MPAD_D_DOWN) { currCity = pCurrButton->d - 1; } @@ -2578,12 +2567,12 @@ int CutSceneSelectScreen(int bSetup) return 1; } - if (feNewPad & 0x10) + if (feNewPad & MPAD_TRIANGLE) { bDrawExtra = 0; iScreenSelect = SCREEN_NONE; } - else if (feNewPad & 0x40) + else if (feNewPad & MPAD_CROSS) { if (currSelIndex == 0) { @@ -2642,11 +2631,11 @@ int CutSceneSelectScreen(int bSetup) return 0; } - else if (feNewPad & 0x1000) + else if (feNewPad & MPAD_D_UP) { currSelIndex = pCurrButton->u - 1; } - else if (feNewPad & 0x4000) + else if (feNewPad & MPAD_D_DOWN) { currSelIndex = pCurrButton->d - 1; } @@ -2746,7 +2735,7 @@ int CutSceneCitySelectScreen(int bSetup) return 0; } - if (feNewPad & 0x40) + if (feNewPad & MPAD_CROSS) { lastCity = -1; lastCutCity = GameLevel; @@ -2772,7 +2761,7 @@ int CutSceneCitySelectScreen(int bSetup) return 0; } - else if (feNewPad & 0x10) + else if (feNewPad & MPAD_TRIANGLE) { FESound(0); bDoneAllready = 1; @@ -2782,11 +2771,11 @@ int CutSceneCitySelectScreen(int bSetup) return 0; } - else if (feNewPad & 0x1000) + else if (feNewPad & MPAD_D_UP) { currCity = pCurrButton->u - 1; } - else if (feNewPad & 0x4000) + else if (feNewPad & MPAD_D_DOWN) { currCity = pCurrButton->d - 1; } @@ -2860,7 +2849,7 @@ int SetVolumeScreen(int bSetup) currSelIndex = (pCurrButton->u & 3); - if (feNewPad & 0x10) + if (feNewPad & MPAD_TRIANGLE) { FESound(0); bDoneAllready = 1; @@ -2875,7 +2864,7 @@ int SetVolumeScreen(int bSetup) return 0; } - else if (feNewPad & 0x40) + else if (feNewPad & MPAD_CROSS) { if (currSelIndex == 2) LoadBackgroundFile("DATA\\GFX.RAW"); @@ -2886,7 +2875,7 @@ int SetVolumeScreen(int bSetup) { int dir = -1; // -1: no action, 0: limit reached, 1: OK - if (fePad & 0x8000) + if (fePad & MPAD_D_LEFT) { switch (currSelIndex) { @@ -2922,7 +2911,7 @@ int SetVolumeScreen(int bSetup) break; } } - else if (fePad & 0x2000) + else if (fePad & MPAD_D_RIGHT) { switch (currSelIndex) { @@ -3080,7 +3069,7 @@ int ScoreScreen(int bSetup) return 0; } - if (feNewPad & 0x40) + if (feNewPad & MPAD_CROSS) { if (currSelIndex == 0) { @@ -3128,12 +3117,12 @@ int ScoreScreen(int bSetup) bRedrawFrontend = 1; #endif } - else if (feNewPad & 0x10) + else if (feNewPad & MPAD_TRIANGLE) { iScreenSelect = SCREEN_NONE; return 0; } - else if ((feNewPad & 0x1000) || (feNewPad & 0x4000)) + else if ((feNewPad & MPAD_D_UP) || (feNewPad & MPAD_D_DOWN)) { currSelIndex ^= 1; } @@ -3202,7 +3191,7 @@ int CityCutOffScreen(int bSetup) #ifndef PSX /* - if ((fePad & 0x40U) != 0) + if ((fePad & MPAD_CROSS) != 0) { lastCity = currCity; @@ -3214,7 +3203,7 @@ int CityCutOffScreen(int bSetup) return 0; }*/ - if (feNewPad & 0x10) + if (feNewPad & MPAD_TRIANGLE) { lastCity = -1; @@ -3227,11 +3216,11 @@ int CityCutOffScreen(int bSetup) return 0; } - else if (feNewPad & 0x1000) + else if (feNewPad & MPAD_D_UP) { currCity = pCurrButton->u - 1; } - else if (feNewPad & 0x4000) + else if (feNewPad & MPAD_D_DOWN) { currCity = pCurrButton->d - 1; } @@ -3267,14 +3256,14 @@ int ControllerScreen(int bSetup) } else { - if (feNewPad & 0x40) + if (feNewPad & MPAD_CROSS) { currSelIndex = currSelIndex ^ 1; LoadBackgroundFile(contNames[currSelIndex]); bRedrawFrontend = 1; } - else if (feNewPad & 0x10) + else if (feNewPad & MPAD_TRIANGLE) { iScreenSelect = SCREEN_SCORES; LoadBackgroundFile("DATA\\GFX.RAW"); @@ -3725,7 +3714,7 @@ int UserReplaySelectScreen(int bSetup) if (gFEReplayCount) { - if (feNewPad & 0x40) + if (feNewPad & MPAD_CROSS) { char filename[64]; int selectedReplay = pCurrButton->var; @@ -3810,7 +3799,7 @@ int TimeOfDaySelectScreen(int bSetup) FEPrintString(GET_GAME_TXT(TimeOfDayNames[wantedTimeOfDay]), 590, ypos[0], 4, 128, 128, 128); FEPrintString(GET_GAME_TXT(WeatherNames[wantedWeather]), 590, ypos[1], 4, 128, 128, 128); - if (feNewPad & 0x10) + if (feNewPad & MPAD_TRIANGLE) { // reset back wantedWeather = -1; @@ -3821,11 +3810,11 @@ int TimeOfDaySelectScreen(int bSetup) dir = 0; - if (feNewPad & 0x8000) + if (feNewPad & MPAD_D_LEFT) { dir = -1; } - else if (feNewPad & 0x2000) + else if (feNewPad & MPAD_D_RIGHT) { dir = 1; } @@ -3861,7 +3850,7 @@ int DemoScreen(int bSetup) if (bSetup) return 0; - if (feNewPad & 0x40) + if (feNewPad & MPAD_CROSS) { pScreenStack[ScreenDepth] = pCurrScreen; pButtonStack[ScreenDepth] = pCurrButton; @@ -3880,7 +3869,7 @@ int DemoScreen(int bSetup) if(mainScreenLoaded) { - if (feNewPad & 0x20) + if (feNewPad & MPAD_CIRCLE) { LoadBackgroundFile(contNames[0]); FESound(2); diff --git a/src_rebuild/Game/dr2limits.h b/src_rebuild/Game/dr2limits.h index 7df5a2be..2670d011 100644 --- a/src_rebuild/Game/dr2limits.h +++ b/src_rebuild/Game/dr2limits.h @@ -4,6 +4,12 @@ // DRIVER 2 game engine limits // please populate this file only with engine limits during refactoring +#ifndef PSX +#define MAX_PLAYERS 16 // used for replay streams mostly +#else +#define MAX_PLAYERS 8 // used for replay streams mostly +#endif + #define MAX_MODEL_SLOTS 1536 // DO NOT CHANGE. No effect in upping it - limited by cell types #define MAX_CARS 20 @@ -30,6 +36,16 @@ #define MAX_DENTING_LOD_UVS 134 #endif +// Tyre track visuals +#define MAX_TYRE_PLAYERS 4 +#ifndef PSX +#define MAX_TYRE_TRACK_WHEELS 4 +#define MAX_TYRE_TRACK_PLAYERS 4 +#else +#define MAX_TYRE_TRACK_WHEELS 2 +#define MAX_TYRE_TRACK_PLAYERS 2 +#endif + // Mission limits // DO NOT EDIT, breaks compatibility! #define MAX_MISSION_THREADS 16 @@ -37,6 +53,7 @@ // replay definitions. // DO NOT EDIT, breaks compatibility! +#define MAX_REPLAY_STREAMS MAX_PLAYERS #define MAX_REPLAY_CAMERAS 60 #define MAX_REPLAY_WAYPOINTS 150 #define MAX_REPLAY_PINGS 400 diff --git a/src_rebuild/Game/dr2locale.c b/src_rebuild/Game/dr2locale.c index eb628409..61f8d98a 100644 --- a/src_rebuild/Game/dr2locale.c +++ b/src_rebuild/Game/dr2locale.c @@ -1,5 +1,6 @@ #include "driver2.h" #include "C/system.h" +#include "C/pres.h" #include "platform.h" #ifndef PSX @@ -7,6 +8,7 @@ #include #endif + int gUserLanguage = 0; char* gMisssionLanguageBuffer = NULL; diff --git a/src_rebuild/Game/dr2math.h b/src_rebuild/Game/dr2math.h index 7d6445a0..1cbed399 100644 --- a/src_rebuild/Game/dr2math.h +++ b/src_rebuild/Game/dr2math.h @@ -3,6 +3,13 @@ #include +struct MATRIX2 +{ + short m[3][3]; + short computed; + char null[12]; +}; + #if defined(_LANGUAGE_C_PLUS_PLUS)||defined(__cplusplus)||defined(c_plusplus) extern "C" { #endif @@ -40,6 +47,20 @@ extern short rcossin_tbl[8192]; #define RemapVal( val, A, B, C, D) \ (C + (D - C) * (val - A) / (B - A)) +#define VecCopy(_v, _xyz) \ +{ \ + (_v)->vx = (_xyz)->vx; \ + (_v)->vy = (_xyz)->vy; \ + (_v)->vz = (_xyz)->vz; \ +} + +#define VecNegate(_v) \ +{ \ + (_v)->vx = -(_v)->vx; \ + (_v)->vy = -(_v)->vy; \ + (_v)->vz = -(_v)->vz; \ +} + #define SetVec(_v, _x, _y, _z) \ { \ (_v)->vx = _x; \ diff --git a/src_rebuild/Game/dr2types.h b/src_rebuild/Game/dr2types.h index a2d301f5..eba624f9 100644 --- a/src_rebuild/Game/dr2types.h +++ b/src_rebuild/Game/dr2types.h @@ -152,12 +152,20 @@ struct DRIVER2_JUNCTION u_int flags; }; +enum SurfaceType +{ + SURF_CONCRETE = 0, // concrete/paved tiles + SURF_GRASS = 4, + SURF_WATER = 6, + SURF_ALLEY = 8, + SURF_DEEPWATER = 9, + SURF_SAND = 11, +}; + typedef struct _sdPlane { - short surface; - short a; - short b; - short c; + short surface; // also one of SurfaceTypes + short a, b, c; int d; } sdPlane; @@ -252,19 +260,6 @@ struct CAR_MODEL SVECTOR* nlist; }; -struct plotCarGlobals -{ - u_char* primptr; - OTTYPE* ot; - u_int intensity; - u_short* pciv_clut; - u_int ShineyTPageASL16; - u_int ShineyClutASL16; - u_char* damageLevel; - u_char* shineyTable; - int ghost; -}; - // UNUSED struct TEX_INFO { @@ -556,136 +551,6 @@ struct LEAD_PARAMETERS int hWidth80Mul; }; -//--------------------------------------------------------------------------------------- -// TODO: DR2EVENTS.H - -typedef struct _EVENT EVENT; - -struct _EVENT -{ - VECTOR position; - short rotation; - short timer; - int* data; - int* node; - short flags; - short radius; - int model; - EVENT* next; -}; - -struct FixedEvent // same as EVENT but different fields -{ - VECTOR position; - short rotation; - short active; - u_short initialRotation; - u_short finalRotation; - u_short minSpeed; - u_short maxSpeed; - short flags; - short radius; - int model; - EVENT* next; - char* modelName; -}; - -struct EventGlobal -{ - int camera; - int draw; - EVENT** track; - EVENT* cameraEvent; -}; - -enum SpecialCamera -{ - SPECIAL_CAMERA_SET = 0, - SPECIAL_CAMERA_SET2 = 1, - SPECIAL_CAMERA_RESET = 2, - SPECIAL_CAMERA_WAIT = 3, -}; - -struct MissionTrain -{ - EVENT* engine; - int* node; - int cornerSpeed; - int initialStraightSpeed; - int finalStraightSpeed; - int start; - int startDir; -}; - -struct Foam -{ - MODEL* model; - int rotate; -}; - -struct EventCarriage -{ - short rotation; - short vel; -}; - -struct MultiCar -{ - EVENT* event; - int count; -}; - -struct Helicopter -{ - int speed; - short pitch; - short dp; - short roll; - short dr; - int lastX; - int lastZ; - TEXTURE_DETAILS rotorTexture; - short rotorrot; - short rotorvel; - int cleanModel; - int deadModel; -}; - -struct Detonator -{ - int timer; - int count; -}; - -struct CameraDelay -{ - int delay; - int type; -}; - -enum VisType -{ - VIS_INIT = 0, - VIS_SORT = 1, - VIS_ADD = 2, - VIS_NEXT = 3, -}; - -struct EventCamera -{ - VECTOR position; - short yAng; - MATRIX matrix; - int rotate; -}; - -enum Station -{ - EVENT_NO_STATION = 0, - EVENT_APPROACHING = 1, - EVENT_LEAVING = 2, -}; - //--------------------------------------------------------------------------------------- // TODO: MISSION.H @@ -949,12 +814,9 @@ enum MissionTimerFlags struct MR_TIMER { - short x; - short y; + short x, y; u_char flags; - u_char min; - u_char sec; - u_char frac; + u_char min, sec, frac; int count; }; @@ -1065,12 +927,14 @@ enum PED_MODEL_TYPES //: char CIVILIAN = 3, }; -typedef void(*pedFunc)(struct PEDESTRIAN* pPed); +typedef struct PEDESTRIAN *LPPEDESTRIAN; + +typedef void(*pedFunc)(LPPEDESTRIAN pPed); typedef struct PEDESTRIAN { - PEDESTRIAN* pNext; - PEDESTRIAN* pPrev; + LPPEDESTRIAN pNext; + LPPEDESTRIAN pPrev; pedFunc fpRestState; pedFunc fpAgitatedState; char padId; @@ -1095,23 +959,6 @@ typedef struct PEDESTRIAN char type; } *LPPEDESTRIAN; -struct CAR_COLLISION_BOX -{ - int min_x; - int max_x; - int min_z; - int max_z; -}; - -typedef struct SEATED_PEDESTRIANS -{ - int x; - int z; - short rotation; - char index; - char pad; -} *SEATEDPTR; - typedef struct PEDESTRIAN_ROADS { short pos; @@ -1124,61 +971,6 @@ typedef struct PEDESTRIAN_ROADS //--------------------------------------------------------------------------------------- // TODO: GAMESND.H -typedef struct __envsound -{ - u_char type; - u_char flags; - VECTOR pos; - VECTOR pos2; - int bank; - int sample; - int vol; -} envsound; - -typedef struct __envsoundtags -{ - int frame_cnt; - int func_cnt; - int num_envsnds; - int envsnd_cnt; -} envsoundtags; - -typedef struct __envsoundinfo -{ - VECTOR eff_pos[4]; - VECTOR cam_pos; - float g[4]; - int thisS[4]; - int playing_sound[4]; - int chan[4]; - u_int flags; -} envsoundinfo; - -struct SPEECH_QUEUE -{ - char allowed; - char chan; - char is_playing; - int count; - char reverb; - int slot[7]; -}; - -typedef struct __othercarsound -{ - int car; - int chan; - char in_use; - char stopped; - char idle; -} othercarsound; - -typedef struct __bitfield64 -{ - int h; - int l; -} bitfield64; - typedef struct __skidinfo { char chan; @@ -1192,75 +984,6 @@ typedef struct __horninfo char request; } horninfo; -//--------------------------------------------------------------------------------------- -// TODO: ANIMOBJ.H - -struct CYCLE_OBJECT -{ - char* name; - short vx; - short vy; - short start1; - short stop1; - short speed1; - short start2; - short stop2; - short speed2; -}; - -//--------------------------------------------------------------------------------------- -// TODO: OVERLAY.H - -struct COLOUR_BAND -{ - CVECTOR colour; - int value; - int flags; -}; - -typedef struct _PERCENTAGE_BAR -{ - char* tag; - short xpos; - short ypos; - short width; - short height; - u_short position; - u_short max; - COLOUR_BAND* pColourBand; - int flags; - int active; -} PERCENTAGE_BAR, *LPPERCENTAGE_BAR; - -//--------------------------------------------------------------------------------------- -// TODO: OVERMAP.H - -struct COP_SIGHT_DATA -{ - short surroundViewDistance; - short frontViewDistance; - short frontViewAngle; -}; - -struct MAPTEX -{ - short u; - short w; - short v; - short h; -}; - -struct OVERMAP -{ - int x_offset; - int y_offset; - int width; - int height; - u_char toptile; - u_char dummy; - int scale; -}; - //--------------------------------------------------------------------------------------- // TODO: CHEATS.H @@ -1391,35 +1114,6 @@ struct PLAYBACKCAMERA u_char idx; }; -//--------------------------------------------------------------------------------------- -// TODO: CUTSCENE.H - -struct CUTSCENE_BUFFER -{ - int numResident; - u_char residentCutscenes[4]; - char(*residentPointers[4]); - - char* buffer; - char* currentPointer; - - int bytesFree; - int reservedSize; - // char buffer[32*1024]; // was 8192, but we have some free mem now even for PSX. Using malloc. -}; - -struct CUTSCENE_INFO -{ - u_short offset; - u_short size; -}; - -struct CUTSCENE_HEADER -{ - int maxsize; - CUTSCENE_INFO data[15]; -}; - //--------------------------------------------------------------------------------------- // TODO: COP_AI.H @@ -1442,7 +1136,7 @@ struct ADJACENT_ROAD_INFO }; // only "status" is used -struct ROADBLOCK // [A] causes undefined behaviour +struct ROADBLOCK { VECTOR position; ADJACENT_ROAD_INFO adjacentRoadInfo; @@ -1605,17 +1299,6 @@ typedef struct _PLAYER //--------------------------------------------------------------------------------------- // TODO: AI.H -typedef struct _EXTRA_CIV_DATA -{ - int surfInd; - int distAlongSegment; - short angle; - u_short ctrlState; - int thrustState; - u_char palette; - u_char controlFlags; -} EXTRA_CIV_DATA; - struct COP_DATA { int autoMaxPowerScaleLimit; @@ -1629,143 +1312,6 @@ struct COP_DATA short trigger[5]; }; -enum AIZone -{ - zoneFrnt = 0, - zoneBack = 1, - zoneLeft = 2, - zoneRght = 3, -}; - -//--------------------------------------------------------------------------------------- -// TODO: DRAW.H - -// Primitive plot context used in scratchpad -struct _pct -{ - struct DB* current; - u_short(*ptexture_pages)[128]; - u_short(*ptexture_cluts)[128][32]; - int f4colourTable[32]; - int* polySizes; - char* primptr; - OTTYPE* ot; - u_int clut; - u_int tpage; - u_int colour; - int flags; - SVECTOR* verts; - u_int lastTexInfo; - int scribble[8]; - int model; -}; - -struct MATRIX2 -{ - short m[3][3]; - short computed; - char null[12]; -}; - -struct MVERTEX -{ - short vx; - short vy; - short vz; - union { - short val; - struct { - u_char u0; - u_char v0; - }s; - }uv; -}; - -struct MVERTEX5x5 -{ - MVERTEX verts[5][5]; -}; - -struct VERTEX -{ - DVECTOR coord; - UV_INFO uv_coord; - u_char pad[2]; -}; - -//--------------------------------------------------------------------------------------- -// TODO: SPOOL.H - -struct Spool -{ - u_short offset; - u_char connected_areas[2]; - u_char pvs_size; - u_char cell_data_size[3]; - u_char super_region; - u_char num_connected_areas; - u_char roadm_size; - u_char roadh_size; -}; - -struct SPOOLQ -{ - u_char type; - u_char data; - u_short nsectors; - u_int sector; - char* addr; - void (*func)(); -#ifdef _DEBUG - const char* requestby; - int requestbyline; -#endif -}; - -struct SPL_REGIONINFO -{ - u_short region_to_unpack; - u_short target_barrel_region; - int nsectors; - char* cell_addr; - char* roadm_addr; -}; - -struct AreaDataStr -{ - u_short gfx_offset; - u_short model_offset; - u_short music_offset; - u_short ambient_offset; - u_char model_size; - u_char pad; - u_char num_tpages; - u_char ambient_size; - u_char music_size; - u_char music_samples_size; - u_char music_id; - u_char ambient_id; -}; - -//--------------------------------------------------------------------------------------- -// TODO: FMV.H - -struct RENDER_ARG -{ - u_char render; - u_char credits; - u_short recap; -}; - -struct RENDER_ARGS -{ - u_char nRenders; - u_char subtitle; - char screenx; - char screeny; - RENDER_ARG Args[4]; -}; - //--------------------------------------------------------------------------------------- // TODO: GLAUNCH.H @@ -1800,221 +1346,4 @@ enum GAMEMODE GAMEMODE_DEMO = 6, }; -struct MISSION_STEP -{ - u_char flags : 3; - u_char recap : 5; - u_char data : 7; - u_char disc : 1; -}; - -//--------------------------------------------------------------------------------------- -// TODO: LEADAI.H - -struct MAP_DATA -{ - CAR_DATA* cp; - VECTOR* base; - VECTOR* pos; - VECTOR* vel; - VECTOR* size; - int intention; - int* map; - int* local; -}; - -//--------------------------------------------------------------------------------------- -// TODO: PAUSE.H - -enum EXIT_VALUE -{ - MENU_QUIT_NONE = 0, - MENU_QUIT_CONTINUE = 1, - MENU_QUIT_QUIT = 2, - MENU_QUIT_RESTART = 3, - MENU_QUIT_DIRECTOR = 4, - MENU_QUIT_QUICKREPLAY = 5, - MENU_QUIT_BACKMENU = 6, - MENU_QUIT_NEXTMISSION = 7, -}; - -typedef void(*pauseFunc)(int dir); - -struct MENU_ITEM; -struct MENU_HEADER; - -struct MENU_ITEM -{ - char* Text; - u_char Type; - u_char Justify; - pauseFunc func; - EXIT_VALUE ExitValue; - MENU_HEADER* SubMenu; -}; - -struct MENU_HEADER -{ - char* Title; - XYWH Bound; - u_char NumItems; - MENU_ITEM* MenuItems; -}; - -//--------------------------------------------------------------------------------------- -// TODO: PRES.H - -struct OUT_FONTINFO -{ - u_char x; - u_char y; - char offx; - char offy; - u_char width; - u_char height; - u_short pad; -}; - -struct FONT_DIGIT -{ - char xOffset; - char width; -}; - -struct SHADOWHDR -{ - u_int num_common_verts; - u_short num_verts_total; - u_short num_polys_total; - u_short vert_offsets[4]; - u_short nverts[4]; - u_short npolys[4]; - u_int(*poly_block[4]); - SVECTOR* vertices; -}; - -//--------------------------------------------------------------------------------------- -// TODO: SHADOW.H - -struct TYRE_TRACK -{ - u_char type; - u_char shade; - u_char shade_type; - u_char surface; - SVECTOR_NOPAD p1; - SVECTOR_NOPAD p2; - SVECTOR_NOPAD p3; - SVECTOR_NOPAD p4; -}; - -//--------------------------------------------------------------------------------------- -// TODO: SYSTEM.H - -struct DRAW_MODE -{ - short x1; - short y1; - short x2; - short y2; - short width; - short height; - short framex; - short framey; -}; - -enum CDTYPE -{ - CDTYPE_NODISC = 0, - CDTYPE_SHELLOPEN = 1, - CDTYPE_DISCERROR = 2, - CDTYPE_WRONGDISC = 3, - CDTYPE_CORRECTDISC = 4, -}; - -enum CITYTYPE -{ - CITYTYPE_DAY = 0, - CITYTYPE_NIGHT = 1, - CITYTYPE_MULTI_DAY = 2, - CITYTYPE_MULTI_NIGHT = 3, -}; - -//--------------------------------------------------------------------------------------- -// TODO: PAD.H - -struct DUPLICATION -{ - char* buffer; - int size; -}; - -typedef struct MAPPING -{ - u_short button_lookup[16]; - u_short swap_analog; - u_short reserved1; -} *LPMAPPING; - -typedef struct PAD -{ - u_char active; - u_char type; - u_char dualshock; - u_char reserved1; - u_short direct; - u_short dirnew; - char diranalog[4]; - u_short mapped; - u_short mapnew; - char mapanalog[4]; - MAPPING mappings; - u_char alarmShakeCounter; - u_char asd; - u_char sdf; - u_char dfg; - u_char delay; - u_char port; - u_char state; - u_char dsactive; - u_char* shakeptr; - u_char motors[2]; - u_char shake_type; - u_char vibrate; -} *LPPAD; - -//--------------------------------------------------------------------------------------- -// TODO: LOADSAVE.H - -struct GAME_SAVE_HEADER -{ - u_int magic; - u_char gMissionLadderPos; - u_char pad1; - u_char pad2; - u_char pad3; - MISSION_DATA SavedData; - int reserved[8]; -}; - -struct CONFIG_SAVE_HEADER -{ - u_int magic; - int gMasterVolume; - int gMusicVolume; - int gSoundMode; - int gVibration; - int gCopDifficultyLevel; - int gFurthestMission; - MAPPING PadMapping[2]; - SCORE_TABLES ScoreTables; - int PALAdjustX; - int PALAdjustY; - int NTSCAdjustX; - int NTSCAdjustY; - int gSubtitles; - ACTIVE_CHEATS AvailableCheats; - int reserved[6]; -}; - #endif // DR2TYPES_H \ No newline at end of file diff --git a/src_rebuild/Game/engine/mdl.h b/src_rebuild/Game/engine/mdl.h index fa3ce1a0..9ee02a21 100644 --- a/src_rebuild/Game/engine/mdl.h +++ b/src_rebuild/Game/engine/mdl.h @@ -62,6 +62,18 @@ struct COLLISION_PACKET short xsize, ysize, zsize; }; +struct SHADOWHDR +{ + u_int num_common_verts; + u_short num_verts_total; + u_short num_polys_total; + u_short vert_offsets[4]; + u_short nverts[4]; + u_short npolys[4]; + u_int(*poly_block[4]); + SVECTOR* vertices; +}; + struct RGB // almost same as CVECTOR { u_char r; diff --git a/src_rebuild/Game/version.h b/src_rebuild/Game/version.h index 9c0eb850..88dbe019 100644 --- a/src_rebuild/Game/version.h +++ b/src_rebuild/Game/version.h @@ -1,9 +1,9 @@ #ifndef GAME_VERSION_N -#define GAME_VERSION_N "7.3" +#define GAME_VERSION_N "7.4" #endif #ifndef GAME_VERSION_RES -#define GAME_VERSION_RES 7,3 +#define GAME_VERSION_RES 7,4 #endif #define GAME_TITLE "REDRIVER2" diff --git a/src_rebuild/PsyCross b/src_rebuild/PsyCross new file mode 160000 index 00000000..502f700c --- /dev/null +++ b/src_rebuild/PsyCross @@ -0,0 +1 @@ +Subproject commit 502f700c5ba88b1ee0f7bca5cdd8ea66b833417a diff --git a/src_rebuild/PsyCross/README.md b/src_rebuild/PsyCross/README.md deleted file mode 100644 index d4367b77..00000000 --- a/src_rebuild/PsyCross/README.md +++ /dev/null @@ -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) \ No newline at end of file diff --git a/src_rebuild/PsyCross/include/PsyX/PsyX_config.h b/src_rebuild/PsyCross/include/PsyX/PsyX_config.h deleted file mode 100644 index 570d5857..00000000 --- a/src_rebuild/PsyCross/include/PsyX/PsyX_config.h +++ /dev/null @@ -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 \ No newline at end of file diff --git a/src_rebuild/PsyCross/include/PsyX/PsyX_globals.h b/src_rebuild/PsyCross/include/PsyX/PsyX_globals.h deleted file mode 100644 index 3cf3f5c6..00000000 --- a/src_rebuild/PsyCross/include/PsyX/PsyX_globals.h +++ /dev/null @@ -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 \ No newline at end of file diff --git a/src_rebuild/PsyCross/include/PsyX/PsyX_public.h b/src_rebuild/PsyCross/include/PsyX/PsyX_public.h deleted file mode 100644 index 1deb7b8c..00000000 --- a/src_rebuild/PsyCross/include/PsyX/PsyX_public.h +++ /dev/null @@ -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 \ No newline at end of file diff --git a/src_rebuild/PsyCross/include/PsyX/PsyX_render.h b/src_rebuild/PsyCross/include/PsyX/PsyX_render.h deleted file mode 100644 index 92424c9d..00000000 --- a/src_rebuild/PsyCross/include/PsyX/PsyX_render.h +++ /dev/null @@ -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 -# else -# if OGLES_VERSION == 2 -# include -# include -# elif OGLES_VERSION == 3 -# include -# endif -# endif - -# include - -#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 -#include - -#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 \ No newline at end of file diff --git a/src_rebuild/PsyCross/include/PsyX/PsyX_version.h b/src_rebuild/PsyCross/include/PsyX/PsyX_version.h deleted file mode 100644 index 1a2d5d8e..00000000 --- a/src_rebuild/PsyCross/include/PsyX/PsyX_version.h +++ /dev/null @@ -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 \ No newline at end of file diff --git a/src_rebuild/PsyCross/include/PsyX/common/glad.h b/src_rebuild/PsyCross/include/PsyX/common/glad.h deleted file mode 100644 index deff3c37..00000000 --- a/src_rebuild/PsyCross/include/PsyX/common/glad.h +++ /dev/null @@ -1,3389 +0,0 @@ -/* - - OpenGL, OpenGL ES loader generated by glad 0.1.34 on Mon Nov 9 14:41:03 2020. - - Language/Generator: C/C++ - Specification: gl - APIs: gl=3.1, gles2=2.0 - Profile: compatibility - Extensions: - - Loader: True - Local files: True - Omit khrplatform: True - Reproducible: False - - Commandline: - --profile="compatibility" --api="gl=3.1,gles2=2.0" --generator="c" --spec="gl" --local-files --omit-khrplatform --extensions="" - Online: - https://glad.dav1d.de/#profile=compatibility&language=c&specification=gl&loader=on&api=gl%3D3.1&api=gles2%3D2.0 -*/ - - -#ifndef __glad_h_ -#define __glad_h_ - -#ifdef __gl_h_ -#error OpenGL header already included, remove this include, glad already provides it -#endif -#define __gl_h_ - -#ifdef __gl2_h_ -#error OpenGL ES 2 header already included, remove this include, glad already provides it -#endif -#define __gl2_h_ - -#ifdef __gl3_h_ -#error OpenGL ES 3 header already included, remove this include, glad already provides it -#endif -#define __gl3_h_ - -#if defined(_WIN32) && !defined(APIENTRY) && !defined(__CYGWIN__) && !defined(__SCITECH_SNAP__) -#define APIENTRY __stdcall -#endif - -#ifndef APIENTRY -#define APIENTRY -#endif -#ifndef APIENTRYP -#define APIENTRYP APIENTRY * -#endif - -#ifndef GLAPIENTRY -#define GLAPIENTRY APIENTRY -#endif -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - -struct gladGLversionStruct { - int major; - int minor; -}; - -typedef void* (* GLADloadproc)(const char *name); - -#ifndef GLAPI -# if defined(GLAD_GLAPI_EXPORT) -# if defined(_WIN32) || defined(__CYGWIN__) -# if defined(GLAD_GLAPI_EXPORT_BUILD) -# if defined(__GNUC__) -# define GLAPI __attribute__ ((dllexport)) extern -# else -# define GLAPI __declspec(dllexport) extern -# endif -# else -# if defined(__GNUC__) -# define GLAPI __attribute__ ((dllimport)) extern -# else -# define GLAPI __declspec(dllimport) extern -# endif -# endif -# elif defined(__GNUC__) && defined(GLAD_GLAPI_EXPORT_BUILD) -# define GLAPI __attribute__ ((visibility ("default"))) extern -# else -# define GLAPI extern -# endif -# else -# define GLAPI extern -# endif -#endif - -GLAPI struct gladGLversionStruct GLVersion; - -GLAPI int gladLoadGL(void); - -GLAPI int gladLoadGLLoader(GLADloadproc); - -GLAPI int gladLoadGLES2Loader(GLADloadproc); - -typedef unsigned int GLenum; -typedef unsigned char GLboolean; -typedef unsigned int GLbitfield; -typedef void GLvoid; -typedef int8_t GLbyte; -typedef uint8_t GLubyte; -typedef int16_t GLshort; -typedef uint16_t GLushort; -typedef int GLint; -typedef unsigned int GLuint; -typedef int32_t GLclampx; -typedef int GLsizei; -typedef float GLfloat; -typedef float GLclampf; -typedef double GLdouble; -typedef double GLclampd; -typedef void *GLeglClientBufferEXT; -typedef void *GLeglImageOES; -typedef char GLchar; -typedef char GLcharARB; -#ifdef __APPLE__ -typedef void *GLhandleARB; -#else -typedef unsigned int GLhandleARB; -#endif -typedef uint16_t GLhalf; -typedef uint16_t GLhalfARB; -typedef int32_t GLfixed; -#if defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && (__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ > 1060) -#if defined(__khrplatform_h_) -typedef khronos_intptr_t GLintptr; -#else -typedef long GLintptr; -#endif -#else -#if defined(__khrplatform_h_) -typedef khronos_intptr_t GLintptr; -#else -typedef ptrdiff_t GLintptr; -#endif -#endif -#if defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && (__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ > 1060) -#if defined(__khrplatform_h_) -typedef khronos_intptr_t GLintptrARB; -#else -typedef long GLintptrARB; -#endif -#else -#if defined(__khrplatform_h_) -typedef khronos_intptr_t GLintptrARB; -#else -typedef ptrdiff_t GLintptrARB; -#endif -#endif -#if defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && (__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ > 1060) -#if defined(__khrplatform_h_) -typedef khronos_ssize_t GLsizeiptr; -#else -typedef long GLsizeiptr; -#endif -#else -#if defined(__khrplatform_h_) -typedef khronos_ssize_t GLsizeiptr; -#else -typedef ptrdiff_t GLsizeiptr; -#endif -#endif -#if defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && (__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ > 1060) -#if defined(__khrplatform_h_) -typedef khronos_ssize_t GLsizeiptrARB; -#else -typedef long GLsizeiptrARB; -#endif -#else -#if defined(__khrplatform_h_) -typedef khronos_ssize_t GLsizeiptrARB; -#else -typedef ptrdiff_t GLsizeiptrARB; -#endif -#endif -typedef int64_t GLint64; -typedef int64_t GLint64EXT; -typedef uint64_t GLuint64; -typedef uint64_t GLuint64EXT; -typedef struct __GLsync *GLsync; -struct _cl_context; -struct _cl_event; -typedef void (APIENTRY *GLDEBUGPROC)(GLenum source,GLenum type,GLuint id,GLenum severity,GLsizei length,const GLchar *message,const void *userParam); -typedef void (APIENTRY *GLDEBUGPROCARB)(GLenum source,GLenum type,GLuint id,GLenum severity,GLsizei length,const GLchar *message,const void *userParam); -typedef void (APIENTRY *GLDEBUGPROCKHR)(GLenum source,GLenum type,GLuint id,GLenum severity,GLsizei length,const GLchar *message,const void *userParam); -typedef void (APIENTRY *GLDEBUGPROCAMD)(GLuint id,GLenum category,GLenum severity,GLsizei length,const GLchar *message,void *userParam); -typedef unsigned short GLhalfNV; -typedef GLintptr GLvdpauSurfaceNV; -typedef void (APIENTRY *GLVULKANPROCNV)(void); -#define GL_DEPTH_BUFFER_BIT 0x00000100 -#define GL_STENCIL_BUFFER_BIT 0x00000400 -#define GL_COLOR_BUFFER_BIT 0x00004000 -#define GL_FALSE 0 -#define GL_TRUE 1 -#define GL_POINTS 0x0000 -#define GL_LINES 0x0001 -#define GL_LINE_LOOP 0x0002 -#define GL_LINE_STRIP 0x0003 -#define GL_TRIANGLES 0x0004 -#define GL_TRIANGLE_STRIP 0x0005 -#define GL_TRIANGLE_FAN 0x0006 -#define GL_QUADS 0x0007 -#define GL_NEVER 0x0200 -#define GL_LESS 0x0201 -#define GL_EQUAL 0x0202 -#define GL_LEQUAL 0x0203 -#define GL_GREATER 0x0204 -#define GL_NOTEQUAL 0x0205 -#define GL_GEQUAL 0x0206 -#define GL_ALWAYS 0x0207 -#define GL_ZERO 0 -#define GL_ONE 1 -#define GL_SRC_COLOR 0x0300 -#define GL_ONE_MINUS_SRC_COLOR 0x0301 -#define GL_SRC_ALPHA 0x0302 -#define GL_ONE_MINUS_SRC_ALPHA 0x0303 -#define GL_DST_ALPHA 0x0304 -#define GL_ONE_MINUS_DST_ALPHA 0x0305 -#define GL_DST_COLOR 0x0306 -#define GL_ONE_MINUS_DST_COLOR 0x0307 -#define GL_SRC_ALPHA_SATURATE 0x0308 -#define GL_NONE 0 -#define GL_FRONT_LEFT 0x0400 -#define GL_FRONT_RIGHT 0x0401 -#define GL_BACK_LEFT 0x0402 -#define GL_BACK_RIGHT 0x0403 -#define GL_FRONT 0x0404 -#define GL_BACK 0x0405 -#define GL_LEFT 0x0406 -#define GL_RIGHT 0x0407 -#define GL_FRONT_AND_BACK 0x0408 -#define GL_NO_ERROR 0 -#define GL_INVALID_ENUM 0x0500 -#define GL_INVALID_VALUE 0x0501 -#define GL_INVALID_OPERATION 0x0502 -#define GL_OUT_OF_MEMORY 0x0505 -#define GL_CW 0x0900 -#define GL_CCW 0x0901 -#define GL_POINT_SIZE 0x0B11 -#define GL_POINT_SIZE_RANGE 0x0B12 -#define GL_POINT_SIZE_GRANULARITY 0x0B13 -#define GL_LINE_SMOOTH 0x0B20 -#define GL_LINE_WIDTH 0x0B21 -#define GL_LINE_WIDTH_RANGE 0x0B22 -#define GL_LINE_WIDTH_GRANULARITY 0x0B23 -#define GL_POLYGON_MODE 0x0B40 -#define GL_POLYGON_SMOOTH 0x0B41 -#define GL_CULL_FACE 0x0B44 -#define GL_CULL_FACE_MODE 0x0B45 -#define GL_FRONT_FACE 0x0B46 -#define GL_DEPTH_RANGE 0x0B70 -#define GL_DEPTH_TEST 0x0B71 -#define GL_DEPTH_WRITEMASK 0x0B72 -#define GL_DEPTH_CLEAR_VALUE 0x0B73 -#define GL_DEPTH_FUNC 0x0B74 -#define GL_STENCIL_TEST 0x0B90 -#define GL_STENCIL_CLEAR_VALUE 0x0B91 -#define GL_STENCIL_FUNC 0x0B92 -#define GL_STENCIL_VALUE_MASK 0x0B93 -#define GL_STENCIL_FAIL 0x0B94 -#define GL_STENCIL_PASS_DEPTH_FAIL 0x0B95 -#define GL_STENCIL_PASS_DEPTH_PASS 0x0B96 -#define GL_STENCIL_REF 0x0B97 -#define GL_STENCIL_WRITEMASK 0x0B98 -#define GL_VIEWPORT 0x0BA2 -#define GL_DITHER 0x0BD0 -#define GL_BLEND_DST 0x0BE0 -#define GL_BLEND_SRC 0x0BE1 -#define GL_BLEND 0x0BE2 -#define GL_LOGIC_OP_MODE 0x0BF0 -#define GL_DRAW_BUFFER 0x0C01 -#define GL_READ_BUFFER 0x0C02 -#define GL_SCISSOR_BOX 0x0C10 -#define GL_SCISSOR_TEST 0x0C11 -#define GL_COLOR_CLEAR_VALUE 0x0C22 -#define GL_COLOR_WRITEMASK 0x0C23 -#define GL_DOUBLEBUFFER 0x0C32 -#define GL_STEREO 0x0C33 -#define GL_LINE_SMOOTH_HINT 0x0C52 -#define GL_POLYGON_SMOOTH_HINT 0x0C53 -#define GL_UNPACK_SWAP_BYTES 0x0CF0 -#define GL_UNPACK_LSB_FIRST 0x0CF1 -#define GL_UNPACK_ROW_LENGTH 0x0CF2 -#define GL_UNPACK_SKIP_ROWS 0x0CF3 -#define GL_UNPACK_SKIP_PIXELS 0x0CF4 -#define GL_UNPACK_ALIGNMENT 0x0CF5 -#define GL_PACK_SWAP_BYTES 0x0D00 -#define GL_PACK_LSB_FIRST 0x0D01 -#define GL_PACK_ROW_LENGTH 0x0D02 -#define GL_PACK_SKIP_ROWS 0x0D03 -#define GL_PACK_SKIP_PIXELS 0x0D04 -#define GL_PACK_ALIGNMENT 0x0D05 -#define GL_MAX_TEXTURE_SIZE 0x0D33 -#define GL_MAX_VIEWPORT_DIMS 0x0D3A -#define GL_SUBPIXEL_BITS 0x0D50 -#define GL_TEXTURE_1D 0x0DE0 -#define GL_TEXTURE_2D 0x0DE1 -#define GL_TEXTURE_WIDTH 0x1000 -#define GL_TEXTURE_HEIGHT 0x1001 -#define GL_TEXTURE_BORDER_COLOR 0x1004 -#define GL_DONT_CARE 0x1100 -#define GL_FASTEST 0x1101 -#define GL_NICEST 0x1102 -#define GL_BYTE 0x1400 -#define GL_UNSIGNED_BYTE 0x1401 -#define GL_SHORT 0x1402 -#define GL_UNSIGNED_SHORT 0x1403 -#define GL_INT 0x1404 -#define GL_UNSIGNED_INT 0x1405 -#define GL_FLOAT 0x1406 -#define GL_STACK_OVERFLOW 0x0503 -#define GL_STACK_UNDERFLOW 0x0504 -#define GL_CLEAR 0x1500 -#define GL_AND 0x1501 -#define GL_AND_REVERSE 0x1502 -#define GL_COPY 0x1503 -#define GL_AND_INVERTED 0x1504 -#define GL_NOOP 0x1505 -#define GL_XOR 0x1506 -#define GL_OR 0x1507 -#define GL_NOR 0x1508 -#define GL_EQUIV 0x1509 -#define GL_INVERT 0x150A -#define GL_OR_REVERSE 0x150B -#define GL_COPY_INVERTED 0x150C -#define GL_OR_INVERTED 0x150D -#define GL_NAND 0x150E -#define GL_SET 0x150F -#define GL_TEXTURE 0x1702 -#define GL_COLOR 0x1800 -#define GL_DEPTH 0x1801 -#define GL_STENCIL 0x1802 -#define GL_STENCIL_INDEX 0x1901 -#define GL_DEPTH_COMPONENT 0x1902 -#define GL_RED 0x1903 -#define GL_GREEN 0x1904 -#define GL_BLUE 0x1905 -#define GL_ALPHA 0x1906 -#define GL_RGB 0x1907 -#define GL_RGBA 0x1908 -#define GL_POINT 0x1B00 -#define GL_LINE 0x1B01 -#define GL_FILL 0x1B02 -#define GL_KEEP 0x1E00 -#define GL_REPLACE 0x1E01 -#define GL_INCR 0x1E02 -#define GL_DECR 0x1E03 -#define GL_VENDOR 0x1F00 -#define GL_RENDERER 0x1F01 -#define GL_VERSION 0x1F02 -#define GL_EXTENSIONS 0x1F03 -#define GL_NEAREST 0x2600 -#define GL_LINEAR 0x2601 -#define GL_NEAREST_MIPMAP_NEAREST 0x2700 -#define GL_LINEAR_MIPMAP_NEAREST 0x2701 -#define GL_NEAREST_MIPMAP_LINEAR 0x2702 -#define GL_LINEAR_MIPMAP_LINEAR 0x2703 -#define GL_TEXTURE_MAG_FILTER 0x2800 -#define GL_TEXTURE_MIN_FILTER 0x2801 -#define GL_TEXTURE_WRAP_S 0x2802 -#define GL_TEXTURE_WRAP_T 0x2803 -#define GL_REPEAT 0x2901 -#define GL_CURRENT_BIT 0x00000001 -#define GL_POINT_BIT 0x00000002 -#define GL_LINE_BIT 0x00000004 -#define GL_POLYGON_BIT 0x00000008 -#define GL_POLYGON_STIPPLE_BIT 0x00000010 -#define GL_PIXEL_MODE_BIT 0x00000020 -#define GL_LIGHTING_BIT 0x00000040 -#define GL_FOG_BIT 0x00000080 -#define GL_ACCUM_BUFFER_BIT 0x00000200 -#define GL_VIEWPORT_BIT 0x00000800 -#define GL_TRANSFORM_BIT 0x00001000 -#define GL_ENABLE_BIT 0x00002000 -#define GL_HINT_BIT 0x00008000 -#define GL_EVAL_BIT 0x00010000 -#define GL_LIST_BIT 0x00020000 -#define GL_TEXTURE_BIT 0x00040000 -#define GL_SCISSOR_BIT 0x00080000 -#define GL_ALL_ATTRIB_BITS 0xFFFFFFFF -#define GL_QUAD_STRIP 0x0008 -#define GL_POLYGON 0x0009 -#define GL_ACCUM 0x0100 -#define GL_LOAD 0x0101 -#define GL_RETURN 0x0102 -#define GL_MULT 0x0103 -#define GL_ADD 0x0104 -#define GL_AUX0 0x0409 -#define GL_AUX1 0x040A -#define GL_AUX2 0x040B -#define GL_AUX3 0x040C -#define GL_2D 0x0600 -#define GL_3D 0x0601 -#define GL_3D_COLOR 0x0602 -#define GL_3D_COLOR_TEXTURE 0x0603 -#define GL_4D_COLOR_TEXTURE 0x0604 -#define GL_PASS_THROUGH_TOKEN 0x0700 -#define GL_POINT_TOKEN 0x0701 -#define GL_LINE_TOKEN 0x0702 -#define GL_POLYGON_TOKEN 0x0703 -#define GL_BITMAP_TOKEN 0x0704 -#define GL_DRAW_PIXEL_TOKEN 0x0705 -#define GL_COPY_PIXEL_TOKEN 0x0706 -#define GL_LINE_RESET_TOKEN 0x0707 -#define GL_EXP 0x0800 -#define GL_EXP2 0x0801 -#define GL_COEFF 0x0A00 -#define GL_ORDER 0x0A01 -#define GL_DOMAIN 0x0A02 -#define GL_PIXEL_MAP_I_TO_I 0x0C70 -#define GL_PIXEL_MAP_S_TO_S 0x0C71 -#define GL_PIXEL_MAP_I_TO_R 0x0C72 -#define GL_PIXEL_MAP_I_TO_G 0x0C73 -#define GL_PIXEL_MAP_I_TO_B 0x0C74 -#define GL_PIXEL_MAP_I_TO_A 0x0C75 -#define GL_PIXEL_MAP_R_TO_R 0x0C76 -#define GL_PIXEL_MAP_G_TO_G 0x0C77 -#define GL_PIXEL_MAP_B_TO_B 0x0C78 -#define GL_PIXEL_MAP_A_TO_A 0x0C79 -#define GL_CURRENT_COLOR 0x0B00 -#define GL_CURRENT_INDEX 0x0B01 -#define GL_CURRENT_NORMAL 0x0B02 -#define GL_CURRENT_TEXTURE_COORDS 0x0B03 -#define GL_CURRENT_RASTER_COLOR 0x0B04 -#define GL_CURRENT_RASTER_INDEX 0x0B05 -#define GL_CURRENT_RASTER_TEXTURE_COORDS 0x0B06 -#define GL_CURRENT_RASTER_POSITION 0x0B07 -#define GL_CURRENT_RASTER_POSITION_VALID 0x0B08 -#define GL_CURRENT_RASTER_DISTANCE 0x0B09 -#define GL_POINT_SMOOTH 0x0B10 -#define GL_LINE_STIPPLE 0x0B24 -#define GL_LINE_STIPPLE_PATTERN 0x0B25 -#define GL_LINE_STIPPLE_REPEAT 0x0B26 -#define GL_LIST_MODE 0x0B30 -#define GL_MAX_LIST_NESTING 0x0B31 -#define GL_LIST_BASE 0x0B32 -#define GL_LIST_INDEX 0x0B33 -#define GL_POLYGON_STIPPLE 0x0B42 -#define GL_EDGE_FLAG 0x0B43 -#define GL_LIGHTING 0x0B50 -#define GL_LIGHT_MODEL_LOCAL_VIEWER 0x0B51 -#define GL_LIGHT_MODEL_TWO_SIDE 0x0B52 -#define GL_LIGHT_MODEL_AMBIENT 0x0B53 -#define GL_SHADE_MODEL 0x0B54 -#define GL_COLOR_MATERIAL_FACE 0x0B55 -#define GL_COLOR_MATERIAL_PARAMETER 0x0B56 -#define GL_COLOR_MATERIAL 0x0B57 -#define GL_FOG 0x0B60 -#define GL_FOG_INDEX 0x0B61 -#define GL_FOG_DENSITY 0x0B62 -#define GL_FOG_START 0x0B63 -#define GL_FOG_END 0x0B64 -#define GL_FOG_MODE 0x0B65 -#define GL_FOG_COLOR 0x0B66 -#define GL_ACCUM_CLEAR_VALUE 0x0B80 -#define GL_MATRIX_MODE 0x0BA0 -#define GL_NORMALIZE 0x0BA1 -#define GL_MODELVIEW_STACK_DEPTH 0x0BA3 -#define GL_PROJECTION_STACK_DEPTH 0x0BA4 -#define GL_TEXTURE_STACK_DEPTH 0x0BA5 -#define GL_MODELVIEW_MATRIX 0x0BA6 -#define GL_PROJECTION_MATRIX 0x0BA7 -#define GL_TEXTURE_MATRIX 0x0BA8 -#define GL_ATTRIB_STACK_DEPTH 0x0BB0 -#define GL_ALPHA_TEST 0x0BC0 -#define GL_ALPHA_TEST_FUNC 0x0BC1 -#define GL_ALPHA_TEST_REF 0x0BC2 -#define GL_LOGIC_OP 0x0BF1 -#define GL_AUX_BUFFERS 0x0C00 -#define GL_INDEX_CLEAR_VALUE 0x0C20 -#define GL_INDEX_WRITEMASK 0x0C21 -#define GL_INDEX_MODE 0x0C30 -#define GL_RGBA_MODE 0x0C31 -#define GL_RENDER_MODE 0x0C40 -#define GL_PERSPECTIVE_CORRECTION_HINT 0x0C50 -#define GL_POINT_SMOOTH_HINT 0x0C51 -#define GL_FOG_HINT 0x0C54 -#define GL_TEXTURE_GEN_S 0x0C60 -#define GL_TEXTURE_GEN_T 0x0C61 -#define GL_TEXTURE_GEN_R 0x0C62 -#define GL_TEXTURE_GEN_Q 0x0C63 -#define GL_PIXEL_MAP_I_TO_I_SIZE 0x0CB0 -#define GL_PIXEL_MAP_S_TO_S_SIZE 0x0CB1 -#define GL_PIXEL_MAP_I_TO_R_SIZE 0x0CB2 -#define GL_PIXEL_MAP_I_TO_G_SIZE 0x0CB3 -#define GL_PIXEL_MAP_I_TO_B_SIZE 0x0CB4 -#define GL_PIXEL_MAP_I_TO_A_SIZE 0x0CB5 -#define GL_PIXEL_MAP_R_TO_R_SIZE 0x0CB6 -#define GL_PIXEL_MAP_G_TO_G_SIZE 0x0CB7 -#define GL_PIXEL_MAP_B_TO_B_SIZE 0x0CB8 -#define GL_PIXEL_MAP_A_TO_A_SIZE 0x0CB9 -#define GL_MAP_COLOR 0x0D10 -#define GL_MAP_STENCIL 0x0D11 -#define GL_INDEX_SHIFT 0x0D12 -#define GL_INDEX_OFFSET 0x0D13 -#define GL_RED_SCALE 0x0D14 -#define GL_RED_BIAS 0x0D15 -#define GL_ZOOM_X 0x0D16 -#define GL_ZOOM_Y 0x0D17 -#define GL_GREEN_SCALE 0x0D18 -#define GL_GREEN_BIAS 0x0D19 -#define GL_BLUE_SCALE 0x0D1A -#define GL_BLUE_BIAS 0x0D1B -#define GL_ALPHA_SCALE 0x0D1C -#define GL_ALPHA_BIAS 0x0D1D -#define GL_DEPTH_SCALE 0x0D1E -#define GL_DEPTH_BIAS 0x0D1F -#define GL_MAX_EVAL_ORDER 0x0D30 -#define GL_MAX_LIGHTS 0x0D31 -#define GL_MAX_CLIP_PLANES 0x0D32 -#define GL_MAX_PIXEL_MAP_TABLE 0x0D34 -#define GL_MAX_ATTRIB_STACK_DEPTH 0x0D35 -#define GL_MAX_MODELVIEW_STACK_DEPTH 0x0D36 -#define GL_MAX_NAME_STACK_DEPTH 0x0D37 -#define GL_MAX_PROJECTION_STACK_DEPTH 0x0D38 -#define GL_MAX_TEXTURE_STACK_DEPTH 0x0D39 -#define GL_INDEX_BITS 0x0D51 -#define GL_RED_BITS 0x0D52 -#define GL_GREEN_BITS 0x0D53 -#define GL_BLUE_BITS 0x0D54 -#define GL_ALPHA_BITS 0x0D55 -#define GL_DEPTH_BITS 0x0D56 -#define GL_STENCIL_BITS 0x0D57 -#define GL_ACCUM_RED_BITS 0x0D58 -#define GL_ACCUM_GREEN_BITS 0x0D59 -#define GL_ACCUM_BLUE_BITS 0x0D5A -#define GL_ACCUM_ALPHA_BITS 0x0D5B -#define GL_NAME_STACK_DEPTH 0x0D70 -#define GL_AUTO_NORMAL 0x0D80 -#define GL_MAP1_COLOR_4 0x0D90 -#define GL_MAP1_INDEX 0x0D91 -#define GL_MAP1_NORMAL 0x0D92 -#define GL_MAP1_TEXTURE_COORD_1 0x0D93 -#define GL_MAP1_TEXTURE_COORD_2 0x0D94 -#define GL_MAP1_TEXTURE_COORD_3 0x0D95 -#define GL_MAP1_TEXTURE_COORD_4 0x0D96 -#define GL_MAP1_VERTEX_3 0x0D97 -#define GL_MAP1_VERTEX_4 0x0D98 -#define GL_MAP2_COLOR_4 0x0DB0 -#define GL_MAP2_INDEX 0x0DB1 -#define GL_MAP2_NORMAL 0x0DB2 -#define GL_MAP2_TEXTURE_COORD_1 0x0DB3 -#define GL_MAP2_TEXTURE_COORD_2 0x0DB4 -#define GL_MAP2_TEXTURE_COORD_3 0x0DB5 -#define GL_MAP2_TEXTURE_COORD_4 0x0DB6 -#define GL_MAP2_VERTEX_3 0x0DB7 -#define GL_MAP2_VERTEX_4 0x0DB8 -#define GL_MAP1_GRID_DOMAIN 0x0DD0 -#define GL_MAP1_GRID_SEGMENTS 0x0DD1 -#define GL_MAP2_GRID_DOMAIN 0x0DD2 -#define GL_MAP2_GRID_SEGMENTS 0x0DD3 -#define GL_TEXTURE_COMPONENTS 0x1003 -#define GL_TEXTURE_BORDER 0x1005 -#define GL_AMBIENT 0x1200 -#define GL_DIFFUSE 0x1201 -#define GL_SPECULAR 0x1202 -#define GL_POSITION 0x1203 -#define GL_SPOT_DIRECTION 0x1204 -#define GL_SPOT_EXPONENT 0x1205 -#define GL_SPOT_CUTOFF 0x1206 -#define GL_CONSTANT_ATTENUATION 0x1207 -#define GL_LINEAR_ATTENUATION 0x1208 -#define GL_QUADRATIC_ATTENUATION 0x1209 -#define GL_COMPILE 0x1300 -#define GL_COMPILE_AND_EXECUTE 0x1301 -#define GL_2_BYTES 0x1407 -#define GL_3_BYTES 0x1408 -#define GL_4_BYTES 0x1409 -#define GL_EMISSION 0x1600 -#define GL_SHININESS 0x1601 -#define GL_AMBIENT_AND_DIFFUSE 0x1602 -#define GL_COLOR_INDEXES 0x1603 -#define GL_MODELVIEW 0x1700 -#define GL_PROJECTION 0x1701 -#define GL_COLOR_INDEX 0x1900 -#define GL_LUMINANCE 0x1909 -#define GL_LUMINANCE_ALPHA 0x190A -#define GL_BITMAP 0x1A00 -#define GL_RENDER 0x1C00 -#define GL_FEEDBACK 0x1C01 -#define GL_SELECT 0x1C02 -#define GL_FLAT 0x1D00 -#define GL_SMOOTH 0x1D01 -#define GL_S 0x2000 -#define GL_T 0x2001 -#define GL_R 0x2002 -#define GL_Q 0x2003 -#define GL_MODULATE 0x2100 -#define GL_DECAL 0x2101 -#define GL_TEXTURE_ENV_MODE 0x2200 -#define GL_TEXTURE_ENV_COLOR 0x2201 -#define GL_TEXTURE_ENV 0x2300 -#define GL_EYE_LINEAR 0x2400 -#define GL_OBJECT_LINEAR 0x2401 -#define GL_SPHERE_MAP 0x2402 -#define GL_TEXTURE_GEN_MODE 0x2500 -#define GL_OBJECT_PLANE 0x2501 -#define GL_EYE_PLANE 0x2502 -#define GL_CLAMP 0x2900 -#define GL_CLIP_PLANE0 0x3000 -#define GL_CLIP_PLANE1 0x3001 -#define GL_CLIP_PLANE2 0x3002 -#define GL_CLIP_PLANE3 0x3003 -#define GL_CLIP_PLANE4 0x3004 -#define GL_CLIP_PLANE5 0x3005 -#define GL_LIGHT0 0x4000 -#define GL_LIGHT1 0x4001 -#define GL_LIGHT2 0x4002 -#define GL_LIGHT3 0x4003 -#define GL_LIGHT4 0x4004 -#define GL_LIGHT5 0x4005 -#define GL_LIGHT6 0x4006 -#define GL_LIGHT7 0x4007 -#define GL_COLOR_LOGIC_OP 0x0BF2 -#define GL_POLYGON_OFFSET_UNITS 0x2A00 -#define GL_POLYGON_OFFSET_POINT 0x2A01 -#define GL_POLYGON_OFFSET_LINE 0x2A02 -#define GL_POLYGON_OFFSET_FILL 0x8037 -#define GL_POLYGON_OFFSET_FACTOR 0x8038 -#define GL_TEXTURE_BINDING_1D 0x8068 -#define GL_TEXTURE_BINDING_2D 0x8069 -#define GL_TEXTURE_INTERNAL_FORMAT 0x1003 -#define GL_TEXTURE_RED_SIZE 0x805C -#define GL_TEXTURE_GREEN_SIZE 0x805D -#define GL_TEXTURE_BLUE_SIZE 0x805E -#define GL_TEXTURE_ALPHA_SIZE 0x805F -#define GL_DOUBLE 0x140A -#define GL_PROXY_TEXTURE_1D 0x8063 -#define GL_PROXY_TEXTURE_2D 0x8064 -#define GL_R3_G3_B2 0x2A10 -#define GL_RGB4 0x804F -#define GL_RGB5 0x8050 -#define GL_RGB8 0x8051 -#define GL_RGB10 0x8052 -#define GL_RGB12 0x8053 -#define GL_RGB16 0x8054 -#define GL_RGBA2 0x8055 -#define GL_RGBA4 0x8056 -#define GL_RGB5_A1 0x8057 -#define GL_RGBA8 0x8058 -#define GL_RGB10_A2 0x8059 -#define GL_RGBA12 0x805A -#define GL_RGBA16 0x805B -#define GL_CLIENT_PIXEL_STORE_BIT 0x00000001 -#define GL_CLIENT_VERTEX_ARRAY_BIT 0x00000002 -#define GL_CLIENT_ALL_ATTRIB_BITS 0xFFFFFFFF -#define GL_VERTEX_ARRAY_POINTER 0x808E -#define GL_NORMAL_ARRAY_POINTER 0x808F -#define GL_COLOR_ARRAY_POINTER 0x8090 -#define GL_INDEX_ARRAY_POINTER 0x8091 -#define GL_TEXTURE_COORD_ARRAY_POINTER 0x8092 -#define GL_EDGE_FLAG_ARRAY_POINTER 0x8093 -#define GL_FEEDBACK_BUFFER_POINTER 0x0DF0 -#define GL_SELECTION_BUFFER_POINTER 0x0DF3 -#define GL_CLIENT_ATTRIB_STACK_DEPTH 0x0BB1 -#define GL_INDEX_LOGIC_OP 0x0BF1 -#define GL_MAX_CLIENT_ATTRIB_STACK_DEPTH 0x0D3B -#define GL_FEEDBACK_BUFFER_SIZE 0x0DF1 -#define GL_FEEDBACK_BUFFER_TYPE 0x0DF2 -#define GL_SELECTION_BUFFER_SIZE 0x0DF4 -#define GL_VERTEX_ARRAY 0x8074 -#define GL_NORMAL_ARRAY 0x8075 -#define GL_COLOR_ARRAY 0x8076 -#define GL_INDEX_ARRAY 0x8077 -#define GL_TEXTURE_COORD_ARRAY 0x8078 -#define GL_EDGE_FLAG_ARRAY 0x8079 -#define GL_VERTEX_ARRAY_SIZE 0x807A -#define GL_VERTEX_ARRAY_TYPE 0x807B -#define GL_VERTEX_ARRAY_STRIDE 0x807C -#define GL_NORMAL_ARRAY_TYPE 0x807E -#define GL_NORMAL_ARRAY_STRIDE 0x807F -#define GL_COLOR_ARRAY_SIZE 0x8081 -#define GL_COLOR_ARRAY_TYPE 0x8082 -#define GL_COLOR_ARRAY_STRIDE 0x8083 -#define GL_INDEX_ARRAY_TYPE 0x8085 -#define GL_INDEX_ARRAY_STRIDE 0x8086 -#define GL_TEXTURE_COORD_ARRAY_SIZE 0x8088 -#define GL_TEXTURE_COORD_ARRAY_TYPE 0x8089 -#define GL_TEXTURE_COORD_ARRAY_STRIDE 0x808A -#define GL_EDGE_FLAG_ARRAY_STRIDE 0x808C -#define GL_TEXTURE_LUMINANCE_SIZE 0x8060 -#define GL_TEXTURE_INTENSITY_SIZE 0x8061 -#define GL_TEXTURE_PRIORITY 0x8066 -#define GL_TEXTURE_RESIDENT 0x8067 -#define GL_ALPHA4 0x803B -#define GL_ALPHA8 0x803C -#define GL_ALPHA12 0x803D -#define GL_ALPHA16 0x803E -#define GL_LUMINANCE4 0x803F -#define GL_LUMINANCE8 0x8040 -#define GL_LUMINANCE12 0x8041 -#define GL_LUMINANCE16 0x8042 -#define GL_LUMINANCE4_ALPHA4 0x8043 -#define GL_LUMINANCE6_ALPHA2 0x8044 -#define GL_LUMINANCE8_ALPHA8 0x8045 -#define GL_LUMINANCE12_ALPHA4 0x8046 -#define GL_LUMINANCE12_ALPHA12 0x8047 -#define GL_LUMINANCE16_ALPHA16 0x8048 -#define GL_INTENSITY 0x8049 -#define GL_INTENSITY4 0x804A -#define GL_INTENSITY8 0x804B -#define GL_INTENSITY12 0x804C -#define GL_INTENSITY16 0x804D -#define GL_V2F 0x2A20 -#define GL_V3F 0x2A21 -#define GL_C4UB_V2F 0x2A22 -#define GL_C4UB_V3F 0x2A23 -#define GL_C3F_V3F 0x2A24 -#define GL_N3F_V3F 0x2A25 -#define GL_C4F_N3F_V3F 0x2A26 -#define GL_T2F_V3F 0x2A27 -#define GL_T4F_V4F 0x2A28 -#define GL_T2F_C4UB_V3F 0x2A29 -#define GL_T2F_C3F_V3F 0x2A2A -#define GL_T2F_N3F_V3F 0x2A2B -#define GL_T2F_C4F_N3F_V3F 0x2A2C -#define GL_T4F_C4F_N3F_V4F 0x2A2D -#define GL_UNSIGNED_BYTE_3_3_2 0x8032 -#define GL_UNSIGNED_SHORT_4_4_4_4 0x8033 -#define GL_UNSIGNED_SHORT_5_5_5_1 0x8034 -#define GL_UNSIGNED_INT_8_8_8_8 0x8035 -#define GL_UNSIGNED_INT_10_10_10_2 0x8036 -#define GL_TEXTURE_BINDING_3D 0x806A -#define GL_PACK_SKIP_IMAGES 0x806B -#define GL_PACK_IMAGE_HEIGHT 0x806C -#define GL_UNPACK_SKIP_IMAGES 0x806D -#define GL_UNPACK_IMAGE_HEIGHT 0x806E -#define GL_TEXTURE_3D 0x806F -#define GL_PROXY_TEXTURE_3D 0x8070 -#define GL_TEXTURE_DEPTH 0x8071 -#define GL_TEXTURE_WRAP_R 0x8072 -#define GL_MAX_3D_TEXTURE_SIZE 0x8073 -#define GL_UNSIGNED_BYTE_2_3_3_REV 0x8362 -#define GL_UNSIGNED_SHORT_5_6_5 0x8363 -#define GL_UNSIGNED_SHORT_5_6_5_REV 0x8364 -#define GL_UNSIGNED_SHORT_4_4_4_4_REV 0x8365 -#define GL_UNSIGNED_SHORT_1_5_5_5_REV 0x8366 -#define GL_UNSIGNED_INT_8_8_8_8_REV 0x8367 -#define GL_UNSIGNED_INT_2_10_10_10_REV 0x8368 -#define GL_BGR 0x80E0 -#define GL_BGRA 0x80E1 -#define GL_MAX_ELEMENTS_VERTICES 0x80E8 -#define GL_MAX_ELEMENTS_INDICES 0x80E9 -#define GL_CLAMP_TO_EDGE 0x812F -#define GL_TEXTURE_MIN_LOD 0x813A -#define GL_TEXTURE_MAX_LOD 0x813B -#define GL_TEXTURE_BASE_LEVEL 0x813C -#define GL_TEXTURE_MAX_LEVEL 0x813D -#define GL_SMOOTH_POINT_SIZE_RANGE 0x0B12 -#define GL_SMOOTH_POINT_SIZE_GRANULARITY 0x0B13 -#define GL_SMOOTH_LINE_WIDTH_RANGE 0x0B22 -#define GL_SMOOTH_LINE_WIDTH_GRANULARITY 0x0B23 -#define GL_ALIASED_LINE_WIDTH_RANGE 0x846E -#define GL_RESCALE_NORMAL 0x803A -#define GL_LIGHT_MODEL_COLOR_CONTROL 0x81F8 -#define GL_SINGLE_COLOR 0x81F9 -#define GL_SEPARATE_SPECULAR_COLOR 0x81FA -#define GL_ALIASED_POINT_SIZE_RANGE 0x846D -#define GL_TEXTURE0 0x84C0 -#define GL_TEXTURE1 0x84C1 -#define GL_TEXTURE2 0x84C2 -#define GL_TEXTURE3 0x84C3 -#define GL_TEXTURE4 0x84C4 -#define GL_TEXTURE5 0x84C5 -#define GL_TEXTURE6 0x84C6 -#define GL_TEXTURE7 0x84C7 -#define GL_TEXTURE8 0x84C8 -#define GL_TEXTURE9 0x84C9 -#define GL_TEXTURE10 0x84CA -#define GL_TEXTURE11 0x84CB -#define GL_TEXTURE12 0x84CC -#define GL_TEXTURE13 0x84CD -#define GL_TEXTURE14 0x84CE -#define GL_TEXTURE15 0x84CF -#define GL_TEXTURE16 0x84D0 -#define GL_TEXTURE17 0x84D1 -#define GL_TEXTURE18 0x84D2 -#define GL_TEXTURE19 0x84D3 -#define GL_TEXTURE20 0x84D4 -#define GL_TEXTURE21 0x84D5 -#define GL_TEXTURE22 0x84D6 -#define GL_TEXTURE23 0x84D7 -#define GL_TEXTURE24 0x84D8 -#define GL_TEXTURE25 0x84D9 -#define GL_TEXTURE26 0x84DA -#define GL_TEXTURE27 0x84DB -#define GL_TEXTURE28 0x84DC -#define GL_TEXTURE29 0x84DD -#define GL_TEXTURE30 0x84DE -#define GL_TEXTURE31 0x84DF -#define GL_ACTIVE_TEXTURE 0x84E0 -#define GL_MULTISAMPLE 0x809D -#define GL_SAMPLE_ALPHA_TO_COVERAGE 0x809E -#define GL_SAMPLE_ALPHA_TO_ONE 0x809F -#define GL_SAMPLE_COVERAGE 0x80A0 -#define GL_SAMPLE_BUFFERS 0x80A8 -#define GL_SAMPLES 0x80A9 -#define GL_SAMPLE_COVERAGE_VALUE 0x80AA -#define GL_SAMPLE_COVERAGE_INVERT 0x80AB -#define GL_TEXTURE_CUBE_MAP 0x8513 -#define GL_TEXTURE_BINDING_CUBE_MAP 0x8514 -#define GL_TEXTURE_CUBE_MAP_POSITIVE_X 0x8515 -#define GL_TEXTURE_CUBE_MAP_NEGATIVE_X 0x8516 -#define GL_TEXTURE_CUBE_MAP_POSITIVE_Y 0x8517 -#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Y 0x8518 -#define GL_TEXTURE_CUBE_MAP_POSITIVE_Z 0x8519 -#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Z 0x851A -#define GL_PROXY_TEXTURE_CUBE_MAP 0x851B -#define GL_MAX_CUBE_MAP_TEXTURE_SIZE 0x851C -#define GL_COMPRESSED_RGB 0x84ED -#define GL_COMPRESSED_RGBA 0x84EE -#define GL_TEXTURE_COMPRESSION_HINT 0x84EF -#define GL_TEXTURE_COMPRESSED_IMAGE_SIZE 0x86A0 -#define GL_TEXTURE_COMPRESSED 0x86A1 -#define GL_NUM_COMPRESSED_TEXTURE_FORMATS 0x86A2 -#define GL_COMPRESSED_TEXTURE_FORMATS 0x86A3 -#define GL_CLAMP_TO_BORDER 0x812D -#define GL_CLIENT_ACTIVE_TEXTURE 0x84E1 -#define GL_MAX_TEXTURE_UNITS 0x84E2 -#define GL_TRANSPOSE_MODELVIEW_MATRIX 0x84E3 -#define GL_TRANSPOSE_PROJECTION_MATRIX 0x84E4 -#define GL_TRANSPOSE_TEXTURE_MATRIX 0x84E5 -#define GL_TRANSPOSE_COLOR_MATRIX 0x84E6 -#define GL_MULTISAMPLE_BIT 0x20000000 -#define GL_NORMAL_MAP 0x8511 -#define GL_REFLECTION_MAP 0x8512 -#define GL_COMPRESSED_ALPHA 0x84E9 -#define GL_COMPRESSED_LUMINANCE 0x84EA -#define GL_COMPRESSED_LUMINANCE_ALPHA 0x84EB -#define GL_COMPRESSED_INTENSITY 0x84EC -#define GL_COMBINE 0x8570 -#define GL_COMBINE_RGB 0x8571 -#define GL_COMBINE_ALPHA 0x8572 -#define GL_SOURCE0_RGB 0x8580 -#define GL_SOURCE1_RGB 0x8581 -#define GL_SOURCE2_RGB 0x8582 -#define GL_SOURCE0_ALPHA 0x8588 -#define GL_SOURCE1_ALPHA 0x8589 -#define GL_SOURCE2_ALPHA 0x858A -#define GL_OPERAND0_RGB 0x8590 -#define GL_OPERAND1_RGB 0x8591 -#define GL_OPERAND2_RGB 0x8592 -#define GL_OPERAND0_ALPHA 0x8598 -#define GL_OPERAND1_ALPHA 0x8599 -#define GL_OPERAND2_ALPHA 0x859A -#define GL_RGB_SCALE 0x8573 -#define GL_ADD_SIGNED 0x8574 -#define GL_INTERPOLATE 0x8575 -#define GL_SUBTRACT 0x84E7 -#define GL_CONSTANT 0x8576 -#define GL_PRIMARY_COLOR 0x8577 -#define GL_PREVIOUS 0x8578 -#define GL_DOT3_RGB 0x86AE -#define GL_DOT3_RGBA 0x86AF -#define GL_BLEND_DST_RGB 0x80C8 -#define GL_BLEND_SRC_RGB 0x80C9 -#define GL_BLEND_DST_ALPHA 0x80CA -#define GL_BLEND_SRC_ALPHA 0x80CB -#define GL_POINT_FADE_THRESHOLD_SIZE 0x8128 -#define GL_DEPTH_COMPONENT16 0x81A5 -#define GL_DEPTH_COMPONENT24 0x81A6 -#define GL_DEPTH_COMPONENT32 0x81A7 -#define GL_MIRRORED_REPEAT 0x8370 -#define GL_MAX_TEXTURE_LOD_BIAS 0x84FD -#define GL_TEXTURE_LOD_BIAS 0x8501 -#define GL_INCR_WRAP 0x8507 -#define GL_DECR_WRAP 0x8508 -#define GL_TEXTURE_DEPTH_SIZE 0x884A -#define GL_TEXTURE_COMPARE_MODE 0x884C -#define GL_TEXTURE_COMPARE_FUNC 0x884D -#define GL_POINT_SIZE_MIN 0x8126 -#define GL_POINT_SIZE_MAX 0x8127 -#define GL_POINT_DISTANCE_ATTENUATION 0x8129 -#define GL_GENERATE_MIPMAP 0x8191 -#define GL_GENERATE_MIPMAP_HINT 0x8192 -#define GL_FOG_COORDINATE_SOURCE 0x8450 -#define GL_FOG_COORDINATE 0x8451 -#define GL_FRAGMENT_DEPTH 0x8452 -#define GL_CURRENT_FOG_COORDINATE 0x8453 -#define GL_FOG_COORDINATE_ARRAY_TYPE 0x8454 -#define GL_FOG_COORDINATE_ARRAY_STRIDE 0x8455 -#define GL_FOG_COORDINATE_ARRAY_POINTER 0x8456 -#define GL_FOG_COORDINATE_ARRAY 0x8457 -#define GL_COLOR_SUM 0x8458 -#define GL_CURRENT_SECONDARY_COLOR 0x8459 -#define GL_SECONDARY_COLOR_ARRAY_SIZE 0x845A -#define GL_SECONDARY_COLOR_ARRAY_TYPE 0x845B -#define GL_SECONDARY_COLOR_ARRAY_STRIDE 0x845C -#define GL_SECONDARY_COLOR_ARRAY_POINTER 0x845D -#define GL_SECONDARY_COLOR_ARRAY 0x845E -#define GL_TEXTURE_FILTER_CONTROL 0x8500 -#define GL_DEPTH_TEXTURE_MODE 0x884B -#define GL_COMPARE_R_TO_TEXTURE 0x884E -#define GL_BLEND_COLOR 0x8005 -#define GL_BLEND_EQUATION 0x8009 -#define GL_CONSTANT_COLOR 0x8001 -#define GL_ONE_MINUS_CONSTANT_COLOR 0x8002 -#define GL_CONSTANT_ALPHA 0x8003 -#define GL_ONE_MINUS_CONSTANT_ALPHA 0x8004 -#define GL_FUNC_ADD 0x8006 -#define GL_FUNC_REVERSE_SUBTRACT 0x800B -#define GL_FUNC_SUBTRACT 0x800A -#define GL_MIN 0x8007 -#define GL_MAX 0x8008 -#define GL_BUFFER_SIZE 0x8764 -#define GL_BUFFER_USAGE 0x8765 -#define GL_QUERY_COUNTER_BITS 0x8864 -#define GL_CURRENT_QUERY 0x8865 -#define GL_QUERY_RESULT 0x8866 -#define GL_QUERY_RESULT_AVAILABLE 0x8867 -#define GL_ARRAY_BUFFER 0x8892 -#define GL_ELEMENT_ARRAY_BUFFER 0x8893 -#define GL_ARRAY_BUFFER_BINDING 0x8894 -#define GL_ELEMENT_ARRAY_BUFFER_BINDING 0x8895 -#define GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING 0x889F -#define GL_READ_ONLY 0x88B8 -#define GL_WRITE_ONLY 0x88B9 -#define GL_READ_WRITE 0x88BA -#define GL_BUFFER_ACCESS 0x88BB -#define GL_BUFFER_MAPPED 0x88BC -#define GL_BUFFER_MAP_POINTER 0x88BD -#define GL_STREAM_DRAW 0x88E0 -#define GL_STREAM_READ 0x88E1 -#define GL_STREAM_COPY 0x88E2 -#define GL_STATIC_DRAW 0x88E4 -#define GL_STATIC_READ 0x88E5 -#define GL_STATIC_COPY 0x88E6 -#define GL_DYNAMIC_DRAW 0x88E8 -#define GL_DYNAMIC_READ 0x88E9 -#define GL_DYNAMIC_COPY 0x88EA -#define GL_SAMPLES_PASSED 0x8914 -#define GL_SRC1_ALPHA 0x8589 -#define GL_VERTEX_ARRAY_BUFFER_BINDING 0x8896 -#define GL_NORMAL_ARRAY_BUFFER_BINDING 0x8897 -#define GL_COLOR_ARRAY_BUFFER_BINDING 0x8898 -#define GL_INDEX_ARRAY_BUFFER_BINDING 0x8899 -#define GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING 0x889A -#define GL_EDGE_FLAG_ARRAY_BUFFER_BINDING 0x889B -#define GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING 0x889C -#define GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING 0x889D -#define GL_WEIGHT_ARRAY_BUFFER_BINDING 0x889E -#define GL_FOG_COORD_SRC 0x8450 -#define GL_FOG_COORD 0x8451 -#define GL_CURRENT_FOG_COORD 0x8453 -#define GL_FOG_COORD_ARRAY_TYPE 0x8454 -#define GL_FOG_COORD_ARRAY_STRIDE 0x8455 -#define GL_FOG_COORD_ARRAY_POINTER 0x8456 -#define GL_FOG_COORD_ARRAY 0x8457 -#define GL_FOG_COORD_ARRAY_BUFFER_BINDING 0x889D -#define GL_SRC0_RGB 0x8580 -#define GL_SRC1_RGB 0x8581 -#define GL_SRC2_RGB 0x8582 -#define GL_SRC0_ALPHA 0x8588 -#define GL_SRC2_ALPHA 0x858A -#define GL_BLEND_EQUATION_RGB 0x8009 -#define GL_VERTEX_ATTRIB_ARRAY_ENABLED 0x8622 -#define GL_VERTEX_ATTRIB_ARRAY_SIZE 0x8623 -#define GL_VERTEX_ATTRIB_ARRAY_STRIDE 0x8624 -#define GL_VERTEX_ATTRIB_ARRAY_TYPE 0x8625 -#define GL_CURRENT_VERTEX_ATTRIB 0x8626 -#define GL_VERTEX_PROGRAM_POINT_SIZE 0x8642 -#define GL_VERTEX_ATTRIB_ARRAY_POINTER 0x8645 -#define GL_STENCIL_BACK_FUNC 0x8800 -#define GL_STENCIL_BACK_FAIL 0x8801 -#define GL_STENCIL_BACK_PASS_DEPTH_FAIL 0x8802 -#define GL_STENCIL_BACK_PASS_DEPTH_PASS 0x8803 -#define GL_MAX_DRAW_BUFFERS 0x8824 -#define GL_DRAW_BUFFER0 0x8825 -#define GL_DRAW_BUFFER1 0x8826 -#define GL_DRAW_BUFFER2 0x8827 -#define GL_DRAW_BUFFER3 0x8828 -#define GL_DRAW_BUFFER4 0x8829 -#define GL_DRAW_BUFFER5 0x882A -#define GL_DRAW_BUFFER6 0x882B -#define GL_DRAW_BUFFER7 0x882C -#define GL_DRAW_BUFFER8 0x882D -#define GL_DRAW_BUFFER9 0x882E -#define GL_DRAW_BUFFER10 0x882F -#define GL_DRAW_BUFFER11 0x8830 -#define GL_DRAW_BUFFER12 0x8831 -#define GL_DRAW_BUFFER13 0x8832 -#define GL_DRAW_BUFFER14 0x8833 -#define GL_DRAW_BUFFER15 0x8834 -#define GL_BLEND_EQUATION_ALPHA 0x883D -#define GL_MAX_VERTEX_ATTRIBS 0x8869 -#define GL_VERTEX_ATTRIB_ARRAY_NORMALIZED 0x886A -#define GL_MAX_TEXTURE_IMAGE_UNITS 0x8872 -#define GL_FRAGMENT_SHADER 0x8B30 -#define GL_VERTEX_SHADER 0x8B31 -#define GL_MAX_FRAGMENT_UNIFORM_COMPONENTS 0x8B49 -#define GL_MAX_VERTEX_UNIFORM_COMPONENTS 0x8B4A -#define GL_MAX_VARYING_FLOATS 0x8B4B -#define GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS 0x8B4C -#define GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS 0x8B4D -#define GL_SHADER_TYPE 0x8B4F -#define GL_FLOAT_VEC2 0x8B50 -#define GL_FLOAT_VEC3 0x8B51 -#define GL_FLOAT_VEC4 0x8B52 -#define GL_INT_VEC2 0x8B53 -#define GL_INT_VEC3 0x8B54 -#define GL_INT_VEC4 0x8B55 -#define GL_BOOL 0x8B56 -#define GL_BOOL_VEC2 0x8B57 -#define GL_BOOL_VEC3 0x8B58 -#define GL_BOOL_VEC4 0x8B59 -#define GL_FLOAT_MAT2 0x8B5A -#define GL_FLOAT_MAT3 0x8B5B -#define GL_FLOAT_MAT4 0x8B5C -#define GL_SAMPLER_1D 0x8B5D -#define GL_SAMPLER_2D 0x8B5E -#define GL_SAMPLER_3D 0x8B5F -#define GL_SAMPLER_CUBE 0x8B60 -#define GL_SAMPLER_1D_SHADOW 0x8B61 -#define GL_SAMPLER_2D_SHADOW 0x8B62 -#define GL_DELETE_STATUS 0x8B80 -#define GL_COMPILE_STATUS 0x8B81 -#define GL_LINK_STATUS 0x8B82 -#define GL_VALIDATE_STATUS 0x8B83 -#define GL_INFO_LOG_LENGTH 0x8B84 -#define GL_ATTACHED_SHADERS 0x8B85 -#define GL_ACTIVE_UNIFORMS 0x8B86 -#define GL_ACTIVE_UNIFORM_MAX_LENGTH 0x8B87 -#define GL_SHADER_SOURCE_LENGTH 0x8B88 -#define GL_ACTIVE_ATTRIBUTES 0x8B89 -#define GL_ACTIVE_ATTRIBUTE_MAX_LENGTH 0x8B8A -#define GL_FRAGMENT_SHADER_DERIVATIVE_HINT 0x8B8B -#define GL_SHADING_LANGUAGE_VERSION 0x8B8C -#define GL_CURRENT_PROGRAM 0x8B8D -#define GL_POINT_SPRITE_COORD_ORIGIN 0x8CA0 -#define GL_LOWER_LEFT 0x8CA1 -#define GL_UPPER_LEFT 0x8CA2 -#define GL_STENCIL_BACK_REF 0x8CA3 -#define GL_STENCIL_BACK_VALUE_MASK 0x8CA4 -#define GL_STENCIL_BACK_WRITEMASK 0x8CA5 -#define GL_VERTEX_PROGRAM_TWO_SIDE 0x8643 -#define GL_POINT_SPRITE 0x8861 -#define GL_COORD_REPLACE 0x8862 -#define GL_MAX_TEXTURE_COORDS 0x8871 -#define GL_PIXEL_PACK_BUFFER 0x88EB -#define GL_PIXEL_UNPACK_BUFFER 0x88EC -#define GL_PIXEL_PACK_BUFFER_BINDING 0x88ED -#define GL_PIXEL_UNPACK_BUFFER_BINDING 0x88EF -#define GL_FLOAT_MAT2x3 0x8B65 -#define GL_FLOAT_MAT2x4 0x8B66 -#define GL_FLOAT_MAT3x2 0x8B67 -#define GL_FLOAT_MAT3x4 0x8B68 -#define GL_FLOAT_MAT4x2 0x8B69 -#define GL_FLOAT_MAT4x3 0x8B6A -#define GL_SRGB 0x8C40 -#define GL_SRGB8 0x8C41 -#define GL_SRGB_ALPHA 0x8C42 -#define GL_SRGB8_ALPHA8 0x8C43 -#define GL_COMPRESSED_SRGB 0x8C48 -#define GL_COMPRESSED_SRGB_ALPHA 0x8C49 -#define GL_CURRENT_RASTER_SECONDARY_COLOR 0x845F -#define GL_SLUMINANCE_ALPHA 0x8C44 -#define GL_SLUMINANCE8_ALPHA8 0x8C45 -#define GL_SLUMINANCE 0x8C46 -#define GL_SLUMINANCE8 0x8C47 -#define GL_COMPRESSED_SLUMINANCE 0x8C4A -#define GL_COMPRESSED_SLUMINANCE_ALPHA 0x8C4B -#define GL_COMPARE_REF_TO_TEXTURE 0x884E -#define GL_CLIP_DISTANCE0 0x3000 -#define GL_CLIP_DISTANCE1 0x3001 -#define GL_CLIP_DISTANCE2 0x3002 -#define GL_CLIP_DISTANCE3 0x3003 -#define GL_CLIP_DISTANCE4 0x3004 -#define GL_CLIP_DISTANCE5 0x3005 -#define GL_CLIP_DISTANCE6 0x3006 -#define GL_CLIP_DISTANCE7 0x3007 -#define GL_MAX_CLIP_DISTANCES 0x0D32 -#define GL_MAJOR_VERSION 0x821B -#define GL_MINOR_VERSION 0x821C -#define GL_NUM_EXTENSIONS 0x821D -#define GL_CONTEXT_FLAGS 0x821E -#define GL_COMPRESSED_RED 0x8225 -#define GL_COMPRESSED_RG 0x8226 -#define GL_CONTEXT_FLAG_FORWARD_COMPATIBLE_BIT 0x00000001 -#define GL_RGBA32F 0x8814 -#define GL_RGB32F 0x8815 -#define GL_RGBA16F 0x881A -#define GL_RGB16F 0x881B -#define GL_VERTEX_ATTRIB_ARRAY_INTEGER 0x88FD -#define GL_MAX_ARRAY_TEXTURE_LAYERS 0x88FF -#define GL_MIN_PROGRAM_TEXEL_OFFSET 0x8904 -#define GL_MAX_PROGRAM_TEXEL_OFFSET 0x8905 -#define GL_CLAMP_READ_COLOR 0x891C -#define GL_FIXED_ONLY 0x891D -#define GL_MAX_VARYING_COMPONENTS 0x8B4B -#define GL_TEXTURE_1D_ARRAY 0x8C18 -#define GL_PROXY_TEXTURE_1D_ARRAY 0x8C19 -#define GL_TEXTURE_2D_ARRAY 0x8C1A -#define GL_PROXY_TEXTURE_2D_ARRAY 0x8C1B -#define GL_TEXTURE_BINDING_1D_ARRAY 0x8C1C -#define GL_TEXTURE_BINDING_2D_ARRAY 0x8C1D -#define GL_R11F_G11F_B10F 0x8C3A -#define GL_UNSIGNED_INT_10F_11F_11F_REV 0x8C3B -#define GL_RGB9_E5 0x8C3D -#define GL_UNSIGNED_INT_5_9_9_9_REV 0x8C3E -#define GL_TEXTURE_SHARED_SIZE 0x8C3F -#define GL_TRANSFORM_FEEDBACK_VARYING_MAX_LENGTH 0x8C76 -#define GL_TRANSFORM_FEEDBACK_BUFFER_MODE 0x8C7F -#define GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS 0x8C80 -#define GL_TRANSFORM_FEEDBACK_VARYINGS 0x8C83 -#define GL_TRANSFORM_FEEDBACK_BUFFER_START 0x8C84 -#define GL_TRANSFORM_FEEDBACK_BUFFER_SIZE 0x8C85 -#define GL_PRIMITIVES_GENERATED 0x8C87 -#define GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN 0x8C88 -#define GL_RASTERIZER_DISCARD 0x8C89 -#define GL_MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS 0x8C8A -#define GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS 0x8C8B -#define GL_INTERLEAVED_ATTRIBS 0x8C8C -#define GL_SEPARATE_ATTRIBS 0x8C8D -#define GL_TRANSFORM_FEEDBACK_BUFFER 0x8C8E -#define GL_TRANSFORM_FEEDBACK_BUFFER_BINDING 0x8C8F -#define GL_RGBA32UI 0x8D70 -#define GL_RGB32UI 0x8D71 -#define GL_RGBA16UI 0x8D76 -#define GL_RGB16UI 0x8D77 -#define GL_RGBA8UI 0x8D7C -#define GL_RGB8UI 0x8D7D -#define GL_RGBA32I 0x8D82 -#define GL_RGB32I 0x8D83 -#define GL_RGBA16I 0x8D88 -#define GL_RGB16I 0x8D89 -#define GL_RGBA8I 0x8D8E -#define GL_RGB8I 0x8D8F -#define GL_RED_INTEGER 0x8D94 -#define GL_GREEN_INTEGER 0x8D95 -#define GL_BLUE_INTEGER 0x8D96 -#define GL_RGB_INTEGER 0x8D98 -#define GL_RGBA_INTEGER 0x8D99 -#define GL_BGR_INTEGER 0x8D9A -#define GL_BGRA_INTEGER 0x8D9B -#define GL_SAMPLER_1D_ARRAY 0x8DC0 -#define GL_SAMPLER_2D_ARRAY 0x8DC1 -#define GL_SAMPLER_1D_ARRAY_SHADOW 0x8DC3 -#define GL_SAMPLER_2D_ARRAY_SHADOW 0x8DC4 -#define GL_SAMPLER_CUBE_SHADOW 0x8DC5 -#define GL_UNSIGNED_INT_VEC2 0x8DC6 -#define GL_UNSIGNED_INT_VEC3 0x8DC7 -#define GL_UNSIGNED_INT_VEC4 0x8DC8 -#define GL_INT_SAMPLER_1D 0x8DC9 -#define GL_INT_SAMPLER_2D 0x8DCA -#define GL_INT_SAMPLER_3D 0x8DCB -#define GL_INT_SAMPLER_CUBE 0x8DCC -#define GL_INT_SAMPLER_1D_ARRAY 0x8DCE -#define GL_INT_SAMPLER_2D_ARRAY 0x8DCF -#define GL_UNSIGNED_INT_SAMPLER_1D 0x8DD1 -#define GL_UNSIGNED_INT_SAMPLER_2D 0x8DD2 -#define GL_UNSIGNED_INT_SAMPLER_3D 0x8DD3 -#define GL_UNSIGNED_INT_SAMPLER_CUBE 0x8DD4 -#define GL_UNSIGNED_INT_SAMPLER_1D_ARRAY 0x8DD6 -#define GL_UNSIGNED_INT_SAMPLER_2D_ARRAY 0x8DD7 -#define GL_QUERY_WAIT 0x8E13 -#define GL_QUERY_NO_WAIT 0x8E14 -#define GL_QUERY_BY_REGION_WAIT 0x8E15 -#define GL_QUERY_BY_REGION_NO_WAIT 0x8E16 -#define GL_BUFFER_ACCESS_FLAGS 0x911F -#define GL_BUFFER_MAP_LENGTH 0x9120 -#define GL_BUFFER_MAP_OFFSET 0x9121 -#define GL_DEPTH_COMPONENT32F 0x8CAC -#define GL_DEPTH32F_STENCIL8 0x8CAD -#define GL_FLOAT_32_UNSIGNED_INT_24_8_REV 0x8DAD -#define GL_INVALID_FRAMEBUFFER_OPERATION 0x0506 -#define GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING 0x8210 -#define GL_FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE 0x8211 -#define GL_FRAMEBUFFER_ATTACHMENT_RED_SIZE 0x8212 -#define GL_FRAMEBUFFER_ATTACHMENT_GREEN_SIZE 0x8213 -#define GL_FRAMEBUFFER_ATTACHMENT_BLUE_SIZE 0x8214 -#define GL_FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE 0x8215 -#define GL_FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE 0x8216 -#define GL_FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE 0x8217 -#define GL_FRAMEBUFFER_DEFAULT 0x8218 -#define GL_FRAMEBUFFER_UNDEFINED 0x8219 -#define GL_DEPTH_STENCIL_ATTACHMENT 0x821A -#define GL_MAX_RENDERBUFFER_SIZE 0x84E8 -#define GL_DEPTH_STENCIL 0x84F9 -#define GL_UNSIGNED_INT_24_8 0x84FA -#define GL_DEPTH24_STENCIL8 0x88F0 -#define GL_TEXTURE_STENCIL_SIZE 0x88F1 -#define GL_TEXTURE_RED_TYPE 0x8C10 -#define GL_TEXTURE_GREEN_TYPE 0x8C11 -#define GL_TEXTURE_BLUE_TYPE 0x8C12 -#define GL_TEXTURE_ALPHA_TYPE 0x8C13 -#define GL_TEXTURE_DEPTH_TYPE 0x8C16 -#define GL_UNSIGNED_NORMALIZED 0x8C17 -#define GL_FRAMEBUFFER_BINDING 0x8CA6 -#define GL_DRAW_FRAMEBUFFER_BINDING 0x8CA6 -#define GL_RENDERBUFFER_BINDING 0x8CA7 -#define GL_READ_FRAMEBUFFER 0x8CA8 -#define GL_DRAW_FRAMEBUFFER 0x8CA9 -#define GL_READ_FRAMEBUFFER_BINDING 0x8CAA -#define GL_RENDERBUFFER_SAMPLES 0x8CAB -#define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE 0x8CD0 -#define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME 0x8CD1 -#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL 0x8CD2 -#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE 0x8CD3 -#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER 0x8CD4 -#define GL_FRAMEBUFFER_COMPLETE 0x8CD5 -#define GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT 0x8CD6 -#define GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT 0x8CD7 -#define GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER 0x8CDB -#define GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER 0x8CDC -#define GL_FRAMEBUFFER_UNSUPPORTED 0x8CDD -#define GL_MAX_COLOR_ATTACHMENTS 0x8CDF -#define GL_COLOR_ATTACHMENT0 0x8CE0 -#define GL_COLOR_ATTACHMENT1 0x8CE1 -#define GL_COLOR_ATTACHMENT2 0x8CE2 -#define GL_COLOR_ATTACHMENT3 0x8CE3 -#define GL_COLOR_ATTACHMENT4 0x8CE4 -#define GL_COLOR_ATTACHMENT5 0x8CE5 -#define GL_COLOR_ATTACHMENT6 0x8CE6 -#define GL_COLOR_ATTACHMENT7 0x8CE7 -#define GL_COLOR_ATTACHMENT8 0x8CE8 -#define GL_COLOR_ATTACHMENT9 0x8CE9 -#define GL_COLOR_ATTACHMENT10 0x8CEA -#define GL_COLOR_ATTACHMENT11 0x8CEB -#define GL_COLOR_ATTACHMENT12 0x8CEC -#define GL_COLOR_ATTACHMENT13 0x8CED -#define GL_COLOR_ATTACHMENT14 0x8CEE -#define GL_COLOR_ATTACHMENT15 0x8CEF -#define GL_COLOR_ATTACHMENT16 0x8CF0 -#define GL_COLOR_ATTACHMENT17 0x8CF1 -#define GL_COLOR_ATTACHMENT18 0x8CF2 -#define GL_COLOR_ATTACHMENT19 0x8CF3 -#define GL_COLOR_ATTACHMENT20 0x8CF4 -#define GL_COLOR_ATTACHMENT21 0x8CF5 -#define GL_COLOR_ATTACHMENT22 0x8CF6 -#define GL_COLOR_ATTACHMENT23 0x8CF7 -#define GL_COLOR_ATTACHMENT24 0x8CF8 -#define GL_COLOR_ATTACHMENT25 0x8CF9 -#define GL_COLOR_ATTACHMENT26 0x8CFA -#define GL_COLOR_ATTACHMENT27 0x8CFB -#define GL_COLOR_ATTACHMENT28 0x8CFC -#define GL_COLOR_ATTACHMENT29 0x8CFD -#define GL_COLOR_ATTACHMENT30 0x8CFE -#define GL_COLOR_ATTACHMENT31 0x8CFF -#define GL_DEPTH_ATTACHMENT 0x8D00 -#define GL_STENCIL_ATTACHMENT 0x8D20 -#define GL_FRAMEBUFFER 0x8D40 -#define GL_RENDERBUFFER 0x8D41 -#define GL_RENDERBUFFER_WIDTH 0x8D42 -#define GL_RENDERBUFFER_HEIGHT 0x8D43 -#define GL_RENDERBUFFER_INTERNAL_FORMAT 0x8D44 -#define GL_STENCIL_INDEX1 0x8D46 -#define GL_STENCIL_INDEX4 0x8D47 -#define GL_STENCIL_INDEX8 0x8D48 -#define GL_STENCIL_INDEX16 0x8D49 -#define GL_RENDERBUFFER_RED_SIZE 0x8D50 -#define GL_RENDERBUFFER_GREEN_SIZE 0x8D51 -#define GL_RENDERBUFFER_BLUE_SIZE 0x8D52 -#define GL_RENDERBUFFER_ALPHA_SIZE 0x8D53 -#define GL_RENDERBUFFER_DEPTH_SIZE 0x8D54 -#define GL_RENDERBUFFER_STENCIL_SIZE 0x8D55 -#define GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE 0x8D56 -#define GL_MAX_SAMPLES 0x8D57 -#define GL_INDEX 0x8222 -#define GL_TEXTURE_LUMINANCE_TYPE 0x8C14 -#define GL_TEXTURE_INTENSITY_TYPE 0x8C15 -#define GL_FRAMEBUFFER_SRGB 0x8DB9 -#define GL_HALF_FLOAT 0x140B -#define GL_MAP_READ_BIT 0x0001 -#define GL_MAP_WRITE_BIT 0x0002 -#define GL_MAP_INVALIDATE_RANGE_BIT 0x0004 -#define GL_MAP_INVALIDATE_BUFFER_BIT 0x0008 -#define GL_MAP_FLUSH_EXPLICIT_BIT 0x0010 -#define GL_MAP_UNSYNCHRONIZED_BIT 0x0020 -#define GL_COMPRESSED_RED_RGTC1 0x8DBB -#define GL_COMPRESSED_SIGNED_RED_RGTC1 0x8DBC -#define GL_COMPRESSED_RG_RGTC2 0x8DBD -#define GL_COMPRESSED_SIGNED_RG_RGTC2 0x8DBE -#define GL_RG 0x8227 -#define GL_RG_INTEGER 0x8228 -#define GL_R8 0x8229 -#define GL_R16 0x822A -#define GL_RG8 0x822B -#define GL_RG16 0x822C -#define GL_R16F 0x822D -#define GL_R32F 0x822E -#define GL_RG16F 0x822F -#define GL_RG32F 0x8230 -#define GL_R8I 0x8231 -#define GL_R8UI 0x8232 -#define GL_R16I 0x8233 -#define GL_R16UI 0x8234 -#define GL_R32I 0x8235 -#define GL_R32UI 0x8236 -#define GL_RG8I 0x8237 -#define GL_RG8UI 0x8238 -#define GL_RG16I 0x8239 -#define GL_RG16UI 0x823A -#define GL_RG32I 0x823B -#define GL_RG32UI 0x823C -#define GL_VERTEX_ARRAY_BINDING 0x85B5 -#define GL_CLAMP_VERTEX_COLOR 0x891A -#define GL_CLAMP_FRAGMENT_COLOR 0x891B -#define GL_ALPHA_INTEGER 0x8D97 -#define GL_SAMPLER_2D_RECT 0x8B63 -#define GL_SAMPLER_2D_RECT_SHADOW 0x8B64 -#define GL_SAMPLER_BUFFER 0x8DC2 -#define GL_INT_SAMPLER_2D_RECT 0x8DCD -#define GL_INT_SAMPLER_BUFFER 0x8DD0 -#define GL_UNSIGNED_INT_SAMPLER_2D_RECT 0x8DD5 -#define GL_UNSIGNED_INT_SAMPLER_BUFFER 0x8DD8 -#define GL_TEXTURE_BUFFER 0x8C2A -#define GL_MAX_TEXTURE_BUFFER_SIZE 0x8C2B -#define GL_TEXTURE_BINDING_BUFFER 0x8C2C -#define GL_TEXTURE_BUFFER_DATA_STORE_BINDING 0x8C2D -#define GL_TEXTURE_RECTANGLE 0x84F5 -#define GL_TEXTURE_BINDING_RECTANGLE 0x84F6 -#define GL_PROXY_TEXTURE_RECTANGLE 0x84F7 -#define GL_MAX_RECTANGLE_TEXTURE_SIZE 0x84F8 -#define GL_R8_SNORM 0x8F94 -#define GL_RG8_SNORM 0x8F95 -#define GL_RGB8_SNORM 0x8F96 -#define GL_RGBA8_SNORM 0x8F97 -#define GL_R16_SNORM 0x8F98 -#define GL_RG16_SNORM 0x8F99 -#define GL_RGB16_SNORM 0x8F9A -#define GL_RGBA16_SNORM 0x8F9B -#define GL_SIGNED_NORMALIZED 0x8F9C -#define GL_PRIMITIVE_RESTART 0x8F9D -#define GL_PRIMITIVE_RESTART_INDEX 0x8F9E -#define GL_COPY_READ_BUFFER 0x8F36 -#define GL_COPY_WRITE_BUFFER 0x8F37 -#define GL_UNIFORM_BUFFER 0x8A11 -#define GL_UNIFORM_BUFFER_BINDING 0x8A28 -#define GL_UNIFORM_BUFFER_START 0x8A29 -#define GL_UNIFORM_BUFFER_SIZE 0x8A2A -#define GL_MAX_VERTEX_UNIFORM_BLOCKS 0x8A2B -#define GL_MAX_GEOMETRY_UNIFORM_BLOCKS 0x8A2C -#define GL_MAX_FRAGMENT_UNIFORM_BLOCKS 0x8A2D -#define GL_MAX_COMBINED_UNIFORM_BLOCKS 0x8A2E -#define GL_MAX_UNIFORM_BUFFER_BINDINGS 0x8A2F -#define GL_MAX_UNIFORM_BLOCK_SIZE 0x8A30 -#define GL_MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS 0x8A31 -#define GL_MAX_COMBINED_GEOMETRY_UNIFORM_COMPONENTS 0x8A32 -#define GL_MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS 0x8A33 -#define GL_UNIFORM_BUFFER_OFFSET_ALIGNMENT 0x8A34 -#define GL_ACTIVE_UNIFORM_BLOCK_MAX_NAME_LENGTH 0x8A35 -#define GL_ACTIVE_UNIFORM_BLOCKS 0x8A36 -#define GL_UNIFORM_TYPE 0x8A37 -#define GL_UNIFORM_SIZE 0x8A38 -#define GL_UNIFORM_NAME_LENGTH 0x8A39 -#define GL_UNIFORM_BLOCK_INDEX 0x8A3A -#define GL_UNIFORM_OFFSET 0x8A3B -#define GL_UNIFORM_ARRAY_STRIDE 0x8A3C -#define GL_UNIFORM_MATRIX_STRIDE 0x8A3D -#define GL_UNIFORM_IS_ROW_MAJOR 0x8A3E -#define GL_UNIFORM_BLOCK_BINDING 0x8A3F -#define GL_UNIFORM_BLOCK_DATA_SIZE 0x8A40 -#define GL_UNIFORM_BLOCK_NAME_LENGTH 0x8A41 -#define GL_UNIFORM_BLOCK_ACTIVE_UNIFORMS 0x8A42 -#define GL_UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES 0x8A43 -#define GL_UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER 0x8A44 -#define GL_UNIFORM_BLOCK_REFERENCED_BY_GEOMETRY_SHADER 0x8A45 -#define GL_UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER 0x8A46 -#define GL_INVALID_INDEX 0xFFFFFFFF -#define GL_FIXED 0x140C -#define GL_MAX_VERTEX_UNIFORM_VECTORS 0x8DFB -#define GL_MAX_VARYING_VECTORS 0x8DFC -#define GL_MAX_FRAGMENT_UNIFORM_VECTORS 0x8DFD -#define GL_IMPLEMENTATION_COLOR_READ_TYPE 0x8B9A -#define GL_IMPLEMENTATION_COLOR_READ_FORMAT 0x8B9B -#define GL_SHADER_COMPILER 0x8DFA -#define GL_SHADER_BINARY_FORMATS 0x8DF8 -#define GL_NUM_SHADER_BINARY_FORMATS 0x8DF9 -#define GL_LOW_FLOAT 0x8DF0 -#define GL_MEDIUM_FLOAT 0x8DF1 -#define GL_HIGH_FLOAT 0x8DF2 -#define GL_LOW_INT 0x8DF3 -#define GL_MEDIUM_INT 0x8DF4 -#define GL_HIGH_INT 0x8DF5 -#define GL_RGB565 0x8D62 -#define GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS 0x8CD9 -#ifndef GL_VERSION_1_0 -#define GL_VERSION_1_0 1 -GLAPI int GLAD_GL_VERSION_1_0; -typedef void (APIENTRYP PFNGLCULLFACEPROC)(GLenum mode); -GLAPI PFNGLCULLFACEPROC glad_glCullFace; -#define glCullFace glad_glCullFace -typedef void (APIENTRYP PFNGLFRONTFACEPROC)(GLenum mode); -GLAPI PFNGLFRONTFACEPROC glad_glFrontFace; -#define glFrontFace glad_glFrontFace -typedef void (APIENTRYP PFNGLHINTPROC)(GLenum target, GLenum mode); -GLAPI PFNGLHINTPROC glad_glHint; -#define glHint glad_glHint -typedef void (APIENTRYP PFNGLLINEWIDTHPROC)(GLfloat width); -GLAPI PFNGLLINEWIDTHPROC glad_glLineWidth; -#define glLineWidth glad_glLineWidth -typedef void (APIENTRYP PFNGLPOINTSIZEPROC)(GLfloat size); -GLAPI PFNGLPOINTSIZEPROC glad_glPointSize; -#define glPointSize glad_glPointSize -typedef void (APIENTRYP PFNGLPOLYGONMODEPROC)(GLenum face, GLenum mode); -GLAPI PFNGLPOLYGONMODEPROC glad_glPolygonMode; -#define glPolygonMode glad_glPolygonMode -typedef void (APIENTRYP PFNGLSCISSORPROC)(GLint x, GLint y, GLsizei width, GLsizei height); -GLAPI PFNGLSCISSORPROC glad_glScissor; -#define glScissor glad_glScissor -typedef void (APIENTRYP PFNGLTEXPARAMETERFPROC)(GLenum target, GLenum pname, GLfloat param); -GLAPI PFNGLTEXPARAMETERFPROC glad_glTexParameterf; -#define glTexParameterf glad_glTexParameterf -typedef void (APIENTRYP PFNGLTEXPARAMETERFVPROC)(GLenum target, GLenum pname, const GLfloat *params); -GLAPI PFNGLTEXPARAMETERFVPROC glad_glTexParameterfv; -#define glTexParameterfv glad_glTexParameterfv -typedef void (APIENTRYP PFNGLTEXPARAMETERIPROC)(GLenum target, GLenum pname, GLint param); -GLAPI PFNGLTEXPARAMETERIPROC glad_glTexParameteri; -#define glTexParameteri glad_glTexParameteri -typedef void (APIENTRYP PFNGLTEXPARAMETERIVPROC)(GLenum target, GLenum pname, const GLint *params); -GLAPI PFNGLTEXPARAMETERIVPROC glad_glTexParameteriv; -#define glTexParameteriv glad_glTexParameteriv -typedef void (APIENTRYP PFNGLTEXIMAGE1DPROC)(GLenum target, GLint level, GLint internalformat, GLsizei width, GLint border, GLenum format, GLenum type, const void *pixels); -GLAPI PFNGLTEXIMAGE1DPROC glad_glTexImage1D; -#define glTexImage1D glad_glTexImage1D -typedef void (APIENTRYP PFNGLTEXIMAGE2DPROC)(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const void *pixels); -GLAPI PFNGLTEXIMAGE2DPROC glad_glTexImage2D; -#define glTexImage2D glad_glTexImage2D -typedef void (APIENTRYP PFNGLDRAWBUFFERPROC)(GLenum buf); -GLAPI PFNGLDRAWBUFFERPROC glad_glDrawBuffer; -#define glDrawBuffer glad_glDrawBuffer -typedef void (APIENTRYP PFNGLCLEARPROC)(GLbitfield mask); -GLAPI PFNGLCLEARPROC glad_glClear; -#define glClear glad_glClear -typedef void (APIENTRYP PFNGLCLEARCOLORPROC)(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha); -GLAPI PFNGLCLEARCOLORPROC glad_glClearColor; -#define glClearColor glad_glClearColor -typedef void (APIENTRYP PFNGLCLEARSTENCILPROC)(GLint s); -GLAPI PFNGLCLEARSTENCILPROC glad_glClearStencil; -#define glClearStencil glad_glClearStencil -typedef void (APIENTRYP PFNGLCLEARDEPTHPROC)(GLdouble depth); -GLAPI PFNGLCLEARDEPTHPROC glad_glClearDepth; -#define glClearDepth glad_glClearDepth -typedef void (APIENTRYP PFNGLSTENCILMASKPROC)(GLuint mask); -GLAPI PFNGLSTENCILMASKPROC glad_glStencilMask; -#define glStencilMask glad_glStencilMask -typedef void (APIENTRYP PFNGLCOLORMASKPROC)(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha); -GLAPI PFNGLCOLORMASKPROC glad_glColorMask; -#define glColorMask glad_glColorMask -typedef void (APIENTRYP PFNGLDEPTHMASKPROC)(GLboolean flag); -GLAPI PFNGLDEPTHMASKPROC glad_glDepthMask; -#define glDepthMask glad_glDepthMask -typedef void (APIENTRYP PFNGLDISABLEPROC)(GLenum cap); -GLAPI PFNGLDISABLEPROC glad_glDisable; -#define glDisable glad_glDisable -typedef void (APIENTRYP PFNGLENABLEPROC)(GLenum cap); -GLAPI PFNGLENABLEPROC glad_glEnable; -#define glEnable glad_glEnable -typedef void (APIENTRYP PFNGLFINISHPROC)(void); -GLAPI PFNGLFINISHPROC glad_glFinish; -#define glFinish glad_glFinish -typedef void (APIENTRYP PFNGLFLUSHPROC)(void); -GLAPI PFNGLFLUSHPROC glad_glFlush; -#define glFlush glad_glFlush -typedef void (APIENTRYP PFNGLBLENDFUNCPROC)(GLenum sfactor, GLenum dfactor); -GLAPI PFNGLBLENDFUNCPROC glad_glBlendFunc; -#define glBlendFunc glad_glBlendFunc -typedef void (APIENTRYP PFNGLLOGICOPPROC)(GLenum opcode); -GLAPI PFNGLLOGICOPPROC glad_glLogicOp; -#define glLogicOp glad_glLogicOp -typedef void (APIENTRYP PFNGLSTENCILFUNCPROC)(GLenum func, GLint ref, GLuint mask); -GLAPI PFNGLSTENCILFUNCPROC glad_glStencilFunc; -#define glStencilFunc glad_glStencilFunc -typedef void (APIENTRYP PFNGLSTENCILOPPROC)(GLenum fail, GLenum zfail, GLenum zpass); -GLAPI PFNGLSTENCILOPPROC glad_glStencilOp; -#define glStencilOp glad_glStencilOp -typedef void (APIENTRYP PFNGLDEPTHFUNCPROC)(GLenum func); -GLAPI PFNGLDEPTHFUNCPROC glad_glDepthFunc; -#define glDepthFunc glad_glDepthFunc -typedef void (APIENTRYP PFNGLPIXELSTOREFPROC)(GLenum pname, GLfloat param); -GLAPI PFNGLPIXELSTOREFPROC glad_glPixelStoref; -#define glPixelStoref glad_glPixelStoref -typedef void (APIENTRYP PFNGLPIXELSTOREIPROC)(GLenum pname, GLint param); -GLAPI PFNGLPIXELSTOREIPROC glad_glPixelStorei; -#define glPixelStorei glad_glPixelStorei -typedef void (APIENTRYP PFNGLREADBUFFERPROC)(GLenum src); -GLAPI PFNGLREADBUFFERPROC glad_glReadBuffer; -#define glReadBuffer glad_glReadBuffer -typedef void (APIENTRYP PFNGLREADPIXELSPROC)(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, void *pixels); -GLAPI PFNGLREADPIXELSPROC glad_glReadPixels; -#define glReadPixels glad_glReadPixels -typedef void (APIENTRYP PFNGLGETBOOLEANVPROC)(GLenum pname, GLboolean *data); -GLAPI PFNGLGETBOOLEANVPROC glad_glGetBooleanv; -#define glGetBooleanv glad_glGetBooleanv -typedef void (APIENTRYP PFNGLGETDOUBLEVPROC)(GLenum pname, GLdouble *data); -GLAPI PFNGLGETDOUBLEVPROC glad_glGetDoublev; -#define glGetDoublev glad_glGetDoublev -typedef GLenum (APIENTRYP PFNGLGETERRORPROC)(void); -GLAPI PFNGLGETERRORPROC glad_glGetError; -#define glGetError glad_glGetError -typedef void (APIENTRYP PFNGLGETFLOATVPROC)(GLenum pname, GLfloat *data); -GLAPI PFNGLGETFLOATVPROC glad_glGetFloatv; -#define glGetFloatv glad_glGetFloatv -typedef void (APIENTRYP PFNGLGETINTEGERVPROC)(GLenum pname, GLint *data); -GLAPI PFNGLGETINTEGERVPROC glad_glGetIntegerv; -#define glGetIntegerv glad_glGetIntegerv -typedef const GLubyte * (APIENTRYP PFNGLGETSTRINGPROC)(GLenum name); -GLAPI PFNGLGETSTRINGPROC glad_glGetString; -#define glGetString glad_glGetString -typedef void (APIENTRYP PFNGLGETTEXIMAGEPROC)(GLenum target, GLint level, GLenum format, GLenum type, void *pixels); -GLAPI PFNGLGETTEXIMAGEPROC glad_glGetTexImage; -#define glGetTexImage glad_glGetTexImage -typedef void (APIENTRYP PFNGLGETTEXPARAMETERFVPROC)(GLenum target, GLenum pname, GLfloat *params); -GLAPI PFNGLGETTEXPARAMETERFVPROC glad_glGetTexParameterfv; -#define glGetTexParameterfv glad_glGetTexParameterfv -typedef void (APIENTRYP PFNGLGETTEXPARAMETERIVPROC)(GLenum target, GLenum pname, GLint *params); -GLAPI PFNGLGETTEXPARAMETERIVPROC glad_glGetTexParameteriv; -#define glGetTexParameteriv glad_glGetTexParameteriv -typedef void (APIENTRYP PFNGLGETTEXLEVELPARAMETERFVPROC)(GLenum target, GLint level, GLenum pname, GLfloat *params); -GLAPI PFNGLGETTEXLEVELPARAMETERFVPROC glad_glGetTexLevelParameterfv; -#define glGetTexLevelParameterfv glad_glGetTexLevelParameterfv -typedef void (APIENTRYP PFNGLGETTEXLEVELPARAMETERIVPROC)(GLenum target, GLint level, GLenum pname, GLint *params); -GLAPI PFNGLGETTEXLEVELPARAMETERIVPROC glad_glGetTexLevelParameteriv; -#define glGetTexLevelParameteriv glad_glGetTexLevelParameteriv -typedef GLboolean (APIENTRYP PFNGLISENABLEDPROC)(GLenum cap); -GLAPI PFNGLISENABLEDPROC glad_glIsEnabled; -#define glIsEnabled glad_glIsEnabled -typedef void (APIENTRYP PFNGLDEPTHRANGEPROC)(GLdouble n, GLdouble f); -GLAPI PFNGLDEPTHRANGEPROC glad_glDepthRange; -#define glDepthRange glad_glDepthRange -typedef void (APIENTRYP PFNGLVIEWPORTPROC)(GLint x, GLint y, GLsizei width, GLsizei height); -GLAPI PFNGLVIEWPORTPROC glad_glViewport; -#define glViewport glad_glViewport -typedef void (APIENTRYP PFNGLNEWLISTPROC)(GLuint list, GLenum mode); -GLAPI PFNGLNEWLISTPROC glad_glNewList; -#define glNewList glad_glNewList -typedef void (APIENTRYP PFNGLENDLISTPROC)(void); -GLAPI PFNGLENDLISTPROC glad_glEndList; -#define glEndList glad_glEndList -typedef void (APIENTRYP PFNGLCALLLISTPROC)(GLuint list); -GLAPI PFNGLCALLLISTPROC glad_glCallList; -#define glCallList glad_glCallList -typedef void (APIENTRYP PFNGLCALLLISTSPROC)(GLsizei n, GLenum type, const void *lists); -GLAPI PFNGLCALLLISTSPROC glad_glCallLists; -#define glCallLists glad_glCallLists -typedef void (APIENTRYP PFNGLDELETELISTSPROC)(GLuint list, GLsizei range); -GLAPI PFNGLDELETELISTSPROC glad_glDeleteLists; -#define glDeleteLists glad_glDeleteLists -typedef GLuint (APIENTRYP PFNGLGENLISTSPROC)(GLsizei range); -GLAPI PFNGLGENLISTSPROC glad_glGenLists; -#define glGenLists glad_glGenLists -typedef void (APIENTRYP PFNGLLISTBASEPROC)(GLuint base); -GLAPI PFNGLLISTBASEPROC glad_glListBase; -#define glListBase glad_glListBase -typedef void (APIENTRYP PFNGLBEGINPROC)(GLenum mode); -GLAPI PFNGLBEGINPROC glad_glBegin; -#define glBegin glad_glBegin -typedef void (APIENTRYP PFNGLBITMAPPROC)(GLsizei width, GLsizei height, GLfloat xorig, GLfloat yorig, GLfloat xmove, GLfloat ymove, const GLubyte *bitmap); -GLAPI PFNGLBITMAPPROC glad_glBitmap; -#define glBitmap glad_glBitmap -typedef void (APIENTRYP PFNGLCOLOR3BPROC)(GLbyte red, GLbyte green, GLbyte blue); -GLAPI PFNGLCOLOR3BPROC glad_glColor3b; -#define glColor3b glad_glColor3b -typedef void (APIENTRYP PFNGLCOLOR3BVPROC)(const GLbyte *v); -GLAPI PFNGLCOLOR3BVPROC glad_glColor3bv; -#define glColor3bv glad_glColor3bv -typedef void (APIENTRYP PFNGLCOLOR3DPROC)(GLdouble red, GLdouble green, GLdouble blue); -GLAPI PFNGLCOLOR3DPROC glad_glColor3d; -#define glColor3d glad_glColor3d -typedef void (APIENTRYP PFNGLCOLOR3DVPROC)(const GLdouble *v); -GLAPI PFNGLCOLOR3DVPROC glad_glColor3dv; -#define glColor3dv glad_glColor3dv -typedef void (APIENTRYP PFNGLCOLOR3FPROC)(GLfloat red, GLfloat green, GLfloat blue); -GLAPI PFNGLCOLOR3FPROC glad_glColor3f; -#define glColor3f glad_glColor3f -typedef void (APIENTRYP PFNGLCOLOR3FVPROC)(const GLfloat *v); -GLAPI PFNGLCOLOR3FVPROC glad_glColor3fv; -#define glColor3fv glad_glColor3fv -typedef void (APIENTRYP PFNGLCOLOR3IPROC)(GLint red, GLint green, GLint blue); -GLAPI PFNGLCOLOR3IPROC glad_glColor3i; -#define glColor3i glad_glColor3i -typedef void (APIENTRYP PFNGLCOLOR3IVPROC)(const GLint *v); -GLAPI PFNGLCOLOR3IVPROC glad_glColor3iv; -#define glColor3iv glad_glColor3iv -typedef void (APIENTRYP PFNGLCOLOR3SPROC)(GLshort red, GLshort green, GLshort blue); -GLAPI PFNGLCOLOR3SPROC glad_glColor3s; -#define glColor3s glad_glColor3s -typedef void (APIENTRYP PFNGLCOLOR3SVPROC)(const GLshort *v); -GLAPI PFNGLCOLOR3SVPROC glad_glColor3sv; -#define glColor3sv glad_glColor3sv -typedef void (APIENTRYP PFNGLCOLOR3UBPROC)(GLubyte red, GLubyte green, GLubyte blue); -GLAPI PFNGLCOLOR3UBPROC glad_glColor3ub; -#define glColor3ub glad_glColor3ub -typedef void (APIENTRYP PFNGLCOLOR3UBVPROC)(const GLubyte *v); -GLAPI PFNGLCOLOR3UBVPROC glad_glColor3ubv; -#define glColor3ubv glad_glColor3ubv -typedef void (APIENTRYP PFNGLCOLOR3UIPROC)(GLuint red, GLuint green, GLuint blue); -GLAPI PFNGLCOLOR3UIPROC glad_glColor3ui; -#define glColor3ui glad_glColor3ui -typedef void (APIENTRYP PFNGLCOLOR3UIVPROC)(const GLuint *v); -GLAPI PFNGLCOLOR3UIVPROC glad_glColor3uiv; -#define glColor3uiv glad_glColor3uiv -typedef void (APIENTRYP PFNGLCOLOR3USPROC)(GLushort red, GLushort green, GLushort blue); -GLAPI PFNGLCOLOR3USPROC glad_glColor3us; -#define glColor3us glad_glColor3us -typedef void (APIENTRYP PFNGLCOLOR3USVPROC)(const GLushort *v); -GLAPI PFNGLCOLOR3USVPROC glad_glColor3usv; -#define glColor3usv glad_glColor3usv -typedef void (APIENTRYP PFNGLCOLOR4BPROC)(GLbyte red, GLbyte green, GLbyte blue, GLbyte alpha); -GLAPI PFNGLCOLOR4BPROC glad_glColor4b; -#define glColor4b glad_glColor4b -typedef void (APIENTRYP PFNGLCOLOR4BVPROC)(const GLbyte *v); -GLAPI PFNGLCOLOR4BVPROC glad_glColor4bv; -#define glColor4bv glad_glColor4bv -typedef void (APIENTRYP PFNGLCOLOR4DPROC)(GLdouble red, GLdouble green, GLdouble blue, GLdouble alpha); -GLAPI PFNGLCOLOR4DPROC glad_glColor4d; -#define glColor4d glad_glColor4d -typedef void (APIENTRYP PFNGLCOLOR4DVPROC)(const GLdouble *v); -GLAPI PFNGLCOLOR4DVPROC glad_glColor4dv; -#define glColor4dv glad_glColor4dv -typedef void (APIENTRYP PFNGLCOLOR4FPROC)(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha); -GLAPI PFNGLCOLOR4FPROC glad_glColor4f; -#define glColor4f glad_glColor4f -typedef void (APIENTRYP PFNGLCOLOR4FVPROC)(const GLfloat *v); -GLAPI PFNGLCOLOR4FVPROC glad_glColor4fv; -#define glColor4fv glad_glColor4fv -typedef void (APIENTRYP PFNGLCOLOR4IPROC)(GLint red, GLint green, GLint blue, GLint alpha); -GLAPI PFNGLCOLOR4IPROC glad_glColor4i; -#define glColor4i glad_glColor4i -typedef void (APIENTRYP PFNGLCOLOR4IVPROC)(const GLint *v); -GLAPI PFNGLCOLOR4IVPROC glad_glColor4iv; -#define glColor4iv glad_glColor4iv -typedef void (APIENTRYP PFNGLCOLOR4SPROC)(GLshort red, GLshort green, GLshort blue, GLshort alpha); -GLAPI PFNGLCOLOR4SPROC glad_glColor4s; -#define glColor4s glad_glColor4s -typedef void (APIENTRYP PFNGLCOLOR4SVPROC)(const GLshort *v); -GLAPI PFNGLCOLOR4SVPROC glad_glColor4sv; -#define glColor4sv glad_glColor4sv -typedef void (APIENTRYP PFNGLCOLOR4UBPROC)(GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha); -GLAPI PFNGLCOLOR4UBPROC glad_glColor4ub; -#define glColor4ub glad_glColor4ub -typedef void (APIENTRYP PFNGLCOLOR4UBVPROC)(const GLubyte *v); -GLAPI PFNGLCOLOR4UBVPROC glad_glColor4ubv; -#define glColor4ubv glad_glColor4ubv -typedef void (APIENTRYP PFNGLCOLOR4UIPROC)(GLuint red, GLuint green, GLuint blue, GLuint alpha); -GLAPI PFNGLCOLOR4UIPROC glad_glColor4ui; -#define glColor4ui glad_glColor4ui -typedef void (APIENTRYP PFNGLCOLOR4UIVPROC)(const GLuint *v); -GLAPI PFNGLCOLOR4UIVPROC glad_glColor4uiv; -#define glColor4uiv glad_glColor4uiv -typedef void (APIENTRYP PFNGLCOLOR4USPROC)(GLushort red, GLushort green, GLushort blue, GLushort alpha); -GLAPI PFNGLCOLOR4USPROC glad_glColor4us; -#define glColor4us glad_glColor4us -typedef void (APIENTRYP PFNGLCOLOR4USVPROC)(const GLushort *v); -GLAPI PFNGLCOLOR4USVPROC glad_glColor4usv; -#define glColor4usv glad_glColor4usv -typedef void (APIENTRYP PFNGLEDGEFLAGPROC)(GLboolean flag); -GLAPI PFNGLEDGEFLAGPROC glad_glEdgeFlag; -#define glEdgeFlag glad_glEdgeFlag -typedef void (APIENTRYP PFNGLEDGEFLAGVPROC)(const GLboolean *flag); -GLAPI PFNGLEDGEFLAGVPROC glad_glEdgeFlagv; -#define glEdgeFlagv glad_glEdgeFlagv -typedef void (APIENTRYP PFNGLENDPROC)(void); -GLAPI PFNGLENDPROC glad_glEnd; -#define glEnd glad_glEnd -typedef void (APIENTRYP PFNGLINDEXDPROC)(GLdouble c); -GLAPI PFNGLINDEXDPROC glad_glIndexd; -#define glIndexd glad_glIndexd -typedef void (APIENTRYP PFNGLINDEXDVPROC)(const GLdouble *c); -GLAPI PFNGLINDEXDVPROC glad_glIndexdv; -#define glIndexdv glad_glIndexdv -typedef void (APIENTRYP PFNGLINDEXFPROC)(GLfloat c); -GLAPI PFNGLINDEXFPROC glad_glIndexf; -#define glIndexf glad_glIndexf -typedef void (APIENTRYP PFNGLINDEXFVPROC)(const GLfloat *c); -GLAPI PFNGLINDEXFVPROC glad_glIndexfv; -#define glIndexfv glad_glIndexfv -typedef void (APIENTRYP PFNGLINDEXIPROC)(GLint c); -GLAPI PFNGLINDEXIPROC glad_glIndexi; -#define glIndexi glad_glIndexi -typedef void (APIENTRYP PFNGLINDEXIVPROC)(const GLint *c); -GLAPI PFNGLINDEXIVPROC glad_glIndexiv; -#define glIndexiv glad_glIndexiv -typedef void (APIENTRYP PFNGLINDEXSPROC)(GLshort c); -GLAPI PFNGLINDEXSPROC glad_glIndexs; -#define glIndexs glad_glIndexs -typedef void (APIENTRYP PFNGLINDEXSVPROC)(const GLshort *c); -GLAPI PFNGLINDEXSVPROC glad_glIndexsv; -#define glIndexsv glad_glIndexsv -typedef void (APIENTRYP PFNGLNORMAL3BPROC)(GLbyte nx, GLbyte ny, GLbyte nz); -GLAPI PFNGLNORMAL3BPROC glad_glNormal3b; -#define glNormal3b glad_glNormal3b -typedef void (APIENTRYP PFNGLNORMAL3BVPROC)(const GLbyte *v); -GLAPI PFNGLNORMAL3BVPROC glad_glNormal3bv; -#define glNormal3bv glad_glNormal3bv -typedef void (APIENTRYP PFNGLNORMAL3DPROC)(GLdouble nx, GLdouble ny, GLdouble nz); -GLAPI PFNGLNORMAL3DPROC glad_glNormal3d; -#define glNormal3d glad_glNormal3d -typedef void (APIENTRYP PFNGLNORMAL3DVPROC)(const GLdouble *v); -GLAPI PFNGLNORMAL3DVPROC glad_glNormal3dv; -#define glNormal3dv glad_glNormal3dv -typedef void (APIENTRYP PFNGLNORMAL3FPROC)(GLfloat nx, GLfloat ny, GLfloat nz); -GLAPI PFNGLNORMAL3FPROC glad_glNormal3f; -#define glNormal3f glad_glNormal3f -typedef void (APIENTRYP PFNGLNORMAL3FVPROC)(const GLfloat *v); -GLAPI PFNGLNORMAL3FVPROC glad_glNormal3fv; -#define glNormal3fv glad_glNormal3fv -typedef void (APIENTRYP PFNGLNORMAL3IPROC)(GLint nx, GLint ny, GLint nz); -GLAPI PFNGLNORMAL3IPROC glad_glNormal3i; -#define glNormal3i glad_glNormal3i -typedef void (APIENTRYP PFNGLNORMAL3IVPROC)(const GLint *v); -GLAPI PFNGLNORMAL3IVPROC glad_glNormal3iv; -#define glNormal3iv glad_glNormal3iv -typedef void (APIENTRYP PFNGLNORMAL3SPROC)(GLshort nx, GLshort ny, GLshort nz); -GLAPI PFNGLNORMAL3SPROC glad_glNormal3s; -#define glNormal3s glad_glNormal3s -typedef void (APIENTRYP PFNGLNORMAL3SVPROC)(const GLshort *v); -GLAPI PFNGLNORMAL3SVPROC glad_glNormal3sv; -#define glNormal3sv glad_glNormal3sv -typedef void (APIENTRYP PFNGLRASTERPOS2DPROC)(GLdouble x, GLdouble y); -GLAPI PFNGLRASTERPOS2DPROC glad_glRasterPos2d; -#define glRasterPos2d glad_glRasterPos2d -typedef void (APIENTRYP PFNGLRASTERPOS2DVPROC)(const GLdouble *v); -GLAPI PFNGLRASTERPOS2DVPROC glad_glRasterPos2dv; -#define glRasterPos2dv glad_glRasterPos2dv -typedef void (APIENTRYP PFNGLRASTERPOS2FPROC)(GLfloat x, GLfloat y); -GLAPI PFNGLRASTERPOS2FPROC glad_glRasterPos2f; -#define glRasterPos2f glad_glRasterPos2f -typedef void (APIENTRYP PFNGLRASTERPOS2FVPROC)(const GLfloat *v); -GLAPI PFNGLRASTERPOS2FVPROC glad_glRasterPos2fv; -#define glRasterPos2fv glad_glRasterPos2fv -typedef void (APIENTRYP PFNGLRASTERPOS2IPROC)(GLint x, GLint y); -GLAPI PFNGLRASTERPOS2IPROC glad_glRasterPos2i; -#define glRasterPos2i glad_glRasterPos2i -typedef void (APIENTRYP PFNGLRASTERPOS2IVPROC)(const GLint *v); -GLAPI PFNGLRASTERPOS2IVPROC glad_glRasterPos2iv; -#define glRasterPos2iv glad_glRasterPos2iv -typedef void (APIENTRYP PFNGLRASTERPOS2SPROC)(GLshort x, GLshort y); -GLAPI PFNGLRASTERPOS2SPROC glad_glRasterPos2s; -#define glRasterPos2s glad_glRasterPos2s -typedef void (APIENTRYP PFNGLRASTERPOS2SVPROC)(const GLshort *v); -GLAPI PFNGLRASTERPOS2SVPROC glad_glRasterPos2sv; -#define glRasterPos2sv glad_glRasterPos2sv -typedef void (APIENTRYP PFNGLRASTERPOS3DPROC)(GLdouble x, GLdouble y, GLdouble z); -GLAPI PFNGLRASTERPOS3DPROC glad_glRasterPos3d; -#define glRasterPos3d glad_glRasterPos3d -typedef void (APIENTRYP PFNGLRASTERPOS3DVPROC)(const GLdouble *v); -GLAPI PFNGLRASTERPOS3DVPROC glad_glRasterPos3dv; -#define glRasterPos3dv glad_glRasterPos3dv -typedef void (APIENTRYP PFNGLRASTERPOS3FPROC)(GLfloat x, GLfloat y, GLfloat z); -GLAPI PFNGLRASTERPOS3FPROC glad_glRasterPos3f; -#define glRasterPos3f glad_glRasterPos3f -typedef void (APIENTRYP PFNGLRASTERPOS3FVPROC)(const GLfloat *v); -GLAPI PFNGLRASTERPOS3FVPROC glad_glRasterPos3fv; -#define glRasterPos3fv glad_glRasterPos3fv -typedef void (APIENTRYP PFNGLRASTERPOS3IPROC)(GLint x, GLint y, GLint z); -GLAPI PFNGLRASTERPOS3IPROC glad_glRasterPos3i; -#define glRasterPos3i glad_glRasterPos3i -typedef void (APIENTRYP PFNGLRASTERPOS3IVPROC)(const GLint *v); -GLAPI PFNGLRASTERPOS3IVPROC glad_glRasterPos3iv; -#define glRasterPos3iv glad_glRasterPos3iv -typedef void (APIENTRYP PFNGLRASTERPOS3SPROC)(GLshort x, GLshort y, GLshort z); -GLAPI PFNGLRASTERPOS3SPROC glad_glRasterPos3s; -#define glRasterPos3s glad_glRasterPos3s -typedef void (APIENTRYP PFNGLRASTERPOS3SVPROC)(const GLshort *v); -GLAPI PFNGLRASTERPOS3SVPROC glad_glRasterPos3sv; -#define glRasterPos3sv glad_glRasterPos3sv -typedef void (APIENTRYP PFNGLRASTERPOS4DPROC)(GLdouble x, GLdouble y, GLdouble z, GLdouble w); -GLAPI PFNGLRASTERPOS4DPROC glad_glRasterPos4d; -#define glRasterPos4d glad_glRasterPos4d -typedef void (APIENTRYP PFNGLRASTERPOS4DVPROC)(const GLdouble *v); -GLAPI PFNGLRASTERPOS4DVPROC glad_glRasterPos4dv; -#define glRasterPos4dv glad_glRasterPos4dv -typedef void (APIENTRYP PFNGLRASTERPOS4FPROC)(GLfloat x, GLfloat y, GLfloat z, GLfloat w); -GLAPI PFNGLRASTERPOS4FPROC glad_glRasterPos4f; -#define glRasterPos4f glad_glRasterPos4f -typedef void (APIENTRYP PFNGLRASTERPOS4FVPROC)(const GLfloat *v); -GLAPI PFNGLRASTERPOS4FVPROC glad_glRasterPos4fv; -#define glRasterPos4fv glad_glRasterPos4fv -typedef void (APIENTRYP PFNGLRASTERPOS4IPROC)(GLint x, GLint y, GLint z, GLint w); -GLAPI PFNGLRASTERPOS4IPROC glad_glRasterPos4i; -#define glRasterPos4i glad_glRasterPos4i -typedef void (APIENTRYP PFNGLRASTERPOS4IVPROC)(const GLint *v); -GLAPI PFNGLRASTERPOS4IVPROC glad_glRasterPos4iv; -#define glRasterPos4iv glad_glRasterPos4iv -typedef void (APIENTRYP PFNGLRASTERPOS4SPROC)(GLshort x, GLshort y, GLshort z, GLshort w); -GLAPI PFNGLRASTERPOS4SPROC glad_glRasterPos4s; -#define glRasterPos4s glad_glRasterPos4s -typedef void (APIENTRYP PFNGLRASTERPOS4SVPROC)(const GLshort *v); -GLAPI PFNGLRASTERPOS4SVPROC glad_glRasterPos4sv; -#define glRasterPos4sv glad_glRasterPos4sv -typedef void (APIENTRYP PFNGLRECTDPROC)(GLdouble x1, GLdouble y1, GLdouble x2, GLdouble y2); -GLAPI PFNGLRECTDPROC glad_glRectd; -#define glRectd glad_glRectd -typedef void (APIENTRYP PFNGLRECTDVPROC)(const GLdouble *v1, const GLdouble *v2); -GLAPI PFNGLRECTDVPROC glad_glRectdv; -#define glRectdv glad_glRectdv -typedef void (APIENTRYP PFNGLRECTFPROC)(GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2); -GLAPI PFNGLRECTFPROC glad_glRectf; -#define glRectf glad_glRectf -typedef void (APIENTRYP PFNGLRECTFVPROC)(const GLfloat *v1, const GLfloat *v2); -GLAPI PFNGLRECTFVPROC glad_glRectfv; -#define glRectfv glad_glRectfv -typedef void (APIENTRYP PFNGLRECTIPROC)(GLint x1, GLint y1, GLint x2, GLint y2); -GLAPI PFNGLRECTIPROC glad_glRecti; -#define glRecti glad_glRecti -typedef void (APIENTRYP PFNGLRECTIVPROC)(const GLint *v1, const GLint *v2); -GLAPI PFNGLRECTIVPROC glad_glRectiv; -#define glRectiv glad_glRectiv -typedef void (APIENTRYP PFNGLRECTSPROC)(GLshort x1, GLshort y1, GLshort x2, GLshort y2); -GLAPI PFNGLRECTSPROC glad_glRects; -#define glRects glad_glRects -typedef void (APIENTRYP PFNGLRECTSVPROC)(const GLshort *v1, const GLshort *v2); -GLAPI PFNGLRECTSVPROC glad_glRectsv; -#define glRectsv glad_glRectsv -typedef void (APIENTRYP PFNGLTEXCOORD1DPROC)(GLdouble s); -GLAPI PFNGLTEXCOORD1DPROC glad_glTexCoord1d; -#define glTexCoord1d glad_glTexCoord1d -typedef void (APIENTRYP PFNGLTEXCOORD1DVPROC)(const GLdouble *v); -GLAPI PFNGLTEXCOORD1DVPROC glad_glTexCoord1dv; -#define glTexCoord1dv glad_glTexCoord1dv -typedef void (APIENTRYP PFNGLTEXCOORD1FPROC)(GLfloat s); -GLAPI PFNGLTEXCOORD1FPROC glad_glTexCoord1f; -#define glTexCoord1f glad_glTexCoord1f -typedef void (APIENTRYP PFNGLTEXCOORD1FVPROC)(const GLfloat *v); -GLAPI PFNGLTEXCOORD1FVPROC glad_glTexCoord1fv; -#define glTexCoord1fv glad_glTexCoord1fv -typedef void (APIENTRYP PFNGLTEXCOORD1IPROC)(GLint s); -GLAPI PFNGLTEXCOORD1IPROC glad_glTexCoord1i; -#define glTexCoord1i glad_glTexCoord1i -typedef void (APIENTRYP PFNGLTEXCOORD1IVPROC)(const GLint *v); -GLAPI PFNGLTEXCOORD1IVPROC glad_glTexCoord1iv; -#define glTexCoord1iv glad_glTexCoord1iv -typedef void (APIENTRYP PFNGLTEXCOORD1SPROC)(GLshort s); -GLAPI PFNGLTEXCOORD1SPROC glad_glTexCoord1s; -#define glTexCoord1s glad_glTexCoord1s -typedef void (APIENTRYP PFNGLTEXCOORD1SVPROC)(const GLshort *v); -GLAPI PFNGLTEXCOORD1SVPROC glad_glTexCoord1sv; -#define glTexCoord1sv glad_glTexCoord1sv -typedef void (APIENTRYP PFNGLTEXCOORD2DPROC)(GLdouble s, GLdouble t); -GLAPI PFNGLTEXCOORD2DPROC glad_glTexCoord2d; -#define glTexCoord2d glad_glTexCoord2d -typedef void (APIENTRYP PFNGLTEXCOORD2DVPROC)(const GLdouble *v); -GLAPI PFNGLTEXCOORD2DVPROC glad_glTexCoord2dv; -#define glTexCoord2dv glad_glTexCoord2dv -typedef void (APIENTRYP PFNGLTEXCOORD2FPROC)(GLfloat s, GLfloat t); -GLAPI PFNGLTEXCOORD2FPROC glad_glTexCoord2f; -#define glTexCoord2f glad_glTexCoord2f -typedef void (APIENTRYP PFNGLTEXCOORD2FVPROC)(const GLfloat *v); -GLAPI PFNGLTEXCOORD2FVPROC glad_glTexCoord2fv; -#define glTexCoord2fv glad_glTexCoord2fv -typedef void (APIENTRYP PFNGLTEXCOORD2IPROC)(GLint s, GLint t); -GLAPI PFNGLTEXCOORD2IPROC glad_glTexCoord2i; -#define glTexCoord2i glad_glTexCoord2i -typedef void (APIENTRYP PFNGLTEXCOORD2IVPROC)(const GLint *v); -GLAPI PFNGLTEXCOORD2IVPROC glad_glTexCoord2iv; -#define glTexCoord2iv glad_glTexCoord2iv -typedef void (APIENTRYP PFNGLTEXCOORD2SPROC)(GLshort s, GLshort t); -GLAPI PFNGLTEXCOORD2SPROC glad_glTexCoord2s; -#define glTexCoord2s glad_glTexCoord2s -typedef void (APIENTRYP PFNGLTEXCOORD2SVPROC)(const GLshort *v); -GLAPI PFNGLTEXCOORD2SVPROC glad_glTexCoord2sv; -#define glTexCoord2sv glad_glTexCoord2sv -typedef void (APIENTRYP PFNGLTEXCOORD3DPROC)(GLdouble s, GLdouble t, GLdouble r); -GLAPI PFNGLTEXCOORD3DPROC glad_glTexCoord3d; -#define glTexCoord3d glad_glTexCoord3d -typedef void (APIENTRYP PFNGLTEXCOORD3DVPROC)(const GLdouble *v); -GLAPI PFNGLTEXCOORD3DVPROC glad_glTexCoord3dv; -#define glTexCoord3dv glad_glTexCoord3dv -typedef void (APIENTRYP PFNGLTEXCOORD3FPROC)(GLfloat s, GLfloat t, GLfloat r); -GLAPI PFNGLTEXCOORD3FPROC glad_glTexCoord3f; -#define glTexCoord3f glad_glTexCoord3f -typedef void (APIENTRYP PFNGLTEXCOORD3FVPROC)(const GLfloat *v); -GLAPI PFNGLTEXCOORD3FVPROC glad_glTexCoord3fv; -#define glTexCoord3fv glad_glTexCoord3fv -typedef void (APIENTRYP PFNGLTEXCOORD3IPROC)(GLint s, GLint t, GLint r); -GLAPI PFNGLTEXCOORD3IPROC glad_glTexCoord3i; -#define glTexCoord3i glad_glTexCoord3i -typedef void (APIENTRYP PFNGLTEXCOORD3IVPROC)(const GLint *v); -GLAPI PFNGLTEXCOORD3IVPROC glad_glTexCoord3iv; -#define glTexCoord3iv glad_glTexCoord3iv -typedef void (APIENTRYP PFNGLTEXCOORD3SPROC)(GLshort s, GLshort t, GLshort r); -GLAPI PFNGLTEXCOORD3SPROC glad_glTexCoord3s; -#define glTexCoord3s glad_glTexCoord3s -typedef void (APIENTRYP PFNGLTEXCOORD3SVPROC)(const GLshort *v); -GLAPI PFNGLTEXCOORD3SVPROC glad_glTexCoord3sv; -#define glTexCoord3sv glad_glTexCoord3sv -typedef void (APIENTRYP PFNGLTEXCOORD4DPROC)(GLdouble s, GLdouble t, GLdouble r, GLdouble q); -GLAPI PFNGLTEXCOORD4DPROC glad_glTexCoord4d; -#define glTexCoord4d glad_glTexCoord4d -typedef void (APIENTRYP PFNGLTEXCOORD4DVPROC)(const GLdouble *v); -GLAPI PFNGLTEXCOORD4DVPROC glad_glTexCoord4dv; -#define glTexCoord4dv glad_glTexCoord4dv -typedef void (APIENTRYP PFNGLTEXCOORD4FPROC)(GLfloat s, GLfloat t, GLfloat r, GLfloat q); -GLAPI PFNGLTEXCOORD4FPROC glad_glTexCoord4f; -#define glTexCoord4f glad_glTexCoord4f -typedef void (APIENTRYP PFNGLTEXCOORD4FVPROC)(const GLfloat *v); -GLAPI PFNGLTEXCOORD4FVPROC glad_glTexCoord4fv; -#define glTexCoord4fv glad_glTexCoord4fv -typedef void (APIENTRYP PFNGLTEXCOORD4IPROC)(GLint s, GLint t, GLint r, GLint q); -GLAPI PFNGLTEXCOORD4IPROC glad_glTexCoord4i; -#define glTexCoord4i glad_glTexCoord4i -typedef void (APIENTRYP PFNGLTEXCOORD4IVPROC)(const GLint *v); -GLAPI PFNGLTEXCOORD4IVPROC glad_glTexCoord4iv; -#define glTexCoord4iv glad_glTexCoord4iv -typedef void (APIENTRYP PFNGLTEXCOORD4SPROC)(GLshort s, GLshort t, GLshort r, GLshort q); -GLAPI PFNGLTEXCOORD4SPROC glad_glTexCoord4s; -#define glTexCoord4s glad_glTexCoord4s -typedef void (APIENTRYP PFNGLTEXCOORD4SVPROC)(const GLshort *v); -GLAPI PFNGLTEXCOORD4SVPROC glad_glTexCoord4sv; -#define glTexCoord4sv glad_glTexCoord4sv -typedef void (APIENTRYP PFNGLVERTEX2DPROC)(GLdouble x, GLdouble y); -GLAPI PFNGLVERTEX2DPROC glad_glVertex2d; -#define glVertex2d glad_glVertex2d -typedef void (APIENTRYP PFNGLVERTEX2DVPROC)(const GLdouble *v); -GLAPI PFNGLVERTEX2DVPROC glad_glVertex2dv; -#define glVertex2dv glad_glVertex2dv -typedef void (APIENTRYP PFNGLVERTEX2FPROC)(GLfloat x, GLfloat y); -GLAPI PFNGLVERTEX2FPROC glad_glVertex2f; -#define glVertex2f glad_glVertex2f -typedef void (APIENTRYP PFNGLVERTEX2FVPROC)(const GLfloat *v); -GLAPI PFNGLVERTEX2FVPROC glad_glVertex2fv; -#define glVertex2fv glad_glVertex2fv -typedef void (APIENTRYP PFNGLVERTEX2IPROC)(GLint x, GLint y); -GLAPI PFNGLVERTEX2IPROC glad_glVertex2i; -#define glVertex2i glad_glVertex2i -typedef void (APIENTRYP PFNGLVERTEX2IVPROC)(const GLint *v); -GLAPI PFNGLVERTEX2IVPROC glad_glVertex2iv; -#define glVertex2iv glad_glVertex2iv -typedef void (APIENTRYP PFNGLVERTEX2SPROC)(GLshort x, GLshort y); -GLAPI PFNGLVERTEX2SPROC glad_glVertex2s; -#define glVertex2s glad_glVertex2s -typedef void (APIENTRYP PFNGLVERTEX2SVPROC)(const GLshort *v); -GLAPI PFNGLVERTEX2SVPROC glad_glVertex2sv; -#define glVertex2sv glad_glVertex2sv -typedef void (APIENTRYP PFNGLVERTEX3DPROC)(GLdouble x, GLdouble y, GLdouble z); -GLAPI PFNGLVERTEX3DPROC glad_glVertex3d; -#define glVertex3d glad_glVertex3d -typedef void (APIENTRYP PFNGLVERTEX3DVPROC)(const GLdouble *v); -GLAPI PFNGLVERTEX3DVPROC glad_glVertex3dv; -#define glVertex3dv glad_glVertex3dv -typedef void (APIENTRYP PFNGLVERTEX3FPROC)(GLfloat x, GLfloat y, GLfloat z); -GLAPI PFNGLVERTEX3FPROC glad_glVertex3f; -#define glVertex3f glad_glVertex3f -typedef void (APIENTRYP PFNGLVERTEX3FVPROC)(const GLfloat *v); -GLAPI PFNGLVERTEX3FVPROC glad_glVertex3fv; -#define glVertex3fv glad_glVertex3fv -typedef void (APIENTRYP PFNGLVERTEX3IPROC)(GLint x, GLint y, GLint z); -GLAPI PFNGLVERTEX3IPROC glad_glVertex3i; -#define glVertex3i glad_glVertex3i -typedef void (APIENTRYP PFNGLVERTEX3IVPROC)(const GLint *v); -GLAPI PFNGLVERTEX3IVPROC glad_glVertex3iv; -#define glVertex3iv glad_glVertex3iv -typedef void (APIENTRYP PFNGLVERTEX3SPROC)(GLshort x, GLshort y, GLshort z); -GLAPI PFNGLVERTEX3SPROC glad_glVertex3s; -#define glVertex3s glad_glVertex3s -typedef void (APIENTRYP PFNGLVERTEX3SVPROC)(const GLshort *v); -GLAPI PFNGLVERTEX3SVPROC glad_glVertex3sv; -#define glVertex3sv glad_glVertex3sv -typedef void (APIENTRYP PFNGLVERTEX4DPROC)(GLdouble x, GLdouble y, GLdouble z, GLdouble w); -GLAPI PFNGLVERTEX4DPROC glad_glVertex4d; -#define glVertex4d glad_glVertex4d -typedef void (APIENTRYP PFNGLVERTEX4DVPROC)(const GLdouble *v); -GLAPI PFNGLVERTEX4DVPROC glad_glVertex4dv; -#define glVertex4dv glad_glVertex4dv -typedef void (APIENTRYP PFNGLVERTEX4FPROC)(GLfloat x, GLfloat y, GLfloat z, GLfloat w); -GLAPI PFNGLVERTEX4FPROC glad_glVertex4f; -#define glVertex4f glad_glVertex4f -typedef void (APIENTRYP PFNGLVERTEX4FVPROC)(const GLfloat *v); -GLAPI PFNGLVERTEX4FVPROC glad_glVertex4fv; -#define glVertex4fv glad_glVertex4fv -typedef void (APIENTRYP PFNGLVERTEX4IPROC)(GLint x, GLint y, GLint z, GLint w); -GLAPI PFNGLVERTEX4IPROC glad_glVertex4i; -#define glVertex4i glad_glVertex4i -typedef void (APIENTRYP PFNGLVERTEX4IVPROC)(const GLint *v); -GLAPI PFNGLVERTEX4IVPROC glad_glVertex4iv; -#define glVertex4iv glad_glVertex4iv -typedef void (APIENTRYP PFNGLVERTEX4SPROC)(GLshort x, GLshort y, GLshort z, GLshort w); -GLAPI PFNGLVERTEX4SPROC glad_glVertex4s; -#define glVertex4s glad_glVertex4s -typedef void (APIENTRYP PFNGLVERTEX4SVPROC)(const GLshort *v); -GLAPI PFNGLVERTEX4SVPROC glad_glVertex4sv; -#define glVertex4sv glad_glVertex4sv -typedef void (APIENTRYP PFNGLCLIPPLANEPROC)(GLenum plane, const GLdouble *equation); -GLAPI PFNGLCLIPPLANEPROC glad_glClipPlane; -#define glClipPlane glad_glClipPlane -typedef void (APIENTRYP PFNGLCOLORMATERIALPROC)(GLenum face, GLenum mode); -GLAPI PFNGLCOLORMATERIALPROC glad_glColorMaterial; -#define glColorMaterial glad_glColorMaterial -typedef void (APIENTRYP PFNGLFOGFPROC)(GLenum pname, GLfloat param); -GLAPI PFNGLFOGFPROC glad_glFogf; -#define glFogf glad_glFogf -typedef void (APIENTRYP PFNGLFOGFVPROC)(GLenum pname, const GLfloat *params); -GLAPI PFNGLFOGFVPROC glad_glFogfv; -#define glFogfv glad_glFogfv -typedef void (APIENTRYP PFNGLFOGIPROC)(GLenum pname, GLint param); -GLAPI PFNGLFOGIPROC glad_glFogi; -#define glFogi glad_glFogi -typedef void (APIENTRYP PFNGLFOGIVPROC)(GLenum pname, const GLint *params); -GLAPI PFNGLFOGIVPROC glad_glFogiv; -#define glFogiv glad_glFogiv -typedef void (APIENTRYP PFNGLLIGHTFPROC)(GLenum light, GLenum pname, GLfloat param); -GLAPI PFNGLLIGHTFPROC glad_glLightf; -#define glLightf glad_glLightf -typedef void (APIENTRYP PFNGLLIGHTFVPROC)(GLenum light, GLenum pname, const GLfloat *params); -GLAPI PFNGLLIGHTFVPROC glad_glLightfv; -#define glLightfv glad_glLightfv -typedef void (APIENTRYP PFNGLLIGHTIPROC)(GLenum light, GLenum pname, GLint param); -GLAPI PFNGLLIGHTIPROC glad_glLighti; -#define glLighti glad_glLighti -typedef void (APIENTRYP PFNGLLIGHTIVPROC)(GLenum light, GLenum pname, const GLint *params); -GLAPI PFNGLLIGHTIVPROC glad_glLightiv; -#define glLightiv glad_glLightiv -typedef void (APIENTRYP PFNGLLIGHTMODELFPROC)(GLenum pname, GLfloat param); -GLAPI PFNGLLIGHTMODELFPROC glad_glLightModelf; -#define glLightModelf glad_glLightModelf -typedef void (APIENTRYP PFNGLLIGHTMODELFVPROC)(GLenum pname, const GLfloat *params); -GLAPI PFNGLLIGHTMODELFVPROC glad_glLightModelfv; -#define glLightModelfv glad_glLightModelfv -typedef void (APIENTRYP PFNGLLIGHTMODELIPROC)(GLenum pname, GLint param); -GLAPI PFNGLLIGHTMODELIPROC glad_glLightModeli; -#define glLightModeli glad_glLightModeli -typedef void (APIENTRYP PFNGLLIGHTMODELIVPROC)(GLenum pname, const GLint *params); -GLAPI PFNGLLIGHTMODELIVPROC glad_glLightModeliv; -#define glLightModeliv glad_glLightModeliv -typedef void (APIENTRYP PFNGLLINESTIPPLEPROC)(GLint factor, GLushort pattern); -GLAPI PFNGLLINESTIPPLEPROC glad_glLineStipple; -#define glLineStipple glad_glLineStipple -typedef void (APIENTRYP PFNGLMATERIALFPROC)(GLenum face, GLenum pname, GLfloat param); -GLAPI PFNGLMATERIALFPROC glad_glMaterialf; -#define glMaterialf glad_glMaterialf -typedef void (APIENTRYP PFNGLMATERIALFVPROC)(GLenum face, GLenum pname, const GLfloat *params); -GLAPI PFNGLMATERIALFVPROC glad_glMaterialfv; -#define glMaterialfv glad_glMaterialfv -typedef void (APIENTRYP PFNGLMATERIALIPROC)(GLenum face, GLenum pname, GLint param); -GLAPI PFNGLMATERIALIPROC glad_glMateriali; -#define glMateriali glad_glMateriali -typedef void (APIENTRYP PFNGLMATERIALIVPROC)(GLenum face, GLenum pname, const GLint *params); -GLAPI PFNGLMATERIALIVPROC glad_glMaterialiv; -#define glMaterialiv glad_glMaterialiv -typedef void (APIENTRYP PFNGLPOLYGONSTIPPLEPROC)(const GLubyte *mask); -GLAPI PFNGLPOLYGONSTIPPLEPROC glad_glPolygonStipple; -#define glPolygonStipple glad_glPolygonStipple -typedef void (APIENTRYP PFNGLSHADEMODELPROC)(GLenum mode); -GLAPI PFNGLSHADEMODELPROC glad_glShadeModel; -#define glShadeModel glad_glShadeModel -typedef void (APIENTRYP PFNGLTEXENVFPROC)(GLenum target, GLenum pname, GLfloat param); -GLAPI PFNGLTEXENVFPROC glad_glTexEnvf; -#define glTexEnvf glad_glTexEnvf -typedef void (APIENTRYP PFNGLTEXENVFVPROC)(GLenum target, GLenum pname, const GLfloat *params); -GLAPI PFNGLTEXENVFVPROC glad_glTexEnvfv; -#define glTexEnvfv glad_glTexEnvfv -typedef void (APIENTRYP PFNGLTEXENVIPROC)(GLenum target, GLenum pname, GLint param); -GLAPI PFNGLTEXENVIPROC glad_glTexEnvi; -#define glTexEnvi glad_glTexEnvi -typedef void (APIENTRYP PFNGLTEXENVIVPROC)(GLenum target, GLenum pname, const GLint *params); -GLAPI PFNGLTEXENVIVPROC glad_glTexEnviv; -#define glTexEnviv glad_glTexEnviv -typedef void (APIENTRYP PFNGLTEXGENDPROC)(GLenum coord, GLenum pname, GLdouble param); -GLAPI PFNGLTEXGENDPROC glad_glTexGend; -#define glTexGend glad_glTexGend -typedef void (APIENTRYP PFNGLTEXGENDVPROC)(GLenum coord, GLenum pname, const GLdouble *params); -GLAPI PFNGLTEXGENDVPROC glad_glTexGendv; -#define glTexGendv glad_glTexGendv -typedef void (APIENTRYP PFNGLTEXGENFPROC)(GLenum coord, GLenum pname, GLfloat param); -GLAPI PFNGLTEXGENFPROC glad_glTexGenf; -#define glTexGenf glad_glTexGenf -typedef void (APIENTRYP PFNGLTEXGENFVPROC)(GLenum coord, GLenum pname, const GLfloat *params); -GLAPI PFNGLTEXGENFVPROC glad_glTexGenfv; -#define glTexGenfv glad_glTexGenfv -typedef void (APIENTRYP PFNGLTEXGENIPROC)(GLenum coord, GLenum pname, GLint param); -GLAPI PFNGLTEXGENIPROC glad_glTexGeni; -#define glTexGeni glad_glTexGeni -typedef void (APIENTRYP PFNGLTEXGENIVPROC)(GLenum coord, GLenum pname, const GLint *params); -GLAPI PFNGLTEXGENIVPROC glad_glTexGeniv; -#define glTexGeniv glad_glTexGeniv -typedef void (APIENTRYP PFNGLFEEDBACKBUFFERPROC)(GLsizei size, GLenum type, GLfloat *buffer); -GLAPI PFNGLFEEDBACKBUFFERPROC glad_glFeedbackBuffer; -#define glFeedbackBuffer glad_glFeedbackBuffer -typedef void (APIENTRYP PFNGLSELECTBUFFERPROC)(GLsizei size, GLuint *buffer); -GLAPI PFNGLSELECTBUFFERPROC glad_glSelectBuffer; -#define glSelectBuffer glad_glSelectBuffer -typedef GLint (APIENTRYP PFNGLRENDERMODEPROC)(GLenum mode); -GLAPI PFNGLRENDERMODEPROC glad_glRenderMode; -#define glRenderMode glad_glRenderMode -typedef void (APIENTRYP PFNGLINITNAMESPROC)(void); -GLAPI PFNGLINITNAMESPROC glad_glInitNames; -#define glInitNames glad_glInitNames -typedef void (APIENTRYP PFNGLLOADNAMEPROC)(GLuint name); -GLAPI PFNGLLOADNAMEPROC glad_glLoadName; -#define glLoadName glad_glLoadName -typedef void (APIENTRYP PFNGLPASSTHROUGHPROC)(GLfloat token); -GLAPI PFNGLPASSTHROUGHPROC glad_glPassThrough; -#define glPassThrough glad_glPassThrough -typedef void (APIENTRYP PFNGLPOPNAMEPROC)(void); -GLAPI PFNGLPOPNAMEPROC glad_glPopName; -#define glPopName glad_glPopName -typedef void (APIENTRYP PFNGLPUSHNAMEPROC)(GLuint name); -GLAPI PFNGLPUSHNAMEPROC glad_glPushName; -#define glPushName glad_glPushName -typedef void (APIENTRYP PFNGLCLEARACCUMPROC)(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha); -GLAPI PFNGLCLEARACCUMPROC glad_glClearAccum; -#define glClearAccum glad_glClearAccum -typedef void (APIENTRYP PFNGLCLEARINDEXPROC)(GLfloat c); -GLAPI PFNGLCLEARINDEXPROC glad_glClearIndex; -#define glClearIndex glad_glClearIndex -typedef void (APIENTRYP PFNGLINDEXMASKPROC)(GLuint mask); -GLAPI PFNGLINDEXMASKPROC glad_glIndexMask; -#define glIndexMask glad_glIndexMask -typedef void (APIENTRYP PFNGLACCUMPROC)(GLenum op, GLfloat value); -GLAPI PFNGLACCUMPROC glad_glAccum; -#define glAccum glad_glAccum -typedef void (APIENTRYP PFNGLPOPATTRIBPROC)(void); -GLAPI PFNGLPOPATTRIBPROC glad_glPopAttrib; -#define glPopAttrib glad_glPopAttrib -typedef void (APIENTRYP PFNGLPUSHATTRIBPROC)(GLbitfield mask); -GLAPI PFNGLPUSHATTRIBPROC glad_glPushAttrib; -#define glPushAttrib glad_glPushAttrib -typedef void (APIENTRYP PFNGLMAP1DPROC)(GLenum target, GLdouble u1, GLdouble u2, GLint stride, GLint order, const GLdouble *points); -GLAPI PFNGLMAP1DPROC glad_glMap1d; -#define glMap1d glad_glMap1d -typedef void (APIENTRYP PFNGLMAP1FPROC)(GLenum target, GLfloat u1, GLfloat u2, GLint stride, GLint order, const GLfloat *points); -GLAPI PFNGLMAP1FPROC glad_glMap1f; -#define glMap1f glad_glMap1f -typedef void (APIENTRYP PFNGLMAP2DPROC)(GLenum target, GLdouble u1, GLdouble u2, GLint ustride, GLint uorder, GLdouble v1, GLdouble v2, GLint vstride, GLint vorder, const GLdouble *points); -GLAPI PFNGLMAP2DPROC glad_glMap2d; -#define glMap2d glad_glMap2d -typedef void (APIENTRYP PFNGLMAP2FPROC)(GLenum target, GLfloat u1, GLfloat u2, GLint ustride, GLint uorder, GLfloat v1, GLfloat v2, GLint vstride, GLint vorder, const GLfloat *points); -GLAPI PFNGLMAP2FPROC glad_glMap2f; -#define glMap2f glad_glMap2f -typedef void (APIENTRYP PFNGLMAPGRID1DPROC)(GLint un, GLdouble u1, GLdouble u2); -GLAPI PFNGLMAPGRID1DPROC glad_glMapGrid1d; -#define glMapGrid1d glad_glMapGrid1d -typedef void (APIENTRYP PFNGLMAPGRID1FPROC)(GLint un, GLfloat u1, GLfloat u2); -GLAPI PFNGLMAPGRID1FPROC glad_glMapGrid1f; -#define glMapGrid1f glad_glMapGrid1f -typedef void (APIENTRYP PFNGLMAPGRID2DPROC)(GLint un, GLdouble u1, GLdouble u2, GLint vn, GLdouble v1, GLdouble v2); -GLAPI PFNGLMAPGRID2DPROC glad_glMapGrid2d; -#define glMapGrid2d glad_glMapGrid2d -typedef void (APIENTRYP PFNGLMAPGRID2FPROC)(GLint un, GLfloat u1, GLfloat u2, GLint vn, GLfloat v1, GLfloat v2); -GLAPI PFNGLMAPGRID2FPROC glad_glMapGrid2f; -#define glMapGrid2f glad_glMapGrid2f -typedef void (APIENTRYP PFNGLEVALCOORD1DPROC)(GLdouble u); -GLAPI PFNGLEVALCOORD1DPROC glad_glEvalCoord1d; -#define glEvalCoord1d glad_glEvalCoord1d -typedef void (APIENTRYP PFNGLEVALCOORD1DVPROC)(const GLdouble *u); -GLAPI PFNGLEVALCOORD1DVPROC glad_glEvalCoord1dv; -#define glEvalCoord1dv glad_glEvalCoord1dv -typedef void (APIENTRYP PFNGLEVALCOORD1FPROC)(GLfloat u); -GLAPI PFNGLEVALCOORD1FPROC glad_glEvalCoord1f; -#define glEvalCoord1f glad_glEvalCoord1f -typedef void (APIENTRYP PFNGLEVALCOORD1FVPROC)(const GLfloat *u); -GLAPI PFNGLEVALCOORD1FVPROC glad_glEvalCoord1fv; -#define glEvalCoord1fv glad_glEvalCoord1fv -typedef void (APIENTRYP PFNGLEVALCOORD2DPROC)(GLdouble u, GLdouble v); -GLAPI PFNGLEVALCOORD2DPROC glad_glEvalCoord2d; -#define glEvalCoord2d glad_glEvalCoord2d -typedef void (APIENTRYP PFNGLEVALCOORD2DVPROC)(const GLdouble *u); -GLAPI PFNGLEVALCOORD2DVPROC glad_glEvalCoord2dv; -#define glEvalCoord2dv glad_glEvalCoord2dv -typedef void (APIENTRYP PFNGLEVALCOORD2FPROC)(GLfloat u, GLfloat v); -GLAPI PFNGLEVALCOORD2FPROC glad_glEvalCoord2f; -#define glEvalCoord2f glad_glEvalCoord2f -typedef void (APIENTRYP PFNGLEVALCOORD2FVPROC)(const GLfloat *u); -GLAPI PFNGLEVALCOORD2FVPROC glad_glEvalCoord2fv; -#define glEvalCoord2fv glad_glEvalCoord2fv -typedef void (APIENTRYP PFNGLEVALMESH1PROC)(GLenum mode, GLint i1, GLint i2); -GLAPI PFNGLEVALMESH1PROC glad_glEvalMesh1; -#define glEvalMesh1 glad_glEvalMesh1 -typedef void (APIENTRYP PFNGLEVALPOINT1PROC)(GLint i); -GLAPI PFNGLEVALPOINT1PROC glad_glEvalPoint1; -#define glEvalPoint1 glad_glEvalPoint1 -typedef void (APIENTRYP PFNGLEVALMESH2PROC)(GLenum mode, GLint i1, GLint i2, GLint j1, GLint j2); -GLAPI PFNGLEVALMESH2PROC glad_glEvalMesh2; -#define glEvalMesh2 glad_glEvalMesh2 -typedef void (APIENTRYP PFNGLEVALPOINT2PROC)(GLint i, GLint j); -GLAPI PFNGLEVALPOINT2PROC glad_glEvalPoint2; -#define glEvalPoint2 glad_glEvalPoint2 -typedef void (APIENTRYP PFNGLALPHAFUNCPROC)(GLenum func, GLfloat ref); -GLAPI PFNGLALPHAFUNCPROC glad_glAlphaFunc; -#define glAlphaFunc glad_glAlphaFunc -typedef void (APIENTRYP PFNGLPIXELZOOMPROC)(GLfloat xfactor, GLfloat yfactor); -GLAPI PFNGLPIXELZOOMPROC glad_glPixelZoom; -#define glPixelZoom glad_glPixelZoom -typedef void (APIENTRYP PFNGLPIXELTRANSFERFPROC)(GLenum pname, GLfloat param); -GLAPI PFNGLPIXELTRANSFERFPROC glad_glPixelTransferf; -#define glPixelTransferf glad_glPixelTransferf -typedef void (APIENTRYP PFNGLPIXELTRANSFERIPROC)(GLenum pname, GLint param); -GLAPI PFNGLPIXELTRANSFERIPROC glad_glPixelTransferi; -#define glPixelTransferi glad_glPixelTransferi -typedef void (APIENTRYP PFNGLPIXELMAPFVPROC)(GLenum map, GLsizei mapsize, const GLfloat *values); -GLAPI PFNGLPIXELMAPFVPROC glad_glPixelMapfv; -#define glPixelMapfv glad_glPixelMapfv -typedef void (APIENTRYP PFNGLPIXELMAPUIVPROC)(GLenum map, GLsizei mapsize, const GLuint *values); -GLAPI PFNGLPIXELMAPUIVPROC glad_glPixelMapuiv; -#define glPixelMapuiv glad_glPixelMapuiv -typedef void (APIENTRYP PFNGLPIXELMAPUSVPROC)(GLenum map, GLsizei mapsize, const GLushort *values); -GLAPI PFNGLPIXELMAPUSVPROC glad_glPixelMapusv; -#define glPixelMapusv glad_glPixelMapusv -typedef void (APIENTRYP PFNGLCOPYPIXELSPROC)(GLint x, GLint y, GLsizei width, GLsizei height, GLenum type); -GLAPI PFNGLCOPYPIXELSPROC glad_glCopyPixels; -#define glCopyPixels glad_glCopyPixels -typedef void (APIENTRYP PFNGLDRAWPIXELSPROC)(GLsizei width, GLsizei height, GLenum format, GLenum type, const void *pixels); -GLAPI PFNGLDRAWPIXELSPROC glad_glDrawPixels; -#define glDrawPixels glad_glDrawPixels -typedef void (APIENTRYP PFNGLGETCLIPPLANEPROC)(GLenum plane, GLdouble *equation); -GLAPI PFNGLGETCLIPPLANEPROC glad_glGetClipPlane; -#define glGetClipPlane glad_glGetClipPlane -typedef void (APIENTRYP PFNGLGETLIGHTFVPROC)(GLenum light, GLenum pname, GLfloat *params); -GLAPI PFNGLGETLIGHTFVPROC glad_glGetLightfv; -#define glGetLightfv glad_glGetLightfv -typedef void (APIENTRYP PFNGLGETLIGHTIVPROC)(GLenum light, GLenum pname, GLint *params); -GLAPI PFNGLGETLIGHTIVPROC glad_glGetLightiv; -#define glGetLightiv glad_glGetLightiv -typedef void (APIENTRYP PFNGLGETMAPDVPROC)(GLenum target, GLenum query, GLdouble *v); -GLAPI PFNGLGETMAPDVPROC glad_glGetMapdv; -#define glGetMapdv glad_glGetMapdv -typedef void (APIENTRYP PFNGLGETMAPFVPROC)(GLenum target, GLenum query, GLfloat *v); -GLAPI PFNGLGETMAPFVPROC glad_glGetMapfv; -#define glGetMapfv glad_glGetMapfv -typedef void (APIENTRYP PFNGLGETMAPIVPROC)(GLenum target, GLenum query, GLint *v); -GLAPI PFNGLGETMAPIVPROC glad_glGetMapiv; -#define glGetMapiv glad_glGetMapiv -typedef void (APIENTRYP PFNGLGETMATERIALFVPROC)(GLenum face, GLenum pname, GLfloat *params); -GLAPI PFNGLGETMATERIALFVPROC glad_glGetMaterialfv; -#define glGetMaterialfv glad_glGetMaterialfv -typedef void (APIENTRYP PFNGLGETMATERIALIVPROC)(GLenum face, GLenum pname, GLint *params); -GLAPI PFNGLGETMATERIALIVPROC glad_glGetMaterialiv; -#define glGetMaterialiv glad_glGetMaterialiv -typedef void (APIENTRYP PFNGLGETPIXELMAPFVPROC)(GLenum map, GLfloat *values); -GLAPI PFNGLGETPIXELMAPFVPROC glad_glGetPixelMapfv; -#define glGetPixelMapfv glad_glGetPixelMapfv -typedef void (APIENTRYP PFNGLGETPIXELMAPUIVPROC)(GLenum map, GLuint *values); -GLAPI PFNGLGETPIXELMAPUIVPROC glad_glGetPixelMapuiv; -#define glGetPixelMapuiv glad_glGetPixelMapuiv -typedef void (APIENTRYP PFNGLGETPIXELMAPUSVPROC)(GLenum map, GLushort *values); -GLAPI PFNGLGETPIXELMAPUSVPROC glad_glGetPixelMapusv; -#define glGetPixelMapusv glad_glGetPixelMapusv -typedef void (APIENTRYP PFNGLGETPOLYGONSTIPPLEPROC)(GLubyte *mask); -GLAPI PFNGLGETPOLYGONSTIPPLEPROC glad_glGetPolygonStipple; -#define glGetPolygonStipple glad_glGetPolygonStipple -typedef void (APIENTRYP PFNGLGETTEXENVFVPROC)(GLenum target, GLenum pname, GLfloat *params); -GLAPI PFNGLGETTEXENVFVPROC glad_glGetTexEnvfv; -#define glGetTexEnvfv glad_glGetTexEnvfv -typedef void (APIENTRYP PFNGLGETTEXENVIVPROC)(GLenum target, GLenum pname, GLint *params); -GLAPI PFNGLGETTEXENVIVPROC glad_glGetTexEnviv; -#define glGetTexEnviv glad_glGetTexEnviv -typedef void (APIENTRYP PFNGLGETTEXGENDVPROC)(GLenum coord, GLenum pname, GLdouble *params); -GLAPI PFNGLGETTEXGENDVPROC glad_glGetTexGendv; -#define glGetTexGendv glad_glGetTexGendv -typedef void (APIENTRYP PFNGLGETTEXGENFVPROC)(GLenum coord, GLenum pname, GLfloat *params); -GLAPI PFNGLGETTEXGENFVPROC glad_glGetTexGenfv; -#define glGetTexGenfv glad_glGetTexGenfv -typedef void (APIENTRYP PFNGLGETTEXGENIVPROC)(GLenum coord, GLenum pname, GLint *params); -GLAPI PFNGLGETTEXGENIVPROC glad_glGetTexGeniv; -#define glGetTexGeniv glad_glGetTexGeniv -typedef GLboolean (APIENTRYP PFNGLISLISTPROC)(GLuint list); -GLAPI PFNGLISLISTPROC glad_glIsList; -#define glIsList glad_glIsList -typedef void (APIENTRYP PFNGLFRUSTUMPROC)(GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar); -GLAPI PFNGLFRUSTUMPROC glad_glFrustum; -#define glFrustum glad_glFrustum -typedef void (APIENTRYP PFNGLLOADIDENTITYPROC)(void); -GLAPI PFNGLLOADIDENTITYPROC glad_glLoadIdentity; -#define glLoadIdentity glad_glLoadIdentity -typedef void (APIENTRYP PFNGLLOADMATRIXFPROC)(const GLfloat *m); -GLAPI PFNGLLOADMATRIXFPROC glad_glLoadMatrixf; -#define glLoadMatrixf glad_glLoadMatrixf -typedef void (APIENTRYP PFNGLLOADMATRIXDPROC)(const GLdouble *m); -GLAPI PFNGLLOADMATRIXDPROC glad_glLoadMatrixd; -#define glLoadMatrixd glad_glLoadMatrixd -typedef void (APIENTRYP PFNGLMATRIXMODEPROC)(GLenum mode); -GLAPI PFNGLMATRIXMODEPROC glad_glMatrixMode; -#define glMatrixMode glad_glMatrixMode -typedef void (APIENTRYP PFNGLMULTMATRIXFPROC)(const GLfloat *m); -GLAPI PFNGLMULTMATRIXFPROC glad_glMultMatrixf; -#define glMultMatrixf glad_glMultMatrixf -typedef void (APIENTRYP PFNGLMULTMATRIXDPROC)(const GLdouble *m); -GLAPI PFNGLMULTMATRIXDPROC glad_glMultMatrixd; -#define glMultMatrixd glad_glMultMatrixd -typedef void (APIENTRYP PFNGLORTHOPROC)(GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar); -GLAPI PFNGLORTHOPROC glad_glOrtho; -#define glOrtho glad_glOrtho -typedef void (APIENTRYP PFNGLPOPMATRIXPROC)(void); -GLAPI PFNGLPOPMATRIXPROC glad_glPopMatrix; -#define glPopMatrix glad_glPopMatrix -typedef void (APIENTRYP PFNGLPUSHMATRIXPROC)(void); -GLAPI PFNGLPUSHMATRIXPROC glad_glPushMatrix; -#define glPushMatrix glad_glPushMatrix -typedef void (APIENTRYP PFNGLROTATEDPROC)(GLdouble angle, GLdouble x, GLdouble y, GLdouble z); -GLAPI PFNGLROTATEDPROC glad_glRotated; -#define glRotated glad_glRotated -typedef void (APIENTRYP PFNGLROTATEFPROC)(GLfloat angle, GLfloat x, GLfloat y, GLfloat z); -GLAPI PFNGLROTATEFPROC glad_glRotatef; -#define glRotatef glad_glRotatef -typedef void (APIENTRYP PFNGLSCALEDPROC)(GLdouble x, GLdouble y, GLdouble z); -GLAPI PFNGLSCALEDPROC glad_glScaled; -#define glScaled glad_glScaled -typedef void (APIENTRYP PFNGLSCALEFPROC)(GLfloat x, GLfloat y, GLfloat z); -GLAPI PFNGLSCALEFPROC glad_glScalef; -#define glScalef glad_glScalef -typedef void (APIENTRYP PFNGLTRANSLATEDPROC)(GLdouble x, GLdouble y, GLdouble z); -GLAPI PFNGLTRANSLATEDPROC glad_glTranslated; -#define glTranslated glad_glTranslated -typedef void (APIENTRYP PFNGLTRANSLATEFPROC)(GLfloat x, GLfloat y, GLfloat z); -GLAPI PFNGLTRANSLATEFPROC glad_glTranslatef; -#define glTranslatef glad_glTranslatef -#endif -#ifndef GL_VERSION_1_1 -#define GL_VERSION_1_1 1 -GLAPI int GLAD_GL_VERSION_1_1; -typedef void (APIENTRYP PFNGLDRAWARRAYSPROC)(GLenum mode, GLint first, GLsizei count); -GLAPI PFNGLDRAWARRAYSPROC glad_glDrawArrays; -#define glDrawArrays glad_glDrawArrays -typedef void (APIENTRYP PFNGLDRAWELEMENTSPROC)(GLenum mode, GLsizei count, GLenum type, const void *indices); -GLAPI PFNGLDRAWELEMENTSPROC glad_glDrawElements; -#define glDrawElements glad_glDrawElements -typedef void (APIENTRYP PFNGLGETPOINTERVPROC)(GLenum pname, void **params); -GLAPI PFNGLGETPOINTERVPROC glad_glGetPointerv; -#define glGetPointerv glad_glGetPointerv -typedef void (APIENTRYP PFNGLPOLYGONOFFSETPROC)(GLfloat factor, GLfloat units); -GLAPI PFNGLPOLYGONOFFSETPROC glad_glPolygonOffset; -#define glPolygonOffset glad_glPolygonOffset -typedef void (APIENTRYP PFNGLCOPYTEXIMAGE1DPROC)(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLint border); -GLAPI PFNGLCOPYTEXIMAGE1DPROC glad_glCopyTexImage1D; -#define glCopyTexImage1D glad_glCopyTexImage1D -typedef void (APIENTRYP PFNGLCOPYTEXIMAGE2DPROC)(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border); -GLAPI PFNGLCOPYTEXIMAGE2DPROC glad_glCopyTexImage2D; -#define glCopyTexImage2D glad_glCopyTexImage2D -typedef void (APIENTRYP PFNGLCOPYTEXSUBIMAGE1DPROC)(GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width); -GLAPI PFNGLCOPYTEXSUBIMAGE1DPROC glad_glCopyTexSubImage1D; -#define glCopyTexSubImage1D glad_glCopyTexSubImage1D -typedef void (APIENTRYP PFNGLCOPYTEXSUBIMAGE2DPROC)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height); -GLAPI PFNGLCOPYTEXSUBIMAGE2DPROC glad_glCopyTexSubImage2D; -#define glCopyTexSubImage2D glad_glCopyTexSubImage2D -typedef void (APIENTRYP PFNGLTEXSUBIMAGE1DPROC)(GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const void *pixels); -GLAPI PFNGLTEXSUBIMAGE1DPROC glad_glTexSubImage1D; -#define glTexSubImage1D glad_glTexSubImage1D -typedef void (APIENTRYP PFNGLTEXSUBIMAGE2DPROC)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const void *pixels); -GLAPI PFNGLTEXSUBIMAGE2DPROC glad_glTexSubImage2D; -#define glTexSubImage2D glad_glTexSubImage2D -typedef void (APIENTRYP PFNGLBINDTEXTUREPROC)(GLenum target, GLuint texture); -GLAPI PFNGLBINDTEXTUREPROC glad_glBindTexture; -#define glBindTexture glad_glBindTexture -typedef void (APIENTRYP PFNGLDELETETEXTURESPROC)(GLsizei n, const GLuint *textures); -GLAPI PFNGLDELETETEXTURESPROC glad_glDeleteTextures; -#define glDeleteTextures glad_glDeleteTextures -typedef void (APIENTRYP PFNGLGENTEXTURESPROC)(GLsizei n, GLuint *textures); -GLAPI PFNGLGENTEXTURESPROC glad_glGenTextures; -#define glGenTextures glad_glGenTextures -typedef GLboolean (APIENTRYP PFNGLISTEXTUREPROC)(GLuint texture); -GLAPI PFNGLISTEXTUREPROC glad_glIsTexture; -#define glIsTexture glad_glIsTexture -typedef void (APIENTRYP PFNGLARRAYELEMENTPROC)(GLint i); -GLAPI PFNGLARRAYELEMENTPROC glad_glArrayElement; -#define glArrayElement glad_glArrayElement -typedef void (APIENTRYP PFNGLCOLORPOINTERPROC)(GLint size, GLenum type, GLsizei stride, const void *pointer); -GLAPI PFNGLCOLORPOINTERPROC glad_glColorPointer; -#define glColorPointer glad_glColorPointer -typedef void (APIENTRYP PFNGLDISABLECLIENTSTATEPROC)(GLenum array); -GLAPI PFNGLDISABLECLIENTSTATEPROC glad_glDisableClientState; -#define glDisableClientState glad_glDisableClientState -typedef void (APIENTRYP PFNGLEDGEFLAGPOINTERPROC)(GLsizei stride, const void *pointer); -GLAPI PFNGLEDGEFLAGPOINTERPROC glad_glEdgeFlagPointer; -#define glEdgeFlagPointer glad_glEdgeFlagPointer -typedef void (APIENTRYP PFNGLENABLECLIENTSTATEPROC)(GLenum array); -GLAPI PFNGLENABLECLIENTSTATEPROC glad_glEnableClientState; -#define glEnableClientState glad_glEnableClientState -typedef void (APIENTRYP PFNGLINDEXPOINTERPROC)(GLenum type, GLsizei stride, const void *pointer); -GLAPI PFNGLINDEXPOINTERPROC glad_glIndexPointer; -#define glIndexPointer glad_glIndexPointer -typedef void (APIENTRYP PFNGLINTERLEAVEDARRAYSPROC)(GLenum format, GLsizei stride, const void *pointer); -GLAPI PFNGLINTERLEAVEDARRAYSPROC glad_glInterleavedArrays; -#define glInterleavedArrays glad_glInterleavedArrays -typedef void (APIENTRYP PFNGLNORMALPOINTERPROC)(GLenum type, GLsizei stride, const void *pointer); -GLAPI PFNGLNORMALPOINTERPROC glad_glNormalPointer; -#define glNormalPointer glad_glNormalPointer -typedef void (APIENTRYP PFNGLTEXCOORDPOINTERPROC)(GLint size, GLenum type, GLsizei stride, const void *pointer); -GLAPI PFNGLTEXCOORDPOINTERPROC glad_glTexCoordPointer; -#define glTexCoordPointer glad_glTexCoordPointer -typedef void (APIENTRYP PFNGLVERTEXPOINTERPROC)(GLint size, GLenum type, GLsizei stride, const void *pointer); -GLAPI PFNGLVERTEXPOINTERPROC glad_glVertexPointer; -#define glVertexPointer glad_glVertexPointer -typedef GLboolean (APIENTRYP PFNGLARETEXTURESRESIDENTPROC)(GLsizei n, const GLuint *textures, GLboolean *residences); -GLAPI PFNGLARETEXTURESRESIDENTPROC glad_glAreTexturesResident; -#define glAreTexturesResident glad_glAreTexturesResident -typedef void (APIENTRYP PFNGLPRIORITIZETEXTURESPROC)(GLsizei n, const GLuint *textures, const GLfloat *priorities); -GLAPI PFNGLPRIORITIZETEXTURESPROC glad_glPrioritizeTextures; -#define glPrioritizeTextures glad_glPrioritizeTextures -typedef void (APIENTRYP PFNGLINDEXUBPROC)(GLubyte c); -GLAPI PFNGLINDEXUBPROC glad_glIndexub; -#define glIndexub glad_glIndexub -typedef void (APIENTRYP PFNGLINDEXUBVPROC)(const GLubyte *c); -GLAPI PFNGLINDEXUBVPROC glad_glIndexubv; -#define glIndexubv glad_glIndexubv -typedef void (APIENTRYP PFNGLPOPCLIENTATTRIBPROC)(void); -GLAPI PFNGLPOPCLIENTATTRIBPROC glad_glPopClientAttrib; -#define glPopClientAttrib glad_glPopClientAttrib -typedef void (APIENTRYP PFNGLPUSHCLIENTATTRIBPROC)(GLbitfield mask); -GLAPI PFNGLPUSHCLIENTATTRIBPROC glad_glPushClientAttrib; -#define glPushClientAttrib glad_glPushClientAttrib -#endif -#ifndef GL_VERSION_1_2 -#define GL_VERSION_1_2 1 -GLAPI int GLAD_GL_VERSION_1_2; -typedef void (APIENTRYP PFNGLDRAWRANGEELEMENTSPROC)(GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const void *indices); -GLAPI PFNGLDRAWRANGEELEMENTSPROC glad_glDrawRangeElements; -#define glDrawRangeElements glad_glDrawRangeElements -typedef void (APIENTRYP PFNGLTEXIMAGE3DPROC)(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const void *pixels); -GLAPI PFNGLTEXIMAGE3DPROC glad_glTexImage3D; -#define glTexImage3D glad_glTexImage3D -typedef void (APIENTRYP PFNGLTEXSUBIMAGE3DPROC)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void *pixels); -GLAPI PFNGLTEXSUBIMAGE3DPROC glad_glTexSubImage3D; -#define glTexSubImage3D glad_glTexSubImage3D -typedef void (APIENTRYP PFNGLCOPYTEXSUBIMAGE3DPROC)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height); -GLAPI PFNGLCOPYTEXSUBIMAGE3DPROC glad_glCopyTexSubImage3D; -#define glCopyTexSubImage3D glad_glCopyTexSubImage3D -#endif -#ifndef GL_VERSION_1_3 -#define GL_VERSION_1_3 1 -GLAPI int GLAD_GL_VERSION_1_3; -typedef void (APIENTRYP PFNGLACTIVETEXTUREPROC)(GLenum texture); -GLAPI PFNGLACTIVETEXTUREPROC glad_glActiveTexture; -#define glActiveTexture glad_glActiveTexture -typedef void (APIENTRYP PFNGLSAMPLECOVERAGEPROC)(GLfloat value, GLboolean invert); -GLAPI PFNGLSAMPLECOVERAGEPROC glad_glSampleCoverage; -#define glSampleCoverage glad_glSampleCoverage -typedef void (APIENTRYP PFNGLCOMPRESSEDTEXIMAGE3DPROC)(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const void *data); -GLAPI PFNGLCOMPRESSEDTEXIMAGE3DPROC glad_glCompressedTexImage3D; -#define glCompressedTexImage3D glad_glCompressedTexImage3D -typedef void (APIENTRYP PFNGLCOMPRESSEDTEXIMAGE2DPROC)(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const void *data); -GLAPI PFNGLCOMPRESSEDTEXIMAGE2DPROC glad_glCompressedTexImage2D; -#define glCompressedTexImage2D glad_glCompressedTexImage2D -typedef void (APIENTRYP PFNGLCOMPRESSEDTEXIMAGE1DPROC)(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const void *data); -GLAPI PFNGLCOMPRESSEDTEXIMAGE1DPROC glad_glCompressedTexImage1D; -#define glCompressedTexImage1D glad_glCompressedTexImage1D -typedef void (APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE3DPROC)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const void *data); -GLAPI PFNGLCOMPRESSEDTEXSUBIMAGE3DPROC glad_glCompressedTexSubImage3D; -#define glCompressedTexSubImage3D glad_glCompressedTexSubImage3D -typedef void (APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE2DPROC)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void *data); -GLAPI PFNGLCOMPRESSEDTEXSUBIMAGE2DPROC glad_glCompressedTexSubImage2D; -#define glCompressedTexSubImage2D glad_glCompressedTexSubImage2D -typedef void (APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE1DPROC)(GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const void *data); -GLAPI PFNGLCOMPRESSEDTEXSUBIMAGE1DPROC glad_glCompressedTexSubImage1D; -#define glCompressedTexSubImage1D glad_glCompressedTexSubImage1D -typedef void (APIENTRYP PFNGLGETCOMPRESSEDTEXIMAGEPROC)(GLenum target, GLint level, void *img); -GLAPI PFNGLGETCOMPRESSEDTEXIMAGEPROC glad_glGetCompressedTexImage; -#define glGetCompressedTexImage glad_glGetCompressedTexImage -typedef void (APIENTRYP PFNGLCLIENTACTIVETEXTUREPROC)(GLenum texture); -GLAPI PFNGLCLIENTACTIVETEXTUREPROC glad_glClientActiveTexture; -#define glClientActiveTexture glad_glClientActiveTexture -typedef void (APIENTRYP PFNGLMULTITEXCOORD1DPROC)(GLenum target, GLdouble s); -GLAPI PFNGLMULTITEXCOORD1DPROC glad_glMultiTexCoord1d; -#define glMultiTexCoord1d glad_glMultiTexCoord1d -typedef void (APIENTRYP PFNGLMULTITEXCOORD1DVPROC)(GLenum target, const GLdouble *v); -GLAPI PFNGLMULTITEXCOORD1DVPROC glad_glMultiTexCoord1dv; -#define glMultiTexCoord1dv glad_glMultiTexCoord1dv -typedef void (APIENTRYP PFNGLMULTITEXCOORD1FPROC)(GLenum target, GLfloat s); -GLAPI PFNGLMULTITEXCOORD1FPROC glad_glMultiTexCoord1f; -#define glMultiTexCoord1f glad_glMultiTexCoord1f -typedef void (APIENTRYP PFNGLMULTITEXCOORD1FVPROC)(GLenum target, const GLfloat *v); -GLAPI PFNGLMULTITEXCOORD1FVPROC glad_glMultiTexCoord1fv; -#define glMultiTexCoord1fv glad_glMultiTexCoord1fv -typedef void (APIENTRYP PFNGLMULTITEXCOORD1IPROC)(GLenum target, GLint s); -GLAPI PFNGLMULTITEXCOORD1IPROC glad_glMultiTexCoord1i; -#define glMultiTexCoord1i glad_glMultiTexCoord1i -typedef void (APIENTRYP PFNGLMULTITEXCOORD1IVPROC)(GLenum target, const GLint *v); -GLAPI PFNGLMULTITEXCOORD1IVPROC glad_glMultiTexCoord1iv; -#define glMultiTexCoord1iv glad_glMultiTexCoord1iv -typedef void (APIENTRYP PFNGLMULTITEXCOORD1SPROC)(GLenum target, GLshort s); -GLAPI PFNGLMULTITEXCOORD1SPROC glad_glMultiTexCoord1s; -#define glMultiTexCoord1s glad_glMultiTexCoord1s -typedef void (APIENTRYP PFNGLMULTITEXCOORD1SVPROC)(GLenum target, const GLshort *v); -GLAPI PFNGLMULTITEXCOORD1SVPROC glad_glMultiTexCoord1sv; -#define glMultiTexCoord1sv glad_glMultiTexCoord1sv -typedef void (APIENTRYP PFNGLMULTITEXCOORD2DPROC)(GLenum target, GLdouble s, GLdouble t); -GLAPI PFNGLMULTITEXCOORD2DPROC glad_glMultiTexCoord2d; -#define glMultiTexCoord2d glad_glMultiTexCoord2d -typedef void (APIENTRYP PFNGLMULTITEXCOORD2DVPROC)(GLenum target, const GLdouble *v); -GLAPI PFNGLMULTITEXCOORD2DVPROC glad_glMultiTexCoord2dv; -#define glMultiTexCoord2dv glad_glMultiTexCoord2dv -typedef void (APIENTRYP PFNGLMULTITEXCOORD2FPROC)(GLenum target, GLfloat s, GLfloat t); -GLAPI PFNGLMULTITEXCOORD2FPROC glad_glMultiTexCoord2f; -#define glMultiTexCoord2f glad_glMultiTexCoord2f -typedef void (APIENTRYP PFNGLMULTITEXCOORD2FVPROC)(GLenum target, const GLfloat *v); -GLAPI PFNGLMULTITEXCOORD2FVPROC glad_glMultiTexCoord2fv; -#define glMultiTexCoord2fv glad_glMultiTexCoord2fv -typedef void (APIENTRYP PFNGLMULTITEXCOORD2IPROC)(GLenum target, GLint s, GLint t); -GLAPI PFNGLMULTITEXCOORD2IPROC glad_glMultiTexCoord2i; -#define glMultiTexCoord2i glad_glMultiTexCoord2i -typedef void (APIENTRYP PFNGLMULTITEXCOORD2IVPROC)(GLenum target, const GLint *v); -GLAPI PFNGLMULTITEXCOORD2IVPROC glad_glMultiTexCoord2iv; -#define glMultiTexCoord2iv glad_glMultiTexCoord2iv -typedef void (APIENTRYP PFNGLMULTITEXCOORD2SPROC)(GLenum target, GLshort s, GLshort t); -GLAPI PFNGLMULTITEXCOORD2SPROC glad_glMultiTexCoord2s; -#define glMultiTexCoord2s glad_glMultiTexCoord2s -typedef void (APIENTRYP PFNGLMULTITEXCOORD2SVPROC)(GLenum target, const GLshort *v); -GLAPI PFNGLMULTITEXCOORD2SVPROC glad_glMultiTexCoord2sv; -#define glMultiTexCoord2sv glad_glMultiTexCoord2sv -typedef void (APIENTRYP PFNGLMULTITEXCOORD3DPROC)(GLenum target, GLdouble s, GLdouble t, GLdouble r); -GLAPI PFNGLMULTITEXCOORD3DPROC glad_glMultiTexCoord3d; -#define glMultiTexCoord3d glad_glMultiTexCoord3d -typedef void (APIENTRYP PFNGLMULTITEXCOORD3DVPROC)(GLenum target, const GLdouble *v); -GLAPI PFNGLMULTITEXCOORD3DVPROC glad_glMultiTexCoord3dv; -#define glMultiTexCoord3dv glad_glMultiTexCoord3dv -typedef void (APIENTRYP PFNGLMULTITEXCOORD3FPROC)(GLenum target, GLfloat s, GLfloat t, GLfloat r); -GLAPI PFNGLMULTITEXCOORD3FPROC glad_glMultiTexCoord3f; -#define glMultiTexCoord3f glad_glMultiTexCoord3f -typedef void (APIENTRYP PFNGLMULTITEXCOORD3FVPROC)(GLenum target, const GLfloat *v); -GLAPI PFNGLMULTITEXCOORD3FVPROC glad_glMultiTexCoord3fv; -#define glMultiTexCoord3fv glad_glMultiTexCoord3fv -typedef void (APIENTRYP PFNGLMULTITEXCOORD3IPROC)(GLenum target, GLint s, GLint t, GLint r); -GLAPI PFNGLMULTITEXCOORD3IPROC glad_glMultiTexCoord3i; -#define glMultiTexCoord3i glad_glMultiTexCoord3i -typedef void (APIENTRYP PFNGLMULTITEXCOORD3IVPROC)(GLenum target, const GLint *v); -GLAPI PFNGLMULTITEXCOORD3IVPROC glad_glMultiTexCoord3iv; -#define glMultiTexCoord3iv glad_glMultiTexCoord3iv -typedef void (APIENTRYP PFNGLMULTITEXCOORD3SPROC)(GLenum target, GLshort s, GLshort t, GLshort r); -GLAPI PFNGLMULTITEXCOORD3SPROC glad_glMultiTexCoord3s; -#define glMultiTexCoord3s glad_glMultiTexCoord3s -typedef void (APIENTRYP PFNGLMULTITEXCOORD3SVPROC)(GLenum target, const GLshort *v); -GLAPI PFNGLMULTITEXCOORD3SVPROC glad_glMultiTexCoord3sv; -#define glMultiTexCoord3sv glad_glMultiTexCoord3sv -typedef void (APIENTRYP PFNGLMULTITEXCOORD4DPROC)(GLenum target, GLdouble s, GLdouble t, GLdouble r, GLdouble q); -GLAPI PFNGLMULTITEXCOORD4DPROC glad_glMultiTexCoord4d; -#define glMultiTexCoord4d glad_glMultiTexCoord4d -typedef void (APIENTRYP PFNGLMULTITEXCOORD4DVPROC)(GLenum target, const GLdouble *v); -GLAPI PFNGLMULTITEXCOORD4DVPROC glad_glMultiTexCoord4dv; -#define glMultiTexCoord4dv glad_glMultiTexCoord4dv -typedef void (APIENTRYP PFNGLMULTITEXCOORD4FPROC)(GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q); -GLAPI PFNGLMULTITEXCOORD4FPROC glad_glMultiTexCoord4f; -#define glMultiTexCoord4f glad_glMultiTexCoord4f -typedef void (APIENTRYP PFNGLMULTITEXCOORD4FVPROC)(GLenum target, const GLfloat *v); -GLAPI PFNGLMULTITEXCOORD4FVPROC glad_glMultiTexCoord4fv; -#define glMultiTexCoord4fv glad_glMultiTexCoord4fv -typedef void (APIENTRYP PFNGLMULTITEXCOORD4IPROC)(GLenum target, GLint s, GLint t, GLint r, GLint q); -GLAPI PFNGLMULTITEXCOORD4IPROC glad_glMultiTexCoord4i; -#define glMultiTexCoord4i glad_glMultiTexCoord4i -typedef void (APIENTRYP PFNGLMULTITEXCOORD4IVPROC)(GLenum target, const GLint *v); -GLAPI PFNGLMULTITEXCOORD4IVPROC glad_glMultiTexCoord4iv; -#define glMultiTexCoord4iv glad_glMultiTexCoord4iv -typedef void (APIENTRYP PFNGLMULTITEXCOORD4SPROC)(GLenum target, GLshort s, GLshort t, GLshort r, GLshort q); -GLAPI PFNGLMULTITEXCOORD4SPROC glad_glMultiTexCoord4s; -#define glMultiTexCoord4s glad_glMultiTexCoord4s -typedef void (APIENTRYP PFNGLMULTITEXCOORD4SVPROC)(GLenum target, const GLshort *v); -GLAPI PFNGLMULTITEXCOORD4SVPROC glad_glMultiTexCoord4sv; -#define glMultiTexCoord4sv glad_glMultiTexCoord4sv -typedef void (APIENTRYP PFNGLLOADTRANSPOSEMATRIXFPROC)(const GLfloat *m); -GLAPI PFNGLLOADTRANSPOSEMATRIXFPROC glad_glLoadTransposeMatrixf; -#define glLoadTransposeMatrixf glad_glLoadTransposeMatrixf -typedef void (APIENTRYP PFNGLLOADTRANSPOSEMATRIXDPROC)(const GLdouble *m); -GLAPI PFNGLLOADTRANSPOSEMATRIXDPROC glad_glLoadTransposeMatrixd; -#define glLoadTransposeMatrixd glad_glLoadTransposeMatrixd -typedef void (APIENTRYP PFNGLMULTTRANSPOSEMATRIXFPROC)(const GLfloat *m); -GLAPI PFNGLMULTTRANSPOSEMATRIXFPROC glad_glMultTransposeMatrixf; -#define glMultTransposeMatrixf glad_glMultTransposeMatrixf -typedef void (APIENTRYP PFNGLMULTTRANSPOSEMATRIXDPROC)(const GLdouble *m); -GLAPI PFNGLMULTTRANSPOSEMATRIXDPROC glad_glMultTransposeMatrixd; -#define glMultTransposeMatrixd glad_glMultTransposeMatrixd -#endif -#ifndef GL_VERSION_1_4 -#define GL_VERSION_1_4 1 -GLAPI int GLAD_GL_VERSION_1_4; -typedef void (APIENTRYP PFNGLBLENDFUNCSEPARATEPROC)(GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha); -GLAPI PFNGLBLENDFUNCSEPARATEPROC glad_glBlendFuncSeparate; -#define glBlendFuncSeparate glad_glBlendFuncSeparate -typedef void (APIENTRYP PFNGLMULTIDRAWARRAYSPROC)(GLenum mode, const GLint *first, const GLsizei *count, GLsizei drawcount); -GLAPI PFNGLMULTIDRAWARRAYSPROC glad_glMultiDrawArrays; -#define glMultiDrawArrays glad_glMultiDrawArrays -typedef void (APIENTRYP PFNGLMULTIDRAWELEMENTSPROC)(GLenum mode, const GLsizei *count, GLenum type, const void *const*indices, GLsizei drawcount); -GLAPI PFNGLMULTIDRAWELEMENTSPROC glad_glMultiDrawElements; -#define glMultiDrawElements glad_glMultiDrawElements -typedef void (APIENTRYP PFNGLPOINTPARAMETERFPROC)(GLenum pname, GLfloat param); -GLAPI PFNGLPOINTPARAMETERFPROC glad_glPointParameterf; -#define glPointParameterf glad_glPointParameterf -typedef void (APIENTRYP PFNGLPOINTPARAMETERFVPROC)(GLenum pname, const GLfloat *params); -GLAPI PFNGLPOINTPARAMETERFVPROC glad_glPointParameterfv; -#define glPointParameterfv glad_glPointParameterfv -typedef void (APIENTRYP PFNGLPOINTPARAMETERIPROC)(GLenum pname, GLint param); -GLAPI PFNGLPOINTPARAMETERIPROC glad_glPointParameteri; -#define glPointParameteri glad_glPointParameteri -typedef void (APIENTRYP PFNGLPOINTPARAMETERIVPROC)(GLenum pname, const GLint *params); -GLAPI PFNGLPOINTPARAMETERIVPROC glad_glPointParameteriv; -#define glPointParameteriv glad_glPointParameteriv -typedef void (APIENTRYP PFNGLFOGCOORDFPROC)(GLfloat coord); -GLAPI PFNGLFOGCOORDFPROC glad_glFogCoordf; -#define glFogCoordf glad_glFogCoordf -typedef void (APIENTRYP PFNGLFOGCOORDFVPROC)(const GLfloat *coord); -GLAPI PFNGLFOGCOORDFVPROC glad_glFogCoordfv; -#define glFogCoordfv glad_glFogCoordfv -typedef void (APIENTRYP PFNGLFOGCOORDDPROC)(GLdouble coord); -GLAPI PFNGLFOGCOORDDPROC glad_glFogCoordd; -#define glFogCoordd glad_glFogCoordd -typedef void (APIENTRYP PFNGLFOGCOORDDVPROC)(const GLdouble *coord); -GLAPI PFNGLFOGCOORDDVPROC glad_glFogCoorddv; -#define glFogCoorddv glad_glFogCoorddv -typedef void (APIENTRYP PFNGLFOGCOORDPOINTERPROC)(GLenum type, GLsizei stride, const void *pointer); -GLAPI PFNGLFOGCOORDPOINTERPROC glad_glFogCoordPointer; -#define glFogCoordPointer glad_glFogCoordPointer -typedef void (APIENTRYP PFNGLSECONDARYCOLOR3BPROC)(GLbyte red, GLbyte green, GLbyte blue); -GLAPI PFNGLSECONDARYCOLOR3BPROC glad_glSecondaryColor3b; -#define glSecondaryColor3b glad_glSecondaryColor3b -typedef void (APIENTRYP PFNGLSECONDARYCOLOR3BVPROC)(const GLbyte *v); -GLAPI PFNGLSECONDARYCOLOR3BVPROC glad_glSecondaryColor3bv; -#define glSecondaryColor3bv glad_glSecondaryColor3bv -typedef void (APIENTRYP PFNGLSECONDARYCOLOR3DPROC)(GLdouble red, GLdouble green, GLdouble blue); -GLAPI PFNGLSECONDARYCOLOR3DPROC glad_glSecondaryColor3d; -#define glSecondaryColor3d glad_glSecondaryColor3d -typedef void (APIENTRYP PFNGLSECONDARYCOLOR3DVPROC)(const GLdouble *v); -GLAPI PFNGLSECONDARYCOLOR3DVPROC glad_glSecondaryColor3dv; -#define glSecondaryColor3dv glad_glSecondaryColor3dv -typedef void (APIENTRYP PFNGLSECONDARYCOLOR3FPROC)(GLfloat red, GLfloat green, GLfloat blue); -GLAPI PFNGLSECONDARYCOLOR3FPROC glad_glSecondaryColor3f; -#define glSecondaryColor3f glad_glSecondaryColor3f -typedef void (APIENTRYP PFNGLSECONDARYCOLOR3FVPROC)(const GLfloat *v); -GLAPI PFNGLSECONDARYCOLOR3FVPROC glad_glSecondaryColor3fv; -#define glSecondaryColor3fv glad_glSecondaryColor3fv -typedef void (APIENTRYP PFNGLSECONDARYCOLOR3IPROC)(GLint red, GLint green, GLint blue); -GLAPI PFNGLSECONDARYCOLOR3IPROC glad_glSecondaryColor3i; -#define glSecondaryColor3i glad_glSecondaryColor3i -typedef void (APIENTRYP PFNGLSECONDARYCOLOR3IVPROC)(const GLint *v); -GLAPI PFNGLSECONDARYCOLOR3IVPROC glad_glSecondaryColor3iv; -#define glSecondaryColor3iv glad_glSecondaryColor3iv -typedef void (APIENTRYP PFNGLSECONDARYCOLOR3SPROC)(GLshort red, GLshort green, GLshort blue); -GLAPI PFNGLSECONDARYCOLOR3SPROC glad_glSecondaryColor3s; -#define glSecondaryColor3s glad_glSecondaryColor3s -typedef void (APIENTRYP PFNGLSECONDARYCOLOR3SVPROC)(const GLshort *v); -GLAPI PFNGLSECONDARYCOLOR3SVPROC glad_glSecondaryColor3sv; -#define glSecondaryColor3sv glad_glSecondaryColor3sv -typedef void (APIENTRYP PFNGLSECONDARYCOLOR3UBPROC)(GLubyte red, GLubyte green, GLubyte blue); -GLAPI PFNGLSECONDARYCOLOR3UBPROC glad_glSecondaryColor3ub; -#define glSecondaryColor3ub glad_glSecondaryColor3ub -typedef void (APIENTRYP PFNGLSECONDARYCOLOR3UBVPROC)(const GLubyte *v); -GLAPI PFNGLSECONDARYCOLOR3UBVPROC glad_glSecondaryColor3ubv; -#define glSecondaryColor3ubv glad_glSecondaryColor3ubv -typedef void (APIENTRYP PFNGLSECONDARYCOLOR3UIPROC)(GLuint red, GLuint green, GLuint blue); -GLAPI PFNGLSECONDARYCOLOR3UIPROC glad_glSecondaryColor3ui; -#define glSecondaryColor3ui glad_glSecondaryColor3ui -typedef void (APIENTRYP PFNGLSECONDARYCOLOR3UIVPROC)(const GLuint *v); -GLAPI PFNGLSECONDARYCOLOR3UIVPROC glad_glSecondaryColor3uiv; -#define glSecondaryColor3uiv glad_glSecondaryColor3uiv -typedef void (APIENTRYP PFNGLSECONDARYCOLOR3USPROC)(GLushort red, GLushort green, GLushort blue); -GLAPI PFNGLSECONDARYCOLOR3USPROC glad_glSecondaryColor3us; -#define glSecondaryColor3us glad_glSecondaryColor3us -typedef void (APIENTRYP PFNGLSECONDARYCOLOR3USVPROC)(const GLushort *v); -GLAPI PFNGLSECONDARYCOLOR3USVPROC glad_glSecondaryColor3usv; -#define glSecondaryColor3usv glad_glSecondaryColor3usv -typedef void (APIENTRYP PFNGLSECONDARYCOLORPOINTERPROC)(GLint size, GLenum type, GLsizei stride, const void *pointer); -GLAPI PFNGLSECONDARYCOLORPOINTERPROC glad_glSecondaryColorPointer; -#define glSecondaryColorPointer glad_glSecondaryColorPointer -typedef void (APIENTRYP PFNGLWINDOWPOS2DPROC)(GLdouble x, GLdouble y); -GLAPI PFNGLWINDOWPOS2DPROC glad_glWindowPos2d; -#define glWindowPos2d glad_glWindowPos2d -typedef void (APIENTRYP PFNGLWINDOWPOS2DVPROC)(const GLdouble *v); -GLAPI PFNGLWINDOWPOS2DVPROC glad_glWindowPos2dv; -#define glWindowPos2dv glad_glWindowPos2dv -typedef void (APIENTRYP PFNGLWINDOWPOS2FPROC)(GLfloat x, GLfloat y); -GLAPI PFNGLWINDOWPOS2FPROC glad_glWindowPos2f; -#define glWindowPos2f glad_glWindowPos2f -typedef void (APIENTRYP PFNGLWINDOWPOS2FVPROC)(const GLfloat *v); -GLAPI PFNGLWINDOWPOS2FVPROC glad_glWindowPos2fv; -#define glWindowPos2fv glad_glWindowPos2fv -typedef void (APIENTRYP PFNGLWINDOWPOS2IPROC)(GLint x, GLint y); -GLAPI PFNGLWINDOWPOS2IPROC glad_glWindowPos2i; -#define glWindowPos2i glad_glWindowPos2i -typedef void (APIENTRYP PFNGLWINDOWPOS2IVPROC)(const GLint *v); -GLAPI PFNGLWINDOWPOS2IVPROC glad_glWindowPos2iv; -#define glWindowPos2iv glad_glWindowPos2iv -typedef void (APIENTRYP PFNGLWINDOWPOS2SPROC)(GLshort x, GLshort y); -GLAPI PFNGLWINDOWPOS2SPROC glad_glWindowPos2s; -#define glWindowPos2s glad_glWindowPos2s -typedef void (APIENTRYP PFNGLWINDOWPOS2SVPROC)(const GLshort *v); -GLAPI PFNGLWINDOWPOS2SVPROC glad_glWindowPos2sv; -#define glWindowPos2sv glad_glWindowPos2sv -typedef void (APIENTRYP PFNGLWINDOWPOS3DPROC)(GLdouble x, GLdouble y, GLdouble z); -GLAPI PFNGLWINDOWPOS3DPROC glad_glWindowPos3d; -#define glWindowPos3d glad_glWindowPos3d -typedef void (APIENTRYP PFNGLWINDOWPOS3DVPROC)(const GLdouble *v); -GLAPI PFNGLWINDOWPOS3DVPROC glad_glWindowPos3dv; -#define glWindowPos3dv glad_glWindowPos3dv -typedef void (APIENTRYP PFNGLWINDOWPOS3FPROC)(GLfloat x, GLfloat y, GLfloat z); -GLAPI PFNGLWINDOWPOS3FPROC glad_glWindowPos3f; -#define glWindowPos3f glad_glWindowPos3f -typedef void (APIENTRYP PFNGLWINDOWPOS3FVPROC)(const GLfloat *v); -GLAPI PFNGLWINDOWPOS3FVPROC glad_glWindowPos3fv; -#define glWindowPos3fv glad_glWindowPos3fv -typedef void (APIENTRYP PFNGLWINDOWPOS3IPROC)(GLint x, GLint y, GLint z); -GLAPI PFNGLWINDOWPOS3IPROC glad_glWindowPos3i; -#define glWindowPos3i glad_glWindowPos3i -typedef void (APIENTRYP PFNGLWINDOWPOS3IVPROC)(const GLint *v); -GLAPI PFNGLWINDOWPOS3IVPROC glad_glWindowPos3iv; -#define glWindowPos3iv glad_glWindowPos3iv -typedef void (APIENTRYP PFNGLWINDOWPOS3SPROC)(GLshort x, GLshort y, GLshort z); -GLAPI PFNGLWINDOWPOS3SPROC glad_glWindowPos3s; -#define glWindowPos3s glad_glWindowPos3s -typedef void (APIENTRYP PFNGLWINDOWPOS3SVPROC)(const GLshort *v); -GLAPI PFNGLWINDOWPOS3SVPROC glad_glWindowPos3sv; -#define glWindowPos3sv glad_glWindowPos3sv -typedef void (APIENTRYP PFNGLBLENDCOLORPROC)(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha); -GLAPI PFNGLBLENDCOLORPROC glad_glBlendColor; -#define glBlendColor glad_glBlendColor -typedef void (APIENTRYP PFNGLBLENDEQUATIONPROC)(GLenum mode); -GLAPI PFNGLBLENDEQUATIONPROC glad_glBlendEquation; -#define glBlendEquation glad_glBlendEquation -#endif -#ifndef GL_VERSION_1_5 -#define GL_VERSION_1_5 1 -GLAPI int GLAD_GL_VERSION_1_5; -typedef void (APIENTRYP PFNGLGENQUERIESPROC)(GLsizei n, GLuint *ids); -GLAPI PFNGLGENQUERIESPROC glad_glGenQueries; -#define glGenQueries glad_glGenQueries -typedef void (APIENTRYP PFNGLDELETEQUERIESPROC)(GLsizei n, const GLuint *ids); -GLAPI PFNGLDELETEQUERIESPROC glad_glDeleteQueries; -#define glDeleteQueries glad_glDeleteQueries -typedef GLboolean (APIENTRYP PFNGLISQUERYPROC)(GLuint id); -GLAPI PFNGLISQUERYPROC glad_glIsQuery; -#define glIsQuery glad_glIsQuery -typedef void (APIENTRYP PFNGLBEGINQUERYPROC)(GLenum target, GLuint id); -GLAPI PFNGLBEGINQUERYPROC glad_glBeginQuery; -#define glBeginQuery glad_glBeginQuery -typedef void (APIENTRYP PFNGLENDQUERYPROC)(GLenum target); -GLAPI PFNGLENDQUERYPROC glad_glEndQuery; -#define glEndQuery glad_glEndQuery -typedef void (APIENTRYP PFNGLGETQUERYIVPROC)(GLenum target, GLenum pname, GLint *params); -GLAPI PFNGLGETQUERYIVPROC glad_glGetQueryiv; -#define glGetQueryiv glad_glGetQueryiv -typedef void (APIENTRYP PFNGLGETQUERYOBJECTIVPROC)(GLuint id, GLenum pname, GLint *params); -GLAPI PFNGLGETQUERYOBJECTIVPROC glad_glGetQueryObjectiv; -#define glGetQueryObjectiv glad_glGetQueryObjectiv -typedef void (APIENTRYP PFNGLGETQUERYOBJECTUIVPROC)(GLuint id, GLenum pname, GLuint *params); -GLAPI PFNGLGETQUERYOBJECTUIVPROC glad_glGetQueryObjectuiv; -#define glGetQueryObjectuiv glad_glGetQueryObjectuiv -typedef void (APIENTRYP PFNGLBINDBUFFERPROC)(GLenum target, GLuint buffer); -GLAPI PFNGLBINDBUFFERPROC glad_glBindBuffer; -#define glBindBuffer glad_glBindBuffer -typedef void (APIENTRYP PFNGLDELETEBUFFERSPROC)(GLsizei n, const GLuint *buffers); -GLAPI PFNGLDELETEBUFFERSPROC glad_glDeleteBuffers; -#define glDeleteBuffers glad_glDeleteBuffers -typedef void (APIENTRYP PFNGLGENBUFFERSPROC)(GLsizei n, GLuint *buffers); -GLAPI PFNGLGENBUFFERSPROC glad_glGenBuffers; -#define glGenBuffers glad_glGenBuffers -typedef GLboolean (APIENTRYP PFNGLISBUFFERPROC)(GLuint buffer); -GLAPI PFNGLISBUFFERPROC glad_glIsBuffer; -#define glIsBuffer glad_glIsBuffer -typedef void (APIENTRYP PFNGLBUFFERDATAPROC)(GLenum target, GLsizeiptr size, const void *data, GLenum usage); -GLAPI PFNGLBUFFERDATAPROC glad_glBufferData; -#define glBufferData glad_glBufferData -typedef void (APIENTRYP PFNGLBUFFERSUBDATAPROC)(GLenum target, GLintptr offset, GLsizeiptr size, const void *data); -GLAPI PFNGLBUFFERSUBDATAPROC glad_glBufferSubData; -#define glBufferSubData glad_glBufferSubData -typedef void (APIENTRYP PFNGLGETBUFFERSUBDATAPROC)(GLenum target, GLintptr offset, GLsizeiptr size, void *data); -GLAPI PFNGLGETBUFFERSUBDATAPROC glad_glGetBufferSubData; -#define glGetBufferSubData glad_glGetBufferSubData -typedef void * (APIENTRYP PFNGLMAPBUFFERPROC)(GLenum target, GLenum access); -GLAPI PFNGLMAPBUFFERPROC glad_glMapBuffer; -#define glMapBuffer glad_glMapBuffer -typedef GLboolean (APIENTRYP PFNGLUNMAPBUFFERPROC)(GLenum target); -GLAPI PFNGLUNMAPBUFFERPROC glad_glUnmapBuffer; -#define glUnmapBuffer glad_glUnmapBuffer -typedef void (APIENTRYP PFNGLGETBUFFERPARAMETERIVPROC)(GLenum target, GLenum pname, GLint *params); -GLAPI PFNGLGETBUFFERPARAMETERIVPROC glad_glGetBufferParameteriv; -#define glGetBufferParameteriv glad_glGetBufferParameteriv -typedef void (APIENTRYP PFNGLGETBUFFERPOINTERVPROC)(GLenum target, GLenum pname, void **params); -GLAPI PFNGLGETBUFFERPOINTERVPROC glad_glGetBufferPointerv; -#define glGetBufferPointerv glad_glGetBufferPointerv -#endif -#ifndef GL_VERSION_2_0 -#define GL_VERSION_2_0 1 -GLAPI int GLAD_GL_VERSION_2_0; -typedef void (APIENTRYP PFNGLBLENDEQUATIONSEPARATEPROC)(GLenum modeRGB, GLenum modeAlpha); -GLAPI PFNGLBLENDEQUATIONSEPARATEPROC glad_glBlendEquationSeparate; -#define glBlendEquationSeparate glad_glBlendEquationSeparate -typedef void (APIENTRYP PFNGLDRAWBUFFERSPROC)(GLsizei n, const GLenum *bufs); -GLAPI PFNGLDRAWBUFFERSPROC glad_glDrawBuffers; -#define glDrawBuffers glad_glDrawBuffers -typedef void (APIENTRYP PFNGLSTENCILOPSEPARATEPROC)(GLenum face, GLenum sfail, GLenum dpfail, GLenum dppass); -GLAPI PFNGLSTENCILOPSEPARATEPROC glad_glStencilOpSeparate; -#define glStencilOpSeparate glad_glStencilOpSeparate -typedef void (APIENTRYP PFNGLSTENCILFUNCSEPARATEPROC)(GLenum face, GLenum func, GLint ref, GLuint mask); -GLAPI PFNGLSTENCILFUNCSEPARATEPROC glad_glStencilFuncSeparate; -#define glStencilFuncSeparate glad_glStencilFuncSeparate -typedef void (APIENTRYP PFNGLSTENCILMASKSEPARATEPROC)(GLenum face, GLuint mask); -GLAPI PFNGLSTENCILMASKSEPARATEPROC glad_glStencilMaskSeparate; -#define glStencilMaskSeparate glad_glStencilMaskSeparate -typedef void (APIENTRYP PFNGLATTACHSHADERPROC)(GLuint program, GLuint shader); -GLAPI PFNGLATTACHSHADERPROC glad_glAttachShader; -#define glAttachShader glad_glAttachShader -typedef void (APIENTRYP PFNGLBINDATTRIBLOCATIONPROC)(GLuint program, GLuint index, const GLchar *name); -GLAPI PFNGLBINDATTRIBLOCATIONPROC glad_glBindAttribLocation; -#define glBindAttribLocation glad_glBindAttribLocation -typedef void (APIENTRYP PFNGLCOMPILESHADERPROC)(GLuint shader); -GLAPI PFNGLCOMPILESHADERPROC glad_glCompileShader; -#define glCompileShader glad_glCompileShader -typedef GLuint (APIENTRYP PFNGLCREATEPROGRAMPROC)(void); -GLAPI PFNGLCREATEPROGRAMPROC glad_glCreateProgram; -#define glCreateProgram glad_glCreateProgram -typedef GLuint (APIENTRYP PFNGLCREATESHADERPROC)(GLenum type); -GLAPI PFNGLCREATESHADERPROC glad_glCreateShader; -#define glCreateShader glad_glCreateShader -typedef void (APIENTRYP PFNGLDELETEPROGRAMPROC)(GLuint program); -GLAPI PFNGLDELETEPROGRAMPROC glad_glDeleteProgram; -#define glDeleteProgram glad_glDeleteProgram -typedef void (APIENTRYP PFNGLDELETESHADERPROC)(GLuint shader); -GLAPI PFNGLDELETESHADERPROC glad_glDeleteShader; -#define glDeleteShader glad_glDeleteShader -typedef void (APIENTRYP PFNGLDETACHSHADERPROC)(GLuint program, GLuint shader); -GLAPI PFNGLDETACHSHADERPROC glad_glDetachShader; -#define glDetachShader glad_glDetachShader -typedef void (APIENTRYP PFNGLDISABLEVERTEXATTRIBARRAYPROC)(GLuint index); -GLAPI PFNGLDISABLEVERTEXATTRIBARRAYPROC glad_glDisableVertexAttribArray; -#define glDisableVertexAttribArray glad_glDisableVertexAttribArray -typedef void (APIENTRYP PFNGLENABLEVERTEXATTRIBARRAYPROC)(GLuint index); -GLAPI PFNGLENABLEVERTEXATTRIBARRAYPROC glad_glEnableVertexAttribArray; -#define glEnableVertexAttribArray glad_glEnableVertexAttribArray -typedef void (APIENTRYP PFNGLGETACTIVEATTRIBPROC)(GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name); -GLAPI PFNGLGETACTIVEATTRIBPROC glad_glGetActiveAttrib; -#define glGetActiveAttrib glad_glGetActiveAttrib -typedef void (APIENTRYP PFNGLGETACTIVEUNIFORMPROC)(GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name); -GLAPI PFNGLGETACTIVEUNIFORMPROC glad_glGetActiveUniform; -#define glGetActiveUniform glad_glGetActiveUniform -typedef void (APIENTRYP PFNGLGETATTACHEDSHADERSPROC)(GLuint program, GLsizei maxCount, GLsizei *count, GLuint *shaders); -GLAPI PFNGLGETATTACHEDSHADERSPROC glad_glGetAttachedShaders; -#define glGetAttachedShaders glad_glGetAttachedShaders -typedef GLint (APIENTRYP PFNGLGETATTRIBLOCATIONPROC)(GLuint program, const GLchar *name); -GLAPI PFNGLGETATTRIBLOCATIONPROC glad_glGetAttribLocation; -#define glGetAttribLocation glad_glGetAttribLocation -typedef void (APIENTRYP PFNGLGETPROGRAMIVPROC)(GLuint program, GLenum pname, GLint *params); -GLAPI PFNGLGETPROGRAMIVPROC glad_glGetProgramiv; -#define glGetProgramiv glad_glGetProgramiv -typedef void (APIENTRYP PFNGLGETPROGRAMINFOLOGPROC)(GLuint program, GLsizei bufSize, GLsizei *length, GLchar *infoLog); -GLAPI PFNGLGETPROGRAMINFOLOGPROC glad_glGetProgramInfoLog; -#define glGetProgramInfoLog glad_glGetProgramInfoLog -typedef void (APIENTRYP PFNGLGETSHADERIVPROC)(GLuint shader, GLenum pname, GLint *params); -GLAPI PFNGLGETSHADERIVPROC glad_glGetShaderiv; -#define glGetShaderiv glad_glGetShaderiv -typedef void (APIENTRYP PFNGLGETSHADERINFOLOGPROC)(GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *infoLog); -GLAPI PFNGLGETSHADERINFOLOGPROC glad_glGetShaderInfoLog; -#define glGetShaderInfoLog glad_glGetShaderInfoLog -typedef void (APIENTRYP PFNGLGETSHADERSOURCEPROC)(GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *source); -GLAPI PFNGLGETSHADERSOURCEPROC glad_glGetShaderSource; -#define glGetShaderSource glad_glGetShaderSource -typedef GLint (APIENTRYP PFNGLGETUNIFORMLOCATIONPROC)(GLuint program, const GLchar *name); -GLAPI PFNGLGETUNIFORMLOCATIONPROC glad_glGetUniformLocation; -#define glGetUniformLocation glad_glGetUniformLocation -typedef void (APIENTRYP PFNGLGETUNIFORMFVPROC)(GLuint program, GLint location, GLfloat *params); -GLAPI PFNGLGETUNIFORMFVPROC glad_glGetUniformfv; -#define glGetUniformfv glad_glGetUniformfv -typedef void (APIENTRYP PFNGLGETUNIFORMIVPROC)(GLuint program, GLint location, GLint *params); -GLAPI PFNGLGETUNIFORMIVPROC glad_glGetUniformiv; -#define glGetUniformiv glad_glGetUniformiv -typedef void (APIENTRYP PFNGLGETVERTEXATTRIBDVPROC)(GLuint index, GLenum pname, GLdouble *params); -GLAPI PFNGLGETVERTEXATTRIBDVPROC glad_glGetVertexAttribdv; -#define glGetVertexAttribdv glad_glGetVertexAttribdv -typedef void (APIENTRYP PFNGLGETVERTEXATTRIBFVPROC)(GLuint index, GLenum pname, GLfloat *params); -GLAPI PFNGLGETVERTEXATTRIBFVPROC glad_glGetVertexAttribfv; -#define glGetVertexAttribfv glad_glGetVertexAttribfv -typedef void (APIENTRYP PFNGLGETVERTEXATTRIBIVPROC)(GLuint index, GLenum pname, GLint *params); -GLAPI PFNGLGETVERTEXATTRIBIVPROC glad_glGetVertexAttribiv; -#define glGetVertexAttribiv glad_glGetVertexAttribiv -typedef void (APIENTRYP PFNGLGETVERTEXATTRIBPOINTERVPROC)(GLuint index, GLenum pname, void **pointer); -GLAPI PFNGLGETVERTEXATTRIBPOINTERVPROC glad_glGetVertexAttribPointerv; -#define glGetVertexAttribPointerv glad_glGetVertexAttribPointerv -typedef GLboolean (APIENTRYP PFNGLISPROGRAMPROC)(GLuint program); -GLAPI PFNGLISPROGRAMPROC glad_glIsProgram; -#define glIsProgram glad_glIsProgram -typedef GLboolean (APIENTRYP PFNGLISSHADERPROC)(GLuint shader); -GLAPI PFNGLISSHADERPROC glad_glIsShader; -#define glIsShader glad_glIsShader -typedef void (APIENTRYP PFNGLLINKPROGRAMPROC)(GLuint program); -GLAPI PFNGLLINKPROGRAMPROC glad_glLinkProgram; -#define glLinkProgram glad_glLinkProgram -typedef void (APIENTRYP PFNGLSHADERSOURCEPROC)(GLuint shader, GLsizei count, const GLchar *const*string, const GLint *length); -GLAPI PFNGLSHADERSOURCEPROC glad_glShaderSource; -#define glShaderSource glad_glShaderSource -typedef void (APIENTRYP PFNGLUSEPROGRAMPROC)(GLuint program); -GLAPI PFNGLUSEPROGRAMPROC glad_glUseProgram; -#define glUseProgram glad_glUseProgram -typedef void (APIENTRYP PFNGLUNIFORM1FPROC)(GLint location, GLfloat v0); -GLAPI PFNGLUNIFORM1FPROC glad_glUniform1f; -#define glUniform1f glad_glUniform1f -typedef void (APIENTRYP PFNGLUNIFORM2FPROC)(GLint location, GLfloat v0, GLfloat v1); -GLAPI PFNGLUNIFORM2FPROC glad_glUniform2f; -#define glUniform2f glad_glUniform2f -typedef void (APIENTRYP PFNGLUNIFORM3FPROC)(GLint location, GLfloat v0, GLfloat v1, GLfloat v2); -GLAPI PFNGLUNIFORM3FPROC glad_glUniform3f; -#define glUniform3f glad_glUniform3f -typedef void (APIENTRYP PFNGLUNIFORM4FPROC)(GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3); -GLAPI PFNGLUNIFORM4FPROC glad_glUniform4f; -#define glUniform4f glad_glUniform4f -typedef void (APIENTRYP PFNGLUNIFORM1IPROC)(GLint location, GLint v0); -GLAPI PFNGLUNIFORM1IPROC glad_glUniform1i; -#define glUniform1i glad_glUniform1i -typedef void (APIENTRYP PFNGLUNIFORM2IPROC)(GLint location, GLint v0, GLint v1); -GLAPI PFNGLUNIFORM2IPROC glad_glUniform2i; -#define glUniform2i glad_glUniform2i -typedef void (APIENTRYP PFNGLUNIFORM3IPROC)(GLint location, GLint v0, GLint v1, GLint v2); -GLAPI PFNGLUNIFORM3IPROC glad_glUniform3i; -#define glUniform3i glad_glUniform3i -typedef void (APIENTRYP PFNGLUNIFORM4IPROC)(GLint location, GLint v0, GLint v1, GLint v2, GLint v3); -GLAPI PFNGLUNIFORM4IPROC glad_glUniform4i; -#define glUniform4i glad_glUniform4i -typedef void (APIENTRYP PFNGLUNIFORM1FVPROC)(GLint location, GLsizei count, const GLfloat *value); -GLAPI PFNGLUNIFORM1FVPROC glad_glUniform1fv; -#define glUniform1fv glad_glUniform1fv -typedef void (APIENTRYP PFNGLUNIFORM2FVPROC)(GLint location, GLsizei count, const GLfloat *value); -GLAPI PFNGLUNIFORM2FVPROC glad_glUniform2fv; -#define glUniform2fv glad_glUniform2fv -typedef void (APIENTRYP PFNGLUNIFORM3FVPROC)(GLint location, GLsizei count, const GLfloat *value); -GLAPI PFNGLUNIFORM3FVPROC glad_glUniform3fv; -#define glUniform3fv glad_glUniform3fv -typedef void (APIENTRYP PFNGLUNIFORM4FVPROC)(GLint location, GLsizei count, const GLfloat *value); -GLAPI PFNGLUNIFORM4FVPROC glad_glUniform4fv; -#define glUniform4fv glad_glUniform4fv -typedef void (APIENTRYP PFNGLUNIFORM1IVPROC)(GLint location, GLsizei count, const GLint *value); -GLAPI PFNGLUNIFORM1IVPROC glad_glUniform1iv; -#define glUniform1iv glad_glUniform1iv -typedef void (APIENTRYP PFNGLUNIFORM2IVPROC)(GLint location, GLsizei count, const GLint *value); -GLAPI PFNGLUNIFORM2IVPROC glad_glUniform2iv; -#define glUniform2iv glad_glUniform2iv -typedef void (APIENTRYP PFNGLUNIFORM3IVPROC)(GLint location, GLsizei count, const GLint *value); -GLAPI PFNGLUNIFORM3IVPROC glad_glUniform3iv; -#define glUniform3iv glad_glUniform3iv -typedef void (APIENTRYP PFNGLUNIFORM4IVPROC)(GLint location, GLsizei count, const GLint *value); -GLAPI PFNGLUNIFORM4IVPROC glad_glUniform4iv; -#define glUniform4iv glad_glUniform4iv -typedef void (APIENTRYP PFNGLUNIFORMMATRIX2FVPROC)(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -GLAPI PFNGLUNIFORMMATRIX2FVPROC glad_glUniformMatrix2fv; -#define glUniformMatrix2fv glad_glUniformMatrix2fv -typedef void (APIENTRYP PFNGLUNIFORMMATRIX3FVPROC)(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -GLAPI PFNGLUNIFORMMATRIX3FVPROC glad_glUniformMatrix3fv; -#define glUniformMatrix3fv glad_glUniformMatrix3fv -typedef void (APIENTRYP PFNGLUNIFORMMATRIX4FVPROC)(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -GLAPI PFNGLUNIFORMMATRIX4FVPROC glad_glUniformMatrix4fv; -#define glUniformMatrix4fv glad_glUniformMatrix4fv -typedef void (APIENTRYP PFNGLVALIDATEPROGRAMPROC)(GLuint program); -GLAPI PFNGLVALIDATEPROGRAMPROC glad_glValidateProgram; -#define glValidateProgram glad_glValidateProgram -typedef void (APIENTRYP PFNGLVERTEXATTRIB1DPROC)(GLuint index, GLdouble x); -GLAPI PFNGLVERTEXATTRIB1DPROC glad_glVertexAttrib1d; -#define glVertexAttrib1d glad_glVertexAttrib1d -typedef void (APIENTRYP PFNGLVERTEXATTRIB1DVPROC)(GLuint index, const GLdouble *v); -GLAPI PFNGLVERTEXATTRIB1DVPROC glad_glVertexAttrib1dv; -#define glVertexAttrib1dv glad_glVertexAttrib1dv -typedef void (APIENTRYP PFNGLVERTEXATTRIB1FPROC)(GLuint index, GLfloat x); -GLAPI PFNGLVERTEXATTRIB1FPROC glad_glVertexAttrib1f; -#define glVertexAttrib1f glad_glVertexAttrib1f -typedef void (APIENTRYP PFNGLVERTEXATTRIB1FVPROC)(GLuint index, const GLfloat *v); -GLAPI PFNGLVERTEXATTRIB1FVPROC glad_glVertexAttrib1fv; -#define glVertexAttrib1fv glad_glVertexAttrib1fv -typedef void (APIENTRYP PFNGLVERTEXATTRIB1SPROC)(GLuint index, GLshort x); -GLAPI PFNGLVERTEXATTRIB1SPROC glad_glVertexAttrib1s; -#define glVertexAttrib1s glad_glVertexAttrib1s -typedef void (APIENTRYP PFNGLVERTEXATTRIB1SVPROC)(GLuint index, const GLshort *v); -GLAPI PFNGLVERTEXATTRIB1SVPROC glad_glVertexAttrib1sv; -#define glVertexAttrib1sv glad_glVertexAttrib1sv -typedef void (APIENTRYP PFNGLVERTEXATTRIB2DPROC)(GLuint index, GLdouble x, GLdouble y); -GLAPI PFNGLVERTEXATTRIB2DPROC glad_glVertexAttrib2d; -#define glVertexAttrib2d glad_glVertexAttrib2d -typedef void (APIENTRYP PFNGLVERTEXATTRIB2DVPROC)(GLuint index, const GLdouble *v); -GLAPI PFNGLVERTEXATTRIB2DVPROC glad_glVertexAttrib2dv; -#define glVertexAttrib2dv glad_glVertexAttrib2dv -typedef void (APIENTRYP PFNGLVERTEXATTRIB2FPROC)(GLuint index, GLfloat x, GLfloat y); -GLAPI PFNGLVERTEXATTRIB2FPROC glad_glVertexAttrib2f; -#define glVertexAttrib2f glad_glVertexAttrib2f -typedef void (APIENTRYP PFNGLVERTEXATTRIB2FVPROC)(GLuint index, const GLfloat *v); -GLAPI PFNGLVERTEXATTRIB2FVPROC glad_glVertexAttrib2fv; -#define glVertexAttrib2fv glad_glVertexAttrib2fv -typedef void (APIENTRYP PFNGLVERTEXATTRIB2SPROC)(GLuint index, GLshort x, GLshort y); -GLAPI PFNGLVERTEXATTRIB2SPROC glad_glVertexAttrib2s; -#define glVertexAttrib2s glad_glVertexAttrib2s -typedef void (APIENTRYP PFNGLVERTEXATTRIB2SVPROC)(GLuint index, const GLshort *v); -GLAPI PFNGLVERTEXATTRIB2SVPROC glad_glVertexAttrib2sv; -#define glVertexAttrib2sv glad_glVertexAttrib2sv -typedef void (APIENTRYP PFNGLVERTEXATTRIB3DPROC)(GLuint index, GLdouble x, GLdouble y, GLdouble z); -GLAPI PFNGLVERTEXATTRIB3DPROC glad_glVertexAttrib3d; -#define glVertexAttrib3d glad_glVertexAttrib3d -typedef void (APIENTRYP PFNGLVERTEXATTRIB3DVPROC)(GLuint index, const GLdouble *v); -GLAPI PFNGLVERTEXATTRIB3DVPROC glad_glVertexAttrib3dv; -#define glVertexAttrib3dv glad_glVertexAttrib3dv -typedef void (APIENTRYP PFNGLVERTEXATTRIB3FPROC)(GLuint index, GLfloat x, GLfloat y, GLfloat z); -GLAPI PFNGLVERTEXATTRIB3FPROC glad_glVertexAttrib3f; -#define glVertexAttrib3f glad_glVertexAttrib3f -typedef void (APIENTRYP PFNGLVERTEXATTRIB3FVPROC)(GLuint index, const GLfloat *v); -GLAPI PFNGLVERTEXATTRIB3FVPROC glad_glVertexAttrib3fv; -#define glVertexAttrib3fv glad_glVertexAttrib3fv -typedef void (APIENTRYP PFNGLVERTEXATTRIB3SPROC)(GLuint index, GLshort x, GLshort y, GLshort z); -GLAPI PFNGLVERTEXATTRIB3SPROC glad_glVertexAttrib3s; -#define glVertexAttrib3s glad_glVertexAttrib3s -typedef void (APIENTRYP PFNGLVERTEXATTRIB3SVPROC)(GLuint index, const GLshort *v); -GLAPI PFNGLVERTEXATTRIB3SVPROC glad_glVertexAttrib3sv; -#define glVertexAttrib3sv glad_glVertexAttrib3sv -typedef void (APIENTRYP PFNGLVERTEXATTRIB4NBVPROC)(GLuint index, const GLbyte *v); -GLAPI PFNGLVERTEXATTRIB4NBVPROC glad_glVertexAttrib4Nbv; -#define glVertexAttrib4Nbv glad_glVertexAttrib4Nbv -typedef void (APIENTRYP PFNGLVERTEXATTRIB4NIVPROC)(GLuint index, const GLint *v); -GLAPI PFNGLVERTEXATTRIB4NIVPROC glad_glVertexAttrib4Niv; -#define glVertexAttrib4Niv glad_glVertexAttrib4Niv -typedef void (APIENTRYP PFNGLVERTEXATTRIB4NSVPROC)(GLuint index, const GLshort *v); -GLAPI PFNGLVERTEXATTRIB4NSVPROC glad_glVertexAttrib4Nsv; -#define glVertexAttrib4Nsv glad_glVertexAttrib4Nsv -typedef void (APIENTRYP PFNGLVERTEXATTRIB4NUBPROC)(GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w); -GLAPI PFNGLVERTEXATTRIB4NUBPROC glad_glVertexAttrib4Nub; -#define glVertexAttrib4Nub glad_glVertexAttrib4Nub -typedef void (APIENTRYP PFNGLVERTEXATTRIB4NUBVPROC)(GLuint index, const GLubyte *v); -GLAPI PFNGLVERTEXATTRIB4NUBVPROC glad_glVertexAttrib4Nubv; -#define glVertexAttrib4Nubv glad_glVertexAttrib4Nubv -typedef void (APIENTRYP PFNGLVERTEXATTRIB4NUIVPROC)(GLuint index, const GLuint *v); -GLAPI PFNGLVERTEXATTRIB4NUIVPROC glad_glVertexAttrib4Nuiv; -#define glVertexAttrib4Nuiv glad_glVertexAttrib4Nuiv -typedef void (APIENTRYP PFNGLVERTEXATTRIB4NUSVPROC)(GLuint index, const GLushort *v); -GLAPI PFNGLVERTEXATTRIB4NUSVPROC glad_glVertexAttrib4Nusv; -#define glVertexAttrib4Nusv glad_glVertexAttrib4Nusv -typedef void (APIENTRYP PFNGLVERTEXATTRIB4BVPROC)(GLuint index, const GLbyte *v); -GLAPI PFNGLVERTEXATTRIB4BVPROC glad_glVertexAttrib4bv; -#define glVertexAttrib4bv glad_glVertexAttrib4bv -typedef void (APIENTRYP PFNGLVERTEXATTRIB4DPROC)(GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); -GLAPI PFNGLVERTEXATTRIB4DPROC glad_glVertexAttrib4d; -#define glVertexAttrib4d glad_glVertexAttrib4d -typedef void (APIENTRYP PFNGLVERTEXATTRIB4DVPROC)(GLuint index, const GLdouble *v); -GLAPI PFNGLVERTEXATTRIB4DVPROC glad_glVertexAttrib4dv; -#define glVertexAttrib4dv glad_glVertexAttrib4dv -typedef void (APIENTRYP PFNGLVERTEXATTRIB4FPROC)(GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); -GLAPI PFNGLVERTEXATTRIB4FPROC glad_glVertexAttrib4f; -#define glVertexAttrib4f glad_glVertexAttrib4f -typedef void (APIENTRYP PFNGLVERTEXATTRIB4FVPROC)(GLuint index, const GLfloat *v); -GLAPI PFNGLVERTEXATTRIB4FVPROC glad_glVertexAttrib4fv; -#define glVertexAttrib4fv glad_glVertexAttrib4fv -typedef void (APIENTRYP PFNGLVERTEXATTRIB4IVPROC)(GLuint index, const GLint *v); -GLAPI PFNGLVERTEXATTRIB4IVPROC glad_glVertexAttrib4iv; -#define glVertexAttrib4iv glad_glVertexAttrib4iv -typedef void (APIENTRYP PFNGLVERTEXATTRIB4SPROC)(GLuint index, GLshort x, GLshort y, GLshort z, GLshort w); -GLAPI PFNGLVERTEXATTRIB4SPROC glad_glVertexAttrib4s; -#define glVertexAttrib4s glad_glVertexAttrib4s -typedef void (APIENTRYP PFNGLVERTEXATTRIB4SVPROC)(GLuint index, const GLshort *v); -GLAPI PFNGLVERTEXATTRIB4SVPROC glad_glVertexAttrib4sv; -#define glVertexAttrib4sv glad_glVertexAttrib4sv -typedef void (APIENTRYP PFNGLVERTEXATTRIB4UBVPROC)(GLuint index, const GLubyte *v); -GLAPI PFNGLVERTEXATTRIB4UBVPROC glad_glVertexAttrib4ubv; -#define glVertexAttrib4ubv glad_glVertexAttrib4ubv -typedef void (APIENTRYP PFNGLVERTEXATTRIB4UIVPROC)(GLuint index, const GLuint *v); -GLAPI PFNGLVERTEXATTRIB4UIVPROC glad_glVertexAttrib4uiv; -#define glVertexAttrib4uiv glad_glVertexAttrib4uiv -typedef void (APIENTRYP PFNGLVERTEXATTRIB4USVPROC)(GLuint index, const GLushort *v); -GLAPI PFNGLVERTEXATTRIB4USVPROC glad_glVertexAttrib4usv; -#define glVertexAttrib4usv glad_glVertexAttrib4usv -typedef void (APIENTRYP PFNGLVERTEXATTRIBPOINTERPROC)(GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const void *pointer); -GLAPI PFNGLVERTEXATTRIBPOINTERPROC glad_glVertexAttribPointer; -#define glVertexAttribPointer glad_glVertexAttribPointer -#endif -#ifndef GL_VERSION_2_1 -#define GL_VERSION_2_1 1 -GLAPI int GLAD_GL_VERSION_2_1; -typedef void (APIENTRYP PFNGLUNIFORMMATRIX2X3FVPROC)(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -GLAPI PFNGLUNIFORMMATRIX2X3FVPROC glad_glUniformMatrix2x3fv; -#define glUniformMatrix2x3fv glad_glUniformMatrix2x3fv -typedef void (APIENTRYP PFNGLUNIFORMMATRIX3X2FVPROC)(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -GLAPI PFNGLUNIFORMMATRIX3X2FVPROC glad_glUniformMatrix3x2fv; -#define glUniformMatrix3x2fv glad_glUniformMatrix3x2fv -typedef void (APIENTRYP PFNGLUNIFORMMATRIX2X4FVPROC)(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -GLAPI PFNGLUNIFORMMATRIX2X4FVPROC glad_glUniformMatrix2x4fv; -#define glUniformMatrix2x4fv glad_glUniformMatrix2x4fv -typedef void (APIENTRYP PFNGLUNIFORMMATRIX4X2FVPROC)(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -GLAPI PFNGLUNIFORMMATRIX4X2FVPROC glad_glUniformMatrix4x2fv; -#define glUniformMatrix4x2fv glad_glUniformMatrix4x2fv -typedef void (APIENTRYP PFNGLUNIFORMMATRIX3X4FVPROC)(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -GLAPI PFNGLUNIFORMMATRIX3X4FVPROC glad_glUniformMatrix3x4fv; -#define glUniformMatrix3x4fv glad_glUniformMatrix3x4fv -typedef void (APIENTRYP PFNGLUNIFORMMATRIX4X3FVPROC)(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -GLAPI PFNGLUNIFORMMATRIX4X3FVPROC glad_glUniformMatrix4x3fv; -#define glUniformMatrix4x3fv glad_glUniformMatrix4x3fv -#endif -#ifndef GL_VERSION_3_0 -#define GL_VERSION_3_0 1 -GLAPI int GLAD_GL_VERSION_3_0; -typedef void (APIENTRYP PFNGLCOLORMASKIPROC)(GLuint index, GLboolean r, GLboolean g, GLboolean b, GLboolean a); -GLAPI PFNGLCOLORMASKIPROC glad_glColorMaski; -#define glColorMaski glad_glColorMaski -typedef void (APIENTRYP PFNGLGETBOOLEANI_VPROC)(GLenum target, GLuint index, GLboolean *data); -GLAPI PFNGLGETBOOLEANI_VPROC glad_glGetBooleani_v; -#define glGetBooleani_v glad_glGetBooleani_v -typedef void (APIENTRYP PFNGLGETINTEGERI_VPROC)(GLenum target, GLuint index, GLint *data); -GLAPI PFNGLGETINTEGERI_VPROC glad_glGetIntegeri_v; -#define glGetIntegeri_v glad_glGetIntegeri_v -typedef void (APIENTRYP PFNGLENABLEIPROC)(GLenum target, GLuint index); -GLAPI PFNGLENABLEIPROC glad_glEnablei; -#define glEnablei glad_glEnablei -typedef void (APIENTRYP PFNGLDISABLEIPROC)(GLenum target, GLuint index); -GLAPI PFNGLDISABLEIPROC glad_glDisablei; -#define glDisablei glad_glDisablei -typedef GLboolean (APIENTRYP PFNGLISENABLEDIPROC)(GLenum target, GLuint index); -GLAPI PFNGLISENABLEDIPROC glad_glIsEnabledi; -#define glIsEnabledi glad_glIsEnabledi -typedef void (APIENTRYP PFNGLBEGINTRANSFORMFEEDBACKPROC)(GLenum primitiveMode); -GLAPI PFNGLBEGINTRANSFORMFEEDBACKPROC glad_glBeginTransformFeedback; -#define glBeginTransformFeedback glad_glBeginTransformFeedback -typedef void (APIENTRYP PFNGLENDTRANSFORMFEEDBACKPROC)(void); -GLAPI PFNGLENDTRANSFORMFEEDBACKPROC glad_glEndTransformFeedback; -#define glEndTransformFeedback glad_glEndTransformFeedback -typedef void (APIENTRYP PFNGLBINDBUFFERRANGEPROC)(GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size); -GLAPI PFNGLBINDBUFFERRANGEPROC glad_glBindBufferRange; -#define glBindBufferRange glad_glBindBufferRange -typedef void (APIENTRYP PFNGLBINDBUFFERBASEPROC)(GLenum target, GLuint index, GLuint buffer); -GLAPI PFNGLBINDBUFFERBASEPROC glad_glBindBufferBase; -#define glBindBufferBase glad_glBindBufferBase -typedef void (APIENTRYP PFNGLTRANSFORMFEEDBACKVARYINGSPROC)(GLuint program, GLsizei count, const GLchar *const*varyings, GLenum bufferMode); -GLAPI PFNGLTRANSFORMFEEDBACKVARYINGSPROC glad_glTransformFeedbackVaryings; -#define glTransformFeedbackVaryings glad_glTransformFeedbackVaryings -typedef void (APIENTRYP PFNGLGETTRANSFORMFEEDBACKVARYINGPROC)(GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLsizei *size, GLenum *type, GLchar *name); -GLAPI PFNGLGETTRANSFORMFEEDBACKVARYINGPROC glad_glGetTransformFeedbackVarying; -#define glGetTransformFeedbackVarying glad_glGetTransformFeedbackVarying -typedef void (APIENTRYP PFNGLCLAMPCOLORPROC)(GLenum target, GLenum clamp); -GLAPI PFNGLCLAMPCOLORPROC glad_glClampColor; -#define glClampColor glad_glClampColor -typedef void (APIENTRYP PFNGLBEGINCONDITIONALRENDERPROC)(GLuint id, GLenum mode); -GLAPI PFNGLBEGINCONDITIONALRENDERPROC glad_glBeginConditionalRender; -#define glBeginConditionalRender glad_glBeginConditionalRender -typedef void (APIENTRYP PFNGLENDCONDITIONALRENDERPROC)(void); -GLAPI PFNGLENDCONDITIONALRENDERPROC glad_glEndConditionalRender; -#define glEndConditionalRender glad_glEndConditionalRender -typedef void (APIENTRYP PFNGLVERTEXATTRIBIPOINTERPROC)(GLuint index, GLint size, GLenum type, GLsizei stride, const void *pointer); -GLAPI PFNGLVERTEXATTRIBIPOINTERPROC glad_glVertexAttribIPointer; -#define glVertexAttribIPointer glad_glVertexAttribIPointer -typedef void (APIENTRYP PFNGLGETVERTEXATTRIBIIVPROC)(GLuint index, GLenum pname, GLint *params); -GLAPI PFNGLGETVERTEXATTRIBIIVPROC glad_glGetVertexAttribIiv; -#define glGetVertexAttribIiv glad_glGetVertexAttribIiv -typedef void (APIENTRYP PFNGLGETVERTEXATTRIBIUIVPROC)(GLuint index, GLenum pname, GLuint *params); -GLAPI PFNGLGETVERTEXATTRIBIUIVPROC glad_glGetVertexAttribIuiv; -#define glGetVertexAttribIuiv glad_glGetVertexAttribIuiv -typedef void (APIENTRYP PFNGLVERTEXATTRIBI1IPROC)(GLuint index, GLint x); -GLAPI PFNGLVERTEXATTRIBI1IPROC glad_glVertexAttribI1i; -#define glVertexAttribI1i glad_glVertexAttribI1i -typedef void (APIENTRYP PFNGLVERTEXATTRIBI2IPROC)(GLuint index, GLint x, GLint y); -GLAPI PFNGLVERTEXATTRIBI2IPROC glad_glVertexAttribI2i; -#define glVertexAttribI2i glad_glVertexAttribI2i -typedef void (APIENTRYP PFNGLVERTEXATTRIBI3IPROC)(GLuint index, GLint x, GLint y, GLint z); -GLAPI PFNGLVERTEXATTRIBI3IPROC glad_glVertexAttribI3i; -#define glVertexAttribI3i glad_glVertexAttribI3i -typedef void (APIENTRYP PFNGLVERTEXATTRIBI4IPROC)(GLuint index, GLint x, GLint y, GLint z, GLint w); -GLAPI PFNGLVERTEXATTRIBI4IPROC glad_glVertexAttribI4i; -#define glVertexAttribI4i glad_glVertexAttribI4i -typedef void (APIENTRYP PFNGLVERTEXATTRIBI1UIPROC)(GLuint index, GLuint x); -GLAPI PFNGLVERTEXATTRIBI1UIPROC glad_glVertexAttribI1ui; -#define glVertexAttribI1ui glad_glVertexAttribI1ui -typedef void (APIENTRYP PFNGLVERTEXATTRIBI2UIPROC)(GLuint index, GLuint x, GLuint y); -GLAPI PFNGLVERTEXATTRIBI2UIPROC glad_glVertexAttribI2ui; -#define glVertexAttribI2ui glad_glVertexAttribI2ui -typedef void (APIENTRYP PFNGLVERTEXATTRIBI3UIPROC)(GLuint index, GLuint x, GLuint y, GLuint z); -GLAPI PFNGLVERTEXATTRIBI3UIPROC glad_glVertexAttribI3ui; -#define glVertexAttribI3ui glad_glVertexAttribI3ui -typedef void (APIENTRYP PFNGLVERTEXATTRIBI4UIPROC)(GLuint index, GLuint x, GLuint y, GLuint z, GLuint w); -GLAPI PFNGLVERTEXATTRIBI4UIPROC glad_glVertexAttribI4ui; -#define glVertexAttribI4ui glad_glVertexAttribI4ui -typedef void (APIENTRYP PFNGLVERTEXATTRIBI1IVPROC)(GLuint index, const GLint *v); -GLAPI PFNGLVERTEXATTRIBI1IVPROC glad_glVertexAttribI1iv; -#define glVertexAttribI1iv glad_glVertexAttribI1iv -typedef void (APIENTRYP PFNGLVERTEXATTRIBI2IVPROC)(GLuint index, const GLint *v); -GLAPI PFNGLVERTEXATTRIBI2IVPROC glad_glVertexAttribI2iv; -#define glVertexAttribI2iv glad_glVertexAttribI2iv -typedef void (APIENTRYP PFNGLVERTEXATTRIBI3IVPROC)(GLuint index, const GLint *v); -GLAPI PFNGLVERTEXATTRIBI3IVPROC glad_glVertexAttribI3iv; -#define glVertexAttribI3iv glad_glVertexAttribI3iv -typedef void (APIENTRYP PFNGLVERTEXATTRIBI4IVPROC)(GLuint index, const GLint *v); -GLAPI PFNGLVERTEXATTRIBI4IVPROC glad_glVertexAttribI4iv; -#define glVertexAttribI4iv glad_glVertexAttribI4iv -typedef void (APIENTRYP PFNGLVERTEXATTRIBI1UIVPROC)(GLuint index, const GLuint *v); -GLAPI PFNGLVERTEXATTRIBI1UIVPROC glad_glVertexAttribI1uiv; -#define glVertexAttribI1uiv glad_glVertexAttribI1uiv -typedef void (APIENTRYP PFNGLVERTEXATTRIBI2UIVPROC)(GLuint index, const GLuint *v); -GLAPI PFNGLVERTEXATTRIBI2UIVPROC glad_glVertexAttribI2uiv; -#define glVertexAttribI2uiv glad_glVertexAttribI2uiv -typedef void (APIENTRYP PFNGLVERTEXATTRIBI3UIVPROC)(GLuint index, const GLuint *v); -GLAPI PFNGLVERTEXATTRIBI3UIVPROC glad_glVertexAttribI3uiv; -#define glVertexAttribI3uiv glad_glVertexAttribI3uiv -typedef void (APIENTRYP PFNGLVERTEXATTRIBI4UIVPROC)(GLuint index, const GLuint *v); -GLAPI PFNGLVERTEXATTRIBI4UIVPROC glad_glVertexAttribI4uiv; -#define glVertexAttribI4uiv glad_glVertexAttribI4uiv -typedef void (APIENTRYP PFNGLVERTEXATTRIBI4BVPROC)(GLuint index, const GLbyte *v); -GLAPI PFNGLVERTEXATTRIBI4BVPROC glad_glVertexAttribI4bv; -#define glVertexAttribI4bv glad_glVertexAttribI4bv -typedef void (APIENTRYP PFNGLVERTEXATTRIBI4SVPROC)(GLuint index, const GLshort *v); -GLAPI PFNGLVERTEXATTRIBI4SVPROC glad_glVertexAttribI4sv; -#define glVertexAttribI4sv glad_glVertexAttribI4sv -typedef void (APIENTRYP PFNGLVERTEXATTRIBI4UBVPROC)(GLuint index, const GLubyte *v); -GLAPI PFNGLVERTEXATTRIBI4UBVPROC glad_glVertexAttribI4ubv; -#define glVertexAttribI4ubv glad_glVertexAttribI4ubv -typedef void (APIENTRYP PFNGLVERTEXATTRIBI4USVPROC)(GLuint index, const GLushort *v); -GLAPI PFNGLVERTEXATTRIBI4USVPROC glad_glVertexAttribI4usv; -#define glVertexAttribI4usv glad_glVertexAttribI4usv -typedef void (APIENTRYP PFNGLGETUNIFORMUIVPROC)(GLuint program, GLint location, GLuint *params); -GLAPI PFNGLGETUNIFORMUIVPROC glad_glGetUniformuiv; -#define glGetUniformuiv glad_glGetUniformuiv -typedef void (APIENTRYP PFNGLBINDFRAGDATALOCATIONPROC)(GLuint program, GLuint color, const GLchar *name); -GLAPI PFNGLBINDFRAGDATALOCATIONPROC glad_glBindFragDataLocation; -#define glBindFragDataLocation glad_glBindFragDataLocation -typedef GLint (APIENTRYP PFNGLGETFRAGDATALOCATIONPROC)(GLuint program, const GLchar *name); -GLAPI PFNGLGETFRAGDATALOCATIONPROC glad_glGetFragDataLocation; -#define glGetFragDataLocation glad_glGetFragDataLocation -typedef void (APIENTRYP PFNGLUNIFORM1UIPROC)(GLint location, GLuint v0); -GLAPI PFNGLUNIFORM1UIPROC glad_glUniform1ui; -#define glUniform1ui glad_glUniform1ui -typedef void (APIENTRYP PFNGLUNIFORM2UIPROC)(GLint location, GLuint v0, GLuint v1); -GLAPI PFNGLUNIFORM2UIPROC glad_glUniform2ui; -#define glUniform2ui glad_glUniform2ui -typedef void (APIENTRYP PFNGLUNIFORM3UIPROC)(GLint location, GLuint v0, GLuint v1, GLuint v2); -GLAPI PFNGLUNIFORM3UIPROC glad_glUniform3ui; -#define glUniform3ui glad_glUniform3ui -typedef void (APIENTRYP PFNGLUNIFORM4UIPROC)(GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3); -GLAPI PFNGLUNIFORM4UIPROC glad_glUniform4ui; -#define glUniform4ui glad_glUniform4ui -typedef void (APIENTRYP PFNGLUNIFORM1UIVPROC)(GLint location, GLsizei count, const GLuint *value); -GLAPI PFNGLUNIFORM1UIVPROC glad_glUniform1uiv; -#define glUniform1uiv glad_glUniform1uiv -typedef void (APIENTRYP PFNGLUNIFORM2UIVPROC)(GLint location, GLsizei count, const GLuint *value); -GLAPI PFNGLUNIFORM2UIVPROC glad_glUniform2uiv; -#define glUniform2uiv glad_glUniform2uiv -typedef void (APIENTRYP PFNGLUNIFORM3UIVPROC)(GLint location, GLsizei count, const GLuint *value); -GLAPI PFNGLUNIFORM3UIVPROC glad_glUniform3uiv; -#define glUniform3uiv glad_glUniform3uiv -typedef void (APIENTRYP PFNGLUNIFORM4UIVPROC)(GLint location, GLsizei count, const GLuint *value); -GLAPI PFNGLUNIFORM4UIVPROC glad_glUniform4uiv; -#define glUniform4uiv glad_glUniform4uiv -typedef void (APIENTRYP PFNGLTEXPARAMETERIIVPROC)(GLenum target, GLenum pname, const GLint *params); -GLAPI PFNGLTEXPARAMETERIIVPROC glad_glTexParameterIiv; -#define glTexParameterIiv glad_glTexParameterIiv -typedef void (APIENTRYP PFNGLTEXPARAMETERIUIVPROC)(GLenum target, GLenum pname, const GLuint *params); -GLAPI PFNGLTEXPARAMETERIUIVPROC glad_glTexParameterIuiv; -#define glTexParameterIuiv glad_glTexParameterIuiv -typedef void (APIENTRYP PFNGLGETTEXPARAMETERIIVPROC)(GLenum target, GLenum pname, GLint *params); -GLAPI PFNGLGETTEXPARAMETERIIVPROC glad_glGetTexParameterIiv; -#define glGetTexParameterIiv glad_glGetTexParameterIiv -typedef void (APIENTRYP PFNGLGETTEXPARAMETERIUIVPROC)(GLenum target, GLenum pname, GLuint *params); -GLAPI PFNGLGETTEXPARAMETERIUIVPROC glad_glGetTexParameterIuiv; -#define glGetTexParameterIuiv glad_glGetTexParameterIuiv -typedef void (APIENTRYP PFNGLCLEARBUFFERIVPROC)(GLenum buffer, GLint drawbuffer, const GLint *value); -GLAPI PFNGLCLEARBUFFERIVPROC glad_glClearBufferiv; -#define glClearBufferiv glad_glClearBufferiv -typedef void (APIENTRYP PFNGLCLEARBUFFERUIVPROC)(GLenum buffer, GLint drawbuffer, const GLuint *value); -GLAPI PFNGLCLEARBUFFERUIVPROC glad_glClearBufferuiv; -#define glClearBufferuiv glad_glClearBufferuiv -typedef void (APIENTRYP PFNGLCLEARBUFFERFVPROC)(GLenum buffer, GLint drawbuffer, const GLfloat *value); -GLAPI PFNGLCLEARBUFFERFVPROC glad_glClearBufferfv; -#define glClearBufferfv glad_glClearBufferfv -typedef void (APIENTRYP PFNGLCLEARBUFFERFIPROC)(GLenum buffer, GLint drawbuffer, GLfloat depth, GLint stencil); -GLAPI PFNGLCLEARBUFFERFIPROC glad_glClearBufferfi; -#define glClearBufferfi glad_glClearBufferfi -typedef const GLubyte * (APIENTRYP PFNGLGETSTRINGIPROC)(GLenum name, GLuint index); -GLAPI PFNGLGETSTRINGIPROC glad_glGetStringi; -#define glGetStringi glad_glGetStringi -typedef GLboolean (APIENTRYP PFNGLISRENDERBUFFERPROC)(GLuint renderbuffer); -GLAPI PFNGLISRENDERBUFFERPROC glad_glIsRenderbuffer; -#define glIsRenderbuffer glad_glIsRenderbuffer -typedef void (APIENTRYP PFNGLBINDRENDERBUFFERPROC)(GLenum target, GLuint renderbuffer); -GLAPI PFNGLBINDRENDERBUFFERPROC glad_glBindRenderbuffer; -#define glBindRenderbuffer glad_glBindRenderbuffer -typedef void (APIENTRYP PFNGLDELETERENDERBUFFERSPROC)(GLsizei n, const GLuint *renderbuffers); -GLAPI PFNGLDELETERENDERBUFFERSPROC glad_glDeleteRenderbuffers; -#define glDeleteRenderbuffers glad_glDeleteRenderbuffers -typedef void (APIENTRYP PFNGLGENRENDERBUFFERSPROC)(GLsizei n, GLuint *renderbuffers); -GLAPI PFNGLGENRENDERBUFFERSPROC glad_glGenRenderbuffers; -#define glGenRenderbuffers glad_glGenRenderbuffers -typedef void (APIENTRYP PFNGLRENDERBUFFERSTORAGEPROC)(GLenum target, GLenum internalformat, GLsizei width, GLsizei height); -GLAPI PFNGLRENDERBUFFERSTORAGEPROC glad_glRenderbufferStorage; -#define glRenderbufferStorage glad_glRenderbufferStorage -typedef void (APIENTRYP PFNGLGETRENDERBUFFERPARAMETERIVPROC)(GLenum target, GLenum pname, GLint *params); -GLAPI PFNGLGETRENDERBUFFERPARAMETERIVPROC glad_glGetRenderbufferParameteriv; -#define glGetRenderbufferParameteriv glad_glGetRenderbufferParameteriv -typedef GLboolean (APIENTRYP PFNGLISFRAMEBUFFERPROC)(GLuint framebuffer); -GLAPI PFNGLISFRAMEBUFFERPROC glad_glIsFramebuffer; -#define glIsFramebuffer glad_glIsFramebuffer -typedef void (APIENTRYP PFNGLBINDFRAMEBUFFERPROC)(GLenum target, GLuint framebuffer); -GLAPI PFNGLBINDFRAMEBUFFERPROC glad_glBindFramebuffer; -#define glBindFramebuffer glad_glBindFramebuffer -typedef void (APIENTRYP PFNGLDELETEFRAMEBUFFERSPROC)(GLsizei n, const GLuint *framebuffers); -GLAPI PFNGLDELETEFRAMEBUFFERSPROC glad_glDeleteFramebuffers; -#define glDeleteFramebuffers glad_glDeleteFramebuffers -typedef void (APIENTRYP PFNGLGENFRAMEBUFFERSPROC)(GLsizei n, GLuint *framebuffers); -GLAPI PFNGLGENFRAMEBUFFERSPROC glad_glGenFramebuffers; -#define glGenFramebuffers glad_glGenFramebuffers -typedef GLenum (APIENTRYP PFNGLCHECKFRAMEBUFFERSTATUSPROC)(GLenum target); -GLAPI PFNGLCHECKFRAMEBUFFERSTATUSPROC glad_glCheckFramebufferStatus; -#define glCheckFramebufferStatus glad_glCheckFramebufferStatus -typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTURE1DPROC)(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level); -GLAPI PFNGLFRAMEBUFFERTEXTURE1DPROC glad_glFramebufferTexture1D; -#define glFramebufferTexture1D glad_glFramebufferTexture1D -typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTURE2DPROC)(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level); -GLAPI PFNGLFRAMEBUFFERTEXTURE2DPROC glad_glFramebufferTexture2D; -#define glFramebufferTexture2D glad_glFramebufferTexture2D -typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTURE3DPROC)(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset); -GLAPI PFNGLFRAMEBUFFERTEXTURE3DPROC glad_glFramebufferTexture3D; -#define glFramebufferTexture3D glad_glFramebufferTexture3D -typedef void (APIENTRYP PFNGLFRAMEBUFFERRENDERBUFFERPROC)(GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer); -GLAPI PFNGLFRAMEBUFFERRENDERBUFFERPROC glad_glFramebufferRenderbuffer; -#define glFramebufferRenderbuffer glad_glFramebufferRenderbuffer -typedef void (APIENTRYP PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVPROC)(GLenum target, GLenum attachment, GLenum pname, GLint *params); -GLAPI PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVPROC glad_glGetFramebufferAttachmentParameteriv; -#define glGetFramebufferAttachmentParameteriv glad_glGetFramebufferAttachmentParameteriv -typedef void (APIENTRYP PFNGLGENERATEMIPMAPPROC)(GLenum target); -GLAPI PFNGLGENERATEMIPMAPPROC glad_glGenerateMipmap; -#define glGenerateMipmap glad_glGenerateMipmap -typedef void (APIENTRYP PFNGLBLITFRAMEBUFFERPROC)(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter); -GLAPI PFNGLBLITFRAMEBUFFERPROC glad_glBlitFramebuffer; -#define glBlitFramebuffer glad_glBlitFramebuffer -typedef void (APIENTRYP PFNGLRENDERBUFFERSTORAGEMULTISAMPLEPROC)(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height); -GLAPI PFNGLRENDERBUFFERSTORAGEMULTISAMPLEPROC glad_glRenderbufferStorageMultisample; -#define glRenderbufferStorageMultisample glad_glRenderbufferStorageMultisample -typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTURELAYERPROC)(GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer); -GLAPI PFNGLFRAMEBUFFERTEXTURELAYERPROC glad_glFramebufferTextureLayer; -#define glFramebufferTextureLayer glad_glFramebufferTextureLayer -typedef void * (APIENTRYP PFNGLMAPBUFFERRANGEPROC)(GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access); -GLAPI PFNGLMAPBUFFERRANGEPROC glad_glMapBufferRange; -#define glMapBufferRange glad_glMapBufferRange -typedef void (APIENTRYP PFNGLFLUSHMAPPEDBUFFERRANGEPROC)(GLenum target, GLintptr offset, GLsizeiptr length); -GLAPI PFNGLFLUSHMAPPEDBUFFERRANGEPROC glad_glFlushMappedBufferRange; -#define glFlushMappedBufferRange glad_glFlushMappedBufferRange -typedef void (APIENTRYP PFNGLBINDVERTEXARRAYPROC)(GLuint array); -GLAPI PFNGLBINDVERTEXARRAYPROC glad_glBindVertexArray; -#define glBindVertexArray glad_glBindVertexArray -typedef void (APIENTRYP PFNGLDELETEVERTEXARRAYSPROC)(GLsizei n, const GLuint *arrays); -GLAPI PFNGLDELETEVERTEXARRAYSPROC glad_glDeleteVertexArrays; -#define glDeleteVertexArrays glad_glDeleteVertexArrays -typedef void (APIENTRYP PFNGLGENVERTEXARRAYSPROC)(GLsizei n, GLuint *arrays); -GLAPI PFNGLGENVERTEXARRAYSPROC glad_glGenVertexArrays; -#define glGenVertexArrays glad_glGenVertexArrays -typedef GLboolean (APIENTRYP PFNGLISVERTEXARRAYPROC)(GLuint array); -GLAPI PFNGLISVERTEXARRAYPROC glad_glIsVertexArray; -#define glIsVertexArray glad_glIsVertexArray -#endif -#ifndef GL_VERSION_3_1 -#define GL_VERSION_3_1 1 -GLAPI int GLAD_GL_VERSION_3_1; -typedef void (APIENTRYP PFNGLDRAWARRAYSINSTANCEDPROC)(GLenum mode, GLint first, GLsizei count, GLsizei instancecount); -GLAPI PFNGLDRAWARRAYSINSTANCEDPROC glad_glDrawArraysInstanced; -#define glDrawArraysInstanced glad_glDrawArraysInstanced -typedef void (APIENTRYP PFNGLDRAWELEMENTSINSTANCEDPROC)(GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instancecount); -GLAPI PFNGLDRAWELEMENTSINSTANCEDPROC glad_glDrawElementsInstanced; -#define glDrawElementsInstanced glad_glDrawElementsInstanced -typedef void (APIENTRYP PFNGLTEXBUFFERPROC)(GLenum target, GLenum internalformat, GLuint buffer); -GLAPI PFNGLTEXBUFFERPROC glad_glTexBuffer; -#define glTexBuffer glad_glTexBuffer -typedef void (APIENTRYP PFNGLPRIMITIVERESTARTINDEXPROC)(GLuint index); -GLAPI PFNGLPRIMITIVERESTARTINDEXPROC glad_glPrimitiveRestartIndex; -#define glPrimitiveRestartIndex glad_glPrimitiveRestartIndex -typedef void (APIENTRYP PFNGLCOPYBUFFERSUBDATAPROC)(GLenum readTarget, GLenum writeTarget, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size); -GLAPI PFNGLCOPYBUFFERSUBDATAPROC glad_glCopyBufferSubData; -#define glCopyBufferSubData glad_glCopyBufferSubData -typedef void (APIENTRYP PFNGLGETUNIFORMINDICESPROC)(GLuint program, GLsizei uniformCount, const GLchar *const*uniformNames, GLuint *uniformIndices); -GLAPI PFNGLGETUNIFORMINDICESPROC glad_glGetUniformIndices; -#define glGetUniformIndices glad_glGetUniformIndices -typedef void (APIENTRYP PFNGLGETACTIVEUNIFORMSIVPROC)(GLuint program, GLsizei uniformCount, const GLuint *uniformIndices, GLenum pname, GLint *params); -GLAPI PFNGLGETACTIVEUNIFORMSIVPROC glad_glGetActiveUniformsiv; -#define glGetActiveUniformsiv glad_glGetActiveUniformsiv -typedef void (APIENTRYP PFNGLGETACTIVEUNIFORMNAMEPROC)(GLuint program, GLuint uniformIndex, GLsizei bufSize, GLsizei *length, GLchar *uniformName); -GLAPI PFNGLGETACTIVEUNIFORMNAMEPROC glad_glGetActiveUniformName; -#define glGetActiveUniformName glad_glGetActiveUniformName -typedef GLuint (APIENTRYP PFNGLGETUNIFORMBLOCKINDEXPROC)(GLuint program, const GLchar *uniformBlockName); -GLAPI PFNGLGETUNIFORMBLOCKINDEXPROC glad_glGetUniformBlockIndex; -#define glGetUniformBlockIndex glad_glGetUniformBlockIndex -typedef void (APIENTRYP PFNGLGETACTIVEUNIFORMBLOCKIVPROC)(GLuint program, GLuint uniformBlockIndex, GLenum pname, GLint *params); -GLAPI PFNGLGETACTIVEUNIFORMBLOCKIVPROC glad_glGetActiveUniformBlockiv; -#define glGetActiveUniformBlockiv glad_glGetActiveUniformBlockiv -typedef void (APIENTRYP PFNGLGETACTIVEUNIFORMBLOCKNAMEPROC)(GLuint program, GLuint uniformBlockIndex, GLsizei bufSize, GLsizei *length, GLchar *uniformBlockName); -GLAPI PFNGLGETACTIVEUNIFORMBLOCKNAMEPROC glad_glGetActiveUniformBlockName; -#define glGetActiveUniformBlockName glad_glGetActiveUniformBlockName -typedef void (APIENTRYP PFNGLUNIFORMBLOCKBINDINGPROC)(GLuint program, GLuint uniformBlockIndex, GLuint uniformBlockBinding); -GLAPI PFNGLUNIFORMBLOCKBINDINGPROC glad_glUniformBlockBinding; -#define glUniformBlockBinding glad_glUniformBlockBinding -#endif -#ifndef GL_ES_VERSION_2_0 -#define GL_ES_VERSION_2_0 1 -GLAPI int GLAD_GL_ES_VERSION_2_0; -typedef void (APIENTRYP PFNGLCLEARDEPTHFPROC)(GLfloat d); -GLAPI PFNGLCLEARDEPTHFPROC glad_glClearDepthf; -#define glClearDepthf glad_glClearDepthf -typedef void (APIENTRYP PFNGLDEPTHRANGEFPROC)(GLfloat n, GLfloat f); -GLAPI PFNGLDEPTHRANGEFPROC glad_glDepthRangef; -#define glDepthRangef glad_glDepthRangef -typedef void (APIENTRYP PFNGLGETSHADERPRECISIONFORMATPROC)(GLenum shadertype, GLenum precisiontype, GLint *range, GLint *precision); -GLAPI PFNGLGETSHADERPRECISIONFORMATPROC glad_glGetShaderPrecisionFormat; -#define glGetShaderPrecisionFormat glad_glGetShaderPrecisionFormat -typedef void (APIENTRYP PFNGLRELEASESHADERCOMPILERPROC)(void); -GLAPI PFNGLRELEASESHADERCOMPILERPROC glad_glReleaseShaderCompiler; -#define glReleaseShaderCompiler glad_glReleaseShaderCompiler -typedef void (APIENTRYP PFNGLSHADERBINARYPROC)(GLsizei count, const GLuint *shaders, GLenum binaryFormat, const void *binary, GLsizei length); -GLAPI PFNGLSHADERBINARYPROC glad_glShaderBinary; -#define glShaderBinary glad_glShaderBinary -#endif - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/src_rebuild/PsyCross/include/PsyX/common/half_float.h b/src_rebuild/PsyCross/include/PsyX/common/half_float.h deleted file mode 100644 index 16aeb2d6..00000000 --- a/src_rebuild/PsyCross/include/PsyX/common/half_float.h +++ /dev/null @@ -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 \ No newline at end of file diff --git a/src_rebuild/PsyCross/include/PsyX/common/pgxp_defs.h b/src_rebuild/PsyCross/include/PsyX/common/pgxp_defs.h deleted file mode 100644 index 91dd4910..00000000 --- a/src_rebuild/PsyCross/include/PsyX/common/pgxp_defs.h +++ /dev/null @@ -1,77 +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; - -extern int g_pgxpVertexIndex; - -/* 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 \ No newline at end of file diff --git a/src_rebuild/PsyCross/include/PsyX/util/timer.h b/src_rebuild/PsyCross/include/PsyX/util/timer.h deleted file mode 100644 index 4ed4419b..00000000 --- a/src_rebuild/PsyCross/include/PsyX/util/timer.h +++ /dev/null @@ -1,30 +0,0 @@ -#ifndef UTIL_TIMER_H -#define UTIL_TIMER_H - -#ifdef _WIN32 -#include -#else -#include -#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 \ No newline at end of file diff --git a/src_rebuild/PsyCross/include/psx/abs.h b/src_rebuild/PsyCross/include/psx/abs.h deleted file mode 100644 index 6f581558..00000000 --- a/src_rebuild/PsyCross/include/psx/abs.h +++ /dev/null @@ -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 \ No newline at end of file diff --git a/src_rebuild/PsyCross/include/psx/asm.h b/src_rebuild/PsyCross/include/psx/asm.h deleted file mode 100644 index 45f28f84..00000000 --- a/src_rebuild/PsyCross/include/psx/asm.h +++ /dev/null @@ -1,12 +0,0 @@ -#ifndef ASM_H -#define ASM_H - -/* - -This header must be empty - -*/ - -#define NREGS 40 - -#endif diff --git a/src_rebuild/PsyCross/include/psx/gtemac.h b/src_rebuild/PsyCross/include/psx/gtemac.h deleted file mode 100644 index f619966b..00000000 --- a/src_rebuild/PsyCross/include/psx/gtemac.h +++ /dev/null @@ -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 \ No newline at end of file diff --git a/src_rebuild/PsyCross/include/psx/gtereg.h b/src_rebuild/PsyCross/include/psx/gtereg.h deleted file mode 100644 index 19ea73cc..00000000 --- a/src_rebuild/PsyCross/include/psx/gtereg.h +++ /dev/null @@ -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 \ No newline at end of file diff --git a/src_rebuild/PsyCross/include/psx/inline_c.h b/src_rebuild/PsyCross/include/psx/inline_c.h deleted file mode 100644 index 6580c4fe..00000000 --- a/src_rebuild/PsyCross/include/psx/inline_c.h +++ /dev/null @@ -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 \ No newline at end of file diff --git a/src_rebuild/PsyCross/include/psx/kernel.h b/src_rebuild/PsyCross/include/psx/kernel.h deleted file mode 100644 index e841d7c5..00000000 --- a/src_rebuild/PsyCross/include/psx/kernel.h +++ /dev/null @@ -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 */ - - diff --git a/src_rebuild/PsyCross/include/psx/libapi.h b/src_rebuild/PsyCross/include/psx/libapi.h deleted file mode 100644 index cf5924a4..00000000 --- a/src_rebuild/PsyCross/include/psx/libapi.h +++ /dev/null @@ -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 diff --git a/src_rebuild/PsyCross/include/psx/libcd.h b/src_rebuild/PsyCross/include/psx/libcd.h deleted file mode 100644 index 4c426a27..00000000 --- a/src_rebuild/PsyCross/include/psx/libcd.h +++ /dev/null @@ -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 diff --git a/src_rebuild/PsyCross/include/psx/libetc.h b/src_rebuild/PsyCross/include/psx/libetc.h deleted file mode 100644 index 38e1e470..00000000 --- a/src_rebuild/PsyCross/include/psx/libetc.h +++ /dev/null @@ -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 - - diff --git a/src_rebuild/PsyCross/include/psx/libgpu.h b/src_rebuild/PsyCross/include/psx/libgpu.h deleted file mode 100644 index 572c7452..00000000 --- a/src_rebuild/PsyCross/include/psx/libgpu.h +++ /dev/null @@ -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 diff --git a/src_rebuild/PsyCross/include/psx/libgte.h b/src_rebuild/PsyCross/include/psx/libgte.h deleted file mode 100644 index f53b4b36..00000000 --- a/src_rebuild/PsyCross/include/psx/libgte.h +++ /dev/null @@ -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 \ No newline at end of file diff --git a/src_rebuild/PsyCross/include/psx/libmath.h b/src_rebuild/PsyCross/include/psx/libmath.h deleted file mode 100644 index 8d56293c..00000000 --- a/src_rebuild/PsyCross/include/psx/libmath.h +++ /dev/null @@ -1,12 +0,0 @@ -#ifndef LIBMATH_H -#define LIBMATH_H - -#define _USE_MATH_DEFINES - -#ifdef __GNUC__ -#include -#endif - -#include - -#endif \ No newline at end of file diff --git a/src_rebuild/PsyCross/include/psx/libmcrd.h b/src_rebuild/PsyCross/include/psx/libmcrd.h deleted file mode 100644 index 0d6c460b..00000000 --- a/src_rebuild/PsyCross/include/psx/libmcrd.h +++ /dev/null @@ -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 diff --git a/src_rebuild/PsyCross/include/psx/libpad.h b/src_rebuild/PsyCross/include/psx/libpad.h deleted file mode 100644 index 48682e9b..00000000 --- a/src_rebuild/PsyCross/include/psx/libpad.h +++ /dev/null @@ -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 \ No newline at end of file diff --git a/src_rebuild/PsyCross/include/psx/libpress.h b/src_rebuild/PsyCross/include/psx/libpress.h deleted file mode 100644 index 9d46de14..00000000 --- a/src_rebuild/PsyCross/include/psx/libpress.h +++ /dev/null @@ -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 diff --git a/src_rebuild/PsyCross/include/psx/libsn.h b/src_rebuild/PsyCross/include/psx/libsn.h deleted file mode 100644 index c87d8ead..00000000 --- a/src_rebuild/PsyCross/include/psx/libsn.h +++ /dev/null @@ -1,23 +0,0 @@ -#ifndef LIBSN_H -#define LIBSN_H - -#include - -#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 \ No newline at end of file diff --git a/src_rebuild/PsyCross/include/psx/libspu.h b/src_rebuild/PsyCross/include/psx/libspu.h deleted file mode 100644 index 1a5d876c..00000000 --- a/src_rebuild/PsyCross/include/psx/libspu.h +++ /dev/null @@ -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 */ diff --git a/src_rebuild/PsyCross/include/psx/r3000.h b/src_rebuild/PsyCross/include/psx/r3000.h deleted file mode 100644 index 38453a08..00000000 --- a/src_rebuild/PsyCross/include/psx/r3000.h +++ /dev/null @@ -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 */ diff --git a/src_rebuild/PsyCross/include/psx/rand.h b/src_rebuild/PsyCross/include/psx/rand.h deleted file mode 100644 index 54eac682..00000000 --- a/src_rebuild/PsyCross/include/psx/rand.h +++ /dev/null @@ -1,7 +0,0 @@ -#ifndef RAND_H -#define RAND_H - -#include -#include - -#endif \ No newline at end of file diff --git a/src_rebuild/PsyCross/include/psx/strings.h b/src_rebuild/PsyCross/include/psx/strings.h deleted file mode 100644 index 96288324..00000000 --- a/src_rebuild/PsyCross/include/psx/strings.h +++ /dev/null @@ -1,7 +0,0 @@ -#ifndef STRINGS_H -#define STRINGS_H - -#include // temp -#include // temp - -#endif \ No newline at end of file diff --git a/src_rebuild/PsyCross/include/psx/types.h b/src_rebuild/PsyCross/include/psx/types.h deleted file mode 100644 index c0e624f8..00000000 --- a/src_rebuild/PsyCross/include/psx/types.h +++ /dev/null @@ -1,54 +0,0 @@ -#ifndef TYPES_H -#define TYPES_H - -#include "PsyX/PsyX_config.h" - -#include -#include - -#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 diff --git a/src_rebuild/PsyCross/src/PsyX_main.cpp b/src_rebuild/PsyCross/src/PsyX_main.cpp deleted file mode 100644 index 13cbc0cf..00000000 --- a/src_rebuild/PsyCross/src/PsyX_main.cpp +++ /dev/null @@ -1,985 +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 -#include - -#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 -#include - -#include "PsyX/PsyX_render.h" - -#ifdef _WIN32 -#include -#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 -#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); - - if (nKey == SDL_SCANCODE_BACKSPACE) - { - if (down) - g_skipSwapInterval = 1; - else - g_skipSwapInterval = 0; - } - - 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(); -} diff --git a/src_rebuild/PsyCross/src/PsyX_main.h b/src_rebuild/PsyCross/src/PsyX_main.h deleted file mode 100644 index 42a9f537..00000000 --- a/src_rebuild/PsyCross/src/PsyX_main.h +++ /dev/null @@ -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 \ No newline at end of file diff --git a/src_rebuild/PsyCross/src/gpu/PsyX_GPU.cpp b/src_rebuild/PsyCross/src/gpu/PsyX_GPU.cpp deleted file mode 100644 index 0877cf14..00000000 --- a/src_rebuild/PsyCross/src/gpu/PsyX_GPU.cpp +++ /dev/null @@ -1,1427 +0,0 @@ -#include "PsyX_GPU.h" - -#include "PsyX/PsyX_public.h" -#include "PsyX/PsyX_globals.h" -#include "PsyX/PsyX_render.h" - -#include "../PsyX_main.h" - -#include -#include -#include - -// Remap a value in the range [A,B] to [C,D]. -#define RemapVal( val, A, B, C, D) \ - (C + (D - C) * (val - A) / (B - A)) - -#define GET_TPAGE_X(tpage) (((tpage << 6) & 0x7C0) % (VRAM_WIDTH)) -#define GET_TPAGE_Y(tpage) (((((tpage << 4) & 0x100) + ((tpage >> 2) & 0x200))) % (VRAM_HEIGHT)) -#define GET_TPAGE_FORMAT(tpage) ((TexFormat)((tpage >> 7) & 0x3)) -#define GET_TPAGE_BLEND(tpage) ((BlendMode)(((tpage >> 5) & 3) + 1)) - -// TODO -#define GET_TPAGE_DITHER(tpage) 1 -//#define GET_TPAGE_DITHER(tpage) 1((tpage >> 9) & 0x1) - -#define GET_CLUT_X(clut) ((clut & 0x3F) << 4) -#define GET_CLUT_Y(clut) (clut >> 6) - -OT_TAG prim_terminator = { -1, 0 }; // P_TAG with zero length - -DISPENV activeDispEnv; -DRAWENV activeDrawEnv; -int g_GPUDisabledState = 0; -int g_DrawPrimMode = 0; - -struct GPUDrawSplit -{ - DRAWENV drawenv; - DISPENV dispenv; - - BlendMode blendMode; - - TexFormat texFormat; - TextureID textureId; - - int drawPrimMode; - - u_short startVertex; - u_short numVerts; -}; - -GrVertex g_vertexBuffer[MAX_NUM_POLY_BUFFER_VERTICES]; -GPUDrawSplit g_splits[MAX_NUM_INDEX_BUFFERS]; - -int g_vertexIndex = 0; -int g_splitIndex = 0; - -void ClearSplits() -{ - g_vertexIndex = 0; - g_splitIndex = 0; - g_splits[0].texFormat = (TexFormat)0xFFFF; -} - -// remaps screen coordinates to [0..1] -// without clamping -inline void ScreenCoordsToEmulator(GrVertex* vertex, int count) -{ -#ifdef USE_PGXP - float curW; - float curH; - - if (activeDrawEnv.dfe) - { - curW = activeDispEnv.disp.w; - curH = activeDispEnv.disp.h; - } - else - { - curW = activeDrawEnv.clip.w; - curH = activeDrawEnv.clip.h; - } - - while (count--) - { - vertex[count].x = RemapVal(vertex[count].x, 0.0f, curW, 0.0f, 1.0f); - vertex[count].y = RemapVal(vertex[count].y, 0.0f, curH, 0.0f, 1.0f); - // FIXME: what about Z? - - // also center - vertex[count].x -= 0.5f; - vertex[count].y -= 0.5f; - } -#endif -} - -void LineSwapSourceVerts(VERTTYPE*& p0, VERTTYPE*& p1, unsigned char*& c0, unsigned char*& c1) -{ - // swap line coordinates for left-to-right and up-to-bottom direction - if ((p0[0] > p1[0]) || - (p0[1] > p1[1] && p0[0] == p1[0])) - { - VERTTYPE* tmp = p0; - p0 = p1; - p1 = tmp; - - unsigned char* tmpCol = c0; - c0 = c1; - c1 = tmpCol; - } -} - -void MakeLineArray(GrVertex* vertex, VERTTYPE* p0, VERTTYPE* p1, ushort gteidx) -{ - VERTTYPE dx = p1[0] - p0[0]; - VERTTYPE dy = p1[1] - p0[1]; - - float ofsX; - float ofsY; - - if (activeDrawEnv.dfe) - { - ofsX = activeDrawEnv.ofs[0] % activeDispEnv.disp.w; - ofsY = activeDrawEnv.ofs[1] % activeDispEnv.disp.h; - } - else - { - ofsX = 0.0f; - ofsY = 0.0f; - } - - memset(vertex, 0, sizeof(GrVertex) * 4); - - if (dx > abs((short)dy)) { // horizontal - vertex[0].x = p0[0] + ofsX; - vertex[0].y = p0[1] + ofsY; - - vertex[1].x = p1[0] + ofsX + 1; - vertex[1].y = p1[1] + ofsY; - - vertex[2].x = vertex[1].x; - vertex[2].y = vertex[1].y + 1; - - vertex[3].x = vertex[0].x; - vertex[3].y = vertex[0].y + 1; - } - else { // vertical - vertex[0].x = p0[0] + ofsX; - vertex[0].y = p0[1] + ofsY; - - vertex[1].x = p1[0] + ofsX; - vertex[1].y = p1[1] + ofsY + 1; - - vertex[2].x = vertex[1].x + 1; - vertex[2].y = vertex[1].y; - - vertex[3].x = vertex[0].x + 1; - vertex[3].y = vertex[0].y; - } // TODO diagonal line alignment - -#ifdef USE_PGXP - vertex[0].scr_h = vertex[1].scr_h = vertex[2].scr_h = vertex[3].scr_h = 0.0f; -#endif - - ScreenCoordsToEmulator(vertex, 4); -} - -inline void ApplyVertexPGXP(GrVertex* v, VERTTYPE* p, float ofsX, float ofsY, ushort gteidx) -{ -#ifdef USE_PGXP - uint lookup = PGXP_LOOKUP_VALUE(p[0], p[1]); - - PGXPVData vd; - if (g_pgxpTextureCorrection && PGXP_GetCacheData(&vd, lookup, gteidx)) - { - float gteOfsX = vd.ofx; - float gteOfsY = vd.ofy; - - // FIXME: it must be clamped strictly to the current draw buffer bounds! - // this is bad approach but it works for now - if (gteOfsX > activeDispEnv.disp.w) - gteOfsX -= activeDispEnv.disp.w; - gteOfsX -= activeDispEnv.disp.w / 2; - - if (gteOfsY > activeDispEnv.disp.h) - gteOfsY -= activeDispEnv.disp.h; - gteOfsY -= activeDispEnv.disp.h / 2; - - v->x = vd.px; - v->y = vd.py; - v->z = vd.pz; - v->ofsX = (ofsX + gteOfsX) / float(activeDispEnv.disp.w) * 2.0f; - v->ofsY = (ofsY + gteOfsY) / float(activeDispEnv.disp.h) * 2.0f; - - v->scr_h = vd.scr_h; - } - else - { - v->scr_h = 0.0f; - v->z = 0.0f; - } -#endif -} - -void MakeVertexTriangle(GrVertex* vertex, VERTTYPE* p0, VERTTYPE* p1, VERTTYPE* p2, ushort gteidx) -{ - assert(p0); - assert(p1); - assert(p2); - - float ofsX; - float ofsY; - - if (activeDrawEnv.dfe) - { - ofsX = activeDrawEnv.ofs[0] % activeDispEnv.disp.w; - ofsY = activeDrawEnv.ofs[1] % activeDispEnv.disp.h; - } - else - { - ofsX = 0.0f; - ofsY = 0.0f; - } - - memset(vertex, 0, sizeof(GrVertex) * 3); - - vertex[0].x = p0[0] + ofsX; - vertex[0].y = p0[1] + ofsY; - - vertex[1].x = p1[0] + ofsX; - vertex[1].y = p1[1] + ofsY; - - vertex[2].x = p2[0] + ofsX; - vertex[2].y = p2[1] + ofsY; - - ApplyVertexPGXP(&vertex[0], p0, ofsX, ofsY, gteidx - 2); - ApplyVertexPGXP(&vertex[1], p1, ofsX, ofsY, gteidx - 1); - ApplyVertexPGXP(&vertex[2], p2, ofsX, ofsY, gteidx); - - ScreenCoordsToEmulator(vertex, 3); -} - -void MakeVertexQuad(GrVertex* vertex, VERTTYPE* p0, VERTTYPE* p1, VERTTYPE* p2, VERTTYPE* p3, ushort gteidx) -{ - assert(p0); - assert(p1); - assert(p2); - assert(p3); - - float ofsX; - float ofsY; - - if (activeDrawEnv.dfe) - { - ofsX = activeDrawEnv.ofs[0] % activeDispEnv.disp.w; - ofsY = activeDrawEnv.ofs[1] % activeDispEnv.disp.h; - } - else - { - ofsX = 0.0f; - ofsY = 0.0f; - } - - memset(vertex, 0, sizeof(GrVertex) * 4); - - vertex[0].x = p0[0] + ofsX; - vertex[0].y = p0[1] + ofsY; - - vertex[1].x = p1[0] + ofsX; - vertex[1].y = p1[1] + ofsY; - - vertex[2].x = p2[0] + ofsX; - vertex[2].y = p2[1] + ofsY; - - vertex[3].x = p3[0] + ofsX; - vertex[3].y = p3[1] + ofsY; - - ApplyVertexPGXP(&vertex[0], p0, ofsX, ofsY, gteidx - 2); - ApplyVertexPGXP(&vertex[1], p1, ofsX, ofsY, gteidx - 2); - ApplyVertexPGXP(&vertex[2], p2, ofsX, ofsY, gteidx - 1); - ApplyVertexPGXP(&vertex[3], p3, ofsX, ofsY, gteidx); - - ScreenCoordsToEmulator(vertex, 4); -} - -void MakeVertexRect(GrVertex* vertex, VERTTYPE* p0, short w, short h, ushort gteidx) -{ - assert(p0); - - float ofsX; - float ofsY; - - if (activeDrawEnv.dfe) - { - ofsX = activeDrawEnv.ofs[0] % activeDispEnv.disp.w; - ofsY = activeDrawEnv.ofs[1] % activeDispEnv.disp.h; - } - else - { - ofsX = 0.0f; - ofsY = 0.0f; - } - - memset(vertex, 0, sizeof(GrVertex) * 4); - - vertex[0].x = p0[0] + ofsX; - vertex[0].y = p0[1] + ofsY; - - vertex[1].x = vertex[0].x; - vertex[1].y = vertex[0].y + h; - - vertex[2].x = vertex[0].x + w; - vertex[2].y = vertex[0].y + h; - - vertex[3].x = vertex[0].x + w; - vertex[3].y = vertex[0].y; - -#ifdef USE_PGXP - vertex[0].scr_h = vertex[1].scr_h = vertex[2].scr_h = vertex[3].scr_h = 0.0f; -#endif - - ScreenCoordsToEmulator(vertex, 4); -} - -void MakeTexcoordQuad(GrVertex* vertex, unsigned char* uv0, unsigned char* uv1, unsigned char* uv2, unsigned char* uv3, short page, short clut, unsigned char dither) -{ - assert(uv0); - assert(uv1); - assert(uv2); - assert(uv3); - - const unsigned char bright = 2; - - vertex[0].u = uv0[0]; - vertex[0].v = uv0[1]; - vertex[0].bright = bright; - vertex[0].dither = dither; - vertex[0].page = page; - vertex[0].clut = clut; - - vertex[1].u = uv1[0]; - vertex[1].v = uv1[1]; - vertex[1].bright = bright; - vertex[1].dither = dither; - vertex[1].page = page; - vertex[1].clut = clut; - - vertex[2].u = uv2[0]; - vertex[2].v = uv2[1]; - vertex[2].bright = bright; - vertex[2].dither = dither; - vertex[2].page = page; - vertex[2].clut = clut; - - vertex[3].u = uv3[0]; - vertex[3].v = uv3[1]; - vertex[3].bright = bright; - vertex[3].dither = dither; - vertex[3].page = page; - vertex[3].clut = clut; - /* - if (g_bilinearFiltering) - { - vertex[0].tcx = -1; - vertex[0].tcy = -1; - - vertex[1].tcx = -1; - vertex[1].tcy = -1; - - vertex[2].tcx = -1; - vertex[2].tcy = -1; - - vertex[3].tcx = -1; - vertex[3].tcy = -1; - }*/ -} - -void MakeTexcoordTriangle(GrVertex* vertex, unsigned char* uv0, unsigned char* uv1, unsigned char* uv2, short page, short clut, unsigned char dither) -{ - assert(uv0); - assert(uv1); - assert(uv2); - - const unsigned char bright = 2; - - vertex[0].u = uv0[0]; - vertex[0].v = uv0[1]; - vertex[0].bright = bright; - vertex[0].dither = dither; - vertex[0].page = page; - vertex[0].clut = clut; - - vertex[1].u = uv1[0]; - vertex[1].v = uv1[1]; - vertex[1].bright = bright; - vertex[1].dither = dither; - vertex[1].page = page; - vertex[1].clut = clut; - - vertex[2].u = uv2[0]; - vertex[2].v = uv2[1]; - vertex[2].bright = bright; - vertex[2].dither = dither; - vertex[2].page = page; - vertex[2].clut = clut; - /* - if (g_bilinearFiltering) - { - vertex[0].tcx = -1; - vertex[0].tcy = -1; - - vertex[1].tcx = -1; - vertex[1].tcy = -1; - - vertex[2].tcx = -1; - vertex[2].tcy = -1; - - vertex[3].tcx = -1; - vertex[3].tcy = -1; - }*/ -} - -void MakeTexcoordRect(GrVertex* vertex, unsigned char* uv, short page, short clut, short w, short h) -{ - assert(uv); - - // sim overflow - if (int(uv[0]) + w > 255) w = 255 - uv[0]; - if (int(uv[1]) + h > 255) h = 255 - uv[1]; - - const unsigned char bright = 2; - const unsigned char dither = 0; - - vertex[0].u = uv[0]; - vertex[0].v = uv[1]; - vertex[0].bright = bright; - vertex[0].dither = dither; - vertex[0].page = page; - vertex[0].clut = clut; - - vertex[1].u = uv[0]; - vertex[1].v = uv[1] + h; - vertex[1].bright = bright; - vertex[1].dither = dither; - vertex[1].page = page; - vertex[1].clut = clut; - - vertex[2].u = uv[0] + w; - vertex[2].v = uv[1] + h; - vertex[2].bright = bright; - vertex[2].dither = dither; - vertex[2].page = page; - vertex[2].clut = clut; - - vertex[3].u = uv[0] + w; - vertex[3].v = uv[1]; - vertex[3].bright = bright; - vertex[3].dither = dither; - vertex[3].page = page; - vertex[3].clut = clut; - - if (g_bilinearFiltering) - { - vertex[0].tcx = -1; - vertex[0].tcy = -1; - - vertex[1].tcx = -1; - vertex[1].tcy = -1; - - vertex[2].tcx = -1; - vertex[2].tcy = -1; - - vertex[3].tcx = -1; - vertex[3].tcy = -1; - } -} - -void MakeTexcoordLineZero(GrVertex* vertex, unsigned char dither) -{ - const unsigned char bright = 1; - - vertex[0].u = 0; - vertex[0].v = 0; - vertex[0].bright = bright; - vertex[0].dither = dither; - vertex[0].page = 0; - vertex[0].clut = 0; - - vertex[1].u = 0; - vertex[1].v = 0; - vertex[1].bright = bright; - vertex[1].dither = dither; - vertex[1].page = 0; - vertex[1].clut = 0; - - vertex[2].u = 0; - vertex[2].v = 0; - vertex[2].bright = bright; - vertex[2].dither = dither; - vertex[2].page = 0; - vertex[2].clut = 0; - - vertex[3].u = 0; - vertex[3].v = 0; - vertex[3].bright = bright; - vertex[3].dither = dither; - vertex[3].page = 0; - vertex[3].clut = 0; -} - -void MakeTexcoordTriangleZero(GrVertex* vertex, unsigned char dither) -{ - const unsigned char bright = 1; - - vertex[0].u = 0; - vertex[0].v = 0; - vertex[0].bright = bright; - vertex[0].dither = dither; - vertex[0].page = 0; - vertex[0].clut = 0; - - vertex[1].u = 0; - vertex[1].v = 0; - vertex[1].bright = bright; - vertex[1].dither = dither; - vertex[1].page = 0; - vertex[1].clut = 0; - - vertex[2].u = 0; - vertex[2].v = 0; - vertex[2].bright = bright; - vertex[2].dither = dither; - vertex[2].page = 0; - vertex[2].clut = 0; - -} - -void MakeTexcoordQuadZero(GrVertex* vertex, unsigned char dither) -{ - const unsigned char bright = 1; - - vertex[0].u = 0; - vertex[0].v = 0; - vertex[0].bright = bright; - vertex[0].dither = dither; - vertex[0].page = 0; - vertex[0].clut = 0; - - vertex[1].u = 0; - vertex[1].v = 0; - vertex[1].bright = bright; - vertex[1].dither = dither; - vertex[1].page = 0; - vertex[1].clut = 0; - - vertex[2].u = 0; - vertex[2].v = 0; - vertex[2].bright = bright; - vertex[2].dither = dither; - vertex[2].page = 0; - vertex[2].clut = 0; - - vertex[3].u = 0; - vertex[3].v = 0; - vertex[3].bright = bright; - vertex[3].dither = dither; - vertex[3].page = 0; - vertex[3].clut = 0; -} - -void MakeColourLine(GrVertex* vertex, unsigned char* col0, unsigned char* col1) -{ - assert(col0); - assert(col1); - - vertex[0].r = col0[0]; - vertex[0].g = col0[1]; - vertex[0].b = col0[2]; - vertex[0].a = 255; - - vertex[1].r = col1[0]; - vertex[1].g = col1[1]; - vertex[1].b = col1[2]; - vertex[1].a = 255; - - vertex[2].r = col1[0]; - vertex[2].g = col1[1]; - vertex[2].b = col1[2]; - vertex[2].a = 255; - - vertex[3].r = col0[0]; - vertex[3].g = col0[1]; - vertex[3].b = col0[2]; - vertex[3].a = 255; -} - -void MakeColourTriangle(GrVertex* vertex, unsigned char* col0, unsigned char* col1, unsigned char* col2) -{ - assert(col0); - assert(col1); - assert(col2); - - vertex[0].r = col0[0]; - vertex[0].g = col0[1]; - vertex[0].b = col0[2]; - vertex[0].a = 255; - - vertex[1].r = col1[0]; - vertex[1].g = col1[1]; - vertex[1].b = col1[2]; - vertex[1].a = 255; - - vertex[2].r = col2[0]; - vertex[2].g = col2[1]; - vertex[2].b = col2[2]; - vertex[2].a = 255; -} - -void MakeColourQuad(GrVertex* vertex, unsigned char* col0, unsigned char* col1, unsigned char* col2, unsigned char* col3) -{ - assert(col0); - assert(col1); - assert(col2); - assert(col3); - - vertex[0].r = col0[0]; - vertex[0].g = col0[1]; - vertex[0].b = col0[2]; - vertex[0].a = 255; - - vertex[1].r = col1[0]; - vertex[1].g = col1[1]; - vertex[1].b = col1[2]; - vertex[1].a = 255; - - vertex[2].r = col2[0]; - vertex[2].g = col2[1]; - vertex[2].b = col2[2]; - vertex[2].a = 255; - - vertex[3].r = col3[0]; - vertex[3].g = col3[1]; - vertex[3].b = col3[2]; - vertex[3].a = 255; -} - -void TriangulateQuad() -{ - /* - Triangulate like this: - - v0--v1 - | / | - | / | - v2--v3 - - NOTE: v2 swapped with v3 during primitive parsing but it not shown here - */ - - g_vertexBuffer[g_vertexIndex + 4] = g_vertexBuffer[g_vertexIndex + 3]; - - g_vertexBuffer[g_vertexIndex + 5] = g_vertexBuffer[g_vertexIndex + 2]; - g_vertexBuffer[g_vertexIndex + 2] = g_vertexBuffer[g_vertexIndex + 3]; - g_vertexBuffer[g_vertexIndex + 3] = g_vertexBuffer[g_vertexIndex + 1]; -} - -//------------------------------------------------------------------------------------------------------------------------ - -void AddSplit(bool semiTrans, TextureID textureId) -{ - int tpage = activeDrawEnv.tpage; - GPUDrawSplit& curSplit = g_splits[g_splitIndex]; - - BlendMode blendMode = semiTrans ? GET_TPAGE_BLEND(tpage) : BM_NONE; - TexFormat texFormat = GET_TPAGE_FORMAT(tpage); - - // FIXME: compare drawing environment too? - if (curSplit.blendMode == blendMode && - curSplit.texFormat == texFormat && - curSplit.textureId == textureId && - curSplit.drawPrimMode == g_DrawPrimMode && - curSplit.drawenv.clip.x == activeDrawEnv.clip.x && - curSplit.drawenv.clip.y == activeDrawEnv.clip.y && - curSplit.drawenv.clip.w == activeDrawEnv.clip.w && - curSplit.drawenv.clip.h == activeDrawEnv.clip.h && - curSplit.drawenv.dfe == activeDrawEnv.dfe) - { - return; - } - - curSplit.numVerts = g_vertexIndex - curSplit.startVertex; - - GPUDrawSplit& split = g_splits[++g_splitIndex]; - - split.blendMode = blendMode; - split.texFormat = texFormat; - split.textureId = textureId; - split.drawPrimMode = g_DrawPrimMode; - split.drawenv = activeDrawEnv; - split.dispenv = activeDispEnv; - - split.startVertex = g_vertexIndex; - split.numVerts = 0; -} - -void DrawSplit(const GPUDrawSplit& split) -{ - GR_SetStencilMode(split.drawPrimMode); // draw with mask 0x16 - - GR_SetTexture(split.textureId, split.texFormat); - - GR_SetupClipMode(&split.drawenv.clip, split.drawenv.dfe); - GR_SetOffscreenState(&split.drawenv.clip, !split.drawenv.dfe); - - GR_SetBlendMode(split.blendMode); - - GR_DrawTriangles(split.startVertex, split.numVerts / 3); -} - -// -// Draws all polygons after AggregatePTAG -// -void DrawAllSplits() -{ - if (g_emulatorPaused) - { - for (int i = 0; i < 3; i++) - { - GrVertex* vert = &g_vertexBuffer[g_polygonSelected + i]; - vert->r = 255; - vert->g = 0; - vert->b = 0; - - eprintf("==========================================\n"); - eprintf("POLYGON: %d\n", g_polygonSelected); -#ifdef USE_PGXP - eprintf("X: %.2f Y: %.2f\n", (float)vert->x, (float)vert->y); - eprintf("U: %.2f V: %.2f\n", (float)vert->u, (float)vert->v); - eprintf("TP: %d CLT: %d\n", (int)vert->page, (int)vert->clut); -#else - eprintf("X: %d Y: %d\n", vert->x, vert->y); - eprintf("U: %d V: %d\n", vert->u, vert->v); - eprintf("TP: %d CLT: %d\n", vert->page, vert->clut); -#endif - - eprintf("==========================================\n"); - } - - PsyX_UpdateInput(); - } - - // next code ideally should be called before EndScene - GR_UpdateVertexBuffer(g_vertexBuffer, g_vertexIndex); - - for (int i = 1; i <= g_splitIndex; i++) - DrawSplit(g_splits[i]); - - ClearSplits(); - -#ifdef USE_PGXP - PGXP_ClearCache(); -#endif -} - -// forward declarations -int ParsePrimitive(uintptr_t primPtr); -int ParseLinkedPrimitiveList(uintptr_t packetStart, uintptr_t packetEnd); - -void ParsePrimitivesToSplits(u_long* p, int singlePrimitive) -{ - if (!p) - return; - - // setup single primitive flag (needed for AddSplits) - g_DrawPrimMode = singlePrimitive; - - if (singlePrimitive) - { -#if defined(USE_PGXP) && defined(USE_EXTENDED_PRIM_POINTERS) - P_TAG* pTag = (P_TAG*)p; - pTag->pgxp_index = 0xFFFF; // force -#endif - - // single primitive - ParsePrimitive((uintptr_t)p); - g_splits[g_splitIndex].numVerts = g_vertexIndex - g_splits[g_splitIndex].startVertex; - } - else - { - P_TAG* pTag = (P_TAG*)p; - - // P_TAG as primitive list - //do - while ((uintptr_t)pTag != (uintptr_t)&prim_terminator) - { - if (pTag->len > 0) - { - uintptr_t packetEnd = (uintptr_t)pTag + (pTag->len + P_LEN) * sizeof(u_long); - - int lastSize = ParseLinkedPrimitiveList((uintptr_t)pTag, packetEnd); - if (lastSize == -1) - break; // safe bailout - } - - pTag = (P_TAG*)pTag->addr; - } - } -} - -inline int IsNull(POLY_FT3* poly) -{ - return poly->x0 == -1 && - poly->y0 == -1 && - poly->x1 == -1 && - poly->y1 == -1 && - poly->x2 == -1 && - poly->y2 == -1; -} - -// parses primitive and pushes it to VBO -// returns primitive size -// -1 means invalid primitive -int ParsePrimitive(uintptr_t primPtr) -{ - P_TAG* pTag = (P_TAG*)primPtr; - - bool semi_transparent = (pTag->code & 2) != 0; - -#if defined(USE_PGXP) && defined(USE_EXTENDED_PRIM_POINTERS) - unsigned short gte_index = pTag->pgxp_index; -#else - unsigned short gte_index = 0xFFFF; -#endif - - switch (pTag->code & ~3) - { - case 0x0: - { - switch (pTag->code) - { - case 0x01: - { - DR_MOVE* drmove = (DR_MOVE*)pTag; - - int x, y; - y = drmove->code[3] >> 0x10 & 0xFFFF; - x = drmove->code[3] & 0xFFFF; - - RECT16 rect; - *(ulong*)&rect.x = *(ulong*)&drmove->code[2]; - *(ulong*)&rect.w = *(ulong*)&drmove->code[4]; - - MoveImage(&rect, x, y); - - break; - } - default: - { - eprinterr("Unknown command %02X!\n", pTag->code); - } - } - - - break; - } - case 0x20: - { - POLY_F3* poly = (POLY_F3*)pTag; - - AddSplit(semi_transparent, g_whiteTexture); - - MakeVertexTriangle(&g_vertexBuffer[g_vertexIndex], &poly->x0, &poly->x1, &poly->x2, gte_index); - MakeTexcoordTriangleZero(&g_vertexBuffer[g_vertexIndex], 0); - MakeColourTriangle(&g_vertexBuffer[g_vertexIndex], &poly->r0, &poly->r0, &poly->r0); - - g_vertexIndex += 3; - -#if defined(DEBUG_POLY_COUNT) - polygon_count++; -#endif - break; - } - case 0x24: - { - POLY_FT3* poly = (POLY_FT3*)pTag; - activeDrawEnv.tpage = poly->tpage; - - // It is an official hack from SCE devs to not use DR_TPAGE and instead use null polygon - if (!IsNull(poly)) - { - AddSplit(semi_transparent, g_vramTexture); - - MakeVertexTriangle(&g_vertexBuffer[g_vertexIndex], &poly->x0, &poly->x1, &poly->x2, gte_index); - MakeTexcoordTriangle(&g_vertexBuffer[g_vertexIndex], &poly->u0, &poly->u1, &poly->u2, poly->tpage, poly->clut, GET_TPAGE_DITHER(lastTpage)); - MakeColourTriangle(&g_vertexBuffer[g_vertexIndex], &poly->r0, &poly->r0, &poly->r0); - - g_vertexIndex += 3; - -#if defined(DEBUG_POLY_COUNT) - polygon_count++; -#endif - } - - break; - } - case 0x28: - { - POLY_F4* poly = (POLY_F4*)pTag; - - AddSplit(semi_transparent, g_whiteTexture); - - MakeVertexQuad(&g_vertexBuffer[g_vertexIndex], &poly->x0, &poly->x1, &poly->x3, &poly->x2, gte_index); - MakeTexcoordQuadZero(&g_vertexBuffer[g_vertexIndex], 0); - MakeColourQuad(&g_vertexBuffer[g_vertexIndex], &poly->r0, &poly->r0, &poly->r0, &poly->r0); - - TriangulateQuad(); - - g_vertexIndex += 6; -#if defined(DEBUG_POLY_COUNT) - polygon_count++; -#endif - break; - } - case 0x2C: - { - POLY_FT4* poly = (POLY_FT4*)pTag; - activeDrawEnv.tpage = poly->tpage; - - AddSplit(semi_transparent, g_vramTexture); - - MakeVertexQuad(&g_vertexBuffer[g_vertexIndex], &poly->x0, &poly->x1, &poly->x3, &poly->x2, gte_index); - MakeTexcoordQuad(&g_vertexBuffer[g_vertexIndex], &poly->u0, &poly->u1, &poly->u3, &poly->u2, poly->tpage, poly->clut, GET_TPAGE_DITHER(lastTpage)); - MakeColourQuad(&g_vertexBuffer[g_vertexIndex], &poly->r0, &poly->r0, &poly->r0, &poly->r0); - - TriangulateQuad(); - - g_vertexIndex += 6; - -#if defined(DEBUG_POLY_COUNT) - polygon_count++; -#endif - break; - } - case 0x30: - { - POLY_G3* poly = (POLY_G3*)pTag; - - AddSplit(semi_transparent, g_whiteTexture); - - MakeVertexTriangle(&g_vertexBuffer[g_vertexIndex], &poly->x0, &poly->x1, &poly->x2, gte_index); - MakeTexcoordTriangleZero(&g_vertexBuffer[g_vertexIndex], 1); - MakeColourTriangle(&g_vertexBuffer[g_vertexIndex], &poly->r0, &poly->r1, &poly->r2); - - g_vertexIndex += 3; - -#if defined(DEBUG_POLY_COUNT) - polygon_count++; -#endif - break; - } - case 0x34: - { - POLY_GT3* poly = (POLY_GT3*)pTag; - activeDrawEnv.tpage = poly->tpage; - - AddSplit(semi_transparent, g_vramTexture); - - MakeVertexTriangle(&g_vertexBuffer[g_vertexIndex], &poly->x0, &poly->x1, &poly->x2, gte_index); - MakeTexcoordTriangle(&g_vertexBuffer[g_vertexIndex], &poly->u0, &poly->u1, &poly->u2, poly->tpage, poly->clut, GET_TPAGE_DITHER(lastTpage)); - MakeColourTriangle(&g_vertexBuffer[g_vertexIndex], &poly->r0, &poly->r1, &poly->r2); - - g_vertexIndex += 3; - -#if defined(DEBUG_POLY_COUNT) - polygon_count++; -#endif - break; - } - case 0x38: - { - POLY_G4* poly = (POLY_G4*)pTag; - - AddSplit(semi_transparent, g_whiteTexture); - - MakeVertexQuad(&g_vertexBuffer[g_vertexIndex], &poly->x0, &poly->x1, &poly->x3, &poly->x2, gte_index); - MakeTexcoordQuadZero(&g_vertexBuffer[g_vertexIndex], 1); - MakeColourQuad(&g_vertexBuffer[g_vertexIndex], &poly->r0, &poly->r1, &poly->r3, &poly->r2); - - TriangulateQuad(); - - g_vertexIndex += 6; - -#if defined(DEBUG_POLY_COUNT) - polygon_count++; -#endif - break; - } - case 0x3C: - { - POLY_GT4* poly = (POLY_GT4*)pTag; - activeDrawEnv.tpage = poly->tpage; - - AddSplit(semi_transparent, g_vramTexture); - - MakeVertexQuad(&g_vertexBuffer[g_vertexIndex], &poly->x0, &poly->x1, &poly->x3, &poly->x2, gte_index); - MakeTexcoordQuad(&g_vertexBuffer[g_vertexIndex], &poly->u0, &poly->u1, &poly->u3, &poly->u2, poly->tpage, poly->clut, GET_TPAGE_DITHER(lastTpage)); - MakeColourQuad(&g_vertexBuffer[g_vertexIndex], &poly->r0, &poly->r1, &poly->r3, &poly->r2); - - TriangulateQuad(); - - g_vertexIndex += 6; - -#if defined(DEBUG_POLY_COUNT) - polygon_count++; -#endif - break; - } - case 0x40: - { - LINE_F2* poly = (LINE_F2*)pTag; - - AddSplit(semi_transparent, g_whiteTexture); - - VERTTYPE* p0 = &poly->x0; - VERTTYPE* p1 = &poly->x1; - unsigned char* c0 = &poly->r0; - unsigned char* c1 = c0; - - LineSwapSourceVerts(p0, p1, c0, c1); - MakeLineArray(&g_vertexBuffer[g_vertexIndex], p0, p1, gte_index); - MakeTexcoordLineZero(&g_vertexBuffer[g_vertexIndex], 0); - MakeColourLine(&g_vertexBuffer[g_vertexIndex], c0, c1); - - TriangulateQuad(); - - g_vertexIndex += 6; - -#if defined(DEBUG_POLY_COUNT) - polygon_count++; -#endif - break; - } - case 0x48: // TODO (unused) - { - LINE_F3* poly = (LINE_F3*)pTag; - - AddSplit(semi_transparent, g_whiteTexture); - - { - VERTTYPE* p0 = &poly->x0; - VERTTYPE* p1 = &poly->x1; - unsigned char* c0 = &poly->r0; - unsigned char* c1 = c0; - - LineSwapSourceVerts(p0, p1, c0, c1); - MakeLineArray(&g_vertexBuffer[g_vertexIndex], p0, p1, gte_index); - MakeTexcoordLineZero(&g_vertexBuffer[g_vertexIndex], 0); - MakeColourLine(&g_vertexBuffer[g_vertexIndex], c0, c1); - - TriangulateQuad(); - - g_vertexIndex += 6; -#if defined(DEBUG_POLY_COUNT) - polygon_count++; -#endif - } - - { - VERTTYPE* p0 = &poly->x1; - VERTTYPE* p1 = &poly->x2; - unsigned char* c0 = &poly->r0; - unsigned char* c1 = c0; - - LineSwapSourceVerts(p0, p1, c0, c1); - MakeLineArray(&g_vertexBuffer[g_vertexIndex], p0, p1, gte_index); - MakeTexcoordLineZero(&g_vertexBuffer[g_vertexIndex], 0); - MakeColourLine(&g_vertexBuffer[g_vertexIndex], c0, c1); - - TriangulateQuad(); - - g_vertexIndex += 6; -#if defined(DEBUG_POLY_COUNT) - polygon_count++; -#endif - } - - break; - } - case 0x4c: - { - int i; - LINE_F4* poly = (LINE_F4*)pTag; - - AddSplit(semi_transparent, g_whiteTexture); - - { - VERTTYPE* p0 = &poly->x0; - VERTTYPE* p1 = &poly->x1; - unsigned char* c0 = &poly->r0; - unsigned char* c1 = c0; - - LineSwapSourceVerts(p0, p1, c0, c1); - MakeLineArray(&g_vertexBuffer[g_vertexIndex], p0, p1, gte_index); - MakeTexcoordLineZero(&g_vertexBuffer[g_vertexIndex], 0); - MakeColourLine(&g_vertexBuffer[g_vertexIndex], c0, c1); - - TriangulateQuad(); - - g_vertexIndex += 6; -#if defined(DEBUG_POLY_COUNT) - polygon_count++; -#endif - } - - { - VERTTYPE* p0 = &poly->x1; - VERTTYPE* p1 = &poly->x2; - unsigned char* c0 = &poly->r0; - unsigned char* c1 = c0; - - LineSwapSourceVerts(p0, p1, c0, c1); - MakeLineArray(&g_vertexBuffer[g_vertexIndex], p0, p1, gte_index); - MakeTexcoordLineZero(&g_vertexBuffer[g_vertexIndex], 0); - MakeColourLine(&g_vertexBuffer[g_vertexIndex], c0, c1); - - TriangulateQuad(); - - g_vertexIndex += 6; -#if defined(DEBUG_POLY_COUNT) - polygon_count++; -#endif - } - - { - VERTTYPE* p0 = &poly->x2; - VERTTYPE* p1 = &poly->x3; - unsigned char* c0 = &poly->r0; - unsigned char* c1 = c0; - - LineSwapSourceVerts(p0, p1, c0, c1); - MakeLineArray(&g_vertexBuffer[g_vertexIndex], p0, p1, gte_index); - MakeTexcoordLineZero(&g_vertexBuffer[g_vertexIndex], 0); - MakeColourLine(&g_vertexBuffer[g_vertexIndex], c0, c1); - - TriangulateQuad(); - - g_vertexIndex += 6; -#if defined(DEBUG_POLY_COUNT) - polygon_count++; -#endif - } - - break; - } - case 0x50: - { - LINE_G2* poly = (LINE_G2*)pTag; - - AddSplit(semi_transparent, g_whiteTexture); - - VERTTYPE* p0 = &poly->x0; - VERTTYPE* p1 = &poly->x1; - unsigned char* c0 = &poly->r0; - unsigned char* c1 = &poly->r1; - - LineSwapSourceVerts(p0, p1, c0, c1); - MakeLineArray(&g_vertexBuffer[g_vertexIndex], p0, p1, gte_index); - MakeTexcoordLineZero(&g_vertexBuffer[g_vertexIndex], 0); - MakeColourLine(&g_vertexBuffer[g_vertexIndex], c0, c1); - - TriangulateQuad(); - - g_vertexIndex += 6; - -#if defined(DEBUG_POLY_COUNT) - polygon_count++; -#endif - break; - } - case 0x60: - { - TILE* poly = (TILE*)pTag; - - AddSplit(semi_transparent, g_whiteTexture); - - MakeVertexRect(&g_vertexBuffer[g_vertexIndex], &poly->x0, poly->w, poly->h, gte_index); - MakeTexcoordQuadZero(&g_vertexBuffer[g_vertexIndex], 0); - MakeColourQuad(&g_vertexBuffer[g_vertexIndex], &poly->r0, &poly->r0, &poly->r0, &poly->r0); - - TriangulateQuad(); - - g_vertexIndex += 6; - -#if defined(DEBUG_POLY_COUNT) - polygon_count++; -#endif - - break; - } - case 0x64: - { - SPRT* poly = (SPRT*)pTag; - - AddSplit(semi_transparent, g_vramTexture); - - MakeVertexRect(&g_vertexBuffer[g_vertexIndex], &poly->x0, poly->w, poly->h, gte_index); - MakeTexcoordRect(&g_vertexBuffer[g_vertexIndex], &poly->u0, activeDrawEnv.tpage, poly->clut, poly->w, poly->h); - MakeColourQuad(&g_vertexBuffer[g_vertexIndex], &poly->r0, &poly->r0, &poly->r0, &poly->r0); - - TriangulateQuad(); - - g_vertexIndex += 6; - -#if defined(DEBUG_POLY_COUNT) - polygon_count++; -#endif - break; - } - case 0x68: - { - TILE_1* poly = (TILE_1*)pTag; - - AddSplit(semi_transparent, g_whiteTexture); - - MakeVertexRect(&g_vertexBuffer[g_vertexIndex], &poly->x0, 1, 1, gte_index); - MakeTexcoordQuadZero(&g_vertexBuffer[g_vertexIndex], 0); - MakeColourQuad(&g_vertexBuffer[g_vertexIndex], &poly->r0, &poly->r0, &poly->r0, &poly->r0); - - TriangulateQuad(); - - g_vertexIndex += 6; - -#if defined(DEBUG_POLY_COUNT) - polygon_count++; -#endif - break; - } - case 0x70: - { - TILE_8* poly = (TILE_8*)pTag; - - AddSplit(semi_transparent, g_whiteTexture); - - MakeVertexRect(&g_vertexBuffer[g_vertexIndex], &poly->x0, 8, 8, gte_index); - MakeTexcoordQuadZero(&g_vertexBuffer[g_vertexIndex], 0); - MakeColourQuad(&g_vertexBuffer[g_vertexIndex], &poly->r0, &poly->r0, &poly->r0, &poly->r0); - - TriangulateQuad(); - - g_vertexIndex += 6; - -#if defined(DEBUG_POLY_COUNT) - polygon_count++; -#endif - break; - } - case 0x74: - { - SPRT_8* poly = (SPRT_8*)pTag; - - AddSplit(semi_transparent, g_vramTexture); - - MakeVertexRect(&g_vertexBuffer[g_vertexIndex], &poly->x0, 8, 8, gte_index); - MakeTexcoordRect(&g_vertexBuffer[g_vertexIndex], &poly->u0, activeDrawEnv.tpage, poly->clut, 8, 8); - MakeColourQuad(&g_vertexBuffer[g_vertexIndex], &poly->r0, &poly->r0, &poly->r0, &poly->r0); - - TriangulateQuad(); - - g_vertexIndex += 6; - -#if defined(DEBUG_POLY_COUNT) - polygon_count++; -#endif - break; - } - case 0x78: - { - TILE_16* poly = (TILE_16*)pTag; - - AddSplit(semi_transparent, g_whiteTexture); - - MakeVertexRect(&g_vertexBuffer[g_vertexIndex], &poly->x0, 16, 16, gte_index); - MakeTexcoordQuadZero(&g_vertexBuffer[g_vertexIndex], 0); - MakeColourQuad(&g_vertexBuffer[g_vertexIndex], &poly->r0, &poly->r0, &poly->r0, &poly->r0); - - TriangulateQuad(); - - g_vertexIndex += 6; - -#if defined(DEBUG_POLY_COUNT) - polygon_count++; -#endif - break; - } - case 0x7C: - { - SPRT_16* poly = (SPRT_16*)pTag; - - AddSplit(semi_transparent, g_vramTexture); - - MakeVertexRect(&g_vertexBuffer[g_vertexIndex], &poly->x0, 16, 16, gte_index); - MakeTexcoordRect(&g_vertexBuffer[g_vertexIndex], &poly->u0, activeDrawEnv.tpage, poly->clut, 16, 16); - MakeColourQuad(&g_vertexBuffer[g_vertexIndex], &poly->r0, &poly->r0, &poly->r0, &poly->r0); - - TriangulateQuad(); - - g_vertexIndex += 6; - -#if defined(DEBUG_POLY_COUNT) - polygon_count++; -#endif - break; - } - case 0xA0: // DR_LOAD commands - { - DR_LOAD* drload = (DR_LOAD*)pTag; - - RECT16 rect; - *(ulong*)&rect.x = *(ulong*)&drload->code[1]; - *(ulong*)&rect.w = *(ulong*)&drload->code[2]; - - LoadImagePSX(&rect, drload->p); - //Emulator_UpdateVRAM(); // FIXME: should it be updated immediately? - - // FIXME: is there othercommands? - - break; - } - case 0xB0: - { - // [A] Psy-X custom texture packet - DR_PSYX_TEX* drtex = (DR_PSYX_TEX*)pTag; - break; - } - case 0xE0: // DR_ENV commands - { - uint i; - DR_ENV* drenv = (DR_ENV*)pTag; - - // parse each code of the command - for (i = 0; i < pTag->len; i++) - { - u_long code = drenv->code[i]; - u_char drcode = code >> 24 & 0xFF; - - switch (drcode) - { - case 0xE1: - { - activeDrawEnv.tpage = (code & 0x1FF); - activeDrawEnv.dtd = (code >> 9) & 1; - activeDrawEnv.dfe = (code >> 10) & 1; - - break; - } - case 0xE2: - { - activeDrawEnv.tw.w = (code & 0x1F); - activeDrawEnv.tw.h = ((code >> 5) & 0x1F); - activeDrawEnv.tw.x = ((code >> 10) & 0x1F); - activeDrawEnv.tw.y = ((code >> 15) & 0x1F); - break; - } - case 0xE3: - { - activeDrawEnv.clip.x = code & 1023; - activeDrawEnv.clip.y = (code >> 10) & 1023; - break; - } - case 0xE4: - { - activeDrawEnv.clip.w = code & 1023; - activeDrawEnv.clip.h = (code >> 10) & 1023; - - activeDrawEnv.clip.w -= activeDrawEnv.clip.x; - activeDrawEnv.clip.h -= activeDrawEnv.clip.y; - break; - } - case 0xE5: - { - activeDrawEnv.ofs[0] = code & 2047; - activeDrawEnv.ofs[1] = (code >> 11) & 2047; - - break; - } - case 0xE6: - { - eprintf("Mask setting: %08x\n", code); - //MaskSetOR = (*cb & 1) ? 0x8000 : 0x0000; - //MaskEvalAND = (*cb & 2) ? 0x8000 : 0x0000; - break; - } - } - } - break; - } - default: - { - //Unhandled poly type - eprinterr("Unhandled primitive type: %02X type2:%02X\n", pTag->code, pTag->code & ~3); - break; - } - } - - return (pTag->len + P_LEN) * sizeof(long); -} - -int ParseLinkedPrimitiveList(uintptr_t packetStart, uintptr_t packetEnd) -{ - uintptr_t currentAddress = packetStart; - - int lastSize = -1; - - while (currentAddress != packetEnd) - { - lastSize = ParsePrimitive(currentAddress); - - if (lastSize == -1) // not valid packets submitted - break; - - currentAddress += lastSize; - } - - g_splits[g_splitIndex].numVerts = g_vertexIndex - g_splits[g_splitIndex].startVertex; - - return lastSize; -} \ No newline at end of file diff --git a/src_rebuild/PsyCross/src/gpu/PsyX_GPU.h b/src_rebuild/PsyCross/src/gpu/PsyX_GPU.h deleted file mode 100644 index 7c705c59..00000000 --- a/src_rebuild/PsyCross/src/gpu/PsyX_GPU.h +++ /dev/null @@ -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 \ No newline at end of file diff --git a/src_rebuild/PsyCross/src/gpu/font.h b/src_rebuild/PsyCross/src/gpu/font.h deleted file mode 100644 index ca80d951..00000000 --- a/src_rebuild/PsyCross/src/gpu/font.h +++ /dev/null @@ -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 -}; \ No newline at end of file diff --git a/src_rebuild/PsyCross/src/gte/PsyX_GTE.cpp b/src_rebuild/PsyCross/src/gte/PsyX_GTE.cpp deleted file mode 100644 index 93299d1d..00000000 --- a/src_rebuild/PsyCross/src/gte/PsyX_GTE.cpp +++ /dev/null @@ -1,915 +0,0 @@ -#include "PsyX_GTE.h" - -#include "psx/libgte.h" -#include "psx/gtereg.h" - -#include - -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[65535]; -int g_pgxpVertexIndex = 0; -int g_pgxpTransformed = 0; -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 - int start = max(0, indexhint - 8); - int end = g_pgxpVertexIndex;// min(start + 256, g_pgxpVertexIndex); - - for (int 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; -} \ No newline at end of file diff --git a/src_rebuild/PsyCross/src/gte/PsyX_GTE.h b/src_rebuild/PsyCross/src/gte/PsyX_GTE.h deleted file mode 100644 index 0f17126c..00000000 --- a/src_rebuild/PsyCross/src/gte/PsyX_GTE.h +++ /dev/null @@ -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 \ No newline at end of file diff --git a/src_rebuild/PsyCross/src/gte/half_float.cpp b/src_rebuild/PsyCross/src/gte/half_float.cpp deleted file mode 100644 index c92194e1..00000000 --- a/src_rebuild/PsyCross/src/gte/half_float.cpp +++ /dev/null @@ -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); -} diff --git a/src_rebuild/PsyCross/src/gte/ratan_tbl.h b/src_rebuild/PsyCross/src/gte/ratan_tbl.h deleted file mode 100644 index e6f22679..00000000 --- a/src_rebuild/PsyCross/src/gte/ratan_tbl.h +++ /dev/null @@ -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 -}; \ No newline at end of file diff --git a/src_rebuild/PsyCross/src/gte/rcossin_tbl.h b/src_rebuild/PsyCross/src/gte/rcossin_tbl.h deleted file mode 100644 index ac2f0fcc..00000000 --- a/src_rebuild/PsyCross/src/gte/rcossin_tbl.h +++ /dev/null @@ -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, -}; \ No newline at end of file diff --git a/src_rebuild/PsyCross/src/gte/sqrt_tbl.h b/src_rebuild/PsyCross/src/gte/sqrt_tbl.h deleted file mode 100644 index f43aee9f..00000000 --- a/src_rebuild/PsyCross/src/gte/sqrt_tbl.h +++ /dev/null @@ -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 -}; \ No newline at end of file diff --git a/src_rebuild/PsyCross/src/iso9660.h b/src_rebuild/PsyCross/src/iso9660.h deleted file mode 100644 index 864206c6..00000000 --- a/src_rebuild/PsyCross/src/iso9660.h +++ /dev/null @@ -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 \ No newline at end of file diff --git a/src_rebuild/PsyCross/src/pad/PsyX_pad.cpp b/src_rebuild/PsyCross/src/pad/PsyX_pad.cpp deleted file mode 100644 index 7ec5c2b3..00000000 --- a/src_rebuild/PsyCross/src/pad/PsyX_pad.cpp +++ /dev/null @@ -1,499 +0,0 @@ -#include "psx/libpad.h" -#include "psx/libetc.h" - -#include "../PsyX_main.h" -#include "PsyX_pad.h" -#include "PsyX/PsyX_public.h" - -#include - -extern "C" -{ -extern int g_padCommEnable; -} - -typedef struct -{ - Sint32 deviceId; // linked device Id - SDL_GameController* gc; - SDL_Haptic* haptic; - int hapticEffect; - - 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; - - SDL_Joystick* joy = SDL_GameControllerGetJoystick(controller->gc); - - // try open haptics - if (SDL_JoystickIsHaptic(joy)) - controller->haptic = SDL_HapticOpenFromJoystick(joy); - else // try open using device ID - controller->haptic = SDL_HapticOpen(controller->deviceId); - - controller->hapticEffect = -1; - - if (!controller->haptic) - { - eprintwarn("No haptic for '%s'\n", SDL_GameControllerNameForIndex(deviceId)); - } - } -} - -// Closes controller in specific slot -void PsyX_Pad_CloseController(int slot) -{ - PsyXController* controller = &g_controllers[slot]; - - SDL_HapticDestroyEffect(controller->haptic, controller->hapticEffect); - SDL_HapticClose(controller->haptic); - SDL_GameControllerClose(controller->gc); - - //controller->deviceId = -1; - controller->gc = NULL; - controller->haptic = NULL; - controller->hapticEffect = -1; -} - -// 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 (!controller->haptic) - return; - - if (len == 0) - return; - - SDL_HapticEffect eff; - eff.type = SDL_HAPTIC_LEFTRIGHT; - - eff.leftright.small_magnitude = table[0] * 255; - - if (len > 1) - eff.leftright.large_magnitude = table[1] * 255; - else - eff.leftright.large_magnitude = 0; - - eff.leftright.length = 400; - - if (SDL_HapticEffectSupported(controller->haptic, &eff) != SDL_TRUE) - return; - - if (controller->hapticEffect == -1) - { - controller->hapticEffect = SDL_HapticNewEffect(controller->haptic, &eff); - if (controller->hapticEffect == -1) - { - eprintwarn("Warning: Unable to create haptic effect! %s\n", SDL_GetError()); - } - } - else - SDL_HapticUpdateEffect(controller->haptic, controller->hapticEffect, &eff); - - if (SDL_HapticRunEffect(controller->haptic, controller->hapticEffect, 1) != 0) - { - eprintwarn("Warning: Unable to run haptic effect! %s\n", SDL_GetError()); - } -} \ No newline at end of file diff --git a/src_rebuild/PsyCross/src/pad/PsyX_pad.h b/src_rebuild/PsyCross/src/pad/PsyX_pad.h deleted file mode 100644 index 50d0ecf8..00000000 --- a/src_rebuild/PsyCross/src/pad/PsyX_pad.h +++ /dev/null @@ -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 \ No newline at end of file diff --git a/src_rebuild/PsyCross/src/platform.h b/src_rebuild/PsyCross/src/platform.h deleted file mode 100644 index 3f16bbe1..00000000 --- a/src_rebuild/PsyCross/src/platform.h +++ /dev/null @@ -1,54 +0,0 @@ -#ifndef PLATFORM_SETUP_H -#define PLATFORM_SETUP_H - -#ifndef _CRT_SECURE_NO_WARNINGS - #define _CRT_SECURE_NO_WARNINGS -#endif - -#include - -//----------------------------------------------------------------------- - -#if defined(__APPLE__) -# include -#elif defined(__EMSCRIPTEN__) -# include -# include -# include -#elif defined(_WINDOWS) || defined(__MINGW32__) || defined(__linux__) || defined(__ANDROID__) || defined(__RPI__) -# include -#endif - -//----------------------------------------------------------------------- - -#ifdef _MSC_VER -#define FUNCNAME __FUNCTION__ -#else -#define FUNCNAME __func__ -#endif - -#include "PsyX/PsyX_globals.h" - -#if defined(__ANDROID__) -# include -# 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 \ No newline at end of file diff --git a/src_rebuild/PsyCross/src/psx/ABS.C b/src_rebuild/PsyCross/src/psx/ABS.C deleted file mode 100644 index 547d5b32..00000000 --- a/src_rebuild/PsyCross/src/psx/ABS.C +++ /dev/null @@ -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; -} \ No newline at end of file diff --git a/src_rebuild/PsyCross/src/psx/INLINE_C.C b/src_rebuild/PsyCross/src/psx/INLINE_C.C deleted file mode 100644 index 5769c745..00000000 --- a/src_rebuild/PsyCross/src/psx/INLINE_C.C +++ /dev/null @@ -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); -} \ No newline at end of file diff --git a/src_rebuild/PsyCross/src/psx/LIBAPI.C b/src_rebuild/PsyCross/src/psx/LIBAPI.C deleted file mode 100644 index d593ec19..00000000 --- a/src_rebuild/PsyCross/src/psx/LIBAPI.C +++ /dev/null @@ -1,557 +0,0 @@ -#include "psx/libapi.h" - -#include -#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; -} diff --git a/src_rebuild/PsyCross/src/psx/LIBCD.C b/src_rebuild/PsyCross/src/psx/LIBCD.C deleted file mode 100644 index d9480704..00000000 --- a/src_rebuild/PsyCross/src/psx/LIBCD.C +++ /dev/null @@ -1,1016 +0,0 @@ -#include "psx/libcd.h" - -#include "../PsyX_main.h" -#include "../iso9660.h" - -#include -#include -#include -#include -#include -#include - -#ifdef _WIN32 -#include -#elif defined (__unix__) -#include -#define _mkdir(str) mkdir(str, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH) -#endif - -#if defined(__ANDROID__)///@FIXME Android include order is messed up, includes SPEC_PSXPC_N MALLOC.H rather than NDK version! -#define malloc SDL_malloc -#define free SDL_free -#endif - -//------------------------------------------------------- -// Virtual stdio.h implementation - -typedef struct _VFILE -{ - FILE* fp; - u_char* basePtr; - u_char* curPtr; - size_t size; -} VFILE; - -size_t vfread(void* _Buffer, size_t _ElementSize, size_t _ElementCount, VFILE* _Stream) -{ - if (_Stream->fp) - return fread(_Buffer, _ElementSize, _ElementCount, _Stream->fp); - - size_t num_to_read = _ElementSize * _ElementCount; - - if ((_Stream->curPtr + num_to_read) - _Stream->basePtr > _Stream->size) - { - // subtract difference - num_to_read -= ((_Stream->curPtr + num_to_read) - (_Stream->basePtr + _Stream->size)); - } - - memcpy(_Buffer, _Stream->curPtr, num_to_read); - - // don't forget to advance - _Stream->curPtr += num_to_read; - - return _ElementCount; -} - -int vfseek(VFILE* _Stream, long _Offset, int _Origin) -{ - if (_Stream->fp) - return fseek(_Stream->fp, _Offset, _Origin); - - if (_Origin == SEEK_SET) - _Stream->curPtr = _Stream->basePtr + _Offset; - else if (_Origin == SEEK_CUR) - _Stream->curPtr += _Offset; - else if (_Origin == SEEK_END) - _Stream->curPtr = _Stream->basePtr + _Stream->size + _Offset; - - return 0; -} - -long vftell(VFILE* _Stream) -{ - if (_Stream->fp) - return ftell(_Stream->fp); - - return _Stream->curPtr - _Stream->basePtr; -} - -//------------------------------------------------------- - -enum ReadMode -{ - RM_DATA, - RM_XA_AUDIO -}; - -enum ReadMode readMode = RM_DATA; - -int CD_Debug = 0; -VFILE g_imageFile = { NULL }; - -typedef struct commandQueue -{ - u_int mode; - u_char* p; - u_int processed; - u_int count; -}commandQueue_s, *commandQueue_p; - - -#define COMMAND_QUEUE_SIZE 128 - -struct commandQueue g_cdComQueue[COMMAND_QUEUE_SIZE]; -int g_cdComQueueIndex = 0; -int g_cdComQueueCount = 0; - -int g_cdCurrentSector = 0; -int g_cdSectorSize = CD_SECTOR_SIZE_MODE2; // default -int g_cdCurrentTrack = 1; // default -int g_cdNumFrames = 0; -int g_CD_com = 0; - -int g_cdReadDoneFlag = 1; - -char g_cdImageBinaryFileName[2048] = { 0 }; -int g_UseCDImage = 0; - -int PsyX_IsCDImageInit() -{ - return g_imageFile.fp != NULL || g_imageFile.basePtr != NULL; -} - -void PsyX_CDFS_Init(const char* imageFileName, int track /*= 0*/, int sectorSize /*= 0*/) -{ - g_UseCDImage = 1; - - strcpy(g_cdImageBinaryFileName, imageFileName); - - if (track > 0) - g_cdCurrentTrack = track; - - if (sectorSize > 0) - g_cdSectorSize = sectorSize; -} - -void PsyX_CDFS_Init_Mem(const u_long* data, int size, int track /*= 0*/, int sectorSize /*= 0*/) -{ - g_UseCDImage = 1; - - strcpy(g_cdImageBinaryFileName, "_MEMORY"); - - g_imageFile.fp = NULL; - g_imageFile.basePtr = g_imageFile.curPtr = (u_char*)data; - g_imageFile.size = size; - - if (track > 0) - g_cdCurrentTrack = track; - - if (sectorSize > 0) - g_cdSectorSize = sectorSize; -} - -// utility function -int GetCurrentDirName(char* dest, char* src) -{ - char* str; - - str = dest; - - // start with folders - strncpy(str, src, 16); - - while (*str) - { - if (*str == '\\') - { - *str = 0; - break; - } - str++; - } - - return str - dest; -} - -//---------------------------------------------------------- - -typedef void(*CdlDataCB)(void); - -void _eCdGetSector(char* dest, int count); -CdlDataCB _eCdDataCallback(CdlDataCB cb); -CdlCB _eCdReadyCallback(CdlCB cb); - -void _eCdControlF_ReadS(int sector); -void _eCdControlF_Pause(); - -//---------------------------------------------------------- - -int PsyX_CD_CheckImageAvailable() -{ - if (g_UseCDImage) - { - if (!PsyX_IsCDImageInit()) - eprintwarn("WARNING - CD subsystem is not initialized yet!\n"); - else - return 1; - } - - return 0; -} - -CdlFILE* CdSearchFile(CdlFILE* fp, char* name) -{ - char pathPart[16]; - int tocLocalOffset; - TOC* toc; - int pathOfs; - int dirLevel; - - Sector sector; - - memset(fp, 0, sizeof(CdlFILE)); - - if (!PsyX_CD_CheckImageAvailable()) - return NULL; - - assert(g_cdReadDoneFlag == 1); - - if (!g_cdReadDoneFlag) - { - // deny request - eprintwarn("CdSearchFile called while in 'CdlReadS'\n"); - return NULL; - } - -#ifdef _DEBUG - eprintf("CdSearchFile: %s\n", name); -#endif - - dirLevel = 0; - - // go to sector 22 - vfseek(&g_imageFile, CD_ROOT_DIRECTORY_SECTOR * g_cdSectorSize, SEEK_SET); - vfread(§or, sizeof(Sector), 1, &g_imageFile); - - toc = (TOC*)§or.data[0]; - tocLocalOffset = 0; - - if (name[0] == '\\') - name++; - - pathOfs = GetCurrentDirName(pathPart, name); - - while (toc->tocEntryLength != 0) - { - char* itemNameStr = (char*)§or.data[tocLocalOffset + sizeof(TOC)]; - - // skip . and .. for now - if (*itemNameStr == 0 || *itemNameStr == 1) - { - tocLocalOffset += toc->tocEntryLength; - toc = (TOC*)§or.data[tocLocalOffset]; - - continue; - } - - if (!strcmp(itemNameStr, pathPart)) - { - if(toc->flags & 2) // is directory - { - // get next directory name - pathOfs += GetCurrentDirName(pathPart, name + pathOfs + 1) + 1; - - // read the needed sector with directory contents - dirLevel++; - vfseek(&g_imageFile, toc->sectorPosition[0] * g_cdSectorSize, SEEK_SET); - vfread(§or, sizeof(Sector), 1, &g_imageFile); - - tocLocalOffset = 0;; - toc = (TOC*)§or.data[tocLocalOffset]; - continue; - } - - memcpy(fp->name, itemNameStr, toc->nameLength); - - fp->size = toc->fileSize[0]; - - vfseek(&g_imageFile, toc->sectorPosition[0] * g_cdSectorSize, SEEK_SET); - vfread(§or, sizeof(Sector), 1, &g_imageFile); - - fp->pos.minute = sector.addr[0]; - fp->pos.second = sector.addr[1]; - fp->pos.sector = sector.addr[2]; - -#if _DEBUG - eprintf("Found\n"); -#endif - return fp; - } - - tocLocalOffset += toc->tocEntryLength; - toc = (TOC*)§or.data[tocLocalOffset]; - } - - return NULL; -} - -int CdReadFile(char* file, u_long* addr, int nbyte) -{ - CdlFILE fp; - - if (CdSearchFile(&fp, file) != NULL) - { - int nSectors; - nSectors = (fp.size / (SECTOR_SIZE * 4)) + 1; - - CdControlB(CdlSetloc, (u_char*)&fp.pos, NULL); - CdRead(nSectors, (u_long*)addr, 0); - - if (nbyte == 0) - nbyte = fp.size; - - return nbyte; - } - - return -1; -} - -CdlLOC* CdIntToPos(int i, CdlLOC* p) -{ - i += 150; - p->sector = ENCODE_BCD(i % 75); - int rem = i / 75; - p->second = ENCODE_BCD(rem % 60); - p->minute = ENCODE_BCD(rem / 60); - return p; -} - -int CdControl(u_char com, u_char * param, u_char * result) -{ - CdlLOC* cd = (CdlLOC*)param; - - g_CD_com = com; - - if (!PsyX_CD_CheckImageAvailable()) - return 0; - - switch (com) - { - case CdlSetloc: - vfseek(&g_imageFile, CdPosToInt(cd)*g_cdSectorSize, SEEK_SET); - break; - case CdlReadS: - { - unsigned int filePos = vftell(&g_imageFile); - - CdlLOC currentLoc; - CdIntToPos(filePos, ¤tLoc); - - vfseek(&g_imageFile, CdPosToInt(cd) * g_cdSectorSize, SEEK_SET); - - g_cdCurrentSector = CdPosToInt(cd); - - if (cd->sector != currentLoc.sector) - return 1; - - break; - } - default: - eprinterr("Unhandled command 0x%02X!\n", com); - break; - } - - return 0; -} - -int CdControlB(u_char com, u_char* param, u_char* result) -{ - int ret; - - if (!PsyX_CD_CheckImageAvailable()) - return 0; - - ret = 0; - - switch (com) - { - case CdlSetloc: - { - CdlLOC* cd = (CdlLOC*)param; - vfseek(&g_imageFile, CdPosToInt(cd) * g_cdSectorSize, SEEK_SET); - readMode = RM_DATA; - ret = 1; - break; - } - case CdlSetfilter: - { - CdlFILTER* cdf = (CdlFILTER*)param; - // TODO: set channel. Primarily used for CDDA/XA - break; - } - case CdlSetmode: - { - // TODO: CdlModeSize0 and CdlModeSize1 can change things - - eprinterr("Unimplemented 'CdlSetmode'!\n"); - - ret = 1; - break; - } - default: - eprinterr("Unhandled command 0x%02X!\n", com); - break; - } - - if(ret) - g_CD_com = com; - - return ret; -} - -int CdControlF(u_char com, u_char * param) -{ - // TODO: CdControlF() waits for the previous command to complete execution before issuing the new command - - g_CD_com = com; - - if (!PsyX_CD_CheckImageAvailable()) - return 0; - - switch (com) - { - case CdlSetloc: - { - CdlLOC* cd = (CdlLOC*)param; - vfseek(&g_imageFile, CdPosToInt(cd) * g_cdSectorSize, SEEK_SET); - break; - } - case CdlSetfilter: - { - CdlFILTER* cdf = (CdlFILTER*)param; - - // TODO: set channel. Primarily used for CDDA/XA - - break; - } - case CdlGetlocP: - { - readMode = RM_XA_AUDIO; - break; - } - case CdlReadS: - { - // start reading sectors - CdlLOC* cd = (CdlLOC*)param; - _eCdControlF_ReadS(CdPosToInt(cd)); - - break; - } - case CdlPause: - { - // pause thread - _eCdControlF_Pause(); - break; - } - default: - { - eprinterr("Unhandled command 0x%02X!\n", com); - break; - } - } - - return 0; -} - -int CdPosToInt(CdlLOC* p) -{ - return (75 * (60 * DECODE_BCD(p->minute) + DECODE_BCD(p->second))) + DECODE_BCD(p->sector) - 150; -} - -int CdRead(int sectors, u_long* buf, int mode) -{ - int ret; - - ret = 0; - - for (int i = 0; i < COMMAND_QUEUE_SIZE; i++) - { - if (g_cdComQueue[i].processed == 1) - { - g_cdComQueue[i].mode = mode; // CdlMode* - g_cdComQueue[i].p = (unsigned char*)buf; - g_cdComQueue[i].processed = 0; - g_cdComQueue[i].count = sectors; - - ret = 1; - break; - } - } - - if(ret == 0) - eprinterr("out of command queue\n"); - - return ret; -} - -int CdReadSync(int mode, u_char* result) -{ - int i; - - for (i = 0; i < COMMAND_QUEUE_SIZE; i++) - { - if (g_cdComQueue[i].processed == 0) - { - do - { - if (readMode == RM_DATA) - { - Sector sector; - - vfread(§or, sizeof(Sector), 1, &g_imageFile); - - memcpy(g_cdComQueue[i].p, §or.data[0], sizeof(sector.data)); - g_cdComQueue[i].p += sizeof(sector.data); - } - else if (readMode == RM_XA_AUDIO) - { - AudioSector sector; - - vfread(§or, sizeof(AudioSector), 1, &g_imageFile); - - memcpy(g_cdComQueue[i].p, §or.data[0], sizeof(sector.data)); - g_cdComQueue[i].p += sizeof(sector.data); - } - else - { - assert(0); - } - - if (--g_cdComQueue[i].count == 0) - g_cdComQueue[i].processed = 1; - - // in mode 1 it doesn't wait until read is completed - if (mode == 1) - break; - - } while (g_cdComQueue[i].count > 0); - - // returns number of sectors remaining - // on mode == 0 it's always greater than 0 - return g_cdComQueue[i].count; - } - } - - return -1; -} - -int CdSetDebug(int level) -{ - int lastLevel = CD_Debug; - CD_Debug = level; - return lastLevel; -} - -int CdSync(int mode, u_char * result) -{ - CdlLOC locP; - CdlLOC* loc = (CdlLOC*)result; - - switch (mode) - { - case 0: - PSYX_UNIMPLEMENTED(); - assert(0); - break; - case 1: - - switch (CdLastCom()) - { - case CdlGetlocP: - - CdIntToPos(g_cdCurrentSector+=20, &locP); - result[0] = g_cdCurrentTrack; - result[1] = 1;//index, usually 1 - result[2] = locP.minute; - result[3] = locP.second; - result[4] = locP.sector; - result[5] = locP.minute + ENCODE_BCD(g_cdNumFrames); - result[6] = locP.second + ENCODE_BCD(g_cdNumFrames); - result[7] = locP.sector + ENCODE_BCD(g_cdNumFrames); - - //Dirty, for now read the audio data - if (readMode == RM_XA_AUDIO) - { - char xaAudioData[2336]; - CdRead(1, (unsigned long*)&xaAudioData[0], CdlReadS); - CdReadSync(CdlReadS, NULL); - - //Sector should be read now - xaAudioData[0] = 0; - } - - break; - } - return CdlComplete; - break; - } - - return 0; -} - -int OpenBinaryImageFile() -{ - // already open? - // TODO: it has to be closed - // FIXME: what if Psy-X users want to swap CDs? - //if (g_UseCDImage) - // return 0; - - if (!g_imageFile.basePtr) - { - // open Binary - g_imageFile.fp = fopen(g_cdImageBinaryFileName, "rb"); - - if (!g_imageFile.fp) - { - eprinterr("CD image '%s' not found.\n", g_cdImageBinaryFileName); - return 0; - } - } - - vfseek(&g_imageFile, 0, SEEK_END); - unsigned int binFileLength = vftell(&g_imageFile); - g_cdNumFrames = binFileLength / g_cdSectorSize; - - assert(g_cdNumFrames != 0); - - vfseek(&g_imageFile, 0, SEEK_SET); - - eprintinfo("Using '%s' image, sector size: %d, frames: %d\n", g_cdImageBinaryFileName, g_cdSectorSize, g_cdNumFrames); - - /*{ - * - Sector sector; - fseek(g_imageFp, CD_ROOT_DIRECTORY_SECTOR * g_cdSectorSize, SEEK_SET); - fread(§or, sizeof(Sector), 1, g_imageFp); - DumpFiles_r(§or, ""); - }*/ - - return 1; -} - -// TODO: don't just rely on cue sheet -// use this https://gist.github.com/ceritium/139577 to detect Mode 1 or Mode 2 -int ParseCueSheet() -{ - if(g_imageFile.basePtr || strlen(g_cdImageBinaryFileName)) - { - OpenBinaryImageFile(); - return 1; - } - - int cdMode; - char* binFileName = NULL; - FILE* cueFp = fopen(DISC_CUE_FILENAME, "rb"); - - if (cueFp == NULL) - { - eprinterr("%s not found.\n", DISC_CUE_FILENAME); - return 0; - } - - fseek(cueFp, 0, SEEK_END); - - unsigned int cueSheetFileLength = ftell(cueFp); - char* cueSheet = (char*)malloc(cueSheetFileLength); - - fseek(cueFp, 0, SEEK_SET); - fread(cueSheet, cueSheetFileLength, 1, cueFp); - - //Null terminated - char* string = &cueSheet[0]; - if (!strncmp(string, "FILE", 4)) - { - //Read the binary name since it's a file - string += 5; - if (isspace(string[0])) - { - string++; - } - - //Get file name length - char* afterFileName = string; - char fileNameLength = 0; - //While - while (!isspace(afterFileName[0])) - { - afterFileName++; - fileNameLength++; - } - - if (string[0] == '"') - { - string[fileNameLength - 1] = 0; - string++; - } - - binFileName = string; - string = afterFileName; - - if (isspace(string[0])) - string++; - - /* Get Type of BIN file */ - assert(!strncmp(string, "BINARY", 6)); - string += 6; - - while (isspace(string[0])) - string++; - - /* Get Track of BIN file */ - assert(!strncmp(string, "TRACK", 5)); - string += 5; - - while (isspace(string[0])) - string++; - - g_cdCurrentTrack = atoi(string); - - string += 2; - - while (isspace(string[0])) - string++; - - assert(!strncmp(string, "MODE", 4)); - string += 4; - - cdMode = atoi(string); - string++; - - assert(string[0] == '/'); - string++; - - g_cdSectorSize = atoi(string); - - assert(g_cdSectorSize == CD_SECTOR_SIZE_MODE2); - - fclose(cueFp); - - // copy file name - strcpy(g_cdImageBinaryFileName, binFileName); - - free(cueSheet); - - eprintinfo("CUE: '%s' is Mode %d image\n", g_cdImageBinaryFileName, cdMode); - - OpenBinaryImageFile(); - } - - return 1; -} - -int CdInit(void) -{ - g_cdCurrentSector = 0; - - if(g_UseCDImage) - { - //Read the cue sheet and obtain properties from it. - if (!ParseCueSheet()) - return 0; - } - else - { - // TODO: explicitly PC FS or CD DRIVE? - } - - memset(&g_cdComQueue, 0, sizeof(g_cdComQueue)); - for (int i = 0; i < COMMAND_QUEUE_SIZE; i++) - g_cdComQueue[i].processed = 1; - - return 1; -} - -int CdLastCom(void) -{ - return g_CD_com; -} - -int CdGetSector(void *madr, int size) -{ - _eCdGetSector((char*)madr, size); - return 1; -} - -CdlCB CdReadyCallback(CdlCB func) -{ - return _eCdReadyCallback(func); -} - -void* CdDataCallback(void(*func)()) -{ - return (void*)_eCdDataCallback(func); -} - -int CdDiskReady(int mode) -{ - //PSYX_UNIMPLEMENTED(); - return CdlComplete; -} - -//-------------------------------------------------------------------------------- - -CdlDataCB g_dataCallback = NULL; -CdlCB g_readyCallback = NULL; - -//char g_cdSectorData[SECTOR_SIZE * 4] = { 0 }; - -Sector g_cdSectorData; - -int g_isCdSectorDataRead = 0; - -#ifndef __EMSCRIPTEN__ -SDL_Thread* g_cdSpoolerPCThread = NULL; -SDL_mutex* g_cdSpoolerMutex = NULL; - -#define CD_LOCK_MUTEX() SDL_LockMutex(g_cdSpoolerMutex) -#define CD_UNLOCK_MUTEX() SDL_UnlockMutex(g_cdSpoolerMutex) - -#else - -#define CD_LOCK_MUTEX() -#define CD_UNLOCK_MUTEX() - -#endif // __EMSCRIPTEN__ - -volatile int g_cdSpoolerSeekCmd = 0; - -//----------------------------------------------------- -// copies read sector data to addr -//----------------------------------------------------- -void _eCdGetSector(char* dest, int count) -{ - count *= 4; - - assert(count <= SECTOR_SIZE * 4); - assert(dest); - - memcpy(dest, g_cdSectorData.data, count); - g_isCdSectorDataRead = 1; -} - -CdlDataCB _eCdDataCallback(CdlDataCB cb) -{ - CdlDataCB old = g_dataCallback; - CD_LOCK_MUTEX(); - g_dataCallback = cb; - CD_UNLOCK_MUTEX(); - return old; -} - -CdlCB _eCdReadyCallback(CdlCB cb) -{ - CdlCB old = g_readyCallback; - - CD_LOCK_MUTEX(); - g_readyCallback = cb; - CD_UNLOCK_MUTEX(); - - return old; -} - -int _eCdSpoolerFunc() -{ - static u_char zero_bytes[] = { 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0 }; - - CdlCB readyCb; - CdlDataCB dataCb; - - CD_LOCK_MUTEX(); - - if (g_cdSpoolerSeekCmd != 0) - { - int sector = g_cdSpoolerSeekCmd; - - if (sector == -1) - { - eprintinfo("CD: 'CdlPause'\n", sector); - - g_cdSpoolerSeekCmd = 0; - g_cdReadDoneFlag = 1; - } - else - { - eprintinfo("CD: 'CdlReadS' at %d\n", sector); - - // seek - vfseek(&g_imageFile, sector * g_cdSectorSize, SEEK_SET); - g_cdSpoolerSeekCmd = 0; - } - } - - dataCb = g_dataCallback; - readyCb = g_readyCallback; - - CD_UNLOCK_MUTEX(); - - // clear sector before proceed - memset(&g_cdSectorData, 0, sizeof(g_cdSectorData)); - vfread(&g_cdSectorData, sizeof(Sector), 1, &g_imageFile); - - g_isCdSectorDataRead = 0; - - if (readyCb) - { - readyCb(1, zero_bytes); - - if (g_isCdSectorDataRead && dataCb) - dataCb(); - } - else - return 0; - - return 1; -} - -// Main spooler thread function -int _eCdSpoolerThreadFunc(void* data) -{ - //Print incoming data - eprintwarn("Running CD thread...\n"); - - g_cdReadDoneFlag = 0; - g_isCdSectorDataRead = 0; - - do - { - if (_eCdSpoolerFunc() == 0) - break; - } while (!g_cdReadDoneFlag); - - eprintinfo("CD thread work done.\n"); - - return 0; -} - -#ifdef __EMSCRIPTEN__ -volatile int g_emCDSpoolerRunning = 0; - -EM_BOOL emCDSpoolerCallback(double time, void* userData) -{ - int result; - - result = _eCdSpoolerFunc(); - - if (result == 0) - { - eprintinfo("CD thread work done.\n"); - g_emCDSpoolerRunning = 0; - return EM_FALSE; - } - - return EM_TRUE; -} -#endif - -//----------------------------------------------------- -// reads sector from LEV file -//----------------------------------------------------- -void _eCdControlF_ReadS(int sector) -{ -#ifdef __EMSCRIPTEN__ - g_cdSpoolerSeekCmd = sector; - - if (g_cdReadDoneFlag) - { - while (g_emCDSpoolerRunning) - { - emscripten_sleep(0); - } - } - - //Print incoming data - if (g_emCDSpoolerRunning == 0) - { - g_emCDSpoolerRunning = 1; - eprintwarn("Running CD thread...\n"); - - g_cdReadDoneFlag = 0; - g_isCdSectorDataRead = 0; - - emscripten_set_timeout_loop(emCDSpoolerCallback, 1.0, NULL); - } -#else - if (!g_cdSpoolerMutex) - g_cdSpoolerMutex = SDL_CreateMutex(); - - CD_LOCK_MUTEX(); - g_cdSpoolerSeekCmd = sector; - CD_UNLOCK_MUTEX(); - - if (g_cdSpoolerPCThread && g_cdReadDoneFlag) - { - int returnValue; - SDL_WaitThread(g_cdSpoolerPCThread, &returnValue); - - g_cdSpoolerPCThread = NULL; - } - - if (!g_cdSpoolerPCThread) - { - g_cdSpoolerPCThread = SDL_CreateThread(_eCdSpoolerThreadFunc, "CDSpooler", NULL); - - if (NULL == g_cdSpoolerPCThread) - { - eprinterr("SDL_CreateThread failed: %s\n", SDL_GetError()); - } - } -#endif // EMSCRIPTEN -} - -void _eCdControlF_Pause() -{ - g_cdSpoolerSeekCmd = -1; -} \ No newline at end of file diff --git a/src_rebuild/PsyCross/src/psx/LIBETC.C b/src_rebuild/PsyCross/src/psx/LIBETC.C deleted file mode 100644 index f13ac168..00000000 --- a/src_rebuild/PsyCross/src/psx/LIBETC.C +++ /dev/null @@ -1,93 +0,0 @@ -#include "psx/libetc.h" - -#include "../PsyX_main.h" -#include "PsyX/PsyX_public.h" - -#include - -#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 -} \ No newline at end of file diff --git a/src_rebuild/PsyCross/src/psx/LIBGPU.C b/src_rebuild/PsyCross/src/psx/LIBGPU.C deleted file mode 100644 index 8975e7d9..00000000 --- a/src_rebuild/PsyCross/src/psx/LIBGPU.C +++ /dev/null @@ -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 - -#include -#include -#include -#include - -#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; -} diff --git a/src_rebuild/PsyCross/src/psx/LIBGTE.C b/src_rebuild/PsyCross/src/psx/LIBGTE.C deleted file mode 100644 index cb20b964..00000000 --- a/src_rebuild/PsyCross/src/psx/LIBGTE.C +++ /dev/null @@ -1,1010 +0,0 @@ -#include "psx/libgte.h" -#include "psx/inline_c.h" -#include "psx/gtemac.h" -#include "psx/gtereg.h" - -#include -#include "PsyX/PsyX_render.h" - -#include - -#include "../gte/PsyX_GTE.h" -#include "../gte/rcossin_tbl.h" -#include "../gte/ratan_tbl.h" -#include "../gte/sqrt_tbl.h" - -#define ONE_BITS 12 -#define ONE (1 << 12) -#define FIXED(a) ((a) >> 12) - -#ifndef MIN -#define MIN(a,b) fst_min(a,b) -#endif - -#ifndef MAX -#define MAX(a,b) fst_max(a,b) -#endif - -inline int fst_min(int a, int b) -{ - int diff = a - b; - int dsgn = diff >> 31; - return b + (diff & dsgn); -} - -inline int fst_max(int a, int b) -{ - int diff = a - b; - int dsgn = diff >> 31; - return a - (diff & dsgn); -} - -void InitGeom() -{ - C2_ZSF3 = 341; - C2_ZSF4 = 256; - C2_H = 1000; - C2_DQA = -98; - C2_DQB = 340; - C2_OFX = 0; - C2_OFY = 0; -} - -void SetGeomOffset(int ofx, int ofy) -{ - C2_OFX = (ofx << 16); - C2_OFY = (ofy << 16); -} - -void SetGeomScreen(int h) -{ - C2_H = h; -} - -void SetRotMatrix(MATRIX* m) -{ - gte_SetRotMatrix(m); -} - -void SetLightMatrix(MATRIX* m) -{ - gte_SetLightMatrix(m); -} - -void SetColorMatrix(MATRIX* m) -{ - gte_SetColorMatrix(m); -} - -void SetTransMatrix(MATRIX* m) -{ - gte_SetTransMatrix(m); -} - -#define MAX_NUM_MATRICES 20 -int matrixLevel = 0; -MATRIX stack[MAX_NUM_MATRICES];//unk_410 -MATRIX* currentMatrix = &stack[0];//unk_40C - -void PushMatrix() -{ - if (matrixLevel < 20) - { - MATRIX* m = &stack[matrixLevel];//$t7 - - gte_ReadRotMatrix(m); - gte_sttr(m->t); - - currentMatrix++; - matrixLevel++; - } - else - { - printf("Error: Can't push matrix,stack(max 20) is full!\n"); - } -} - -void PopMatrix() -{ - if (matrixLevel > 0) - { - currentMatrix--; - matrixLevel--; - MATRIX* m = &stack[matrixLevel];//$t7 - - gte_SetRotMatrix(m); - gte_SetTransMatrix(m); - } - else - { - printf("Error: Can't pop matrix,stack is empty!\n"); - } -} - -void RotTrans(SVECTOR* v0, VECTOR* v1, long* flag) -{ - gte_RotTrans(v0, v1, flag); -} - -void RotTransSV(SVECTOR* v0, SVECTOR* v1, long* flag) -{ - gte_ldv0(v0); - gte_rt(); - gte_stsv(v1); - gte_stflg(flag); -} - -long RotTransPers(SVECTOR* v0, long* sxy, long* p, long* flag) -{ - int sz; - gte_RotTransPers(v0, sxy, p, flag, &sz); - - return sz; -} - -long RotTransPers3(SVECTOR* v0, SVECTOR* v1, SVECTOR* v2, long* sxy0, long* sxy1, long* sxy2, long* p, long* flag) -{ - int sz; - gte_RotTransPers3(v0, v1, v2, sxy0, sxy1, sxy2, p, flag, &sz); - - return sz; -} - -long RotTransPers4(SVECTOR* v0, SVECTOR* v1, SVECTOR* v2, SVECTOR* v3, long* sxy0, long* sxy1, long* sxy2, long* sxy3, long* p, long* flag) -{ - long _flag; - int sz; - - gte_ldv3(v0, v1, v2); - gte_rtpt(); - - gte_stsxy3(sxy0, sxy1, sxy2); - - gte_stflg(&_flag); - - gte_ldv0(v3); - gte_rtps(); - - gte_stsxy(sxy3); - gte_stflg(flag); - gte_stdp(p); - - *flag |= _flag; - gte_stszotz(&sz); - - return sz; -} - -void NormalColor(SVECTOR* v0, CVECTOR* v1) -{ - gte_NormalColor(v0, v1); -} - -void NormalColor3(SVECTOR* v0, SVECTOR* v1, SVECTOR* v2, CVECTOR* v3, CVECTOR* v4, CVECTOR* v5) -{ - gte_NormalColor3(v0, v1, v2, v3, v4, v5); -} - -void NormalColorDpq(SVECTOR* v0, CVECTOR* v1, long p, CVECTOR* v2) -{ - gte_NormalColorDpq(v0, v1, p, v2); -} - -void NormalColorCol(SVECTOR* v0, CVECTOR* v1, CVECTOR* v2) -{ - gte_NormalColorCol(v0, v1, v2); -} - -void NormalColorCol3(SVECTOR* v0, SVECTOR* v1, SVECTOR* v2, CVECTOR* v3, CVECTOR* v4, CVECTOR* v5, CVECTOR* v6) -{ - gte_NormalColorCol3(v0,v1,v2,v3,v4,v5,v6); -} - -void DpqColor(CVECTOR* v0, long p, CVECTOR* v1) -{ - gte_DpqColor(v0, &p, v1); -} - -void ColorDpq(VECTOR* v0, CVECTOR* v1, long p, CVECTOR* v2) -{ - gte_ColorDpq(v0, v1, p, v2); -} - -void ColorCol(VECTOR* v0, CVECTOR* v1, CVECTOR* v2) -{ - gte_ColorCol(v0, v1, v2); -} - -long NormalClip(long sxy0, long sxy1, long sxy2) -{ - long opz; - - gte_NormalClip(&sxy0, &sxy1, &sxy2, &opz); - - return opz; -} - -void LocalLight(SVECTOR* v0, VECTOR* v1) -{ - gte_LocalLight(v0, v1); -} - -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*/) -{ - gte_ldv3(v0, v1, v2); - gte_rtpt(); - gte_stflg(flag); - - gte_nclip(); - - int opz; - gte_stopz(&opz); - - if (opz > 0) - { - gte_stsxy3(sxy0, sxy1, sxy2); - - gte_ldv0(v3); - - gte_rtps(); - - gte_stsxy(sxy3); - gte_stdp(p); - gte_stflg(flag); - - gte_avsz4(); - - gte_stotz(otz); - } - - return opz; -} - -// TODO: to INLINE_C EMULATOR macros - -MATRIX* MulMatrix0(MATRIX* m0, MATRIX* m1, MATRIX* m2) -{ -#if 1 - /* - // FIXME: might be wrong - SVECTOR t1, t2, t3; - - gte_SetRotMatrix(m0); - - t1.vx = m1->m[0][0]; - t1.vy = m1->m[1][0]; - t1.vz = m1->m[2][0]; - - gte_rtv0(); - gte_stsv(&t1); - - t2.vx = m1->m[0][1]; - t2.vy = m1->m[1][1]; - t2.vz = m1->m[2][1]; - gte_ldv0(&t2); - gte_rtv0(); - gte_stsv(&t2); - - t3.vx = m1->m[0][2]; - t3.vy = m1->m[1][2]; - t3.vz = m1->m[2][2]; - gte_ldv0(&t3); - gte_rtv0(); - gte_stsv(&t3); - - m2->m[0][0] = t1.vx; - m2->m[1][0] = t1.vx; - m2->m[2][0] = t1.vz; - - m2->m[0][1] = t2.vz; - m2->m[1][1] = t2.vx; - m2->m[2][1] = t2.vy; - - m2->m[0][2] = t3.vy; - m2->m[1][2] = t3.vy; - m2->m[2][2] = t3.vz; - - return m1; - */ - - gte_MulMatrix0(m0, m1, m2); - - return m1; -#else - /* ‚±‚ê‚Å‚àm0==m2‚ÌŽžƒ„ƒoƒC */ - int vx, vy, vz; - MATRIX tmp; - /* ‚Ì‚Åm0‚ðtmp‚ɃRƒs[ */ - if (m0 == m2) { - tmp = *m0; m0 = &tmp; - } - - vx = m1->m[0][0]; - vy = m1->m[1][0]; - vz = m1->m[2][0]; - m2->m[0][0] = FIXED(m0->m[0][0] * vx + m0->m[0][1] * vy + m0->m[0][2] * vz); - m2->m[1][0] = FIXED(m0->m[1][0] * vx + m0->m[1][1] * vy + m0->m[1][2] * vz); - m2->m[2][0] = FIXED(m0->m[2][0] * vx + m0->m[2][1] * vy + m0->m[2][2] * vz); - vx = m1->m[0][1]; - vy = m1->m[1][1]; - vz = m1->m[2][1]; - m2->m[0][1] = FIXED(m0->m[0][0] * vx + m0->m[0][1] * vy + m0->m[0][2] * vz); - m2->m[1][1] = FIXED(m0->m[1][0] * vx + m0->m[1][1] * vy + m0->m[1][2] * vz); - m2->m[2][1] = FIXED(m0->m[2][0] * vx + m0->m[2][1] * vy + m0->m[2][2] * vz); - vx = m1->m[0][2]; - vy = m1->m[1][2]; - vz = m1->m[2][2]; - m2->m[0][2] = FIXED(m0->m[0][0] * vx + m0->m[0][1] * vy + m0->m[0][2] * vz); - m2->m[1][2] = FIXED(m0->m[1][0] * vx + m0->m[1][1] * vy + m0->m[1][2] * vz); - m2->m[2][2] = FIXED(m0->m[2][0] * vx + m0->m[2][1] * vy + m0->m[2][2] * vz); -#endif - - return m2; -} - -MATRIX* MulMatrix(MATRIX* m0, MATRIX* m1) -{ - MATRIX tmp; - gte_MulMatrix0(m0, m1, &tmp); - - *m0 = tmp; - - return m0; -} - -MATRIX* MulMatrix2(MATRIX* m0, MATRIX* m1) -{ - // Same as MulMatrix but result goes to m1 - MATRIX tmp; - gte_MulMatrix0(m0, m1, &tmp); - - *m1 = tmp; - - return m1; -} - -MATRIX* MulRotMatrix(MATRIX* m0) -{ - // FIXME: might be wrong - // as RTV0 can be insufficient - gte_ldv0(&m0->m[0]); - gte_rtv0(); - gte_stsv(&m0->m[0]); - - gte_ldv0(&m0->m[1]); - gte_rtv0(); - gte_stsv(&m0->m[1]); - - gte_ldv0(&m0->m[2]); - gte_rtv0(); - gte_stsv(&m0->m[2]); - - return m0; -} - -void SetBackColor(long rbk, long gbk, long bbk) -{ - gte_SetBackColor(rbk,gbk,bbk); -} - -void SetFarColor(long rfc, long gfc, long bfc) -{ - gte_SetFarColor(rfc, gfc, bfc); -} - -#define APPLYMATRIX(m,v0,v1) {\ - int vx = v0->vx;\ - int vy = v0->vy;\ - int vz = v0->vz;\ - v1->vx = FIXED(m->m[0][0]*vx + m->m[0][1]*vy + m->m[0][2]*vz );\ - v1->vy = FIXED(m->m[1][0]*vx + m->m[1][1]*vy + m->m[1][2]*vz );\ - v1->vz = FIXED(m->m[2][0]*vx + m->m[2][1]*vy + m->m[2][2]*vz );\ -} - -VECTOR* ApplyMatrix(MATRIX* m, SVECTOR* v0, VECTOR* v1) -{ -#if 1 - // correct Psy-Q implementation - gte_SetRotMatrix(m); - gte_ldv0(v0); - gte_rtv0(); - gte_stlvnl(v1); -#else - APPLYMATRIX(m, v0, v1); -#endif - return v1; -} - -VECTOR* ApplyRotMatrix(SVECTOR* v0, VECTOR* v1) -{ -#if 1 - // correct Psy-Q implementation - gte_ldv0(v0); - gte_rtv0(); - gte_stlvnl(v1); -#else - MATRIX temp; - gte_ReadRotMatrix(&temp); - - MATRIX* m = &temp; - - APPLYMATRIX(m, v0, v1); -#endif - return v1; -} - -VECTOR* ApplyRotMatrixLV(VECTOR* v0, VECTOR* v1) -{ -#if 1 - // correct Psy-Q implementation - VECTOR tmpHI; - VECTOR tmpLO; - - tmpHI.vx = v0->vx; - tmpHI.vy = v0->vy; - tmpHI.vz = v0->vz; - - if (tmpHI.vx < 0) - { - tmpLO.vx = -(-tmpHI.vx >> 0xf); - tmpHI.vx = -(-tmpHI.vx & 0x7fff); - } - else - { - tmpLO.vx = tmpHI.vx >> 0xf; - tmpHI.vx = tmpHI.vx & 0x7fff; - } - - if (tmpHI.vy < 0) - { - tmpLO.vy = -(-tmpHI.vy >> 0xf); - tmpHI.vy = -(-tmpHI.vy & 0x7fff); - } - else - { - tmpLO.vy = tmpHI.vy >> 0xf; - tmpHI.vy = tmpHI.vy & 0x7fff; - } - - if (tmpHI.vz < 0) - { - tmpLO.vz = -(-tmpHI.vz >> 0xf); - tmpHI.vz = -(-tmpHI.vz & 0x7fff); - } - else - { - tmpLO.vz = tmpHI.vz >> 0xf; - tmpHI.vz = tmpHI.vz & 0x7fff; - } - - gte_ldlvl(&tmpLO); - gte_rtir_sf0(); - gte_stlvnl(&tmpLO); - - gte_ldlvl(&tmpHI); - gte_rtir(); - - if (tmpLO.vx < 0) - tmpLO.vx *= 8; - else - tmpLO.vx <<= 3; - - if (tmpLO.vy < 0) - tmpLO.vy *= 8; - else - tmpLO.vy <<= 3; - - if (tmpLO.vz < 0) - tmpLO.vz *= 8; - else - tmpLO.vz <<= 3; - - gte_stlvnl(&tmpHI); - - v1->vx = tmpHI.vx + tmpLO.vx; - v1->vy = tmpHI.vy + tmpLO.vy; - v1->vz = tmpHI.vz + tmpLO.vz; -#else - MATRIX temp; - gte_ReadRotMatrix(&temp); - - MATRIX* m = &temp; - - APPLYMATRIX(m, v0, v1); -#endif - return v1; -} - -SVECTOR* ApplyMatrixSV(MATRIX* m, SVECTOR* v0, SVECTOR* v1) -{ -#if 1 - // correct Psy-Q implementation - gte_SetRotMatrix(m); - gte_ldv0(v0); - gte_rtv0(); - gte_stsv(v1); -#else - APPLYMATRIX(m, v0, v1); -#endif - return v1; -} - -VECTOR* ApplyMatrixLV(MATRIX* m, VECTOR* v0, VECTOR* v1) -{ -#if 1 - // correct Psy-Q implementation - VECTOR tmpHI; - VECTOR tmpLO; - - gte_SetRotMatrix(m); - - tmpHI.vx = v0->vx; - tmpHI.vy = v0->vy; - tmpHI.vz = v0->vz; - - if (tmpHI.vx < 0) - { - tmpLO.vx = -(-tmpHI.vx >> 0xf); - tmpHI.vx = -(-tmpHI.vx & 0x7fff); - } - else - { - tmpLO.vx = tmpHI.vx >> 0xf; - tmpHI.vx = tmpHI.vx & 0x7fff; - } - - if (tmpHI.vy < 0) - { - tmpLO.vy = -(-tmpHI.vy >> 0xf); - tmpHI.vy = -(-tmpHI.vy & 0x7fff); - } - else - { - tmpLO.vy = tmpHI.vy >> 0xf; - tmpHI.vy = tmpHI.vy & 0x7fff; - } - - if (tmpHI.vz < 0) - { - tmpLO.vz = -(-tmpHI.vz >> 0xf); - tmpHI.vz = -(-tmpHI.vz & 0x7fff); - } - else - { - tmpLO.vz = tmpHI.vz >> 0xf; - tmpHI.vz = tmpHI.vz & 0x7fff; - } - - gte_ldlvl(&tmpLO); - gte_rtir_sf0(); - gte_stlvnl(&tmpLO); - - gte_ldlvl(&tmpHI); - gte_rtir(); - - if (tmpLO.vx < 0) - tmpLO.vx *= 8; - else - tmpLO.vx <<= 3; - - if (tmpLO.vy < 0) - tmpLO.vy *= 8; - else - tmpLO.vy <<= 3; - - if (tmpLO.vz < 0) - tmpLO.vz *= 8; - else - tmpLO.vz <<= 3; - - gte_stlvnl(&tmpHI); - - v1->vx = tmpHI.vx + tmpLO.vx; - v1->vy = tmpHI.vy + tmpLO.vy; - v1->vz = tmpHI.vz + tmpLO.vz; -#else - APPLYMATRIX(m, v0, v1); -#endif - return v1; -} - -MATRIX* RotMatrix(SVECTOR* r, MATRIX* m) -{ - // correct Psy-Q implementation - int c0, c1, c2; - int s0, s1, s2; - int s2p0, s2m0, c2p0, c2m0; - int s2c0, s2s0, c2c0, c2s0; - - c0 = rcos(r->vx); - c1 = rcos(r->vy); - c2 = rcos(r->vz); - s0 = rsin(r->vx); - s1 = rsin(r->vy); - s2 = rsin(r->vz); - s2p0 = rsin(r->vz + r->vx); - s2m0 = rsin(r->vz - r->vx); - c2p0 = rcos(r->vz + r->vx); - c2m0 = rcos(r->vz - r->vx); - s2c0 = (s2p0 + s2m0) / 2; - c2s0 = (s2p0 - s2m0) / 2; - s2s0 = (c2m0 - c2p0) / 2; - c2c0 = (c2m0 + c2p0) / 2; - - m->m[0][0] = FIXED(c2 * c1); - m->m[1][0] = s2c0 + FIXED(c2s0 * s1); - m->m[2][0] = s2s0 - FIXED(c2c0 * s1); - m->m[0][1] = -FIXED(s2 * c1); - m->m[1][1] = c2c0 - FIXED(s2s0 * s1); - m->m[2][1] = c2s0 + FIXED(s2c0 * s1); - m->m[0][2] = s1; - m->m[1][2] = -FIXED(c1 * s0); - m->m[2][2] = FIXED(c1 * c0); - - return m; -} - -MATRIX* RotMatrixYXZ(SVECTOR* r, MATRIX* m) -{ - // correct Psy-Q implementation - int c0, c1, c2; - int s0, s1, s2; - - c0 = rcos(r->vx); - c1 = rcos(r->vy); - c2 = rcos(r->vz); - s0 = rsin(r->vx); - s1 = rsin(r->vy); - s2 = rsin(r->vz); - - // Y-axis - m->m[1][0] = FIXED(s2 * c0); - m->m[1][1] = FIXED(c2 * c0); - m->m[1][2] = -s0; - - // X-axis - int x0 = FIXED(s1 * s0); - m->m[0][0] = FIXED(c1 * c2) + FIXED(x0 * s2); - m->m[0][1] = FIXED(x0 * c2) - FIXED(c1 * s2); - m->m[0][2] = FIXED(s1 * c0); - - // Z-axis - int z0 = FIXED(c1 * s0); - m->m[2][1] = FIXED(s1 * s2) + FIXED(z0 * c2); - m->m[2][0] = FIXED(z0 * s2) - FIXED(s1 * c2); - m->m[2][2] = FIXED(c1 * c0); - - return m; -} - -MATRIX* RotMatrixX(long r, MATRIX* m) -{ - // correct Psy-Q implementation - int s0 = rsin(r); - int c0 = rcos(r); - int t1, t2; - t1 = m->m[1][0]; - t2 = m->m[2][0]; - m->m[1][0] = FIXED(t1 * c0 - t2 * s0); - m->m[2][0] = FIXED(t1 * s0 + t2 * c0); - t1 = m->m[1][1]; - t2 = m->m[2][1]; - m->m[1][1] = FIXED(t1 * c0 - t2 * s0); - m->m[2][1] = FIXED(t1 * s0 + t2 * c0); - t1 = m->m[1][2]; - t2 = m->m[2][2]; - m->m[1][2] = FIXED(t1 * c0 - t2 * s0); - m->m[2][2] = FIXED(t1 * s0 + t2 * c0); - - return m; -} - -MATRIX* RotMatrixY(long r, MATRIX* m) -{ - // correct Psy-Q implementation - int s0 = rsin(r); - int c0 = rcos(r); - int t1, t2; - t1 = m->m[0][0]; - t2 = m->m[2][0]; - m->m[0][0] = FIXED(t1 * c0 + t2 * s0); - m->m[2][0] = FIXED(-t1 * s0 + t2 * c0); - t1 = m->m[0][1]; - t2 = m->m[2][1]; - m->m[0][1] = FIXED(t1 * c0 + t2 * s0); - m->m[2][1] = FIXED(-t1 * s0 + t2 * c0); - t1 = m->m[0][2]; - t2 = m->m[2][2]; - m->m[0][2] = FIXED(t1 * c0 + t2 * s0); - m->m[2][2] = FIXED(-t1 * s0 + t2 * c0); - - return m; -} - -MATRIX* RotMatrixZ(long r, MATRIX* m) -{ - // correct Psy-Q implementation - int s0 = rsin(r); - int c0 = rcos(r); - int t1, t2; - t1 = m->m[0][0]; - t2 = m->m[1][0]; - m->m[0][0] = FIXED(t1 * c0 - t2 * s0); - m->m[1][0] = FIXED(t1 * s0 + t2 * c0); - t1 = m->m[0][1]; - t2 = m->m[1][1]; - m->m[0][1] = FIXED(t1 * c0 - t2 * s0); - m->m[1][1] = FIXED(t1 * s0 + t2 * c0); - t1 = m->m[0][2]; - t2 = m->m[1][2]; - m->m[0][2] = FIXED(t1 * c0 - t2 * s0); - m->m[1][2] = FIXED(t1 * s0 + t2 * c0); - - return m; -} - -MATRIX* RotMatrixZYX_gte(SVECTOR* r, MATRIX* m) -{ -#if 0 - // TODO: correct Psy-Q implementation -#else - m->m[0][0] = 0x1000; - m->m[0][1] = 0; - m->m[0][2] = 0; - - m->m[1][0] = 0; - m->m[1][1] = 0x1000; - m->m[1][2] = 0; - - m->m[2][0] = 0; - m->m[2][1] = 0; - m->m[2][2] = 0x1000; - - RotMatrixX(r->vx, m); - RotMatrixY(r->vy, m); - RotMatrixZ(r->vz, m); -#endif - return m; -} - -MATRIX* CompMatrix(MATRIX* m0, MATRIX* m1, MATRIX* m2) -{ - // UNTESTED - SVECTOR tmp; - gte_MulMatrix0(m0, m1, m2); - - tmp.vx = m1->t[0]; - tmp.vy = m1->t[1]; - tmp.vz = m1->t[2]; - - gte_ldv0(&tmp); - gte_rtv0(); - gte_stlvnl(m2->t); - - m2->t[0] += m0->t[0]; - m2->t[1] += m0->t[1]; - m2->t[2] += m0->t[2]; - - return m2; -} - -MATRIX* CompMatrixLV(MATRIX* m0, MATRIX* m1, MATRIX* m2) -{ - // UNTESTED - // correct Psy-Q implementation - VECTOR tmpHI; - VECTOR tmpLO; - - gte_MulMatrix0(m0, m1, m2); - - // next... same as ApplyMatrixLV - tmpHI.vx = m1->t[0]; - tmpHI.vy = m1->t[1]; - tmpHI.vz = m1->t[2]; - - if (tmpHI.vx < 0) - { - tmpLO.vx = -(-tmpHI.vx >> 0xf); - tmpHI.vx = -(-tmpHI.vx & 0x7fff); - } - else - { - tmpLO.vx = tmpHI.vx >> 0xf; - tmpHI.vx = tmpHI.vx & 0x7fff; - } - - if (tmpHI.vy < 0) - { - tmpLO.vy = -(-tmpHI.vy >> 0xf); - tmpHI.vy = -(-tmpHI.vy & 0x7fff); - } - else - { - tmpLO.vy = tmpHI.vy >> 0xf; - tmpHI.vy = tmpHI.vy & 0x7fff; - } - - if (tmpHI.vz < 0) - { - tmpLO.vz = -(-tmpHI.vz >> 0xf); - tmpHI.vz = -(-tmpHI.vz & 0x7fff); - } - else - { - tmpLO.vz = tmpHI.vz >> 0xf; - tmpHI.vz = tmpHI.vz & 0x7fff; - } - - gte_ldlvl(&tmpLO); - gte_rtir_sf0(); - gte_stlvnl(&tmpLO); - - gte_ldlvl(&tmpHI); - gte_rtir(); - - if (tmpLO.vx < 0) - tmpLO.vx = tmpLO.vx * 8; - else - tmpLO.vx = tmpLO.vx << 3; - - if (tmpLO.vy < 0) - tmpLO.vy = tmpLO.vy * 8; - else - tmpLO.vy = tmpLO.vy << 3; - - if (tmpLO.vz < 0) - tmpLO.vz = tmpLO.vz * 8; - else - tmpLO.vz = tmpLO.vz << 3; - - gte_stlvnl(&tmpHI); - - m2->t[0] = tmpHI.vx + tmpLO.vx + m0->t[0]; - m2->t[1] = tmpHI.vy + tmpLO.vy + m0->t[1]; - m2->t[2] = tmpHI.vz + tmpLO.vz + m0->t[2]; - - return m2; -} - -MATRIX* TransMatrix(MATRIX* m, VECTOR* v) -{ - m->t[0] = v->vx; - m->t[1] = v->vy; - m->t[2] = v->vz; - return m; -} - -MATRIX* ScaleMatrix(MATRIX* m, VECTOR* v) -{ - m->m[0][0] = FIXED(m->m[0][0] * v->vx); - m->m[0][1] = FIXED(m->m[0][1] * v->vx); - m->m[0][2] = FIXED(m->m[0][2] * v->vx); - m->m[1][0] = FIXED(m->m[1][0] * v->vy); - m->m[1][1] = FIXED(m->m[1][1] * v->vy); - m->m[1][2] = FIXED(m->m[1][2] * v->vy); - m->m[2][0] = FIXED(m->m[2][0] * v->vz); - m->m[2][1] = FIXED(m->m[2][1] * v->vz); - m->m[2][2] = FIXED(m->m[2][2] * v->vz); - return m; -} - -void SetDQA(int iDQA) -{ - CTC2(*(uint*)&iDQA, 27); -} - -void SetDQB(int iDQB) -{ - CTC2(*(uint*)&iDQB, 28); -} - -void SetFogNear(long a, long h) -{ - //Error division by 0 - assert(h != 0); - int depthQ = -(((a << 2) + a) << 6); - assert(h != -1 && depthQ != 0x8000); - SetDQA(depthQ / h); - SetDQB(20971520); -} - -void SetFogNearFar(long a, long b, long h) -{ - if (b - a < 100) - return; - - assert((b - a)); - assert((b - a) != -1 && (-a * b) != 32768); - assert((b - a)); - assert((b - a) != -1 && (b << 12) != 32768); - assert(h != 0); - assert(h != -1 && (((-a * b) / (b - a)) << 8) != 32768); - - int dqa = (-a * b / (b - a) << 8) / h; - - SetDQA(MAX(MIN(dqa, 32767), -32767)); - SetDQB((b << 12) / (b - a) << 12); -} - -int rsin(int a) -{ - //if (a < 0) // really not needed; bit mask does it all - // return -rcossin_tbl[(-a & 0xfffU) * 2]; - - return rcossin_tbl[(a & 0xfffU) * 2]; -} - -int rcos(int a) -{ - //if (a < 0) // really not needed; bit mask does it all - // return rcossin_tbl[(-a & 0xfffU) * 2 + 1]; - - return rcossin_tbl[(a & 0xfffU) * 2 + 1]; -} - -long ratan2(long y, long x) -{ - // correct Psy-Q implementation - long v; - ulong ang; - int xlt0, ylt0; - - xlt0 = x < 0; - ylt0 = y < 0; - - if (x == 0 && y == 0) - return 0; - - if (x < 0) - x = -x; - - if (y < 0) - y = -y; - - if (y < x) - { - if (((ulong)y & 0x7fe00000U) == 0) - ang = (y << 10) / x; - else - ang = y / (x >> 10); - - v = ratan_tbl[ang]; - } - else - { - if (((ulong)x & 0x7fe00000U) == 0) - ang = (x << 10) / y; - else - ang = x / (y >> 10); - - v = 1024 - ratan_tbl[ang]; - } - - if (xlt0) - v = 2048 - v; - - if (ylt0) - v = -v; - - return v; -} - -long SquareRoot0(long a) -{ - // correct Psy-Q implementation - int idx; - int lzcs; - lzcs = gte_leadingzerocount(a); - - if (lzcs == 32) - return 0; - - lzcs &= 0xfffffffe; - - if ((lzcs - 24) < 0) - idx = a >> (24 - lzcs); - else - idx = a << (lzcs - 24); - - return SQRT[idx - 64] << (31 - lzcs >> 1) >> 12; -} diff --git a/src_rebuild/PsyCross/src/psx/LIBMCRD.C b/src_rebuild/PsyCross/src/psx/LIBMCRD.C deleted file mode 100644 index 8d5125b8..00000000 --- a/src_rebuild/PsyCross/src/psx/LIBMCRD.C +++ /dev/null @@ -1,309 +0,0 @@ -#include "../PsyX_main.h" -#include "psx/libmcrd.h" -#include -#include - -#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; -} diff --git a/src_rebuild/PsyCross/src/psx/LIBPAD.C b/src_rebuild/PsyCross/src/psx/LIBPAD.C deleted file mode 100644 index 83a42391..00000000 --- a/src_rebuild/PsyCross/src/psx/LIBPAD.C +++ /dev/null @@ -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 - -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); -} \ No newline at end of file diff --git a/src_rebuild/PsyCross/src/psx/LIBSN.C b/src_rebuild/PsyCross/src/psx/LIBSN.C deleted file mode 100644 index 1f02448c..00000000 --- a/src_rebuild/PsyCross/src/psx/LIBSN.C +++ /dev/null @@ -1,70 +0,0 @@ - -#include "psx/libsn.h" -#include - -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); -} \ No newline at end of file diff --git a/src_rebuild/PsyCross/src/psx/LIBSPU.C b/src_rebuild/PsyCross/src/psx/LIBSPU.C deleted file mode 100644 index 8eda5fba..00000000 --- a/src_rebuild/PsyCross/src/psx/LIBSPU.C +++ /dev/null @@ -1,1049 +0,0 @@ -#define HAVE_M_PI - -#include "psx/libspu.h" -#include "psx/libetc.h" -#include "psx/libmath.h" - -#include - -#include "../PsyX_main.h" - -#include - -#include -#include -#include -#include - - -// TODO: implement XA, implement ADSR - -#define SPU_CENTERNOTE (-32768 / 2) - -short _spu_voice_centerNote[24] ={ SPU_CENTERNOTE }; - -const char* getALCErrorString(int err) -{ - switch (err) - { - case ALC_NO_ERROR: - return "AL_NO_ERROR"; - case ALC_INVALID_DEVICE: - return "ALC_INVALID_DEVICE"; - case ALC_INVALID_CONTEXT: - return "ALC_INVALID_CONTEXT"; - case ALC_INVALID_ENUM: - return "ALC_INVALID_ENUM"; - case ALC_INVALID_VALUE: - return "ALC_INVALID_VALUE"; - case ALC_OUT_OF_MEMORY: - return "ALC_OUT_OF_MEMORY"; - default: - return "AL_UNKNOWN"; - } -} - -const char* getALErrorString(int err) -{ - switch (err) - { - case AL_NO_ERROR: - return "AL_NO_ERROR"; - case AL_INVALID_NAME: - return "AL_INVALID_NAME"; - case AL_INVALID_ENUM: - return "AL_INVALID_ENUM"; - case AL_INVALID_VALUE: - return "AL_INVALID_VALUE"; - case AL_INVALID_OPERATION: - return "AL_INVALID_OPERATION"; - case AL_OUT_OF_MEMORY: - return "AL_OUT_OF_MEMORY"; - default: - return "AL_UNKNOWN"; - } -} - -#define SPU_REALMEMSIZE (512 * 1024) -#define SPU_MEMSIZE (2048*1024) // SPU_REALMEMSIZE -#define SPU_VOICES 24 - -typedef struct -{ - unsigned char samplemem[SPU_MEMSIZE]; - unsigned char* writeptr; -} SPUMemory; - -static SPUMemory s_SpuMemory; -SDL_mutex* g_SpuMutex = NULL; -int g_spuInit = 0; - -typedef struct -{ - SpuVoiceAttr attr; // .voice is Id of this channel - - ALuint alBuffer; - ALuint alSource; - ushort sampledirty; - ushort reverb; -} SPUVoice; - -SPUVoice g_SpuVoices[SPU_VOICES]; -ALCdevice* g_ALCdevice = NULL; -ALCcontext* g_ALCcontext = NULL; -int g_SPUMuted = 0; -ALuint g_ALEffectSlots[2]; -int g_currEffectSlotIdx = 0; -ALuint g_nAlReverbEffect = 0; -int g_enableSPUReverb = 0; -int g_ALEffectsSupported = 0; - -LPALGENEFFECTS alGenEffects = NULL; -LPALDELETEEFFECTS alDeleteEffects = NULL; -LPALEFFECTI alEffecti = NULL; -LPALEFFECTF alEffectf = NULL; -LPALGENAUXILIARYEFFECTSLOTS alGenAuxiliaryEffectSlots = NULL; -LPALDELETEAUXILIARYEFFECTSLOTS alDeleteAuxiliaryEffectSlots = NULL; -LPALAUXILIARYEFFECTSLOTI alAuxiliaryEffectSloti = NULL; - -void PsyX_SPU_InitOpenAlEffects() -{ - g_ALEffectsSupported = 0; - - if (!alcIsExtensionPresent(g_ALCdevice, ALC_EXT_EFX_NAME)) - { - eprintf("PSX SPU effects are NOT supported!\n"); - return; - } - - alGenEffects = (LPALGENEFFECTS)alGetProcAddress("alGenEffects"); - alDeleteEffects = (LPALDELETEEFFECTS)alGetProcAddress("alDeleteEffects"); - alEffecti = (LPALEFFECTI)alGetProcAddress("alEffecti"); - alEffectf = (LPALEFFECTF)alGetProcAddress("alEffectf"); - alGenAuxiliaryEffectSlots = (LPALGENAUXILIARYEFFECTSLOTS)alGetProcAddress("alGenAuxiliaryEffectSlots"); - alDeleteAuxiliaryEffectSlots = (LPALDELETEAUXILIARYEFFECTSLOTS)alGetProcAddress("alDeleteAuxiliaryEffectSlots"); - alAuxiliaryEffectSloti = (LPALAUXILIARYEFFECTSLOTI)alGetProcAddress("alAuxiliaryEffectSloti"); - - int max_sends = 0; - alcGetIntegerv(g_ALCdevice, ALC_MAX_AUXILIARY_SENDS, 1, &max_sends); - - // make reverb effect slot - g_currEffectSlotIdx = 0; - alGenAuxiliaryEffectSlots(1, g_ALEffectSlots); - - // make reverb effect - alGenEffects(1, &g_nAlReverbEffect); - alEffecti(g_nAlReverbEffect, AL_EFFECT_TYPE, AL_EFFECT_REVERB); - - // setup defaults of effect - alEffectf(g_nAlReverbEffect, AL_REVERB_GAIN, 0.45f); - alEffectf(g_nAlReverbEffect, AL_REVERB_GAINHF, 0.25f); - alEffectf(g_nAlReverbEffect, AL_REVERB_DECAY_TIME, 2.0f); - alEffectf(g_nAlReverbEffect, AL_REVERB_DECAY_HFRATIO, 0.9f); - alEffectf(g_nAlReverbEffect, AL_REVERB_REFLECTIONS_DELAY, 0.08f); - alEffectf(g_nAlReverbEffect, AL_REVERB_REFLECTIONS_GAIN, 0.2f); - alEffectf(g_nAlReverbEffect, AL_REVERB_DIFFUSION, 0.9f); - alEffectf(g_nAlReverbEffect, AL_REVERB_DENSITY, 0.1f); - alEffectf(g_nAlReverbEffect, AL_REVERB_AIR_ABSORPTION_GAINHF, 0.1f); - - g_ALEffectsSupported = 1; - - eprintf("PSX SPU effects are supported and initialized\n"); - - alAuxiliaryEffectSloti(g_ALEffectSlots[g_currEffectSlotIdx], AL_EFFECTSLOT_EFFECT, g_nAlReverbEffect); -} - -int PsyX_SPU_InitSound() -{ - int numDevices, alErr, i; - const char* devices; - const char* devStrptr; - - // out_channel_formats snd_outputchannels - static int al_context_params[] = - { - ALC_FREQUENCY, 44100, - ALC_MAX_AUXILIARY_SENDS, 2, - 0 - }; - - if (g_ALCdevice) - return 1; - - numDevices = 0; - - // Init openAL - // check devices list - - devStrptr = alcGetString(NULL, ALC_DEVICE_SPECIFIER); - devices = devStrptr; - - // go through device list (each device terminated with a single NULL, list terminated with double NULL) - while ((*devStrptr) != '\0') - { - eprintinfo("found sound device: %s\n", devStrptr); - devStrptr += strlen(devStrptr) + 1; - numDevices++; - } - - if(numDevices == 0) - return 0; - - g_ALCdevice = alcOpenDevice(NULL); - - alErr = AL_NO_ERROR; - - if (!g_ALCdevice) - { - alErr = alcGetError(NULL); - eprinterr("alcOpenDevice: NULL DEVICE error: %s\n", getALCErrorString(alErr)); - return 0; - } - -#ifndef __EMSCRIPTEN__ - g_ALCcontext = alcCreateContext(g_ALCdevice, al_context_params); -#else - g_ALCcontext = alcCreateContext(g_ALCdevice, NULL); -#endif - - alErr = alcGetError(g_ALCdevice); - if (alErr != AL_NO_ERROR) - { - eprinterr("alcCreateContext error: %s\n", getALCErrorString(alErr)); - return 0; - } - - alcMakeContextCurrent(g_ALCcontext); - - alErr = alcGetError(g_ALCdevice); - if (alErr != AL_NO_ERROR) - { - eprinterr("alcMakeContextCurrent error: %s\n", getALCErrorString(alErr)); - return 0; - } - - // Setup defaults - alListenerf(AL_GAIN, 1.0f); - alDistanceModel(AL_NONE); - - // create channels - for (i = 0; i < SPU_VOICES; i++) - { - SPUVoice* voice = &g_SpuVoices[i]; - memset(voice, 0, sizeof(SPUVoice)); - - alGenSources(1, &voice->alSource); - alGenBuffers(1, &voice->alBuffer); - - alSourcei(voice->alSource, AL_SOURCE_RESAMPLER_SOFT, 2); // Use cubic resampler - alSourcei(voice->alSource, AL_SOURCE_RELATIVE, AL_TRUE); - } - - memset(&s_SpuMemory, 0, sizeof(s_SpuMemory)); - - PsyX_SPU_InitOpenAlEffects(); - - g_SpuMutex = SDL_CreateMutex(); - - return 1; -} - -void PsyX_SPU_ShutdownSound() -{ - if (!g_ALCcontext) - return; - - for (int i = 0; i < SPU_VOICES; i++) - { - SPUVoice* voice = &g_SpuVoices[i]; - alDeleteSources(1, &voice->alSource); - alDeleteBuffers(1, &voice->alBuffer); - } - - if (g_ALEffectsSupported) - { - alDeleteEffects(1, &g_nAlReverbEffect); - g_ALEffectsSupported = AL_NONE; - alDeleteAuxiliaryEffectSlots(1, g_ALEffectSlots); - } - - alcDestroyContext(g_ALCcontext); - alcCloseDevice(g_ALCdevice); - - g_ALCcontext = NULL; - g_ALCdevice = NULL; -} - -//-------------------------------------------------------------------------------- - -// PSX ADPCM coefficients -const float K0[5] = { 0, 0.9375, 1.796875, 1.53125, 1.90625 }; -const float K1[5] = { 0, 0, -0.8125, -0.859375, -0.9375 }; - -// PSX ADPCM decoding routine - decodes a single sample -short vagToPcm(unsigned char soundParameter, int soundData, float* vagPrev1, float* vagPrev2) -{ - int resultInt = 0; - - float dTmp1 = 0.0; - float dTmp2 = 0.0; - float dTmp3 = 0.0; - - if (soundData > 7) - soundData -= 16; - - dTmp1 = (float)soundData * pow(2, (float)(12 - (soundParameter & 0x0F))); - - dTmp2 = (*vagPrev1) * K0[(soundParameter >> 4) & 0x0F]; - dTmp3 = (*vagPrev2) * K1[(soundParameter >> 4) & 0x0F]; - - (*vagPrev2) = (*vagPrev1); - (*vagPrev1) = dTmp1 + dTmp2 + dTmp3; - - resultInt = (int)round((*vagPrev1)); - - if (resultInt > 32767) - resultInt = 32767; - - if (resultInt < -32768) - resultInt = -32768; - - return (short)resultInt; -} - -typedef enum -{ - LoopEnd = 1 << 0, // Jump to repeat address after this block - // 1 - Copy repeatAddress to currentAddress AFTER this block - // set ENDX (TODO: Immediately or after this block?) - // 0 - Nothing - - Repeat = 1 << 1, // Takes an effect only with LoopEnd bit set. - // 1 - Loop normally - // 0 - Loop and force Release - - LoopStart = 1 << 2, // Mark current address as the beginning of repeat - // 1 - Load currentAddress to repeatAddress - // 0 - Nothing -} ADPCM_FLAGS; - - -// Main decoding routine - Takes PSX ADPCM formatted audio data and converts it to PCM. It also extracts the looping information if used. -int decodeSound(unsigned char* iData, int soundSize, short* oData, int* loopStart, int* loopLength, int breakOnEnd /*= 0*/) -{ - unsigned char sp; - unsigned char flag; - int sd = 0; - float vagPrev1 = 0.0; - float vagPrev2 = 0.0; - int k = 0; - - int loopStrt = 0, loopEnd = 0; - int breakOn = -1; - - for (int i = 0; i < soundSize; i++) - { - if (i % 16 == 0) - { - sp = iData[i]; - flag = iData[i+1]; - i += 2; - } - - sd = (int)iData[i] & 0xF; - oData[k++] = vagToPcm(sp, sd, &vagPrev1, &vagPrev2); - - sd = ((int)iData[i] >> 4) & 0xF; - oData[k++] = vagToPcm(sp, sd, &vagPrev1, &vagPrev2); - - if (breakOnEnd && k == breakOn) - return k; - - if (breakOn == -1) - { - // flags parsed - if (flag & LoopStart) - { - loopStrt = k + 26; // FIXME: is that correct? - } - - if (flag & LoopEnd) - { - loopEnd = k + 26; - - if (flag & Repeat) - { - *loopStart = loopStrt; - *loopLength = loopEnd - loopStrt; - } - - if (breakOnEnd) - breakOn = k + 26; - } - } - } - - return soundSize; -} - -#include - -unsigned long SpuWrite(unsigned char* addr, unsigned long size) -{ - //if (0x7EFF0 < size) - // size = 0x7EFF0; - - int wptr_ofs = s_SpuMemory.writeptr - s_SpuMemory.samplemem; - - if (wptr_ofs+size > SPU_REALMEMSIZE) - { - eprintf("SPU WARNING: SpuWrite exceeded SPU_REALMEMSIZE (%d > 512k)!\n", wptr_ofs+size); - } - assert(size > 0 && wptr_ofs+size < SPU_MEMSIZE); - - // simply copy to the writeptr - memcpy(s_SpuMemory.writeptr, addr, size); - -#if 0 // BANK TEST - { - static short waveBuffer[SPU_MEMSIZE]; - - ALuint alSource; - ALuint alBuffer; - - alGenSources(1, &alSource); - alGenBuffers(1, &alBuffer); - - int loopStart = 0, loopLen = 0; - int count = decodeSound(addr, size, waveBuffer, &loopStart, &loopLen); - - // update AL buffer - alBufferData(alBuffer, AL_FORMAT_MONO16, waveBuffer, count * sizeof(short), 11000); - - // set the buffer - alSourcei(alSource, AL_BUFFER, alBuffer); - alSourcef(alSource, AL_GAIN, 1.0f);// TODO: panning - alSourcef(alSource, AL_PITCH, 1); - - alSourcePlay(alSource); - int status; - do - { - alGetSourcei(alSource, AL_SOURCE_STATE, &status); - } while (status == AL_PLAYING); - - alSourceStop(alSource); - - alDeleteSources(1, &alSource); - alDeleteBuffers(1, &alBuffer); - } -#endif - - return size; -} - -long SpuSetTransferMode(long mode) -{ - // TODO: handle different transfer modes? - - long mode_fix = mode == 0 ? 0 : 1; - - //trans_mode = mode; - //transMode = mode_fix; - - return mode_fix; -} - -unsigned long SpuSetTransferStartAddr(unsigned long addr) -{ - s_SpuMemory.writeptr = s_SpuMemory.samplemem + addr; - - if(addr > SPU_MEMSIZE) - return 0; - - if (addr < 0x1010) - return 0; - - return 1; -} - -long SpuIsTransferCompleted(long flag) -{ - return 1; -} - -void SpuStart() -{ - PsyX_SPU_InitSound(); -} - -void _SpuInit(int a0) -{ - ResetCallback(); - - if (a0 == 0) - { - for (int i = 0; i < sizeof(_spu_voice_centerNote) / sizeof(short); i++) - _spu_voice_centerNote[i] = SPU_CENTERNOTE; - } - - SpuStart(); - g_spuInit = 1; -} - -void SpuInit(void) -{ - _SpuInit(0); -} - -void SpuQuit(void) -{ - g_spuInit = 0; -#ifndef __EMSCRIPTEN__ - PsyX_SPU_ShutdownSound(); -#endif // SpuQuit -} - -void UpdateVoiceSample(SPUVoice* voice) -{ - static short waveBuffer[SPU_REALMEMSIZE]; - int loopStart, loopLen, count; - ALuint alSource, alBuffer; - - //if (!voice->sampledirty) - // return; - - voice->sampledirty = 0; - - alSource = voice->alSource; - alBuffer = voice->alBuffer; - - if (alSource == AL_NONE) - return; - - loopStart = 0; - loopLen = 0; - - count = decodeSound(s_SpuMemory.samplemem + voice->attr.addr, SPU_REALMEMSIZE - voice->attr.addr, waveBuffer, &loopStart, &loopLen, 1); - - if (count == 0) - return; - -#if 0 // sample test - { - ALuint aalSource; - ALuint aalBuffer; - - alGenSources(1, &aalSource); - alGenBuffers(1, &aalBuffer); - - // update AL buffer - alBufferData(aalBuffer, AL_FORMAT_MONO16, waveBuffer, count * sizeof(short), 11000); - - // set the buffer - alSourcei(aalSource, AL_BUFFER, aalBuffer); - alSourcef(aalSource, AL_GAIN, 1.0f);// TODO: panning - alSourcef(aalSource, AL_PITCH, 1); - - alSourcePlay(aalSource); - int status; - do - { - alGetSourcei(aalSource, AL_SOURCE_STATE, &status); - } while (status == AL_PLAYING); - - alSourceStop(aalSource); - - alDeleteSources(1, &aalSource); - alDeleteBuffers(1, &aalBuffer); - } -#endif - - alSourcei(alSource, AL_BUFFER, 0); - alBufferData(alBuffer, AL_FORMAT_MONO16, waveBuffer, count * sizeof(short), 44100); - - if (loopLen > 0) - { - loopStart += voice->attr.loop_addr - voice->attr.addr; - - if (loopStart-54 > 0 && loopStart + loopLen <= count) - { - int sampleOffs[] = { loopStart, loopStart + loopLen }; - alBufferiv(alBuffer, AL_LOOP_POINTS_SOFT, sampleOffs); - } - - alSourcei(alSource, AL_LOOPING, AL_TRUE); - } - else - { - //int sampleOffs[] = { 0, 0 }; - //alBufferiv(alBuffer, AL_LOOP_POINTS_SOFT, sampleOffs); - alSourcei(alSource, AL_LOOPING, AL_FALSE); - } - - // set the buffer - alSourcei(alSource, AL_BUFFER, alBuffer); -} - -void SpuSetVoiceAttr(SpuVoiceAttr *arg) -{ - const float STEREO_FACTOR = 3.0f; - SPUVoice* voice; - ALuint alSource; - float pitch, left_gain, right_gain, pan; - - if (!g_spuInit) - { - return; - } - - SDL_LockMutex(g_SpuMutex); - - for (int i = 0; i < SPU_VOICES; i++) - { - if (!(arg->voice & SPU_VOICECH(i))) - continue; - - voice = &g_SpuVoices[i]; - - ALuint alSource = voice->alSource; - - if (alSource == AL_NONE) - continue; - - // update sample - if ((arg->mask & SPU_VOICE_WDSA) || (arg->mask & SPU_VOICE_LSAX)) - { - //ALuint tmp = voice->alSource[1]; - //voice->alSource[1] = voice->alSource[0]; - //voice->alSource[1] = tmp; - //alSource = voice->alSource[0]; - - if (arg->mask & SPU_VOICE_WDSA) - { - if (voice->attr.addr != arg->addr) - voice->sampledirty++; - - voice->attr.addr = arg->addr; - } - - if (arg->mask & SPU_VOICE_LSAX) - { - if(voice->attr.loop_addr != arg->loop_addr) - voice->sampledirty++; - - voice->attr.loop_addr = arg->loop_addr; - } - } - - // update volume - if ((arg->mask & SPU_VOICE_VOLL) || (arg->mask & SPU_VOICE_VOLR)) - { - if (arg->mask & SPU_VOICE_VOLL) - voice->attr.volume.left = arg->volume.left; - - if (arg->mask & SPU_VOICE_VOLR) - voice->attr.volume.right = arg->volume.right; - - left_gain = (float)(voice->attr.volume.left) / (float)(16384); - right_gain = (float)(voice->attr.volume.right) / (float)(16384); - - if(left_gain > 1.0f) - left_gain = 1.0f; - - if(right_gain > 1.0f) - right_gain = 1.0f; - - pan = (acosf(left_gain) + asinf(right_gain)) / ((float)(M_PI)); // average angle in [0,1] - pan = 2.0f * pan - 1.0f; // convert to [-1, 1] - pan = pan * 0.5f; // 0.5 = sin(30') for a +/- 30 degree arc - alSource3f(alSource, AL_POSITION, pan * STEREO_FACTOR, 0, -sqrtf(1.0f - pan * pan)); - - alSourcef(alSource, AL_GAIN, (left_gain+right_gain)*0.5f); - } - - // update pitch - if (arg->mask & SPU_VOICE_PITCH) - { - ALint state; - alGetSourcei(alSource, AL_SOURCE_STATE, &state); - - if (arg->pitch == 0 && state == AL_PLAYING) - alSourcePause(alSource); - else if (voice->attr.pitch == 0 && state == AL_PAUSED) - alSourcePlay(alSource); - - voice->attr.pitch = arg->pitch; - - pitch = (float)(voice->attr.pitch) / 4096.0f; - - alSourcef(alSource, AL_PITCH, pitch); - } - - // TODO: ADSR and other stuff - } - SDL_UnlockMutex(g_SpuMutex); -} - -void SpuSetKey(long on_off, unsigned long voice_bit) -{ - SPUVoice* voice; - ALuint alSource; - - if (!g_spuInit) - { - return; - } - - SDL_LockMutex(g_SpuMutex); - for (int i = 0; i < SPU_VOICES; i++) - { - if (voice_bit & SPU_VOICECH(i)) - { - voice = &g_SpuVoices[i]; - - alSource = voice->alSource; - - if (alSource == AL_NONE) - continue; - - if (on_off && !g_SPUMuted) - { - alSourceStop(alSource); - UpdateVoiceSample(voice); - - alSourcePlay(alSource); - } - else - { - alSourceStop(alSource); - } - } - } - SDL_UnlockMutex(g_SpuMutex); -} - -long SpuGetKeyStatus(unsigned long voice_bit) -{ - SPUVoice* voice; - ALuint alSource; - int state = AL_STOPPED; - - SDL_LockMutex(g_SpuMutex); - - for (int i = 0; i < SPU_VOICES; i++) - { - if (voice_bit != SPU_VOICECH(i)) - continue; - - voice = &g_SpuVoices[i]; - - alSource = voice->alSource; - - if (alSource == AL_NONE) - break; // SpuOff? - - alGetSourcei(alSource, AL_SOURCE_STATE, &state); - break; - } - - SDL_UnlockMutex(g_SpuMutex); - - return (state == AL_PLAYING); // simple as this? -} - -void SpuGetAllKeysStatus(char* status) -{ - SPUVoice* voice; - ALuint alSource; - - SDL_LockMutex(g_SpuMutex); - - for (int i = 0; i < SPU_VOICES; i++) - { - voice = &g_SpuVoices[i]; - - alSource = voice->alSource; - - if (alSource == AL_NONE) - { - status[i] = 0; // SpuOff? - continue; - } - - int state; - alGetSourcei(alSource, AL_SOURCE_STATE, &state); - - status[i] = (state == AL_PLAYING); - } - SDL_UnlockMutex(g_SpuMutex); -} - -void SpuSetKeyOnWithAttr(SpuVoiceAttr* attr) -{ - SpuSetVoiceAttr(attr); - SpuSetKey(1, attr->voice); -} - -long SpuSetMute(long on_off) -{ - long old_state = g_SPUMuted; - g_SPUMuted = on_off; - return old_state; -} - -long SpuSetReverb(long on_off) -{ - long old_state = g_enableSPUReverb; - g_enableSPUReverb = on_off; - - if (!g_spuInit) - { - return old_state; - } - - // switch if needed - if (g_ALEffectsSupported && old_state != g_enableSPUReverb) - { - if (g_enableSPUReverb) - { - alAuxiliaryEffectSloti(g_ALEffectSlots[g_currEffectSlotIdx], AL_EFFECTSLOT_EFFECT, g_nAlReverbEffect); - } - else - { - g_currEffectSlotIdx = 0; - alAuxiliaryEffectSloti(g_ALEffectSlots[0], AL_EFFECTSLOT_EFFECT, AL_EFFECT_NULL); - alAuxiliaryEffectSloti(g_ALEffectSlots[1], AL_EFFECTSLOT_EFFECT, AL_EFFECT_NULL); - } - } - - return old_state; -} - -long SpuGetReverb(void) -{ - return g_enableSPUReverb; -} - -long SpuSetReverbModeParam(SpuReverbAttr* attr) -{ - // TODO: setup next params - /* - alEffectf(g_nAlReverbEffect, AL_REVERB_GAIN, 0.45f); - alEffectf(g_nAlReverbEffect, AL_REVERB_GAINHF, 0.25f); - alEffectf(g_nAlReverbEffect, AL_REVERB_DECAY_TIME, 2.0f); - alEffectf(g_nAlReverbEffect, AL_REVERB_DECAY_HFRATIO, 0.9f); - alEffectf(g_nAlReverbEffect, AL_REVERB_REFLECTIONS_DELAY, 0.08f); - alEffectf(g_nAlReverbEffect, AL_REVERB_REFLECTIONS_GAIN, 0.2f); - alEffectf(g_nAlReverbEffect, AL_REVERB_DIFFUSION, 0.9f); - alEffectf(g_nAlReverbEffect, AL_REVERB_DENSITY, 0.1f); - alEffectf(g_nAlReverbEffect, AL_REVERB_AIR_ABSORPTION_GAINHF, 0.1f); - */ - - PSYX_UNIMPLEMENTED(); - return 0; -} - -void SpuGetReverbModeParam(SpuReverbAttr* attr) -{ - PSYX_UNIMPLEMENTED(); -} - -long SpuSetReverbDepth(SpuReverbAttr* attr) -{ - PSYX_UNIMPLEMENTED(); - return 0; -} - -long SpuReserveReverbWorkArea(long on_off) -{ - return 1; -} - -long SpuIsReverbWorkAreaReserved(long on_off) -{ - PSYX_UNIMPLEMENTED(); - return 0; -} - -unsigned long SpuSetReverbVoice(long on_off, unsigned long voice_bit) -{ - SPUVoice* voice; - ALuint alSource; - - if (!g_spuInit) - { - return 0; - } - - if(!g_ALEffectsSupported) - return 0; - - SDL_LockMutex(g_SpuMutex); - - for (int i = 0; i < SPU_VOICES; i++) - { - if (voice_bit & SPU_VOICECH(i)) - { - voice = &g_SpuVoices[i]; - - alSource = voice->alSource; - - if (alSource == AL_NONE) - continue; - - voice->reverb = on_off > 0; - - if (on_off) - { - alSource3i(alSource, AL_AUXILIARY_SEND_FILTER, g_ALEffectSlots[g_currEffectSlotIdx], 0, AL_FILTER_NULL); - } - else - { - alSource3i(alSource, AL_AUXILIARY_SEND_FILTER, AL_EFFECTSLOT_NULL, 0, AL_FILTER_NULL); - } - } - } - - SDL_UnlockMutex(g_SpuMutex); - - return 0; -} - -unsigned long SpuGetReverbVoice(void) -{ - SPUVoice* voice; - - unsigned long bits = 0; - - for (int i = 0; i < SPU_VOICES; i++) - { - voice = &g_SpuVoices[i]; - if (voice->reverb) - bits |= SPU_KEYCH(i); - } - - return bits; -} - -long SpuClearReverbWorkArea(long mode) -{ - PSYX_UNIMPLEMENTED(); - return 0; -} - - -void SpuSetCommonAttr(SpuCommonAttr* attr) -{ - PSYX_UNIMPLEMENTED(); -} - -static long s_spuMallocVal = 0; - -long SpuInitMalloc(long num, char* top) -{ - s_spuMallocVal = 0; - return num; -} - -long SpuMalloc(long size) -{ - int addr = s_spuMallocVal; - s_spuMallocVal += size; - - if (s_spuMallocVal > SPU_MEMSIZE) - return -1; - - return addr; -} - -long SpuMallocWithStartAddr(unsigned long addr, long size) -{ - PSYX_UNIMPLEMENTED(); - return 0; -} - -void SpuFree(unsigned long addr) -{ - s_spuMallocVal = 0; -} - -unsigned long SpuFlush(unsigned long ev) -{ - //PSYX_UNIMPLEMENTED(); - return 0; -} - -void SpuSetCommonMasterVolume(short mvol_left, short mvol_right)// (F) -{ - //MasterVolume.VolumeLeft.Raw = mvol_left; - //MasterVolume.VolumeRight.Raw = mvol_right; -} - -long SpuSetReverbModeType(long mode) -{ - PSYX_UNIMPLEMENTED(); - return 0; -} - -void SpuSetReverbModeDepth(short depth_left, short depth_right) -{ - PSYX_UNIMPLEMENTED(); -} - -void SpuSetVoiceVolume(int vNum, short volL, short volR) -{ - SpuVoiceAttr attr; - - attr.mask = SPU_VOICE_VOLL | SPU_VOICE_VOLR; - attr.voice = SPU_VOICECH(vNum); - attr.volume.left = volL; - attr.volume.right = volR; - - SpuSetVoiceAttr(&attr); -} - -void SpuSetVoicePitch(int vNum, unsigned short pitch) -{ - SpuVoiceAttr attr; - - attr.mask = SPU_VOICE_PITCH; - attr.voice = SPU_VOICECH(vNum); - attr.pitch = pitch; - - SpuSetVoiceAttr(&attr); -} - -void SpuGetVoiceVolume(int vNum, short *volL, short *volR) -{ - if(volL) - *volL = g_SpuVoices[vNum].attr.volume.left; - - if(volR) - *volR = g_SpuVoices[vNum].attr.volume.right; -} - -void SpuGetVoicePitch(int vNum, unsigned short *pitch) -{ - *pitch = g_SpuVoices[vNum].attr.pitch; -} - -void SpuSetVoiceAR(int vNum, unsigned short AR) -{ - SpuVoiceAttr attr; - - attr.mask = SPU_VOICE_ADSR_AR; - attr.ar = AR; - - SpuSetVoiceAttr(&attr); -} - -void SpuSetVoiceRR(int vNum, unsigned short RR) -{ - SpuVoiceAttr attr; - - attr.mask = SPU_VOICE_ADSR_RR; - attr.rr = RR; - - SpuSetVoiceAttr(&attr); -} diff --git a/src_rebuild/PsyCross/src/render/PsyX_render.cpp b/src_rebuild/PsyCross/src/render/PsyX_render.cpp deleted file mode 100644 index 1d8119ee..00000000 --- a/src_rebuild/PsyCross/src/render/PsyX_render.cpp +++ /dev/null @@ -1,1873 +0,0 @@ -#include "PsyX/PsyX_public.h" - -#include "../platform.h" -#include "../gpu/PsyX_GPU.h" - -#include "PsyX/PsyX_render.h" -#include "PsyX/PsyX_globals.h" -#include "PsyX/util/timer.h" - - -#include -#include - -#ifdef _WIN32 -#include - -#if defined(_LANGUAGE_C_PLUS_PLUS)||defined(__cplusplus)||defined(c_plusplus) -extern "C" { -#endif - - __declspec(dllexport) DWORD NvOptimusEnablement = 0x00000001; - __declspec(dllexport) int AmdPowerXpressRequestHighPerformance = 1; - -#if defined(_LANGUAGE_C_PLUS_PLUS)||defined(__cplusplus)||defined(c_plusplus) -} -#endif - -#endif //def WIN32 - -#if defined(RENDERER_OGL) - -#define USE_PBO 1 -#define USE_OFFSCREEN_BLIT 1 -#define USE_FRAMEBUFFER_BLIT 1 - -#else - -// OpenGL ES/Web GL has slowdowns and doesn't allow GL_LUMINANCE_ALPHA format as framebuffer, so it's disabled -#define USE_PBO 0 -#define USE_OFFSCREEN_BLIT 0 -#define USE_FRAMEBUFFER_BLIT 0 - -#endif - -extern SDL_Window* g_window; - -#define PSX_SCREEN_ASPECT (240.0f / 320.0f) // PSX screen is mapped always to this aspect - -int g_PreviousBlendMode = BM_NONE; -int g_PreviousDepthMode = 0; -int g_PreviousStencilMode = 0; -int g_PreviousScissorState = 0; -int g_PreviousOffscreenState = 0; -RECT16 g_PreviousFramebuffer = { 0,0,0,0 }; -RECT16 g_PreviousOffscreen = { 0,0,0,0 }; - -ShaderID g_PreviousShader = -1; - -TextureID g_vramTexturesDouble[2]; -TextureID g_vramTexture; -int g_vramTextureIdx = 0; - -TextureID g_fbTexture = -1; -TextureID g_offscreenRTTexture = -1; - -TextureID g_whiteTexture = -1; -TextureID g_lastBoundTexture = -1; - -int g_windowWidth = 0; -int g_windowHeight = 0; - -int g_wireframeMode = 0; -int g_texturelessMode = 0; - -int g_emulatorPaused = 0; -int g_polygonSelected = 0; -int g_pgxpTextureCorrection = 1; -int g_pgxpZBuffer = 1; -int g_bilinearFiltering = 0; - -extern int g_skipSwapInterval; - -// this has to be configured for each game -float g_pgxpZNear = 0.25f; -float g_pgxpZFar = 1000.0f; - -int vram_need_update = 1; -int framebuffer_need_update = 0; - -#if defined(__EMSCRIPTEN__) || defined(__RPI__) || defined(__ANDROID__) -#if defined(RENDERER_OGL) -#error It should not be enabled -#endif -#endif - - - -#if defined(USE_OPENGL) -typedef struct -{ - GLenum fmt; - GLuint* pbos; - uint64_t num_pbos; - uint64_t dx; - uint64_t num_downloads; - - int width; - int height; - int nbytes; /* number of bytes in the pbo buffer. */ - unsigned char* pixels; /* the downloaded pixels. */ -} GrPBO; - -int PBO_Init(GrPBO* pbo, GLenum format, int w, int h, int num) -{ - if (pbo->pbos) - { - eprinterr("Already initialized. Not necessary to initialize again; or shutdown first."); - return -1; - } - - if (0 >= num) - { - eprinterr("Invalid number of PBOs: %d", num); - return -2; - } - - pbo->fmt = format; - pbo->width = w; - pbo->height = h; - pbo->num_pbos = num; - -#if USE_PBO - if (GL_RED == pbo->fmt || GL_GREEN == pbo->fmt || GL_BLUE == pbo->fmt) { - pbo->nbytes = pbo->width * pbo->height; - } - else if (GL_RGB == pbo->fmt || GL_BGR == pbo->fmt) - { - pbo->nbytes = pbo->width * pbo->height * 3; - } - else if (GL_RGBA == pbo->fmt || GL_BGRA == pbo->fmt) { - pbo->nbytes = pbo->width * pbo->height * 4; - } - else - { - eprinterr("Unhandled pixel format, use GL_R, GL_RG, GL_RGB or GL_RGBA."); - return -3; - } - - if (pbo->nbytes == 0) - { - eprinterr("Invalid width or height given: %d x %d", pbo->width, pbo->height); - return -4; - } - - pbo->pbos = (GLuint*)malloc(sizeof(GLuint) * num); - pbo->pixels = (u_char*)malloc(pbo->nbytes); - - glGenBuffers(num, pbo->pbos); - for (int i = 0; i < num; ++i) - { - glBindBuffer(GL_PIXEL_PACK_BUFFER, pbo->pbos[i]); - glBufferData(GL_PIXEL_PACK_BUFFER, pbo->nbytes, NULL, GL_STREAM_READ); - } - - glBindBuffer(GL_PIXEL_PACK_BUFFER, 0); -#endif - return 0; -} - -void PBO_Destroy(GrPBO* pbo) -{ -#if USE_PBO - if(pbo->pbos) - { - glDeleteBuffers(pbo->num_pbos, pbo->pbos); - - free(pbo->pbos); - pbo->num_pbos = 0; - pbo->pbos = NULL; - } - -#endif - if (pbo->pixels) - { - free(pbo->pixels); - pbo->pixels = NULL; - } - - pbo->num_downloads = 0; - pbo->dx = 0; - pbo->fmt = 0; - pbo->nbytes = 0; -} - -void PBO_Download(GrPBO* pbo) -{ - unsigned char* ptr; - -#if USE_PBO - if (pbo->num_downloads < pbo->num_pbos) - { - /* - First we need to make sure all our pbos are bound, so glMap/Unmap will - read from the oldest bound buffer first. - */ - glBindBuffer(GL_PIXEL_PACK_BUFFER, pbo->pbos[pbo->dx]); - -#if defined(RENDERER_OGL) - glGetTexImage(GL_TEXTURE_2D, 0, pbo->fmt, GL_UNSIGNED_BYTE, 0); -#else - glReadPixels(0, 0, pbo->width, pbo->height, pbo->fmt, GL_UNSIGNED_BYTE, 0); /* When a GL_PIXEL_PACK_BUFFER is bound, the last 0 is used as offset into the buffer to read into. */ -#endif - } - else - { - /* Read from the oldest bound pbo */ - glBindBuffer(GL_PIXEL_PACK_BUFFER, pbo->pbos[pbo->dx]); - -#if defined(RENDERER_OGL) - ptr = (unsigned char*)glMapBuffer(GL_PIXEL_PACK_BUFFER, GL_READ_ONLY); - if (NULL != ptr) - { - memcpy(pbo->pixels, ptr, pbo->nbytes); - glUnmapBuffer(GL_PIXEL_PACK_BUFFER); - } - else - eprintwarn("Failed to map the buffer\n"); - - /* Trigger the next read. */ - glGetTexImage(GL_TEXTURE_2D, 0, pbo->fmt, GL_UNSIGNED_BYTE, 0); -#else - glReadPixels(0, 0, pbo->width, pbo->height, GL_RGBA, GL_UNSIGNED_BYTE, pbo->pixels); -#endif - } - - ++pbo->dx; - pbo->dx = pbo->dx % pbo->num_pbos; - - pbo->num_downloads++; - - if (pbo->num_downloads == UINT64_MAX) - pbo->num_downloads = pbo->num_pbos; - - glBindBuffer(GL_PIXEL_PACK_BUFFER, 0); -#else - // FIXME: THIS is very slow - // Do not use at all - - // glBindBuffer(GL_PIXEL_PACK_BUFFER, 0); /* just make sure we're not accidentilly using a PBO. */ - // glGetTexImage(GL_TEXTURE_2D, 0, GL_RGBA, GL_UNSIGNED_BYTE, pbo->pixels); -#endif -} - -GLuint g_glVertexArray[2]; -GLuint g_glVertexBuffer[2]; -int g_curVertexBuffer = 0; - -GLuint g_glBlitFramebuffer; -GrPBO g_glFramebufferPBO; - -GLuint g_glVRAMFramebuffer; - -GLuint g_glOffscreenFramebuffer; -GrPBO g_glOffscreenPBO; - -#endif - -#if defined(RENDERER_OGLES) -EGLint majorVersion = 0, minorVersion = 0; -EGLContext eglContext = NULL; -EGLSurface eglSurface = NULL; -EGLConfig eglConfig = NULL; -EGLDisplay eglDisplay = NULL; -int numConfigs = 0; - -const EGLint config16bpp[] = -{ -#if OGLES_VERSION == 2 - EGL_RENDERABLE_TYPE,EGL_OPENGL_ES2_BIT, -#elif OGLES_VERSION == 3 - EGL_RENDERABLE_TYPE,EGL_OPENGL_ES3_BIT, -#endif - EGL_BUFFER_SIZE,24, - EGL_RED_SIZE,8, - EGL_GREEN_SIZE,8, - EGL_BLUE_SIZE,8, - EGL_ALPHA_SIZE,0, - EGL_DEPTH_SIZE,24, - EGL_STENCIL_SIZE,1, - //EGL_SAMPLE_BUFFERS,1, - //EGL_SAMPLES,4, - EGL_NONE -}; - -int GR_InitialiseGLESContext(char* windowName, int fullscreen) -{ - unsigned int windowFlags = SDL_WINDOW_OPENGL; - -#if defined(__ANDROID__) - windowFlags |= SDL_WINDOW_FULLSCREEN; -#endif - - eglDisplay = eglGetDisplay(EGL_DEFAULT_DISPLAY); - g_window = SDL_CreateWindow(windowName, SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, g_windowWidth, g_windowHeight, windowFlags); - - if (g_window == NULL) - { - eprinterr("Failed to create SDL window!\n"); - } - - if (!eglInitialize(eglDisplay, &majorVersion, &minorVersion)) - { - eprinterr("eglInitialize failure! Error: %x\n", eglGetError()); - return 0; - } - - eglBindAPI(EGL_OPENGL_ES_API); - - if (!eglChooseConfig(eglDisplay, config16bpp, &eglConfig, 1, &numConfigs)) - { - printf("eglChooseConfig failed\n"); - if (eglContext == 0) - { - printf("Error code: %d\n", eglGetError()); - } - } - -#if !defined(__EMSCRIPTEN__) && !defined(__RPI__) - SDL_SysWMinfo systemInfo; - SDL_VERSION(&systemInfo.version); - SDL_GetWindowWMInfo(g_window, &systemInfo); -#endif - -#if defined(__EMSCRIPTEN__) - EGLNativeWindowType dummyWindow; - eglSurface = eglCreateWindowSurface(eglDisplay, eglConfig, (EGLNativeWindowType)dummyWindow, NULL); -#elif defined(__ANDROID__) - eglSurface = systemInfo.info.android.surface; -#else - eglSurface = eglCreateWindowSurface(eglDisplay, eglConfig, (EGLNativeWindowType)systemInfo.info.win.window, NULL); -#endif - - if (eglSurface == EGL_NO_SURFACE) - { - eprinterr("eglSurface failure! Error: %x\n", eglGetError()); - return 0; - } - - EGLint contextAttribs[] = { EGL_CONTEXT_CLIENT_VERSION, OGLES_VERSION, EGL_NONE }; - eglContext = eglCreateContext(eglDisplay, eglConfig, EGL_NO_CONTEXT, contextAttribs); - - if (eglContext == EGL_NO_CONTEXT) { - eprinterr("eglContext failure! Error: %x\n", eglGetError()); - return 0; - } - - eglMakeCurrent(eglDisplay, eglSurface, eglSurface, eglContext); - - return 1; -} - -#elif defined(RENDERER_OGL) -int GR_InitialiseGLContext(char* windowName, int fullscreen) -{ - int windowFlags = SDL_WINDOW_OPENGL | SDL_WINDOW_RESIZABLE; - - if (fullscreen) - { - windowFlags |= SDL_WINDOW_FULLSCREEN_DESKTOP; - } - - g_window = SDL_CreateWindow(windowName, SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, g_windowWidth, g_windowHeight, windowFlags); - - if (g_window == NULL) - { - eprinterr("Failed to initialise SDL window!\n"); - return 0; - } - -#if defined(RENDERER_OGLES) - -#if defined(__ANDROID__) - //Override to full screen. - SDL_DisplayMode displayMode; - if (SDL_GetCurrentDisplayMode(0, &displayMode) == 0) - { - screenWidth = displayMode.w; - windowWidth = displayMode.w; - screenHeight = displayMode.h; - windowHeight = displayMode.h; - } -#endif - - //SDL_GL_SetAttribute(SDL_GL_CONTEXT_EGL, 1); - SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, OGLES_VERSION); - SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 0); - SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_ES); - - if(!SDL_GL_CreateContext(g_window)) - { - eprinterr("Failed to initialise - OpenGL ES %d.x is not supported.\n", OGLES_VERSION); - return 0; - } - -#elif defined(RENDERER_OGL) - - int major_version = 3; - int minor_version = 3; - int profile = SDL_GL_CONTEXT_PROFILE_CORE; - - // find best OpenGL version - do - { - SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, major_version); - SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, minor_version); - SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, profile); - - if (SDL_GL_CreateContext(g_window)) - break; - - minor_version--; - - } while (minor_version >= 0); - - if (minor_version == -1) - { - eprinterr("Failed to initialise - OpenGL 3.x is not supported. Please update video drivers.\n"); - return 0; - } -#endif - - return 1; -} -#endif - -int GR_InitialiseGLExt() -{ -#ifndef __EMSCRIPTEN__ - GLenum err = gladLoadGL(); - - if (err == 0) - return 0; -#endif - - const char* rend = (const char*)glGetString(GL_RENDERER); - const char* vendor = (const char*)glGetString(GL_VENDOR); - eprintf("*Video adapter: %s by %s\n", rend, vendor); - - const char* versionStr = (const char*)glGetString(GL_VERSION); - eprintf("*OpenGL version: %s\n", versionStr); - - const char* glslVersionStr = (const char*)glGetString(GL_SHADING_LANGUAGE_VERSION); - eprintf("*GLSL version: %s\n", glslVersionStr); - - return 1; -} - -int GR_InitialiseRender(char* windowName, int width, int height, int fullscreen) -{ - g_windowWidth = width; - g_windowHeight = height; - - // Due to debugging in fullscreen - SDL_SetHint(SDL_HINT_ALLOW_TOPMOST, "0"); - SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1); - -#if defined(USE_OPENGL) - SDL_GL_SetAttribute(SDL_GL_STENCIL_SIZE, 1); - -#if defined(RENDERER_OGLES) - if (!GR_InitialiseGLESContext(windowName, fullscreen)) - { - eprinterr("Failed to Initialise GLES Context!\n"); - return 0; - } -#elif defined(RENDERER_OGL) - if (!GR_InitialiseGLContext(windowName, fullscreen)) - { - eprinterr("Failed to Initialise GL Context!\n"); - return 0; - } -#endif - - if (!GR_InitialiseGLExt()) - { - eprinterr("Failed to Intialise GL extensions\n"); - return 0; - } -#endif - - return 1; -} - -void GR_Shutdown() -{ -#if defined(USE_OPENGL) - glDeleteVertexArrays(2, g_glVertexArray); - glDeleteBuffers(2, g_glVertexBuffer); - - PBO_Destroy(&g_glFramebufferPBO); - PBO_Destroy(&g_glOffscreenPBO); - - glDeleteFramebuffers(1, &g_glBlitFramebuffer); - glDeleteFramebuffers(1, &g_glOffscreenFramebuffer); - glDeleteFramebuffers(1, &g_glVRAMFramebuffer); - - GR_DestroyTexture(g_vramTexturesDouble[0]); - GR_DestroyTexture(g_vramTexturesDouble[1]); - - GR_DestroyTexture(g_whiteTexture); - GR_DestroyTexture(g_fbTexture); - GR_DestroyTexture(g_offscreenRTTexture); -#endif -} - -void GR_UpdateSwapIntervalState() -{ -#if defined(RENDERER_OGL) - SDL_GL_SetSwapInterval((g_enableSwapInterval && !g_skipSwapInterval) ? g_swapInterval : 0); -#endif -} - -void GR_BeginScene() -{ - g_lastBoundTexture = 0; - -#if defined(USE_OPENGL) - glClearDepth(1.0f); - glClear(GL_DEPTH_BUFFER_BIT); - glClear(GL_STENCIL_BUFFER_BIT); -#endif - - GR_UpdateVRAM(); - GR_SetViewPort(0, 0, g_windowWidth, g_windowHeight); - GR_UpdateSwapIntervalState(); - - if (g_wireframeMode) - { - GR_SetWireframe(1); - -#if defined(USE_OPENGL) - glClearColor(0.1f, 0.1f, 0.1f, 1.0f); - glClear(GL_COLOR_BUFFER_BIT); -#endif - } -} - -void GR_EndScene() -{ - framebuffer_need_update = 1; - - if (g_wireframeMode) - GR_SetWireframe(0); - -#if defined(USE_OPENGL) - glBindVertexArray(0); -#endif -} - -//---------------------------------------------------------------------------------------- - -unsigned short vram[VRAM_WIDTH * VRAM_HEIGHT]; - -void GR_ResetDevice() -{ - GR_UpdateSwapIntervalState(); -} - -typedef struct -{ - // shader itself - ShaderID shader; - -#if defined(USE_OPENGL) - GLint projectionLoc; - GLint projection3DLoc; - GLint bilinearFilterLoc; -#endif -} GTEShader; - -GTEShader g_gte_shader_4; -GTEShader g_gte_shader_8; -GTEShader g_gte_shader_16; - -#if defined(USE_OPENGL) - -GLint u_projectionLoc; -GLint u_projection3DLoc; -GLint u_bilinearFilterLoc; - -#define GPU_PACK_RG\ - " float color_16 = (color_rg.y * 256.0 + color_rg.x) * 255.0;\n" - -#define GPU_DISCARD\ - " if (color_16 == 0.0) { discard; }\n" - -#define GPU_DECODE_RG\ - " fragColor = fract(floor(color_16 / vec4(1.0, 32.0, 1024.0, 32768.0)) / 32.0);\n" - -#define GPU_PACK_RG_FUNC\ - " const float c_PackRange = 255.001;\n"\ - " float packRG(vec2 rg) { return (rg.y * 256.0 + rg.x) * c_PackRange;}\n" - -#define GPU_DECODE_RG_FUNC\ - " vec4 decodeRG(float rg) { return fract(floor(rg / vec4(1.0, 32.0, 1024.0, 32768.0)) / 32.0); }\n" - -#if defined(RENDERER_OGL) || (OGLES_VERSION == 3) - -# define GPU_DITHERING\ - " fragColor *= v_color;\n"\ - " mat4 dither = mat4(\n"\ - " -4.0, +0.0, -3.0, +1.0,\n"\ - " +2.0, -2.0, +3.0, -1.0,\n"\ - " -3.0, +1.0, -4.0, +0.0,\n"\ - " +3.0, -1.0, +2.0, -2.0) / 255.0;\n"\ - " ivec2 dc = ivec2(fract(gl_FragCoord.xy / 4.0) * 4.0);\n"\ - " fragColor.xyz += vec3(dither[dc.x][dc.y] * v_texcoord.w);\n" - -# define GPU_ARRAY_FUNC\ - " float _idx2(vec2 array, int idx) { return array[idx]; }" - -#else - -# define GPU_DITHERING\ - " fragColor *= v_color;\n" - -# define GPU_ARRAY_FUNC\ - " float _idx2(vec2 array, int idx) { if(idx == 0) return array.x; else return array.y; }" - -#endif - -#define GPU_SAMPLE_TEXTURE_4BIT_FUNC\ - " // returns 16 bit colour\n"\ - " float samplePSX(vec2 tc){\n"\ - " vec2 uv = (tc * vec2(0.25, 1.0) + v_page_clut.xy) * c_VRAMTexel;\n"\ - " vec2 comp = VRAM(uv);\n"\ - " int index = int(fract(tc.x / 4.0 + 0.0001) * 4.0);\n"\ - " float v = _idx2(comp, index / 2) * (c_PackRange / 16.0);\n"\ - " float f = floor(v);\n"\ - " vec2 c = vec2( (v - f) * 16.0, f );\n"\ - " vec2 clut_pos = v_page_clut.zw;\n"\ - " clut_pos.x += mix(c[0], c[1], mod(float(index), 2.0)) * c_VRAMTexel.x;\n"\ - " return packRG(VRAM(clut_pos));\n"\ - " }\n" - -#define GPU_SAMPLE_TEXTURE_8BIT_FUNC\ - " // returns 16 bit colour\n"\ - " float samplePSX(vec2 tc){\n"\ - " vec2 uv = (tc * vec2(0.5, 1.0) + v_page_clut.xy) * c_VRAMTexel;\n"\ - " vec2 comp = VRAM(uv);\n"\ - " vec2 clut_pos = v_page_clut.zw;\n"\ - " int index = int(mod(tc.x, 2.0));\n"\ - " clut_pos.x += _idx2(comp, index) * c_PackRange * c_VRAMTexel.x;\n"\ - " vec2 color_rg = VRAM(clut_pos);\n"\ - " return packRG(VRAM(clut_pos));\n"\ - " }\n" - -#define GPU_SAMPLE_TEXTURE_16BIT_FUNC\ - " float samplePSX(vec2 tc){\n"\ - " vec2 uv = (tc + v_page_clut.xy) * c_VRAMTexel;\n"\ - " vec2 color_rg = VRAM(uv);\n"\ - " return packRG(color_rg);\n"\ - " }\n" - - -#define GPU_BILINEAR_SAMPLE_FUNC \ - " float c_textureSize = 1.0;\n"\ - " float c_onePixel = 1.0;\n"\ - " vec4 BilinearTextureSample(vec2 P) {\n"\ - " vec2 frac = fract(P);\n"\ - " vec2 pixel = floor(P);\n"\ - " float C11 = samplePSX(pixel);\n"\ - " float C21 = samplePSX(pixel + vec2(c_onePixel, 0.0));\n"\ - " float C12 = samplePSX(pixel + vec2(0.0, c_onePixel));\n"\ - " float C22 = samplePSX(pixel + vec2(c_onePixel, c_onePixel));\n"\ - " float ax1 = mix(float(C11 > 0.0), float(C21 > 0.0), frac.x);\n"\ - " float ax2 = mix(float(C12 > 0.0), float(C22 > 0.0), frac.x);\n"\ - " if(mix(ax1, ax2, frac.y) < 0.5) { discard; }\n"\ - " vec4 x1 = mix(decodeRG(C11), decodeRG(C21), frac.x);\n"\ - " vec4 x2 = mix(decodeRG(C12), decodeRG(C22), frac.x);\n"\ - " return mix(x1, x2, frac.y);\n"\ - " }\n" - -#define GPU_NEAREST_SAMPLE_FUNC \ - "vec4 NearestTextureSample(vec2 P) {\n"\ - " float color_16 = samplePSX(P);\n"\ - " if(color_16 == 0.0) {discard;}\n"\ - " return decodeRG(color_16);\n"\ - "}\n" - -#if (VRAM_FORMAT == GL_LUMINANCE_ALPHA) -#define GPU_FETCH_VRAM_FUNC\ - " uniform sampler2D s_texture;\n"\ - " vec2 VRAM(vec2 uv) { return texture2D(s_texture, uv).ra; }\n" -#else -#define GPU_FETCH_VRAM_FUNC\ - " uniform sampler2D s_texture;\n"\ - " vec2 VRAM(vec2 uv) { return texture2D(s_texture, uv).rg; }\n" -#endif - -#ifdef USE_PGXP -#define GTE_PERSPECTIVE_CORRECTION \ - " mat4 ofsMat = mat4(\n"\ - " vec4(1.0, 0.0, 0.0, 0.0),\n"\ - " vec4(0.0, 1.0, 0.0, 0.0),\n"\ - " vec4(0.0, 0.0, 1.0, 0.0),\n"\ - " vec4(a_zw.z, -a_zw.w, 0.0, 1.0));\n"\ - " vec2 geom_ofs = vec2(0.5, 0.5);\n"\ - " vec4 fragPosition = (a_zw.y > 100.0 ? ofsMat * (Projection3D * vec4((a_position.xy + geom_ofs) * vec2(1.0,-1.0) * a_zw.y, a_zw.x, 1.0)) : (Projection * vec4(a_position.xy, 0.5, 1.0)));\n" \ - " gl_Position = fragPosition;\n" -#else -#define GTE_PERSPECTIVE_CORRECTION \ - " gl_Position = Projection * vec4(a_position.xy, 0.0, 1.0);\n" -#endif - -#define GTE_VERTEX_SHADER \ - " attribute vec4 a_position;\n"\ - " attribute vec4 a_texcoord; // uv, color multiplier, dither\n"\ - " attribute vec4 a_color;\n"\ - " attribute vec4 a_extra; // texcoord.xy ofs, unused.xy\n"\ - " attribute vec4 a_zw;\n"\ - " uniform mat4 Projection;\n"\ - " uniform mat4 Projection3D;\n"\ - " const vec2 c_UVFudge = vec2(0.00025, 0.00025);\n"\ - " void main() {\n"\ - " v_texcoord = a_texcoord;\n"\ - " v_texcoord.xy += a_extra.xy * 0.5;\n"\ - " v_color = a_color;\n"\ - " v_color.xyz *= a_texcoord.z;\n"\ - " v_page_clut.x = fract(a_position.z / 16.0) * 1024.0;\n"\ - " v_page_clut.y = floor(a_position.z / 16.0) * 256.0;\n"\ - " v_page_clut.z = fract(a_position.w / 64.0);\n"\ - " v_page_clut.w = floor(a_position.w / 64.0) / 512.0;\n"\ - " v_page_clut.xy += c_UVFudge;\n"\ - " v_page_clut.zw += c_UVFudge;\n"\ - GTE_PERSPECTIVE_CORRECTION\ - " v_z = (gl_Position.z - 40.0) * 0.005;\n"\ - " }\n" - -#define GPU_FRAGMENT_SAMPLE_SHADER(bit) \ - GPU_PACK_RG_FUNC\ - GPU_DECODE_RG_FUNC\ - GPU_FETCH_VRAM_FUNC\ - " const vec2 c_VRAMTexel = vec2(1.0 / 1024.0, 1.0 / 512.0);\n"\ - GPU_ARRAY_FUNC\ - GPU_SAMPLE_TEXTURE_## bit ##BIT_FUNC\ - GPU_BILINEAR_SAMPLE_FUNC\ - GPU_NEAREST_SAMPLE_FUNC\ - " uniform int bilinearFilter;\n"\ - " void main() {\n"\ - " if(bilinearFilter > 0)\n"\ - " fragColor = BilinearTextureSample(v_texcoord.xy);\n"\ - " else\n"\ - " fragColor = NearestTextureSample(v_texcoord.xy);\n"\ - " \n"\ - GPU_DITHERING\ - " }\n" - -const char* gte_shader_4 = - "varying vec4 v_texcoord;\n" - "varying vec4 v_color;\n" - "varying vec4 v_page_clut;\n" - "varying float v_z;\n" - "#ifdef VERTEX\n" - GTE_VERTEX_SHADER - "#else\n" - GPU_FRAGMENT_SAMPLE_SHADER(4) - "#endif\n"; - -const char* gte_shader_8 = - "varying vec4 v_texcoord;\n" - "varying vec4 v_color;\n" - "varying vec4 v_page_clut;\n" - "varying float v_z;\n" - "#ifdef VERTEX\n" - GTE_VERTEX_SHADER - "#else\n" - GPU_FRAGMENT_SAMPLE_SHADER(8) - "#endif\n"; - -const char* gte_shader_16 = - "varying vec4 v_texcoord;\n" - "varying vec4 v_color;\n" - "varying vec4 v_page_clut;\n" - "varying float v_z;\n" - "#ifdef VERTEX\n" - GTE_VERTEX_SHADER - "#else\n" - GPU_FRAGMENT_SAMPLE_SHADER(16) - "#endif\n"; - -int GR_Shader_CheckShaderStatus(GLuint shader) -{ - char info[1024]; - GLint result; - - glGetShaderiv(shader, GL_COMPILE_STATUS, &result); - - if (result == GL_TRUE) - return 1; - - glGetShaderInfoLog(shader, sizeof(info), NULL, info); - if (info[0] && strlen(info) > 8) - { - eprinterr("%s\n", info); - assert(0); - } - - return 0; -} - -int GR_Shader_CheckProgramStatus(GLuint program) -{ - char info[1024]; - GLint result; - - glGetProgramiv(program, GL_LINK_STATUS, &result); - - if (result == GL_TRUE) - return 1; - - glGetProgramInfoLog(program, sizeof(info), NULL, info); - if (info[0] && strlen(info) > 8) - { - eprinterr("%s\n", info); - assert(0); - } - - return 0; -} - -ShaderID GR_Shader_Compile(const char* source) -{ -#if defined(ES2_SHADERS) - const char* GLSL_HEADER_VERT = - "#version 100\n" - "precision lowp int;\n" - "precision highp float;\n" - "#define VERTEX\n"; - - const char* GLSL_HEADER_FRAG = - "#version 100\n" - "precision lowp int;\n" - "precision highp float;\n" - "#define fragColor gl_FragColor\n"; -#elif defined(ES3_SHADERS) - const char* GLSL_HEADER_VERT = - "#version 300 es\n" - "precision lowp int;\n" - "precision highp float;\n" - "#define VERTEX\n" - "#define varying out\n" - "#define attribute in\n" - "#define texture2D texture\n"; - - const char* GLSL_HEADER_FRAG = - "#version 300 es\n" - "precision lowp int;\n" - "precision highp float;\n" - "#define varying in\n" - "#define texture2D texture\n" - "out vec4 fragColor;\n"; -#else - const char* GLSL_HEADER_VERT = - "#version 140\n" - "precision lowp int;\n" - "precision highp float;\n" - "#define VERTEX\n" - "#define varying out\n" - "#define attribute in\n" - "#define texture2D texture\n"; - - const char* GLSL_HEADER_FRAG = - "#version 140\n" - "precision lowp int;\n" - "precision highp float;\n" - "#define varying in\n" - "#define texture2D texture\n" - "out vec4 fragColor;\n"; -#endif - - char extra_vs_defines[1024]; - char extra_fs_defines[1024]; - extra_vs_defines[0] = 0; - extra_fs_defines[0] = 0; - - if (g_bilinearFiltering) - { - strcat(extra_fs_defines, "#define BILINEAR_FILTER\n"); - } - - const char* vs_list[] = { GLSL_HEADER_VERT, extra_vs_defines, source }; - const char* fs_list[] = { GLSL_HEADER_FRAG, extra_fs_defines, source }; - - GLuint program = glCreateProgram(); - - { - GLuint vertexShader = glCreateShader(GL_VERTEX_SHADER); - glShaderSource(vertexShader, 3, vs_list, NULL); - glCompileShader(vertexShader); - - if( GR_Shader_CheckShaderStatus(vertexShader) == 0 ) - eprinterr("Failed to compile Vertex Shader!\n"); - - glAttachShader(program, vertexShader); - glDeleteShader(vertexShader); - } - - { - GLuint fragmentShader = glCreateShader(GL_FRAGMENT_SHADER); - glShaderSource(fragmentShader, 3, fs_list, NULL); - glCompileShader(fragmentShader); - - if(GR_Shader_CheckShaderStatus(fragmentShader) == 0) - eprinterr("Failed to compile Fragment Shader!\n"); - - glAttachShader(program, fragmentShader); - glDeleteShader(fragmentShader); - } - - glBindAttribLocation(program, a_position, "a_position"); - glBindAttribLocation(program, a_texcoord, "a_texcoord"); - glBindAttribLocation(program, a_color, "a_color"); - -#ifdef USE_PGXP - glBindAttribLocation(program, a_zw, "a_zw"); -#endif - - glLinkProgram(program); - if(GR_Shader_CheckProgramStatus(program) == 0) - eprinterr("Failed to link Shader!\n"); - - GLint sampler = 0; - glUseProgram(program); - glUniform1iv(glGetUniformLocation(program, "s_texture"), 1, &sampler); - glUseProgram(0); - - return program; -} -#else -#error -#endif - -//-------------------------------------------------------------------------------------------- - -void GR_GenerateCommonTextures() -{ - unsigned int pixelData = 0xFFFFFFFF; - -#if defined(USE_OPENGL) - glGenTextures(1, &g_whiteTexture); - { - glBindTexture(GL_TEXTURE_2D, g_whiteTexture); - - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); - glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 1, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, &pixelData); - - glBindTexture(GL_TEXTURE_2D, 0); - } -#endif -} - -TextureID GR_CreateRGBATexture(int width, int height, u_char* data /*= nullptr*/) -{ - TextureID newTexture; - glGenTextures(1, &newTexture); - - glBindTexture(GL_TEXTURE_2D, newTexture); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, g_bilinearFiltering ? GL_LINEAR : GL_NEAREST); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, g_bilinearFiltering ? GL_LINEAR : GL_NEAREST); - glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, data); - - glBindTexture(GL_TEXTURE_2D, 0); - - return newTexture; -} - -void GR_CompilePSXShader(GTEShader* sh, const char* source) -{ - sh->shader = GR_Shader_Compile(source); - -#if defined(USE_OPENGL) - - sh->bilinearFilterLoc = glGetUniformLocation(sh->shader, "bilinearFilter"); - sh->projectionLoc = glGetUniformLocation(sh->shader, "Projection"); -#ifdef USE_PGXP - sh->projection3DLoc = glGetUniformLocation(sh->shader, "Projection3D"); -#endif - -#endif -} - -void GR_InitialisePSXShaders() -{ - GR_CompilePSXShader(&g_gte_shader_4, gte_shader_4); - GR_CompilePSXShader(&g_gte_shader_8, gte_shader_8); - GR_CompilePSXShader(&g_gte_shader_16, gte_shader_16); -} - -int GR_InitialisePSX() -{ - SDL_memset(vram, 0, VRAM_WIDTH * VRAM_HEIGHT * sizeof(unsigned short)); - GR_GenerateCommonTextures(); - GR_InitialisePSXShaders(); - -#if defined(USE_OPENGL) - glDepthFunc(GL_LEQUAL); - glEnable(GL_STENCIL_TEST); - glBlendColor(0.5f, 0.5f, 0.5f, 0.25f); - - // gen framebuffer - { - memset(&g_glFramebufferPBO, 0, sizeof(g_glFramebufferPBO)); - PBO_Init(&g_glFramebufferPBO, GL_RGBA, VRAM_WIDTH, VRAM_HEIGHT, 2); - - // make a special texture - // it will be resized later - glGenTextures(1, &g_fbTexture); - { - glBindTexture(GL_TEXTURE_2D, g_fbTexture); - - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); - - // default to VRAM size - glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, VRAM_WIDTH, VRAM_HEIGHT, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL); - - glBindTexture(GL_TEXTURE_2D, 0); - } - - glGenFramebuffers(1, &g_glBlitFramebuffer); - { - glBindFramebuffer(GL_FRAMEBUFFER, g_glBlitFramebuffer); - - glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, g_fbTexture, 0); - glFramebufferTexture2D(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_TEXTURE_2D, 0, 0); - glFramebufferTexture2D(GL_FRAMEBUFFER, GL_STENCIL_ATTACHMENT, GL_TEXTURE_2D, 0, 0); - - glBindFramebuffer(GL_FRAMEBUFFER, 0); - } - } - - // gen offscreen RT - { - memset(&g_glOffscreenPBO, 0, sizeof(g_glOffscreenPBO)); - PBO_Init(&g_glOffscreenPBO, GL_RGBA, VRAM_WIDTH, VRAM_HEIGHT, 2); - - // offscreen texture render target - glGenTextures(1, &g_offscreenRTTexture); - { - glBindTexture(GL_TEXTURE_2D, g_offscreenRTTexture); - - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); - - // default to VRAM size - glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, VRAM_WIDTH, VRAM_HEIGHT, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL); - - glBindTexture(GL_TEXTURE_2D, 0); - } - - glGenFramebuffers(1, &g_glOffscreenFramebuffer); - { - glBindFramebuffer(GL_FRAMEBUFFER, g_glOffscreenFramebuffer); - - glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, g_offscreenRTTexture, 0); - glFramebufferTexture2D(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_TEXTURE_2D, 0, 0); - glFramebufferTexture2D(GL_FRAMEBUFFER, GL_STENCIL_ATTACHMENT, GL_TEXTURE_2D, 0, 0); - - glBindFramebuffer(GL_FRAMEBUFFER, 0); - } - } - - // gen VRAM textures. - // double-buffered - { - int i; - - glGenTextures(2, g_vramTexturesDouble); - - for(i = 0; i < 2; i++) - { - glBindTexture(GL_TEXTURE_2D, g_vramTexturesDouble[i]); - - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); - - // set storage size - glTexImage2D(GL_TEXTURE_2D, 0, VRAM_INTERNAL_FORMAT, VRAM_WIDTH, VRAM_HEIGHT, 0, VRAM_FORMAT, GL_UNSIGNED_BYTE, NULL); - } - - g_vramTexture = g_vramTexturesDouble[0]; - - glBindTexture(GL_TEXTURE_2D, 0); - - // VRAM framebuffer for offscreen blitting to VRAM - glGenFramebuffers(1, &g_glVRAMFramebuffer); - { - glBindFramebuffer(GL_FRAMEBUFFER, g_glVRAMFramebuffer); - - glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, g_vramTexture, 0); - glFramebufferTexture2D(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_TEXTURE_2D, 0, 0); - glFramebufferTexture2D(GL_FRAMEBUFFER, GL_STENCIL_ATTACHMENT, GL_TEXTURE_2D, 0, 0); - - glBindFramebuffer(GL_FRAMEBUFFER, 0); - } - } - - // gen vertex buffer and index buffer - { - int i; - - glGenBuffers(2, g_glVertexBuffer); - glGenVertexArrays(2, g_glVertexArray); - - for (i = 0; i < 2; i++) - { - glBindVertexArray(g_glVertexArray[i]); - - glBindBuffer(GL_ARRAY_BUFFER, g_glVertexBuffer[i]); - glBufferData(GL_ARRAY_BUFFER, sizeof(GrVertex) * MAX_NUM_POLY_BUFFER_VERTICES, NULL, GL_DYNAMIC_DRAW); - } - - glBindVertexArray(0); - } -#else -#error -#endif - - GR_ResetDevice(); - - return 1; -} - -void PsyX_SetSwapInterval(int interval) -{ - g_swapInterval = interval; -} - -void PsyX_EnableSwapInterval(int enable) -{ - g_enableSwapInterval = enable; -} - -void GR_Ortho2D(float left, float right, float bottom, float top, float znear, float zfar) -{ - float a = 2.0f / (right - left); - float b = 2.0f / (top - bottom); - float c = 2.0f / (znear - zfar); - - float x = (left + right) / (left - right); - float y = (bottom + top) / (bottom - top); - -#if defined(USE_OPENGL) // -1..1 - float z = (znear + zfar) / (znear - zfar); -#endif - - float ortho[16] = { - a, 0, 0, 0, - 0, b, 0, 0, - 0, 0, c, 0, - x, y, z, 1 - }; - -#if defined(USE_OPENGL) - glUniformMatrix4fv(u_projectionLoc, 1, GL_FALSE, ortho); -#endif -} - -void GR_Perspective3D(const float fov, const float width, const float height, const float zNear, const float zFar) -{ - float sinF, cosF; - sinF = sinf(0.5f * fov); - cosF = cosf(0.5f * fov); - - float h = cosF / sinF; - float w = (h * height) / width; - - float persp[16] = { - w, 0, 0, 0, - 0, h, 0, 0, - 0, 0, (zFar + zNear) / (zFar - zNear), 1, - 0, 0, -(2 * zFar * zNear) / (zFar - zNear), 0 - }; - -#if defined(USE_OPENGL) - glUniformMatrix4fv(u_projection3DLoc, 1, GL_FALSE, persp); -#endif -} - -void GR_SetupClipMode(const RECT16* rect, int enable) -{ - float emuScreenAspect, flipOffset; - float psxScreenW, psxScreenH; - float clipRectX, clipRectY, clipRectW, clipRectH; - int scissorOn; - - // [A] isinterlaced dirty hack for widescreen - scissorOn = enable && (activeDispEnv.isinter || - ( rect->x - activeDispEnv.disp.x > 0 || - rect->y - activeDispEnv.disp.y > 0 || - rect->w < activeDispEnv.disp.w - 1 || - rect->h < activeDispEnv.disp.h - 1)); - - GR_SetScissorState(scissorOn); - - if (!scissorOn) - return; - - psxScreenW = activeDispEnv.disp.w; - psxScreenH = activeDispEnv.disp.h; - - // first map to 0..1 - clipRectX = (float)(rect->x - activeDispEnv.disp.x) / psxScreenW; - clipRectY = (float)(rect->y - activeDispEnv.disp.y) / psxScreenH; - clipRectW = (float)(rect->w) / psxScreenW; - clipRectH = (float)(rect->h) / psxScreenH; - - // then map to screen - { - clipRectX -= 0.5f; -#ifdef USE_PGXP - emuScreenAspect = (float)(g_windowWidth) / (float)(g_windowHeight); -#else - emuScreenAspect = (320.0f / 240.0f); -#endif - - clipRectX /= PSX_SCREEN_ASPECT * emuScreenAspect; - clipRectW /= emuScreenAspect * PSX_SCREEN_ASPECT; - - clipRectX += 0.5f; - } - -#if defined(USE_OPENGL) - flipOffset = g_windowHeight - clipRectH * (float)g_windowHeight; - - glScissor(clipRectX * (float)g_windowWidth, - flipOffset - clipRectY * (float)g_windowHeight, - clipRectW * (float)g_windowWidth, - clipRectH * (float)g_windowHeight); -#endif -} - -void PsyX_GetPSXWidescreenMappedViewport(struct _RECT16* rect) -{ -#ifdef USE_PGXP - float psxScreenW, psxScreenH; - float emuScreenAspect; - - emuScreenAspect = (float)(g_windowWidth) / (float)(g_windowHeight); - - psxScreenW = activeDispEnv.disp.w; - psxScreenH = activeDispEnv.disp.h; - - rect->x = activeDispEnv.screen.x; - rect->y = activeDispEnv.screen.y; - - rect->w = psxScreenW * emuScreenAspect * PSX_SCREEN_ASPECT; // windowWidth; - rect->h = psxScreenH; // windowHeight; - - rect->x -= (rect->w - activeDispEnv.disp.w) / 2; - - rect->w += rect->x; -#else - rect->x = activeDispEnv.screen.x; - rect->y = activeDispEnv.screen.y; - rect->w = activeDispEnv.disp.w; - rect->h = activeDispEnv.disp.h; -#endif -} - -void GR_SetShader(const ShaderID shader) -{ - if (g_PreviousShader != shader) - { -#if defined(USE_OPENGL) - glUseProgram(shader); -#else -#error -#endif - - g_PreviousShader = shader; - } -} - - -void GR_SetTexture(TextureID texture, TexFormat texFormat) -{ - switch (texFormat) - { - case TF_4_BIT: - GR_SetShader(g_gte_shader_4.shader); - u_bilinearFilterLoc = g_gte_shader_4.bilinearFilterLoc; - u_projectionLoc = g_gte_shader_4.projectionLoc; - u_projection3DLoc = g_gte_shader_4.projection3DLoc; - break; - case TF_8_BIT: - GR_SetShader(g_gte_shader_8.shader); - u_bilinearFilterLoc = g_gte_shader_8.bilinearFilterLoc; - u_projectionLoc = g_gte_shader_8.projectionLoc; - u_projection3DLoc = g_gte_shader_8.projection3DLoc; - break; - case TF_16_BIT: - GR_SetShader(g_gte_shader_16.shader); - u_bilinearFilterLoc = g_gte_shader_16.bilinearFilterLoc; - u_projectionLoc = g_gte_shader_16.projectionLoc; - u_projection3DLoc = g_gte_shader_16.projection3DLoc; - break; - } - - if (g_texturelessMode) { - texture = g_whiteTexture; - } - - if (g_lastBoundTexture == texture) { - return; - } - -#if defined(USE_OPENGL) - glBindTexture(GL_TEXTURE_2D, texture); - glUniform1i(u_bilinearFilterLoc, g_bilinearFiltering); -#endif - - g_lastBoundTexture = texture; -} - -void GR_DestroyTexture(TextureID texture) -{ - if (texture == -1) - return; - -#if defined(USE_OPENGL) - glDeleteTextures(1, &texture); -#else -#error -#endif -} - -void GR_ClearVRAM(int x, int y, int w, int h, unsigned char r, unsigned char g, unsigned char b) -{ - vram_need_update = 1; - - u_short* dst = vram + x + y * VRAM_WIDTH; - - if (x + w > VRAM_WIDTH) - w = VRAM_WIDTH - x; - - if (y + h > VRAM_HEIGHT) - h = VRAM_HEIGHT - y; - - // clear VRAM region with given color - for (int i = 0; i < h; i++) - { - u_short* tmp = dst; - - for (int j = 0; j < w; j++) - *tmp++ = r | (g << 5) | (b << 11); - - dst += VRAM_WIDTH; - } -} - -void GR_Clear(int x, int y, int w, int h, unsigned char r, unsigned char g, unsigned char b) -{ - framebuffer_need_update = 1; - -#if defined(USE_OPENGL) - glClearColor(r / 255.0f, g / 255.0f, b / 255.0f, 1.0f); - glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); -#endif -} - -void GR_SaveVRAM(const char* outputFileName, int x, int y, int width, int height, int bReadFromFrameBuffer) -{ -#if !defined(__EMSCRIPTEN__) && !defined(__ANDROID__) - -#if defined(USE_OPENGL) - -#define FLIP_Y (VRAM_HEIGHT - i - 1) - -#endif - - FILE* fp = fopen(outputFileName, "wb"); - if (fp == NULL) - return; - - unsigned char TGAheader[12] = { 0,0,2,0,0,0,0,0,0,0,0,0 }; - unsigned char header[6]; - header[0] = (width % 256); - header[1] = (width / 256); - header[2] = (height % 256); - header[3] = (height / 256); - header[4] = 16; - header[5] = 0; - - fwrite(TGAheader, sizeof(unsigned char), 12, fp); - fwrite(header, sizeof(unsigned char), 6, fp); - - for (int i = 0; i < VRAM_HEIGHT; i++) - { - fwrite(vram + VRAM_WIDTH * FLIP_Y, sizeof(short), VRAM_WIDTH, fp); - } - - fclose(fp); - -#undef FLIP_Y -#endif -} - -void GR_CopyRGBAFramebufferToVRAM(u_int* src, int x, int y, int w, int h, int update_vram, int flip_y) -{ - ushort* fb = (ushort*)malloc(w * h * sizeof(ushort)); - uint* data_src = (uint*)src; - ushort* data_dst = (ushort*)fb; - - for (int i = 0; i < h; i++) - { - for (int j = 0; j < w; j++) - { - uint c = *data_src++; - - u_char b = ((c >> 3) & 0x1F); - u_char g = ((c >> 11) & 0x1F); - u_char r = ((c >> 19) & 0x1F); - //u_char a = ((c >> 24) & 0x1F); - - int a = r == g == b == 0 ? 0 : 1; - - *data_dst++ = r | (g << 5) | (b << 10) | (a << 15); - } - } - - ushort* ptr = (ushort*)vram + VRAM_WIDTH * y + x; - - for (int fy = 0; fy < h; fy++) - { - int py = flip_y ? (h - fy - 1) : fy; - ushort* fb_ptr = fb + (h * py / h) * w; - - for (int fx = 0; fx < w; fx++) - ptr[fx] = fb_ptr[w * fx / w]; - - ptr += VRAM_WIDTH; - } - - free(fb); - - if (update_vram) - vram_need_update = 1; -} - -void GR_ReadFramebufferDataToVRAM() -{ - int x, y, w, h; - if (!framebuffer_need_update) - return; - - framebuffer_need_update = 0; - - x = g_PreviousFramebuffer.x; - y = g_PreviousFramebuffer.y; - w = g_PreviousFramebuffer.w; - h = g_PreviousFramebuffer.h; - - // now we can read it back to VRAM texture - { -#if defined(USE_OPENGL) - // reat the texture - glBindTexture(GL_TEXTURE_2D, g_fbTexture); - PBO_Download(&g_glFramebufferPBO); - glBindTexture(GL_TEXTURE_2D, 0); - GR_CopyRGBAFramebufferToVRAM((u_int*)g_glFramebufferPBO.pixels, x, y, w, h, 0, 0); -#endif - } -} - -void GR_SetScissorState(int enable) -{ - if (g_PreviousScissorState == enable) - return; - -#if defined(USE_OPENGL) - if (g_PreviousScissorState) - glDisable(GL_SCISSOR_TEST); - else - glEnable(GL_SCISSOR_TEST); -#endif - g_PreviousScissorState = enable; -} - -void GR_SetOffscreenState(const RECT16* offscreenRect, int enable) -{ - if (enable) - { - // setup render target viewport -#ifdef USE_PGXP - GR_Ortho2D(-0.5f, 0.5f, 0.5f, -0.5f, -1.0f, 1.0f); -#else - GR_Ortho2D(0, offscreenRect->w, offscreenRect->h, 0, -1.0f, 1.0f); -#endif - } - else - { - // setup default viewport -#ifdef USE_PGXP - -#define PGXP_FOV_FACTOR 0.9265f - - const float emuScreenAspect = (float)(g_windowWidth) / (float)(g_windowHeight); - - GR_Ortho2D(-0.5f * emuScreenAspect * PSX_SCREEN_ASPECT, 0.5f * emuScreenAspect * PSX_SCREEN_ASPECT, 0.5f, -0.5f, -1.0f, 1.0f); - GR_Perspective3D(PGXP_FOV_FACTOR, 1.0f, 1.0f / (emuScreenAspect * PSX_SCREEN_ASPECT), g_pgxpZNear, g_pgxpZFar); -#else - GR_Ortho2D(0, activeDispEnv.disp.w, activeDispEnv.disp.h, 0, -1.0f, 1.0f); -#endif - } - - if (g_PreviousOffscreenState == enable) - return; - - g_PreviousOffscreenState = enable; - -#if defined(USE_OPENGL) - if (enable) - { - // set storage size first - if (g_PreviousOffscreen.w != offscreenRect->w && - g_PreviousOffscreen.h != offscreenRect->h) - { - glBindTexture(GL_TEXTURE_2D, g_offscreenRTTexture); - glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, offscreenRect->w, offscreenRect->h, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL); - glBindTexture(GL_TEXTURE_2D, 0); - } - - g_PreviousOffscreen = *offscreenRect; - - GR_SetViewPort(0, 0, offscreenRect->w, offscreenRect->h); - glBindFramebuffer(GL_FRAMEBUFFER, g_glOffscreenFramebuffer); - - // clear it out - glClearColor(0.5f, 0.5f, 0.5f, 0.0f); - glClear(GL_COLOR_BUFFER_BIT); - } - else - { - GR_SetViewPort(0, 0, g_windowWidth, g_windowHeight); - -#if USE_OFFSCREEN_BLIT - // before drawing set source and target - { - glBindFramebuffer(GL_FRAMEBUFFER, g_glVRAMFramebuffer); - - // rebind texture - glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, g_vramTexture, 0); - - // setup draw and read framebuffers - glBindFramebuffer(GL_READ_FRAMEBUFFER, g_glOffscreenFramebuffer); // source is backbuffer - glBindFramebuffer(GL_DRAW_FRAMEBUFFER, g_glVRAMFramebuffer); - - glBlitFramebuffer(0, 0, g_PreviousOffscreen.w, g_PreviousOffscreen.h, - g_PreviousOffscreen.x, g_PreviousOffscreen.y + g_PreviousOffscreen.h, g_PreviousOffscreen.x + g_PreviousOffscreen.w, g_PreviousOffscreen.y, - GL_COLOR_BUFFER_BIT, GL_NEAREST); - - // done, unbind - glBindFramebuffer(GL_READ_FRAMEBUFFER, 0); - glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0); - } -#endif - - glBindFramebuffer(GL_FRAMEBUFFER, 0); - // copy rendering results to VRAM texture - { - // reat the texture - glBindTexture(GL_TEXTURE_2D, g_offscreenRTTexture); - //glGetTexImage(GL_TEXTURE_2D, 0, GL_RGBA, GL_UNSIGNED_BYTE, data); - PBO_Download(&g_glOffscreenPBO); - glBindTexture(GL_TEXTURE_2D, g_lastBoundTexture); - - // Don't forcely update VRAM - GR_CopyRGBAFramebufferToVRAM((u_int*)g_glOffscreenPBO.pixels, - g_PreviousOffscreen.x, g_PreviousOffscreen.y, g_PreviousOffscreen.w, g_PreviousOffscreen.h, - USE_OFFSCREEN_BLIT == 0, 1); - } - - } -#endif -} - -void GR_StoreFrameBuffer(int x, int y, int w, int h) -{ -#if defined(USE_OPENGL) - // set storage size first - if (g_PreviousFramebuffer.w != w || - g_PreviousFramebuffer.h != h) - { - glBindTexture(GL_TEXTURE_2D, g_fbTexture); - glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, w, h, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL); - glBindTexture(GL_TEXTURE_2D, 0); - } - - g_PreviousFramebuffer.x = x; - g_PreviousFramebuffer.y = y; - g_PreviousFramebuffer.w = w; - g_PreviousFramebuffer.h = h; - -#if USE_FRAMEBUFFER_BLIT - glBindFramebuffer(GL_FRAMEBUFFER, g_glBlitFramebuffer); - - // before drawing set source and target - { - // setup draw and read framebuffers - glBindFramebuffer(GL_READ_FRAMEBUFFER, 0); // source is backbuffer - glBindFramebuffer(GL_DRAW_FRAMEBUFFER, g_glBlitFramebuffer); - - glBlitFramebuffer(0, 0, g_windowWidth, g_windowHeight, x, y + h, x + w, y, GL_COLOR_BUFFER_BIT, GL_NEAREST); - - // Blit framebuffer to VRAM screen area - - // before drawing set source and target - glBindFramebuffer(GL_FRAMEBUFFER, g_glVRAMFramebuffer); - - // rebind vram texture - glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, g_vramTexture, 0); - - // setup draw and read framebuffers - glBindFramebuffer(GL_READ_FRAMEBUFFER, g_glBlitFramebuffer); // source is backbuffer - glBindFramebuffer(GL_DRAW_FRAMEBUFFER, g_glVRAMFramebuffer); - - glBlitFramebuffer(0, 0, w, h, - x, y + h, x + w, y, - GL_COLOR_BUFFER_BIT, GL_NEAREST); - - - // done, unbind - glBindFramebuffer(GL_READ_FRAMEBUFFER, 0); - glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0); - } - - // after drawing - glBindFramebuffer(GL_FRAMEBUFFER, 0); - glFlush(); -#endif - - GR_ReadFramebufferDataToVRAM(); -#endif -} - -void GR_CopyVRAM(unsigned short* src, int x, int y, int w, int h, int dst_x, int dst_y) -{ - vram_need_update = 1; - - int stride = w; - - if (!src) - { - framebuffer_need_update = 1; - - src = vram; - stride = VRAM_WIDTH; - } - - src += x + y * stride; - - unsigned short* dst = vram + dst_x + dst_y * VRAM_WIDTH; - - for (int i = 0; i < h; i++) { - SDL_memcpy(dst, src, w * sizeof(short)); - dst += VRAM_WIDTH; - src += stride; - } -} - -void GR_ReadVRAM(unsigned short* dst, int x, int y, int dst_w, int dst_h) -{ - unsigned short* src = vram + x + VRAM_WIDTH * y; - - for (int i = 0; i < dst_h; i++) { - SDL_memcpy(dst, src, dst_w * sizeof(short)); - dst += dst_w; - src += VRAM_WIDTH; - } -} - -void GR_UpdateVRAM() -{ - if (!vram_need_update) - return; - - vram_need_update = 0; - -#if defined(USE_OPENGL) - g_vramTexture = g_vramTexturesDouble[g_vramTextureIdx]; - g_vramTextureIdx++; - g_vramTextureIdx &= 1; - - glBindTexture(GL_TEXTURE_2D, g_vramTexture); - -#if defined(RENDERER_OGL) - glTexImage2D(GL_TEXTURE_2D, 0, VRAM_INTERNAL_FORMAT, VRAM_WIDTH, VRAM_HEIGHT, 0, VRAM_FORMAT, GL_UNSIGNED_BYTE, vram); -#else - glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, VRAM_WIDTH, VRAM_HEIGHT, VRAM_FORMAT, GL_UNSIGNED_BYTE, vram); -#endif - -#endif -} - -void GR_SwapWindow() -{ -#if defined(RENDERER_OGL) - SDL_GL_SwapWindow(g_window); -#elif defined(RENDERER_OGLES) - eglSwapBuffers(eglDisplay, eglSurface); -#endif - - //glFinish(); -} - -void GR_EnableDepth(int enable) -{ - if (g_PreviousDepthMode == enable) - return; - - g_PreviousDepthMode = enable; - -#if defined(USE_OPENGL) - if (enable && g_pgxpZBuffer) - glEnable(GL_DEPTH_TEST); - else - glDisable(GL_DEPTH_TEST); -#endif -} - -void GR_SetStencilMode(int drawPrim) -{ - if (g_PreviousStencilMode == drawPrim) - return; - - g_PreviousStencilMode = drawPrim; - -#if defined(USE_OPENGL) - if (drawPrim) - { - glStencilFunc(GL_ALWAYS, 1, 0x10); - glStencilOp(GL_REPLACE, GL_REPLACE, GL_REPLACE); - } - else - { - glStencilFunc(GL_NOTEQUAL, 1, 0xFF); - glStencilOp(GL_REPLACE, GL_KEEP, GL_KEEP); - } -#endif -} - -void GR_SetBlendMode(BlendMode blendMode) -{ - if (g_PreviousBlendMode == blendMode) - return; - -#if defined(USE_OPENGL) - if (g_PreviousBlendMode == BM_NONE) - glEnable(GL_BLEND); - - switch (blendMode) - { - case BM_NONE: - glDisable(GL_BLEND); - GR_EnableDepth(1); - break; - case BM_AVERAGE: - glBlendFunc(GL_CONSTANT_COLOR, GL_CONSTANT_COLOR); - glBlendEquation(GL_FUNC_ADD); - GR_EnableDepth(0); - break; - case BM_ADD: - glBlendFunc(GL_ONE, GL_ONE); - glBlendEquation(GL_FUNC_ADD); - GR_EnableDepth(0); - break; - case BM_SUBTRACT: - glBlendFunc(GL_ONE, GL_ONE); - glBlendEquation(GL_FUNC_REVERSE_SUBTRACT); - GR_EnableDepth(0); - break; - case BM_ADD_QUATER_SOURCE: - glBlendFunc(GL_CONSTANT_ALPHA, GL_ONE); - glBlendEquation(GL_FUNC_ADD); - GR_EnableDepth(0); - break; - } -#endif - - g_PreviousBlendMode = blendMode; -} - -void GR_SetPolygonOffset(float ofs) -{ -#if defined(USE_OPENGL) - if (ofs == 0.0f) - { - glDisable(GL_POLYGON_OFFSET_FILL); - } - else - { - glEnable(GL_POLYGON_OFFSET_FILL); - glPolygonOffset(0.0f, ofs); - } -#endif -} - -void GR_SetViewPort(int x, int y, int width, int height) -{ -#if defined(USE_OPENGL) - glViewport(x, y, width, height); -#endif -} - -void GR_SetWireframe(int enable) -{ -#if defined(RENDERER_OGL) - glPolygonMode(GL_FRONT_AND_BACK, enable ? GL_LINE : GL_FILL); -#endif -} - -void GR_BindVertexBuffer() -{ -#if defined(USE_OPENGL) - glBindVertexArray(g_glVertexArray[g_curVertexBuffer]); - - glEnableVertexAttribArray(a_position); - glEnableVertexAttribArray(a_texcoord); - glEnableVertexAttribArray(a_color); - glEnableVertexAttribArray(a_extra); - -#if defined(USE_PGXP) - glVertexAttribPointer(a_position, 4, GL_FLOAT, GL_FALSE, sizeof(GrVertex), &((GrVertex*)NULL)->x); - glVertexAttribPointer(a_zw, 4, GL_FLOAT, GL_FALSE, sizeof(GrVertex), &((GrVertex*)NULL)->z); - - glEnableVertexAttribArray(a_zw); -#else - glVertexAttribPointer(a_position, 4, GL_SHORT, GL_FALSE, sizeof(GrVertex), &((GrVertex*)NULL)->x); -#endif - glVertexAttribPointer(a_texcoord, 4, GL_UNSIGNED_BYTE, GL_FALSE, sizeof(GrVertex), &((GrVertex*)NULL)->u); - glVertexAttribPointer(a_color, 4, GL_UNSIGNED_BYTE, GL_TRUE, sizeof(GrVertex), &((GrVertex*)NULL)->r); - glVertexAttribPointer(a_extra, 4, GL_BYTE, GL_FALSE, sizeof(GrVertex), &((GrVertex*)NULL)->tcx); - - g_curVertexBuffer++; - g_curVertexBuffer &= 1; -#else -#error -#endif -} - -void GR_UpdateVertexBuffer(const GrVertex* vertices, int num_vertices) -{ - assert(num_vertices <= MAX_NUM_POLY_BUFFER_VERTICES); - GR_BindVertexBuffer(); - -#if defined(USE_OPENGL) - glBufferSubData(GL_ARRAY_BUFFER, 0, num_vertices * sizeof(GrVertex), vertices); -#else -#error -#endif -} - -void GR_DrawTriangles(int start_vertex, int triangles) -{ -#if defined(USE_OPENGL) - glDrawArrays(GL_TRIANGLES, start_vertex, triangles * 3); -#else -#error -#endif -} diff --git a/src_rebuild/PsyCross/src/render/glad.c b/src_rebuild/PsyCross/src/render/glad.c deleted file mode 100644 index 000b3191..00000000 --- a/src_rebuild/PsyCross/src/render/glad.c +++ /dev/null @@ -1,1888 +0,0 @@ -/* - - OpenGL, OpenGL ES loader generated by glad 0.1.34 on Mon Nov 9 14:41:03 2020. - - Language/Generator: C/C++ - Specification: gl - APIs: gl=3.1, gles2=2.0 - Profile: compatibility - Extensions: - - Loader: True - Local files: True - Omit khrplatform: True - Reproducible: False - - Commandline: - --profile="compatibility" --api="gl=3.1,gles2=2.0" --generator="c" --spec="gl" --local-files --omit-khrplatform --extensions="" - Online: - https://glad.dav1d.de/#profile=compatibility&language=c&specification=gl&loader=on&api=gl%3D3.1&api=gles2%3D2.0 -*/ - -#include -#include -#include - -#include "PsyX/common/glad.h" - -static void* get_proc(const char *namez); - -#if defined(_WIN32) || defined(__CYGWIN__) -#ifndef _WINDOWS_ -#undef APIENTRY -#endif -#include -static HMODULE libGL; - -typedef void* (APIENTRYP PFNWGLGETPROCADDRESSPROC_PRIVATE)(const char*); -static PFNWGLGETPROCADDRESSPROC_PRIVATE gladGetProcAddressPtr; - -#ifdef _MSC_VER -#ifdef __has_include - #if __has_include() - #define HAVE_WINAPIFAMILY 1 - #endif -#elif _MSC_VER >= 1700 && !_USING_V110_SDK71_ - #define HAVE_WINAPIFAMILY 1 -#endif -#endif - -#ifdef HAVE_WINAPIFAMILY - #include - #if !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) && WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP) - #define IS_UWP 1 - #endif -#endif - -static -int open_gl(void) { -#ifndef IS_UWP - libGL = LoadLibraryW(L"opengl32.dll"); - if(libGL != NULL) { - void (* tmp)(void); - tmp = (void(*)(void)) GetProcAddress(libGL, "wglGetProcAddress"); - gladGetProcAddressPtr = (PFNWGLGETPROCADDRESSPROC_PRIVATE) tmp; - return gladGetProcAddressPtr != NULL; - } -#endif - - return 0; -} - -static -void close_gl(void) { - if(libGL != NULL) { - FreeLibrary((HMODULE) libGL); - libGL = NULL; - } -} -#else -#include -static void* libGL; - -#if !defined(__APPLE__) && !defined(__HAIKU__) -typedef void* (APIENTRYP PFNGLXGETPROCADDRESSPROC_PRIVATE)(const char*); -static PFNGLXGETPROCADDRESSPROC_PRIVATE gladGetProcAddressPtr; -#endif - -static -int open_gl(void) { -#ifdef __APPLE__ - static const char *NAMES[] = { - "../Frameworks/OpenGL.framework/OpenGL", - "/Library/Frameworks/OpenGL.framework/OpenGL", - "/System/Library/Frameworks/OpenGL.framework/OpenGL", - "/System/Library/Frameworks/OpenGL.framework/Versions/Current/OpenGL" - }; -#else - static const char *NAMES[] = {"libGL.so.1", "libGL.so"}; -#endif - - unsigned int index = 0; - for(index = 0; index < (sizeof(NAMES) / sizeof(NAMES[0])); index++) { - libGL = dlopen(NAMES[index], RTLD_NOW | RTLD_GLOBAL); - - if(libGL != NULL) { -#if defined(__APPLE__) || defined(__HAIKU__) - return 1; -#else - gladGetProcAddressPtr = (PFNGLXGETPROCADDRESSPROC_PRIVATE)dlsym(libGL, - "glXGetProcAddressARB"); - return gladGetProcAddressPtr != NULL; -#endif - } - } - - return 0; -} - -static -void close_gl(void) { - if(libGL != NULL) { - dlclose(libGL); - libGL = NULL; - } -} -#endif - -static -void* get_proc(const char *namez) { - void* result = NULL; - if(libGL == NULL) return NULL; - -#if !defined(__APPLE__) && !defined(__HAIKU__) - if(gladGetProcAddressPtr != NULL) { - result = gladGetProcAddressPtr(namez); - } -#endif - if(result == NULL) { -#if defined(_WIN32) || defined(__CYGWIN__) - result = (void*)GetProcAddress((HMODULE) libGL, namez); -#else - result = dlsym(libGL, namez); -#endif - } - - return result; -} - -int gladLoadGL(void) { - int status = 0; - - if(open_gl()) { - status = gladLoadGLLoader(&get_proc); - close_gl(); - } - - return status; -} - -struct gladGLversionStruct GLVersion = { 0, 0 }; - -#if defined(GL_ES_VERSION_3_0) || defined(GL_VERSION_3_0) -#define _GLAD_IS_SOME_NEW_VERSION 1 -#endif - -static int max_loaded_major; -static int max_loaded_minor; - -static const char *exts = NULL; -static int num_exts_i = 0; -static char **exts_i = NULL; - -static int get_exts(void) { -#ifdef _GLAD_IS_SOME_NEW_VERSION - if(max_loaded_major < 3) { -#endif - exts = (const char *)glGetString(GL_EXTENSIONS); -#ifdef _GLAD_IS_SOME_NEW_VERSION - } else { - unsigned int index; - - num_exts_i = 0; - glGetIntegerv(GL_NUM_EXTENSIONS, &num_exts_i); - if (num_exts_i > 0) { - exts_i = (char **)malloc((size_t)num_exts_i * (sizeof *exts_i)); - } - - if (exts_i == NULL) { - return 0; - } - - for(index = 0; index < (unsigned)num_exts_i; index++) { - const char *gl_str_tmp = (const char*)glGetStringi(GL_EXTENSIONS, index); - size_t len = strlen(gl_str_tmp); - - char *local_str = (char*)malloc((len+1) * sizeof(char)); - if(local_str != NULL) { - memcpy(local_str, gl_str_tmp, (len+1) * sizeof(char)); - } - exts_i[index] = local_str; - } - } -#endif - return 1; -} - -static void free_exts(void) { - if (exts_i != NULL) { - int index; - for(index = 0; index < num_exts_i; index++) { - free((char *)exts_i[index]); - } - free((void *)exts_i); - exts_i = NULL; - } -} - -static int has_ext(const char *ext) { -#ifdef _GLAD_IS_SOME_NEW_VERSION - if(max_loaded_major < 3) { -#endif - const char *extensions; - const char *loc; - const char *terminator; - extensions = exts; - if(extensions == NULL || ext == NULL) { - return 0; - } - - while(1) { - loc = strstr(extensions, ext); - if(loc == NULL) { - return 0; - } - - terminator = loc + strlen(ext); - if((loc == extensions || *(loc - 1) == ' ') && - (*terminator == ' ' || *terminator == '\0')) { - return 1; - } - extensions = terminator; - } -#ifdef _GLAD_IS_SOME_NEW_VERSION - } else { - int index; - if(exts_i == NULL) return 0; - for(index = 0; index < num_exts_i; index++) { - const char *e = exts_i[index]; - - if(exts_i[index] != NULL && strcmp(e, ext) == 0) { - return 1; - } - } - } -#endif - - return 0; -} -int GLAD_GL_VERSION_1_0 = 0; -int GLAD_GL_VERSION_1_1 = 0; -int GLAD_GL_VERSION_1_2 = 0; -int GLAD_GL_VERSION_1_3 = 0; -int GLAD_GL_VERSION_1_4 = 0; -int GLAD_GL_VERSION_1_5 = 0; -int GLAD_GL_VERSION_2_0 = 0; -int GLAD_GL_VERSION_2_1 = 0; -int GLAD_GL_VERSION_3_0 = 0; -int GLAD_GL_VERSION_3_1 = 0; -int GLAD_GL_ES_VERSION_2_0 = 0; -PFNGLACCUMPROC glad_glAccum = NULL; -PFNGLACTIVETEXTUREPROC glad_glActiveTexture = NULL; -PFNGLALPHAFUNCPROC glad_glAlphaFunc = NULL; -PFNGLARETEXTURESRESIDENTPROC glad_glAreTexturesResident = NULL; -PFNGLARRAYELEMENTPROC glad_glArrayElement = NULL; -PFNGLATTACHSHADERPROC glad_glAttachShader = NULL; -PFNGLBEGINPROC glad_glBegin = NULL; -PFNGLBEGINCONDITIONALRENDERPROC glad_glBeginConditionalRender = NULL; -PFNGLBEGINQUERYPROC glad_glBeginQuery = NULL; -PFNGLBEGINTRANSFORMFEEDBACKPROC glad_glBeginTransformFeedback = NULL; -PFNGLBINDATTRIBLOCATIONPROC glad_glBindAttribLocation = NULL; -PFNGLBINDBUFFERPROC glad_glBindBuffer = NULL; -PFNGLBINDBUFFERBASEPROC glad_glBindBufferBase = NULL; -PFNGLBINDBUFFERRANGEPROC glad_glBindBufferRange = NULL; -PFNGLBINDFRAGDATALOCATIONPROC glad_glBindFragDataLocation = NULL; -PFNGLBINDFRAMEBUFFERPROC glad_glBindFramebuffer = NULL; -PFNGLBINDRENDERBUFFERPROC glad_glBindRenderbuffer = NULL; -PFNGLBINDTEXTUREPROC glad_glBindTexture = NULL; -PFNGLBINDVERTEXARRAYPROC glad_glBindVertexArray = NULL; -PFNGLBITMAPPROC glad_glBitmap = NULL; -PFNGLBLENDCOLORPROC glad_glBlendColor = NULL; -PFNGLBLENDEQUATIONPROC glad_glBlendEquation = NULL; -PFNGLBLENDEQUATIONSEPARATEPROC glad_glBlendEquationSeparate = NULL; -PFNGLBLENDFUNCPROC glad_glBlendFunc = NULL; -PFNGLBLENDFUNCSEPARATEPROC glad_glBlendFuncSeparate = NULL; -PFNGLBLITFRAMEBUFFERPROC glad_glBlitFramebuffer = NULL; -PFNGLBUFFERDATAPROC glad_glBufferData = NULL; -PFNGLBUFFERSUBDATAPROC glad_glBufferSubData = NULL; -PFNGLCALLLISTPROC glad_glCallList = NULL; -PFNGLCALLLISTSPROC glad_glCallLists = NULL; -PFNGLCHECKFRAMEBUFFERSTATUSPROC glad_glCheckFramebufferStatus = NULL; -PFNGLCLAMPCOLORPROC glad_glClampColor = NULL; -PFNGLCLEARPROC glad_glClear = NULL; -PFNGLCLEARACCUMPROC glad_glClearAccum = NULL; -PFNGLCLEARBUFFERFIPROC glad_glClearBufferfi = NULL; -PFNGLCLEARBUFFERFVPROC glad_glClearBufferfv = NULL; -PFNGLCLEARBUFFERIVPROC glad_glClearBufferiv = NULL; -PFNGLCLEARBUFFERUIVPROC glad_glClearBufferuiv = NULL; -PFNGLCLEARCOLORPROC glad_glClearColor = NULL; -PFNGLCLEARDEPTHPROC glad_glClearDepth = NULL; -PFNGLCLEARDEPTHFPROC glad_glClearDepthf = NULL; -PFNGLCLEARINDEXPROC glad_glClearIndex = NULL; -PFNGLCLEARSTENCILPROC glad_glClearStencil = NULL; -PFNGLCLIENTACTIVETEXTUREPROC glad_glClientActiveTexture = NULL; -PFNGLCLIPPLANEPROC glad_glClipPlane = NULL; -PFNGLCOLOR3BPROC glad_glColor3b = NULL; -PFNGLCOLOR3BVPROC glad_glColor3bv = NULL; -PFNGLCOLOR3DPROC glad_glColor3d = NULL; -PFNGLCOLOR3DVPROC glad_glColor3dv = NULL; -PFNGLCOLOR3FPROC glad_glColor3f = NULL; -PFNGLCOLOR3FVPROC glad_glColor3fv = NULL; -PFNGLCOLOR3IPROC glad_glColor3i = NULL; -PFNGLCOLOR3IVPROC glad_glColor3iv = NULL; -PFNGLCOLOR3SPROC glad_glColor3s = NULL; -PFNGLCOLOR3SVPROC glad_glColor3sv = NULL; -PFNGLCOLOR3UBPROC glad_glColor3ub = NULL; -PFNGLCOLOR3UBVPROC glad_glColor3ubv = NULL; -PFNGLCOLOR3UIPROC glad_glColor3ui = NULL; -PFNGLCOLOR3UIVPROC glad_glColor3uiv = NULL; -PFNGLCOLOR3USPROC glad_glColor3us = NULL; -PFNGLCOLOR3USVPROC glad_glColor3usv = NULL; -PFNGLCOLOR4BPROC glad_glColor4b = NULL; -PFNGLCOLOR4BVPROC glad_glColor4bv = NULL; -PFNGLCOLOR4DPROC glad_glColor4d = NULL; -PFNGLCOLOR4DVPROC glad_glColor4dv = NULL; -PFNGLCOLOR4FPROC glad_glColor4f = NULL; -PFNGLCOLOR4FVPROC glad_glColor4fv = NULL; -PFNGLCOLOR4IPROC glad_glColor4i = NULL; -PFNGLCOLOR4IVPROC glad_glColor4iv = NULL; -PFNGLCOLOR4SPROC glad_glColor4s = NULL; -PFNGLCOLOR4SVPROC glad_glColor4sv = NULL; -PFNGLCOLOR4UBPROC glad_glColor4ub = NULL; -PFNGLCOLOR4UBVPROC glad_glColor4ubv = NULL; -PFNGLCOLOR4UIPROC glad_glColor4ui = NULL; -PFNGLCOLOR4UIVPROC glad_glColor4uiv = NULL; -PFNGLCOLOR4USPROC glad_glColor4us = NULL; -PFNGLCOLOR4USVPROC glad_glColor4usv = NULL; -PFNGLCOLORMASKPROC glad_glColorMask = NULL; -PFNGLCOLORMASKIPROC glad_glColorMaski = NULL; -PFNGLCOLORMATERIALPROC glad_glColorMaterial = NULL; -PFNGLCOLORPOINTERPROC glad_glColorPointer = NULL; -PFNGLCOMPILESHADERPROC glad_glCompileShader = NULL; -PFNGLCOMPRESSEDTEXIMAGE1DPROC glad_glCompressedTexImage1D = NULL; -PFNGLCOMPRESSEDTEXIMAGE2DPROC glad_glCompressedTexImage2D = NULL; -PFNGLCOMPRESSEDTEXIMAGE3DPROC glad_glCompressedTexImage3D = NULL; -PFNGLCOMPRESSEDTEXSUBIMAGE1DPROC glad_glCompressedTexSubImage1D = NULL; -PFNGLCOMPRESSEDTEXSUBIMAGE2DPROC glad_glCompressedTexSubImage2D = NULL; -PFNGLCOMPRESSEDTEXSUBIMAGE3DPROC glad_glCompressedTexSubImage3D = NULL; -PFNGLCOPYBUFFERSUBDATAPROC glad_glCopyBufferSubData = NULL; -PFNGLCOPYPIXELSPROC glad_glCopyPixels = NULL; -PFNGLCOPYTEXIMAGE1DPROC glad_glCopyTexImage1D = NULL; -PFNGLCOPYTEXIMAGE2DPROC glad_glCopyTexImage2D = NULL; -PFNGLCOPYTEXSUBIMAGE1DPROC glad_glCopyTexSubImage1D = NULL; -PFNGLCOPYTEXSUBIMAGE2DPROC glad_glCopyTexSubImage2D = NULL; -PFNGLCOPYTEXSUBIMAGE3DPROC glad_glCopyTexSubImage3D = NULL; -PFNGLCREATEPROGRAMPROC glad_glCreateProgram = NULL; -PFNGLCREATESHADERPROC glad_glCreateShader = NULL; -PFNGLCULLFACEPROC glad_glCullFace = NULL; -PFNGLDELETEBUFFERSPROC glad_glDeleteBuffers = NULL; -PFNGLDELETEFRAMEBUFFERSPROC glad_glDeleteFramebuffers = NULL; -PFNGLDELETELISTSPROC glad_glDeleteLists = NULL; -PFNGLDELETEPROGRAMPROC glad_glDeleteProgram = NULL; -PFNGLDELETEQUERIESPROC glad_glDeleteQueries = NULL; -PFNGLDELETERENDERBUFFERSPROC glad_glDeleteRenderbuffers = NULL; -PFNGLDELETESHADERPROC glad_glDeleteShader = NULL; -PFNGLDELETETEXTURESPROC glad_glDeleteTextures = NULL; -PFNGLDELETEVERTEXARRAYSPROC glad_glDeleteVertexArrays = NULL; -PFNGLDEPTHFUNCPROC glad_glDepthFunc = NULL; -PFNGLDEPTHMASKPROC glad_glDepthMask = NULL; -PFNGLDEPTHRANGEPROC glad_glDepthRange = NULL; -PFNGLDEPTHRANGEFPROC glad_glDepthRangef = NULL; -PFNGLDETACHSHADERPROC glad_glDetachShader = NULL; -PFNGLDISABLEPROC glad_glDisable = NULL; -PFNGLDISABLECLIENTSTATEPROC glad_glDisableClientState = NULL; -PFNGLDISABLEVERTEXATTRIBARRAYPROC glad_glDisableVertexAttribArray = NULL; -PFNGLDISABLEIPROC glad_glDisablei = NULL; -PFNGLDRAWARRAYSPROC glad_glDrawArrays = NULL; -PFNGLDRAWARRAYSINSTANCEDPROC glad_glDrawArraysInstanced = NULL; -PFNGLDRAWBUFFERPROC glad_glDrawBuffer = NULL; -PFNGLDRAWBUFFERSPROC glad_glDrawBuffers = NULL; -PFNGLDRAWELEMENTSPROC glad_glDrawElements = NULL; -PFNGLDRAWELEMENTSINSTANCEDPROC glad_glDrawElementsInstanced = NULL; -PFNGLDRAWPIXELSPROC glad_glDrawPixels = NULL; -PFNGLDRAWRANGEELEMENTSPROC glad_glDrawRangeElements = NULL; -PFNGLEDGEFLAGPROC glad_glEdgeFlag = NULL; -PFNGLEDGEFLAGPOINTERPROC glad_glEdgeFlagPointer = NULL; -PFNGLEDGEFLAGVPROC glad_glEdgeFlagv = NULL; -PFNGLENABLEPROC glad_glEnable = NULL; -PFNGLENABLECLIENTSTATEPROC glad_glEnableClientState = NULL; -PFNGLENABLEVERTEXATTRIBARRAYPROC glad_glEnableVertexAttribArray = NULL; -PFNGLENABLEIPROC glad_glEnablei = NULL; -PFNGLENDPROC glad_glEnd = NULL; -PFNGLENDCONDITIONALRENDERPROC glad_glEndConditionalRender = NULL; -PFNGLENDLISTPROC glad_glEndList = NULL; -PFNGLENDQUERYPROC glad_glEndQuery = NULL; -PFNGLENDTRANSFORMFEEDBACKPROC glad_glEndTransformFeedback = NULL; -PFNGLEVALCOORD1DPROC glad_glEvalCoord1d = NULL; -PFNGLEVALCOORD1DVPROC glad_glEvalCoord1dv = NULL; -PFNGLEVALCOORD1FPROC glad_glEvalCoord1f = NULL; -PFNGLEVALCOORD1FVPROC glad_glEvalCoord1fv = NULL; -PFNGLEVALCOORD2DPROC glad_glEvalCoord2d = NULL; -PFNGLEVALCOORD2DVPROC glad_glEvalCoord2dv = NULL; -PFNGLEVALCOORD2FPROC glad_glEvalCoord2f = NULL; -PFNGLEVALCOORD2FVPROC glad_glEvalCoord2fv = NULL; -PFNGLEVALMESH1PROC glad_glEvalMesh1 = NULL; -PFNGLEVALMESH2PROC glad_glEvalMesh2 = NULL; -PFNGLEVALPOINT1PROC glad_glEvalPoint1 = NULL; -PFNGLEVALPOINT2PROC glad_glEvalPoint2 = NULL; -PFNGLFEEDBACKBUFFERPROC glad_glFeedbackBuffer = NULL; -PFNGLFINISHPROC glad_glFinish = NULL; -PFNGLFLUSHPROC glad_glFlush = NULL; -PFNGLFLUSHMAPPEDBUFFERRANGEPROC glad_glFlushMappedBufferRange = NULL; -PFNGLFOGCOORDPOINTERPROC glad_glFogCoordPointer = NULL; -PFNGLFOGCOORDDPROC glad_glFogCoordd = NULL; -PFNGLFOGCOORDDVPROC glad_glFogCoorddv = NULL; -PFNGLFOGCOORDFPROC glad_glFogCoordf = NULL; -PFNGLFOGCOORDFVPROC glad_glFogCoordfv = NULL; -PFNGLFOGFPROC glad_glFogf = NULL; -PFNGLFOGFVPROC glad_glFogfv = NULL; -PFNGLFOGIPROC glad_glFogi = NULL; -PFNGLFOGIVPROC glad_glFogiv = NULL; -PFNGLFRAMEBUFFERRENDERBUFFERPROC glad_glFramebufferRenderbuffer = NULL; -PFNGLFRAMEBUFFERTEXTURE1DPROC glad_glFramebufferTexture1D = NULL; -PFNGLFRAMEBUFFERTEXTURE2DPROC glad_glFramebufferTexture2D = NULL; -PFNGLFRAMEBUFFERTEXTURE3DPROC glad_glFramebufferTexture3D = NULL; -PFNGLFRAMEBUFFERTEXTURELAYERPROC glad_glFramebufferTextureLayer = NULL; -PFNGLFRONTFACEPROC glad_glFrontFace = NULL; -PFNGLFRUSTUMPROC glad_glFrustum = NULL; -PFNGLGENBUFFERSPROC glad_glGenBuffers = NULL; -PFNGLGENFRAMEBUFFERSPROC glad_glGenFramebuffers = NULL; -PFNGLGENLISTSPROC glad_glGenLists = NULL; -PFNGLGENQUERIESPROC glad_glGenQueries = NULL; -PFNGLGENRENDERBUFFERSPROC glad_glGenRenderbuffers = NULL; -PFNGLGENTEXTURESPROC glad_glGenTextures = NULL; -PFNGLGENVERTEXARRAYSPROC glad_glGenVertexArrays = NULL; -PFNGLGENERATEMIPMAPPROC glad_glGenerateMipmap = NULL; -PFNGLGETACTIVEATTRIBPROC glad_glGetActiveAttrib = NULL; -PFNGLGETACTIVEUNIFORMPROC glad_glGetActiveUniform = NULL; -PFNGLGETACTIVEUNIFORMBLOCKNAMEPROC glad_glGetActiveUniformBlockName = NULL; -PFNGLGETACTIVEUNIFORMBLOCKIVPROC glad_glGetActiveUniformBlockiv = NULL; -PFNGLGETACTIVEUNIFORMNAMEPROC glad_glGetActiveUniformName = NULL; -PFNGLGETACTIVEUNIFORMSIVPROC glad_glGetActiveUniformsiv = NULL; -PFNGLGETATTACHEDSHADERSPROC glad_glGetAttachedShaders = NULL; -PFNGLGETATTRIBLOCATIONPROC glad_glGetAttribLocation = NULL; -PFNGLGETBOOLEANI_VPROC glad_glGetBooleani_v = NULL; -PFNGLGETBOOLEANVPROC glad_glGetBooleanv = NULL; -PFNGLGETBUFFERPARAMETERIVPROC glad_glGetBufferParameteriv = NULL; -PFNGLGETBUFFERPOINTERVPROC glad_glGetBufferPointerv = NULL; -PFNGLGETBUFFERSUBDATAPROC glad_glGetBufferSubData = NULL; -PFNGLGETCLIPPLANEPROC glad_glGetClipPlane = NULL; -PFNGLGETCOMPRESSEDTEXIMAGEPROC glad_glGetCompressedTexImage = NULL; -PFNGLGETDOUBLEVPROC glad_glGetDoublev = NULL; -PFNGLGETERRORPROC glad_glGetError = NULL; -PFNGLGETFLOATVPROC glad_glGetFloatv = NULL; -PFNGLGETFRAGDATALOCATIONPROC glad_glGetFragDataLocation = NULL; -PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVPROC glad_glGetFramebufferAttachmentParameteriv = NULL; -PFNGLGETINTEGERI_VPROC glad_glGetIntegeri_v = NULL; -PFNGLGETINTEGERVPROC glad_glGetIntegerv = NULL; -PFNGLGETLIGHTFVPROC glad_glGetLightfv = NULL; -PFNGLGETLIGHTIVPROC glad_glGetLightiv = NULL; -PFNGLGETMAPDVPROC glad_glGetMapdv = NULL; -PFNGLGETMAPFVPROC glad_glGetMapfv = NULL; -PFNGLGETMAPIVPROC glad_glGetMapiv = NULL; -PFNGLGETMATERIALFVPROC glad_glGetMaterialfv = NULL; -PFNGLGETMATERIALIVPROC glad_glGetMaterialiv = NULL; -PFNGLGETPIXELMAPFVPROC glad_glGetPixelMapfv = NULL; -PFNGLGETPIXELMAPUIVPROC glad_glGetPixelMapuiv = NULL; -PFNGLGETPIXELMAPUSVPROC glad_glGetPixelMapusv = NULL; -PFNGLGETPOINTERVPROC glad_glGetPointerv = NULL; -PFNGLGETPOLYGONSTIPPLEPROC glad_glGetPolygonStipple = NULL; -PFNGLGETPROGRAMINFOLOGPROC glad_glGetProgramInfoLog = NULL; -PFNGLGETPROGRAMIVPROC glad_glGetProgramiv = NULL; -PFNGLGETQUERYOBJECTIVPROC glad_glGetQueryObjectiv = NULL; -PFNGLGETQUERYOBJECTUIVPROC glad_glGetQueryObjectuiv = NULL; -PFNGLGETQUERYIVPROC glad_glGetQueryiv = NULL; -PFNGLGETRENDERBUFFERPARAMETERIVPROC glad_glGetRenderbufferParameteriv = NULL; -PFNGLGETSHADERINFOLOGPROC glad_glGetShaderInfoLog = NULL; -PFNGLGETSHADERPRECISIONFORMATPROC glad_glGetShaderPrecisionFormat = NULL; -PFNGLGETSHADERSOURCEPROC glad_glGetShaderSource = NULL; -PFNGLGETSHADERIVPROC glad_glGetShaderiv = NULL; -PFNGLGETSTRINGPROC glad_glGetString = NULL; -PFNGLGETSTRINGIPROC glad_glGetStringi = NULL; -PFNGLGETTEXENVFVPROC glad_glGetTexEnvfv = NULL; -PFNGLGETTEXENVIVPROC glad_glGetTexEnviv = NULL; -PFNGLGETTEXGENDVPROC glad_glGetTexGendv = NULL; -PFNGLGETTEXGENFVPROC glad_glGetTexGenfv = NULL; -PFNGLGETTEXGENIVPROC glad_glGetTexGeniv = NULL; -PFNGLGETTEXIMAGEPROC glad_glGetTexImage = NULL; -PFNGLGETTEXLEVELPARAMETERFVPROC glad_glGetTexLevelParameterfv = NULL; -PFNGLGETTEXLEVELPARAMETERIVPROC glad_glGetTexLevelParameteriv = NULL; -PFNGLGETTEXPARAMETERIIVPROC glad_glGetTexParameterIiv = NULL; -PFNGLGETTEXPARAMETERIUIVPROC glad_glGetTexParameterIuiv = NULL; -PFNGLGETTEXPARAMETERFVPROC glad_glGetTexParameterfv = NULL; -PFNGLGETTEXPARAMETERIVPROC glad_glGetTexParameteriv = NULL; -PFNGLGETTRANSFORMFEEDBACKVARYINGPROC glad_glGetTransformFeedbackVarying = NULL; -PFNGLGETUNIFORMBLOCKINDEXPROC glad_glGetUniformBlockIndex = NULL; -PFNGLGETUNIFORMINDICESPROC glad_glGetUniformIndices = NULL; -PFNGLGETUNIFORMLOCATIONPROC glad_glGetUniformLocation = NULL; -PFNGLGETUNIFORMFVPROC glad_glGetUniformfv = NULL; -PFNGLGETUNIFORMIVPROC glad_glGetUniformiv = NULL; -PFNGLGETUNIFORMUIVPROC glad_glGetUniformuiv = NULL; -PFNGLGETVERTEXATTRIBIIVPROC glad_glGetVertexAttribIiv = NULL; -PFNGLGETVERTEXATTRIBIUIVPROC glad_glGetVertexAttribIuiv = NULL; -PFNGLGETVERTEXATTRIBPOINTERVPROC glad_glGetVertexAttribPointerv = NULL; -PFNGLGETVERTEXATTRIBDVPROC glad_glGetVertexAttribdv = NULL; -PFNGLGETVERTEXATTRIBFVPROC glad_glGetVertexAttribfv = NULL; -PFNGLGETVERTEXATTRIBIVPROC glad_glGetVertexAttribiv = NULL; -PFNGLHINTPROC glad_glHint = NULL; -PFNGLINDEXMASKPROC glad_glIndexMask = NULL; -PFNGLINDEXPOINTERPROC glad_glIndexPointer = NULL; -PFNGLINDEXDPROC glad_glIndexd = NULL; -PFNGLINDEXDVPROC glad_glIndexdv = NULL; -PFNGLINDEXFPROC glad_glIndexf = NULL; -PFNGLINDEXFVPROC glad_glIndexfv = NULL; -PFNGLINDEXIPROC glad_glIndexi = NULL; -PFNGLINDEXIVPROC glad_glIndexiv = NULL; -PFNGLINDEXSPROC glad_glIndexs = NULL; -PFNGLINDEXSVPROC glad_glIndexsv = NULL; -PFNGLINDEXUBPROC glad_glIndexub = NULL; -PFNGLINDEXUBVPROC glad_glIndexubv = NULL; -PFNGLINITNAMESPROC glad_glInitNames = NULL; -PFNGLINTERLEAVEDARRAYSPROC glad_glInterleavedArrays = NULL; -PFNGLISBUFFERPROC glad_glIsBuffer = NULL; -PFNGLISENABLEDPROC glad_glIsEnabled = NULL; -PFNGLISENABLEDIPROC glad_glIsEnabledi = NULL; -PFNGLISFRAMEBUFFERPROC glad_glIsFramebuffer = NULL; -PFNGLISLISTPROC glad_glIsList = NULL; -PFNGLISPROGRAMPROC glad_glIsProgram = NULL; -PFNGLISQUERYPROC glad_glIsQuery = NULL; -PFNGLISRENDERBUFFERPROC glad_glIsRenderbuffer = NULL; -PFNGLISSHADERPROC glad_glIsShader = NULL; -PFNGLISTEXTUREPROC glad_glIsTexture = NULL; -PFNGLISVERTEXARRAYPROC glad_glIsVertexArray = NULL; -PFNGLLIGHTMODELFPROC glad_glLightModelf = NULL; -PFNGLLIGHTMODELFVPROC glad_glLightModelfv = NULL; -PFNGLLIGHTMODELIPROC glad_glLightModeli = NULL; -PFNGLLIGHTMODELIVPROC glad_glLightModeliv = NULL; -PFNGLLIGHTFPROC glad_glLightf = NULL; -PFNGLLIGHTFVPROC glad_glLightfv = NULL; -PFNGLLIGHTIPROC glad_glLighti = NULL; -PFNGLLIGHTIVPROC glad_glLightiv = NULL; -PFNGLLINESTIPPLEPROC glad_glLineStipple = NULL; -PFNGLLINEWIDTHPROC glad_glLineWidth = NULL; -PFNGLLINKPROGRAMPROC glad_glLinkProgram = NULL; -PFNGLLISTBASEPROC glad_glListBase = NULL; -PFNGLLOADIDENTITYPROC glad_glLoadIdentity = NULL; -PFNGLLOADMATRIXDPROC glad_glLoadMatrixd = NULL; -PFNGLLOADMATRIXFPROC glad_glLoadMatrixf = NULL; -PFNGLLOADNAMEPROC glad_glLoadName = NULL; -PFNGLLOADTRANSPOSEMATRIXDPROC glad_glLoadTransposeMatrixd = NULL; -PFNGLLOADTRANSPOSEMATRIXFPROC glad_glLoadTransposeMatrixf = NULL; -PFNGLLOGICOPPROC glad_glLogicOp = NULL; -PFNGLMAP1DPROC glad_glMap1d = NULL; -PFNGLMAP1FPROC glad_glMap1f = NULL; -PFNGLMAP2DPROC glad_glMap2d = NULL; -PFNGLMAP2FPROC glad_glMap2f = NULL; -PFNGLMAPBUFFERPROC glad_glMapBuffer = NULL; -PFNGLMAPBUFFERRANGEPROC glad_glMapBufferRange = NULL; -PFNGLMAPGRID1DPROC glad_glMapGrid1d = NULL; -PFNGLMAPGRID1FPROC glad_glMapGrid1f = NULL; -PFNGLMAPGRID2DPROC glad_glMapGrid2d = NULL; -PFNGLMAPGRID2FPROC glad_glMapGrid2f = NULL; -PFNGLMATERIALFPROC glad_glMaterialf = NULL; -PFNGLMATERIALFVPROC glad_glMaterialfv = NULL; -PFNGLMATERIALIPROC glad_glMateriali = NULL; -PFNGLMATERIALIVPROC glad_glMaterialiv = NULL; -PFNGLMATRIXMODEPROC glad_glMatrixMode = NULL; -PFNGLMULTMATRIXDPROC glad_glMultMatrixd = NULL; -PFNGLMULTMATRIXFPROC glad_glMultMatrixf = NULL; -PFNGLMULTTRANSPOSEMATRIXDPROC glad_glMultTransposeMatrixd = NULL; -PFNGLMULTTRANSPOSEMATRIXFPROC glad_glMultTransposeMatrixf = NULL; -PFNGLMULTIDRAWARRAYSPROC glad_glMultiDrawArrays = NULL; -PFNGLMULTIDRAWELEMENTSPROC glad_glMultiDrawElements = NULL; -PFNGLMULTITEXCOORD1DPROC glad_glMultiTexCoord1d = NULL; -PFNGLMULTITEXCOORD1DVPROC glad_glMultiTexCoord1dv = NULL; -PFNGLMULTITEXCOORD1FPROC glad_glMultiTexCoord1f = NULL; -PFNGLMULTITEXCOORD1FVPROC glad_glMultiTexCoord1fv = NULL; -PFNGLMULTITEXCOORD1IPROC glad_glMultiTexCoord1i = NULL; -PFNGLMULTITEXCOORD1IVPROC glad_glMultiTexCoord1iv = NULL; -PFNGLMULTITEXCOORD1SPROC glad_glMultiTexCoord1s = NULL; -PFNGLMULTITEXCOORD1SVPROC glad_glMultiTexCoord1sv = NULL; -PFNGLMULTITEXCOORD2DPROC glad_glMultiTexCoord2d = NULL; -PFNGLMULTITEXCOORD2DVPROC glad_glMultiTexCoord2dv = NULL; -PFNGLMULTITEXCOORD2FPROC glad_glMultiTexCoord2f = NULL; -PFNGLMULTITEXCOORD2FVPROC glad_glMultiTexCoord2fv = NULL; -PFNGLMULTITEXCOORD2IPROC glad_glMultiTexCoord2i = NULL; -PFNGLMULTITEXCOORD2IVPROC glad_glMultiTexCoord2iv = NULL; -PFNGLMULTITEXCOORD2SPROC glad_glMultiTexCoord2s = NULL; -PFNGLMULTITEXCOORD2SVPROC glad_glMultiTexCoord2sv = NULL; -PFNGLMULTITEXCOORD3DPROC glad_glMultiTexCoord3d = NULL; -PFNGLMULTITEXCOORD3DVPROC glad_glMultiTexCoord3dv = NULL; -PFNGLMULTITEXCOORD3FPROC glad_glMultiTexCoord3f = NULL; -PFNGLMULTITEXCOORD3FVPROC glad_glMultiTexCoord3fv = NULL; -PFNGLMULTITEXCOORD3IPROC glad_glMultiTexCoord3i = NULL; -PFNGLMULTITEXCOORD3IVPROC glad_glMultiTexCoord3iv = NULL; -PFNGLMULTITEXCOORD3SPROC glad_glMultiTexCoord3s = NULL; -PFNGLMULTITEXCOORD3SVPROC glad_glMultiTexCoord3sv = NULL; -PFNGLMULTITEXCOORD4DPROC glad_glMultiTexCoord4d = NULL; -PFNGLMULTITEXCOORD4DVPROC glad_glMultiTexCoord4dv = NULL; -PFNGLMULTITEXCOORD4FPROC glad_glMultiTexCoord4f = NULL; -PFNGLMULTITEXCOORD4FVPROC glad_glMultiTexCoord4fv = NULL; -PFNGLMULTITEXCOORD4IPROC glad_glMultiTexCoord4i = NULL; -PFNGLMULTITEXCOORD4IVPROC glad_glMultiTexCoord4iv = NULL; -PFNGLMULTITEXCOORD4SPROC glad_glMultiTexCoord4s = NULL; -PFNGLMULTITEXCOORD4SVPROC glad_glMultiTexCoord4sv = NULL; -PFNGLNEWLISTPROC glad_glNewList = NULL; -PFNGLNORMAL3BPROC glad_glNormal3b = NULL; -PFNGLNORMAL3BVPROC glad_glNormal3bv = NULL; -PFNGLNORMAL3DPROC glad_glNormal3d = NULL; -PFNGLNORMAL3DVPROC glad_glNormal3dv = NULL; -PFNGLNORMAL3FPROC glad_glNormal3f = NULL; -PFNGLNORMAL3FVPROC glad_glNormal3fv = NULL; -PFNGLNORMAL3IPROC glad_glNormal3i = NULL; -PFNGLNORMAL3IVPROC glad_glNormal3iv = NULL; -PFNGLNORMAL3SPROC glad_glNormal3s = NULL; -PFNGLNORMAL3SVPROC glad_glNormal3sv = NULL; -PFNGLNORMALPOINTERPROC glad_glNormalPointer = NULL; -PFNGLORTHOPROC glad_glOrtho = NULL; -PFNGLPASSTHROUGHPROC glad_glPassThrough = NULL; -PFNGLPIXELMAPFVPROC glad_glPixelMapfv = NULL; -PFNGLPIXELMAPUIVPROC glad_glPixelMapuiv = NULL; -PFNGLPIXELMAPUSVPROC glad_glPixelMapusv = NULL; -PFNGLPIXELSTOREFPROC glad_glPixelStoref = NULL; -PFNGLPIXELSTOREIPROC glad_glPixelStorei = NULL; -PFNGLPIXELTRANSFERFPROC glad_glPixelTransferf = NULL; -PFNGLPIXELTRANSFERIPROC glad_glPixelTransferi = NULL; -PFNGLPIXELZOOMPROC glad_glPixelZoom = NULL; -PFNGLPOINTPARAMETERFPROC glad_glPointParameterf = NULL; -PFNGLPOINTPARAMETERFVPROC glad_glPointParameterfv = NULL; -PFNGLPOINTPARAMETERIPROC glad_glPointParameteri = NULL; -PFNGLPOINTPARAMETERIVPROC glad_glPointParameteriv = NULL; -PFNGLPOINTSIZEPROC glad_glPointSize = NULL; -PFNGLPOLYGONMODEPROC glad_glPolygonMode = NULL; -PFNGLPOLYGONOFFSETPROC glad_glPolygonOffset = NULL; -PFNGLPOLYGONSTIPPLEPROC glad_glPolygonStipple = NULL; -PFNGLPOPATTRIBPROC glad_glPopAttrib = NULL; -PFNGLPOPCLIENTATTRIBPROC glad_glPopClientAttrib = NULL; -PFNGLPOPMATRIXPROC glad_glPopMatrix = NULL; -PFNGLPOPNAMEPROC glad_glPopName = NULL; -PFNGLPRIMITIVERESTARTINDEXPROC glad_glPrimitiveRestartIndex = NULL; -PFNGLPRIORITIZETEXTURESPROC glad_glPrioritizeTextures = NULL; -PFNGLPUSHATTRIBPROC glad_glPushAttrib = NULL; -PFNGLPUSHCLIENTATTRIBPROC glad_glPushClientAttrib = NULL; -PFNGLPUSHMATRIXPROC glad_glPushMatrix = NULL; -PFNGLPUSHNAMEPROC glad_glPushName = NULL; -PFNGLRASTERPOS2DPROC glad_glRasterPos2d = NULL; -PFNGLRASTERPOS2DVPROC glad_glRasterPos2dv = NULL; -PFNGLRASTERPOS2FPROC glad_glRasterPos2f = NULL; -PFNGLRASTERPOS2FVPROC glad_glRasterPos2fv = NULL; -PFNGLRASTERPOS2IPROC glad_glRasterPos2i = NULL; -PFNGLRASTERPOS2IVPROC glad_glRasterPos2iv = NULL; -PFNGLRASTERPOS2SPROC glad_glRasterPos2s = NULL; -PFNGLRASTERPOS2SVPROC glad_glRasterPos2sv = NULL; -PFNGLRASTERPOS3DPROC glad_glRasterPos3d = NULL; -PFNGLRASTERPOS3DVPROC glad_glRasterPos3dv = NULL; -PFNGLRASTERPOS3FPROC glad_glRasterPos3f = NULL; -PFNGLRASTERPOS3FVPROC glad_glRasterPos3fv = NULL; -PFNGLRASTERPOS3IPROC glad_glRasterPos3i = NULL; -PFNGLRASTERPOS3IVPROC glad_glRasterPos3iv = NULL; -PFNGLRASTERPOS3SPROC glad_glRasterPos3s = NULL; -PFNGLRASTERPOS3SVPROC glad_glRasterPos3sv = NULL; -PFNGLRASTERPOS4DPROC glad_glRasterPos4d = NULL; -PFNGLRASTERPOS4DVPROC glad_glRasterPos4dv = NULL; -PFNGLRASTERPOS4FPROC glad_glRasterPos4f = NULL; -PFNGLRASTERPOS4FVPROC glad_glRasterPos4fv = NULL; -PFNGLRASTERPOS4IPROC glad_glRasterPos4i = NULL; -PFNGLRASTERPOS4IVPROC glad_glRasterPos4iv = NULL; -PFNGLRASTERPOS4SPROC glad_glRasterPos4s = NULL; -PFNGLRASTERPOS4SVPROC glad_glRasterPos4sv = NULL; -PFNGLREADBUFFERPROC glad_glReadBuffer = NULL; -PFNGLREADPIXELSPROC glad_glReadPixels = NULL; -PFNGLRECTDPROC glad_glRectd = NULL; -PFNGLRECTDVPROC glad_glRectdv = NULL; -PFNGLRECTFPROC glad_glRectf = NULL; -PFNGLRECTFVPROC glad_glRectfv = NULL; -PFNGLRECTIPROC glad_glRecti = NULL; -PFNGLRECTIVPROC glad_glRectiv = NULL; -PFNGLRECTSPROC glad_glRects = NULL; -PFNGLRECTSVPROC glad_glRectsv = NULL; -PFNGLRELEASESHADERCOMPILERPROC glad_glReleaseShaderCompiler = NULL; -PFNGLRENDERMODEPROC glad_glRenderMode = NULL; -PFNGLRENDERBUFFERSTORAGEPROC glad_glRenderbufferStorage = NULL; -PFNGLRENDERBUFFERSTORAGEMULTISAMPLEPROC glad_glRenderbufferStorageMultisample = NULL; -PFNGLROTATEDPROC glad_glRotated = NULL; -PFNGLROTATEFPROC glad_glRotatef = NULL; -PFNGLSAMPLECOVERAGEPROC glad_glSampleCoverage = NULL; -PFNGLSCALEDPROC glad_glScaled = NULL; -PFNGLSCALEFPROC glad_glScalef = NULL; -PFNGLSCISSORPROC glad_glScissor = NULL; -PFNGLSECONDARYCOLOR3BPROC glad_glSecondaryColor3b = NULL; -PFNGLSECONDARYCOLOR3BVPROC glad_glSecondaryColor3bv = NULL; -PFNGLSECONDARYCOLOR3DPROC glad_glSecondaryColor3d = NULL; -PFNGLSECONDARYCOLOR3DVPROC glad_glSecondaryColor3dv = NULL; -PFNGLSECONDARYCOLOR3FPROC glad_glSecondaryColor3f = NULL; -PFNGLSECONDARYCOLOR3FVPROC glad_glSecondaryColor3fv = NULL; -PFNGLSECONDARYCOLOR3IPROC glad_glSecondaryColor3i = NULL; -PFNGLSECONDARYCOLOR3IVPROC glad_glSecondaryColor3iv = NULL; -PFNGLSECONDARYCOLOR3SPROC glad_glSecondaryColor3s = NULL; -PFNGLSECONDARYCOLOR3SVPROC glad_glSecondaryColor3sv = NULL; -PFNGLSECONDARYCOLOR3UBPROC glad_glSecondaryColor3ub = NULL; -PFNGLSECONDARYCOLOR3UBVPROC glad_glSecondaryColor3ubv = NULL; -PFNGLSECONDARYCOLOR3UIPROC glad_glSecondaryColor3ui = NULL; -PFNGLSECONDARYCOLOR3UIVPROC glad_glSecondaryColor3uiv = NULL; -PFNGLSECONDARYCOLOR3USPROC glad_glSecondaryColor3us = NULL; -PFNGLSECONDARYCOLOR3USVPROC glad_glSecondaryColor3usv = NULL; -PFNGLSECONDARYCOLORPOINTERPROC glad_glSecondaryColorPointer = NULL; -PFNGLSELECTBUFFERPROC glad_glSelectBuffer = NULL; -PFNGLSHADEMODELPROC glad_glShadeModel = NULL; -PFNGLSHADERBINARYPROC glad_glShaderBinary = NULL; -PFNGLSHADERSOURCEPROC glad_glShaderSource = NULL; -PFNGLSTENCILFUNCPROC glad_glStencilFunc = NULL; -PFNGLSTENCILFUNCSEPARATEPROC glad_glStencilFuncSeparate = NULL; -PFNGLSTENCILMASKPROC glad_glStencilMask = NULL; -PFNGLSTENCILMASKSEPARATEPROC glad_glStencilMaskSeparate = NULL; -PFNGLSTENCILOPPROC glad_glStencilOp = NULL; -PFNGLSTENCILOPSEPARATEPROC glad_glStencilOpSeparate = NULL; -PFNGLTEXBUFFERPROC glad_glTexBuffer = NULL; -PFNGLTEXCOORD1DPROC glad_glTexCoord1d = NULL; -PFNGLTEXCOORD1DVPROC glad_glTexCoord1dv = NULL; -PFNGLTEXCOORD1FPROC glad_glTexCoord1f = NULL; -PFNGLTEXCOORD1FVPROC glad_glTexCoord1fv = NULL; -PFNGLTEXCOORD1IPROC glad_glTexCoord1i = NULL; -PFNGLTEXCOORD1IVPROC glad_glTexCoord1iv = NULL; -PFNGLTEXCOORD1SPROC glad_glTexCoord1s = NULL; -PFNGLTEXCOORD1SVPROC glad_glTexCoord1sv = NULL; -PFNGLTEXCOORD2DPROC glad_glTexCoord2d = NULL; -PFNGLTEXCOORD2DVPROC glad_glTexCoord2dv = NULL; -PFNGLTEXCOORD2FPROC glad_glTexCoord2f = NULL; -PFNGLTEXCOORD2FVPROC glad_glTexCoord2fv = NULL; -PFNGLTEXCOORD2IPROC glad_glTexCoord2i = NULL; -PFNGLTEXCOORD2IVPROC glad_glTexCoord2iv = NULL; -PFNGLTEXCOORD2SPROC glad_glTexCoord2s = NULL; -PFNGLTEXCOORD2SVPROC glad_glTexCoord2sv = NULL; -PFNGLTEXCOORD3DPROC glad_glTexCoord3d = NULL; -PFNGLTEXCOORD3DVPROC glad_glTexCoord3dv = NULL; -PFNGLTEXCOORD3FPROC glad_glTexCoord3f = NULL; -PFNGLTEXCOORD3FVPROC glad_glTexCoord3fv = NULL; -PFNGLTEXCOORD3IPROC glad_glTexCoord3i = NULL; -PFNGLTEXCOORD3IVPROC glad_glTexCoord3iv = NULL; -PFNGLTEXCOORD3SPROC glad_glTexCoord3s = NULL; -PFNGLTEXCOORD3SVPROC glad_glTexCoord3sv = NULL; -PFNGLTEXCOORD4DPROC glad_glTexCoord4d = NULL; -PFNGLTEXCOORD4DVPROC glad_glTexCoord4dv = NULL; -PFNGLTEXCOORD4FPROC glad_glTexCoord4f = NULL; -PFNGLTEXCOORD4FVPROC glad_glTexCoord4fv = NULL; -PFNGLTEXCOORD4IPROC glad_glTexCoord4i = NULL; -PFNGLTEXCOORD4IVPROC glad_glTexCoord4iv = NULL; -PFNGLTEXCOORD4SPROC glad_glTexCoord4s = NULL; -PFNGLTEXCOORD4SVPROC glad_glTexCoord4sv = NULL; -PFNGLTEXCOORDPOINTERPROC glad_glTexCoordPointer = NULL; -PFNGLTEXENVFPROC glad_glTexEnvf = NULL; -PFNGLTEXENVFVPROC glad_glTexEnvfv = NULL; -PFNGLTEXENVIPROC glad_glTexEnvi = NULL; -PFNGLTEXENVIVPROC glad_glTexEnviv = NULL; -PFNGLTEXGENDPROC glad_glTexGend = NULL; -PFNGLTEXGENDVPROC glad_glTexGendv = NULL; -PFNGLTEXGENFPROC glad_glTexGenf = NULL; -PFNGLTEXGENFVPROC glad_glTexGenfv = NULL; -PFNGLTEXGENIPROC glad_glTexGeni = NULL; -PFNGLTEXGENIVPROC glad_glTexGeniv = NULL; -PFNGLTEXIMAGE1DPROC glad_glTexImage1D = NULL; -PFNGLTEXIMAGE2DPROC glad_glTexImage2D = NULL; -PFNGLTEXIMAGE3DPROC glad_glTexImage3D = NULL; -PFNGLTEXPARAMETERIIVPROC glad_glTexParameterIiv = NULL; -PFNGLTEXPARAMETERIUIVPROC glad_glTexParameterIuiv = NULL; -PFNGLTEXPARAMETERFPROC glad_glTexParameterf = NULL; -PFNGLTEXPARAMETERFVPROC glad_glTexParameterfv = NULL; -PFNGLTEXPARAMETERIPROC glad_glTexParameteri = NULL; -PFNGLTEXPARAMETERIVPROC glad_glTexParameteriv = NULL; -PFNGLTEXSUBIMAGE1DPROC glad_glTexSubImage1D = NULL; -PFNGLTEXSUBIMAGE2DPROC glad_glTexSubImage2D = NULL; -PFNGLTEXSUBIMAGE3DPROC glad_glTexSubImage3D = NULL; -PFNGLTRANSFORMFEEDBACKVARYINGSPROC glad_glTransformFeedbackVaryings = NULL; -PFNGLTRANSLATEDPROC glad_glTranslated = NULL; -PFNGLTRANSLATEFPROC glad_glTranslatef = NULL; -PFNGLUNIFORM1FPROC glad_glUniform1f = NULL; -PFNGLUNIFORM1FVPROC glad_glUniform1fv = NULL; -PFNGLUNIFORM1IPROC glad_glUniform1i = NULL; -PFNGLUNIFORM1IVPROC glad_glUniform1iv = NULL; -PFNGLUNIFORM1UIPROC glad_glUniform1ui = NULL; -PFNGLUNIFORM1UIVPROC glad_glUniform1uiv = NULL; -PFNGLUNIFORM2FPROC glad_glUniform2f = NULL; -PFNGLUNIFORM2FVPROC glad_glUniform2fv = NULL; -PFNGLUNIFORM2IPROC glad_glUniform2i = NULL; -PFNGLUNIFORM2IVPROC glad_glUniform2iv = NULL; -PFNGLUNIFORM2UIPROC glad_glUniform2ui = NULL; -PFNGLUNIFORM2UIVPROC glad_glUniform2uiv = NULL; -PFNGLUNIFORM3FPROC glad_glUniform3f = NULL; -PFNGLUNIFORM3FVPROC glad_glUniform3fv = NULL; -PFNGLUNIFORM3IPROC glad_glUniform3i = NULL; -PFNGLUNIFORM3IVPROC glad_glUniform3iv = NULL; -PFNGLUNIFORM3UIPROC glad_glUniform3ui = NULL; -PFNGLUNIFORM3UIVPROC glad_glUniform3uiv = NULL; -PFNGLUNIFORM4FPROC glad_glUniform4f = NULL; -PFNGLUNIFORM4FVPROC glad_glUniform4fv = NULL; -PFNGLUNIFORM4IPROC glad_glUniform4i = NULL; -PFNGLUNIFORM4IVPROC glad_glUniform4iv = NULL; -PFNGLUNIFORM4UIPROC glad_glUniform4ui = NULL; -PFNGLUNIFORM4UIVPROC glad_glUniform4uiv = NULL; -PFNGLUNIFORMBLOCKBINDINGPROC glad_glUniformBlockBinding = NULL; -PFNGLUNIFORMMATRIX2FVPROC glad_glUniformMatrix2fv = NULL; -PFNGLUNIFORMMATRIX2X3FVPROC glad_glUniformMatrix2x3fv = NULL; -PFNGLUNIFORMMATRIX2X4FVPROC glad_glUniformMatrix2x4fv = NULL; -PFNGLUNIFORMMATRIX3FVPROC glad_glUniformMatrix3fv = NULL; -PFNGLUNIFORMMATRIX3X2FVPROC glad_glUniformMatrix3x2fv = NULL; -PFNGLUNIFORMMATRIX3X4FVPROC glad_glUniformMatrix3x4fv = NULL; -PFNGLUNIFORMMATRIX4FVPROC glad_glUniformMatrix4fv = NULL; -PFNGLUNIFORMMATRIX4X2FVPROC glad_glUniformMatrix4x2fv = NULL; -PFNGLUNIFORMMATRIX4X3FVPROC glad_glUniformMatrix4x3fv = NULL; -PFNGLUNMAPBUFFERPROC glad_glUnmapBuffer = NULL; -PFNGLUSEPROGRAMPROC glad_glUseProgram = NULL; -PFNGLVALIDATEPROGRAMPROC glad_glValidateProgram = NULL; -PFNGLVERTEX2DPROC glad_glVertex2d = NULL; -PFNGLVERTEX2DVPROC glad_glVertex2dv = NULL; -PFNGLVERTEX2FPROC glad_glVertex2f = NULL; -PFNGLVERTEX2FVPROC glad_glVertex2fv = NULL; -PFNGLVERTEX2IPROC glad_glVertex2i = NULL; -PFNGLVERTEX2IVPROC glad_glVertex2iv = NULL; -PFNGLVERTEX2SPROC glad_glVertex2s = NULL; -PFNGLVERTEX2SVPROC glad_glVertex2sv = NULL; -PFNGLVERTEX3DPROC glad_glVertex3d = NULL; -PFNGLVERTEX3DVPROC glad_glVertex3dv = NULL; -PFNGLVERTEX3FPROC glad_glVertex3f = NULL; -PFNGLVERTEX3FVPROC glad_glVertex3fv = NULL; -PFNGLVERTEX3IPROC glad_glVertex3i = NULL; -PFNGLVERTEX3IVPROC glad_glVertex3iv = NULL; -PFNGLVERTEX3SPROC glad_glVertex3s = NULL; -PFNGLVERTEX3SVPROC glad_glVertex3sv = NULL; -PFNGLVERTEX4DPROC glad_glVertex4d = NULL; -PFNGLVERTEX4DVPROC glad_glVertex4dv = NULL; -PFNGLVERTEX4FPROC glad_glVertex4f = NULL; -PFNGLVERTEX4FVPROC glad_glVertex4fv = NULL; -PFNGLVERTEX4IPROC glad_glVertex4i = NULL; -PFNGLVERTEX4IVPROC glad_glVertex4iv = NULL; -PFNGLVERTEX4SPROC glad_glVertex4s = NULL; -PFNGLVERTEX4SVPROC glad_glVertex4sv = NULL; -PFNGLVERTEXATTRIB1DPROC glad_glVertexAttrib1d = NULL; -PFNGLVERTEXATTRIB1DVPROC glad_glVertexAttrib1dv = NULL; -PFNGLVERTEXATTRIB1FPROC glad_glVertexAttrib1f = NULL; -PFNGLVERTEXATTRIB1FVPROC glad_glVertexAttrib1fv = NULL; -PFNGLVERTEXATTRIB1SPROC glad_glVertexAttrib1s = NULL; -PFNGLVERTEXATTRIB1SVPROC glad_glVertexAttrib1sv = NULL; -PFNGLVERTEXATTRIB2DPROC glad_glVertexAttrib2d = NULL; -PFNGLVERTEXATTRIB2DVPROC glad_glVertexAttrib2dv = NULL; -PFNGLVERTEXATTRIB2FPROC glad_glVertexAttrib2f = NULL; -PFNGLVERTEXATTRIB2FVPROC glad_glVertexAttrib2fv = NULL; -PFNGLVERTEXATTRIB2SPROC glad_glVertexAttrib2s = NULL; -PFNGLVERTEXATTRIB2SVPROC glad_glVertexAttrib2sv = NULL; -PFNGLVERTEXATTRIB3DPROC glad_glVertexAttrib3d = NULL; -PFNGLVERTEXATTRIB3DVPROC glad_glVertexAttrib3dv = NULL; -PFNGLVERTEXATTRIB3FPROC glad_glVertexAttrib3f = NULL; -PFNGLVERTEXATTRIB3FVPROC glad_glVertexAttrib3fv = NULL; -PFNGLVERTEXATTRIB3SPROC glad_glVertexAttrib3s = NULL; -PFNGLVERTEXATTRIB3SVPROC glad_glVertexAttrib3sv = NULL; -PFNGLVERTEXATTRIB4NBVPROC glad_glVertexAttrib4Nbv = NULL; -PFNGLVERTEXATTRIB4NIVPROC glad_glVertexAttrib4Niv = NULL; -PFNGLVERTEXATTRIB4NSVPROC glad_glVertexAttrib4Nsv = NULL; -PFNGLVERTEXATTRIB4NUBPROC glad_glVertexAttrib4Nub = NULL; -PFNGLVERTEXATTRIB4NUBVPROC glad_glVertexAttrib4Nubv = NULL; -PFNGLVERTEXATTRIB4NUIVPROC glad_glVertexAttrib4Nuiv = NULL; -PFNGLVERTEXATTRIB4NUSVPROC glad_glVertexAttrib4Nusv = NULL; -PFNGLVERTEXATTRIB4BVPROC glad_glVertexAttrib4bv = NULL; -PFNGLVERTEXATTRIB4DPROC glad_glVertexAttrib4d = NULL; -PFNGLVERTEXATTRIB4DVPROC glad_glVertexAttrib4dv = NULL; -PFNGLVERTEXATTRIB4FPROC glad_glVertexAttrib4f = NULL; -PFNGLVERTEXATTRIB4FVPROC glad_glVertexAttrib4fv = NULL; -PFNGLVERTEXATTRIB4IVPROC glad_glVertexAttrib4iv = NULL; -PFNGLVERTEXATTRIB4SPROC glad_glVertexAttrib4s = NULL; -PFNGLVERTEXATTRIB4SVPROC glad_glVertexAttrib4sv = NULL; -PFNGLVERTEXATTRIB4UBVPROC glad_glVertexAttrib4ubv = NULL; -PFNGLVERTEXATTRIB4UIVPROC glad_glVertexAttrib4uiv = NULL; -PFNGLVERTEXATTRIB4USVPROC glad_glVertexAttrib4usv = NULL; -PFNGLVERTEXATTRIBI1IPROC glad_glVertexAttribI1i = NULL; -PFNGLVERTEXATTRIBI1IVPROC glad_glVertexAttribI1iv = NULL; -PFNGLVERTEXATTRIBI1UIPROC glad_glVertexAttribI1ui = NULL; -PFNGLVERTEXATTRIBI1UIVPROC glad_glVertexAttribI1uiv = NULL; -PFNGLVERTEXATTRIBI2IPROC glad_glVertexAttribI2i = NULL; -PFNGLVERTEXATTRIBI2IVPROC glad_glVertexAttribI2iv = NULL; -PFNGLVERTEXATTRIBI2UIPROC glad_glVertexAttribI2ui = NULL; -PFNGLVERTEXATTRIBI2UIVPROC glad_glVertexAttribI2uiv = NULL; -PFNGLVERTEXATTRIBI3IPROC glad_glVertexAttribI3i = NULL; -PFNGLVERTEXATTRIBI3IVPROC glad_glVertexAttribI3iv = NULL; -PFNGLVERTEXATTRIBI3UIPROC glad_glVertexAttribI3ui = NULL; -PFNGLVERTEXATTRIBI3UIVPROC glad_glVertexAttribI3uiv = NULL; -PFNGLVERTEXATTRIBI4BVPROC glad_glVertexAttribI4bv = NULL; -PFNGLVERTEXATTRIBI4IPROC glad_glVertexAttribI4i = NULL; -PFNGLVERTEXATTRIBI4IVPROC glad_glVertexAttribI4iv = NULL; -PFNGLVERTEXATTRIBI4SVPROC glad_glVertexAttribI4sv = NULL; -PFNGLVERTEXATTRIBI4UBVPROC glad_glVertexAttribI4ubv = NULL; -PFNGLVERTEXATTRIBI4UIPROC glad_glVertexAttribI4ui = NULL; -PFNGLVERTEXATTRIBI4UIVPROC glad_glVertexAttribI4uiv = NULL; -PFNGLVERTEXATTRIBI4USVPROC glad_glVertexAttribI4usv = NULL; -PFNGLVERTEXATTRIBIPOINTERPROC glad_glVertexAttribIPointer = NULL; -PFNGLVERTEXATTRIBPOINTERPROC glad_glVertexAttribPointer = NULL; -PFNGLVERTEXPOINTERPROC glad_glVertexPointer = NULL; -PFNGLVIEWPORTPROC glad_glViewport = NULL; -PFNGLWINDOWPOS2DPROC glad_glWindowPos2d = NULL; -PFNGLWINDOWPOS2DVPROC glad_glWindowPos2dv = NULL; -PFNGLWINDOWPOS2FPROC glad_glWindowPos2f = NULL; -PFNGLWINDOWPOS2FVPROC glad_glWindowPos2fv = NULL; -PFNGLWINDOWPOS2IPROC glad_glWindowPos2i = NULL; -PFNGLWINDOWPOS2IVPROC glad_glWindowPos2iv = NULL; -PFNGLWINDOWPOS2SPROC glad_glWindowPos2s = NULL; -PFNGLWINDOWPOS2SVPROC glad_glWindowPos2sv = NULL; -PFNGLWINDOWPOS3DPROC glad_glWindowPos3d = NULL; -PFNGLWINDOWPOS3DVPROC glad_glWindowPos3dv = NULL; -PFNGLWINDOWPOS3FPROC glad_glWindowPos3f = NULL; -PFNGLWINDOWPOS3FVPROC glad_glWindowPos3fv = NULL; -PFNGLWINDOWPOS3IPROC glad_glWindowPos3i = NULL; -PFNGLWINDOWPOS3IVPROC glad_glWindowPos3iv = NULL; -PFNGLWINDOWPOS3SPROC glad_glWindowPos3s = NULL; -PFNGLWINDOWPOS3SVPROC glad_glWindowPos3sv = NULL; -static void load_GL_VERSION_1_0(GLADloadproc load) { - if(!GLAD_GL_VERSION_1_0) return; - glad_glCullFace = (PFNGLCULLFACEPROC)load("glCullFace"); - glad_glFrontFace = (PFNGLFRONTFACEPROC)load("glFrontFace"); - glad_glHint = (PFNGLHINTPROC)load("glHint"); - glad_glLineWidth = (PFNGLLINEWIDTHPROC)load("glLineWidth"); - glad_glPointSize = (PFNGLPOINTSIZEPROC)load("glPointSize"); - glad_glPolygonMode = (PFNGLPOLYGONMODEPROC)load("glPolygonMode"); - glad_glScissor = (PFNGLSCISSORPROC)load("glScissor"); - glad_glTexParameterf = (PFNGLTEXPARAMETERFPROC)load("glTexParameterf"); - glad_glTexParameterfv = (PFNGLTEXPARAMETERFVPROC)load("glTexParameterfv"); - glad_glTexParameteri = (PFNGLTEXPARAMETERIPROC)load("glTexParameteri"); - glad_glTexParameteriv = (PFNGLTEXPARAMETERIVPROC)load("glTexParameteriv"); - glad_glTexImage1D = (PFNGLTEXIMAGE1DPROC)load("glTexImage1D"); - glad_glTexImage2D = (PFNGLTEXIMAGE2DPROC)load("glTexImage2D"); - glad_glDrawBuffer = (PFNGLDRAWBUFFERPROC)load("glDrawBuffer"); - glad_glClear = (PFNGLCLEARPROC)load("glClear"); - glad_glClearColor = (PFNGLCLEARCOLORPROC)load("glClearColor"); - glad_glClearStencil = (PFNGLCLEARSTENCILPROC)load("glClearStencil"); - glad_glClearDepth = (PFNGLCLEARDEPTHPROC)load("glClearDepth"); - glad_glStencilMask = (PFNGLSTENCILMASKPROC)load("glStencilMask"); - glad_glColorMask = (PFNGLCOLORMASKPROC)load("glColorMask"); - glad_glDepthMask = (PFNGLDEPTHMASKPROC)load("glDepthMask"); - glad_glDisable = (PFNGLDISABLEPROC)load("glDisable"); - glad_glEnable = (PFNGLENABLEPROC)load("glEnable"); - glad_glFinish = (PFNGLFINISHPROC)load("glFinish"); - glad_glFlush = (PFNGLFLUSHPROC)load("glFlush"); - glad_glBlendFunc = (PFNGLBLENDFUNCPROC)load("glBlendFunc"); - glad_glLogicOp = (PFNGLLOGICOPPROC)load("glLogicOp"); - glad_glStencilFunc = (PFNGLSTENCILFUNCPROC)load("glStencilFunc"); - glad_glStencilOp = (PFNGLSTENCILOPPROC)load("glStencilOp"); - glad_glDepthFunc = (PFNGLDEPTHFUNCPROC)load("glDepthFunc"); - glad_glPixelStoref = (PFNGLPIXELSTOREFPROC)load("glPixelStoref"); - glad_glPixelStorei = (PFNGLPIXELSTOREIPROC)load("glPixelStorei"); - glad_glReadBuffer = (PFNGLREADBUFFERPROC)load("glReadBuffer"); - glad_glReadPixels = (PFNGLREADPIXELSPROC)load("glReadPixels"); - glad_glGetBooleanv = (PFNGLGETBOOLEANVPROC)load("glGetBooleanv"); - glad_glGetDoublev = (PFNGLGETDOUBLEVPROC)load("glGetDoublev"); - glad_glGetError = (PFNGLGETERRORPROC)load("glGetError"); - glad_glGetFloatv = (PFNGLGETFLOATVPROC)load("glGetFloatv"); - glad_glGetIntegerv = (PFNGLGETINTEGERVPROC)load("glGetIntegerv"); - glad_glGetString = (PFNGLGETSTRINGPROC)load("glGetString"); - glad_glGetTexImage = (PFNGLGETTEXIMAGEPROC)load("glGetTexImage"); - glad_glGetTexParameterfv = (PFNGLGETTEXPARAMETERFVPROC)load("glGetTexParameterfv"); - glad_glGetTexParameteriv = (PFNGLGETTEXPARAMETERIVPROC)load("glGetTexParameteriv"); - glad_glGetTexLevelParameterfv = (PFNGLGETTEXLEVELPARAMETERFVPROC)load("glGetTexLevelParameterfv"); - glad_glGetTexLevelParameteriv = (PFNGLGETTEXLEVELPARAMETERIVPROC)load("glGetTexLevelParameteriv"); - glad_glIsEnabled = (PFNGLISENABLEDPROC)load("glIsEnabled"); - glad_glDepthRange = (PFNGLDEPTHRANGEPROC)load("glDepthRange"); - glad_glViewport = (PFNGLVIEWPORTPROC)load("glViewport"); - glad_glNewList = (PFNGLNEWLISTPROC)load("glNewList"); - glad_glEndList = (PFNGLENDLISTPROC)load("glEndList"); - glad_glCallList = (PFNGLCALLLISTPROC)load("glCallList"); - glad_glCallLists = (PFNGLCALLLISTSPROC)load("glCallLists"); - glad_glDeleteLists = (PFNGLDELETELISTSPROC)load("glDeleteLists"); - glad_glGenLists = (PFNGLGENLISTSPROC)load("glGenLists"); - glad_glListBase = (PFNGLLISTBASEPROC)load("glListBase"); - glad_glBegin = (PFNGLBEGINPROC)load("glBegin"); - glad_glBitmap = (PFNGLBITMAPPROC)load("glBitmap"); - glad_glColor3b = (PFNGLCOLOR3BPROC)load("glColor3b"); - glad_glColor3bv = (PFNGLCOLOR3BVPROC)load("glColor3bv"); - glad_glColor3d = (PFNGLCOLOR3DPROC)load("glColor3d"); - glad_glColor3dv = (PFNGLCOLOR3DVPROC)load("glColor3dv"); - glad_glColor3f = (PFNGLCOLOR3FPROC)load("glColor3f"); - glad_glColor3fv = (PFNGLCOLOR3FVPROC)load("glColor3fv"); - glad_glColor3i = (PFNGLCOLOR3IPROC)load("glColor3i"); - glad_glColor3iv = (PFNGLCOLOR3IVPROC)load("glColor3iv"); - glad_glColor3s = (PFNGLCOLOR3SPROC)load("glColor3s"); - glad_glColor3sv = (PFNGLCOLOR3SVPROC)load("glColor3sv"); - glad_glColor3ub = (PFNGLCOLOR3UBPROC)load("glColor3ub"); - glad_glColor3ubv = (PFNGLCOLOR3UBVPROC)load("glColor3ubv"); - glad_glColor3ui = (PFNGLCOLOR3UIPROC)load("glColor3ui"); - glad_glColor3uiv = (PFNGLCOLOR3UIVPROC)load("glColor3uiv"); - glad_glColor3us = (PFNGLCOLOR3USPROC)load("glColor3us"); - glad_glColor3usv = (PFNGLCOLOR3USVPROC)load("glColor3usv"); - glad_glColor4b = (PFNGLCOLOR4BPROC)load("glColor4b"); - glad_glColor4bv = (PFNGLCOLOR4BVPROC)load("glColor4bv"); - glad_glColor4d = (PFNGLCOLOR4DPROC)load("glColor4d"); - glad_glColor4dv = (PFNGLCOLOR4DVPROC)load("glColor4dv"); - glad_glColor4f = (PFNGLCOLOR4FPROC)load("glColor4f"); - glad_glColor4fv = (PFNGLCOLOR4FVPROC)load("glColor4fv"); - glad_glColor4i = (PFNGLCOLOR4IPROC)load("glColor4i"); - glad_glColor4iv = (PFNGLCOLOR4IVPROC)load("glColor4iv"); - glad_glColor4s = (PFNGLCOLOR4SPROC)load("glColor4s"); - glad_glColor4sv = (PFNGLCOLOR4SVPROC)load("glColor4sv"); - glad_glColor4ub = (PFNGLCOLOR4UBPROC)load("glColor4ub"); - glad_glColor4ubv = (PFNGLCOLOR4UBVPROC)load("glColor4ubv"); - glad_glColor4ui = (PFNGLCOLOR4UIPROC)load("glColor4ui"); - glad_glColor4uiv = (PFNGLCOLOR4UIVPROC)load("glColor4uiv"); - glad_glColor4us = (PFNGLCOLOR4USPROC)load("glColor4us"); - glad_glColor4usv = (PFNGLCOLOR4USVPROC)load("glColor4usv"); - glad_glEdgeFlag = (PFNGLEDGEFLAGPROC)load("glEdgeFlag"); - glad_glEdgeFlagv = (PFNGLEDGEFLAGVPROC)load("glEdgeFlagv"); - glad_glEnd = (PFNGLENDPROC)load("glEnd"); - glad_glIndexd = (PFNGLINDEXDPROC)load("glIndexd"); - glad_glIndexdv = (PFNGLINDEXDVPROC)load("glIndexdv"); - glad_glIndexf = (PFNGLINDEXFPROC)load("glIndexf"); - glad_glIndexfv = (PFNGLINDEXFVPROC)load("glIndexfv"); - glad_glIndexi = (PFNGLINDEXIPROC)load("glIndexi"); - glad_glIndexiv = (PFNGLINDEXIVPROC)load("glIndexiv"); - glad_glIndexs = (PFNGLINDEXSPROC)load("glIndexs"); - glad_glIndexsv = (PFNGLINDEXSVPROC)load("glIndexsv"); - glad_glNormal3b = (PFNGLNORMAL3BPROC)load("glNormal3b"); - glad_glNormal3bv = (PFNGLNORMAL3BVPROC)load("glNormal3bv"); - glad_glNormal3d = (PFNGLNORMAL3DPROC)load("glNormal3d"); - glad_glNormal3dv = (PFNGLNORMAL3DVPROC)load("glNormal3dv"); - glad_glNormal3f = (PFNGLNORMAL3FPROC)load("glNormal3f"); - glad_glNormal3fv = (PFNGLNORMAL3FVPROC)load("glNormal3fv"); - glad_glNormal3i = (PFNGLNORMAL3IPROC)load("glNormal3i"); - glad_glNormal3iv = (PFNGLNORMAL3IVPROC)load("glNormal3iv"); - glad_glNormal3s = (PFNGLNORMAL3SPROC)load("glNormal3s"); - glad_glNormal3sv = (PFNGLNORMAL3SVPROC)load("glNormal3sv"); - glad_glRasterPos2d = (PFNGLRASTERPOS2DPROC)load("glRasterPos2d"); - glad_glRasterPos2dv = (PFNGLRASTERPOS2DVPROC)load("glRasterPos2dv"); - glad_glRasterPos2f = (PFNGLRASTERPOS2FPROC)load("glRasterPos2f"); - glad_glRasterPos2fv = (PFNGLRASTERPOS2FVPROC)load("glRasterPos2fv"); - glad_glRasterPos2i = (PFNGLRASTERPOS2IPROC)load("glRasterPos2i"); - glad_glRasterPos2iv = (PFNGLRASTERPOS2IVPROC)load("glRasterPos2iv"); - glad_glRasterPos2s = (PFNGLRASTERPOS2SPROC)load("glRasterPos2s"); - glad_glRasterPos2sv = (PFNGLRASTERPOS2SVPROC)load("glRasterPos2sv"); - glad_glRasterPos3d = (PFNGLRASTERPOS3DPROC)load("glRasterPos3d"); - glad_glRasterPos3dv = (PFNGLRASTERPOS3DVPROC)load("glRasterPos3dv"); - glad_glRasterPos3f = (PFNGLRASTERPOS3FPROC)load("glRasterPos3f"); - glad_glRasterPos3fv = (PFNGLRASTERPOS3FVPROC)load("glRasterPos3fv"); - glad_glRasterPos3i = (PFNGLRASTERPOS3IPROC)load("glRasterPos3i"); - glad_glRasterPos3iv = (PFNGLRASTERPOS3IVPROC)load("glRasterPos3iv"); - glad_glRasterPos3s = (PFNGLRASTERPOS3SPROC)load("glRasterPos3s"); - glad_glRasterPos3sv = (PFNGLRASTERPOS3SVPROC)load("glRasterPos3sv"); - glad_glRasterPos4d = (PFNGLRASTERPOS4DPROC)load("glRasterPos4d"); - glad_glRasterPos4dv = (PFNGLRASTERPOS4DVPROC)load("glRasterPos4dv"); - glad_glRasterPos4f = (PFNGLRASTERPOS4FPROC)load("glRasterPos4f"); - glad_glRasterPos4fv = (PFNGLRASTERPOS4FVPROC)load("glRasterPos4fv"); - glad_glRasterPos4i = (PFNGLRASTERPOS4IPROC)load("glRasterPos4i"); - glad_glRasterPos4iv = (PFNGLRASTERPOS4IVPROC)load("glRasterPos4iv"); - glad_glRasterPos4s = (PFNGLRASTERPOS4SPROC)load("glRasterPos4s"); - glad_glRasterPos4sv = (PFNGLRASTERPOS4SVPROC)load("glRasterPos4sv"); - glad_glRectd = (PFNGLRECTDPROC)load("glRectd"); - glad_glRectdv = (PFNGLRECTDVPROC)load("glRectdv"); - glad_glRectf = (PFNGLRECTFPROC)load("glRectf"); - glad_glRectfv = (PFNGLRECTFVPROC)load("glRectfv"); - glad_glRecti = (PFNGLRECTIPROC)load("glRecti"); - glad_glRectiv = (PFNGLRECTIVPROC)load("glRectiv"); - glad_glRects = (PFNGLRECTSPROC)load("glRects"); - glad_glRectsv = (PFNGLRECTSVPROC)load("glRectsv"); - glad_glTexCoord1d = (PFNGLTEXCOORD1DPROC)load("glTexCoord1d"); - glad_glTexCoord1dv = (PFNGLTEXCOORD1DVPROC)load("glTexCoord1dv"); - glad_glTexCoord1f = (PFNGLTEXCOORD1FPROC)load("glTexCoord1f"); - glad_glTexCoord1fv = (PFNGLTEXCOORD1FVPROC)load("glTexCoord1fv"); - glad_glTexCoord1i = (PFNGLTEXCOORD1IPROC)load("glTexCoord1i"); - glad_glTexCoord1iv = (PFNGLTEXCOORD1IVPROC)load("glTexCoord1iv"); - glad_glTexCoord1s = (PFNGLTEXCOORD1SPROC)load("glTexCoord1s"); - glad_glTexCoord1sv = (PFNGLTEXCOORD1SVPROC)load("glTexCoord1sv"); - glad_glTexCoord2d = (PFNGLTEXCOORD2DPROC)load("glTexCoord2d"); - glad_glTexCoord2dv = (PFNGLTEXCOORD2DVPROC)load("glTexCoord2dv"); - glad_glTexCoord2f = (PFNGLTEXCOORD2FPROC)load("glTexCoord2f"); - glad_glTexCoord2fv = (PFNGLTEXCOORD2FVPROC)load("glTexCoord2fv"); - glad_glTexCoord2i = (PFNGLTEXCOORD2IPROC)load("glTexCoord2i"); - glad_glTexCoord2iv = (PFNGLTEXCOORD2IVPROC)load("glTexCoord2iv"); - glad_glTexCoord2s = (PFNGLTEXCOORD2SPROC)load("glTexCoord2s"); - glad_glTexCoord2sv = (PFNGLTEXCOORD2SVPROC)load("glTexCoord2sv"); - glad_glTexCoord3d = (PFNGLTEXCOORD3DPROC)load("glTexCoord3d"); - glad_glTexCoord3dv = (PFNGLTEXCOORD3DVPROC)load("glTexCoord3dv"); - glad_glTexCoord3f = (PFNGLTEXCOORD3FPROC)load("glTexCoord3f"); - glad_glTexCoord3fv = (PFNGLTEXCOORD3FVPROC)load("glTexCoord3fv"); - glad_glTexCoord3i = (PFNGLTEXCOORD3IPROC)load("glTexCoord3i"); - glad_glTexCoord3iv = (PFNGLTEXCOORD3IVPROC)load("glTexCoord3iv"); - glad_glTexCoord3s = (PFNGLTEXCOORD3SPROC)load("glTexCoord3s"); - glad_glTexCoord3sv = (PFNGLTEXCOORD3SVPROC)load("glTexCoord3sv"); - glad_glTexCoord4d = (PFNGLTEXCOORD4DPROC)load("glTexCoord4d"); - glad_glTexCoord4dv = (PFNGLTEXCOORD4DVPROC)load("glTexCoord4dv"); - glad_glTexCoord4f = (PFNGLTEXCOORD4FPROC)load("glTexCoord4f"); - glad_glTexCoord4fv = (PFNGLTEXCOORD4FVPROC)load("glTexCoord4fv"); - glad_glTexCoord4i = (PFNGLTEXCOORD4IPROC)load("glTexCoord4i"); - glad_glTexCoord4iv = (PFNGLTEXCOORD4IVPROC)load("glTexCoord4iv"); - glad_glTexCoord4s = (PFNGLTEXCOORD4SPROC)load("glTexCoord4s"); - glad_glTexCoord4sv = (PFNGLTEXCOORD4SVPROC)load("glTexCoord4sv"); - glad_glVertex2d = (PFNGLVERTEX2DPROC)load("glVertex2d"); - glad_glVertex2dv = (PFNGLVERTEX2DVPROC)load("glVertex2dv"); - glad_glVertex2f = (PFNGLVERTEX2FPROC)load("glVertex2f"); - glad_glVertex2fv = (PFNGLVERTEX2FVPROC)load("glVertex2fv"); - glad_glVertex2i = (PFNGLVERTEX2IPROC)load("glVertex2i"); - glad_glVertex2iv = (PFNGLVERTEX2IVPROC)load("glVertex2iv"); - glad_glVertex2s = (PFNGLVERTEX2SPROC)load("glVertex2s"); - glad_glVertex2sv = (PFNGLVERTEX2SVPROC)load("glVertex2sv"); - glad_glVertex3d = (PFNGLVERTEX3DPROC)load("glVertex3d"); - glad_glVertex3dv = (PFNGLVERTEX3DVPROC)load("glVertex3dv"); - glad_glVertex3f = (PFNGLVERTEX3FPROC)load("glVertex3f"); - glad_glVertex3fv = (PFNGLVERTEX3FVPROC)load("glVertex3fv"); - glad_glVertex3i = (PFNGLVERTEX3IPROC)load("glVertex3i"); - glad_glVertex3iv = (PFNGLVERTEX3IVPROC)load("glVertex3iv"); - glad_glVertex3s = (PFNGLVERTEX3SPROC)load("glVertex3s"); - glad_glVertex3sv = (PFNGLVERTEX3SVPROC)load("glVertex3sv"); - glad_glVertex4d = (PFNGLVERTEX4DPROC)load("glVertex4d"); - glad_glVertex4dv = (PFNGLVERTEX4DVPROC)load("glVertex4dv"); - glad_glVertex4f = (PFNGLVERTEX4FPROC)load("glVertex4f"); - glad_glVertex4fv = (PFNGLVERTEX4FVPROC)load("glVertex4fv"); - glad_glVertex4i = (PFNGLVERTEX4IPROC)load("glVertex4i"); - glad_glVertex4iv = (PFNGLVERTEX4IVPROC)load("glVertex4iv"); - glad_glVertex4s = (PFNGLVERTEX4SPROC)load("glVertex4s"); - glad_glVertex4sv = (PFNGLVERTEX4SVPROC)load("glVertex4sv"); - glad_glClipPlane = (PFNGLCLIPPLANEPROC)load("glClipPlane"); - glad_glColorMaterial = (PFNGLCOLORMATERIALPROC)load("glColorMaterial"); - glad_glFogf = (PFNGLFOGFPROC)load("glFogf"); - glad_glFogfv = (PFNGLFOGFVPROC)load("glFogfv"); - glad_glFogi = (PFNGLFOGIPROC)load("glFogi"); - glad_glFogiv = (PFNGLFOGIVPROC)load("glFogiv"); - glad_glLightf = (PFNGLLIGHTFPROC)load("glLightf"); - glad_glLightfv = (PFNGLLIGHTFVPROC)load("glLightfv"); - glad_glLighti = (PFNGLLIGHTIPROC)load("glLighti"); - glad_glLightiv = (PFNGLLIGHTIVPROC)load("glLightiv"); - glad_glLightModelf = (PFNGLLIGHTMODELFPROC)load("glLightModelf"); - glad_glLightModelfv = (PFNGLLIGHTMODELFVPROC)load("glLightModelfv"); - glad_glLightModeli = (PFNGLLIGHTMODELIPROC)load("glLightModeli"); - glad_glLightModeliv = (PFNGLLIGHTMODELIVPROC)load("glLightModeliv"); - glad_glLineStipple = (PFNGLLINESTIPPLEPROC)load("glLineStipple"); - glad_glMaterialf = (PFNGLMATERIALFPROC)load("glMaterialf"); - glad_glMaterialfv = (PFNGLMATERIALFVPROC)load("glMaterialfv"); - glad_glMateriali = (PFNGLMATERIALIPROC)load("glMateriali"); - glad_glMaterialiv = (PFNGLMATERIALIVPROC)load("glMaterialiv"); - glad_glPolygonStipple = (PFNGLPOLYGONSTIPPLEPROC)load("glPolygonStipple"); - glad_glShadeModel = (PFNGLSHADEMODELPROC)load("glShadeModel"); - glad_glTexEnvf = (PFNGLTEXENVFPROC)load("glTexEnvf"); - glad_glTexEnvfv = (PFNGLTEXENVFVPROC)load("glTexEnvfv"); - glad_glTexEnvi = (PFNGLTEXENVIPROC)load("glTexEnvi"); - glad_glTexEnviv = (PFNGLTEXENVIVPROC)load("glTexEnviv"); - glad_glTexGend = (PFNGLTEXGENDPROC)load("glTexGend"); - glad_glTexGendv = (PFNGLTEXGENDVPROC)load("glTexGendv"); - glad_glTexGenf = (PFNGLTEXGENFPROC)load("glTexGenf"); - glad_glTexGenfv = (PFNGLTEXGENFVPROC)load("glTexGenfv"); - glad_glTexGeni = (PFNGLTEXGENIPROC)load("glTexGeni"); - glad_glTexGeniv = (PFNGLTEXGENIVPROC)load("glTexGeniv"); - glad_glFeedbackBuffer = (PFNGLFEEDBACKBUFFERPROC)load("glFeedbackBuffer"); - glad_glSelectBuffer = (PFNGLSELECTBUFFERPROC)load("glSelectBuffer"); - glad_glRenderMode = (PFNGLRENDERMODEPROC)load("glRenderMode"); - glad_glInitNames = (PFNGLINITNAMESPROC)load("glInitNames"); - glad_glLoadName = (PFNGLLOADNAMEPROC)load("glLoadName"); - glad_glPassThrough = (PFNGLPASSTHROUGHPROC)load("glPassThrough"); - glad_glPopName = (PFNGLPOPNAMEPROC)load("glPopName"); - glad_glPushName = (PFNGLPUSHNAMEPROC)load("glPushName"); - glad_glClearAccum = (PFNGLCLEARACCUMPROC)load("glClearAccum"); - glad_glClearIndex = (PFNGLCLEARINDEXPROC)load("glClearIndex"); - glad_glIndexMask = (PFNGLINDEXMASKPROC)load("glIndexMask"); - glad_glAccum = (PFNGLACCUMPROC)load("glAccum"); - glad_glPopAttrib = (PFNGLPOPATTRIBPROC)load("glPopAttrib"); - glad_glPushAttrib = (PFNGLPUSHATTRIBPROC)load("glPushAttrib"); - glad_glMap1d = (PFNGLMAP1DPROC)load("glMap1d"); - glad_glMap1f = (PFNGLMAP1FPROC)load("glMap1f"); - glad_glMap2d = (PFNGLMAP2DPROC)load("glMap2d"); - glad_glMap2f = (PFNGLMAP2FPROC)load("glMap2f"); - glad_glMapGrid1d = (PFNGLMAPGRID1DPROC)load("glMapGrid1d"); - glad_glMapGrid1f = (PFNGLMAPGRID1FPROC)load("glMapGrid1f"); - glad_glMapGrid2d = (PFNGLMAPGRID2DPROC)load("glMapGrid2d"); - glad_glMapGrid2f = (PFNGLMAPGRID2FPROC)load("glMapGrid2f"); - glad_glEvalCoord1d = (PFNGLEVALCOORD1DPROC)load("glEvalCoord1d"); - glad_glEvalCoord1dv = (PFNGLEVALCOORD1DVPROC)load("glEvalCoord1dv"); - glad_glEvalCoord1f = (PFNGLEVALCOORD1FPROC)load("glEvalCoord1f"); - glad_glEvalCoord1fv = (PFNGLEVALCOORD1FVPROC)load("glEvalCoord1fv"); - glad_glEvalCoord2d = (PFNGLEVALCOORD2DPROC)load("glEvalCoord2d"); - glad_glEvalCoord2dv = (PFNGLEVALCOORD2DVPROC)load("glEvalCoord2dv"); - glad_glEvalCoord2f = (PFNGLEVALCOORD2FPROC)load("glEvalCoord2f"); - glad_glEvalCoord2fv = (PFNGLEVALCOORD2FVPROC)load("glEvalCoord2fv"); - glad_glEvalMesh1 = (PFNGLEVALMESH1PROC)load("glEvalMesh1"); - glad_glEvalPoint1 = (PFNGLEVALPOINT1PROC)load("glEvalPoint1"); - glad_glEvalMesh2 = (PFNGLEVALMESH2PROC)load("glEvalMesh2"); - glad_glEvalPoint2 = (PFNGLEVALPOINT2PROC)load("glEvalPoint2"); - glad_glAlphaFunc = (PFNGLALPHAFUNCPROC)load("glAlphaFunc"); - glad_glPixelZoom = (PFNGLPIXELZOOMPROC)load("glPixelZoom"); - glad_glPixelTransferf = (PFNGLPIXELTRANSFERFPROC)load("glPixelTransferf"); - glad_glPixelTransferi = (PFNGLPIXELTRANSFERIPROC)load("glPixelTransferi"); - glad_glPixelMapfv = (PFNGLPIXELMAPFVPROC)load("glPixelMapfv"); - glad_glPixelMapuiv = (PFNGLPIXELMAPUIVPROC)load("glPixelMapuiv"); - glad_glPixelMapusv = (PFNGLPIXELMAPUSVPROC)load("glPixelMapusv"); - glad_glCopyPixels = (PFNGLCOPYPIXELSPROC)load("glCopyPixels"); - glad_glDrawPixels = (PFNGLDRAWPIXELSPROC)load("glDrawPixels"); - glad_glGetClipPlane = (PFNGLGETCLIPPLANEPROC)load("glGetClipPlane"); - glad_glGetLightfv = (PFNGLGETLIGHTFVPROC)load("glGetLightfv"); - glad_glGetLightiv = (PFNGLGETLIGHTIVPROC)load("glGetLightiv"); - glad_glGetMapdv = (PFNGLGETMAPDVPROC)load("glGetMapdv"); - glad_glGetMapfv = (PFNGLGETMAPFVPROC)load("glGetMapfv"); - glad_glGetMapiv = (PFNGLGETMAPIVPROC)load("glGetMapiv"); - glad_glGetMaterialfv = (PFNGLGETMATERIALFVPROC)load("glGetMaterialfv"); - glad_glGetMaterialiv = (PFNGLGETMATERIALIVPROC)load("glGetMaterialiv"); - glad_glGetPixelMapfv = (PFNGLGETPIXELMAPFVPROC)load("glGetPixelMapfv"); - glad_glGetPixelMapuiv = (PFNGLGETPIXELMAPUIVPROC)load("glGetPixelMapuiv"); - glad_glGetPixelMapusv = (PFNGLGETPIXELMAPUSVPROC)load("glGetPixelMapusv"); - glad_glGetPolygonStipple = (PFNGLGETPOLYGONSTIPPLEPROC)load("glGetPolygonStipple"); - glad_glGetTexEnvfv = (PFNGLGETTEXENVFVPROC)load("glGetTexEnvfv"); - glad_glGetTexEnviv = (PFNGLGETTEXENVIVPROC)load("glGetTexEnviv"); - glad_glGetTexGendv = (PFNGLGETTEXGENDVPROC)load("glGetTexGendv"); - glad_glGetTexGenfv = (PFNGLGETTEXGENFVPROC)load("glGetTexGenfv"); - glad_glGetTexGeniv = (PFNGLGETTEXGENIVPROC)load("glGetTexGeniv"); - glad_glIsList = (PFNGLISLISTPROC)load("glIsList"); - glad_glFrustum = (PFNGLFRUSTUMPROC)load("glFrustum"); - glad_glLoadIdentity = (PFNGLLOADIDENTITYPROC)load("glLoadIdentity"); - glad_glLoadMatrixf = (PFNGLLOADMATRIXFPROC)load("glLoadMatrixf"); - glad_glLoadMatrixd = (PFNGLLOADMATRIXDPROC)load("glLoadMatrixd"); - glad_glMatrixMode = (PFNGLMATRIXMODEPROC)load("glMatrixMode"); - glad_glMultMatrixf = (PFNGLMULTMATRIXFPROC)load("glMultMatrixf"); - glad_glMultMatrixd = (PFNGLMULTMATRIXDPROC)load("glMultMatrixd"); - glad_glOrtho = (PFNGLORTHOPROC)load("glOrtho"); - glad_glPopMatrix = (PFNGLPOPMATRIXPROC)load("glPopMatrix"); - glad_glPushMatrix = (PFNGLPUSHMATRIXPROC)load("glPushMatrix"); - glad_glRotated = (PFNGLROTATEDPROC)load("glRotated"); - glad_glRotatef = (PFNGLROTATEFPROC)load("glRotatef"); - glad_glScaled = (PFNGLSCALEDPROC)load("glScaled"); - glad_glScalef = (PFNGLSCALEFPROC)load("glScalef"); - glad_glTranslated = (PFNGLTRANSLATEDPROC)load("glTranslated"); - glad_glTranslatef = (PFNGLTRANSLATEFPROC)load("glTranslatef"); -} -static void load_GL_VERSION_1_1(GLADloadproc load) { - if(!GLAD_GL_VERSION_1_1) return; - glad_glDrawArrays = (PFNGLDRAWARRAYSPROC)load("glDrawArrays"); - glad_glDrawElements = (PFNGLDRAWELEMENTSPROC)load("glDrawElements"); - glad_glGetPointerv = (PFNGLGETPOINTERVPROC)load("glGetPointerv"); - glad_glPolygonOffset = (PFNGLPOLYGONOFFSETPROC)load("glPolygonOffset"); - glad_glCopyTexImage1D = (PFNGLCOPYTEXIMAGE1DPROC)load("glCopyTexImage1D"); - glad_glCopyTexImage2D = (PFNGLCOPYTEXIMAGE2DPROC)load("glCopyTexImage2D"); - glad_glCopyTexSubImage1D = (PFNGLCOPYTEXSUBIMAGE1DPROC)load("glCopyTexSubImage1D"); - glad_glCopyTexSubImage2D = (PFNGLCOPYTEXSUBIMAGE2DPROC)load("glCopyTexSubImage2D"); - glad_glTexSubImage1D = (PFNGLTEXSUBIMAGE1DPROC)load("glTexSubImage1D"); - glad_glTexSubImage2D = (PFNGLTEXSUBIMAGE2DPROC)load("glTexSubImage2D"); - glad_glBindTexture = (PFNGLBINDTEXTUREPROC)load("glBindTexture"); - glad_glDeleteTextures = (PFNGLDELETETEXTURESPROC)load("glDeleteTextures"); - glad_glGenTextures = (PFNGLGENTEXTURESPROC)load("glGenTextures"); - glad_glIsTexture = (PFNGLISTEXTUREPROC)load("glIsTexture"); - glad_glArrayElement = (PFNGLARRAYELEMENTPROC)load("glArrayElement"); - glad_glColorPointer = (PFNGLCOLORPOINTERPROC)load("glColorPointer"); - glad_glDisableClientState = (PFNGLDISABLECLIENTSTATEPROC)load("glDisableClientState"); - glad_glEdgeFlagPointer = (PFNGLEDGEFLAGPOINTERPROC)load("glEdgeFlagPointer"); - glad_glEnableClientState = (PFNGLENABLECLIENTSTATEPROC)load("glEnableClientState"); - glad_glIndexPointer = (PFNGLINDEXPOINTERPROC)load("glIndexPointer"); - glad_glInterleavedArrays = (PFNGLINTERLEAVEDARRAYSPROC)load("glInterleavedArrays"); - glad_glNormalPointer = (PFNGLNORMALPOINTERPROC)load("glNormalPointer"); - glad_glTexCoordPointer = (PFNGLTEXCOORDPOINTERPROC)load("glTexCoordPointer"); - glad_glVertexPointer = (PFNGLVERTEXPOINTERPROC)load("glVertexPointer"); - glad_glAreTexturesResident = (PFNGLARETEXTURESRESIDENTPROC)load("glAreTexturesResident"); - glad_glPrioritizeTextures = (PFNGLPRIORITIZETEXTURESPROC)load("glPrioritizeTextures"); - glad_glIndexub = (PFNGLINDEXUBPROC)load("glIndexub"); - glad_glIndexubv = (PFNGLINDEXUBVPROC)load("glIndexubv"); - glad_glPopClientAttrib = (PFNGLPOPCLIENTATTRIBPROC)load("glPopClientAttrib"); - glad_glPushClientAttrib = (PFNGLPUSHCLIENTATTRIBPROC)load("glPushClientAttrib"); -} -static void load_GL_VERSION_1_2(GLADloadproc load) { - if(!GLAD_GL_VERSION_1_2) return; - glad_glDrawRangeElements = (PFNGLDRAWRANGEELEMENTSPROC)load("glDrawRangeElements"); - glad_glTexImage3D = (PFNGLTEXIMAGE3DPROC)load("glTexImage3D"); - glad_glTexSubImage3D = (PFNGLTEXSUBIMAGE3DPROC)load("glTexSubImage3D"); - glad_glCopyTexSubImage3D = (PFNGLCOPYTEXSUBIMAGE3DPROC)load("glCopyTexSubImage3D"); -} -static void load_GL_VERSION_1_3(GLADloadproc load) { - if(!GLAD_GL_VERSION_1_3) return; - glad_glActiveTexture = (PFNGLACTIVETEXTUREPROC)load("glActiveTexture"); - glad_glSampleCoverage = (PFNGLSAMPLECOVERAGEPROC)load("glSampleCoverage"); - glad_glCompressedTexImage3D = (PFNGLCOMPRESSEDTEXIMAGE3DPROC)load("glCompressedTexImage3D"); - glad_glCompressedTexImage2D = (PFNGLCOMPRESSEDTEXIMAGE2DPROC)load("glCompressedTexImage2D"); - glad_glCompressedTexImage1D = (PFNGLCOMPRESSEDTEXIMAGE1DPROC)load("glCompressedTexImage1D"); - glad_glCompressedTexSubImage3D = (PFNGLCOMPRESSEDTEXSUBIMAGE3DPROC)load("glCompressedTexSubImage3D"); - glad_glCompressedTexSubImage2D = (PFNGLCOMPRESSEDTEXSUBIMAGE2DPROC)load("glCompressedTexSubImage2D"); - glad_glCompressedTexSubImage1D = (PFNGLCOMPRESSEDTEXSUBIMAGE1DPROC)load("glCompressedTexSubImage1D"); - glad_glGetCompressedTexImage = (PFNGLGETCOMPRESSEDTEXIMAGEPROC)load("glGetCompressedTexImage"); - glad_glClientActiveTexture = (PFNGLCLIENTACTIVETEXTUREPROC)load("glClientActiveTexture"); - glad_glMultiTexCoord1d = (PFNGLMULTITEXCOORD1DPROC)load("glMultiTexCoord1d"); - glad_glMultiTexCoord1dv = (PFNGLMULTITEXCOORD1DVPROC)load("glMultiTexCoord1dv"); - glad_glMultiTexCoord1f = (PFNGLMULTITEXCOORD1FPROC)load("glMultiTexCoord1f"); - glad_glMultiTexCoord1fv = (PFNGLMULTITEXCOORD1FVPROC)load("glMultiTexCoord1fv"); - glad_glMultiTexCoord1i = (PFNGLMULTITEXCOORD1IPROC)load("glMultiTexCoord1i"); - glad_glMultiTexCoord1iv = (PFNGLMULTITEXCOORD1IVPROC)load("glMultiTexCoord1iv"); - glad_glMultiTexCoord1s = (PFNGLMULTITEXCOORD1SPROC)load("glMultiTexCoord1s"); - glad_glMultiTexCoord1sv = (PFNGLMULTITEXCOORD1SVPROC)load("glMultiTexCoord1sv"); - glad_glMultiTexCoord2d = (PFNGLMULTITEXCOORD2DPROC)load("glMultiTexCoord2d"); - glad_glMultiTexCoord2dv = (PFNGLMULTITEXCOORD2DVPROC)load("glMultiTexCoord2dv"); - glad_glMultiTexCoord2f = (PFNGLMULTITEXCOORD2FPROC)load("glMultiTexCoord2f"); - glad_glMultiTexCoord2fv = (PFNGLMULTITEXCOORD2FVPROC)load("glMultiTexCoord2fv"); - glad_glMultiTexCoord2i = (PFNGLMULTITEXCOORD2IPROC)load("glMultiTexCoord2i"); - glad_glMultiTexCoord2iv = (PFNGLMULTITEXCOORD2IVPROC)load("glMultiTexCoord2iv"); - glad_glMultiTexCoord2s = (PFNGLMULTITEXCOORD2SPROC)load("glMultiTexCoord2s"); - glad_glMultiTexCoord2sv = (PFNGLMULTITEXCOORD2SVPROC)load("glMultiTexCoord2sv"); - glad_glMultiTexCoord3d = (PFNGLMULTITEXCOORD3DPROC)load("glMultiTexCoord3d"); - glad_glMultiTexCoord3dv = (PFNGLMULTITEXCOORD3DVPROC)load("glMultiTexCoord3dv"); - glad_glMultiTexCoord3f = (PFNGLMULTITEXCOORD3FPROC)load("glMultiTexCoord3f"); - glad_glMultiTexCoord3fv = (PFNGLMULTITEXCOORD3FVPROC)load("glMultiTexCoord3fv"); - glad_glMultiTexCoord3i = (PFNGLMULTITEXCOORD3IPROC)load("glMultiTexCoord3i"); - glad_glMultiTexCoord3iv = (PFNGLMULTITEXCOORD3IVPROC)load("glMultiTexCoord3iv"); - glad_glMultiTexCoord3s = (PFNGLMULTITEXCOORD3SPROC)load("glMultiTexCoord3s"); - glad_glMultiTexCoord3sv = (PFNGLMULTITEXCOORD3SVPROC)load("glMultiTexCoord3sv"); - glad_glMultiTexCoord4d = (PFNGLMULTITEXCOORD4DPROC)load("glMultiTexCoord4d"); - glad_glMultiTexCoord4dv = (PFNGLMULTITEXCOORD4DVPROC)load("glMultiTexCoord4dv"); - glad_glMultiTexCoord4f = (PFNGLMULTITEXCOORD4FPROC)load("glMultiTexCoord4f"); - glad_glMultiTexCoord4fv = (PFNGLMULTITEXCOORD4FVPROC)load("glMultiTexCoord4fv"); - glad_glMultiTexCoord4i = (PFNGLMULTITEXCOORD4IPROC)load("glMultiTexCoord4i"); - glad_glMultiTexCoord4iv = (PFNGLMULTITEXCOORD4IVPROC)load("glMultiTexCoord4iv"); - glad_glMultiTexCoord4s = (PFNGLMULTITEXCOORD4SPROC)load("glMultiTexCoord4s"); - glad_glMultiTexCoord4sv = (PFNGLMULTITEXCOORD4SVPROC)load("glMultiTexCoord4sv"); - glad_glLoadTransposeMatrixf = (PFNGLLOADTRANSPOSEMATRIXFPROC)load("glLoadTransposeMatrixf"); - glad_glLoadTransposeMatrixd = (PFNGLLOADTRANSPOSEMATRIXDPROC)load("glLoadTransposeMatrixd"); - glad_glMultTransposeMatrixf = (PFNGLMULTTRANSPOSEMATRIXFPROC)load("glMultTransposeMatrixf"); - glad_glMultTransposeMatrixd = (PFNGLMULTTRANSPOSEMATRIXDPROC)load("glMultTransposeMatrixd"); -} -static void load_GL_VERSION_1_4(GLADloadproc load) { - if(!GLAD_GL_VERSION_1_4) return; - glad_glBlendFuncSeparate = (PFNGLBLENDFUNCSEPARATEPROC)load("glBlendFuncSeparate"); - glad_glMultiDrawArrays = (PFNGLMULTIDRAWARRAYSPROC)load("glMultiDrawArrays"); - glad_glMultiDrawElements = (PFNGLMULTIDRAWELEMENTSPROC)load("glMultiDrawElements"); - glad_glPointParameterf = (PFNGLPOINTPARAMETERFPROC)load("glPointParameterf"); - glad_glPointParameterfv = (PFNGLPOINTPARAMETERFVPROC)load("glPointParameterfv"); - glad_glPointParameteri = (PFNGLPOINTPARAMETERIPROC)load("glPointParameteri"); - glad_glPointParameteriv = (PFNGLPOINTPARAMETERIVPROC)load("glPointParameteriv"); - glad_glFogCoordf = (PFNGLFOGCOORDFPROC)load("glFogCoordf"); - glad_glFogCoordfv = (PFNGLFOGCOORDFVPROC)load("glFogCoordfv"); - glad_glFogCoordd = (PFNGLFOGCOORDDPROC)load("glFogCoordd"); - glad_glFogCoorddv = (PFNGLFOGCOORDDVPROC)load("glFogCoorddv"); - glad_glFogCoordPointer = (PFNGLFOGCOORDPOINTERPROC)load("glFogCoordPointer"); - glad_glSecondaryColor3b = (PFNGLSECONDARYCOLOR3BPROC)load("glSecondaryColor3b"); - glad_glSecondaryColor3bv = (PFNGLSECONDARYCOLOR3BVPROC)load("glSecondaryColor3bv"); - glad_glSecondaryColor3d = (PFNGLSECONDARYCOLOR3DPROC)load("glSecondaryColor3d"); - glad_glSecondaryColor3dv = (PFNGLSECONDARYCOLOR3DVPROC)load("glSecondaryColor3dv"); - glad_glSecondaryColor3f = (PFNGLSECONDARYCOLOR3FPROC)load("glSecondaryColor3f"); - glad_glSecondaryColor3fv = (PFNGLSECONDARYCOLOR3FVPROC)load("glSecondaryColor3fv"); - glad_glSecondaryColor3i = (PFNGLSECONDARYCOLOR3IPROC)load("glSecondaryColor3i"); - glad_glSecondaryColor3iv = (PFNGLSECONDARYCOLOR3IVPROC)load("glSecondaryColor3iv"); - glad_glSecondaryColor3s = (PFNGLSECONDARYCOLOR3SPROC)load("glSecondaryColor3s"); - glad_glSecondaryColor3sv = (PFNGLSECONDARYCOLOR3SVPROC)load("glSecondaryColor3sv"); - glad_glSecondaryColor3ub = (PFNGLSECONDARYCOLOR3UBPROC)load("glSecondaryColor3ub"); - glad_glSecondaryColor3ubv = (PFNGLSECONDARYCOLOR3UBVPROC)load("glSecondaryColor3ubv"); - glad_glSecondaryColor3ui = (PFNGLSECONDARYCOLOR3UIPROC)load("glSecondaryColor3ui"); - glad_glSecondaryColor3uiv = (PFNGLSECONDARYCOLOR3UIVPROC)load("glSecondaryColor3uiv"); - glad_glSecondaryColor3us = (PFNGLSECONDARYCOLOR3USPROC)load("glSecondaryColor3us"); - glad_glSecondaryColor3usv = (PFNGLSECONDARYCOLOR3USVPROC)load("glSecondaryColor3usv"); - glad_glSecondaryColorPointer = (PFNGLSECONDARYCOLORPOINTERPROC)load("glSecondaryColorPointer"); - glad_glWindowPos2d = (PFNGLWINDOWPOS2DPROC)load("glWindowPos2d"); - glad_glWindowPos2dv = (PFNGLWINDOWPOS2DVPROC)load("glWindowPos2dv"); - glad_glWindowPos2f = (PFNGLWINDOWPOS2FPROC)load("glWindowPos2f"); - glad_glWindowPos2fv = (PFNGLWINDOWPOS2FVPROC)load("glWindowPos2fv"); - glad_glWindowPos2i = (PFNGLWINDOWPOS2IPROC)load("glWindowPos2i"); - glad_glWindowPos2iv = (PFNGLWINDOWPOS2IVPROC)load("glWindowPos2iv"); - glad_glWindowPos2s = (PFNGLWINDOWPOS2SPROC)load("glWindowPos2s"); - glad_glWindowPos2sv = (PFNGLWINDOWPOS2SVPROC)load("glWindowPos2sv"); - glad_glWindowPos3d = (PFNGLWINDOWPOS3DPROC)load("glWindowPos3d"); - glad_glWindowPos3dv = (PFNGLWINDOWPOS3DVPROC)load("glWindowPos3dv"); - glad_glWindowPos3f = (PFNGLWINDOWPOS3FPROC)load("glWindowPos3f"); - glad_glWindowPos3fv = (PFNGLWINDOWPOS3FVPROC)load("glWindowPos3fv"); - glad_glWindowPos3i = (PFNGLWINDOWPOS3IPROC)load("glWindowPos3i"); - glad_glWindowPos3iv = (PFNGLWINDOWPOS3IVPROC)load("glWindowPos3iv"); - glad_glWindowPos3s = (PFNGLWINDOWPOS3SPROC)load("glWindowPos3s"); - glad_glWindowPos3sv = (PFNGLWINDOWPOS3SVPROC)load("glWindowPos3sv"); - glad_glBlendColor = (PFNGLBLENDCOLORPROC)load("glBlendColor"); - glad_glBlendEquation = (PFNGLBLENDEQUATIONPROC)load("glBlendEquation"); -} -static void load_GL_VERSION_1_5(GLADloadproc load) { - if(!GLAD_GL_VERSION_1_5) return; - glad_glGenQueries = (PFNGLGENQUERIESPROC)load("glGenQueries"); - glad_glDeleteQueries = (PFNGLDELETEQUERIESPROC)load("glDeleteQueries"); - glad_glIsQuery = (PFNGLISQUERYPROC)load("glIsQuery"); - glad_glBeginQuery = (PFNGLBEGINQUERYPROC)load("glBeginQuery"); - glad_glEndQuery = (PFNGLENDQUERYPROC)load("glEndQuery"); - glad_glGetQueryiv = (PFNGLGETQUERYIVPROC)load("glGetQueryiv"); - glad_glGetQueryObjectiv = (PFNGLGETQUERYOBJECTIVPROC)load("glGetQueryObjectiv"); - glad_glGetQueryObjectuiv = (PFNGLGETQUERYOBJECTUIVPROC)load("glGetQueryObjectuiv"); - glad_glBindBuffer = (PFNGLBINDBUFFERPROC)load("glBindBuffer"); - glad_glDeleteBuffers = (PFNGLDELETEBUFFERSPROC)load("glDeleteBuffers"); - glad_glGenBuffers = (PFNGLGENBUFFERSPROC)load("glGenBuffers"); - glad_glIsBuffer = (PFNGLISBUFFERPROC)load("glIsBuffer"); - glad_glBufferData = (PFNGLBUFFERDATAPROC)load("glBufferData"); - glad_glBufferSubData = (PFNGLBUFFERSUBDATAPROC)load("glBufferSubData"); - glad_glGetBufferSubData = (PFNGLGETBUFFERSUBDATAPROC)load("glGetBufferSubData"); - glad_glMapBuffer = (PFNGLMAPBUFFERPROC)load("glMapBuffer"); - glad_glUnmapBuffer = (PFNGLUNMAPBUFFERPROC)load("glUnmapBuffer"); - glad_glGetBufferParameteriv = (PFNGLGETBUFFERPARAMETERIVPROC)load("glGetBufferParameteriv"); - glad_glGetBufferPointerv = (PFNGLGETBUFFERPOINTERVPROC)load("glGetBufferPointerv"); -} -static void load_GL_VERSION_2_0(GLADloadproc load) { - if(!GLAD_GL_VERSION_2_0) return; - glad_glBlendEquationSeparate = (PFNGLBLENDEQUATIONSEPARATEPROC)load("glBlendEquationSeparate"); - glad_glDrawBuffers = (PFNGLDRAWBUFFERSPROC)load("glDrawBuffers"); - glad_glStencilOpSeparate = (PFNGLSTENCILOPSEPARATEPROC)load("glStencilOpSeparate"); - glad_glStencilFuncSeparate = (PFNGLSTENCILFUNCSEPARATEPROC)load("glStencilFuncSeparate"); - glad_glStencilMaskSeparate = (PFNGLSTENCILMASKSEPARATEPROC)load("glStencilMaskSeparate"); - glad_glAttachShader = (PFNGLATTACHSHADERPROC)load("glAttachShader"); - glad_glBindAttribLocation = (PFNGLBINDATTRIBLOCATIONPROC)load("glBindAttribLocation"); - glad_glCompileShader = (PFNGLCOMPILESHADERPROC)load("glCompileShader"); - glad_glCreateProgram = (PFNGLCREATEPROGRAMPROC)load("glCreateProgram"); - glad_glCreateShader = (PFNGLCREATESHADERPROC)load("glCreateShader"); - glad_glDeleteProgram = (PFNGLDELETEPROGRAMPROC)load("glDeleteProgram"); - glad_glDeleteShader = (PFNGLDELETESHADERPROC)load("glDeleteShader"); - glad_glDetachShader = (PFNGLDETACHSHADERPROC)load("glDetachShader"); - glad_glDisableVertexAttribArray = (PFNGLDISABLEVERTEXATTRIBARRAYPROC)load("glDisableVertexAttribArray"); - glad_glEnableVertexAttribArray = (PFNGLENABLEVERTEXATTRIBARRAYPROC)load("glEnableVertexAttribArray"); - glad_glGetActiveAttrib = (PFNGLGETACTIVEATTRIBPROC)load("glGetActiveAttrib"); - glad_glGetActiveUniform = (PFNGLGETACTIVEUNIFORMPROC)load("glGetActiveUniform"); - glad_glGetAttachedShaders = (PFNGLGETATTACHEDSHADERSPROC)load("glGetAttachedShaders"); - glad_glGetAttribLocation = (PFNGLGETATTRIBLOCATIONPROC)load("glGetAttribLocation"); - glad_glGetProgramiv = (PFNGLGETPROGRAMIVPROC)load("glGetProgramiv"); - glad_glGetProgramInfoLog = (PFNGLGETPROGRAMINFOLOGPROC)load("glGetProgramInfoLog"); - glad_glGetShaderiv = (PFNGLGETSHADERIVPROC)load("glGetShaderiv"); - glad_glGetShaderInfoLog = (PFNGLGETSHADERINFOLOGPROC)load("glGetShaderInfoLog"); - glad_glGetShaderSource = (PFNGLGETSHADERSOURCEPROC)load("glGetShaderSource"); - glad_glGetUniformLocation = (PFNGLGETUNIFORMLOCATIONPROC)load("glGetUniformLocation"); - glad_glGetUniformfv = (PFNGLGETUNIFORMFVPROC)load("glGetUniformfv"); - glad_glGetUniformiv = (PFNGLGETUNIFORMIVPROC)load("glGetUniformiv"); - glad_glGetVertexAttribdv = (PFNGLGETVERTEXATTRIBDVPROC)load("glGetVertexAttribdv"); - glad_glGetVertexAttribfv = (PFNGLGETVERTEXATTRIBFVPROC)load("glGetVertexAttribfv"); - glad_glGetVertexAttribiv = (PFNGLGETVERTEXATTRIBIVPROC)load("glGetVertexAttribiv"); - glad_glGetVertexAttribPointerv = (PFNGLGETVERTEXATTRIBPOINTERVPROC)load("glGetVertexAttribPointerv"); - glad_glIsProgram = (PFNGLISPROGRAMPROC)load("glIsProgram"); - glad_glIsShader = (PFNGLISSHADERPROC)load("glIsShader"); - glad_glLinkProgram = (PFNGLLINKPROGRAMPROC)load("glLinkProgram"); - glad_glShaderSource = (PFNGLSHADERSOURCEPROC)load("glShaderSource"); - glad_glUseProgram = (PFNGLUSEPROGRAMPROC)load("glUseProgram"); - glad_glUniform1f = (PFNGLUNIFORM1FPROC)load("glUniform1f"); - glad_glUniform2f = (PFNGLUNIFORM2FPROC)load("glUniform2f"); - glad_glUniform3f = (PFNGLUNIFORM3FPROC)load("glUniform3f"); - glad_glUniform4f = (PFNGLUNIFORM4FPROC)load("glUniform4f"); - glad_glUniform1i = (PFNGLUNIFORM1IPROC)load("glUniform1i"); - glad_glUniform2i = (PFNGLUNIFORM2IPROC)load("glUniform2i"); - glad_glUniform3i = (PFNGLUNIFORM3IPROC)load("glUniform3i"); - glad_glUniform4i = (PFNGLUNIFORM4IPROC)load("glUniform4i"); - glad_glUniform1fv = (PFNGLUNIFORM1FVPROC)load("glUniform1fv"); - glad_glUniform2fv = (PFNGLUNIFORM2FVPROC)load("glUniform2fv"); - glad_glUniform3fv = (PFNGLUNIFORM3FVPROC)load("glUniform3fv"); - glad_glUniform4fv = (PFNGLUNIFORM4FVPROC)load("glUniform4fv"); - glad_glUniform1iv = (PFNGLUNIFORM1IVPROC)load("glUniform1iv"); - glad_glUniform2iv = (PFNGLUNIFORM2IVPROC)load("glUniform2iv"); - glad_glUniform3iv = (PFNGLUNIFORM3IVPROC)load("glUniform3iv"); - glad_glUniform4iv = (PFNGLUNIFORM4IVPROC)load("glUniform4iv"); - glad_glUniformMatrix2fv = (PFNGLUNIFORMMATRIX2FVPROC)load("glUniformMatrix2fv"); - glad_glUniformMatrix3fv = (PFNGLUNIFORMMATRIX3FVPROC)load("glUniformMatrix3fv"); - glad_glUniformMatrix4fv = (PFNGLUNIFORMMATRIX4FVPROC)load("glUniformMatrix4fv"); - glad_glValidateProgram = (PFNGLVALIDATEPROGRAMPROC)load("glValidateProgram"); - glad_glVertexAttrib1d = (PFNGLVERTEXATTRIB1DPROC)load("glVertexAttrib1d"); - glad_glVertexAttrib1dv = (PFNGLVERTEXATTRIB1DVPROC)load("glVertexAttrib1dv"); - glad_glVertexAttrib1f = (PFNGLVERTEXATTRIB1FPROC)load("glVertexAttrib1f"); - glad_glVertexAttrib1fv = (PFNGLVERTEXATTRIB1FVPROC)load("glVertexAttrib1fv"); - glad_glVertexAttrib1s = (PFNGLVERTEXATTRIB1SPROC)load("glVertexAttrib1s"); - glad_glVertexAttrib1sv = (PFNGLVERTEXATTRIB1SVPROC)load("glVertexAttrib1sv"); - glad_glVertexAttrib2d = (PFNGLVERTEXATTRIB2DPROC)load("glVertexAttrib2d"); - glad_glVertexAttrib2dv = (PFNGLVERTEXATTRIB2DVPROC)load("glVertexAttrib2dv"); - glad_glVertexAttrib2f = (PFNGLVERTEXATTRIB2FPROC)load("glVertexAttrib2f"); - glad_glVertexAttrib2fv = (PFNGLVERTEXATTRIB2FVPROC)load("glVertexAttrib2fv"); - glad_glVertexAttrib2s = (PFNGLVERTEXATTRIB2SPROC)load("glVertexAttrib2s"); - glad_glVertexAttrib2sv = (PFNGLVERTEXATTRIB2SVPROC)load("glVertexAttrib2sv"); - glad_glVertexAttrib3d = (PFNGLVERTEXATTRIB3DPROC)load("glVertexAttrib3d"); - glad_glVertexAttrib3dv = (PFNGLVERTEXATTRIB3DVPROC)load("glVertexAttrib3dv"); - glad_glVertexAttrib3f = (PFNGLVERTEXATTRIB3FPROC)load("glVertexAttrib3f"); - glad_glVertexAttrib3fv = (PFNGLVERTEXATTRIB3FVPROC)load("glVertexAttrib3fv"); - glad_glVertexAttrib3s = (PFNGLVERTEXATTRIB3SPROC)load("glVertexAttrib3s"); - glad_glVertexAttrib3sv = (PFNGLVERTEXATTRIB3SVPROC)load("glVertexAttrib3sv"); - glad_glVertexAttrib4Nbv = (PFNGLVERTEXATTRIB4NBVPROC)load("glVertexAttrib4Nbv"); - glad_glVertexAttrib4Niv = (PFNGLVERTEXATTRIB4NIVPROC)load("glVertexAttrib4Niv"); - glad_glVertexAttrib4Nsv = (PFNGLVERTEXATTRIB4NSVPROC)load("glVertexAttrib4Nsv"); - glad_glVertexAttrib4Nub = (PFNGLVERTEXATTRIB4NUBPROC)load("glVertexAttrib4Nub"); - glad_glVertexAttrib4Nubv = (PFNGLVERTEXATTRIB4NUBVPROC)load("glVertexAttrib4Nubv"); - glad_glVertexAttrib4Nuiv = (PFNGLVERTEXATTRIB4NUIVPROC)load("glVertexAttrib4Nuiv"); - glad_glVertexAttrib4Nusv = (PFNGLVERTEXATTRIB4NUSVPROC)load("glVertexAttrib4Nusv"); - glad_glVertexAttrib4bv = (PFNGLVERTEXATTRIB4BVPROC)load("glVertexAttrib4bv"); - glad_glVertexAttrib4d = (PFNGLVERTEXATTRIB4DPROC)load("glVertexAttrib4d"); - glad_glVertexAttrib4dv = (PFNGLVERTEXATTRIB4DVPROC)load("glVertexAttrib4dv"); - glad_glVertexAttrib4f = (PFNGLVERTEXATTRIB4FPROC)load("glVertexAttrib4f"); - glad_glVertexAttrib4fv = (PFNGLVERTEXATTRIB4FVPROC)load("glVertexAttrib4fv"); - glad_glVertexAttrib4iv = (PFNGLVERTEXATTRIB4IVPROC)load("glVertexAttrib4iv"); - glad_glVertexAttrib4s = (PFNGLVERTEXATTRIB4SPROC)load("glVertexAttrib4s"); - glad_glVertexAttrib4sv = (PFNGLVERTEXATTRIB4SVPROC)load("glVertexAttrib4sv"); - glad_glVertexAttrib4ubv = (PFNGLVERTEXATTRIB4UBVPROC)load("glVertexAttrib4ubv"); - glad_glVertexAttrib4uiv = (PFNGLVERTEXATTRIB4UIVPROC)load("glVertexAttrib4uiv"); - glad_glVertexAttrib4usv = (PFNGLVERTEXATTRIB4USVPROC)load("glVertexAttrib4usv"); - glad_glVertexAttribPointer = (PFNGLVERTEXATTRIBPOINTERPROC)load("glVertexAttribPointer"); -} -static void load_GL_VERSION_2_1(GLADloadproc load) { - if(!GLAD_GL_VERSION_2_1) return; - glad_glUniformMatrix2x3fv = (PFNGLUNIFORMMATRIX2X3FVPROC)load("glUniformMatrix2x3fv"); - glad_glUniformMatrix3x2fv = (PFNGLUNIFORMMATRIX3X2FVPROC)load("glUniformMatrix3x2fv"); - glad_glUniformMatrix2x4fv = (PFNGLUNIFORMMATRIX2X4FVPROC)load("glUniformMatrix2x4fv"); - glad_glUniformMatrix4x2fv = (PFNGLUNIFORMMATRIX4X2FVPROC)load("glUniformMatrix4x2fv"); - glad_glUniformMatrix3x4fv = (PFNGLUNIFORMMATRIX3X4FVPROC)load("glUniformMatrix3x4fv"); - glad_glUniformMatrix4x3fv = (PFNGLUNIFORMMATRIX4X3FVPROC)load("glUniformMatrix4x3fv"); -} -static void load_GL_VERSION_3_0(GLADloadproc load) { - if(!GLAD_GL_VERSION_3_0) return; - glad_glColorMaski = (PFNGLCOLORMASKIPROC)load("glColorMaski"); - glad_glGetBooleani_v = (PFNGLGETBOOLEANI_VPROC)load("glGetBooleani_v"); - glad_glGetIntegeri_v = (PFNGLGETINTEGERI_VPROC)load("glGetIntegeri_v"); - glad_glEnablei = (PFNGLENABLEIPROC)load("glEnablei"); - glad_glDisablei = (PFNGLDISABLEIPROC)load("glDisablei"); - glad_glIsEnabledi = (PFNGLISENABLEDIPROC)load("glIsEnabledi"); - glad_glBeginTransformFeedback = (PFNGLBEGINTRANSFORMFEEDBACKPROC)load("glBeginTransformFeedback"); - glad_glEndTransformFeedback = (PFNGLENDTRANSFORMFEEDBACKPROC)load("glEndTransformFeedback"); - glad_glBindBufferRange = (PFNGLBINDBUFFERRANGEPROC)load("glBindBufferRange"); - glad_glBindBufferBase = (PFNGLBINDBUFFERBASEPROC)load("glBindBufferBase"); - glad_glTransformFeedbackVaryings = (PFNGLTRANSFORMFEEDBACKVARYINGSPROC)load("glTransformFeedbackVaryings"); - glad_glGetTransformFeedbackVarying = (PFNGLGETTRANSFORMFEEDBACKVARYINGPROC)load("glGetTransformFeedbackVarying"); - glad_glClampColor = (PFNGLCLAMPCOLORPROC)load("glClampColor"); - glad_glBeginConditionalRender = (PFNGLBEGINCONDITIONALRENDERPROC)load("glBeginConditionalRender"); - glad_glEndConditionalRender = (PFNGLENDCONDITIONALRENDERPROC)load("glEndConditionalRender"); - glad_glVertexAttribIPointer = (PFNGLVERTEXATTRIBIPOINTERPROC)load("glVertexAttribIPointer"); - glad_glGetVertexAttribIiv = (PFNGLGETVERTEXATTRIBIIVPROC)load("glGetVertexAttribIiv"); - glad_glGetVertexAttribIuiv = (PFNGLGETVERTEXATTRIBIUIVPROC)load("glGetVertexAttribIuiv"); - glad_glVertexAttribI1i = (PFNGLVERTEXATTRIBI1IPROC)load("glVertexAttribI1i"); - glad_glVertexAttribI2i = (PFNGLVERTEXATTRIBI2IPROC)load("glVertexAttribI2i"); - glad_glVertexAttribI3i = (PFNGLVERTEXATTRIBI3IPROC)load("glVertexAttribI3i"); - glad_glVertexAttribI4i = (PFNGLVERTEXATTRIBI4IPROC)load("glVertexAttribI4i"); - glad_glVertexAttribI1ui = (PFNGLVERTEXATTRIBI1UIPROC)load("glVertexAttribI1ui"); - glad_glVertexAttribI2ui = (PFNGLVERTEXATTRIBI2UIPROC)load("glVertexAttribI2ui"); - glad_glVertexAttribI3ui = (PFNGLVERTEXATTRIBI3UIPROC)load("glVertexAttribI3ui"); - glad_glVertexAttribI4ui = (PFNGLVERTEXATTRIBI4UIPROC)load("glVertexAttribI4ui"); - glad_glVertexAttribI1iv = (PFNGLVERTEXATTRIBI1IVPROC)load("glVertexAttribI1iv"); - glad_glVertexAttribI2iv = (PFNGLVERTEXATTRIBI2IVPROC)load("glVertexAttribI2iv"); - glad_glVertexAttribI3iv = (PFNGLVERTEXATTRIBI3IVPROC)load("glVertexAttribI3iv"); - glad_glVertexAttribI4iv = (PFNGLVERTEXATTRIBI4IVPROC)load("glVertexAttribI4iv"); - glad_glVertexAttribI1uiv = (PFNGLVERTEXATTRIBI1UIVPROC)load("glVertexAttribI1uiv"); - glad_glVertexAttribI2uiv = (PFNGLVERTEXATTRIBI2UIVPROC)load("glVertexAttribI2uiv"); - glad_glVertexAttribI3uiv = (PFNGLVERTEXATTRIBI3UIVPROC)load("glVertexAttribI3uiv"); - glad_glVertexAttribI4uiv = (PFNGLVERTEXATTRIBI4UIVPROC)load("glVertexAttribI4uiv"); - glad_glVertexAttribI4bv = (PFNGLVERTEXATTRIBI4BVPROC)load("glVertexAttribI4bv"); - glad_glVertexAttribI4sv = (PFNGLVERTEXATTRIBI4SVPROC)load("glVertexAttribI4sv"); - glad_glVertexAttribI4ubv = (PFNGLVERTEXATTRIBI4UBVPROC)load("glVertexAttribI4ubv"); - glad_glVertexAttribI4usv = (PFNGLVERTEXATTRIBI4USVPROC)load("glVertexAttribI4usv"); - glad_glGetUniformuiv = (PFNGLGETUNIFORMUIVPROC)load("glGetUniformuiv"); - glad_glBindFragDataLocation = (PFNGLBINDFRAGDATALOCATIONPROC)load("glBindFragDataLocation"); - glad_glGetFragDataLocation = (PFNGLGETFRAGDATALOCATIONPROC)load("glGetFragDataLocation"); - glad_glUniform1ui = (PFNGLUNIFORM1UIPROC)load("glUniform1ui"); - glad_glUniform2ui = (PFNGLUNIFORM2UIPROC)load("glUniform2ui"); - glad_glUniform3ui = (PFNGLUNIFORM3UIPROC)load("glUniform3ui"); - glad_glUniform4ui = (PFNGLUNIFORM4UIPROC)load("glUniform4ui"); - glad_glUniform1uiv = (PFNGLUNIFORM1UIVPROC)load("glUniform1uiv"); - glad_glUniform2uiv = (PFNGLUNIFORM2UIVPROC)load("glUniform2uiv"); - glad_glUniform3uiv = (PFNGLUNIFORM3UIVPROC)load("glUniform3uiv"); - glad_glUniform4uiv = (PFNGLUNIFORM4UIVPROC)load("glUniform4uiv"); - glad_glTexParameterIiv = (PFNGLTEXPARAMETERIIVPROC)load("glTexParameterIiv"); - glad_glTexParameterIuiv = (PFNGLTEXPARAMETERIUIVPROC)load("glTexParameterIuiv"); - glad_glGetTexParameterIiv = (PFNGLGETTEXPARAMETERIIVPROC)load("glGetTexParameterIiv"); - glad_glGetTexParameterIuiv = (PFNGLGETTEXPARAMETERIUIVPROC)load("glGetTexParameterIuiv"); - glad_glClearBufferiv = (PFNGLCLEARBUFFERIVPROC)load("glClearBufferiv"); - glad_glClearBufferuiv = (PFNGLCLEARBUFFERUIVPROC)load("glClearBufferuiv"); - glad_glClearBufferfv = (PFNGLCLEARBUFFERFVPROC)load("glClearBufferfv"); - glad_glClearBufferfi = (PFNGLCLEARBUFFERFIPROC)load("glClearBufferfi"); - glad_glGetStringi = (PFNGLGETSTRINGIPROC)load("glGetStringi"); - glad_glIsRenderbuffer = (PFNGLISRENDERBUFFERPROC)load("glIsRenderbuffer"); - glad_glBindRenderbuffer = (PFNGLBINDRENDERBUFFERPROC)load("glBindRenderbuffer"); - glad_glDeleteRenderbuffers = (PFNGLDELETERENDERBUFFERSPROC)load("glDeleteRenderbuffers"); - glad_glGenRenderbuffers = (PFNGLGENRENDERBUFFERSPROC)load("glGenRenderbuffers"); - glad_glRenderbufferStorage = (PFNGLRENDERBUFFERSTORAGEPROC)load("glRenderbufferStorage"); - glad_glGetRenderbufferParameteriv = (PFNGLGETRENDERBUFFERPARAMETERIVPROC)load("glGetRenderbufferParameteriv"); - glad_glIsFramebuffer = (PFNGLISFRAMEBUFFERPROC)load("glIsFramebuffer"); - glad_glBindFramebuffer = (PFNGLBINDFRAMEBUFFERPROC)load("glBindFramebuffer"); - glad_glDeleteFramebuffers = (PFNGLDELETEFRAMEBUFFERSPROC)load("glDeleteFramebuffers"); - glad_glGenFramebuffers = (PFNGLGENFRAMEBUFFERSPROC)load("glGenFramebuffers"); - glad_glCheckFramebufferStatus = (PFNGLCHECKFRAMEBUFFERSTATUSPROC)load("glCheckFramebufferStatus"); - glad_glFramebufferTexture1D = (PFNGLFRAMEBUFFERTEXTURE1DPROC)load("glFramebufferTexture1D"); - glad_glFramebufferTexture2D = (PFNGLFRAMEBUFFERTEXTURE2DPROC)load("glFramebufferTexture2D"); - glad_glFramebufferTexture3D = (PFNGLFRAMEBUFFERTEXTURE3DPROC)load("glFramebufferTexture3D"); - glad_glFramebufferRenderbuffer = (PFNGLFRAMEBUFFERRENDERBUFFERPROC)load("glFramebufferRenderbuffer"); - glad_glGetFramebufferAttachmentParameteriv = (PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVPROC)load("glGetFramebufferAttachmentParameteriv"); - glad_glGenerateMipmap = (PFNGLGENERATEMIPMAPPROC)load("glGenerateMipmap"); - glad_glBlitFramebuffer = (PFNGLBLITFRAMEBUFFERPROC)load("glBlitFramebuffer"); - glad_glRenderbufferStorageMultisample = (PFNGLRENDERBUFFERSTORAGEMULTISAMPLEPROC)load("glRenderbufferStorageMultisample"); - glad_glFramebufferTextureLayer = (PFNGLFRAMEBUFFERTEXTURELAYERPROC)load("glFramebufferTextureLayer"); - glad_glMapBufferRange = (PFNGLMAPBUFFERRANGEPROC)load("glMapBufferRange"); - glad_glFlushMappedBufferRange = (PFNGLFLUSHMAPPEDBUFFERRANGEPROC)load("glFlushMappedBufferRange"); - glad_glBindVertexArray = (PFNGLBINDVERTEXARRAYPROC)load("glBindVertexArray"); - glad_glDeleteVertexArrays = (PFNGLDELETEVERTEXARRAYSPROC)load("glDeleteVertexArrays"); - glad_glGenVertexArrays = (PFNGLGENVERTEXARRAYSPROC)load("glGenVertexArrays"); - glad_glIsVertexArray = (PFNGLISVERTEXARRAYPROC)load("glIsVertexArray"); -} -static void load_GL_VERSION_3_1(GLADloadproc load) { - if(!GLAD_GL_VERSION_3_1) return; - glad_glDrawArraysInstanced = (PFNGLDRAWARRAYSINSTANCEDPROC)load("glDrawArraysInstanced"); - glad_glDrawElementsInstanced = (PFNGLDRAWELEMENTSINSTANCEDPROC)load("glDrawElementsInstanced"); - glad_glTexBuffer = (PFNGLTEXBUFFERPROC)load("glTexBuffer"); - glad_glPrimitiveRestartIndex = (PFNGLPRIMITIVERESTARTINDEXPROC)load("glPrimitiveRestartIndex"); - glad_glCopyBufferSubData = (PFNGLCOPYBUFFERSUBDATAPROC)load("glCopyBufferSubData"); - glad_glGetUniformIndices = (PFNGLGETUNIFORMINDICESPROC)load("glGetUniformIndices"); - glad_glGetActiveUniformsiv = (PFNGLGETACTIVEUNIFORMSIVPROC)load("glGetActiveUniformsiv"); - glad_glGetActiveUniformName = (PFNGLGETACTIVEUNIFORMNAMEPROC)load("glGetActiveUniformName"); - glad_glGetUniformBlockIndex = (PFNGLGETUNIFORMBLOCKINDEXPROC)load("glGetUniformBlockIndex"); - glad_glGetActiveUniformBlockiv = (PFNGLGETACTIVEUNIFORMBLOCKIVPROC)load("glGetActiveUniformBlockiv"); - glad_glGetActiveUniformBlockName = (PFNGLGETACTIVEUNIFORMBLOCKNAMEPROC)load("glGetActiveUniformBlockName"); - glad_glUniformBlockBinding = (PFNGLUNIFORMBLOCKBINDINGPROC)load("glUniformBlockBinding"); - glad_glBindBufferRange = (PFNGLBINDBUFFERRANGEPROC)load("glBindBufferRange"); - glad_glBindBufferBase = (PFNGLBINDBUFFERBASEPROC)load("glBindBufferBase"); - glad_glGetIntegeri_v = (PFNGLGETINTEGERI_VPROC)load("glGetIntegeri_v"); -} -static int find_extensionsGL(void) { - if (!get_exts()) return 0; - (void)&has_ext; - free_exts(); - return 1; -} - -static void find_coreGL(void) { - - /* Thank you @elmindreda - * https://github.com/elmindreda/greg/blob/master/templates/greg.c.in#L176 - * https://github.com/glfw/glfw/blob/master/src/context.c#L36 - */ - int i, major, minor; - - const char* version; - const char* prefixes[] = { - "OpenGL ES-CM ", - "OpenGL ES-CL ", - "OpenGL ES ", - NULL - }; - - version = (const char*) glGetString(GL_VERSION); - if (!version) return; - - for (i = 0; prefixes[i]; i++) { - const size_t length = strlen(prefixes[i]); - if (strncmp(version, prefixes[i], length) == 0) { - version += length; - break; - } - } - -/* PR #18 */ -#ifdef _MSC_VER - sscanf_s(version, "%d.%d", &major, &minor); -#else - sscanf(version, "%d.%d", &major, &minor); -#endif - - GLVersion.major = major; GLVersion.minor = minor; - max_loaded_major = major; max_loaded_minor = minor; - GLAD_GL_VERSION_1_0 = (major == 1 && minor >= 0) || major > 1; - GLAD_GL_VERSION_1_1 = (major == 1 && minor >= 1) || major > 1; - GLAD_GL_VERSION_1_2 = (major == 1 && minor >= 2) || major > 1; - GLAD_GL_VERSION_1_3 = (major == 1 && minor >= 3) || major > 1; - GLAD_GL_VERSION_1_4 = (major == 1 && minor >= 4) || major > 1; - GLAD_GL_VERSION_1_5 = (major == 1 && minor >= 5) || major > 1; - GLAD_GL_VERSION_2_0 = (major == 2 && minor >= 0) || major > 2; - GLAD_GL_VERSION_2_1 = (major == 2 && minor >= 1) || major > 2; - GLAD_GL_VERSION_3_0 = (major == 3 && minor >= 0) || major > 3; - GLAD_GL_VERSION_3_1 = (major == 3 && minor >= 1) || major > 3; - if (GLVersion.major > 3 || (GLVersion.major >= 3 && GLVersion.minor >= 1)) { - max_loaded_major = 3; - max_loaded_minor = 1; - } -} - -int gladLoadGLLoader(GLADloadproc load) { - GLVersion.major = 0; GLVersion.minor = 0; - glGetString = (PFNGLGETSTRINGPROC)load("glGetString"); - if(glGetString == NULL) return 0; - if(glGetString(GL_VERSION) == NULL) return 0; - find_coreGL(); - load_GL_VERSION_1_0(load); - load_GL_VERSION_1_1(load); - load_GL_VERSION_1_2(load); - load_GL_VERSION_1_3(load); - load_GL_VERSION_1_4(load); - load_GL_VERSION_1_5(load); - load_GL_VERSION_2_0(load); - load_GL_VERSION_2_1(load); - load_GL_VERSION_3_0(load); - load_GL_VERSION_3_1(load); - - if (!find_extensionsGL()) return 0; - return GLVersion.major != 0 || GLVersion.minor != 0; -} - -static void load_GL_ES_VERSION_2_0(GLADloadproc load) { - if(!GLAD_GL_ES_VERSION_2_0) return; - glad_glActiveTexture = (PFNGLACTIVETEXTUREPROC)load("glActiveTexture"); - glad_glAttachShader = (PFNGLATTACHSHADERPROC)load("glAttachShader"); - glad_glBindAttribLocation = (PFNGLBINDATTRIBLOCATIONPROC)load("glBindAttribLocation"); - glad_glBindBuffer = (PFNGLBINDBUFFERPROC)load("glBindBuffer"); - glad_glBindFramebuffer = (PFNGLBINDFRAMEBUFFERPROC)load("glBindFramebuffer"); - glad_glBindRenderbuffer = (PFNGLBINDRENDERBUFFERPROC)load("glBindRenderbuffer"); - glad_glBindTexture = (PFNGLBINDTEXTUREPROC)load("glBindTexture"); - glad_glBlendColor = (PFNGLBLENDCOLORPROC)load("glBlendColor"); - glad_glBlendEquation = (PFNGLBLENDEQUATIONPROC)load("glBlendEquation"); - glad_glBlendEquationSeparate = (PFNGLBLENDEQUATIONSEPARATEPROC)load("glBlendEquationSeparate"); - glad_glBlendFunc = (PFNGLBLENDFUNCPROC)load("glBlendFunc"); - glad_glBlendFuncSeparate = (PFNGLBLENDFUNCSEPARATEPROC)load("glBlendFuncSeparate"); - glad_glBufferData = (PFNGLBUFFERDATAPROC)load("glBufferData"); - glad_glBufferSubData = (PFNGLBUFFERSUBDATAPROC)load("glBufferSubData"); - glad_glCheckFramebufferStatus = (PFNGLCHECKFRAMEBUFFERSTATUSPROC)load("glCheckFramebufferStatus"); - glad_glClear = (PFNGLCLEARPROC)load("glClear"); - glad_glClearColor = (PFNGLCLEARCOLORPROC)load("glClearColor"); - glad_glClearDepthf = (PFNGLCLEARDEPTHFPROC)load("glClearDepthf"); - glad_glClearStencil = (PFNGLCLEARSTENCILPROC)load("glClearStencil"); - glad_glColorMask = (PFNGLCOLORMASKPROC)load("glColorMask"); - glad_glCompileShader = (PFNGLCOMPILESHADERPROC)load("glCompileShader"); - glad_glCompressedTexImage2D = (PFNGLCOMPRESSEDTEXIMAGE2DPROC)load("glCompressedTexImage2D"); - glad_glCompressedTexSubImage2D = (PFNGLCOMPRESSEDTEXSUBIMAGE2DPROC)load("glCompressedTexSubImage2D"); - glad_glCopyTexImage2D = (PFNGLCOPYTEXIMAGE2DPROC)load("glCopyTexImage2D"); - glad_glCopyTexSubImage2D = (PFNGLCOPYTEXSUBIMAGE2DPROC)load("glCopyTexSubImage2D"); - glad_glCreateProgram = (PFNGLCREATEPROGRAMPROC)load("glCreateProgram"); - glad_glCreateShader = (PFNGLCREATESHADERPROC)load("glCreateShader"); - glad_glCullFace = (PFNGLCULLFACEPROC)load("glCullFace"); - glad_glDeleteBuffers = (PFNGLDELETEBUFFERSPROC)load("glDeleteBuffers"); - glad_glDeleteFramebuffers = (PFNGLDELETEFRAMEBUFFERSPROC)load("glDeleteFramebuffers"); - glad_glDeleteProgram = (PFNGLDELETEPROGRAMPROC)load("glDeleteProgram"); - glad_glDeleteRenderbuffers = (PFNGLDELETERENDERBUFFERSPROC)load("glDeleteRenderbuffers"); - glad_glDeleteShader = (PFNGLDELETESHADERPROC)load("glDeleteShader"); - glad_glDeleteTextures = (PFNGLDELETETEXTURESPROC)load("glDeleteTextures"); - glad_glDepthFunc = (PFNGLDEPTHFUNCPROC)load("glDepthFunc"); - glad_glDepthMask = (PFNGLDEPTHMASKPROC)load("glDepthMask"); - glad_glDepthRangef = (PFNGLDEPTHRANGEFPROC)load("glDepthRangef"); - glad_glDetachShader = (PFNGLDETACHSHADERPROC)load("glDetachShader"); - glad_glDisable = (PFNGLDISABLEPROC)load("glDisable"); - glad_glDisableVertexAttribArray = (PFNGLDISABLEVERTEXATTRIBARRAYPROC)load("glDisableVertexAttribArray"); - glad_glDrawArrays = (PFNGLDRAWARRAYSPROC)load("glDrawArrays"); - glad_glDrawElements = (PFNGLDRAWELEMENTSPROC)load("glDrawElements"); - glad_glEnable = (PFNGLENABLEPROC)load("glEnable"); - glad_glEnableVertexAttribArray = (PFNGLENABLEVERTEXATTRIBARRAYPROC)load("glEnableVertexAttribArray"); - glad_glFinish = (PFNGLFINISHPROC)load("glFinish"); - glad_glFlush = (PFNGLFLUSHPROC)load("glFlush"); - glad_glFramebufferRenderbuffer = (PFNGLFRAMEBUFFERRENDERBUFFERPROC)load("glFramebufferRenderbuffer"); - glad_glFramebufferTexture2D = (PFNGLFRAMEBUFFERTEXTURE2DPROC)load("glFramebufferTexture2D"); - glad_glFrontFace = (PFNGLFRONTFACEPROC)load("glFrontFace"); - glad_glGenBuffers = (PFNGLGENBUFFERSPROC)load("glGenBuffers"); - glad_glGenerateMipmap = (PFNGLGENERATEMIPMAPPROC)load("glGenerateMipmap"); - glad_glGenFramebuffers = (PFNGLGENFRAMEBUFFERSPROC)load("glGenFramebuffers"); - glad_glGenRenderbuffers = (PFNGLGENRENDERBUFFERSPROC)load("glGenRenderbuffers"); - glad_glGenTextures = (PFNGLGENTEXTURESPROC)load("glGenTextures"); - glad_glGetActiveAttrib = (PFNGLGETACTIVEATTRIBPROC)load("glGetActiveAttrib"); - glad_glGetActiveUniform = (PFNGLGETACTIVEUNIFORMPROC)load("glGetActiveUniform"); - glad_glGetAttachedShaders = (PFNGLGETATTACHEDSHADERSPROC)load("glGetAttachedShaders"); - glad_glGetAttribLocation = (PFNGLGETATTRIBLOCATIONPROC)load("glGetAttribLocation"); - glad_glGetBooleanv = (PFNGLGETBOOLEANVPROC)load("glGetBooleanv"); - glad_glGetBufferParameteriv = (PFNGLGETBUFFERPARAMETERIVPROC)load("glGetBufferParameteriv"); - glad_glGetError = (PFNGLGETERRORPROC)load("glGetError"); - glad_glGetFloatv = (PFNGLGETFLOATVPROC)load("glGetFloatv"); - glad_glGetFramebufferAttachmentParameteriv = (PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVPROC)load("glGetFramebufferAttachmentParameteriv"); - glad_glGetIntegerv = (PFNGLGETINTEGERVPROC)load("glGetIntegerv"); - glad_glGetProgramiv = (PFNGLGETPROGRAMIVPROC)load("glGetProgramiv"); - glad_glGetProgramInfoLog = (PFNGLGETPROGRAMINFOLOGPROC)load("glGetProgramInfoLog"); - glad_glGetRenderbufferParameteriv = (PFNGLGETRENDERBUFFERPARAMETERIVPROC)load("glGetRenderbufferParameteriv"); - glad_glGetShaderiv = (PFNGLGETSHADERIVPROC)load("glGetShaderiv"); - glad_glGetShaderInfoLog = (PFNGLGETSHADERINFOLOGPROC)load("glGetShaderInfoLog"); - glad_glGetShaderPrecisionFormat = (PFNGLGETSHADERPRECISIONFORMATPROC)load("glGetShaderPrecisionFormat"); - glad_glGetShaderSource = (PFNGLGETSHADERSOURCEPROC)load("glGetShaderSource"); - glad_glGetString = (PFNGLGETSTRINGPROC)load("glGetString"); - glad_glGetTexParameterfv = (PFNGLGETTEXPARAMETERFVPROC)load("glGetTexParameterfv"); - glad_glGetTexParameteriv = (PFNGLGETTEXPARAMETERIVPROC)load("glGetTexParameteriv"); - glad_glGetUniformfv = (PFNGLGETUNIFORMFVPROC)load("glGetUniformfv"); - glad_glGetUniformiv = (PFNGLGETUNIFORMIVPROC)load("glGetUniformiv"); - glad_glGetUniformLocation = (PFNGLGETUNIFORMLOCATIONPROC)load("glGetUniformLocation"); - glad_glGetVertexAttribfv = (PFNGLGETVERTEXATTRIBFVPROC)load("glGetVertexAttribfv"); - glad_glGetVertexAttribiv = (PFNGLGETVERTEXATTRIBIVPROC)load("glGetVertexAttribiv"); - glad_glGetVertexAttribPointerv = (PFNGLGETVERTEXATTRIBPOINTERVPROC)load("glGetVertexAttribPointerv"); - glad_glHint = (PFNGLHINTPROC)load("glHint"); - glad_glIsBuffer = (PFNGLISBUFFERPROC)load("glIsBuffer"); - glad_glIsEnabled = (PFNGLISENABLEDPROC)load("glIsEnabled"); - glad_glIsFramebuffer = (PFNGLISFRAMEBUFFERPROC)load("glIsFramebuffer"); - glad_glIsProgram = (PFNGLISPROGRAMPROC)load("glIsProgram"); - glad_glIsRenderbuffer = (PFNGLISRENDERBUFFERPROC)load("glIsRenderbuffer"); - glad_glIsShader = (PFNGLISSHADERPROC)load("glIsShader"); - glad_glIsTexture = (PFNGLISTEXTUREPROC)load("glIsTexture"); - glad_glLineWidth = (PFNGLLINEWIDTHPROC)load("glLineWidth"); - glad_glLinkProgram = (PFNGLLINKPROGRAMPROC)load("glLinkProgram"); - glad_glPixelStorei = (PFNGLPIXELSTOREIPROC)load("glPixelStorei"); - glad_glPolygonOffset = (PFNGLPOLYGONOFFSETPROC)load("glPolygonOffset"); - glad_glReadPixels = (PFNGLREADPIXELSPROC)load("glReadPixels"); - glad_glReleaseShaderCompiler = (PFNGLRELEASESHADERCOMPILERPROC)load("glReleaseShaderCompiler"); - glad_glRenderbufferStorage = (PFNGLRENDERBUFFERSTORAGEPROC)load("glRenderbufferStorage"); - glad_glSampleCoverage = (PFNGLSAMPLECOVERAGEPROC)load("glSampleCoverage"); - glad_glScissor = (PFNGLSCISSORPROC)load("glScissor"); - glad_glShaderBinary = (PFNGLSHADERBINARYPROC)load("glShaderBinary"); - glad_glShaderSource = (PFNGLSHADERSOURCEPROC)load("glShaderSource"); - glad_glStencilFunc = (PFNGLSTENCILFUNCPROC)load("glStencilFunc"); - glad_glStencilFuncSeparate = (PFNGLSTENCILFUNCSEPARATEPROC)load("glStencilFuncSeparate"); - glad_glStencilMask = (PFNGLSTENCILMASKPROC)load("glStencilMask"); - glad_glStencilMaskSeparate = (PFNGLSTENCILMASKSEPARATEPROC)load("glStencilMaskSeparate"); - glad_glStencilOp = (PFNGLSTENCILOPPROC)load("glStencilOp"); - glad_glStencilOpSeparate = (PFNGLSTENCILOPSEPARATEPROC)load("glStencilOpSeparate"); - glad_glTexImage2D = (PFNGLTEXIMAGE2DPROC)load("glTexImage2D"); - glad_glTexParameterf = (PFNGLTEXPARAMETERFPROC)load("glTexParameterf"); - glad_glTexParameterfv = (PFNGLTEXPARAMETERFVPROC)load("glTexParameterfv"); - glad_glTexParameteri = (PFNGLTEXPARAMETERIPROC)load("glTexParameteri"); - glad_glTexParameteriv = (PFNGLTEXPARAMETERIVPROC)load("glTexParameteriv"); - glad_glTexSubImage2D = (PFNGLTEXSUBIMAGE2DPROC)load("glTexSubImage2D"); - glad_glUniform1f = (PFNGLUNIFORM1FPROC)load("glUniform1f"); - glad_glUniform1fv = (PFNGLUNIFORM1FVPROC)load("glUniform1fv"); - glad_glUniform1i = (PFNGLUNIFORM1IPROC)load("glUniform1i"); - glad_glUniform1iv = (PFNGLUNIFORM1IVPROC)load("glUniform1iv"); - glad_glUniform2f = (PFNGLUNIFORM2FPROC)load("glUniform2f"); - glad_glUniform2fv = (PFNGLUNIFORM2FVPROC)load("glUniform2fv"); - glad_glUniform2i = (PFNGLUNIFORM2IPROC)load("glUniform2i"); - glad_glUniform2iv = (PFNGLUNIFORM2IVPROC)load("glUniform2iv"); - glad_glUniform3f = (PFNGLUNIFORM3FPROC)load("glUniform3f"); - glad_glUniform3fv = (PFNGLUNIFORM3FVPROC)load("glUniform3fv"); - glad_glUniform3i = (PFNGLUNIFORM3IPROC)load("glUniform3i"); - glad_glUniform3iv = (PFNGLUNIFORM3IVPROC)load("glUniform3iv"); - glad_glUniform4f = (PFNGLUNIFORM4FPROC)load("glUniform4f"); - glad_glUniform4fv = (PFNGLUNIFORM4FVPROC)load("glUniform4fv"); - glad_glUniform4i = (PFNGLUNIFORM4IPROC)load("glUniform4i"); - glad_glUniform4iv = (PFNGLUNIFORM4IVPROC)load("glUniform4iv"); - glad_glUniformMatrix2fv = (PFNGLUNIFORMMATRIX2FVPROC)load("glUniformMatrix2fv"); - glad_glUniformMatrix3fv = (PFNGLUNIFORMMATRIX3FVPROC)load("glUniformMatrix3fv"); - glad_glUniformMatrix4fv = (PFNGLUNIFORMMATRIX4FVPROC)load("glUniformMatrix4fv"); - glad_glUseProgram = (PFNGLUSEPROGRAMPROC)load("glUseProgram"); - glad_glValidateProgram = (PFNGLVALIDATEPROGRAMPROC)load("glValidateProgram"); - glad_glVertexAttrib1f = (PFNGLVERTEXATTRIB1FPROC)load("glVertexAttrib1f"); - glad_glVertexAttrib1fv = (PFNGLVERTEXATTRIB1FVPROC)load("glVertexAttrib1fv"); - glad_glVertexAttrib2f = (PFNGLVERTEXATTRIB2FPROC)load("glVertexAttrib2f"); - glad_glVertexAttrib2fv = (PFNGLVERTEXATTRIB2FVPROC)load("glVertexAttrib2fv"); - glad_glVertexAttrib3f = (PFNGLVERTEXATTRIB3FPROC)load("glVertexAttrib3f"); - glad_glVertexAttrib3fv = (PFNGLVERTEXATTRIB3FVPROC)load("glVertexAttrib3fv"); - glad_glVertexAttrib4f = (PFNGLVERTEXATTRIB4FPROC)load("glVertexAttrib4f"); - glad_glVertexAttrib4fv = (PFNGLVERTEXATTRIB4FVPROC)load("glVertexAttrib4fv"); - glad_glVertexAttribPointer = (PFNGLVERTEXATTRIBPOINTERPROC)load("glVertexAttribPointer"); - glad_glViewport = (PFNGLVIEWPORTPROC)load("glViewport"); -} -static int find_extensionsGLES2(void) { - if (!get_exts()) return 0; - (void)&has_ext; - free_exts(); - return 1; -} - -static void find_coreGLES2(void) { - - /* Thank you @elmindreda - * https://github.com/elmindreda/greg/blob/master/templates/greg.c.in#L176 - * https://github.com/glfw/glfw/blob/master/src/context.c#L36 - */ - int i, major, minor; - - const char* version; - const char* prefixes[] = { - "OpenGL ES-CM ", - "OpenGL ES-CL ", - "OpenGL ES ", - NULL - }; - - version = (const char*) glGetString(GL_VERSION); - if (!version) return; - - for (i = 0; prefixes[i]; i++) { - const size_t length = strlen(prefixes[i]); - if (strncmp(version, prefixes[i], length) == 0) { - version += length; - break; - } - } - -/* PR #18 */ -#ifdef _MSC_VER - sscanf_s(version, "%d.%d", &major, &minor); -#else - sscanf(version, "%d.%d", &major, &minor); -#endif - - GLVersion.major = major; GLVersion.minor = minor; - max_loaded_major = major; max_loaded_minor = minor; - GLAD_GL_ES_VERSION_2_0 = (major == 2 && minor >= 0) || major > 2; - if (GLVersion.major > 2 || (GLVersion.major >= 2 && GLVersion.minor >= 0)) { - max_loaded_major = 2; - max_loaded_minor = 0; - } -} - -int gladLoadGLES2Loader(GLADloadproc load) { - GLVersion.major = 0; GLVersion.minor = 0; - glGetString = (PFNGLGETSTRINGPROC)load("glGetString"); - if(glGetString == NULL) return 0; - if(glGetString(GL_VERSION) == NULL) return 0; - find_coreGLES2(); - load_GL_ES_VERSION_2_0(load); - - if (!find_extensionsGLES2()) return 0; - return GLVersion.major != 0 || GLVersion.minor != 0; -} - diff --git a/src_rebuild/PsyCross/src/util/crash_handler.cpp b/src_rebuild/PsyCross/src/util/crash_handler.cpp deleted file mode 100644 index b1c0b096..00000000 --- a/src_rebuild/PsyCross/src/util/crash_handler.cpp +++ /dev/null @@ -1,199 +0,0 @@ -#ifdef _WINDOWS - -#include -#include -#include -#include - -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 \ No newline at end of file diff --git a/src_rebuild/PsyCross/src/util/crash_handler.h b/src_rebuild/PsyCross/src/util/crash_handler.h deleted file mode 100644 index fc4bee0d..00000000 --- a/src_rebuild/PsyCross/src/util/crash_handler.h +++ /dev/null @@ -1,7 +0,0 @@ -#ifndef CRASH_HANDLER_H -#define CRASH_HANDLER_H - -void InstallExceptionHandler(); -void UnInstallExceptionHandler(); - -#endif \ No newline at end of file diff --git a/src_rebuild/PsyCross/src/util/timer.c b/src_rebuild/PsyCross/src/util/timer.c deleted file mode 100644 index 4f36f346..00000000 --- a/src_rebuild/PsyCross/src/util/timer.c +++ /dev/null @@ -1,44 +0,0 @@ -#ifdef _WIN32 -#include -#else -#include -#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; -} \ No newline at end of file diff --git a/src_rebuild/premake5.lua b/src_rebuild/premake5.lua index 93409e21..ab56f11b 100644 --- a/src_rebuild/premake5.lua +++ b/src_rebuild/premake5.lua @@ -135,7 +135,7 @@ if os.target() == "windows" or os.target() == "emscripten" then end -- Psy-Cross layer -include "PsyCross/premake5.lua" +include "premake5_psycross.lua" -- game iteslf project "REDRIVER2" diff --git a/src_rebuild/PsyCross/premake5.lua b/src_rebuild/premake5_psycross.lua similarity index 77% rename from src_rebuild/PsyCross/premake5.lua rename to src_rebuild/premake5_psycross.lua index 30c3138f..b7c3bb0c 100644 --- a/src_rebuild/PsyCross/premake5.lua +++ b/src_rebuild/premake5_psycross.lua @@ -1,3 +1,5 @@ +-- if you want to build project with PsyCross - you have to include it to your workspace + -- Psy-Cross layer project "PsyCross" kind "StaticLib" @@ -7,12 +9,12 @@ project "PsyCross" defines { GAME_REGION } files { - "**.h", - "**.H", - "**.c", - "**.C", - "**.cpp", - "**.CPP", + "PsyCross/**.h", + "PsyCross/**.H", + "PsyCross/**.c", + "PsyCross/**.C", + "PsyCross/**.cpp", + "PsyCross/**.CPP", } defines { } @@ -20,7 +22,7 @@ project "PsyCross" includedirs { SDL2_DIR.."/include", OPENAL_DIR.."/include", - "include" + "PsyCross/include" } filter "system:Windows" @@ -30,13 +32,13 @@ project "PsyCross" "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", @@ -56,16 +58,16 @@ project "PsyCross" 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" + "PsyCross/include", + "PsyCross/include/psx" } \ No newline at end of file diff --git a/src_rebuild/redriver2_psxpc.cpp b/src_rebuild/redriver2_psxpc.cpp index c2f5d575..d635ebe6 100644 --- a/src_rebuild/redriver2_psxpc.cpp +++ b/src_rebuild/redriver2_psxpc.cpp @@ -338,124 +338,125 @@ char g_Replay_buffer[0x50000]; // 0x1fABBC void ParseKeyboardMappings(ini_t* config, char* section, PsyXKeyboardMapping& outMapping) { - extern PsyXKeyboardMapping g_keyboard_mapping; + // since it is configured by default + const PsyXKeyboardMapping& defaultMapping = g_cfg_keyboardMapping; const char* str; str = ini_get(config, section, "square"); - outMapping.kc_square = PsyX_LookupKeyboardMapping(str, g_keyboard_mapping.kc_square); + outMapping.kc_square = PsyX_LookupKeyboardMapping(str, defaultMapping.kc_square); str = ini_get(config, section, "circle"); - outMapping.kc_circle = PsyX_LookupKeyboardMapping(str, g_keyboard_mapping.kc_circle); + outMapping.kc_circle = PsyX_LookupKeyboardMapping(str, defaultMapping.kc_circle); str = ini_get(config, section, "triangle"); - outMapping.kc_triangle = PsyX_LookupKeyboardMapping(str, g_keyboard_mapping.kc_triangle); + outMapping.kc_triangle = PsyX_LookupKeyboardMapping(str, defaultMapping.kc_triangle); str = ini_get(config, section, "cross"); - outMapping.kc_cross = PsyX_LookupKeyboardMapping(str, g_keyboard_mapping.kc_cross); + outMapping.kc_cross = PsyX_LookupKeyboardMapping(str, defaultMapping.kc_cross); str = ini_get(config, section, "l1"); - outMapping.kc_l1 = PsyX_LookupKeyboardMapping(str, g_keyboard_mapping.kc_l1); + outMapping.kc_l1 = PsyX_LookupKeyboardMapping(str, defaultMapping.kc_l1); str = ini_get(config, section, "l2"); - outMapping.kc_l2 = PsyX_LookupKeyboardMapping(str, g_keyboard_mapping.kc_l2); + outMapping.kc_l2 = PsyX_LookupKeyboardMapping(str, defaultMapping.kc_l2); str = ini_get(config, section, "l3"); - outMapping.kc_l3 = PsyX_LookupKeyboardMapping(str, g_keyboard_mapping.kc_l3); + outMapping.kc_l3 = PsyX_LookupKeyboardMapping(str, defaultMapping.kc_l3); str = ini_get(config, section, "r1"); - outMapping.kc_r1 = PsyX_LookupKeyboardMapping(str, g_keyboard_mapping.kc_r1); + outMapping.kc_r1 = PsyX_LookupKeyboardMapping(str, defaultMapping.kc_r1); str = ini_get(config, section, "r2"); - outMapping.kc_r2 = PsyX_LookupKeyboardMapping(str, g_keyboard_mapping.kc_r2); + outMapping.kc_r2 = PsyX_LookupKeyboardMapping(str, defaultMapping.kc_r2); str = ini_get(config, section, "r3"); - outMapping.kc_r3 = PsyX_LookupKeyboardMapping(str, g_keyboard_mapping.kc_r3); + outMapping.kc_r3 = PsyX_LookupKeyboardMapping(str, defaultMapping.kc_r3); str = ini_get(config, section, "up"); - outMapping.kc_dpad_up = PsyX_LookupKeyboardMapping(str, g_keyboard_mapping.kc_dpad_up); + outMapping.kc_dpad_up = PsyX_LookupKeyboardMapping(str, defaultMapping.kc_dpad_up); str = ini_get(config, section, "down"); - outMapping.kc_dpad_down = PsyX_LookupKeyboardMapping(str, g_keyboard_mapping.kc_dpad_down); + outMapping.kc_dpad_down = PsyX_LookupKeyboardMapping(str, defaultMapping.kc_dpad_down); str = ini_get(config, section, "left"); - outMapping.kc_dpad_left = PsyX_LookupKeyboardMapping(str, g_keyboard_mapping.kc_dpad_left); + outMapping.kc_dpad_left = PsyX_LookupKeyboardMapping(str, defaultMapping.kc_dpad_left); str = ini_get(config, section, "right"); - outMapping.kc_dpad_right = PsyX_LookupKeyboardMapping(str, g_keyboard_mapping.kc_dpad_right); + outMapping.kc_dpad_right = PsyX_LookupKeyboardMapping(str, defaultMapping.kc_dpad_right); str = ini_get(config, section, "select"); - outMapping.kc_select = PsyX_LookupKeyboardMapping(str, g_keyboard_mapping.kc_select); + outMapping.kc_select = PsyX_LookupKeyboardMapping(str, defaultMapping.kc_select); str = ini_get(config, section, "start"); - outMapping.kc_start = PsyX_LookupKeyboardMapping(str, g_keyboard_mapping.kc_start); + outMapping.kc_start = PsyX_LookupKeyboardMapping(str, defaultMapping.kc_start); } void ParseControllerMappings(ini_t* config, char* section, PsyXControllerMapping& outMapping) { - extern PsyXControllerMapping g_controller_mapping; + const PsyXControllerMapping& defaultMapping = g_cfg_controllerMapping; const char* str; str = ini_get(config, section, "square"); - outMapping.gc_square = PsyX_LookupGameControllerMapping(str, g_controller_mapping.gc_square); + outMapping.gc_square = PsyX_LookupGameControllerMapping(str, defaultMapping.gc_square); str = ini_get(config, section, "circle"); - outMapping.gc_circle = PsyX_LookupGameControllerMapping(str, g_controller_mapping.gc_circle); + outMapping.gc_circle = PsyX_LookupGameControllerMapping(str, defaultMapping.gc_circle); str = ini_get(config, section, "triangle"); - outMapping.gc_triangle = PsyX_LookupGameControllerMapping(str, g_controller_mapping.gc_triangle); + outMapping.gc_triangle = PsyX_LookupGameControllerMapping(str, defaultMapping.gc_triangle); str = ini_get(config, section, "cross"); - outMapping.gc_cross = PsyX_LookupGameControllerMapping(str, g_controller_mapping.gc_cross); + outMapping.gc_cross = PsyX_LookupGameControllerMapping(str, defaultMapping.gc_cross); str = ini_get(config, section, "l1"); - outMapping.gc_l1 = PsyX_LookupGameControllerMapping(str, g_controller_mapping.gc_l1); + outMapping.gc_l1 = PsyX_LookupGameControllerMapping(str, defaultMapping.gc_l1); str = ini_get(config, section, "l2"); - outMapping.gc_l2 = PsyX_LookupGameControllerMapping(str, g_controller_mapping.gc_l2); + outMapping.gc_l2 = PsyX_LookupGameControllerMapping(str, defaultMapping.gc_l2); str = ini_get(config, section, "l3"); - outMapping.gc_l3 = PsyX_LookupGameControllerMapping(str, g_controller_mapping.gc_l3); + outMapping.gc_l3 = PsyX_LookupGameControllerMapping(str, defaultMapping.gc_l3); str = ini_get(config, section, "r1"); - outMapping.gc_r1 = PsyX_LookupGameControllerMapping(str, g_controller_mapping.gc_r1); + outMapping.gc_r1 = PsyX_LookupGameControllerMapping(str, defaultMapping.gc_r1); str = ini_get(config, section, "r2"); - outMapping.gc_r2 = PsyX_LookupGameControllerMapping(str, g_controller_mapping.gc_r2); + outMapping.gc_r2 = PsyX_LookupGameControllerMapping(str, defaultMapping.gc_r2); str = ini_get(config, section, "r3"); - outMapping.gc_r3 = PsyX_LookupGameControllerMapping(str, g_controller_mapping.gc_r3); + outMapping.gc_r3 = PsyX_LookupGameControllerMapping(str, defaultMapping.gc_r3); str = ini_get(config, section, "up"); - outMapping.gc_dpad_up = PsyX_LookupGameControllerMapping(str, g_controller_mapping.gc_dpad_up); + outMapping.gc_dpad_up = PsyX_LookupGameControllerMapping(str, defaultMapping.gc_dpad_up); str = ini_get(config, section, "down"); - outMapping.gc_dpad_down = PsyX_LookupGameControllerMapping(str, g_controller_mapping.gc_dpad_down); + outMapping.gc_dpad_down = PsyX_LookupGameControllerMapping(str, defaultMapping.gc_dpad_down); str = ini_get(config, section, "left"); - outMapping.gc_dpad_left = PsyX_LookupGameControllerMapping(str, g_controller_mapping.gc_dpad_left); + outMapping.gc_dpad_left = PsyX_LookupGameControllerMapping(str, defaultMapping.gc_dpad_left); str = ini_get(config, section, "right"); - outMapping.gc_dpad_right = PsyX_LookupGameControllerMapping(str, g_controller_mapping.gc_dpad_right); + outMapping.gc_dpad_right = PsyX_LookupGameControllerMapping(str, defaultMapping.gc_dpad_right); str = ini_get(config, section, "select"); - outMapping.gc_select = PsyX_LookupGameControllerMapping(str, g_controller_mapping.gc_select); + outMapping.gc_select = PsyX_LookupGameControllerMapping(str, defaultMapping.gc_select); str = ini_get(config, section, "start"); - outMapping.gc_start = PsyX_LookupGameControllerMapping(str, g_controller_mapping.gc_start); + outMapping.gc_start = PsyX_LookupGameControllerMapping(str, defaultMapping.gc_start); str = ini_get(config, section, "axis_left_x"); - outMapping.gc_axis_left_x = PsyX_LookupGameControllerMapping(str, g_controller_mapping.gc_axis_left_x); + outMapping.gc_axis_left_x = PsyX_LookupGameControllerMapping(str, defaultMapping.gc_axis_left_x); str = ini_get(config, section, "axis_left_y"); - outMapping.gc_axis_left_y = PsyX_LookupGameControllerMapping(str, g_controller_mapping.gc_axis_left_y); + outMapping.gc_axis_left_y = PsyX_LookupGameControllerMapping(str, defaultMapping.gc_axis_left_y); str = ini_get(config, section, "axis_right_x"); - outMapping.gc_axis_right_x = PsyX_LookupGameControllerMapping(str, g_controller_mapping.gc_axis_right_x); + outMapping.gc_axis_right_x = PsyX_LookupGameControllerMapping(str, defaultMapping.gc_axis_right_x); str = ini_get(config, section, "axis_right_y"); - outMapping.gc_axis_right_y = PsyX_LookupGameControllerMapping(str, g_controller_mapping.gc_axis_right_y); + outMapping.gc_axis_right_y = PsyX_LookupGameControllerMapping(str, defaultMapping.gc_axis_right_y); } PsyXKeyboardMapping g_kbGameMappings = { 0x123 }; @@ -466,18 +467,15 @@ PsyXControllerMapping g_gcMenuMappings = { 0x654 }; void SwitchMappings(int menu) { - extern PsyXKeyboardMapping g_keyboard_mapping; - extern PsyXControllerMapping g_controller_mapping; - if(menu) { - g_keyboard_mapping = g_kbMenuMappings; - g_controller_mapping = g_gcMenuMappings; + g_cfg_keyboardMapping = g_kbMenuMappings; + g_cfg_controllerMapping = g_gcMenuMappings; } else { - g_keyboard_mapping = g_kbGameMappings; - g_controller_mapping = g_gcGameMappings; + g_cfg_keyboardMapping = g_kbGameMappings; + g_cfg_controllerMapping = g_gcGameMappings; } } @@ -548,7 +546,10 @@ int main(int argc, char** argv) int windowWidth = 800; int windowHeight = 600; + int screenWidth = 800; + int screenHeight = 600; int fullScreen = 0; + int vsync = 0; int enableFreecamera = 0; extern int gUserLanguage; @@ -567,16 +568,19 @@ int main(int argc, char** argv) InitUserReplays(userReplaysStr); // configure Psy-X pads - ini_sget(config, "pad", "pad1device", "%d", &g_controllerToSlotMapping[0]); - ini_sget(config, "pad", "pad2device", "%d", &g_controllerToSlotMapping[1]); + ini_sget(config, "pad", "pad1device", "%d", &g_cfg_controllerToSlotMapping[0]); + ini_sget(config, "pad", "pad2device", "%d", &g_cfg_controllerToSlotMapping[1]); // configure Psy-X renderer ini_sget(config, "render", "windowWidth", "%d", &windowWidth); ini_sget(config, "render", "windowHeight", "%d", &windowHeight); + ini_sget(config, "render", "screenWidth", "%d", &screenWidth); + ini_sget(config, "render", "screenHeight", "%d", &screenHeight); ini_sget(config, "render", "fullscreen", "%d", &fullScreen); - ini_sget(config, "render", "pgxpTextureMapping", "%d", &g_pgxpTextureCorrection); - ini_sget(config, "render", "pgxpZbuffer", "%d", &g_pgxpZBuffer); - ini_sget(config, "render", "bilinearFiltering", "%d", &g_bilinearFiltering); + ini_sget(config, "render", "vsync", "%d", &g_cfg_swapInterval); + ini_sget(config, "render", "pgxpTextureMapping", "%d", &g_cfg_pgxpTextureCorrection); + ini_sget(config, "render", "pgxpZbuffer", "%d", &g_cfg_pgxpZBuffer); + ini_sget(config, "render", "bilinearFiltering", "%d", &g_cfg_bilinearFiltering); // configure host game ini_sget(config, "game", "drawDistance", "%d", &gDrawDistance); @@ -626,17 +630,17 @@ int main(int argc, char** argv) #ifndef _DEBUG if (enableFreecamera) { - gameDebugKeys = FreeCameraKeyboardHandler; - gameDebugMouse = FreeCameraMouseHandler; + g_dbg_gameDebugKeys = FreeCameraKeyboardHandler; + g_dbg_gameDebugMouse = FreeCameraMouseHandler; } #else - gameDebugKeys = GameDebugKeys; - gameDebugMouse = FreeCameraMouseHandler; + g_dbg_gameDebugKeys = GameDebugKeys; + g_dbg_gameDebugMouse = FreeCameraMouseHandler; #endif - PsyX_Initialise("REDRIVER2", windowWidth, windowHeight, fullScreen); + PsyX_Initialise("REDRIVER2", fullScreen ? screenWidth : windowWidth, fullScreen ? screenHeight : windowHeight, fullScreen); char version_info[32]; GetTimeStamp(version_info); diff --git a/src_rebuild/utils/video_source/VideoPlayer.cpp b/src_rebuild/utils/video_source/VideoPlayer.cpp index dfd6df0e..4f0b2b0d 100644 --- a/src_rebuild/utils/video_source/VideoPlayer.cpp +++ b/src_rebuild/utils/video_source/VideoPlayer.cpp @@ -10,6 +10,7 @@ #include "C/system.h" #include "C/E3stuff.h" #include "C/fmv_font.h" +#include "C/fmvplay.h" #include #include diff --git a/windows_dev_prepare.ps1 b/windows_dev_prepare.ps1 new file mode 100644 index 00000000..25a675e0 --- /dev/null +++ b/windows_dev_prepare.ps1 @@ -0,0 +1,37 @@ +$windows_premake_url = 'https://github.com/premake/premake-core/releases/download/v5.0.0-beta1/premake-5.0.0-beta1-windows.zip' +$windows_jpeg_url = 'http://www.ijg.org/files/jpegsr9d.zip' +$windows_openal_url = 'https://openal-soft.org/openal-binaries/openal-soft-1.21.1-bin.zip' +$windows_sdl2_url = 'https://www.libsdl.org/release/SDL2-devel-2.0.20-VC.zip' + +$project_folder = '.\\src_rebuild' +$dependency_folder = $project_folder + '\\dependencies' + +# Download required dependencies +Invoke-WebRequest -Uri $windows_premake_url -OutFile PREMAKE.zip +Expand-Archive PREMAKE.zip -DestinationPath $project_folder + +Invoke-WebRequest -Uri $windows_sdl2_url -OutFile SDL2.zip +Expand-Archive SDL2.zip -DestinationPath $dependency_folder + +Invoke-WebRequest -Uri $windows_openal_url -OutFile OPENAL.zip +Expand-Archive OPENAL.zip -DestinationPath $dependency_folder + +Invoke-WebRequest -Uri $windows_jpeg_url -OutFile JPEG.zip +Expand-Archive JPEG.zip -DestinationPath $dependency_folder + +# Generate project files +$windows_jpeg_dir = '.\\dependencies\\jpeg-9d' +$windows_openal_dir = '.\\dependencies\\openal-soft-1.21.1-bin' +$windows_sdl2_dir = '.\\dependencies\\SDL2-2.0.20' + +$env:SDL2_DIR = $windows_sdl2_dir +$env:OPENAL_DIR = $windows_openal_dir +$env:JPEG_DIR = $windows_jpeg_dir + +Set-Location -Path $project_folder +Rename-Item -Path ($windows_jpeg_dir + '\\jconfig.vc') -NewName "jconfig.h" + +& .\\premake5 vs2019 + +# Open solution +& .\\project_vs2019_windows\\REDRIVER2.sln \ No newline at end of file