code cleanup

This commit is contained in:
ekeeke31 2008-12-11 17:38:29 +00:00
parent 822de1bd3f
commit 00a61b4762
83 changed files with 33831 additions and 35082 deletions

View File

@ -17,10 +17,10 @@ include $(DEVKITPPC)/gamecube_rules
#---------------------------------------------------------------------------------
TARGET := genplus_cube
BUILD := build_cube
SOURCES := source source/m68k source/z80 source/sound source/cart_hw \
source/cart_hw/svp source/ngc source/ngc/gui source/sound/SRC source/ntsc
INCLUDES := source source/m68k source/z80 source/sound source/cart_hw \
source/cart_hw/svp source/ngc source/ngc/gui source/sound/SRC source/ntsc
SOURCES := source source/m68k source/z80 source/sound source/sound/SRC source/ntsc \
source/cart_hw source/cart_hw/svp source/ngc source/ngc/gui source/ngc/fileio
INCLUDES := source source/m68k source/z80 source/sound source/sound/SRC source/ntsc \
source/cart_hw source/cart_hw/svp source/ngc source/ngc/gui source/ngc/fileio
#---------------------------------------------------------------------------------
# options for code generation

View File

@ -17,10 +17,10 @@ include $(DEVKITPPC)/wii_rules
#---------------------------------------------------------------------------------
TARGET := genplus_wii
BUILD := build_wii
SOURCES := source source/m68k source/z80 source/sound source/cart_hw\
source/cart_hw/svp source/ngc source/ngc/gui source/sound/SRC source/ntsc
INCLUDES := source source/m68k source/z80 source/sound source/cart_hw\
source/cart_hw/svp source/ngc source/ngc/gui source/sound/SRC source/ntsc
SOURCES := source source/m68k source/z80 source/sound source/sound/SRC source/ntsc \
source/cart_hw source/cart_hw/svp source/ngc source/ngc/gui source/ngc/fileio
INCLUDES := source source/m68k source/z80 source/sound source/sound/SRC source/ntsc \
source/cart_hw source/cart_hw/svp source/ngc source/ngc/gui source/ngc/fileio
#---------------------------------------------------------------------------------
# options for code generation

View File

@ -180,13 +180,11 @@ void eeprom_write(uint32 address, uint32 value, uint32 word_access)
Detect_STOP();
break;
/* Suspended Mode */
case WAIT_STOP:
Detect_STOP();
break;
/* Get Word Address 7 bits: MODE-1 only (24C01)
* and R/W bit
*/

View File

@ -2,7 +2,8 @@
vscroll: 1 (0); 209 (26) - alternates every 4 frames
vram range for patterns: 0000-999f (low scr 0000-395f,72e0-999f; high 3980-999f)
name table address: c000
seen DMAs (in order): [300002-3026c3]->[0020-26e1] len 4961
seen DMAs (in order):
[300002-3026c3]->[0020-26e1] len 4961
[3026c2-303943]->[26e0-3961] len 2369
[303942-306003]->[72e0-99a1] len 4961
---

View File

@ -63,7 +63,7 @@ typedef struct
unsigned short stack[6];
unsigned int pmac_read[6]; // read modes/addrs for PM0-PM5
unsigned int pmac_write[6]; // write ...
//
#define SSP_PMC_HAVE_ADDR 0x0001 // address written to PMAC, waiting for mode
#define SSP_PMC_SET 0x0002 // PMAC is set
#define SSP_HANG 0x1000 // 68000 hangs SVP

View File

@ -86,11 +86,8 @@ static inline void lightgun_update(int num)
H-Counter range is approx. 292 pixel clocks
*/
hc_latch = 0x100;
if (reg[12] & 1)
hc_latch |= hc_320[((input.analog[num][0] * 290) / (2 * 320) + input.x_offset) % 210];
else
hc_latch |= hc_256[(input.analog[num][0] / 2 + input.x_offset)%171];
if (reg[12] & 1) hc_latch |= hc_320[((input.analog[num][0] * 290) / (2 * 320) + input.x_offset) % 210];
else hc_latch |= hc_256[(input.analog[num][0] / 2 + input.x_offset)%171];
}
}
}

View File

@ -1,7 +1,27 @@
/****************************************************************************
* config.c
*
* Genesis Plus GX configuration file support
*
* code by Eke-Eke (2008)
*
* 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 of the License, 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 "shared.h"
#include "font.h"
#include <fat.h>
#include <sys/dir.h>
#ifdef HW_RVL

View File

@ -1,3 +1,25 @@
/****************************************************************************
* config.c
*
* Genesis Plus GX configuration file support
*
* code by Eke-Eke (2008)
*
* 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 of the License, 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
*
***************************************************************************/
#ifndef _CONFIG_H_
#define _CONFIG_H_

View File

@ -1,19 +0,0 @@
/****************************************************************************
* Nintendo Gamecube DVD Reading Library
*
* Low-Level DVD access
*
***************************************************************************/
#ifndef _DVD_H_
#define _DVD_H_
extern u32 dvd_read (void *dst, u32 len, u64 offset);
extern void dvd_motor_off ();
#ifndef HW_RVL
extern void uselessinquiry ();
extern void dvd_drive_detect();
#endif
#endif

View File

@ -1,9 +1,26 @@
/****************************************************************************
* Nintendo Gamecube DVD Reading Library
/*
* dvd.c
*
* Low-Level DVD access
* Low-level DVD access
*
***************************************************************************/
* code by Softdev (2006), Eke-Eke (2007,2008)
*
* 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 of the License, 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 "shared.h"
#ifdef HW_RVL

36
source/ngc/fileio/dvd.h Normal file
View File

@ -0,0 +1,36 @@
/*
* dvd.c
*
* Low-level DVD access
*
* code by Softdev (2006), Eke-Eke (2007,2008)
*
* 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 of the License, 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
*
********************************************************************************/
#ifndef _DVD_H_
#define _DVD_H_
extern u32 dvd_read (void *dst, u32 len, u64 offset);
extern void dvd_motor_off ();
#ifndef HW_RVL
extern void uselessinquiry ();
extern void dvd_drive_detect();
#endif
#endif

View File

@ -1,14 +1,31 @@
/****************************************************************************
/*
* file_dvd.c
*
* DVD ISO9660/Joliet loading support
* generic ISO9660/Joliet DVD loading support
*
***************************************************************************/
* code by Eke-Eke (2008)
*
* 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 of the License, 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 "shared.h"
#include "font.h"
#include "fileio_dvd.h"
#include "filesel.h"
#include "fileio.h"
#include "dvd.h"
#include "unzip.h"
#include "filesel.h"
#ifdef HW_RVL
#include "di/di.h"
@ -269,7 +286,7 @@ int DVD_ParseDirectory ()
* This functions return the actual size of data copied into the buffer
*
****************************************************************************/
int DVD_LoadFile (unsigned char *buffer)
int DVD_LoadFile (u8 *buffer)
{
/* file size */
int length = filelist[selection].length;
@ -284,6 +301,9 @@ int DVD_LoadFile (unsigned char *buffer)
/* determine file type */
if (!IsZipFile ((char *) readbuffer))
{
char msg[50];
sprintf(msg,"Loading %d bytes...", length);
ShowAction(msg);
/* How many 2k blocks to read */
int blocks = length / 2048;
int readoffset = 0;
@ -310,7 +330,7 @@ int DVD_LoadFile (unsigned char *buffer)
}
else
{
return UnZipDVD (buffer, discoffset, length);
return UnZipBuffer (buffer, discoffset, NULL);
}
}
@ -323,7 +343,7 @@ int DVD_LoadFile (unsigned char *buffer)
* Function to load a DVD directory and display to user.
****************************************************************************/
int DVD_Open ()
int DVD_Open (u8 *buffer)
{
/* reset flags */
useFAT = 0;
@ -385,7 +405,7 @@ int DVD_Open ()
selection = 0;
old_offset = 0;
old_selection = 0;
return FileSelector ();
return FileSelector (buffer);
}
else
{
@ -395,5 +415,5 @@ int DVD_Open ()
}
}
return FileSelector ();
return FileSelector (buffer);
}

View File

@ -0,0 +1,32 @@
/*
* file_dvd.c
*
* generic ISO9660/Joliet DVD loading support
*
* code by Eke-Eke (2008)
*
* 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 of the License, 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
*
********************************************************************************/
#ifndef _FILE_DVD_H
#define _FILE_DVD_H
extern int DVD_UpdateDir(int go_up);
extern int DVD_ParseDirectory();
extern int DVD_LoadFile(u8 *buffer);
extern int DVD_Open (u8 *buffer);
#endif

View File

@ -1,16 +1,35 @@
/****************************************************************************
* FAT loading support
/*
* file_fat.c
*
***************************************************************************/
* generic FAT loading support
*
* code by Eke-Eke (2008)
*
* 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 of the License, 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 "shared.h"
#include "font.h"
#include "fileio_fat.h"
#include "filesel.h"
#include "fileio.h"
#include "history.h"
#include "unzip.h"
#include "filesel.h"
#include "file_fat.h"
/* current FAT directory */
static char fatdir[256];
static char fatdir[MAXPATHLEN];
/* current FAT device */
static int fat_type = 0;
@ -149,7 +168,7 @@ int FAT_ParseDirectory()
* This functions return the actual size of data copied into the buffer
*
****************************************************************************/
int FAT_LoadFile (unsigned char *buffer)
int FAT_LoadFile (u8 *buffer)
{
/* If loading from history then we need to setup a few more things. */
if(useHistory)
@ -203,6 +222,9 @@ int FAT_LoadFile (unsigned char *buffer)
sdfile = fopen(fname, "rb");
if (sdfile)
{
char msg[50];
sprintf(msg,"Loading %d bytes...", length);
ShowAction(msg);
fread(buffer, 1, length, sdfile);
fclose(sdfile);
return length;
@ -211,7 +233,7 @@ int FAT_LoadFile (unsigned char *buffer)
else
{
/* unzip file */
return UnZipFAT(buffer, fname);
return UnZipBuffer (buffer, 0, fname);
}
}
@ -223,7 +245,7 @@ int FAT_LoadFile (unsigned char *buffer)
*
* Function to load a FAT directory and display to user.
****************************************************************************/
int FAT_Open(int type)
int FAT_Open(int type, u8 *buffer)
{
int max = 0;
char root[10] = "";
@ -299,7 +321,7 @@ int FAT_Open(int type)
selection = 0;
old_offset = 0;
old_selection = 0;
return FileSelector ();
return FileSelector (buffer);
}
else
{
@ -309,5 +331,5 @@ int FAT_Open(int type)
}
}
return FileSelector ();
return FileSelector (buffer);
}

View File

@ -0,0 +1,39 @@
/*
* file_fat.c
*
* generic FAT loading support
*
* code by Eke-Eke (2008)
*
* 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 of the License, 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
*
********************************************************************************/
#ifndef _FILE_FAT_H
#define _FILE_FAT_H
#define TYPE_RECENT 0
#define TYPE_SD 1
#ifdef HW_RVL
#define TYPE_USB 2
#endif
extern int FAT_UpdateDir(int go_up);
extern int FAT_ParseDirectory(void);
extern int FAT_LoadFile(u8* buffer);
extern int FAT_Open (int type, u8 *buffer);
#endif

View File

@ -1,19 +1,30 @@
/****************************************************************************
* ROM Selection Interface
/*
* filesel.c
*
* The following features are implemented:
* . SDCARD access with LFN support (through softdev's VFAT library)
* . DVD access
* . easy subdirectory browsing
* . ROM browser
* . alphabetical file sorting (Marty Disibio)
* . load from history list (Marty Disibio)
* File Selection menu
*
***************************************************************************/
* code by Softdev (2006), Eke-Eke (2007,2008)
*
* 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 of the License, 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 "shared.h"
#include "font.h"
#include "fileio_dvd.h"
#include "fileio_fat.h"
#include "file_dvd.h"
#include "file_fat.h"
#include "filesel.h"
/* Global Variables */
@ -27,6 +38,7 @@ int useHistory = 0;
int haveDVDdir = 0;
int haveFATdir = 0;
FILEENTRIES filelist[MAXFILES];
/***************************************************************************
* ShowFiles
@ -46,8 +58,8 @@ static void ShowFiles (int offset, int selection)
memset(text,0,MAXJOLIET+2);
if (filelist[i].flags) sprintf(text, "[%s]", filelist[i].filename + filelist[i].filename_offset);
else sprintf (text, "%s", filelist[i].filename + filelist[i].filename_offset);
if (j == (selection - offset)) WriteCentre_HL ((j * fheight) + 120, text);
else WriteCentre ((j * fheight) + 120, text);
if (j == (selection - offset)) WriteCentre_HL ((j * fheight) + PAGEOFFSET, text);
else WriteCentre ((j * fheight) + PAGEOFFSET, text);
j++;
}
SetScreen ();
@ -57,8 +69,11 @@ static void ShowFiles (int offset, int selection)
* FileSelector
*
* Let user select a file from the File listing
.* ROM file buffer is provided as input
* ROM size is returned
*
****************************************************************************/
int FileSelector()
int FileSelector(unsigned char *buffer)
{
short p;
int redraw = 1;
@ -168,10 +183,15 @@ int FileSelector()
if (filelist[selection].flags)
{
/* get new directory */
ret = useFAT ? FAT_UpdateDir(go_up) : DVD_UpdateDir(go_up);
if (useFAT) ret =FAT_UpdateDir(go_up);
else ret = DVD_UpdateDir(go_up);
/* get new entry list or quit */
if (ret) maxfiles = useFAT ? FAT_ParseDirectory() : DVD_ParseDirectory();
if (ret)
{
if (useFAT) maxfiles = FAT_ParseDirectory();
else maxfiles = DVD_ParseDirectory();
}
else return 0;
}
@ -179,16 +199,8 @@ int FileSelector()
else
{
/* Load file */
genromsize = useFAT ? FAT_LoadFile(cart_rom) : DVD_LoadFile(cart_rom);
if (genromsize)
{
memfile_autosave();
reloadrom();
memfile_autoload();
return 1;
}
return 0;
if (useFAT) return FAT_LoadFile(buffer);
else return DVD_LoadFile(buffer);
}
redraw = 1;
}

View File

@ -0,0 +1,59 @@
/*
* filesel.c
*
* File Selection menu
*
* code by Softdev (2006), Eke-Eke (2007,2008)
*
* 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 of the License, 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
*
********************************************************************************/
#ifndef _FILESEL_H
#define _FILESEL_H
#define MAXJOLIET 256
#define MAXFILES 1000
/* this is emulator specific ! */
#define PAGESIZE 12
#define PAGEOFFSET 120
/* Filelist structure */
typedef struct
{
u64 offset;
unsigned int length;
char flags;
char filename[MAXJOLIET];
u16 filename_offset;
}FILEENTRIES;
/* Global Variables */
extern FILEENTRIES filelist[MAXFILES];
extern int maxfiles;
extern int offset;
extern int selection;
extern int old_selection;
extern int old_offset;
extern int useFAT;
extern int haveDVDdir;
extern int haveFATdir;
extern int FileSelector(unsigned char *buffer);
#endif

View File

@ -1,11 +1,25 @@
/*
* history.c
* genplusgx-mdisibio
*
* Created by Martin Disibio on 6/17/08.
* Copyright 2008 __MyCompanyName__. All rights reserved.
* Generic ROM history list managment
*
*/
* code by Martin Disibio (6/17/08)
*
* 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 of the License, 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 "shared.h"
#include "history.h"

View File

@ -0,0 +1,51 @@
/*
* history.c
*
* Generic ROM history list managment
*
* code by Martin Disibio (6/17/08)
*
* 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 of the License, 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
*
********************************************************************************/
#ifndef _HISTORY_H
#define _HISTORY_H
#include "filesel.h"
#define NUM_HISTORY_ENTRIES (10)
/****************************************************************************
* ROM Play History
*
****************************************************************************/
typedef struct
{
char filepath[MAXJOLIET];
char filename[MAXJOLIET];
} t_history_entry;
typedef struct
{
t_history_entry entries[NUM_HISTORY_ENTRIES];
} t_history;
extern t_history history;
extern void history_add_file(char *filepath, char *filename);
extern void history_load();
extern void set_history_defaults();
#endif

View File

@ -1,16 +1,33 @@
/******************************************************************************
*
* Nintendo Gamecube Zip Support
* unzip.c
*
* Zip Support
*
* Only partial support is included, in that only the first file within the archive
* is considered to be a ROM image.
***************************************************************************/
*
* code by Softdev (2006), Eke-Eke (2007,2008)
*
* 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 of the License, 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 "shared.h"
#include "dvd.h"
#include "font.h"
#include "unzip.h"
#include <zlib.h>
/*
* PKWare Zip Header - adopted into zip standard
@ -77,7 +94,7 @@ int IsZipFile (char *buffer)
*
* It should be noted that there is a limit of 5MB total size for any ROM
******************************************************************************/
int UnZipDVD (unsigned char *outbuffer, u64 discoffset, int length)
int UnZipBuffer (unsigned char *outbuffer, u64 discoffset, char *filename)
{
PKZIPHEADER pkzip;
int zipoffset = 0;
@ -89,9 +106,25 @@ int UnZipDVD (unsigned char *outbuffer, u64 discoffset, int length)
int have = 0;
char readbuffer[2048];
char msg[128];
FILE *fatfile = NULL;
/*** FAT file support ***/
if (filename)
{
fatfile = fopen(filename, "rb");
if (fatfile == NULL) return 0;
}
/*** Read Zip Header ***/
if (fatfile)
{
fseek(fatfile, 0, SEEK_SET);
fread(readbuffer, 1, 2048, fatfile);
}
else
{
dvd_read (&readbuffer, 2048, discoffset);
}
/*** Copy PKZip header to local, used as info ***/
memcpy (&pkzip, &readbuffer, sizeof (PKZIPHEADER));
@ -147,13 +180,23 @@ int UnZipDVD (unsigned char *outbuffer, u64 discoffset, int length)
zipoffset = 0;
zipchunk = ZIPCHUNK;
if (fatfile)
{
fread(readbuffer, 1, 2048, fatfile);
}
else
{
discoffset += 2048;
dvd_read (&readbuffer, 2048, discoffset);
}
}
while (res != Z_STREAM_END);
inflateEnd (&zs);
/* close file */
if (fatfile) fclose(fatfile);
if (res == Z_STREAM_END)
{
if (FLIP32 (pkzip.uncompressedSize) == (u32) bufferoffset) return bufferoffset;
@ -163,72 +206,5 @@ int UnZipDVD (unsigned char *outbuffer, u64 discoffset, int length)
return 0;
}
int UnZipFAT (unsigned char *outbuffer, char *filename)
{
unzFile *fd = NULL;
unz_file_info info;
int ret = 0;
int size;
char msg[128];
/* Attempt to open the archive */
fd = unzOpen(filename);
if(!fd) return (0);
/* Go to first file in archive */
ret = unzGoToFirstFile(fd);
if(ret != UNZ_OK)
{
unzClose(fd);
return (0);
}
ret = unzGetCurrentFileInfo(fd, &info, NULL, 0, NULL, 0, NULL, 0);
if(ret != UNZ_OK)
{
unzClose(fd);
return (0);
}
/* Open the file for reading */
ret = unzOpenCurrentFile(fd);
if(ret != UNZ_OK)
{
unzClose(fd);
return (0);
}
/* Allocate file data buffer */
size = info.uncompressed_size;
sprintf (msg, "Unzipping %d bytes ... Wait", size);
ShowAction (msg);
/* Read (decompress) the file */
ret = unzReadCurrentFile(fd, outbuffer, info.uncompressed_size);
if(ret != info.uncompressed_size)
{
unzCloseCurrentFile(fd);
unzClose(fd);
return (0);
}
/* Close the current file */
ret = unzCloseCurrentFile(fd);
if(ret != UNZ_OK)
{
unzClose(fd);
return (0);
}
/* Close the archive */
ret = unzClose(fd);
if(ret != UNZ_OK)
{
return (0);
}
/* Update file size and return pointer to file data */
return (size);
}

View File

@ -5,11 +5,10 @@
* Only partial support is included, in that only the first file within the archive
* is considered to be a ROM image.
***************************************************************************/
#ifndef _FILEIO_H_
#define _FILEIO_H_
#ifndef _UNZIP_H_
#define _UNZIP_H_
extern int IsZipFile (char *buffer);
int UnZipDVD (unsigned char *outbuffer, u64 discoffset, int length);
int UnZipFAT (unsigned char *outbuffer, char *filename);
int UnZipBuffer (unsigned char *outbuffer, u64 discoffset, char *filename);
#endif

View File

@ -1,14 +0,0 @@
/****************************************************************************
*
* DVD ISO9660/Joliet loading support
*
***************************************************************************/
#ifndef _FILEIO_DVD_H
#define _FILEIO_DVD_H
extern int DVD_UpdateDir(int go_up);
extern int DVD_ParseDirectory();
extern int DVD_LoadFile(unsigned char* buffer);
extern int DVD_Open ();
#endif

View File

@ -1,21 +0,0 @@
/****************************************************************************
*
* FAT loading support
*
***************************************************************************/
#ifndef _FILEIO_FAT_H
#define _FILEIO_FAT_H
#define TYPE_RECENT 0
#define TYPE_SD 1
#ifdef HW_RVL
#define TYPE_USB 2
#endif
extern int FAT_UpdateDir(int go_up);
extern int FAT_ParseDirectory(void);
extern int FAT_LoadFile(unsigned char* buffer);
extern int FAT_Open (int device);
#endif

View File

@ -1,8 +1,26 @@
/***************************************************************************
* SDCARD/MEMCARD File support
/*
* filemem.c
*
* FAT and Memory Card SRAM/Savestate files managment
*
* code by Softdev (2006), Eke-Eke (2007,2008)
*
* 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 of the License, 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 "shared.h"
#include "font.h"
#include "saveicon.h"
@ -11,7 +29,6 @@
#include "dvd.h"
#endif
#include <fat.h>
#include <sys/dir.h>
/* Support for MemCards */

View File

@ -1,11 +1,27 @@
/**
* Nintendo GameCube ARAM Wrapper for libOGC aram.c
/****************************************************************************
* gcaram.c
*
* This is an often overlooked area of ~16Mb extra RAM
* It's use in Genesis Plus is to shadow the ROM.
* Actually, only SSF2TNC needs shadowing, but it's always
* Good to know :)
*/
* ARAM wrapper for libogc
*
* code by Softdev (2006)
*
* 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 of the License, 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 "shared.h"
#define ARAMSTART 0x8000

View File

@ -1,11 +1,25 @@
/**
* Nintendo GameCube ARAM Wrapper for libOGC aram.c
/****************************************************************************
* gcaram.c
*
* This is an often overlooked area of ~16Mb extra RAM
* It's use in Genesis Plus is to shadow the ROM.
* Actually, only SSF2TNC needs shadowing, but it's always
* Good to know :)
*/
* ARAM wrapper for libogc
*
* code by Softdev (2006)
*
* 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 of the License, 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
*
***************************************************************************/
#ifndef _ARAM_H
#define _ARAM_H

View File

@ -1,35 +0,0 @@
/****************************************************************************
* ROM Selection Interface
*
***************************************************************************/
#ifndef _FILESEL_H
#define _FILESEL_H
#define MAXJOLIET 256
#define MAXFILES 1000
#define PAGESIZE 12
typedef struct
{
u64 offset;
unsigned int length;
char flags;
char filename[MAXJOLIET];
u16 filename_offset;
}FILEENTRIES;
FILEENTRIES filelist[MAXFILES];
/* Global Variables */
extern int maxfiles;
extern int offset;
extern int selection;
extern int old_selection;
extern int old_offset;
extern int useFAT;
extern int haveDVDdir;
extern int haveFATdir;
extern int FileSelector();
#endif

View File

@ -1,9 +1,27 @@
/*****************************************************************************
* IPL FONT Engine
* font.c
*
* Based on Qoob MP3 Player Font
* Added IPL font extraction
*****************************************************************************/
* IPL FONT Engine, based on Qoob MP3 Player Font
*
* code by Softdev (2006), Eke-Eke(2007-2008)
*
*
* 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 of the License, 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 "shared.h"
#include "gpback.h"

View File

@ -1,9 +1,27 @@
/*****************************************************************************
* IPL FONT Engine
* font.c
*
* Based on Qoob MP3 Player Font
* Added IPL font extraction
*****************************************************************************/
* IPL FONT Engine, based on Qoob MP3 Player Font
*
* code by Softdev (2006), Eke-Eke(2007-2008)
*
*
* 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 of the License, 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
*
********************************************************************************/
#ifndef _FONT_H
#define _FONT_H

View File

@ -1,7 +1,9 @@
/****************************************************************************
* Genesis Plus 1.2a
* ggentry.c
*
* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 Charles Mac Donald
* Genesis Plus GX Game Genie
*
* code by Softdev (2006), Eke-Eke (2007,2008)
*
* 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
@ -17,7 +19,6 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* Nintendo Gamecube Game Genie Entry
***************************************************************************/
#include "shared.h"

View File

@ -1,7 +1,9 @@
/****************************************************************************
* Genesis Plus 1.2a
* legal.c
*
* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 Charles Mac Donald
* generic legal informations screen
*
* code by Softdev (2006), Eke-Eke (2007,2008)
*
* 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
@ -16,8 +18,10 @@
* 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 "shared.h"
#include "font.h"
#include "dkpro.h"

View File

@ -1,7 +1,9 @@
/****************************************************************************
* Genesis Plus 1.2a
* menu.c
*
* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 Charles Mac Donald
* Genesis Plus GX menu
*
* code by Softdev (March 2006), Eke-Eke (2007,2008)
*
* 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
@ -17,15 +19,13 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* Nintendo Gamecube Menus
* Please put any user menus here! - softdev March 12 2006
***************************************************************************/
#include "shared.h"
#include "dvd.h"
#include "font.h"
#include "fileio_dvd.h"
#include "fileio_fat.h"
#include "file_dvd.h"
#include "file_fat.h"
#ifdef HW_RVL
#include <wiiuse/wpad.h>
@ -896,10 +896,9 @@ static u8 dvd_on = 0;
int loadmenu ()
{
int prevmenu = menu;
int ret;
int ret,count,size;
int quit = 0;
#ifdef HW_RVL
int count = 4 + dvd_on;
char item[5][25] = {
{"Load Recent"},
{"Load from SD"},
@ -908,7 +907,6 @@ int loadmenu ()
{"Stop DVD Motor"}
};
#else
int count = 3 + dvd_on;
char item[4][25] = {
{"Load Recent"},
{"Load from SD"},
@ -921,6 +919,11 @@ int loadmenu ()
while (quit == 0)
{
#ifdef HW_RVL
count = 4 + dvd_on;
#else
count = 3 + dvd_on;
#endif
strcpy (menutitle, "Press B to return");
ret = domenu (&item[0], count, 0);
switch (ret)
@ -937,9 +940,14 @@ int loadmenu ()
case 2:
#endif
load_menu = menu;
if (DVD_Open())
size = DVD_Open(cart_rom);
if (size)
{
dvd_on = 1;
genromsize = size;
memfile_autosave();
reloadrom();
memfile_autoload();
return 1;
}
break;
@ -952,18 +960,21 @@ int loadmenu ()
#endif
dvd_motor_off();
dvd_on = 0;
#ifdef HW_RVL
count = 4 + dvd_on;
#else
count = 3 + dvd_on;
#endif
menu = load_menu;
break;
/*** Load from FAT device ***/
default:
load_menu = menu;
if (FAT_Open(ret)) return 1;
size = FAT_Open(ret,cart_rom);
if (size)
{
genromsize = size;
memfile_autosave();
reloadrom();
memfile_autoload();
return 1;
}
break;
}

View File

@ -1,37 +0,0 @@
/*
* history.h
* genplusgx-mdisibio
*
* Created by Martin Disibio on 6/17/08.
*
*/
#ifndef _HISTORY_H
#define _HISTORY_H
#include "types.h"
#include "filesel.h"
#define NUM_HISTORY_ENTRIES (10)
/****************************************************************************
* ROM Play History
*
****************************************************************************/
typedef struct
{
char filepath[MAXJOLIET];
char filename[MAXJOLIET];
} t_history_entry;
typedef struct
{
t_history_entry entries[NUM_HISTORY_ENTRIES];
} t_history;
extern t_history history;
extern void history_add_file(char *filepath, char *filename);
extern void history_load();
extern void set_history_defaults();
#endif

View File

@ -0,0 +1,20 @@
Copyright (C) 2004 - 2008
Michael Wiedenbauer (shagkur)
Dave Murphy (WinterMute)
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any
damages arising from the use of this software.
Permission is granted to anyone to use this software for any
purpose, including commercial applications, and to alter it and
redistribute it freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you
must not claim that you wrote the original software. If you use
this software in a product, an acknowledgment in the product
documentation would be appreciated but is not required.
2. Altered source versions must be plainly marked as such, and
must not be misrepresented as being the original software.
3. This notice may not be removed or altered from any source
distribution.

View File

@ -1,7 +1,9 @@
/****************************************************************************
* Genesis Plus 1.2a
* ngc.c
*
* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 Charles Mac Donald
* Genesis Plus GX main
*
* code by Softdev (2006), Eke-Eke (2007,2008)
*
* 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
@ -16,7 +18,9 @@
* 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 "shared.h"
#include "gcaram.h"
#include "font.h"

View File

@ -1,8 +1,9 @@
/******************************************************************************
/****************************************************************************
* ogc_video.c
*
* Genesis Plus - Sega Megadrive / Genesis Emulator
* Genesis Plus GX audio support
*
* NGC/Wii Audio support
* code by Softdev (2006), Eke-Eke (2007,2008)
*
* 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
@ -17,10 +18,10 @@
* 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 "shared.h"
#include "ogc_input.h"
/* global datas */
unsigned char soundbuffer[16][3840] ATTRIBUTE_ALIGN(32);

View File

@ -1,8 +1,9 @@
/******************************************************************************
/****************************************************************************
* ogc_video.c
*
* SMS Plus - Sega Master System / GameGear Emulator
* Genesis Plus GX audio support
*
* NGC/Wii Audio support
* code by Softdev (2006), Eke-Eke (2007,2008)
*
* 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
@ -17,7 +18,9 @@
* 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
*
***************************************************************************/
#ifndef _GC_AUDIO_H_
#define _GC_AUDIO_H_

View File

@ -1,8 +1,9 @@
/******************************************************************************
/****************************************************************************
* ogc_input.c
*
* SMS Plus GX - Sega Master System / GameGear Emulator
* Genesis Plus GX input support
*
* SMS Plus - Sega Master System / GameGear Emulator
* code by Eke-Eke (2008)
*
* 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
@ -17,6 +18,7 @@
* 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 "shared.h"

View File

@ -1,8 +1,9 @@
/******************************************************************************
/****************************************************************************
* ogc_input.c
*
* SMS Plus - Sega Master System / GameGear Emulator
* Genesis Plus GX input support
*
* NGC/Wii Controller support
* code by Eke-Eke (2008)
*
* 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
@ -17,7 +18,10 @@
* 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
*
***************************************************************************/
#ifndef _GC_INPUT_H_
#define _GC_INPUT_H_

View File

@ -1,8 +1,9 @@
/******************************************************************************
/****************************************************************************
* ogc_video.c
*
* Genesis Plus - Sega Megadrive / Genesis Emulator
* Genesis Plus GX video support
*
* NGC/Wii Video support
* code by Softdev (2006), Eke-Eke (2007,2008)
*
* 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
@ -17,8 +18,10 @@
* 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 "shared.h"
#include "font.h"
#include "gcaram.h"

View File

@ -1,8 +1,9 @@
/******************************************************************************
/****************************************************************************
* ogc_video.c
*
* SMS Plus - Sega Master System / GameGear Emulator
* Genesis Plus GX video support
*
* NGC/Wii Video support
* code by Softdev (2006), Eke-Eke (2007,2008)
*
* 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
@ -17,7 +18,9 @@
* 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
*
***************************************************************************/
#ifndef _GC_VIDEO_H_
#define _GC_VIDEO_H_

View File

@ -16,12 +16,11 @@
#include "ogc_audio.h"
#include "ogc_video.h"
#include "config.h"
#include "history.h"
#define DEFAULT_PATH "/genplus"
#define update_input() ogc_input__update()
#define DEFAULT_PATH "/genplus"
/* globals */
extern u32 diff_usec(long long start,long long end);
extern long long gettime();
@ -35,9 +34,6 @@ extern void MainMenu();
extern void set_region();
extern int ManageSRAM(u8 direction, u8 device);
extern int ManageState(u8 direction, u8 device);
extern int OpenDVD();
extern int OpenFAT(char *name);
extern int OpenHistory();
extern void memfile_autosave();
extern void memfile_autoload();

View File

@ -370,7 +370,8 @@ static const UINT8 lfo_ams_depth_shift[4] = {8, 3, 1, 0};
samples (32*432=13824; 32 because we store only a quarter of whole
waveform in the table below)
*/
static const UINT8 lfo_pm_output[7*8][8]={ /* 7 bits meaningful (of F-NUMBER), 8 LFO output levels per one depth (out of 32), 8 LFO depths */
static const UINT8 lfo_pm_output[7*8][8]={
/* 7 bits meaningful (of F-NUMBER), 8 LFO output levels per one depth (out of 32), 8 LFO depths */
/* FNUM BIT 4: 000 0001xxxx */
/* DEPTH 0 */ {0, 0, 0, 0, 0, 0, 0, 0},
/* DEPTH 1 */ {0, 0, 0, 0, 0, 0, 0, 0},
@ -518,7 +519,7 @@ typedef struct
UINT8 ams; /* channel AMS */
UINT32 fc; /* fnum,blk:adjusted to sample rate */
UINT8 kcode; /* key code: */
UINT8 kcode; /* key code */
UINT32 block_fnum; /* current blk/fnum value for this slot (can be different betweeen slots of one channel in 3slot mode) */
} FM_CH;
@ -544,7 +545,6 @@ typedef struct
} FM_ST;
/***********************************************************/
/* OPN unit */
/***********************************************************/

File diff suppressed because it is too large Load Diff

View File

@ -1,274 +0,0 @@
/* unzip.h -- IO for uncompress .zip files using zlib
Version 0.15 beta, Mar 19th, 1998,
Copyright (C) 1998 Gilles Vollant
This unzip package allow extract file from .ZIP file, compatible with PKZip 2.04g
WinZip, InfoZip tools and compatible.
Encryption and multi volume ZipFile (span) are not supported.
Old compressions used by old PKZip 1.x are not supported
THIS IS AN ALPHA VERSION. AT THIS STAGE OF DEVELOPPEMENT, SOMES API OR STRUCTURE
CAN CHANGE IN FUTURE VERSION !!
I WAIT FEEDBACK at mail info@winimage.com
Visit also http://www.winimage.com/zLibDll/unzip.htm for evolution
Condition of use and distribution are the same than zlib :
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
*/
/* for more info about .ZIP format, see
ftp://ftp.cdrom.com/pub/infozip/doc/appnote-970311-iz.zip
PkWare has also a specification at :
ftp://ftp.pkware.com/probdesc.zip */
#ifndef _unz_H
#define _unz_H
#ifdef __cplusplus
extern "C" {
#endif
#ifndef _ZLIB_H
#include "zlib.h"
#endif
#if defined(STRICTUNZIP) || defined(STRICTZIPUNZIP)
/* like the STRICT of WIN32, we define a pointer that cannot be converted
from (void*) without cast */
typedef struct TagunzFile__ { int unused; } unzFile__;
typedef unzFile__ *unzFile;
#else
typedef voidp unzFile;
#endif
#define UNZ_OK (0)
#define UNZ_END_OF_LIST_OF_FILE (-100)
#define UNZ_ERRNO (Z_ERRNO)
#define UNZ_EOF (0)
#define UNZ_PARAMERROR (-102)
#define UNZ_BADZIPFILE (-103)
#define UNZ_INTERNALERROR (-104)
#define UNZ_CRCERROR (-105)
/* tm_unz contain date/time info */
typedef struct tm_unz_s
{
uInt tm_sec; /* seconds after the minute - [0,59] */
uInt tm_min; /* minutes after the hour - [0,59] */
uInt tm_hour; /* hours since midnight - [0,23] */
uInt tm_mday; /* day of the month - [1,31] */
uInt tm_mon; /* months since January - [0,11] */
uInt tm_year; /* years - [1980..2044] */
} tm_unz;
/* unz_global_info structure contain global data about the ZIPfile
These data comes from the end of central dir */
typedef struct unz_global_info_s
{
uLong number_entry; /* total number of entries in
the central dir on this disk */
uLong size_comment; /* size of the global comment of the zipfile */
} unz_global_info;
/* unz_file_info contain information about a file in the zipfile */
typedef struct unz_file_info_s
{
uLong version; /* version made by 2 bytes */
uLong version_needed; /* version needed to extract 2 bytes */
uLong flag; /* general purpose bit flag 2 bytes */
uLong compression_method; /* compression method 2 bytes */
uLong dosDate; /* last mod file date in Dos fmt 4 bytes */
uLong crc; /* crc-32 4 bytes */
uLong compressed_size; /* compressed size 4 bytes */
uLong uncompressed_size; /* uncompressed size 4 bytes */
uLong size_filename; /* filename length 2 bytes */
uLong size_file_extra; /* extra field length 2 bytes */
uLong size_file_comment; /* file comment length 2 bytes */
uLong disk_num_start; /* disk number start 2 bytes */
uLong internal_fa; /* internal file attributes 2 bytes */
uLong external_fa; /* external file attributes 4 bytes */
tm_unz tmu_date;
} unz_file_info;
extern int ZEXPORT unzStringFileNameCompare OF ((const char* fileName1,
const char* fileName2,
int iCaseSensitivity));
/*
Compare two filename (fileName1,fileName2).
If iCaseSenisivity = 1, comparision is case sensitivity (like strcmp)
If iCaseSenisivity = 2, comparision is not case sensitivity (like strcmpi
or strcasecmp)
If iCaseSenisivity = 0, case sensitivity is defaut of your operating system
(like 1 on Unix, 2 on Windows)
*/
extern unzFile ZEXPORT unzOpen OF((const char *path));
/*
Open a Zip file. path contain the full pathname (by example,
on a Windows NT computer "c:\\zlib\\zlib111.zip" or on an Unix computer
"zlib/zlib111.zip".
If the zipfile cannot be opened (file don't exist or in not valid), the
return value is NULL.
Else, the return value is a unzFile Handle, usable with other function
of this unzip package.
*/
extern int ZEXPORT unzClose OF((unzFile file));
/*
Close a ZipFile opened with unzipOpen.
If there is files inside the .Zip opened with unzOpenCurrentFile (see later),
these files MUST be closed with unzipCloseCurrentFile before call unzipClose.
return UNZ_OK if there is no problem. */
extern int ZEXPORT unzGetGlobalInfo OF((unzFile file,
unz_global_info *pglobal_info));
/*
Write info about the ZipFile in the *pglobal_info structure.
No preparation of the structure is needed
return UNZ_OK if there is no problem. */
extern int ZEXPORT unzGetGlobalComment OF((unzFile file,
char *szComment,
uLong uSizeBuf));
/*
Get the global comment string of the ZipFile, in the szComment buffer.
uSizeBuf is the size of the szComment buffer.
return the number of byte copied or an error code <0
*/
/***************************************************************************/
/* Unzip package allow you browse the directory of the zipfile */
extern int ZEXPORT unzGoToFirstFile OF((unzFile file));
/*
Set the current file of the zipfile to the first file.
return UNZ_OK if there is no problem
*/
extern int ZEXPORT unzGoToNextFile OF((unzFile file));
/*
Set the current file of the zipfile to the next file.
return UNZ_OK if there is no problem
return UNZ_END_OF_LIST_OF_FILE if the actual file was the latest.
*/
extern int ZEXPORT unzLocateFile OF((unzFile file,
const char *szFileName,
int iCaseSensitivity));
/*
Try locate the file szFileName in the zipfile.
For the iCaseSensitivity signification, see unzStringFileNameCompare
return value :
UNZ_OK if the file is found. It becomes the current file.
UNZ_END_OF_LIST_OF_FILE if the file is not found
*/
extern int ZEXPORT unzGetCurrentFileInfo OF((unzFile file,
unz_file_info *pfile_info,
char *szFileName,
uLong fileNameBufferSize,
void *extraField,
uLong extraFieldBufferSize,
char *szComment,
uLong commentBufferSize));
/*
Get Info about the current file
if pfile_info!=NULL, the *pfile_info structure will contain somes info about
the current file
if szFileName!=NULL, the filemane string will be copied in szFileName
(fileNameBufferSize is the size of the buffer)
if extraField!=NULL, the extra field information will be copied in extraField
(extraFieldBufferSize is the size of the buffer).
This is the Central-header version of the extra field
if szComment!=NULL, the comment string of the file will be copied in szComment
(commentBufferSize is the size of the buffer)
*/
/***************************************************************************/
/* for reading the content of the current zipfile, you can open it, read data
from it, and close it (you can close it before reading all the file)
*/
extern int ZEXPORT unzOpenCurrentFile OF((unzFile file));
/*
Open for reading data the current file in the zipfile.
If there is no error, the return value is UNZ_OK.
*/
extern int ZEXPORT unzCloseCurrentFile OF((unzFile file));
/*
Close the file in zip opened with unzOpenCurrentFile
Return UNZ_CRCERROR if all the file was read but the CRC is not good
*/
extern int ZEXPORT unzReadCurrentFile OF((unzFile file,
voidp buf,
unsigned len));
/*
Read bytes from the current file (opened by unzOpenCurrentFile)
buf contain buffer where data must be copied
len the size of buf.
return the number of byte copied if somes bytes are copied
return 0 if the end of file was reached
return <0 with error code if there is an error
(UNZ_ERRNO for IO error, or zLib error for uncompress error)
*/
extern z_off_t ZEXPORT unztell OF((unzFile file));
/*
Give the current position in uncompressed data
*/
extern int ZEXPORT unzeof OF((unzFile file));
/*
return 1 if the end of file was reached, 0 elsewhere
*/
extern int ZEXPORT unzGetLocalExtrafield OF((unzFile file,
voidp buf,
unsigned len));
/*
Read extra field from the current file (opened by unzOpenCurrentFile)
This is the local-header version of the extra field (sometimes, there is
more info in the local-header version than in the central-header)
if buf==NULL, it return the size of the local extra field
if buf!=NULL, len is the size of the buffer, the extra header is copied in
buf.
the return value is the number of bytes copied in buf, or (if <0)
the error code
*/
#ifdef __cplusplus
}
#endif
#endif /* _unz_H */