mirror of
https://github.com/dborth/vbagx.git
synced 2024-11-26 04:24:16 +01:00
July 14, 2008 update by theinternetftw
This commit is contained in:
parent
64546f8550
commit
5a65f55992
@ -1,289 +1,304 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* VisualBoyAdvance 1.7.2
|
* VisualBoyAdvance 1.7.2
|
||||||
*
|
*
|
||||||
* Nintendo GameCube Joypad Wrapper
|
* Nintendo GameCube Joypad Wrapper
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
#include <gccore.h>
|
|
||||||
#include <stdio.h>
|
#include <gccore.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
#define VBA_BUTTON_A 1
|
|
||||||
#define VBA_BUTTON_B 2
|
#define VBA_BUTTON_A 1
|
||||||
#define VBA_BUTTON_SELECT 4
|
#define VBA_BUTTON_B 2
|
||||||
#define VBA_BUTTON_START 8
|
#define VBA_BUTTON_SELECT 4
|
||||||
#define VBA_RIGHT 16
|
#define VBA_BUTTON_START 8
|
||||||
#define VBA_LEFT 32
|
#define VBA_RIGHT 16
|
||||||
#define VBA_UP 64
|
#define VBA_LEFT 32
|
||||||
#define VBA_DOWN 128
|
#define VBA_UP 64
|
||||||
#define VBA_BUTTON_R 256
|
#define VBA_DOWN 128
|
||||||
#define VBA_BUTTON_L 512
|
#define VBA_BUTTON_R 256
|
||||||
#define VBA_SPEED 1024
|
#define VBA_BUTTON_L 512
|
||||||
#define VBA_CAPTURE 2048
|
#define VBA_SPEED 1024
|
||||||
|
#define VBA_CAPTURE 2048
|
||||||
#ifdef WII_BUILD
|
|
||||||
#include <math.h>
|
#ifdef WII_BUILD
|
||||||
#include <wiiuse/wpad.h>
|
#include <math.h>
|
||||||
int isClassicAvailable = 0;
|
#include <wiiuse/wpad.h>
|
||||||
int isWiimoteAvailable = 0;
|
int isClassicAvailable = 0;
|
||||||
/*
|
int isWiimoteAvailable = 0;
|
||||||
#ifndef PI
|
/*
|
||||||
#define PI 3.14159f
|
#ifndef PI
|
||||||
#endif
|
#define PI 3.14159f
|
||||||
|
#endif
|
||||||
enum { STICK_X, STICK_Y };
|
|
||||||
static int getStickValue(joystick_t* j, int axis, int maxAbsValue){
|
enum { STICK_X, STICK_Y };
|
||||||
double angle = PI * j->ang/180.0f;
|
static int getStickValue(joystick_t* j, int axis, int maxAbsValue){
|
||||||
double magnitude = (j->mag > 1.0f) ? 1.0f :
|
double angle = PI * j->ang/180.0f;
|
||||||
(j->mag < -1.0f) ? -1.0f : j->mag;
|
double magnitude = (j->mag > 1.0f) ? 1.0f :
|
||||||
double value;
|
(j->mag < -1.0f) ? -1.0f : j->mag;
|
||||||
if(axis == STICK_X)
|
double value;
|
||||||
value = magnitude * sin( angle );
|
if(axis == STICK_X)
|
||||||
else
|
value = magnitude * sin( angle );
|
||||||
value = magnitude * cos( angle );
|
else
|
||||||
return (int)(value * maxAbsValue);
|
value = magnitude * cos( angle );
|
||||||
}*/
|
return (int)(value * maxAbsValue);
|
||||||
|
}*/
|
||||||
#endif
|
|
||||||
int menuCalled = 0;
|
#endif
|
||||||
u32
|
int menuCalled = 0;
|
||||||
NGCPad()
|
u32
|
||||||
{
|
NGCPad()
|
||||||
u32 res = 0;
|
{
|
||||||
short p;
|
u32 res = 0;
|
||||||
signed char x,
|
short p;
|
||||||
y;
|
signed char x,
|
||||||
int padcal = 90;
|
y;
|
||||||
float t;
|
int padcal = 90;
|
||||||
|
float t;
|
||||||
|
|
||||||
#ifdef WII_BUILD
|
#ifdef WII_BUILD
|
||||||
//wiimote
|
//wiimote
|
||||||
if(isWiimoteAvailable)
|
WPADData *wpad;
|
||||||
{
|
WPAD_ScanPads();
|
||||||
WPADData wpad;
|
wpad = WPAD_Data(0);
|
||||||
WPAD_Read(0, &wpad);
|
if (isWiimoteAvailable)
|
||||||
unsigned short b = wpad.btns_d;
|
{
|
||||||
|
unsigned short b = wpad->btns_h;
|
||||||
if (b & WPAD_BUTTON_2)
|
|
||||||
res |= VBA_BUTTON_A;
|
if (b & WPAD_BUTTON_2)
|
||||||
|
res |= VBA_BUTTON_A;
|
||||||
if (b & WPAD_BUTTON_1)
|
|
||||||
res |= VBA_BUTTON_B;
|
if (b & WPAD_BUTTON_1)
|
||||||
|
res |= VBA_BUTTON_B;
|
||||||
if (b & WPAD_BUTTON_MINUS)
|
|
||||||
res |= VBA_BUTTON_SELECT;
|
if (b & WPAD_BUTTON_MINUS)
|
||||||
|
res |= VBA_BUTTON_SELECT;
|
||||||
if (b & WPAD_BUTTON_PLUS)
|
|
||||||
res |= VBA_BUTTON_START;
|
if (b & WPAD_BUTTON_PLUS)
|
||||||
|
res |= VBA_BUTTON_START;
|
||||||
if (b & WPAD_BUTTON_RIGHT)
|
|
||||||
res |= VBA_UP;
|
if (b & WPAD_BUTTON_RIGHT)
|
||||||
|
res |= VBA_UP;
|
||||||
if (b & WPAD_BUTTON_LEFT)
|
|
||||||
res |= VBA_DOWN;
|
if (b & WPAD_BUTTON_LEFT)
|
||||||
|
res |= VBA_DOWN;
|
||||||
if (b & WPAD_BUTTON_UP)
|
|
||||||
res |= VBA_LEFT;
|
if (b & WPAD_BUTTON_UP)
|
||||||
|
res |= VBA_LEFT;
|
||||||
if (b & WPAD_BUTTON_DOWN)
|
|
||||||
res |= VBA_RIGHT;
|
if (b & WPAD_BUTTON_DOWN)
|
||||||
|
res |= VBA_RIGHT;
|
||||||
if (b & WPAD_BUTTON_A)
|
|
||||||
res |= VBA_BUTTON_L;
|
if (b & WPAD_BUTTON_A)
|
||||||
|
res |= VBA_BUTTON_L;
|
||||||
if (b & WPAD_BUTTON_B)
|
|
||||||
res |= VBA_BUTTON_R;
|
if (b & WPAD_BUTTON_B)
|
||||||
|
res |= VBA_BUTTON_R;
|
||||||
if (b & WPAD_BUTTON_HOME)
|
|
||||||
menuCalled = 1;
|
if (b & WPAD_BUTTON_HOME)
|
||||||
}
|
menuCalled = 1;
|
||||||
//classic controller
|
}
|
||||||
if(isClassicAvailable)
|
//classic controller
|
||||||
{
|
if (isClassicAvailable)
|
||||||
WPADData wpad;
|
{
|
||||||
WPAD_Read(0, &wpad);
|
float mag,ang;
|
||||||
int b = wpad.exp.classic.btns;
|
int b = wpad->exp.classic.btns;
|
||||||
int x_s = 0; //getStickValue(&wpad.exp.classic.ljs, STICK_X, 127);
|
/* Stolen Shamelessly out of Falco's unofficial SNES9x update */
|
||||||
int y_s = 0; //getStickValue(&wpad.exp.classic.ljs, STICK_Y, 127);
|
ang = wpad->exp.classic.ljs.ang;
|
||||||
if (b & CLASSIC_CTRL_BUTTON_A)
|
mag = wpad->exp.classic.ljs.mag;
|
||||||
res |= VBA_BUTTON_A;
|
|
||||||
|
if (mag > 0.4) {
|
||||||
if (b & CLASSIC_CTRL_BUTTON_B)
|
if (ang > 292.5 | ang <= 67.5)
|
||||||
res |= VBA_BUTTON_B;
|
res |= VBA_UP;
|
||||||
|
if (ang > 22.5 & ang <= 157.5)
|
||||||
if (b & CLASSIC_CTRL_BUTTON_MINUS)
|
res |= VBA_RIGHT;
|
||||||
res |= VBA_BUTTON_SELECT;
|
if (ang > 113.5 & ang <= 247.5)
|
||||||
|
res |= VBA_DOWN;
|
||||||
if (b & CLASSIC_CTRL_BUTTON_PLUS)
|
if (ang > 203.5 & ang <= 337.5)
|
||||||
res |= VBA_BUTTON_START;
|
res |= VBA_LEFT;
|
||||||
|
}
|
||||||
if ((b & CLASSIC_CTRL_BUTTON_UP) || (y_s > 0))
|
|
||||||
res |= VBA_UP;
|
int x_s = 0; //getStickValue(&wpad.exp.classic.ljs, STICK_X, 127);
|
||||||
|
int y_s = 0; //getStickValue(&wpad.exp.classic.ljs, STICK_Y, 127);
|
||||||
if ((b & CLASSIC_CTRL_BUTTON_DOWN) || (y_s < 0))
|
if (b & CLASSIC_CTRL_BUTTON_A)
|
||||||
res |= VBA_DOWN;
|
res |= VBA_BUTTON_A;
|
||||||
|
|
||||||
if ((b & CLASSIC_CTRL_BUTTON_LEFT) || (x_s < 0))
|
if (b & CLASSIC_CTRL_BUTTON_B)
|
||||||
res |= VBA_LEFT;
|
res |= VBA_BUTTON_B;
|
||||||
|
|
||||||
if ((b & CLASSIC_CTRL_BUTTON_RIGHT) || (x_s > 0))
|
if (b & CLASSIC_CTRL_BUTTON_MINUS)
|
||||||
res |= VBA_RIGHT;
|
res |= VBA_BUTTON_SELECT;
|
||||||
|
|
||||||
if (b & CLASSIC_CTRL_BUTTON_FULL_L)
|
if (b & CLASSIC_CTRL_BUTTON_PLUS)
|
||||||
res |= VBA_BUTTON_L;
|
res |= VBA_BUTTON_START;
|
||||||
|
|
||||||
if (b & CLASSIC_CTRL_BUTTON_FULL_R)
|
if ((b & CLASSIC_CTRL_BUTTON_UP) || (y_s > 0))
|
||||||
res |= VBA_BUTTON_R;
|
res |= VBA_UP;
|
||||||
|
|
||||||
if (b & CLASSIC_CTRL_BUTTON_HOME)
|
if ((b & CLASSIC_CTRL_BUTTON_DOWN) || (y_s < 0))
|
||||||
menuCalled = 1;
|
res |= VBA_DOWN;
|
||||||
|
|
||||||
}
|
if ((b & CLASSIC_CTRL_BUTTON_LEFT) || (x_s < 0))
|
||||||
//user needs a GC remote
|
res |= VBA_LEFT;
|
||||||
else if((!(isWiimoteAvailable)) && (!(isClassicAvailable)))
|
|
||||||
{
|
if ((b & CLASSIC_CTRL_BUTTON_RIGHT) || (x_s > 0))
|
||||||
p = PAD_ButtonsHeld(0);
|
res |= VBA_RIGHT;
|
||||||
x = PAD_StickX(0);
|
|
||||||
y = PAD_StickY(0);
|
if (b & CLASSIC_CTRL_BUTTON_FULL_L)
|
||||||
if (x * x + y * y > padcal * padcal)
|
res |= VBA_BUTTON_L;
|
||||||
{
|
|
||||||
if (x > 0 && y == 0)
|
if (b & CLASSIC_CTRL_BUTTON_FULL_R)
|
||||||
res |= VBA_RIGHT;
|
res |= VBA_BUTTON_R;
|
||||||
if (x < 0 && y == 0)
|
|
||||||
res |= VBA_LEFT;
|
if (b & CLASSIC_CTRL_BUTTON_HOME)
|
||||||
if (x == 0 && y > 0)
|
menuCalled = 1;
|
||||||
res |= VBA_UP;
|
|
||||||
if (x == 0 && y < 0)
|
}
|
||||||
res |= VBA_DOWN;
|
//user needs a GC remote
|
||||||
|
else
|
||||||
/*** Recalc left / right ***/
|
{
|
||||||
t = (float) y / x;
|
p = PAD_ButtonsHeld(0);
|
||||||
if (t >= -2.41421356237 && t < 2.41421356237)
|
x = PAD_StickX(0);
|
||||||
{
|
y = PAD_StickY(0);
|
||||||
if (x >= 0)
|
if (x * x + y * y > padcal * padcal)
|
||||||
res |= VBA_RIGHT;
|
{
|
||||||
else
|
if (x > 0 && y == 0)
|
||||||
res |= VBA_LEFT;
|
res |= VBA_RIGHT;
|
||||||
}
|
if (x < 0 && y == 0)
|
||||||
|
res |= VBA_LEFT;
|
||||||
/*** Recalc up / down ***/
|
if (x == 0 && y > 0)
|
||||||
t = (float) x / y;
|
res |= VBA_UP;
|
||||||
if (t >= -2.41421356237 && t < 2.41421356237)
|
if (x == 0 && y < 0)
|
||||||
{
|
res |= VBA_DOWN;
|
||||||
if (y >= 0)
|
|
||||||
res |= VBA_UP;
|
/*** Recalc left / right ***/
|
||||||
else
|
t = (float) y / x;
|
||||||
res |= VBA_DOWN;
|
if (t >= -2.41421356237 && t < 2.41421356237)
|
||||||
}
|
{
|
||||||
}
|
if (x >= 0)
|
||||||
if (p & PAD_BUTTON_A)
|
res |= VBA_RIGHT;
|
||||||
res |= VBA_BUTTON_A;
|
else
|
||||||
|
res |= VBA_LEFT;
|
||||||
if (p & PAD_BUTTON_B)
|
}
|
||||||
res |= VBA_BUTTON_B;
|
|
||||||
|
/*** Recalc up / down ***/
|
||||||
if (p & PAD_TRIGGER_Z)
|
t = (float) x / y;
|
||||||
res |= VBA_BUTTON_SELECT;
|
if (t >= -2.41421356237 && t < 2.41421356237)
|
||||||
|
{
|
||||||
if (p & PAD_BUTTON_START)
|
if (y >= 0)
|
||||||
res |= VBA_BUTTON_START;
|
res |= VBA_UP;
|
||||||
|
else
|
||||||
if (p & PAD_BUTTON_UP)
|
res |= VBA_DOWN;
|
||||||
res |= VBA_UP;
|
}
|
||||||
|
}
|
||||||
if (p & PAD_BUTTON_DOWN)
|
if (p & PAD_BUTTON_A)
|
||||||
res |= VBA_DOWN;
|
res |= VBA_BUTTON_A;
|
||||||
|
|
||||||
if (p & PAD_BUTTON_LEFT)
|
if (p & PAD_BUTTON_B)
|
||||||
res |= VBA_LEFT;
|
res |= VBA_BUTTON_B;
|
||||||
|
|
||||||
if (p & PAD_BUTTON_RIGHT)
|
if (p & PAD_TRIGGER_Z)
|
||||||
res |= VBA_RIGHT;
|
res |= VBA_BUTTON_SELECT;
|
||||||
|
|
||||||
if (p & PAD_TRIGGER_L)
|
if (p & PAD_BUTTON_START)
|
||||||
res |= VBA_BUTTON_L;
|
res |= VBA_BUTTON_START;
|
||||||
|
|
||||||
if (p & PAD_TRIGGER_R)
|
if (p & PAD_BUTTON_UP)
|
||||||
res |= VBA_BUTTON_R;
|
res |= VBA_UP;
|
||||||
|
|
||||||
if((p & PAD_BUTTON_X) && (p & PAD_BUTTON_Y))
|
if (p & PAD_BUTTON_DOWN)
|
||||||
menuCalled = 1;
|
res |= VBA_DOWN;
|
||||||
}
|
|
||||||
#endif
|
if (p & PAD_BUTTON_LEFT)
|
||||||
|
res |= VBA_LEFT;
|
||||||
#ifdef GC_BUILD
|
|
||||||
p = PAD_ButtonsHeld(0);
|
if (p & PAD_BUTTON_RIGHT)
|
||||||
x = PAD_StickX(0);
|
res |= VBA_RIGHT;
|
||||||
y = PAD_StickY(0);
|
|
||||||
if (x * x + y * y > padcal * padcal)
|
if (p & PAD_TRIGGER_L)
|
||||||
{
|
res |= VBA_BUTTON_L;
|
||||||
if (x > 0 && y == 0)
|
|
||||||
res |= VBA_RIGHT;
|
if (p & PAD_TRIGGER_R)
|
||||||
if (x < 0 && y == 0)
|
res |= VBA_BUTTON_R;
|
||||||
res |= VBA_LEFT;
|
|
||||||
if (x == 0 && y > 0)
|
if((p & PAD_BUTTON_X) && (p & PAD_BUTTON_Y))
|
||||||
res |= VBA_UP;
|
menuCalled = 1;
|
||||||
if (x == 0 && y < 0)
|
}
|
||||||
res |= VBA_DOWN;
|
#endif
|
||||||
|
|
||||||
/*** Recalc left / right ***/
|
#ifdef GC_BUILD
|
||||||
t = (float) y / x;
|
p = PAD_ButtonsHeld(0);
|
||||||
if (t >= -2.41421356237 && t < 2.41421356237)
|
x = PAD_StickX(0);
|
||||||
{
|
y = PAD_StickY(0);
|
||||||
if (x >= 0)
|
if (x * x + y * y > padcal * padcal)
|
||||||
res |= VBA_RIGHT;
|
{
|
||||||
else
|
if (x > 0 && y == 0)
|
||||||
res |= VBA_LEFT;
|
res |= VBA_RIGHT;
|
||||||
}
|
if (x < 0 && y == 0)
|
||||||
|
res |= VBA_LEFT;
|
||||||
/*** Recalc up / down ***/
|
if (x == 0 && y > 0)
|
||||||
t = (float) x / y;
|
res |= VBA_UP;
|
||||||
if (t >= -2.41421356237 && t < 2.41421356237)
|
if (x == 0 && y < 0)
|
||||||
{
|
res |= VBA_DOWN;
|
||||||
if (y >= 0)
|
|
||||||
res |= VBA_UP;
|
/*** Recalc left / right ***/
|
||||||
else
|
t = (float) y / x;
|
||||||
res |= VBA_DOWN;
|
if (t >= -2.41421356237 && t < 2.41421356237)
|
||||||
}
|
{
|
||||||
}
|
if (x >= 0)
|
||||||
if (p & PAD_BUTTON_A)
|
res |= VBA_RIGHT;
|
||||||
res |= VBA_BUTTON_A;
|
else
|
||||||
|
res |= VBA_LEFT;
|
||||||
if (p & PAD_BUTTON_B)
|
}
|
||||||
res |= VBA_BUTTON_B;
|
|
||||||
|
/*** Recalc up / down ***/
|
||||||
if (p & PAD_TRIGGER_Z)
|
t = (float) x / y;
|
||||||
res |= VBA_BUTTON_SELECT;
|
if (t >= -2.41421356237 && t < 2.41421356237)
|
||||||
|
{
|
||||||
if (p & PAD_BUTTON_START)
|
if (y >= 0)
|
||||||
res |= VBA_BUTTON_START;
|
res |= VBA_UP;
|
||||||
|
else
|
||||||
if ((p & PAD_BUTTON_UP))
|
res |= VBA_DOWN;
|
||||||
res |= VBA_UP;
|
}
|
||||||
|
}
|
||||||
if ((p & PAD_BUTTON_DOWN))
|
if (p & PAD_BUTTON_A)
|
||||||
res |= VBA_DOWN;
|
res |= VBA_BUTTON_A;
|
||||||
|
|
||||||
if ((p & PAD_BUTTON_LEFT))
|
if (p & PAD_BUTTON_B)
|
||||||
res |= VBA_LEFT;
|
res |= VBA_BUTTON_B;
|
||||||
|
|
||||||
if ((p & PAD_BUTTON_RIGHT))
|
if (p & PAD_TRIGGER_Z)
|
||||||
res |= VBA_RIGHT;
|
res |= VBA_BUTTON_SELECT;
|
||||||
|
|
||||||
if (p & PAD_TRIGGER_L)
|
if (p & PAD_BUTTON_START)
|
||||||
res |= VBA_BUTTON_L;
|
res |= VBA_BUTTON_START;
|
||||||
|
|
||||||
if (p & PAD_TRIGGER_R)
|
if ((p & PAD_BUTTON_UP))
|
||||||
res |= VBA_BUTTON_R;
|
res |= VBA_UP;
|
||||||
|
|
||||||
if((p & PAD_BUTTON_X) && (p & PAD_BUTTON_Y))
|
if ((p & PAD_BUTTON_DOWN))
|
||||||
menuCalled = 1;
|
res |= VBA_DOWN;
|
||||||
#endif
|
|
||||||
|
if ((p & PAD_BUTTON_LEFT))
|
||||||
if ((res & 48) == 48)
|
res |= VBA_LEFT;
|
||||||
res &= ~16;
|
|
||||||
if ((res & 192) == 192)
|
if ((p & PAD_BUTTON_RIGHT))
|
||||||
res &= ~128;
|
res |= VBA_RIGHT;
|
||||||
|
|
||||||
return res;
|
if (p & PAD_TRIGGER_L)
|
||||||
}
|
res |= VBA_BUTTON_L;
|
||||||
|
|
||||||
|
if (p & PAD_TRIGGER_R)
|
||||||
|
res |= VBA_BUTTON_R;
|
||||||
|
|
||||||
|
if((p & PAD_BUTTON_X) && (p & PAD_BUTTON_Y))
|
||||||
|
menuCalled = 1;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if ((res & 48) == 48)
|
||||||
|
res &= ~16;
|
||||||
|
if ((res & 192) == 192)
|
||||||
|
res &= ~128;
|
||||||
|
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
525
src/ngc/menu.cpp
525
src/ngc/menu.cpp
@ -1,260 +1,265 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* File Selection Menu
|
* File Selection Menu
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <gccore.h>
|
#include <gccore.h>
|
||||||
#include "sdfileio.h"
|
#include "sdfileio.h"
|
||||||
|
|
||||||
extern GXRModeObj *vmode; /*** Graphics Mode Object ***/
|
extern GXRModeObj *vmode; /*** Graphics Mode Object ***/
|
||||||
extern u32 *xfb[2]; /*** Framebuffers ***/
|
extern u32 *xfb[2]; /*** Framebuffers ***/
|
||||||
extern int whichfb; /*** Frame buffer toggle ***/
|
extern int whichfb; /*** Frame buffer toggle ***/
|
||||||
|
|
||||||
/** Bits from SD lib **/
|
/** Bits from SD lib **/
|
||||||
|
|
||||||
#define PAGE_SIZE 14
|
#define PAGE_SIZE 14
|
||||||
|
|
||||||
/*** Use OGC built in font ***/
|
/*** Use OGC built in font ***/
|
||||||
extern u8 console_font_8x16[];
|
extern u8 console_font_8x16[];
|
||||||
|
|
||||||
static u32 forecolour = COLOR_WHITE;
|
static u32 forecolour = COLOR_WHITE;
|
||||||
static u32 backcolour = COLOR_BLACK;
|
static u32 backcolour = COLOR_BLACK;
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* MENU_DrawChar
|
* MENU_DrawChar
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
void MENU_DrawChar( int x, int y, char c, int style )
|
void MENU_DrawChar( int x, int y, char c, int style )
|
||||||
{
|
{
|
||||||
u8 bits;
|
u8 bits;
|
||||||
int offset;
|
int offset;
|
||||||
int h,w;
|
int h,w;
|
||||||
u32 colour[2];
|
u32 colour[2];
|
||||||
u32 scroffs;
|
u32 scroffs;
|
||||||
|
|
||||||
offset = c << 4;
|
offset = c << 4;
|
||||||
scroffs = ( y * 320 ) + ( x >> 1 );
|
scroffs = ( y * 320 ) + ( x >> 1 );
|
||||||
|
|
||||||
for( h = 0; h < 16; h++ )
|
for( h = 0; h < 16; h++ )
|
||||||
{
|
{
|
||||||
bits = console_font_8x16[ offset++ ];
|
bits = console_font_8x16[ offset++ ];
|
||||||
|
|
||||||
if ( style )
|
if ( style )
|
||||||
{
|
{
|
||||||
for( w = 0; w < 8; w++ )
|
for( w = 0; w < 8; w++ )
|
||||||
{
|
{
|
||||||
xfb[whichfb][scroffs + w] = ( bits & 0x80 ) ? forecolour : backcolour;
|
xfb[whichfb][scroffs + w] = ( bits & 0x80 ) ? forecolour : backcolour;
|
||||||
bits <<= 1;
|
bits <<= 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
for( w = 0; w < 4; w++ )
|
for( w = 0; w < 4; w++ )
|
||||||
{
|
{
|
||||||
colour[0] = ( bits & 0x80 ) ? forecolour : backcolour;
|
colour[0] = ( bits & 0x80 ) ? forecolour : backcolour;
|
||||||
colour[1] = ( bits & 0x40 ) ? forecolour : backcolour;
|
colour[1] = ( bits & 0x40 ) ? forecolour : backcolour;
|
||||||
|
|
||||||
xfb[whichfb][scroffs + w] = ( colour[0] & 0xFFFF00FF ) | ( colour[1] & 0x0000FF00 );
|
xfb[whichfb][scroffs + w] = ( colour[0] & 0xFFFF00FF ) | ( colour[1] & 0x0000FF00 );
|
||||||
bits <<= 2;
|
bits <<= 2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
scroffs += 320;
|
scroffs += 320;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* MENU_DrawString
|
* MENU_DrawString
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
void MENU_DrawString( int x, int y, char *msg, int style )
|
void MENU_DrawString( int x, int y, char *msg, int style )
|
||||||
{
|
{
|
||||||
int i,len;
|
int i,len;
|
||||||
|
|
||||||
/* Centred ? */
|
/* Centred ? */
|
||||||
if ( x == -1 )
|
if ( x == -1 )
|
||||||
{
|
{
|
||||||
if ( style )
|
if ( style )
|
||||||
x = strlen(msg) << 4;
|
x = strlen(msg) << 4;
|
||||||
else
|
else
|
||||||
x = strlen(msg) << 3;
|
x = strlen(msg) << 3;
|
||||||
|
|
||||||
x = ( 640 - x ) >> 1;
|
x = ( 640 - x ) >> 1;
|
||||||
}
|
}
|
||||||
if((int)strlen(msg) < 36)
|
if((int)strlen(msg) < 36)
|
||||||
len = (int)strlen(msg);
|
len = (int)strlen(msg);
|
||||||
else
|
else
|
||||||
len = 36;
|
len = 36;
|
||||||
for ( i = 0; i < len; i++ )
|
for ( i = 0; i < len; i++ )
|
||||||
{
|
{
|
||||||
MENU_DrawChar(x,y,msg[i],style);
|
MENU_DrawChar(x,y,msg[i],style);
|
||||||
x += ( style ? 16 : 8 );
|
x += ( style ? 16 : 8 );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* MENU_Draw
|
* MENU_Draw
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
int MENU_Draw( int max, int current, int offset )
|
int MENU_Draw( int max, int current, int offset )
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
int ypos = 30;
|
int ypos = 30;
|
||||||
int xpos = 30;
|
int xpos = 30;
|
||||||
|
|
||||||
for ( i = offset; i < max && ( ( i - offset ) < PAGE_SIZE ); i++ )
|
for ( i = offset; i < max && ( ( i - offset ) < PAGE_SIZE ); i++ )
|
||||||
{
|
{
|
||||||
if ( i == current )
|
if ( i == current )
|
||||||
{
|
{
|
||||||
forecolour = COLOR_BLACK;
|
forecolour = COLOR_BLACK;
|
||||||
backcolour = COLOR_WHITE;
|
backcolour = COLOR_WHITE;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
forecolour = COLOR_WHITE;
|
forecolour = COLOR_WHITE;
|
||||||
backcolour = COLOR_BLACK;
|
backcolour = COLOR_BLACK;
|
||||||
}
|
}
|
||||||
MENU_DrawString( xpos, ypos, direntries[i], 1);
|
MENU_DrawString( xpos, ypos, direntries[i], 1);
|
||||||
ypos += 16;
|
ypos += 16;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#ifdef WII_BUILD
|
#ifdef WII_BUILD
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
#include <wiiuse/wpad.h>
|
#include <wiiuse/wpad.h>
|
||||||
extern int isClassicAvailable;
|
extern int isClassicAvailable;
|
||||||
extern int isWiimoteAvailable;
|
extern int isWiimoteAvailable;
|
||||||
extern void setup_controllers();
|
extern void setup_controllers();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* MENU_GetLoadFile
|
* MENU_GetLoadFile
|
||||||
*
|
*
|
||||||
* Returns the filename of the selected file
|
* Returns the filename of the selected file
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
char *MENU_GetLoadFile( char *whichdir )
|
char *MENU_GetLoadFile( char *whichdir )
|
||||||
{
|
{
|
||||||
int count;
|
int count;
|
||||||
char *p = NULL;
|
char *p = NULL;
|
||||||
int quit = 0;
|
int quit = 0;
|
||||||
int redraw = 1;
|
int redraw = 1;
|
||||||
int current = 0;
|
int current = 0;
|
||||||
int offset = 0;
|
int offset = 0;
|
||||||
u16 buttons;
|
u16 buttons;
|
||||||
int do_DOWN = 0;
|
int do_DOWN = 0;
|
||||||
int do_UP = 0;
|
int do_UP = 0;
|
||||||
int do_A = 0;
|
int do_A = 0;
|
||||||
|
|
||||||
count = gen_getdir( whichdir );
|
count = gen_getdir( whichdir );
|
||||||
|
|
||||||
|
|
||||||
if ( count == 0 )
|
if ( count == 0 )
|
||||||
{
|
{
|
||||||
printf("No ROM files in %s\n", whichdir);
|
printf("No ROM files in %s\n", whichdir);
|
||||||
while(1);
|
while(1);
|
||||||
}
|
}
|
||||||
|
#ifdef WII_BUILD
|
||||||
if ( count == 1 )
|
setup_controllers();
|
||||||
return (char*)direntries[0];
|
#endif
|
||||||
|
if ( count == 1 )
|
||||||
|
return (char*)direntries[0];
|
||||||
/* Do menu */
|
|
||||||
while ( !quit )
|
/* Do menu */
|
||||||
{
|
while ( !quit )
|
||||||
if ( redraw )
|
{
|
||||||
{
|
if ( redraw )
|
||||||
whichfb ^= 1;
|
{
|
||||||
VIDEO_ClearFrameBuffer(vmode, xfb[whichfb], COLOR_BLACK);
|
whichfb ^= 1;
|
||||||
MENU_Draw( count, current, offset );
|
VIDEO_ClearFrameBuffer(vmode, xfb[whichfb], COLOR_BLACK);
|
||||||
VIDEO_SetNextFramebuffer(xfb[whichfb]);
|
MENU_Draw( count, current, offset );
|
||||||
VIDEO_Flush();
|
VIDEO_SetNextFramebuffer(xfb[whichfb]);
|
||||||
VIDEO_WaitVSync();
|
VIDEO_Flush();
|
||||||
redraw = 0;
|
VIDEO_WaitVSync();
|
||||||
}
|
redraw = 0;
|
||||||
#ifdef WII_BUILD
|
}
|
||||||
setup_controllers();
|
#ifdef WII_BUILD
|
||||||
WPADData wpad;
|
WPAD_ScanPads();
|
||||||
WPAD_Read(0, &wpad);
|
WPADData *wpad;
|
||||||
if(isClassicAvailable)
|
wpad = WPAD_Data(0);
|
||||||
{
|
int b = wpad->exp.classic.btns;
|
||||||
int b = wpad.exp.classic.btns;
|
unsigned short b1 = wpad->btns_d;
|
||||||
if (b & CLASSIC_CTRL_BUTTON_DOWN){
|
if (isClassicAvailable){
|
||||||
do_DOWN = 1;
|
if (b & CLASSIC_CTRL_BUTTON_DOWN){
|
||||||
do{WPAD_Read(0, &wpad); b = wpad.exp.classic.btns;}while(b & CLASSIC_CTRL_BUTTON_DOWN);
|
do_DOWN = 1;
|
||||||
}
|
do{WPAD_ScanPads(); wpad = WPAD_Data(0);}
|
||||||
else if (b & CLASSIC_CTRL_BUTTON_UP){
|
while (WPAD_ButtonsHeld(0));
|
||||||
do_UP = 1;
|
}
|
||||||
do{WPAD_Read(0, &wpad); b = wpad.exp.classic.btns;}while(b & CLASSIC_CTRL_BUTTON_UP);
|
else if (b & CLASSIC_CTRL_BUTTON_UP){
|
||||||
}
|
do_UP = 1;
|
||||||
else if (b & CLASSIC_CTRL_BUTTON_A){
|
do{WPAD_ScanPads(); wpad = WPAD_Data(0);}
|
||||||
do_A = 1;
|
while (WPAD_ButtonsHeld(0));
|
||||||
do{WPAD_Read(0, &wpad); b = wpad.exp.classic.btns;}while(b & CLASSIC_CTRL_BUTTON_A);
|
}
|
||||||
}
|
else if (b & CLASSIC_CTRL_BUTTON_A){
|
||||||
}
|
do_A = 1;
|
||||||
if(isWiimoteAvailable)
|
do{WPAD_ScanPads(); wpad = WPAD_Data(0);}
|
||||||
{
|
while (WPAD_ButtonsHeld(0));
|
||||||
unsigned short b = wpad.btns_d;
|
}
|
||||||
if(b & WPAD_BUTTON_LEFT){
|
}
|
||||||
do_DOWN = 1;
|
if (isWiimoteAvailable){
|
||||||
do{WPAD_Read(0, &wpad); b = wpad.btns_d;}while(b & WPAD_BUTTON_LEFT);
|
if (b1 & WPAD_BUTTON_LEFT){
|
||||||
}
|
do_DOWN = 1;
|
||||||
else if (b & WPAD_BUTTON_RIGHT){
|
do{WPAD_ScanPads(); wpad = WPAD_Data(0);}
|
||||||
do_UP = 1;
|
while (WPAD_ButtonsHeld(0));
|
||||||
do{WPAD_Read(0, &wpad); b = wpad.btns_d;}while(b & WPAD_BUTTON_RIGHT);
|
}
|
||||||
}
|
else if (b1 & WPAD_BUTTON_RIGHT){
|
||||||
else if (b & WPAD_BUTTON_2){
|
do_UP = 1;
|
||||||
do_A = 1;
|
do{WPAD_ScanPads(); wpad = WPAD_Data(0);}
|
||||||
do{WPAD_Read(0, &wpad); b = wpad.btns_d;}while(b & WPAD_BUTTON_2);
|
while (WPAD_ButtonsHeld(0));
|
||||||
}
|
}
|
||||||
}
|
else if (b1 & WPAD_BUTTON_2){
|
||||||
#endif
|
do_A = 1;
|
||||||
buttons = PAD_ButtonsDown(0);
|
do{WPAD_ScanPads(); wpad = WPAD_Data(0);}
|
||||||
if(buttons & PAD_BUTTON_DOWN)
|
while (WPAD_ButtonsHeld(0));
|
||||||
do_DOWN = 1;
|
}
|
||||||
else if(buttons & PAD_BUTTON_UP)
|
}
|
||||||
do_UP = 1;
|
#endif
|
||||||
else if(buttons & PAD_BUTTON_A)
|
buttons = PAD_ButtonsDown(0);
|
||||||
do_A = 1;
|
if(buttons & PAD_BUTTON_DOWN)
|
||||||
if (do_DOWN)
|
do_DOWN = 1;
|
||||||
{
|
else if(buttons & PAD_BUTTON_UP)
|
||||||
do_DOWN=0;
|
do_UP = 1;
|
||||||
current++;
|
else if(buttons & PAD_BUTTON_A)
|
||||||
if ( current == count )
|
do_A = 1;
|
||||||
current = 0;
|
if (do_DOWN)
|
||||||
|
{
|
||||||
if ( ( current % PAGE_SIZE ) == 0 )
|
do_DOWN=0;
|
||||||
offset = current;
|
current++;
|
||||||
|
if ( current == count )
|
||||||
redraw = 1;
|
current = 0;
|
||||||
}
|
|
||||||
else
|
if ( ( current % PAGE_SIZE ) == 0 )
|
||||||
{
|
offset = current;
|
||||||
if ( do_UP )
|
|
||||||
{
|
redraw = 1;
|
||||||
do_UP=0;
|
}
|
||||||
current--;
|
else
|
||||||
if ( current < 0 ) current = count - 1;
|
{
|
||||||
offset = ( current / PAGE_SIZE ) * PAGE_SIZE;
|
if ( do_UP )
|
||||||
redraw = 1;
|
{
|
||||||
}
|
do_UP=0;
|
||||||
else
|
current--;
|
||||||
{
|
if ( current < 0 ) current = count - 1;
|
||||||
if ( do_A )
|
offset = ( current / PAGE_SIZE ) * PAGE_SIZE;
|
||||||
{
|
redraw = 1;
|
||||||
do_A=0;
|
}
|
||||||
quit = 1;
|
else
|
||||||
p = (char*)direntries[current];
|
{
|
||||||
}
|
if ( do_A )
|
||||||
}
|
{
|
||||||
}
|
do_A=0;
|
||||||
}
|
quit = 1;
|
||||||
|
p = (char*)direntries[current];
|
||||||
whichfb ^= 1;
|
}
|
||||||
VIDEO_ClearFrameBuffer(vmode, xfb[whichfb], COLOR_BLACK);
|
}
|
||||||
forecolour = COLOR_WHITE;
|
}
|
||||||
backcolour = COLOR_BLACK;
|
}
|
||||||
MENU_DrawString(-1, 240, "Loading ... Wait", 1);
|
|
||||||
VIDEO_SetNextFramebuffer(xfb[whichfb]);
|
whichfb ^= 1;
|
||||||
VIDEO_Flush();
|
VIDEO_ClearFrameBuffer(vmode, xfb[whichfb], COLOR_BLACK);
|
||||||
VIDEO_WaitVSync();
|
forecolour = COLOR_WHITE;
|
||||||
return p;
|
backcolour = COLOR_BLACK;
|
||||||
}
|
MENU_DrawString(-1, 240, "Loading ... Wait", 1);
|
||||||
|
VIDEO_SetNextFramebuffer(xfb[whichfb]);
|
||||||
|
VIDEO_Flush();
|
||||||
|
VIDEO_WaitVSync();
|
||||||
|
return p;
|
||||||
|
}
|
||||||
|
|
||||||
|
1589
src/ngc/vba172.cpp
1589
src/ngc/vba172.cpp
File diff suppressed because it is too large
Load Diff
220
src/zutil.h
220
src/zutil.h
@ -1,220 +0,0 @@
|
|||||||
/* zutil.h -- internal interface and configuration of the compression library
|
|
||||||
* Copyright (C) 1995-1998 Jean-loup Gailly.
|
|
||||||
* For conditions of distribution and use, see copyright notice in zlib.h
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* WARNING: this file should *not* be used by applications. It is
|
|
||||||
part of the implementation of the compression library and is
|
|
||||||
subject to change. Applications should only use zlib.h.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* @(#) $Id: zutil.h,v 1.2 2004/01/17 23:07:32 kxu Exp $ */
|
|
||||||
|
|
||||||
#ifndef _Z_UTIL_H
|
|
||||||
#define _Z_UTIL_H
|
|
||||||
|
|
||||||
#include <zlib.h>
|
|
||||||
|
|
||||||
#ifdef STDC
|
|
||||||
# include <stddef.h>
|
|
||||||
# include <string.h>
|
|
||||||
# include <stdlib.h>
|
|
||||||
#endif
|
|
||||||
#ifdef NO_ERRNO_H
|
|
||||||
extern int errno;
|
|
||||||
#else
|
|
||||||
# include <errno.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef local
|
|
||||||
# define local static
|
|
||||||
#endif
|
|
||||||
/* compile with -Dlocal if your debugger can't find static symbols */
|
|
||||||
|
|
||||||
typedef unsigned char uch;
|
|
||||||
typedef uch FAR uchf;
|
|
||||||
typedef unsigned short ush;
|
|
||||||
typedef ush FAR ushf;
|
|
||||||
typedef unsigned long ulg;
|
|
||||||
|
|
||||||
extern const char *z_errmsg[10]; /* indexed by 2-zlib_error */
|
|
||||||
/* (size given to avoid silly warnings with Visual C++) */
|
|
||||||
|
|
||||||
#define ERR_MSG(err) z_errmsg[Z_NEED_DICT-(err)]
|
|
||||||
|
|
||||||
#define ERR_RETURN(strm,err) \
|
|
||||||
return (strm->msg = (char*)ERR_MSG(err), (err))
|
|
||||||
/* To be used only when the state is known to be valid */
|
|
||||||
|
|
||||||
/* common constants */
|
|
||||||
|
|
||||||
#ifndef DEF_WBITS
|
|
||||||
# define DEF_WBITS MAX_WBITS
|
|
||||||
#endif
|
|
||||||
/* default windowBits for decompression. MAX_WBITS is for compression only */
|
|
||||||
|
|
||||||
#if MAX_MEM_LEVEL >= 8
|
|
||||||
# define DEF_MEM_LEVEL 8
|
|
||||||
#else
|
|
||||||
# define DEF_MEM_LEVEL MAX_MEM_LEVEL
|
|
||||||
#endif
|
|
||||||
/* default memLevel */
|
|
||||||
|
|
||||||
#define STORED_BLOCK 0
|
|
||||||
#define STATIC_TREES 1
|
|
||||||
#define DYN_TREES 2
|
|
||||||
/* The three kinds of block type */
|
|
||||||
|
|
||||||
#define MIN_MATCH 3
|
|
||||||
#define MAX_MATCH 258
|
|
||||||
/* The minimum and maximum match lengths */
|
|
||||||
|
|
||||||
#define PRESET_DICT 0x20 /* preset dictionary flag in zlib header */
|
|
||||||
|
|
||||||
/* target dependencies */
|
|
||||||
|
|
||||||
#ifdef MSDOS
|
|
||||||
# define OS_CODE 0x00
|
|
||||||
# if defined(__TURBOC__) || defined(__BORLANDC__)
|
|
||||||
# if(__STDC__ == 1) && (defined(__LARGE__) || defined(__COMPACT__))
|
|
||||||
/* Allow compilation with ANSI keywords only enabled */
|
|
||||||
void _Cdecl farfree( void *block );
|
|
||||||
void *_Cdecl farmalloc( unsigned long nbytes );
|
|
||||||
# else
|
|
||||||
# include <alloc.h>
|
|
||||||
# endif
|
|
||||||
# else /* MSC or DJGPP */
|
|
||||||
# include <malloc.h>
|
|
||||||
# endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef OS2
|
|
||||||
# define OS_CODE 0x06
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef WIN32 /* Window 95 & Windows NT */
|
|
||||||
# define OS_CODE 0x0b
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(VAXC) || defined(VMS)
|
|
||||||
# define OS_CODE 0x02
|
|
||||||
# define F_OPEN(name, mode) \
|
|
||||||
fopen((name), (mode), "mbc=60", "ctx=stm", "rfm=fix", "mrs=512")
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef AMIGA
|
|
||||||
# define OS_CODE 0x01
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(ATARI) || defined(atarist)
|
|
||||||
# define OS_CODE 0x05
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(MACOS) || defined(TARGET_OS_MAC)
|
|
||||||
# define OS_CODE 0x07
|
|
||||||
# if defined(__MWERKS__) && __dest_os != __be_os && __dest_os != __win32_os
|
|
||||||
# include <unix.h> /* for fdopen */
|
|
||||||
# else
|
|
||||||
# ifndef fdopen
|
|
||||||
# define fdopen(fd,mode) NULL /* No fdopen() */
|
|
||||||
# endif
|
|
||||||
# endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef __50SERIES /* Prime/PRIMOS */
|
|
||||||
# define OS_CODE 0x0F
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef TOPS20
|
|
||||||
# define OS_CODE 0x0a
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(_BEOS_) || defined(RISCOS)
|
|
||||||
# define fdopen(fd,mode) NULL /* No fdopen() */
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if (defined(_MSC_VER) && (_MSC_VER > 600))
|
|
||||||
# define fdopen(fd,type) _fdopen(fd,type)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
/* Common defaults */
|
|
||||||
|
|
||||||
#ifndef OS_CODE
|
|
||||||
# define OS_CODE 0x03 /* assume Unix */
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef F_OPEN
|
|
||||||
# define F_OPEN(name, mode) fopen((name), (mode))
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* functions */
|
|
||||||
|
|
||||||
#ifdef HAVE_STRERROR
|
|
||||||
extern char *strerror OF((int));
|
|
||||||
# define zstrerror(errnum) strerror(errnum)
|
|
||||||
#else
|
|
||||||
# define zstrerror(errnum) ""
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(pyr)
|
|
||||||
# define NO_MEMCPY
|
|
||||||
#endif
|
|
||||||
#if defined(SMALL_MEDIUM) && !defined(_MSC_VER) && !defined(__SC__)
|
|
||||||
/* Use our own functions for small and medium model with MSC <= 5.0.
|
|
||||||
* You may have to use the same strategy for Borland C (untested).
|
|
||||||
* The __SC__ check is for Symantec.
|
|
||||||
*/
|
|
||||||
# define NO_MEMCPY
|
|
||||||
#endif
|
|
||||||
#if defined(STDC) && !defined(HAVE_MEMCPY) && !defined(NO_MEMCPY)
|
|
||||||
# define HAVE_MEMCPY
|
|
||||||
#endif
|
|
||||||
#ifdef HAVE_MEMCPY
|
|
||||||
# ifdef SMALL_MEDIUM /* MSDOS small or medium model */
|
|
||||||
# define zmemcpy _fmemcpy
|
|
||||||
# define zmemcmp _fmemcmp
|
|
||||||
# define zmemzero(dest, len) _fmemset(dest, 0, len)
|
|
||||||
# else
|
|
||||||
# define zmemcpy memcpy
|
|
||||||
# define zmemcmp memcmp
|
|
||||||
# define zmemzero(dest, len) memset(dest, 0, len)
|
|
||||||
# endif
|
|
||||||
#else
|
|
||||||
extern void zmemcpy OF((Bytef* dest, const Bytef* source, uInt len));
|
|
||||||
extern int zmemcmp OF((const Bytef* s1, const Bytef* s2, uInt len));
|
|
||||||
extern void zmemzero OF((Bytef* dest, uInt len));
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Diagnostic functions */
|
|
||||||
#ifdef DEBUG
|
|
||||||
# include <stdio.h>
|
|
||||||
extern int z_verbose;
|
|
||||||
extern void z_error OF((char *m));
|
|
||||||
# define Assert(cond,msg) {if(!(cond)) z_error(msg);}
|
|
||||||
# define Trace(x) {if (z_verbose>=0) fprintf x ;}
|
|
||||||
# define Tracev(x) {if (z_verbose>0) fprintf x ;}
|
|
||||||
# define Tracevv(x) {if (z_verbose>1) fprintf x ;}
|
|
||||||
# define Tracec(c,x) {if (z_verbose>0 && (c)) fprintf x ;}
|
|
||||||
# define Tracecv(c,x) {if (z_verbose>1 && (c)) fprintf x ;}
|
|
||||||
#else
|
|
||||||
# define Assert(cond,msg)
|
|
||||||
# define Trace(x)
|
|
||||||
# define Tracev(x)
|
|
||||||
# define Tracevv(x)
|
|
||||||
# define Tracec(c,x)
|
|
||||||
# define Tracecv(c,x)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
typedef uLong (ZEXPORT *check_func) OF((uLong check, const Bytef *buf,
|
|
||||||
uInt len));
|
|
||||||
voidpf zcalloc OF((voidpf opaque, unsigned items, unsigned size));
|
|
||||||
void zcfree OF((voidpf opaque, voidpf ptr));
|
|
||||||
|
|
||||||
#define ZALLOC(strm, items, size) \
|
|
||||||
(*((strm)->zalloc))((strm)->opaque, (items), (size))
|
|
||||||
#define ZFREE(strm, addr) (*((strm)->zfree))((strm)->opaque, (voidpf)(addr))
|
|
||||||
#define TRY_FREE(s, p) {if (p) ZFREE(s, p);}
|
|
||||||
|
|
||||||
#endif /* _Z_UTIL_H */
|
|
Loading…
Reference in New Issue
Block a user