summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoraliaspider2015-11-04 17:59:57 +0100
committeraliaspider2015-11-04 17:59:57 +0100
commit0e70c7f861ed41b86be891882d08cd0fa0530d55 (patch)
treebfa04def3519523ce64280494c9d7c44f05fdfbe
parent47d0f0c4a19a0566912ca293ff29abd32e6d01a9 (diff)
downloadsnes9x2002-0e70c7f861ed41b86be891882d08cd0fa0530d55.tar.gz
snes9x2002-0e70c7f861ed41b86be891882d08cd0fa0530d55.tar.bz2
snes9x2002-0e70c7f861ed41b86be891882d08cd0fa0530d55.zip
cleanups
-rw-r--r--src/2xsaiwin.cpp707
-rw-r--r--src/3d.h100
-rw-r--r--src/caanoo_sdk.c806
-rw-r--r--src/caanoo_sdk.h64
-rw-r--r--src/compile.txt27
-rw-r--r--src/rel/warm_2.6.24.kobin86123 -> 0 bytes
-rw-r--r--src/snapshots/do.sh4
-rw-r--r--src/spc700/spcgen.c4
-rw-r--r--src/spc700/spcgen.dsp88
-rw-r--r--src/spc700/spcgen.dsw29
-rw-r--r--src/spc700/spcgen.ncbbin41984 -> 0 bytes
-rw-r--r--src/spc700/spcgen.optbin53760 -> 0 bytes
-rw-r--r--src/spc700/spcgen.plg32
-rw-r--r--src/zip/do.sh4
14 files changed, 2 insertions, 1863 deletions
diff --git a/src/2xsaiwin.cpp b/src/2xsaiwin.cpp
deleted file mode 100644
index fbff856..0000000
--- a/src/2xsaiwin.cpp
+++ /dev/null
@@ -1,707 +0,0 @@
-/*
- * Snes9x - Portable Super Nintendo Entertainment System (TM) emulator.
- *
- * (c) Copyright 1996 - 2001 Gary Henderson (gary.henderson@ntlworld.com) and
- * Jerremy Koot (jkoot@snes9x.com)
- *
- * Super FX C emulator code
- * (c) Copyright 1997 - 1999 Ivar (ivar@snes9x.com) and
- * Gary Henderson.
- * Super FX assembler emulator code (c) Copyright 1998 zsKnight and _Demo_.
- *
- * DSP1 emulator code (c) Copyright 1998 Ivar, _Demo_ and Gary Henderson.
- * C4 asm and some C emulation code (c) Copyright 2000 zsKnight and _Demo_.
- * C4 C code (c) Copyright 2001 Gary Henderson (gary.henderson@ntlworld.com).
- *
- * DOS port code contains the works of other authors. See headers in
- * individual files.
- *
- * Snes9x homepage: http://www.snes9x.com
- *
- * Permission to use, copy, modify and distribute Snes9x in both binary and
- * source form, for non-commercial purposes, is hereby granted without fee,
- * providing that this license information and copyright notice appear with
- * all copies and any derived work.
- *
- * This software is provided 'as-is', without any express or implied
- * warranty. In no event shall the authors be held liable for any damages
- * arising from the use of this software.
- *
- * Snes9x is freeware for PERSONAL USE only. Commercial users should
- * seek permission of the copyright holders first. Commercial use includes
- * charging money for Snes9x or software derived from Snes9x.
- *
- * The copyright holders request that bug fixes and improvements to the code
- * should be forwarded to them so everyone can benefit from the modifications
- * in future versions.
- *
- * Super NES and Super Nintendo Entertainment System are trademarks of
- * Nintendo Co., Limited and its subsidiary companies.
- */
-//#define MMX
-
-#if !defined(_SNESPPC) && !defined(__GIZ__) && !defined(__GP2X__) && !defined(__WIZ__)
-#include "snes9x/snes9x.h"
-#include "snes9x/port.h"
-#include "snes9x/gfx.h"
-#else
-#include "snes9x.h"
-#include "port.h"
-#include "gfx.h"
-#endif
-
-#ifdef MMX
-EXTERN_C void _2xSaILine (uint8 *srcPtr, uint8 *deltaPtr, uint32 srcPitch, uint32 width,
- uint8 *dstPtr, uint32 dstPitch);
-EXTERN_C void _2xSaISuperEagleLine (uint8 *srcPtr, uint8 *deltaPtr, uint32 srcPitch, uint32 width,
- uint8 *dstPtr, uint32 dstPitch);
-EXTERN_C int Init_2xSaIMMX (uint32 BitFormat);
-#endif
-
-bool mmx_cpu = false;
-
-static uint32 colorMask = 0xF7DEF7DE;
-static uint32 lowPixelMask = 0x08210821;
-static uint32 qcolorMask = 0xE79CE79C;
-static uint32 qlowpixelMask = 0x18631863;
-
-
-int Init_2xSaI(uint32 BitFormat)
-{
- if (BitFormat == 565)
- {
- colorMask = 0xF7DEF7DE;
- lowPixelMask = 0x08210821;
- qcolorMask = 0xE79CE79C;
- qlowpixelMask = 0x18631863;
- }
- else
- if (BitFormat == 555)
- {
- colorMask = 0x7BDE7BDE;
- lowPixelMask = 0x04210421;
- qcolorMask = 0x739C739C;
- qlowpixelMask = 0x0C630C63;
- }
- else
- {
- return 0;
- }
-#ifdef MMX
- Init_2xSaIMMX(BitFormat);
-#endif
- return 1;
-}
-
-STATIC inline int GetResult1(uint32 A, uint32 B, uint32 C, uint32 D, uint32 E)
-{
- int x = 0;
- int y = 0;
- int r = 0;
- if (A == C) x+=1; else if (B == C) y+=1;
- if (A == D) x+=1; else if (B == D) y+=1;
- if (x <= 1) r+=1;
- if (y <= 1) r-=1;
- return r;
-}
-
-STATIC inline int GetResult2(uint32 A, uint32 B, uint32 C, uint32 D, uint32 E)
-{
- int x = 0;
- int y = 0;
- int r = 0;
- if (A == C) x+=1; else if (B == C) y+=1;
- if (A == D) x+=1; else if (B == D) y+=1;
- if (x <= 1) r-=1;
- if (y <= 1) r+=1;
- return r;
-}
-
-
-STATIC inline int GetResult(uint32 A, uint32 B, uint32 C, uint32 D)
-{
- int x = 0;
- int y = 0;
- int r = 0;
- if (A == C) x+=1; else if (B == C) y+=1;
- if (A == D) x+=1; else if (B == D) y+=1;
- if (x <= 1) r+=1;
- if (y <= 1) r-=1;
- return r;
-}
-
-
-STATIC inline uint32 INTERPOLATE(uint32 A, uint32 B)
-{
- if (A !=B)
- {
- return ( ((A & colorMask) >> 1) + ((B & colorMask) >> 1) + (A & B & lowPixelMask) );
- }
- else return A;
-}
-
-
-STATIC inline uint32 Q_INTERPOLATE(uint32 A, uint32 B, uint32 C, uint32 D)
-{
- register uint32 x = ((A & qcolorMask) >> 2) +
- ((B & qcolorMask) >> 2) +
- ((C & qcolorMask) >> 2) +
- ((D & qcolorMask) >> 2);
- register uint32 y = (A & qlowpixelMask) +
- (B & qlowpixelMask) +
- (C & qlowpixelMask) +
- (D & qlowpixelMask);
- y = (y>>2) & qlowpixelMask;
- return x+y;
-}
-
-
-
-
-#define HOR
-#define VER
-void Super2xSaI(uint8 *srcPtr, uint32 srcPitch,
- uint8 *deltaPtr,
- uint8 *dstPtr, uint32 dstPitch, int width, int height)
-{
- uint32 *dP;
- uint16 *bP;
-
-#ifdef MMX_BLA //no MMX version yet
- if (cpu_mmx && width != 512)
- {
- for (height; height; height-=1)
- {
- bP = (uint16 *) srcPtr;
- xP = (uint16 *) deltaPtr;
- dP = (uint32 *) dstPtr;
- _2xSaISuperEagleLine ((uint8 *) bP, (uint8 *) xP, srcPitch, width, (uint8 *) dP, dstPitch);
- dstPtr += dstPitch << 1;
- srcPtr += srcPitch;
- deltaPtr += srcPitch;
- }
- }
- else
- {
-#endif
- uint32 Nextline = srcPitch >> 1;
-
- for (height; height; height-=1)
- {
- bP = (uint16 *) srcPtr;
- dP = (uint32 *) dstPtr;
- for (uint32 finish = width; finish; finish -= 1 )
- {
- uint32 color4, color5, color6;
- uint32 color1, color2, color3;
- uint32 colorA0, colorA1, colorA2, colorA3,
- colorB0, colorB1, colorB2, colorB3,
- colorS1, colorS2;
- uint32 product1a, product1b,
- product2a, product2b;
-
-//--------------------------------------- B1 B2
-// 4 5 6 S2
-// 1 2 3 S1
-// A1 A2
-
- colorB0 = *(bP- Nextline - 1);
- colorB1 = *(bP- Nextline);
- colorB2 = *(bP- Nextline + 1);
- colorB3 = *(bP- Nextline + 2);
-
- color4 = *(bP - 1);
- color5 = *(bP);
- color6 = *(bP + 1);
- colorS2 = *(bP + 2);
-
- color1 = *(bP + Nextline - 1);
- color2 = *(bP + Nextline);
- color3 = *(bP + Nextline + 1);
- colorS1 = *(bP + Nextline + 2);
-
- colorA0 = *(bP + Nextline + Nextline - 1);
- colorA1 = *(bP + Nextline + Nextline);
- colorA2 = *(bP + Nextline + Nextline + 1);
- colorA3 = *(bP + Nextline + Nextline + 2);
-
-
-//--------------------------------------
- if (color2 == color6 && color5 != color3)
- {
- product2b = product1b = color2;
- }
- else
- if (color5 == color3 && color2 != color6)
- {
- product2b = product1b = color5;
- }
- else
- if (color5 == color3 && color2 == color6 && color5 != color6)
- {
- register int r = 0;
-
- r += GetResult (color6, color5, color1, colorA1);
- r += GetResult (color6, color5, color4, colorB1);
- r += GetResult (color6, color5, colorA2, colorS1);
- r += GetResult (color6, color5, colorB2, colorS2);
-
- if (r > 0)
- product2b = product1b = color6;
- else
- if (r < 0)
- product2b = product1b = color5;
- else
- {
- product2b = product1b = INTERPOLATE (color5, color6);
- }
-
- }
- else
- {
-
-#ifdef VER
- if (color6 == color3 && color3 == colorA1 && color2 != colorA2 && color3 != colorA0)
- product2b = Q_INTERPOLATE (color3, color3, color3, color2);
- else
- if (color5 == color2 && color2 == colorA2 && colorA1 != color3 && color2 != colorA3)
- product2b = Q_INTERPOLATE (color2, color2, color2, color3);
- else
-#endif
- product2b = INTERPOLATE (color2, color3);
-
-#ifdef VER
- if (color6 == color3 && color6 == colorB1 && color5 != colorB2 && color6 != colorB0)
- product1b = Q_INTERPOLATE (color6, color6, color6, color5);
- else
- if (color5 == color2 && color5 == colorB2 && colorB1 != color6 && color5 != colorB3)
- product1b = Q_INTERPOLATE (color6, color5, color5, color5);
- else
-#endif
- product1b = INTERPOLATE (color5, color6);
- }
-
-#ifdef HOR
- if (color5 == color3 && color2 != color6 && color4 == color5 && color5 != colorA2)
- product2a = INTERPOLATE (color2, color5);
- else
- if (color5 == color1 && color6 == color5 && color4 != color2 && color5 != colorA0)
- product2a = INTERPOLATE(color2, color5);
- else
-#endif
- product2a = color2;
-
-#ifdef HOR
- if (color2 == color6 && color5 != color3 && color1 == color2 && color2 != colorB2)
- product1a = INTERPOLATE (color2, color5);
- else
- if (color4 == color2 && color3 == color2 && color1 != color5 && color2 != colorB0)
- product1a = INTERPOLATE(color2, color5);
- else
-#endif
- product1a = color5;
-
-
- product1a = product1a | (product1b << 16);
- product2a = product2a | (product2b << 16);
-
- *(dP) = product1a;
- *(dP+(dstPitch>>2)) = product2a;
-
- bP += 1;
- dP += 1;
- }//end of for ( finish= width etc..)
-
- dstPtr += dstPitch << 1;
- srcPtr += srcPitch;
- deltaPtr += srcPitch;
- }; //endof: for (height; height; height--)
-#ifdef MMX_BLA
- }
-#endif
-}
-
-
-
-
-
-
-/*ONLY use with 640x480x16 or higher resolutions*/
-/*Only use this if 2*width * 2*height fits on the current screen*/
-void SuperEagle(uint8 *srcPtr, uint32 srcPitch,
- uint8 *deltaPtr,
- uint8 *dstPtr, uint32 dstPitch, int width, int height)
-{
- uint32 *dP;
- uint16 *bP;
-#if !defined(_SNESPPC) && !defined(__GIZ__) && !defined(__GP2X__) && !defined(__WIZ__)
- uint16 *xP;
-#endif
-
-#ifdef MMX
- if (mmx_cpu && width != 512)
- {
- for (height; height; height-=1)
- {
- bP = (uint16 *) srcPtr;
- xP = (uint16 *) deltaPtr;
- dP = (uint32 *) dstPtr;
- _2xSaISuperEagleLine ((uint8 *) bP, (uint8 *) xP, srcPitch, width, (uint8 *)dP, dstPitch);
- dstPtr += dstPitch << 1;
- srcPtr += srcPitch;
- deltaPtr += srcPitch;
- }
- }
- else
- {
-#endif
- uint32 Nextline = srcPitch >> 1;
-
- for (height; height; height-=1)
- {
- bP = (uint16 *) srcPtr;
- dP = (uint32 *) dstPtr;
- for (uint32 finish = width; finish; finish -= 1 )
- {
-
- uint32 color4, color5, color6;
- uint32 color1, color2, color3;
- uint32 colorA0, colorA1, colorA2, colorA3,
- colorB0, colorB1, colorB2, colorB3,
- colorS1, colorS2;
- uint32 product1a, product1b,
- product2a, product2b;
-
- colorB0 = *(bP- Nextline - 1);
- colorB1 = *(bP- Nextline);
- colorB2 = *(bP- Nextline + 1);
- colorB3 = *(bP- Nextline + 2);
-
- color4 = *(bP - 1);
- color5 = *(bP);
- color6 = *(bP + 1);
- colorS2 = *(bP + 2);
-
- color1 = *(bP + Nextline - 1);
- color2 = *(bP + Nextline);
- color3 = *(bP + Nextline + 1);
- colorS1 = *(bP + Nextline + 2);
-
- colorA0 = *(bP + Nextline + Nextline - 1);
- colorA1 = *(bP + Nextline + Nextline);
- colorA2 = *(bP + Nextline + Nextline + 1);
- colorA3 = *(bP + Nextline + Nextline + 2);
-
-
- //--------------------------------------
- if (color2 == color6 && color5 != color3)
- {
- product1b = product2a = color2;
- if ((color1 == color2 && color6 == colorS2) ||
- (color2 == colorA1 && color6 == colorB2))
- {
- product1a = INTERPOLATE (color2, color5);
- product1a = INTERPOLATE (color2, product1a);
- product2b = INTERPOLATE (color2, color3);
- product2b = INTERPOLATE (color2, product2b);
-// product1a = color2;
-// product2b = color2;
- }
- else
- {
- product1a = INTERPOLATE (color5, color6);
- product2b = INTERPOLATE (color2, color3);
- }
- }
- else
- if (color5 == color3 && color2 != color6)
- {
- product2b = product1a = color5;
- if ((colorB1 == color5 && color3 == colorA2) ||
- (color4 == color5 && color3 == colorS1))
- {
- product1b = INTERPOLATE (color5, color6);
- product1b = INTERPOLATE (color5, product1b);
- product2a = INTERPOLATE (color5, color2);
- product2a = INTERPOLATE (color5, product2a);
-// product1b = color5;
-// product2a = color5;
- }
- else
- {
- product1b = INTERPOLATE (color5, color6);
- product2a = INTERPOLATE (color2, color3);
- }
- }
- else
- if (color5 == color3 && color2 == color6 && color5 != color6)
- {
- register int r = 0;
-
- r += GetResult (color6, color5, color1, colorA1);
- r += GetResult (color6, color5, color4, colorB1);
- r += GetResult (color6, color5, colorA2, colorS1);
- r += GetResult (color6, color5, colorB2, colorS2);
-
- if (r > 0)
- {
- product1b = product2a = color2;
- product1a = product2b = INTERPOLATE (color5, color6);
- }
- else
- if (r < 0)
- {
- product2b = product1a = color5;
- product1b = product2a = INTERPOLATE (color5, color6);
- }
- else
- {
- product2b = product1a = color5;
- product1b = product2a = color2;
- }
- }
- else
- {
-
- if ((color2 == color5) || (color3 == color6))
- {
- product1a = color5;
- product2a = color2;
- product1b = color6;
- product2b = color3;
-
- }
- else
- {
- product1b = product1a = INTERPOLATE (color5, color6);
- product1a = INTERPOLATE (color5, product1a);
- product1b = INTERPOLATE (color6, product1b);
-
- product2a = product2b = INTERPOLATE (color2, color3);
- product2a = INTERPOLATE (color2, product2a);
- product2b = INTERPOLATE (color3, product2b);
- }
- }
-
-
- product1a = product1a | (product1b << 16);
- product2a = product2a | (product2b << 16);
-
- *(dP) = product1a;
- *(dP+(dstPitch>>2)) = product2a;
-
- bP += 1;
- dP += 1;
- }//end of for ( finish= width etc..)
-
- dstPtr += dstPitch << 1;
- srcPtr += srcPitch;
- deltaPtr += srcPitch;
- }; //endof: for (height; height; height--)
-#ifdef MMX
- }
-#endif
-}
-
-
-
-/*ONLY use with 640x480x16 or higher resolutions*/
-/*Only use this if 2*width * 2*height fits on the current screen*/
-void _2xSaI(uint8 *srcPtr, uint32 srcPitch,
- uint8 *deltaPtr,
- uint8 *dstPtr, uint32 dstPitch, int width, int height)
-{
- uint32 *dP;
- uint16 *bP;
-#if !defined(_SNESPPC) && !defined(__GIZ__) && !defined(__GP2X__) && !defined(__WIZ__)
- uint16 *xP;
-#endif
-
-#ifdef MMX
- if (mmx_cpu && width != 512)
- {
- for (height; height; height-=1)
- {
-
- bP = (uint16 *) srcPtr;
- xP = (uint16 *) deltaPtr;
- dP = (uint32 *) dstPtr;
- _2xSaILine ((uint8 *) bP, (uint8 *) xP, srcPitch, width, (uint8 *)dP, dstPitch);
- dstPtr += dstPitch << 1;
- srcPtr += srcPitch;
- deltaPtr += srcPitch;
- }
- }
- else
- {
-#endif
- uint32 Nextline = srcPitch >> 1;
-
- for (height; height; height-=1)
- {
- bP = (uint16 *) srcPtr;
- dP = (uint32 *) dstPtr;
- for (uint32 finish = width; finish; finish -= 1 )
- {
-
-
- register uint32 colorA, colorB;
- uint32 colorC, colorD,
- colorE, colorF, colorG, colorH,
- colorI, colorJ, colorK, colorL,
- colorM, colorN, colorO, colorP;
- uint32 product, product1, product2;
-
-
-//---------------------------------------
-// Map of the pixels: I|E F|J
-// G|A B|K
-// H|C D|L
-// M|N O|P
- colorI = *(bP- Nextline - 1);
- colorE = *(bP- Nextline);
- colorF = *(bP- Nextline + 1);
- colorJ = *(bP- Nextline + 2);
-
- colorG = *(bP - 1);
- colorA = *(bP);
- colorB = *(bP + 1);
- colorK = *(bP + 2);
-
- colorH = *(bP + Nextline - 1);
- colorC = *(bP + Nextline);
- colorD = *(bP + Nextline + 1);
- colorL = *(bP + Nextline + 2);
-
- colorM = *(bP + Nextline + Nextline - 1);
- colorN = *(bP + Nextline + Nextline);
- colorO = *(bP + Nextline + Nextline + 1);
- colorP = *(bP + Nextline + Nextline + 2);
-
- if ((colorA == colorD) && (colorB != colorC))
- {
- if ( ((colorA == colorE) && (colorB == colorL)) ||
- ((colorA == colorC) && (colorA == colorF) && (colorB != colorE) && (colorB == colorJ)) )
- {
- product = colorA;
- }
- else
- {
- product = INTERPOLATE(colorA, colorB);
- }
-
- if (((colorA == colorG) && (colorC == colorO)) ||
- ((colorA == colorB) && (colorA == colorH) && (colorG != colorC) && (colorC == colorM)) )
- {
- product1 = colorA;
- }
- else
- {
- product1 = INTERPOLATE(colorA, colorC);
- }
- product2 = colorA;
- }
- else
- if ((colorB == colorC) && (colorA != colorD))
- {
- if (((colorB == colorF) && (colorA == colorH)) ||
- ((colorB == colorE) && (colorB == colorD) && (colorA != colorF) && (colorA == colorI)) )
- {
- product = colorB;
- }
- else
- {
- product = INTERPOLATE(colorA, colorB);
- }
-
- if (((colorC == colorH) && (colorA == colorF)) ||
- ((colorC == colorG) && (colorC == colorD) && (colorA != colorH) && (colorA == colorI)) )
- {
- product1 = colorC;
- }
- else
- {
- product1 = INTERPOLATE(colorA, colorC);
- }
- product2 = colorB;
- }
- else
- if ((colorA == colorD) && (colorB == colorC))
- {
- if (colorA == colorB)
- {
- product = colorA;
- product1 = colorA;
- product2 = colorA;
- }
- else
- {
- register int r = 0;
- product1 = INTERPOLATE(colorA, colorC);
- product = INTERPOLATE(colorA, colorB);
-
- r += GetResult1 (colorA, colorB, colorG, colorE, colorI);
- r += GetResult2 (colorB, colorA, colorK, colorF, colorJ);
- r += GetResult2 (colorB, colorA, colorH, colorN, colorM);
- r += GetResult1 (colorA, colorB, colorL, colorO, colorP);
-
- if (r > 0)
- product2 = colorA;
- else
- if (r < 0)
- product2 = colorB;
- else
- {
- product2 = Q_INTERPOLATE(colorA, colorB, colorC, colorD);
- }
- }
- }
- else
- {
- product2 = Q_INTERPOLATE(colorA, colorB, colorC, colorD);
-
- if ((colorA == colorC) && (colorA == colorF) && (colorB != colorE) && (colorB == colorJ))
- {
- product = colorA;
- }
- else
- if ((colorB == colorE) && (colorB == colorD) && (colorA != colorF) && (colorA == colorI))
- {
- product = colorB;
- }
- else
- {
- product = INTERPOLATE(colorA, colorB);
- }
-
- if ((colorA == colorB) && (colorA == colorH) && (colorG != colorC) && (colorC == colorM))
- {
- product1 = colorA;
- }
- else
- if ((colorC == colorG) && (colorC == colorD) && (colorA != colorH) && (colorA == colorI))
- {
- product1 = colorC;
- }
- else
- {
- product1 = INTERPOLATE(colorA, colorC);
- }
- }
- product = colorA | (product << 16);
- product1 = product1 | (product2 << 16);
- *(dP) = product;
- *(dP+(dstPitch>>2)) = product1;
-
- bP += 1;
- dP += 1;
- }//end of for ( finish= width etc..)
-
- dstPtr += dstPitch << 1;
- srcPtr += srcPitch;
- deltaPtr += srcPitch;
- }; //endof: for (height; height; height--)
-#ifdef MMX
- }
-#endif
-}
diff --git a/src/3d.h b/src/3d.h
deleted file mode 100644
index 6585fa7..0000000
--- a/src/3d.h
+++ /dev/null
@@ -1,100 +0,0 @@
-/*
- * Snes9x - Portable Super Nintendo Entertainment System (TM) emulator.
- *
- * (c) Copyright 1996 - 2001 Gary Henderson (gary.henderson@ntlworld.com) and
- * Jerremy Koot (jkoot@snes9x.com)
- *
- * Super FX C emulator code
- * (c) Copyright 1997 - 1999 Ivar (ivar@snes9x.com) and
- * Gary Henderson.
- * Super FX assembler emulator code (c) Copyright 1998 zsKnight and _Demo_.
- *
- * DSP1 emulator code (c) Copyright 1998 Ivar, _Demo_ and Gary Henderson.
- * C4 asm and some C emulation code (c) Copyright 2000 zsKnight and _Demo_.
- * C4 C code (c) Copyright 2001 Gary Henderson (gary.henderson@ntlworld.com).
- *
- * DOS port code contains the works of other authors. See headers in
- * individual files.
- *
- * Snes9x homepage: http://www.snes9x.com
- *
- * Permission to use, copy, modify and distribute Snes9x in both binary and
- * source form, for non-commercial purposes, is hereby granted without fee,
- * providing that this license information and copyright notice appear with
- * all copies and any derived work.
- *
- * This software is provided 'as-is', without any express or implied
- * warranty. In no event shall the authors be held liable for any damages
- * arising from the use of this software.
- *
- * Snes9x is freeware for PERSONAL USE only. Commercial users should
- * seek permission of the copyright holders first. Commercial use includes
- * charging money for Snes9x or software derived from Snes9x.
- *
- * The copyright holders request that bug fixes and improvements to the code
- * should be forwarded to them so everyone can benefit from the modifications
- * in future versions.
- *
- * Super NES and Super Nintendo Entertainment System are trademarks of
- * Nintendo Co., Limited and its subsidiary companies.
- */
-#ifndef _3D_H_
-#define _3D_H_
-
-#if defined(USE_OPENGL)
-#include <GL/gl.h>
-#include <GL/glu.h>
-
-#ifdef __linux__
-//#include <GL/glx.h>
-#endif
-
-typedef struct
-{
- bool8 packed_pixels_extension_present;
- bool8 draw_cube;
- uint32 version;
- // Texture format
- GLint internal_format;
- GLint format;
- GLint type;
-
- GLint max_texture_size;// 256 or 512
- GLint texture_size;
- uint32 num_textures; // 1 if max_texture_size == 256, 2 otherwise
- GLuint textures [2];
-} OpenGLData;
-
-extern OpenGLData OpenGL;
-
-bool8 S9xOpenGLInit ();
-bool8 S9xOpenGLInit2 ();
-void S9xOpenGLPutImage (int width, int height);
-void S9xOpenGLDeinit ();
-
-#endif
-
-#ifdef USE_GLIDE
-//#include <glide.h>
-
-typedef struct
-{
- bool8 voodoo_present;
- GrVertex sq[4];
- GrTexInfo texture;
- int32 texture_mem_size;
- int32 texture_mem_start;
- float x_offset, y_offset;
- float x_scale, y_scale;
- float voodoo_width;
- float voodoo_height;
-} GlideData;
-
-extern GlideData Glide;
-bool8 S9xGlideEnable (bool8 enable);
-void S9xGlideDeinit ();
-bool8 S9xGlideInit ();
-bool8 S9xVoodooInitialise ();
-#endif
-
-#endif
diff --git a/src/caanoo_sdk.c b/src/caanoo_sdk.c
deleted file mode 100644
index 5ce36a0..0000000
--- a/src/caanoo_sdk.c
+++ /dev/null
@@ -1,806 +0,0 @@
-
-#include <unistd.h>
-#include <fcntl.h>
-#include <sys/mman.h>
-#include <sys/time.h>
-#include <sys/ioctl.h>
-#include <sys/soundcard.h>
-#include <linux/fb.h>
-#include <linux/fb.h>
-#include <pthread.h>
-#include "menu.h"
-#include "wiz_sdk.h"
-#include <stdint.h>
-#include "polluxregs.h"
-#include <time.h>
-#include "asmmemfuncs.h"
-#include "pollux_set.h"
-#include "warm.h"
-#include <linux/input.h>
-
-#define SYS_CLK_FREQ 27
-#define BUFFERS 4
-
-static int fb_size=(320*240*2); //+(16*2);
-
-//unsigned long gp2x_ticks_per_second=7372800/1000;
-unsigned long wiz_dev[3]={0,0,0};
-unsigned long wiz_physvram[BUFFERS]={0,0,0,0};
-
-unsigned short *framebuffer16[BUFFERS]={0,0,0,0};
-static unsigned short *framebuffer_mmap[BUFFERS]={0,0,0,0};
-unsigned short gp2x_sound_buffer[4+((44100*2)*8)]; //*2=stereo, *4=max buffers
-
-volatile short *pOutput[8];
-int InitFramebuffer=0;
-int Timer=0;
-volatile int SoundThreadFlag=0;
-volatile int CurrentSoundBank=0;
-int CurrentFrameBuffer=0;
-int CurrentFrag=0;
-
-// 1024x8 8x8 font, i love it :)
-const unsigned int font8x8[]= {0x0,0x0,0xc3663c18,0x3c2424e7,0xe724243c,0x183c66c3,0xc16f3818,0x18386fc1,0x83f61c18,0x181cf683,0xe7c3993c,0x3c99c3,0x3f7fffff,0xe7cf9f,0x3c99c3e7,0xe7c399,0x3160c080,0x40e1b,0xcbcbc37e,0x7ec3c3db,0x3c3c3c18,0x81c087e,0x8683818,0x60f0e08,0x81422418,0x18244281,0xbd5a2418,0x18245abd,0x818181ff,0xff8181,0xa1c181ff,0xff8995,0x63633e,0x3e6363,0x606060,0x606060,0x3e60603e,0x3e0303,0x3e60603e,0x3e6060,0x3e636363,0x606060,0x3e03033e,0x3e6060,0x3e03033e,0x3e6363,0x60603e,0x606060,0x3e63633e,0x3e6363,0x3e63633e,0x3e6060,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x18181818,0x180018,0x666666,0x0,0x367f3600,0x367f36,0x3c067c18,0x183e60,0x18366600,0x62660c,0xe1c361c,0x6e337b,0x181818,0x0,0x18183870,0x703818,0x18181c0e,0xe1c18,0xff3c6600,0x663c,0x7e181800,0x1818,0x0,0x60c0c00,0x7e000000,0x0,0x0,0x181800,0x18306040,0x2060c,0x6e76663c,0x3c6666,0x18181c18,0x7e1818,0x3060663c,0x7e0c18,0x3018307e,0x3c6660,0x363c3830,0x30307e,0x603e067e,0x3c6660,0x3e06063c,0x3c6666,0x1830607e,0xc0c0c,0x3c66663c,0x3c6666,0x7c66663c,0x1c3060,0x181800,0x1818,0x181800,0xc1818,0xc183060,0x603018,0x7e0000,0x7e00,0x30180c06,0x60c18,0x3060663c,0x180018,0x5676663c,0x7c0676,0x66663c18,0x66667e,0x3e66663e,0x3e6666,0x606663c,0x3c6606,0x6666361e,0x1e3666,0x3e06067e,0x7e0606,0x3e06067e,0x60606,0x7606067c,0x7c6666,0x7e666666,0x666666,0x1818183c,0x3c1818,0x60606060,0x3c6660,0xe1e3666,0x66361e,0x6060606,0x7e0606,0x6b7f7763,0x636363,0x7e7e6e66,0x666676,0x6666663c,0x3c6666,0x3e66663e,0x60606,0x6666663c,0x6c366e,0x3e66663e,0x666636,0x3c06663c,0x3c6660,0x1818187e,0x181818,0x66666666,0x7c6666,0x66666666,0x183c66,0x6b636363,0x63777f,0x183c6666,0x66663c,0x3c666666,0x181818,0x1830607e,0x7e060c,0x18181878,0x781818,0x180c0602,0x406030,0x1818181e,0x1e1818,0x63361c08,0x0,0x0,0x7f0000,0xc060300,0x0,0x603c0000,0x7c667c,0x663e0606,0x3e6666,0x63c0000,0x3c0606,0x667c6060,0x7c6666,0x663c0000,0x3c067e,0xc3e0c38,0xc0c0c,0x667c0000,0x3e607c66,0x663e0606,0x666666,0x181c0018,0x3c1818,0x18180018,0xe181818,0x36660606,0x66361e,0x1818181c,0x3c1818,0x7f370000,0x63636b,0x663e0000,0x666666,0x663c0000,0x3c6666,0x663e0000,0x63e6666,0x667c0000,0x607c6666,0x663e0000,0x60606,0x67c0000,0x3e603c,0x187e1800,0x701818,0x66660000,0x7c6666,0x66660000,0x183c66,0x63630000,0x363e6b,0x3c660000,0x663c18,0x66660000,0x3e607c66,0x307e0000,0x7e0c18,0xc181870,0x701818,0x18181818,0x18181818,0x3018180e,0xe1818,0x794f0600,0x30};
-
-pthread_t gp2x_sound_thread=0, gp2x_sound_thread_exit=0;
-
-uint32_t bkregs32[15]; /* backing up values */
-int layer_width[2];
-volatile uint32_t *memregs32;
-volatile uint16_t *memregs16;
-volatile uint8_t *memregs8;
-
-extern unsigned short * pOutputScreen;
-
-/* Sets the dirty flag for the MLC */
-static void lc_dirtymlc(void)
-{
- MLCCONTROLT |= BIT(3);
-}
-
-#define FBIO_MAGIC 'D'
-#define FBIO_LCD_CHANGE_CONTROL _IOW(FBIO_MAGIC, 90, unsigned int[2])
-#define LCD_DIRECTION_ON_CMD 5 /* 320x240 */
-#define LCD_DIRECTION_OFF_CMD 6 /* 240x320 */
-
-void lc_screensize(int w, int h) {
- unsigned int send[2];
- int fb_fd = open("/dev/fb0", O_RDWR);
- send[1] = 0;
- /* alter MLC to rotate the display */
- if(w == 320 && h == 240) {
- send[0] = LCD_DIRECTION_ON_CMD;
- } else if(w == 240 && h == 320) {
- send[0] = LCD_DIRECTION_OFF_CMD;
- }
-
- /* send command to display controller */
- ioctl(fb_fd, FBIO_LCD_CHANGE_CONTROL, &send);
- close(fb_fd);
- /* apply the MLC changes */
- MLCSCREENSIZE = ((h-1)<<16) | (w-1);
- lc_dirtymlc();
-}
-
-/* Sets the dirty flag for the layer */
-static void lc_dirtylayer(int layer)
-{
- if(layer == 0) {
- MLCCONTROL0 |= BIT(4);
- } else {
- MLCCONTROL1 |= BIT(4);
- }
-}
-
-/* Sets layer position */
-static void lc_layerpos(int layer, int x1, int y1, int x2, int y2)
-{
- unsigned int temp_lr, temp_tb;
- temp_lr = (x1 << 16) | x2;
- temp_tb = (y1 << 16) | y2;
-
- if(layer == 0) {
- MLCLEFTRIGHT0 = temp_lr;
- MLCTOPBOTTOM0 = temp_tb;
- } else {
- MLCLEFTRIGHT1 = temp_lr;
- MLCTOPBOTTOM1 = temp_tb;
- }
- lc_dirtylayer(layer);
-
- layer_width[layer] = (x2-x1)+1;
-}
-
-/* Sets stride registers */
-static void lc_setstride(int layer, int hs, int vs)
-{
- /* set how many bytes the MLC is supposed to read */
- if(layer == 0) {
- MLCHSTRIDE0 = hs;
- MLCVSTRIDE0 = vs;
- } else {
- MLCHSTRIDE1 = hs;
- MLCVSTRIDE1 = vs;
- }
- lc_dirtylayer(layer);
-}
-
-/* Sets layer properties */
-static void lc_setlayer(int layer, unsigned int onoff, unsigned int alpha, unsigned int invert, unsigned int trans, unsigned int mode)
-{
- /* set layer properties register */
- unsigned int temp;
- temp = 0;
- if(onoff) temp |= BIT(5);
- if(alpha) temp |= BIT(2);
- if(invert) temp |= BIT(1);
- if(trans) temp |= BIT(0);
- temp |= BIT(12);
- temp |= BIT(14);
- temp |= BIT(15);
- temp |= (mode<<16);
-
- if(layer == 0) {
- MLCCONTROL0 = temp;
- } else {
- MLCCONTROL1= temp;
- }
- lc_dirtylayer(layer);
-
- int pixel_width = 0;
- /* set stride based on pixel width*/
- switch(mode) {
- case RGB565:
- case BGR565:
- case XRGB1555:
- case XBGR1555:
- case XRGB4444:
- case XBGR4444:
- case XRGB8332:
- case XBGR8332:
- case ARGB1555:
- case ABGR1555:
- case ARGB4444:
- case ABGR4444:
- case ARGB8332:
- case ABGR8332:
- pixel_width = 2;
- break;
- case RGB888:
- case BGR888:
- pixel_width = 3;
- break;
- case ARGB8888:
- case ABGR8888:
- pixel_width = 4;
- break;
- case PTRGB565:
- pixel_width = 1;
- break;
- default:
- break;
- }
- lc_setstride(layer, pixel_width, pixel_width*layer_width[layer]);
-}
-
-/* Sets the background colour */
-static void lc_setbgcol(unsigned int colour)
-{
- /* colour to be displayed where no layers cover */
- MLCBGCOLOR = colour;
- lc_dirtymlc();
-}
-
-/*
-########################
-Graphics functions
-########################
- */
-
-static void debug(char *text, int pause)
-{
- gp_clearFramebuffer16(framebuffer16[currFB],0);
- gp_drawString(0,0,strlen(text),text,(unsigned short)MENU_RGB(31,31,31),framebuffer16[currFB]);
- MenuFlip();
- if(pause) MenuPause();
-
-}
-
-static int clipping_x1 = 0;
-static int clipping_x2 = 319;
-static int clipping_y1 = 0;
-static int clipping_y2 = 239;
-
-
-void gp_setClipping(int x1, int y1, int x2, int y2) {
- if (x1 < 0) x1 = 0;
- if (x1 > 319) x1 = 319;
- if (x2 < 0) x2 = 0;
- if (x2 > 319) x2 = 319;
- if (y1 < 0) y1 = 0;
- if (y1 > 239) y1 = 239;
- if (y2 < 0) y2 = 0;
- if (y2 > 239) y2 = 239;
-
- if (x1 < x2) {
- clipping_x1 = x1;
- clipping_x2 = x2;
- } else {
- clipping_x2 = x1;
- clipping_x1 = x2;
- }
-
- if (y1 < y2) {
- clipping_y1 = y1;
- clipping_y2 = y2;
- } else {
- clipping_y2 = y1;
- clipping_y1 = y2;
- }
-}
-
-static __inline__
-void gp_drawPixel16 ( int x, int y, unsigned short c, unsigned short *framebuffer )
-{
- if ((x < clipping_x1) || (x > clipping_x2) || (y < clipping_y1) || (y > clipping_y2)) return;
- *(framebuffer +(320*y)+x ) = c;
-}
-
-static
-void set_char8x8_16bpp (int xx,int yy,int offset,unsigned short mode,unsigned short *framebuffer)
-{
- unsigned int y, pixel;
- offset *= 2;
- pixel = font8x8[0 + offset];
- for (y = 0; y < 4; y++)
- {
- if (pixel&(1<<(0+(y<<3)))) gp_drawPixel16(xx+0, yy+y, mode, framebuffer);
- if (pixel&(1<<(1+(y<<3)))) gp_drawPixel16(xx+1, yy+y, mode, framebuffer);
- if (pixel&(1<<(2+(y<<3)))) gp_drawPixel16(xx+2, yy+y, mode, framebuffer);
- if (pixel&(1<<(3+(y<<3)))) gp_drawPixel16(xx+3, yy+y, mode, framebuffer);
- if (pixel&(1<<(4+(y<<3)))) gp_drawPixel16(xx+4, yy+y, mode, framebuffer);
- if (pixel&(1<<(5+(y<<3)))) gp_drawPixel16(xx+5, yy+y, mode, framebuffer);
- if (pixel&(1<<(6+(y<<3)))) gp_drawPixel16(xx+6, yy+y, mode, framebuffer);
- if (pixel&(1<<(7+(y<<3)))) gp_drawPixel16(xx+7, yy+y, mode, framebuffer);
- }
- pixel = font8x8[1 + offset];
- for (y = 0; y < 4; y++)
- {
- if (pixel&(1<<(0+(y<<3)))) gp_drawPixel16(xx+0, yy+y+4, mode, framebuffer);
- if (pixel&(1<<(1+(y<<3)))) gp_drawPixel16(xx+1, yy+y+4, mode, framebuffer);
- if (pixel&(1<<(2+(y<<3)))) gp_drawPixel16(xx+2, yy+y+4, mode, framebuffer);
- if (pixel&(1<<(3+(y<<3)))) gp_drawPixel16(xx+3, yy+y+4, mode, framebuffer);
- if (pixel&(1<<(4+(y<<3)))) gp_drawPixel16(xx+4, yy+y+4, mode, framebuffer);
- if (pixel&(1<<(5+(y<<3)))) gp_drawPixel16(xx+5, yy+y+4, mode, framebuffer);
- if (pixel&(1<<(6+(y<<3)))) gp_drawPixel16(xx+6, yy+y+4, mode, framebuffer);
- if (pixel&(1<<(7+(y<<3)))) gp_drawPixel16(xx+7, yy+y+4, mode, framebuffer);
-
- }
-}
-
-void gp_drawString (int x,int y,int len,char *buffer,unsigned short color,void *framebuffer)
-{
- int l,base=0;
-
- for (l=0;l<len;l++)
- {
- set_char8x8_16bpp (x+base,y,buffer[l],color,framebuffer);
- base+=8;
- }
-}
-
-void gp_clearFramebuffer16(unsigned short *framebuffer, unsigned short pal)
-{
- int x,y;
- for (y=0;y<240;y++)
- {
- for (x=0;x<320;x++)
- {
- *framebuffer++ = pal;
- }
- }
-}
-
-static int abs_x=0, abs_y=0;
-static struct input_event event[64];
-int analogdev;
-unsigned int gp_getButton(unsigned char enable_diagnals)
- {
- unsigned int key = ~((GPIOCPAD << 16) | GPIOBPAD) & ~0xF000;
- int i, bytes;
-
- bytes = read(analogdev, &event, sizeof(event));
- if (bytes > 0) {
- for (i=0; i < bytes/sizeof(struct input_event); i++) {
- if (event[i].type == EV_ABS) {
- switch (event[i].code) {
- case ABS_X: abs_x = event[i].value - 128; break;
- case ABS_Y: abs_y = event[i].value - 128; break;
- }
- }
- }
- }
-
- if (abs_x < -32) key |= (1<<INP_BUTTON_LEFT);
- if (abs_x > 32) key |= (1<<INP_BUTTON_RIGHT);
- if (abs_y < -32) key |= (1<<INP_BUTTON_UP);
- if (abs_y > 32) key |= (1<<INP_BUTTON_DOWN);
-
- return key;
- }
-
-void gp_initGraphics(unsigned short bpp, int flip, int applyMmuHack)
-{
-
- int x = 0;
- unsigned int key = 0;
- unsigned int offset = 0;
- char buf[256];
-
- struct fb_fix_screeninfo info;
- int fb_fd;
- int f;
-
-
- gp_setClipping(0, 0, 319, 239);
-
-#ifdef DEBUG
- printf("Entering gp_initGraphics....\r\n");
-#endif
- /*
- First check that frame buffer memory has not already been setup
- */
- if (!InitFramebuffer)
- {
-#ifdef DEBUG
- sprintf(buf, "Initing buffer\r\n");
- printf(buf);
-#endif
- wiz_dev[0] = open("/dev/mem", O_RDWR);
- if(wiz_dev[0] < 0) {
- printf("Could not open /dev/mem\n");
- return;
- }
-
-#ifdef DEBUG
- sprintf(buf, "Devices opened\r\n");
- printf(buf);
- sprintf(buf, "/dev/mem: %x \r\n", wiz_dev[0]);
- printf(buf);
-#endif
-
- memregs32 = (volatile unsigned int *)mmap(0, 0x20000, PROT_READ|PROT_WRITE, MAP_SHARED, wiz_dev[0], 0xC0000000);
- if(memregs32 == (volatile unsigned int *)0xFFFFFFFF) {
- printf("Could not mmap hardware registers\n");
- return;
- }
-
- memregs16 = (volatile unsigned short *)memregs32;
- memregs8 = (volatile unsigned char *)memregs32;
-
- /* backup old register values to restore upon exit */
- bkregs32[0] = MLCADDRESS0; bkregs32[1] = MLCADDRESS1; bkregs32[2] = MLCCONTROL0; bkregs32[3] = MLCCONTROL1; bkregs32[4] = MLCLEFTRIGHT0;
- bkregs32[5] = MLCTOPBOTTOM0; bkregs32[6] = MLCLEFTRIGHT1; bkregs32[7] = MLCTOPBOTTOM1; bkregs32[8] = MLCBGCOLOR; bkregs32[9] = MLCHSTRIDE0;
- bkregs32[10] = MLCVSTRIDE0; bkregs32[11] = MLCHSTRIDE1; bkregs32[12] = MLCVSTRIDE1; bkregs32[13] = DPCCTRL1; bkregs32[14] = MLCSCREENSIZE;
- bkregs32[15] = PLLSETREG0;
-
- // Get frame buffer address, do not hardcode them, for tv-out compatibility
- fb_fd = open("/dev/fb0", O_RDWR);
- if ((!fb_fd) || (ioctl(fb_fd, FBIOGET_FSCREENINFO, &info) < 0)) return;
-
- wiz_physvram[0] = info.smem_start;
- framebuffer_mmap[0] = (void *)mmap(0, fb_size * BUFFERS, PROT_READ|PROT_WRITE, MAP_SHARED, wiz_dev[0], wiz_physvram[0]);
- for (f = 1; f < BUFFERS; f++) {
- framebuffer_mmap[f] = framebuffer_mmap[f-1] + (fb_size / sizeof(unsigned short));
- wiz_physvram[f] = wiz_physvram[f-1] + fb_size;
- }
-
-
-
- close(fb_fd);
-
- if (applyMmuHack)
- {
- warm_init();
- warm_change_cb_upper(WCB_C_BIT|WCB_B_BIT, 1);
- }
-
- // Init and clear the frame buffers
- for (f = 0; f < BUFFERS; f++) {
- memset(framebuffer_mmap[f], 0, fb_size);
- framebuffer16[f] = framebuffer_mmap[f];
- }
-
-/* Not working well with TV-Out
- // offset externally visible buffers by 8
- // this allows DrMD to not worry about clipping
- framebuffer16[0]=framebuffer_mmap[0]+8;
- framebuffer16[1]=framebuffer_mmap[1]+8;
- framebuffer16[2]=framebuffer_mmap[2]+8;
- framebuffer16[3]=framebuffer_mmap[3]+8;
- //ofset physical buffer as well
- wiz_physvram[0]+=16;
- wiz_physvram[1]+=16;
- wiz_physvram[2]+=16;
- wiz_physvram[3]+=16;
-*/
- InitFramebuffer=1;
-
- }
-
-
- // Set graphics mode
- lc_screensize(320, 240);
- lc_setbgcol(0x000000); /* set default background colour */
- lc_layerpos(0, 0, 0, 319, 239); /* set default layer positions */
- lc_layerpos(1, 0, 0, 319, 239);
- lc_setlayer(0, 0, 0, 0, 0, RGB565); /* set default layer settings */
- lc_setlayer(1, 1, 0, 0, 0, RGB565);
-
- gp_setFramebuffer(flip,1);
- usleep(100000);
-
- //pollux_set(memregs16, "lcd_timings=397,1,37,277,341,0,17,337;dpc_clkdiv0=9");
- //pollux_set(memregs16, "ram_timings=2,9,4,1,1,1,1");
- pollux_set(memregs16, "ram_timings=3,9,4,1,1,1,1");
- analogdev = open("/dev/input/event1", O_RDONLY|O_NONBLOCK); //open stick device
-
-#ifdef DEBUG
- printf("Leaving gp_initGraphics....\r\n");
-#endif
-}
-
-void gp_setFramebuffer(int flip, int sync)
-{
- CurrentFrameBuffer=flip;
- unsigned int address=(unsigned int)wiz_physvram[flip];
- unsigned short x=0;
-
- // Wait for VSync if required
- if (sync) {
- while((DPCCTRL0 & 0x400) == 0);
- DPCCTRL0 |= 0x400;
- }
-
- /* set absolute address for framebuffers */
- MLCADDRESS1 = address;
- lc_dirtylayer(1);
-}
-
-/*
-########################
-Sound functions
-########################
- */
-static
-void *gp2x_sound_play(void *x)
-{
- //struct timespec ts; ts.tv_sec=0, ts.tv_nsec=1000;
- while(! gp2x_sound_thread_exit)
- {
- Timer++;
- //CurrentSoundBank++;
- //if (CurrentSoundBank >= 8) CurrentSoundBank = 0;
-
- //if (SoundThreadFlag==SOUND_THREAD_SOUND_ON)
- //{
- write(wiz_dev[1], (void *)pOutput[CurrentSoundBank], gp2x_sound_buffer[1]);
- CurrentSoundBank = (CurrentSoundBank + 1) & 7;
- ioctl(wiz_dev[1], SOUND_PCM_SYNC, 0);
- //ts.tv_sec=0, ts.tv_nsec=(gp2x_sound_buffer[3]<<16)|gp2x_sound_buffer[2];
- //nanosleep(&ts, NULL);
-/*
- }
- else
- {
- write(wiz_dev[1], (void *)&gp2x_sound_buffer[4], gp2x_sound_buffer[1]);
- //ioctl(wiz_dev[1], SOUND_PCM_SYNC, 0);
- //ts.tv_sec=0, ts.tv_nsec=(gp2x_sound_buffer[3]<<16)|gp2x_sound_buffer[2];
- //nanosleep(&ts, NULL);
- }
-*/
- }
-
- return NULL;
-}
-
-void gp_sound_volume(int l, int r)
-{
- if(!wiz_dev[2])
- {
- wiz_dev[2] = open("/dev/mixer", O_WRONLY);
- }
-
- l=((l<<8)|r);
- ioctl(wiz_dev[2], SOUND_MIXER_WRITE_PCM, &l);
-}
-
-/*
-unsigned long gp_timer_read(void)
-{
- // Once again another peice of direct hardware access bites the dust
- // the code below is broken in firmware 2.1.1 so I've replaced it with a
- // to a linux function which seems to work
- //return gp2x_memregl[0x0A00>>2]/gp2x_ticks_per_second;
- struct timeval tval; // timing
-
- gettimeofday(&tval, 0);
- //tval.tv_usec
- //tval.tv_sec
- return (tval.tv_sec*1000000)+tval.tv_usec;
-}
-*/
-
-static int _rate = -1;
-static int _bits = -1;
-static int _stereo = -1;
-static int _Hz = -1;
-static int _frag = -1;
-int gp_initSound(int rate, int bits, int stereo, int Hz, int frag)
-{
- int status;
- int i=0;
- int nonblocking=1;
- unsigned int bufferStart=0;
- int result;
- char text[256];
-
- //int frag=0x00020010; // double buffer - frag size = 1<<0xf = 32768
-
- //8 = 256 = 2 fps loss = good sound
- //9 = 512 = 1 fps loss = good sound
- //A = 1024 =
- //f = 32768 = 0 fps loss = bad sound
- //if ((frag!= CurrentFrag)&&(wiz_dev[1]!=0))
- /*
- if (wiz_dev[1] != 0)
- {
- // Different frag config required
- // close device in order to re-adjust
- close(wiz_dev[1]);
- wiz_dev[1]=0;
- }
- */
-
- if (wiz_dev[1]==0)
- {
- wiz_dev[1] = open("/dev/dsp", O_WRONLY);
- printf("Opening sound device: %x\r\n",wiz_dev[1]);
- //ioctl(wiz_dev[1], SNDCTL_DSP_SETFRAGMENT, &frag);
- //CurrentFrag=frag; // save frag config
- }
-
- ioctl(wiz_dev[1], SNDCTL_DSP_RESET, 0);
-
- result=ioctl(wiz_dev[1], SNDCTL_DSP_SPEED, &rate);
- if(result==-1)
- {
- debug("Error setting DSP Speed",1);
- return(-1);
- }
-
- result=ioctl(wiz_dev[1], SNDCTL_DSP_SETFMT, &bits);
- if(result==-1)
- {
- debug("Error setting DSP format",1);
- return(-1);
- }
-
- result=ioctl(wiz_dev[1], SNDCTL_DSP_STEREO, &stereo);
- if(result==-1)
- {
- debug("Error setting DSP format",1);
- return(-1);
- }
-
- //printf("Disable Blocking: %x\r\n",ioctl(wiz_dev[3], 0x5421, &nonblocking));
-
- gp2x_sound_buffer[1]=(gp2x_sound_buffer[0]=(rate/Hz)) << (stereo + (bits==16));
- gp2x_sound_buffer[2]=(1000000000/Hz)&0xFFFF;
- gp2x_sound_buffer[3]=(1000000000/Hz)>>16;
-
- bufferStart= (unsigned int)&gp2x_sound_buffer[4];
- pOutput[0] = (short*)bufferStart+(0*gp2x_sound_buffer[1]);
- pOutput[1] = (short*)bufferStart+(1*gp2x_sound_buffer[1]);
- pOutput[2] = (short*)bufferStart+(2*gp2x_sound_buffer[1]);
- pOutput[3] = (short*)bufferStart+(3*gp2x_sound_buffer[1]);
- pOutput[4] = (short*)bufferStart+(4*gp2x_sound_buffer[1]);
- pOutput[5] = (short*)bufferStart+(5*gp2x_sound_buffer[1]);
- pOutput[6] = (short*)bufferStart+(6*gp2x_sound_buffer[1]);
- pOutput[7] = (short*)bufferStart+(7*gp2x_sound_buffer[1]);
-
- if(!gp2x_sound_thread)
- {
- pthread_create( &gp2x_sound_thread, NULL, gp2x_sound_play, NULL);
- //atexit(gp_Reset);
- }
-
- for(i=0;i<(gp2x_sound_buffer[1]*8);i++)
- {
- gp2x_sound_buffer[4+i] = 0;
- }
-
- // save function's args
- _rate = rate;
- _bits = bits;
- _stereo = stereo;
- _Hz = Hz;
- _frag = frag;
-
- return(0);
-}
-
-void gp_stopSound(void)
-{
- unsigned int i=0;
- gp2x_sound_thread_exit=1;
- printf("Killing Thread\r\n");
- for(i=0;i<(gp2x_sound_buffer[1]*8);i++)
- {
- gp2x_sound_buffer[4+i] = 0;
- }
- usleep(100000);
- printf("Thread is dead\r\n");
- gp2x_sound_thread=0;
- gp2x_sound_thread_exit=0;
- CurrentSoundBank=0;
-}
-
-
-/*
-########################
-System functions
-########################
- */
-void gp_Reset(void)
-{
- unsigned int i=0;
-
- gp_setCpuspeed(533);
-
- if( gp2x_sound_thread)
- {
- gp2x_sound_thread_exit=1;
- usleep(500);
- }
-
- MLCADDRESS0 = bkregs32[0]; MLCADDRESS1 = bkregs32[1]; MLCCONTROL0 = bkregs32[2]; MLCCONTROL1 = bkregs32[3]; MLCLEFTRIGHT0 = bkregs32[4];
- MLCTOPBOTTOM0 = bkregs32[5]; MLCLEFTRIGHT1 = bkregs32[6]; MLCTOPBOTTOM1 = bkregs32[7]; MLCBGCOLOR = bkregs32[8]; MLCHSTRIDE0 = bkregs32[9];
- MLCVSTRIDE0 = bkregs32[10]; MLCHSTRIDE1 = bkregs32[11]; MLCVSTRIDE1 = bkregs32[12]; DPCCTRL1 = bkregs32[13]; MLCSCREENSIZE = bkregs32[14];
-
- lc_dirtylayer(0);
- lc_dirtylayer(1);
- lc_dirtymlc();
-
- munmap((void *)memregs32, 0x20000);
-
- munmap(framebuffer_mmap[0], fb_size * BUFFERS);
-
- if (wiz_dev[0]) close(wiz_dev[0]);
- if (wiz_dev[1]) close(wiz_dev[1]);
- if (wiz_dev[2]) close(wiz_dev[2]);
-
- fcloseall();
-
- chdir("/usr/gp2x");
- execl("gp2xmenu",NULL);
-}
-
-void gp_video_RGB_setscaling(int W, int H)
-{
- uint16_t * pSource = (uint16_t *)pOutputScreen;
- uint16_t * pTarget = (uint16_t *)framebuffer16[currFB];
- unsigned short y;
- unsigned short x;
- if (H == 239)
- {
- for (y = 240; y != 0; y--)
- {
- pSource+=32;
- for (x = 64; x != 0; x--)
- {
- pTarget[0] = pSource[0];
- pTarget[1] = pSource[1];
- pTarget[2] = pSource[2];
- pTarget[3] = pSource[3];
- pTarget[4] = pSource[3];
- pTarget+=5;
- pSource+=4;
- }
- pSource+=32;
- }
- }
- else // 224
- {
- pSource += 2560;
- unsigned short pos = 2;
- for (y = 240; y != 0; y--)
- {
- pSource+=32;
- for (x = 64; x != 0; x--)
- {
- pTarget[0] = pSource[0];
- pTarget[1] = pSource[1];
- pTarget[2] = pSource[2];
- pTarget[3] = pSource[3];
- pTarget[4] = pSource[3];
- pTarget+=5;
- pSource+=4;
- }
- pSource+=32;
- pos--;
-
- if (pos == 0)
- {
- pSource -= 320;
- pos = 14;
- }
- }
- }
-}
-
-#define COLORMIX(a, b) ( ((((a & 0xF81F) + (b & 0xF81F)) >> 1) & 0xF81F) | ((((a & 0x07E0) + (b & 0x07E0)) >> 1) & 0x07E0) )
-void gp_video_RGB_setHZscaling(int W, int H)
-{
- uint16_t * pSource = (uint16_t *)pOutputScreen;
- uint16_t * pTarget = (uint16_t *)framebuffer16[currFB];
- unsigned short y;
- unsigned short x;
-
- if (H == 224)
- {
- pSource += 2560;
- pTarget += 2560;
- }
- for (y = H; y != 0; y--)
- {
- pSource+=32;
- for (x = 64; x != 0; x--)
- {
- pTarget[0] = pSource[0];
- pTarget[1] = pSource[1];
- pTarget[2] = pSource[2];
- pTarget[3] = COLORMIX(pSource[2],pSource[3]);
- pTarget[4] = pSource[3];
- pTarget+=5;
- pSource+=4;
- }
- pSource+=32;
- }
-}
-
-void gp_setCpuspeed(unsigned int MHZ)
-{
- unsigned long v;
- //unsigned mdiv, pdiv=9, sdiv=0;
- unsigned mdiv, pdiv=20, sdiv=0;
-
- mdiv= (MHZ * pdiv) / SYS_CLK_FREQ;
- mdiv &= 0x3FF;
- v= pdiv<<18 | mdiv<<8 | sdiv;
-
- PLLSETREG0 = v;
- PWRMODE |= 0x8000;
-
- while (PWRMODE & 0x8000);
-
- // Ok, let's reset sound since it depends on CPU speed
- if (_rate > 0) {
- gp_initSound(_rate, _bits, _stereo, _Hz, _frag);
- }
-}
-
-// craigix: --trc 6 --tras 4 --twr 1 --tmrd 1 --trfc 1 --trp 2 --trcd 2
-// set_RAM_Timings(6, 4, 1, 1, 1, 2, 2);
-void set_RAM_Timings(int tRC, int tRAS, int tWR, int tMRD, int tRFC, int tRP, int tRCD)
-{
-}
-
-void set_gamma(int g100)
-{
-}
-
-
-
-
-
diff --git a/src/caanoo_sdk.h b/src/caanoo_sdk.h
deleted file mode 100644
index fb642e5..0000000
--- a/src/caanoo_sdk.h
+++ /dev/null
@@ -1,64 +0,0 @@
-#ifndef _WIZ_SDK_H_
-#define _WIZ_SDK_H_
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#define UPPERMEM_START 0x3000000
-//0x2A00000
-#define UPPERMEM_SIZE (0x4000000-UPPERMEM_START)
-
-#define SOUND_THREAD_SOUND_ON 1
-#define SOUND_THREAD_SOUND_OFF 2
-#define SOUND_THREAD_PAUSE 3
-
-#define INP_BUTTON_A (20)
-#define INP_BUTTON_B (21)
-#define INP_BUTTON_X (22)
-#define INP_BUTTON_Y (23)
-#define INP_BUTTON_L (18)
-#define INP_BUTTON_R (19)
-#define INP_BUTTON_START (17)
-#define INP_BUTTON_SELECT (16)
-#define INP_BUTTON_VOL_UP ( 4)
-#define INP_BUTTON_VOL_DOWN ( 5)
-#define INP_BUTTON_HOME (11)
-#define INP_BUTTON_LEFT (12)
-#define INP_BUTTON_RIGHT (13)
-#define INP_BUTTON_UP (14)
-#define INP_BUTTON_DOWN (15)
-
-void gp_setClipping(int x1, int y1, int x2, int y2);
-void gp_drawString (int x,int y,int len,char *buffer,unsigned short color,void *framebuffer);
-void gp_clearFramebuffer16(unsigned short *framebuffer, unsigned short pal);
-void gp_setCpuspeed(unsigned int cpuspeed);
-void gp_initGraphics(unsigned short bpp, int flip, int applyMmuHack);
-void gp_setFramebuffer(int flip, int sync);
-int gp_initSound(int rate, int bits, int stereo, int Hz, int frag);
-void gp_stopSound(void);
-void gp_Reset(void);
-void gp_sound_volume(int l, int r);
-//unsigned long gp_timer_read(void);
-#define gp_timer_read clock
-unsigned int gp_getButton(unsigned char enable_diagnals);
-void gp_video_RGB_setscaling(int W, int H);
-void gp_video_RGB_setHZscaling(int W, int H);
-void set_gamma(int g100);
-void set_RAM_Timings(int tRC, int tRAS, int tWR, int tMRD, int tRFC, int tRP, int tRCD);
-
-extern volatile int SoundThreadFlag;
-extern volatile int CurrentSoundBank;
-extern int CurrentFrameBuffer;
-extern volatile short *pOutput[];
-extern unsigned short *framebuffer16[];
-extern unsigned long wiz_physvram[];
-extern volatile unsigned short *wiz_memregs;
-extern void *uppermem;
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
-
diff --git a/src/compile.txt b/src/compile.txt
deleted file mode 100644
index b71265f..0000000
--- a/src/compile.txt
+++ /dev/null
@@ -1,27 +0,0 @@
-To compile just do:
-------------------
-
-make
-
-will compile for Gp2x, Wiz and Caanoo
-
-To compile just for a platform:
-------------------------------
-
-make target
-
-where target can be: gp2x, wiz or caanoo this will compile both fast and compatible binaries
-
-To compile just a binary (fast or compatible) for just a platform:
------------------------------------------------------------------
-
-make target(c|f)
-
-c for Compatible binary
-f for Fast binary
-
-for example:
-
-make wizf
-
-
diff --git a/src/rel/warm_2.6.24.ko b/src/rel/warm_2.6.24.ko
deleted file mode 100644
index d2b8dc4..0000000
--- a/src/rel/warm_2.6.24.ko
+++ /dev/null
Binary files differ
diff --git a/src/snapshots/do.sh b/src/snapshots/do.sh
deleted file mode 100644
index cb8b3bc..0000000
--- a/src/snapshots/do.sh
+++ /dev/null
@@ -1,4 +0,0 @@
-#!/bin/bash
-
-FILE=$(date +%Y%m%d-%k%M)
-zip -9 -r pocketsnes-$FILE ../* -x \*.o \*.gpe \*.zip \*~
diff --git a/src/spc700/spcgen.c b/src/spc700/spcgen.c
index 5a15bd7..3ac06d6 100644
--- a/src/spc700/spcgen.c
+++ b/src/spc700/spcgen.c
@@ -87,7 +87,7 @@ static char buff[1024];
void ot(char *format, ...)
{
- va_list valist=NULL;
+ va_list valist;
int i, len;
// notaz: stop me from leaving newlines in the middle of format string
@@ -103,7 +103,7 @@ void ot(char *format, ...)
// ot buffered
void otb(char *format, ...)
{
- va_list valist=NULL;
+ va_list valist;
int i, len;
// notaz: stop me from leaving newlines in the middle of format string
diff --git a/src/spc700/spcgen.dsp b/src/spc700/spcgen.dsp
deleted file mode 100644
index a6bf264..0000000
--- a/src/spc700/spcgen.dsp
+++ /dev/null
@@ -1,88 +0,0 @@
-# Microsoft Developer Studio Project File - Name="spcgen" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Console Application" 0x0103
-
-CFG=spcgen - Win32 Debug
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "spcgen.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "spcgen.mak" CFG="spcgen - Win32 Debug"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "spcgen - Win32 Release" (based on "Win32 (x86) Console Application")
-!MESSAGE "spcgen - Win32 Debug" (based on "Win32 (x86) Console Application")
-!MESSAGE
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "spcgen - Win32 Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release"
-# PROP BASE Intermediate_Dir "Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release"
-# PROP Intermediate_Dir "Release"
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD BASE RSC /l 0x809 /d "NDEBUG"
-# ADD RSC /l 0x809 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
-
-!ELSEIF "$(CFG)" == "spcgen - Win32 Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug"
-# PROP BASE Intermediate_Dir "Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug"
-# PROP Intermediate_Dir "Debug"
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
-# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
-# ADD BASE RSC /l 0x809 /d "_DEBUG"
-# ADD RSC /l 0x809 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
-
-!ENDIF
-
-# Begin Target
-
-# Name "spcgen - Win32 Release"
-# Name "spcgen - Win32 Debug"
-# Begin Source File
-
-SOURCE=.\spcgen.c
-# End Source File
-# End Target
-# End Project
diff --git a/src/spc700/spcgen.dsw b/src/spc700/spcgen.dsw
deleted file mode 100644
index 7b947fc..0000000
--- a/src/spc700/spcgen.dsw
+++ /dev/null
@@ -1,29 +0,0 @@
-Microsoft Developer Studio Workspace File, Format Version 6.00
-# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
-
-###############################################################################
-
-Project: "spcgen"=.\spcgen.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Global:
-
-Package=<5>
-{{{
-}}}
-
-Package=<3>
-{{{
-}}}
-
-###############################################################################
-
diff --git a/src/spc700/spcgen.ncb b/src/spc700/spcgen.ncb
deleted file mode 100644
index 22b2108..0000000
--- a/src/spc700/spcgen.ncb
+++ /dev/null
Binary files differ
diff --git a/src/spc700/spcgen.opt b/src/spc700/spcgen.opt
deleted file mode 100644
index 673f065..0000000
--- a/src/spc700/spcgen.opt
+++ /dev/null
Binary files differ
diff --git a/src/spc700/spcgen.plg b/src/spc700/spcgen.plg
deleted file mode 100644
index 8db8f5e..0000000
--- a/src/spc700/spcgen.plg
+++ /dev/null
@@ -1,32 +0,0 @@
-<html>
-<body>
-<pre>
-<h1>Build Log</h1>
-<h3>
---------------------Configuration: spcgen - Win32 Debug--------------------
-</h3>
-<h3>Command Lines</h3>
-Creating temporary file "C:\DOCUME~1\Dave\LOCALS~1\Temp\RSP2C.tmp" with contents
-[
-/nologo /MLd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /Fp"Debug/spcgen.pch" /YX /Fo"Debug/" /Fd"Debug/" /FD /GZ /c
-"C:\Downloads\squidgesnes0392src\squidgesnes\spc700\spcgen.c"
-]
-Creating command line "cl.exe @C:\DOCUME~1\Dave\LOCALS~1\Temp\RSP2C.tmp"
-Creating temporary file "C:\DOCUME~1\Dave\LOCALS~1\Temp\RSP2E.tmp" with contents
-[
-kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /incremental:yes /pdb:"Debug/spcgen.pdb" /debug /machine:I386 /out:"Debug/spcgen.exe" /pdbtype:sept
-.\Debug\spcgen.obj
-]
-Creating command line "link.exe @C:\DOCUME~1\Dave\LOCALS~1\Temp\RSP2E.tmp"
-<h3>Output Window</h3>
-Compiling...
-spcgen.c
-Linking...
-
-
-
-<h3>Results</h3>
-spcgen.exe - 0 error(s), 0 warning(s)
-</pre>
-</body>
-</html>
diff --git a/src/zip/do.sh b/src/zip/do.sh
deleted file mode 100644
index d368948..0000000
--- a/src/zip/do.sh
+++ /dev/null
@@ -1,4 +0,0 @@
-#!/bin/bash
-
-FILE=$(date +%Y%m%d-%k%M)
-zip -9 pbit-$FILE ../pocketsnes_wiz_fast.gpe