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 # options for code generation
#--------------------------------------------------------------------------------- #---------------------------------------------------------------------------------
CFLAGS = -g -Os -Wall $(MACHDEP) $(INCLUDE) \ CFLAGS = -g -Os -Wall $(MACHDEP) $(INCLUDE) -maltivec \
-DNGC -DWORDS_BIGENDIAN -DPACKAGE=\"VisualBoyAdvance\" \ -DNGC -DWORDS_BIGENDIAN -DC_CORE \
-DVERSION=\"1.7.2\" -DC_CORE \ -DCHANFFS -DSDL -DHAVE_ZUTIL_H
-DCHANFFS -DSDL -DNO_DEFLATE
CXXFLAGS = -save-temps -Xassembler -aln=$@.lst $(CFLAGS) CXXFLAGS = -save-temps -Xassembler -aln=$@.lst $(CFLAGS)
LDFLAGS = -g $(MACHDEP) -Wl,-Map,$(notdir $@).map -Wl,--cref 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 # options for code generation
#--------------------------------------------------------------------------------- #---------------------------------------------------------------------------------
CFLAGS = -g -Os -Wall $(MACHDEP) $(INCLUDE) \ CFLAGS = -g -Os -Wall $(MACHDEP) $(INCLUDE) -maltivec \
-DNGC -DWORDS_BIGENDIAN -DPACKAGE=\"VisualBoyAdvance\" \ -DNGC -DWORDS_BIGENDIAN -DC_CORE \
-DVERSION=\"1.7.2\" -DC_CORE \ -DCHANFFS -DSDL -DHAVE_ZUTIL_H
-DCHANFFS -DSDL -DNO_DEFLATE
CXXFLAGS = -save-temps -Xassembler -aln=$@.lst $(CFLAGS) CXXFLAGS = -save-temps -Xassembler -aln=$@.lst $(CFLAGS)
LDFLAGS = -g $(MACHDEP) -Wl,-Map,$(notdir $@).map -Wl,--cref LDFLAGS = -g $(MACHDEP) -Wl,-Map,$(notdir $@).map -Wl,--cref

View File

@ -13,7 +13,7 @@
#define SAVEBUFFERSIZE ((512 * 1024) + 2048 + 64 + 4 + 4) #define SAVEBUFFERSIZE ((512 * 1024) + 2048 + 64 + 4 + 4)
#define MAXJOLIET 255 #define MAXJOLIET 255
#define MAXDISPLAY 54 #define MAXDISPLAY 44
typedef struct 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_x = PAD_StickX (pad);
signed char pad_y = PAD_StickY (pad); signed char pad_y = PAD_StickY (pad);
u32 jp = PAD_ButtonsHeld (pad); u32 jp = PAD_ButtonsHeld (pad);
unsigned char J = 0; u32 J = 0;
#ifdef HW_RVL #ifdef HW_RVL
signed char wm_ax = 0; signed char wm_ax = 0;
@ -298,12 +298,16 @@ u32 DecodeJoy(unsigned short pad)
J |= vbapadmap[i]; J |= vbapadmap[i];
} }
if ((J & 48) == 48)
J &= ~16;
if ((J & 192) == 192)
J &= ~128;
return J; return J;
} }
u32 GetJoy() u32 GetJoy()
{ {
int pad = 0; int pad = 0;
u32 res = 0;
s8 gc_px = PAD_SubStickX (0); s8 gc_px = PAD_SubStickX (0);
@ -339,12 +343,6 @@ u32 GetJoy()
} }
else else
{ {
res = DecodeJoy(pad); return DecodeJoy(pad);
if ((res & 48) == 48)
res &= ~16;
if ((res & 192) == 192)
res &= ~128;
return res;
} }
} }

View File

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

View File

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

View File

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

View File

@ -16,6 +16,7 @@
#include <string.h> #include <string.h>
#include <malloc.h> #include <malloc.h>
#include <wiiuse/wpad.h> #include <wiiuse/wpad.h>
#include "images/bg.h"
/*** External 2D Video ***/ /*** External 2D Video ***/
/*** 2D Video Globals ***/ /*** 2D Video Globals ***/
@ -313,13 +314,7 @@ clearscreen (int c)
whichfb ^= 1; whichfb ^= 1;
VIDEO_ClearFrameBuffer (vmode, xfb[whichfb], colour); VIDEO_ClearFrameBuffer (vmode, xfb[whichfb], colour);
#ifdef HW_RVL memcpy (xfb[whichfb], &bg, 1280 * 480);
// 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
} }
void void

View File

@ -38,13 +38,13 @@ bool speedup = false;
bool synchronize = true; bool synchronize = true;
bool cpuDisableSfx = false; bool cpuDisableSfx = false;
bool cpuIsMultiBoot = false; bool cpuIsMultiBoot = false;
bool parseDebug = false; bool parseDebug = true;
int layerSettings = 0xff00; int layerSettings = 0xff00;
int layerEnable = 0xff00; int layerEnable = 0xff00;
bool speedHack = false; bool speedHack = false;
int cpuSaveType = 0; int cpuSaveType = 0;
bool cpuEnhancedDetection = true; bool cpuEnhancedDetection = true;
bool cheatsEnabled = false; bool cheatsEnabled = true;
u8 *bios = NULL; u8 *bios = NULL;
u8 *rom = NULL; u8 *rom = NULL;

View File

@ -40,6 +40,7 @@ extern "C"
#include "RTC.h" #include "RTC.h"
#include "Port.h" #include "Port.h"
extern "C" extern "C"
{ {
#include "memgzio.h" #include "memgzio.h"
@ -1103,7 +1104,7 @@ gzFile utilGzOpen(const char *file, const char *mode)
gzFile utilMemGzOpen(char *memory, int available, char *mode) gzFile utilMemGzOpen(char *memory, int available, char *mode)
{ {
// utilGzWriteFunc = memgzwrite; utilGzWriteFunc = memgzwrite;
utilGzReadFunc = memgzread; utilGzReadFunc = memgzread;
utilGzCloseFunc = memgzclose; utilGzCloseFunc = memgzclose;

View File

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

View File

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