fix L-R buttons, new menu bg, makefile tweak

This commit is contained in:
dborth 2008-09-18 03:12:56 +00:00
parent bf230dce6c
commit c3ad79eb38
15 changed files with 20654 additions and 1663 deletions

View File

@ -25,10 +25,9 @@ INCLUDES := source/vba source/vba/gb source/ngc
# options for code generation
#---------------------------------------------------------------------------------
CFLAGS = -g -Os -Wall $(MACHDEP) $(INCLUDE) \
-DNGC -DWORDS_BIGENDIAN -DPACKAGE=\"VisualBoyAdvance\" \
-DVERSION=\"1.7.2\" -DC_CORE \
-DCHANFFS -DSDL -DNO_DEFLATE
CFLAGS = -g -Os -Wall $(MACHDEP) $(INCLUDE) -maltivec \
-DNGC -DWORDS_BIGENDIAN -DC_CORE \
-DCHANFFS -DSDL -DHAVE_ZUTIL_H
CXXFLAGS = -save-temps -Xassembler -aln=$@.lst $(CFLAGS)
LDFLAGS = -g $(MACHDEP) -Wl,-Map,$(notdir $@).map -Wl,--cref

View File

@ -25,10 +25,9 @@ INCLUDES := source/vba source/vba/gb source/ngc
# options for code generation
#---------------------------------------------------------------------------------
CFLAGS = -g -Os -Wall $(MACHDEP) $(INCLUDE) \
-DNGC -DWORDS_BIGENDIAN -DPACKAGE=\"VisualBoyAdvance\" \
-DVERSION=\"1.7.2\" -DC_CORE \
-DCHANFFS -DSDL -DNO_DEFLATE
CFLAGS = -g -Os -Wall $(MACHDEP) $(INCLUDE) -maltivec \
-DNGC -DWORDS_BIGENDIAN -DC_CORE \
-DCHANFFS -DSDL -DHAVE_ZUTIL_H
CXXFLAGS = -save-temps -Xassembler -aln=$@.lst $(CFLAGS)
LDFLAGS = -g $(MACHDEP) -Wl,-Map,$(notdir $@).map -Wl,--cref

View File

@ -13,7 +13,7 @@
#define SAVEBUFFERSIZE ((512 * 1024) + 2048 + 64 + 4 + 4)
#define MAXJOLIET 255
#define MAXDISPLAY 54
#define MAXDISPLAY 44
typedef struct
{

19212
source/ngc/images/bg.h Normal file

File diff suppressed because it is too large Load Diff

View File

@ -194,7 +194,7 @@ u32 DecodeJoy(unsigned short pad)
signed char pad_x = PAD_StickX (pad);
signed char pad_y = PAD_StickY (pad);
u32 jp = PAD_ButtonsHeld (pad);
unsigned char J = 0;
u32 J = 0;
#ifdef HW_RVL
signed char wm_ax = 0;
@ -298,12 +298,16 @@ u32 DecodeJoy(unsigned short pad)
J |= vbapadmap[i];
}
if ((J & 48) == 48)
J &= ~16;
if ((J & 192) == 192)
J &= ~128;
return J;
}
u32 GetJoy()
{
int pad = 0;
u32 res = 0;
s8 gc_px = PAD_SubStickX (0);
@ -339,12 +343,6 @@ u32 GetJoy()
}
else
{
res = DecodeJoy(pad);
if ((res & 48) == 48)
res &= ~16;
if ((res & 192) == 192)
res &= ~128;
return res;
return DecodeJoy(pad);
}
}

View File

@ -205,6 +205,17 @@ setfontcolour (u8 r, u8 g, u8 b)
fontlo = fontcolour & 0xffff;
}
/****************************************************************************
* Draws Version # on screen
***************************************************************************/
void DrawVersion()
{
setfontsize (12);
setfontcolour (0,0,0);
DrawText (115, screenheight - 34, (char *)VERSIONSTRFULL);
}
/****************************************************************************
* Display credits, legal copyright and licence
*
@ -217,10 +228,10 @@ Credits ()
setfontcolour (0x00, 0x00, 0x00);
setfontsize (28);
DrawText (-1, 60, (char*)"Credits");
setfontsize (26);
DrawText (-1, 150, (char*)"Credits");
int ypos = 25;
int ypos = 120;
if (screenheight == 480)
ypos += 52;
@ -245,9 +256,11 @@ Credits ()
DrawText (-1, ypos += 36, (char*)"And many others who have contributed over the years!");
setfontsize (12);
DrawText (-1, ypos += 50, (char*)"This software is open source and may be copied, distributed, or modified");
DrawText (-1, ypos += 15, (char*)"under the terms of the GNU General Public License (GPL) Version 2.");
DrawText (-1, ypos += 50, (char*)"This software is open source and may be copied,");
DrawText (-1, ypos += 15, (char*)"distributed, or modified under the terms of");
DrawText (-1, ypos += 15, (char*)"the GNU General Public License (GPL) Version 2.");
DrawVersion();
showscreen ();
}
@ -353,9 +366,12 @@ WaitPrompt (char *msg)
ypos += 32;
clearscreen ();
setfontsize(20);
DrawText (-1, ypos, msg);
ypos += 30;
DrawText (-1, ypos, (char*)"Press A to continue");
DrawVersion();
showscreen ();
WaitButtonA ();
}
@ -375,11 +391,14 @@ WaitPromptChoice (char *msg, char *bmsg, char *amsg)
ypos += 17;
clearscreen ();
setfontsize(20);
DrawText (-1, ypos, msg);
ypos += 60;
char txt[80];
sprintf (txt, "B = %s : A = %s", bmsg, amsg);
DrawText (-1, ypos, txt);
DrawVersion();
showscreen ();
return WaitButtonAB ();
}
@ -398,7 +417,10 @@ ShowAction (char *msg)
ypos += 32;
clearscreen ();
setfontsize(20);
DrawText (-1, ypos, msg);
DrawVersion();
showscreen ();
}
@ -413,7 +435,7 @@ DrawMenu (char items[][50], char *title, int maxitems, int selected, int fontsiz
int n = 1;
int line_height;
ypos = 45;
ypos = 105;
if (screenheight == 480)
ypos += 52;
@ -426,13 +448,10 @@ DrawMenu (char items[][50], char *title, int maxitems, int selected, int fontsiz
if (title != NULL)
{
setfontsize (28);
DrawText (-1, 60, title);
setfontsize (26);
DrawText (-1, 150, title);
}
setfontsize (14);
DrawText (380, screenheight - 30, (char *)VERSIONSTRFULL);
// Draw menu items
setfontsize (fontsize); // set font size
@ -448,11 +467,11 @@ DrawMenu (char items[][50], char *title, int maxitems, int selected, int fontsiz
else if (i == selected)
{
for( w = 0; w < line_height; w++ )
DrawLineFast( 30, 610, n * line_height + (ypos-line_height+6) + w, 0x80, 0x80, 0x80 );
DrawLineFast( 77, 575, n * line_height + (ypos-line_height+6) + w, 0x00, 0x00, 0x00 );
setfontcolour (0xff, 0xff, 0xff);
//setfontcolour (0xff, 0xff, 0xff);
DrawText (x, n * line_height + ypos, items[i]);
setfontcolour (0x00, 0x00, 0x00);
//setfontcolour (0x00, 0x00, 0x00);
}
else
{
@ -462,8 +481,8 @@ DrawMenu (char items[][50], char *title, int maxitems, int selected, int fontsiz
}
}
DrawVersion();
showscreen ();
}
/****************************************************************************
@ -584,8 +603,8 @@ ShowFiles (FILEENTRIES filelist[], int maxfiles, int offset, int selection)
clearscreen ();
setfontsize (28);
DrawText (-1, 60, (char*)"Choose Game");
setfontsize (26);
DrawText (-1, 150, (char*)"Choose Game");
setfontsize(18);
@ -596,6 +615,8 @@ ShowFiles (FILEENTRIES filelist[], int maxfiles, int offset, int selection)
else
ypos += 10;
ypos += 30;
j = 0;
for (i = offset; i < (offset + PAGESIZE) && (i < maxfiles); i++)
{
@ -614,19 +635,18 @@ ShowFiles (FILEENTRIES filelist[], int maxfiles, int offset, int selection)
{
/*** Highlighted text entry ***/
for ( w = 0; w < 20; w++ )
DrawLineFast( 30, 610, ( j * 20 ) + (ypos-16) + w, 0x80, 0x80, 0x80 );
setfontcolour (0x00, 0x00, 0xe0);
DrawText (50, (j * 20) + ypos, text);
setfontcolour (0x00, 0x00, 0x00);
DrawLineFast( 77, 575, ( j * 20 ) + (ypos-16) + w, 0x00, 0x00, 0x00 );
DrawText (100, (j * 20) + ypos, text);
}
else
{
/*** Normal entry ***/
DrawText (50, (j * 20) + ypos, text);
DrawText (100, (j * 20) + ypos, text);
}
j++;
}
DrawVersion();
showscreen ();
}
@ -645,8 +665,8 @@ ShowCheats (char items[][50], char itemvalues[][50], int maxitems, int offset, i
clearscreen ();
setfontsize (28);
DrawText (-1, 60, (char*)"Cheats");
setfontsize (26);
DrawText (-1, 150, (char*)"Cheats");
setfontsize(18);
@ -676,6 +696,8 @@ ShowCheats (char items[][50], char itemvalues[][50], int maxitems, int offset, i
}
j++;
}
DrawVersion();
showscreen ();
}
@ -784,6 +806,7 @@ ShowProgress (char *msg, int done, int total)
int i;
clearscreen ();
setfontsize(20);
DrawText (-1, ypos, msg);
/*** Draw a white outline box ***/
@ -796,6 +819,7 @@ ShowProgress (char *msg, int done, int total)
for (i = 381; i < 400; i++)
DrawLine (101, i, 101 + xpos, i, 0x00, 0x00, 0x80);
DrawVersion();
showscreen ();
}

View File

@ -19,7 +19,7 @@
#include "filesel.h"
#define PAGESIZE 17 // max item listing on a screen
#define PAGESIZE 13 // max item listing on a screen
int FT_Init ();
void setfontsize (int pixelsize);

View File

@ -229,8 +229,13 @@ bool SaveBattery(int method, bool silent)
result = emulator.emuWriteBattery(filepath);
}
if(!result && !silent)
WaitPrompt ((char*) "Save failed");
if(!silent)
{
if(result)
WaitPrompt ((char*) "Save successful");
else
WaitPrompt ((char*) "Save failed");
}
return result;
}
@ -275,8 +280,13 @@ bool SaveState(int method, bool silent)
result = emulator.emuWriteState(filepath);
}
if(!result && !silent)
WaitPrompt ((char*) "Save failed");
if(!silent)
{
if(result)
WaitPrompt ((char*) "Save successful");
else
WaitPrompt ((char*) "Save failed");
}
return result;
}

View File

@ -16,6 +16,7 @@
#include <string.h>
#include <malloc.h>
#include <wiiuse/wpad.h>
#include "images/bg.h"
/*** External 2D Video ***/
/*** 2D Video Globals ***/
@ -313,13 +314,7 @@ clearscreen (int c)
whichfb ^= 1;
VIDEO_ClearFrameBuffer (vmode, xfb[whichfb], colour);
#ifdef HW_RVL
// on wii copy from memory
//memcpy ((char *) xfb[whichfb], (char *) backdrop, 640 * screenheight * 2);
#else
// on gc copy from aram
//ARAMFetch ((char *) xfb[whichfb], (char *) AR_BACKDROP, 640 * screenheight * 2);
#endif
memcpy (xfb[whichfb], &bg, 1280 * 480);
}
void

View File

@ -1,135 +1,135 @@
// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator.
// Copyright (C) 1999-2003 Forgotten
// Copyright (C) 2004 Forgotten and the VBA development team
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2, or(at your option)
// any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software Foundation,
// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "GBA.h"
reg_pair reg[45];
memoryMap map[256];
bool ioReadable[0x400];
bool N_FLAG = 0;
bool C_FLAG = 0;
bool Z_FLAG = 0;
bool V_FLAG = 0;
bool armState = true;
bool armIrqEnable = true;
u32 armNextPC = 0x00000000;
int armMode = 0x1f;
u32 stop = 0x08000568;
int saveType = 0;
bool useBios = false;
bool skipBios = false;
int frameSkip = 1;
bool speedup = false;
bool synchronize = true;
bool cpuDisableSfx = false;
bool cpuIsMultiBoot = false;
bool parseDebug = false;
int layerSettings = 0xff00;
int layerEnable = 0xff00;
bool speedHack = false;
int cpuSaveType = 0;
bool cpuEnhancedDetection = true;
bool cheatsEnabled = false;
u8 *bios = NULL;
u8 *rom = NULL;
u8 *internalRAM = NULL;
u8 *workRAM = NULL;
u8 *paletteRAM = NULL;
u8 *vram = NULL;
u8 *pix = NULL;
u8 *oam = NULL;
u8 *ioMem = NULL;
u16 DISPCNT = 0x0080;
u16 DISPSTAT = 0x0000;
u16 VCOUNT = 0x0000;
u16 BG0CNT = 0x0000;
u16 BG1CNT = 0x0000;
u16 BG2CNT = 0x0000;
u16 BG3CNT = 0x0000;
u16 BG0HOFS = 0x0000;
u16 BG0VOFS = 0x0000;
u16 BG1HOFS = 0x0000;
u16 BG1VOFS = 0x0000;
u16 BG2HOFS = 0x0000;
u16 BG2VOFS = 0x0000;
u16 BG3HOFS = 0x0000;
u16 BG3VOFS = 0x0000;
u16 BG2PA = 0x0100;
u16 BG2PB = 0x0000;
u16 BG2PC = 0x0000;
u16 BG2PD = 0x0100;
u16 BG2X_L = 0x0000;
u16 BG2X_H = 0x0000;
u16 BG2Y_L = 0x0000;
u16 BG2Y_H = 0x0000;
u16 BG3PA = 0x0100;
u16 BG3PB = 0x0000;
u16 BG3PC = 0x0000;
u16 BG3PD = 0x0100;
u16 BG3X_L = 0x0000;
u16 BG3X_H = 0x0000;
u16 BG3Y_L = 0x0000;
u16 BG3Y_H = 0x0000;
u16 WIN0H = 0x0000;
u16 WIN1H = 0x0000;
u16 WIN0V = 0x0000;
u16 WIN1V = 0x0000;
u16 WININ = 0x0000;
u16 WINOUT = 0x0000;
u16 MOSAIC = 0x0000;
u16 BLDMOD = 0x0000;
u16 COLEV = 0x0000;
u16 COLY = 0x0000;
u16 DM0SAD_L = 0x0000;
u16 DM0SAD_H = 0x0000;
u16 DM0DAD_L = 0x0000;
u16 DM0DAD_H = 0x0000;
u16 DM0CNT_L = 0x0000;
u16 DM0CNT_H = 0x0000;
u16 DM1SAD_L = 0x0000;
u16 DM1SAD_H = 0x0000;
u16 DM1DAD_L = 0x0000;
u16 DM1DAD_H = 0x0000;
u16 DM1CNT_L = 0x0000;
u16 DM1CNT_H = 0x0000;
u16 DM2SAD_L = 0x0000;
u16 DM2SAD_H = 0x0000;
u16 DM2DAD_L = 0x0000;
u16 DM2DAD_H = 0x0000;
u16 DM2CNT_L = 0x0000;
u16 DM2CNT_H = 0x0000;
u16 DM3SAD_L = 0x0000;
u16 DM3SAD_H = 0x0000;
u16 DM3DAD_L = 0x0000;
u16 DM3DAD_H = 0x0000;
u16 DM3CNT_L = 0x0000;
u16 DM3CNT_H = 0x0000;
u16 TM0D = 0x0000;
u16 TM0CNT = 0x0000;
u16 TM1D = 0x0000;
u16 TM1CNT = 0x0000;
u16 TM2D = 0x0000;
u16 TM2CNT = 0x0000;
u16 TM3D = 0x0000;
u16 TM3CNT = 0x0000;
u16 P1 = 0xFFFF;
u16 IE = 0x0000;
u16 IF = 0x0000;
u16 IME = 0x0000;
// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator.
// Copyright (C) 1999-2003 Forgotten
// Copyright (C) 2004 Forgotten and the VBA development team
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2, or(at your option)
// any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software Foundation,
// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "GBA.h"
reg_pair reg[45];
memoryMap map[256];
bool ioReadable[0x400];
bool N_FLAG = 0;
bool C_FLAG = 0;
bool Z_FLAG = 0;
bool V_FLAG = 0;
bool armState = true;
bool armIrqEnable = true;
u32 armNextPC = 0x00000000;
int armMode = 0x1f;
u32 stop = 0x08000568;
int saveType = 0;
bool useBios = false;
bool skipBios = false;
int frameSkip = 1;
bool speedup = false;
bool synchronize = true;
bool cpuDisableSfx = false;
bool cpuIsMultiBoot = false;
bool parseDebug = true;
int layerSettings = 0xff00;
int layerEnable = 0xff00;
bool speedHack = false;
int cpuSaveType = 0;
bool cpuEnhancedDetection = true;
bool cheatsEnabled = true;
u8 *bios = NULL;
u8 *rom = NULL;
u8 *internalRAM = NULL;
u8 *workRAM = NULL;
u8 *paletteRAM = NULL;
u8 *vram = NULL;
u8 *pix = NULL;
u8 *oam = NULL;
u8 *ioMem = NULL;
u16 DISPCNT = 0x0080;
u16 DISPSTAT = 0x0000;
u16 VCOUNT = 0x0000;
u16 BG0CNT = 0x0000;
u16 BG1CNT = 0x0000;
u16 BG2CNT = 0x0000;
u16 BG3CNT = 0x0000;
u16 BG0HOFS = 0x0000;
u16 BG0VOFS = 0x0000;
u16 BG1HOFS = 0x0000;
u16 BG1VOFS = 0x0000;
u16 BG2HOFS = 0x0000;
u16 BG2VOFS = 0x0000;
u16 BG3HOFS = 0x0000;
u16 BG3VOFS = 0x0000;
u16 BG2PA = 0x0100;
u16 BG2PB = 0x0000;
u16 BG2PC = 0x0000;
u16 BG2PD = 0x0100;
u16 BG2X_L = 0x0000;
u16 BG2X_H = 0x0000;
u16 BG2Y_L = 0x0000;
u16 BG2Y_H = 0x0000;
u16 BG3PA = 0x0100;
u16 BG3PB = 0x0000;
u16 BG3PC = 0x0000;
u16 BG3PD = 0x0100;
u16 BG3X_L = 0x0000;
u16 BG3X_H = 0x0000;
u16 BG3Y_L = 0x0000;
u16 BG3Y_H = 0x0000;
u16 WIN0H = 0x0000;
u16 WIN1H = 0x0000;
u16 WIN0V = 0x0000;
u16 WIN1V = 0x0000;
u16 WININ = 0x0000;
u16 WINOUT = 0x0000;
u16 MOSAIC = 0x0000;
u16 BLDMOD = 0x0000;
u16 COLEV = 0x0000;
u16 COLY = 0x0000;
u16 DM0SAD_L = 0x0000;
u16 DM0SAD_H = 0x0000;
u16 DM0DAD_L = 0x0000;
u16 DM0DAD_H = 0x0000;
u16 DM0CNT_L = 0x0000;
u16 DM0CNT_H = 0x0000;
u16 DM1SAD_L = 0x0000;
u16 DM1SAD_H = 0x0000;
u16 DM1DAD_L = 0x0000;
u16 DM1DAD_H = 0x0000;
u16 DM1CNT_L = 0x0000;
u16 DM1CNT_H = 0x0000;
u16 DM2SAD_L = 0x0000;
u16 DM2SAD_H = 0x0000;
u16 DM2DAD_L = 0x0000;
u16 DM2DAD_H = 0x0000;
u16 DM2CNT_L = 0x0000;
u16 DM2CNT_H = 0x0000;
u16 DM3SAD_L = 0x0000;
u16 DM3SAD_H = 0x0000;
u16 DM3DAD_L = 0x0000;
u16 DM3DAD_H = 0x0000;
u16 DM3CNT_L = 0x0000;
u16 DM3CNT_H = 0x0000;
u16 TM0D = 0x0000;
u16 TM0CNT = 0x0000;
u16 TM1D = 0x0000;
u16 TM1CNT = 0x0000;
u16 TM2D = 0x0000;
u16 TM2CNT = 0x0000;
u16 TM3D = 0x0000;
u16 TM3CNT = 0x0000;
u16 P1 = 0xFFFF;
u16 IE = 0x0000;
u16 IF = 0x0000;
u16 IME = 0x0000;

File diff suppressed because it is too large Load Diff

View File

@ -10,7 +10,7 @@
*/
/* @(#) $Id: memgzio.c,v 1.3 2004/01/17 23:07:32 kxu Exp $ */
#include <string.h>
#include <stdio.h>
#include <stdarg.h>
#include <stdlib.h>
@ -70,15 +70,15 @@ typedef struct mem_stream
mem_stream;
gzFile gz_open OF((char *memory, const int available, const char *mode));
int do_flush OF((gzFile file, int flush));
int get_byte OF((mem_stream *s));
void check_header OF((mem_stream *s));
int destroy OF((mem_stream *s));
void putLong OF((MEMFILE *file, uLong x));
uLong getLong OF((mem_stream *s));
local gzFile gz_open OF((char *memory, const int available, const char *mode));
local int do_flush OF((gzFile file, int flush));
local int get_byte OF((mem_stream *s));
local void check_header OF((mem_stream *s));
local int destroy OF((mem_stream *s));
local void putLong OF((MEMFILE *file, uLong x));
local uLong getLong OF((mem_stream *s));
MEMFILE *memOpen(char *memory, int available, char mode)
local MEMFILE *memOpen(char *memory, int available, char mode)
{
MEMFILE *f;
@ -119,7 +119,7 @@ MEMFILE *memOpen(char *memory, int available, char mode)
return f;
}
size_t memWrite(const void *buffer, size_t size, size_t count,
local size_t memWrite(const void *buffer, size_t size, size_t count,
MEMFILE *file)
{
size_t total = size*count;
@ -140,7 +140,7 @@ size_t memWrite(const void *buffer, size_t size, size_t count,
return total;
}
size_t memRead(void *buffer, size_t size, size_t count,
local size_t memRead(void *buffer, size_t size, size_t count,
MEMFILE *file)
{
size_t total = size*count;
@ -164,7 +164,7 @@ size_t memRead(void *buffer, size_t size, size_t count,
return total;
}
int memPutc(int c, MEMFILE *file)
local int memPutc(int c, MEMFILE *file)
{
if(file->mode != 'w')
{
@ -183,17 +183,17 @@ int memPutc(int c, MEMFILE *file)
return c;
}
long memTell(MEMFILE *f)
local long memTell(MEMFILE *f)
{
return (f->next - f->memory) - 8;
}
int memError(MEMFILE *f)
local int memError(MEMFILE *f)
{
return f->error;
}
int memClose(MEMFILE *f)
local int memClose(MEMFILE *f)
{
if(f->mode == 'w')
{
@ -203,7 +203,7 @@ int memClose(MEMFILE *f)
return 0;
}
int memPrintf(MEMFILE *f, const char *format, ...)
local int memPrintf(MEMFILE *f, const char *format, ...)
{
char buffer[80];
va_list list;
@ -225,7 +225,7 @@ int memPrintf(MEMFILE *f, const char *format, ...)
can be checked to distinguish the two cases (if errno is zero, the
zlib error is Z_MEM_ERROR).
*/
gzFile gz_open (memory, available, mode)
local gzFile gz_open (memory, available, mode)
char *memory;
const int available;
const char *mode;
@ -313,7 +313,7 @@ const char *mode;
}
s->stream.avail_out = Z_BUFSIZE;
//errno = 0;
errno = 0;
s->file = memOpen(memory, available, s->mode);
if (s->file == NULL)
@ -325,8 +325,8 @@ const char *mode;
{
/* Write a very simple .gz header:
*/
//memPrintf(s->file, "%c%c%c%c%c%c%c%c%c%c", gz_magic[0], gz_magic[1],
// Z_DEFLATED, 0 /*flags*/, 0,0,0,0 /*time*/, 0 /*xflags*/, OS_CODE);
memPrintf(s->file, "%c%c%c%c%c%c%c%c%c%c", gz_magic[0], gz_magic[1],
Z_DEFLATED, 0 /*flags*/, 0,0,0,0 /*time*/, 0 /*xflags*/, OS_CODE);
s->startpos = 10L;
/* We use 10L instead of ftell(s->file) to because ftell causes an
* fflush on some systems. This version of the library doesn't use
@ -359,13 +359,13 @@ const char *mode;
for end of file.
IN assertion: the stream s has been sucessfully opened for reading.
*/
int get_byte(s)
local int get_byte(s)
mem_stream *s;
{
if (s->z_eof) return EOF;
if (s->stream.avail_in == 0)
{
// errno = 0;
errno = 0;
s->stream.avail_in = memRead(s->inbuf, 1, Z_BUFSIZE, s->file);
if (s->stream.avail_in == 0)
{
@ -388,7 +388,7 @@ mem_stream *s;
s->stream.avail_in is zero for the first time, but may be non-zero
for concatenated .gz files.
*/
void check_header(s)
local void check_header(s)
mem_stream *s;
{
int method; /* method byte */
@ -449,7 +449,7 @@ mem_stream *s;
* Cleanup then free the given mem_stream. Return a zlib error code.
Try freeing in the reverse order of allocations.
*/
int destroy (s)
local int destroy (s)
mem_stream *s;
{
int err = Z_OK;
@ -520,7 +520,7 @@ unsigned len;
if (n > s->stream.avail_out) n = s->stream.avail_out;
if (n > 0)
{
// zmemcpy(s->stream.next_out, s->stream.next_in, n);
zmemcpy(s->stream.next_out, s->stream.next_in, n);
next_out += n;
s->stream.next_out = next_out;
s->stream.next_in += n;
@ -541,7 +541,7 @@ unsigned len;
if (s->stream.avail_in == 0 && !s->z_eof)
{
// errno = 0;
errno = 0;
s->stream.avail_in = memRead(s->inbuf, 1, Z_BUFSIZE, s->file);
if (s->stream.avail_in == 0)
{
@ -637,7 +637,7 @@ unsigned len;
Flushes all pending output into the compressed file. The parameter
flush is as in the deflate() function.
*/
int do_flush (file, flush)
local int do_flush (file, flush)
gzFile file;
int flush;
{
@ -682,7 +682,7 @@ int flush;
/* ===========================================================================
Outputs a long in LSB order to the given file
*/
void putLong (file, x)
local void putLong (file, x)
MEMFILE *file;
uLong x;
{
@ -698,7 +698,7 @@ uLong x;
Reads a long in LSB order from the given mem_stream. Sets z_err in case
of error.
*/
uLong getLong (s)
local uLong getLong (s)
mem_stream *s;
{
uLong x = (uLong)get_byte(s);
@ -719,7 +719,7 @@ mem_stream *s;
int ZEXPORT memgzclose (file)
gzFile file;
{
// int err;
int err;
mem_stream *s = (mem_stream*)file;
if (s == NULL) return Z_STREAM_ERROR;

View File

@ -8,19 +8,14 @@
/* memgzio.c - IO on .gz files in memory
* Adapted from original gzio.c from zlib library by Forgotten
*/
/*
#ifndef HAVE_ZUTIL_H
#include "../win32/include/zlib/zutil.h"
#else
#include <zutil.h>
#endif
*/
#include <zlib.h>
gzFile ZEXPORT memgzopen(char *memory, int, const char *);
int ZEXPORT memgzread(gzFile, voidp, unsigned);
int ZEXPORT memgzwrite(gzFile, const voidp, unsigned);
int ZEXPORT memgzclose(gzFile);
long ZEXPORT memtell(gzFile);

View File

@ -1,242 +0,0 @@
// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator.
// Copyright (C) 1999-2003 Forgotten
// Copyright (C) 2004 Forgotten and the VBA development team
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2, or(at your option)
// any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software Foundation,
// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "System.h"
extern int RGB_LOW_BITS_MASK;
void Scanlines (u8 *srcPtr, u32 srcPitch, u8 *,
u8 *dstPtr, u32 dstPitch, int width, int height)
{
u8 *nextLine, *finish;
nextLine = dstPtr + dstPitch;
do
{
u32 *bP = (u32 *) srcPtr;
u32 *dP = (u32 *) dstPtr;
u32 *nL = (u32 *) nextLine;
u32 currentPixel;
u32 nextPixel;
finish = (u8 *) bP + ((width+2) << 1);
nextPixel = *bP++;
do
{
currentPixel = nextPixel;
nextPixel = *bP++;
u32 colorA, colorB;
#ifdef WORDS_BIGENDIAN
colorA = currentPixel >> 16;
colorB = currentPixel & 0xffff;
#else
colorA = currentPixel & 0xffff;
colorB = currentPixel >> 16;
#endif
*(dP) = colorA | colorA<<16;
*(nL) = 0;
#ifdef WORDS_BIGENDIAN
colorA = nextPixel >> 16;
#else
colorA = nextPixel & 0xffff;
#endif
*(dP + 1) = colorB | (colorB << 16);
*(nL + 1) = 0;
dP += 2;
nL += 2;
}
while ((u8 *) bP < finish);
srcPtr += srcPitch;
dstPtr += dstPitch << 1;
nextLine += dstPitch << 1;
}
while (--height);
}
void Scanlines32(u8 *srcPtr, u32 srcPitch, u8 * /* deltaPtr */,
u8 *dstPtr, u32 dstPitch, int width, int height)
{
u8 *nextLine, *finish;
nextLine = dstPtr + dstPitch;
do
{
u32 *bP = (u32 *) srcPtr;
u32 *dP = (u32 *) dstPtr;
u32 *nL = (u32 *) nextLine;
u32 currentPixel;
u32 nextPixel;
finish = (u8 *) bP + ((width+1) << 2);
nextPixel = *bP++;
do
{
currentPixel = nextPixel;
nextPixel = *bP++;
u32 colorA, colorB;
colorA = currentPixel;
colorB = nextPixel;
*(dP) = colorA;
*(dP+1) = colorA;
*(nL) = 0;
*(nL+1) = 0;
*(dP + 2) = colorB;
*(dP + 3) = colorB;
*(nL+2) = 0;
*(nL+3) = 0;
nextPixel = *bP++;
dP += 4;
nL += 4;
}
while ((u8 *) bP < finish);
srcPtr += srcPitch;
dstPtr += dstPitch << 1;
nextLine += dstPitch << 1;
}
while (--height);
}
void ScanlinesTV(u8 *srcPtr, u32 srcPitch, u8 * /* deltaPtr */,
u8 *dstPtr, u32 dstPitch, int width, int height)
{
u8 *nextLine, *finish;
u32 colorMask = ~(RGB_LOW_BITS_MASK | (RGB_LOW_BITS_MASK << 16));
nextLine = dstPtr + dstPitch;
do
{
u32 *bP = (u32 *) srcPtr;
u32 *dP = (u32 *) dstPtr;
u32 *nL = (u32 *) nextLine;
u32 currentPixel;
u32 nextPixel;
finish = (u8 *) bP + ((width+2) << 1);
nextPixel = *bP++;
do
{
currentPixel = nextPixel;
nextPixel = *bP++;
u32 colorA, colorB;
#ifdef WORDS_BIGENDIAN
colorA = currentPixel >> 16;
colorB = currentPixel & 0xFFFF;
#else
colorA = currentPixel & 0xFFFF;
colorB = currentPixel >> 16;
#endif
*(dP) = colorA = colorA | ((((colorA & colorMask) >> 1) +
((colorB & colorMask) >> 1))) << 16;
colorA = ((colorA & colorMask) >> 1);
colorA += ((colorA & colorMask) >> 1);
*(nL) = colorA;
colorA = nextPixel & 0xFFFF;
*(dP + 1) = colorB = colorB | ((((colorA & colorMask) >> 1) +
((colorB & colorMask) >> 1))) << 16;
colorB = ((colorB & colorMask) >> 1);
colorB += ((colorB & colorMask) >> 1);
*(nL + 1) = colorB;
dP += 2;
nL += 2;
}
while ((u8 *) bP < finish);
srcPtr += srcPitch;
dstPtr += dstPitch << 1;
nextLine += dstPitch << 1;
}
while (--height);
}
void ScanlinesTV32(u8 *srcPtr, u32 srcPitch, u8 * /* deltaPtr */,
u8 *dstPtr, u32 dstPitch, int width, int height)
{
u8 *nextLine, *finish;
u32 colorMask = ~RGB_LOW_BITS_MASK;
nextLine = dstPtr + dstPitch;
do
{
u32 *bP = (u32 *) srcPtr;
u32 *dP = (u32 *) dstPtr;
u32 *nL = (u32 *) nextLine;
u32 currentPixel;
u32 nextPixel;
finish = (u8 *) bP + ((width+1) << 2);
nextPixel = *bP++;
do
{
currentPixel = nextPixel;
nextPixel = *bP++;
u32 colorA, colorB, temp;
colorA = currentPixel;
colorB = nextPixel;
*(dP) = colorA;
*(dP+1) = temp = ((colorA & colorMask) >> 1) +
((colorB & colorMask) >> 1);
temp = ((temp & colorMask) >> 1);
temp += ((temp & colorMask) >> 1);
colorA = ((colorA & colorMask) >> 1);
colorA += ((colorA & colorMask) >> 1);
*(nL) = colorA;
*(nL+1) = temp;
dP += 2;
nL += 2;
}
while ((u8 *) bP < finish);
srcPtr += srcPitch;
dstPtr += dstPitch << 1;
nextLine += dstPitch << 1;
}
while (--height);
}

View File

@ -66,7 +66,7 @@ extern "C"
#endif
#ifndef _ZLIB_H
#include <zlib.h>
#include "zlib.h"
#endif
#if defined(STRICTUNZIP) || defined(STRICTZIPUNZIP)