[GCW0] added GCW Zero port (made by Shin-NiL & David Knight)

This commit is contained in:
EkeEke 2015-04-26 22:10:42 +02:00
parent d57d03e222
commit 8910b0c955
30 changed files with 5812 additions and 0 deletions

181
gcw0/Makefile Normal file
View File

@ -0,0 +1,181 @@
# Makefile for genplus SDL GCW0
#
# (c) 1999, 2000, 2001, 2002, 2003 Charles MacDonald
# modified by Eke-Eke <eke_eke31@yahoo.fr>
#
# Defines :
# -DLSB_FIRST : for little endian systems.
# -DLOGERROR : enable message logging
# -DLOGVDP : enable VDP debug messages
# -DLOGSOUND : enable AUDIO debug messages
# -DLOG_SCD : enable SCD debug messages
# -DLOG_CDD : enable CDD debug messages
# -DLOG_CDC : enable CDC debug messages
# -DLOG_PCM : enable PCM debug messages
# -DLOGSOUND : enable AUDIO debug messages
# -D8BPP_RENDERING - configure for 8-bit pixels (RGB332)
# -D15BPP_RENDERING - configure for 15-bit pixels (RGB555)
# -D16BPP_RENDERING - configure for 16-bit pixels (RGB565)
# -D32BPP_RENDERING - configure for 32-bit pixels (RGB888)
NAME = gen_gcw0
SDL-CONFIG = /opt/gcw0-toolchain/usr/mipsel-gcw0-linux-uclibc/sysroot/usr/bin/sdl-config
CC = /opt/gcw0-toolchain/usr/bin/mipsel-gcw0-linux-uclibc-gcc
#CFLAGS = `$(SDL-CONFIG) --cflags` -03 -fomit-frame-pointer -Wall -ansi -std=c99
#CFLAGS = `sdl-config --cflags` -O6 -fomit-frame-pointer -Wall -Wno-strict-aliasing -ansi -std=c99
CFLAGS = `$(SDL-CONFIG) --cflags` -O3 -fomit-frame-pointer -Wall -ansi -std=c99 -march=mips32 -mtune=mips32r2 -mhard-float
#-fomit-frame-pointer
#LDFLAGS = -g
DEFINES = -DLSB_FIRST -DUSE_16BPP_RENDERING -DUSE_LIBVORBIS -DGCWZERO -DALIGN_LONG -DALT_RENDERER
SRCDIR = ../core
INCLUDES = -I$(SRCDIR) -I$(SRCDIR)/z80 -I$(SRCDIR)/m68k \
-I$(SRCDIR)/sound -I$(SRCDIR)/input_hw -I$(SRCDIR)/cart_hw -I$(SRCDIR)/cart_hw/svp \
-I$(SRCDIR)/cd_hw -I$(SRCDIR)/ntsc \
-I$(SRCDIR)/../gcw0 \
-I/opt/gcw0-toolchain/usr/mipsel-gcw0-linux-uclibc/sysroot/usr/include/
# -I$(SRCDIR)/tremor
LIBS = `$(SDL-CONFIG) --libs --libs` -lz -lm -lSDL_ttf -lSDL_image \
-L/opt/gcw0-toolchain/usr/mipsel-gcw0-linux-uclibc/sysroot/usr/lib -lvorbisfile
OBJDIR = ./build_gcw0
OBJECTS = $(OBJDIR)/z80.o
OBJECTS += $(OBJDIR)/m68kcpu.o \
$(OBJDIR)/s68kcpu.o
OBJECTS += $(OBJDIR)/genesis.o \
$(OBJDIR)/vdp_ctrl.o \
$(OBJDIR)/vdp_render.o \
$(OBJDIR)/system.o \
$(OBJDIR)/io_ctrl.o \
$(OBJDIR)/mem68k.o \
$(OBJDIR)/memz80.o \
$(OBJDIR)/membnk.o \
$(OBJDIR)/state.o \
$(OBJDIR)/loadrom.o
OBJECTS += $(OBJDIR)/input.o \
$(OBJDIR)/gamepad.o \
$(OBJDIR)/lightgun.o \
$(OBJDIR)/mouse.o \
$(OBJDIR)/activator.o \
$(OBJDIR)/xe_1ap.o \
$(OBJDIR)/teamplayer.o \
$(OBJDIR)/paddle.o \
$(OBJDIR)/sportspad.o \
$(OBJDIR)/terebi_oekaki.o \
$(OBJDIR)/graphic_board.o
OBJECTS += $(OBJDIR)/sound.o \
$(OBJDIR)/sn76489.o \
$(OBJDIR)/ym2413.o \
$(OBJDIR)/ym2612.o
OBJECTS += $(OBJDIR)/blip_buf.o
OBJECTS += $(OBJDIR)/eq.o
OBJECTS += $(OBJDIR)/sram.o \
$(OBJDIR)/svp.o \
$(OBJDIR)/ssp16.o \
$(OBJDIR)/ggenie.o \
$(OBJDIR)/areplay.o \
$(OBJDIR)/eeprom_93c.o \
$(OBJDIR)/eeprom_i2c.o \
$(OBJDIR)/eeprom_spi.o \
$(OBJDIR)/md_cart.o \
$(OBJDIR)/sms_cart.o
OBJECTS += $(OBJDIR)/scd.o \
$(OBJDIR)/cdd.o \
$(OBJDIR)/cdc.o \
$(OBJDIR)/gfx.o \
$(OBJDIR)/pcm.o \
$(OBJDIR)/cd_cart.o
OBJECTS += $(OBJDIR)/sms_ntsc.o \
$(OBJDIR)/md_ntsc.o
OBJECTS += $(OBJDIR)/main.o \
$(OBJDIR)/config.o \
$(OBJDIR)/error.o \
$(OBJDIR)/unzip.o \
$(OBJDIR)/fileio.o \
$(OBJDIR)/utils.o #\
# $(OBJDIR)/menu.o
#OBJECTS += $(OBJDIR)/block.o \
# $(OBJDIR)/codebook.o \
# $(OBJDIR)/floor0.o \
# $(OBJDIR)/floor1.o \
# $(OBJDIR)/framing.o \
# $(OBJDIR)/info.o \
# $(OBJDIR)/mapping0.o \
# $(OBJDIR)/mdct.o \
# $(OBJDIR)/registry.o \
# $(OBJDIR)/res012.o \
# $(OBJDIR)/sharedbook.o \
# $(OBJDIR)/synthesis.o \
# $(OBJDIR)/vorbisfile.o \
# $(OBJDIR)/window.o
## 1st $(OBJDIR)/bitwise.o \
all: $(NAME)
$(NAME): $(OBJDIR) $(OBJECTS)
$(CC) $(LDFLAGS) $(OBJECTS) $(LIBS) -o $@
$(OBJDIR) :
@[ -d $@ ] || mkdir -p $@
$(OBJDIR)/%.o : $(SRCDIR)/%.c $(SRCDIR)/%.h
$(CC) -c $(CFLAGS) $(INCLUDES) $(DEFINES) $< -o $@
$(OBJDIR)/%.o : $(SRCDIR)/sound/%.c $(SRCDIR)/sound/%.h
$(CC) -c $(CFLAGS) $(INCLUDES) $(DEFINES) $< -o $@
$(OBJDIR)/%.o : $(SRCDIR)/input_hw/%.c $(SRCDIR)/input_hw/%.h
$(CC) -c $(CFLAGS) $(INCLUDES) $(DEFINES) $< -o $@
$(OBJDIR)/%.o : $(SRCDIR)/cart_hw/%.c $(SRCDIR)/cart_hw/%.h
$(CC) -c $(CFLAGS) $(INCLUDES) $(DEFINES) $< -o $@
$(OBJDIR)/%.o : $(SRCDIR)/cart_hw/svp/%.c
$(CC) -c $(CFLAGS) $(INCLUDES) $(DEFINES) $< -o $@
$(OBJDIR)/%.o : $(SRCDIR)/cart_hw/svp/%.c $(SRCDIR)/cart_hw/svp/%.h
$(CC) -c $(CFLAGS) $(INCLUDES) $(DEFINES) $< -o $@
$(OBJDIR)/%.o : $(SRCDIR)/cd_hw/%.c $(SRCDIR)/cd_hw/%.h
$(CC) -c $(CFLAGS) $(INCLUDES) $(DEFINES) $< -o $@
$(OBJDIR)/%.o : $(SRCDIR)/z80/%.c $(SRCDIR)/z80/%.h
$(CC) -c $(CFLAGS) $(INCLUDES) $(DEFINES) $< -o $@
$(OBJDIR)/%.o : $(SRCDIR)/m68k/%.c
$(CC) -c $(CFLAGS) $(INCLUDES) $(DEFINES) $< -o $@
$(OBJDIR)/%.o : $(SRCDIR)/ntsc/%.c $(SRCDIR)/ntsc/%.h
$(CC) -c $(CFLAGS) $(INCLUDES) $(DEFINES) $< -o $@
#$(OBJDIR)/%.o : $(SRCDIR)/tremor/%.c $(SRCDIR)/tremor/%.h
# $(CC) -c $(CFLAGS) $(INCLUDES) $(DEFINES) $< -o $@
#$(OBJDIR)/%.o : $(SRCDIR)/tremor/%.c
# $(CC) -c $(CFLAGS) $(INCLUDES) $(DEFINES) $< -o $@
$(OBJDIR)/%.o : $(SRCDIR)/../gcw0/%.c $(SRCDIR)/../gcw0/%.h
$(CC) -c $(CFLAGS) $(INCLUDES) $(DEFINES) $< -o $@
pack :
strip $(NAME)
upx -9 $(NAME)
clean:
rm -f $(OBJECTS) $(NAME)

132
gcw0/config.c Normal file
View File

@ -0,0 +1,132 @@
#include "osd.h"
t_config config;
static int config_load(void)
{
//TODO: extract to function
const char *homedir;
if ((homedir = getenv("HOME")) == NULL) {
homedir = getpwuid(getuid())->pw_dir;
}
/* open configuration file */
char fname[MAXPATHLEN];
sprintf (fname, "%s%s/config.ini", homedir, DEFAULT_PATH);
FILE *fp = fopen(fname, "rb");
if (fp)
{
/* check file size */
fseek(fp, 0, SEEK_END);
if (ftell(fp) != sizeof(config))
{
fclose(fp);
return 0;
}
/* read file */
fseek(fp, 0, SEEK_SET);
fread(&config, sizeof(config), 1, fp);
fclose(fp);
return 1;
}
return 0;
}
void set_config_defaults(void)
{
int i;
/* sound options */
config.psg_preamp = 150;
config.fm_preamp = 100;
config.hq_fm = 1;
config.psgBoostNoise = 1;
config.filter = 1;
config.low_freq = 200;
config.high_freq = 8000;
config.lg = 1.0;
config.mg = 1.0;
config.hg = 1.0;
config.lp_range = 0x9999; /* 0.6 in 16.16 fixed point */
config.dac_bits = 14;
config.ym2413 = 1; /* = AUTO (0 = always OFF, 1 = always ON) */
config.mono = 0;
/* system options */
config.system = 0; /* = AUTO (or SYSTEM_SG, SYSTEM_MARKIII, SYSTEM_SMS, SYSTEM_SMS2, SYSTEM_GG, SYSTEM_MD) */
config.region_detect = 0; /* = AUTO (1 = USA, 2 = EUROPE, 3 = JAPAN/NTSC, 4 = JAPAN/PAL) */
config.vdp_mode = 0; /* = AUTO (1 = NTSC, 2 = PAL) */
config.master_clock = 0; /* = AUTO (1 = NTSC, 2 = PAL) */
config.force_dtack = 0;
config.addr_error = 1;
config.bios = 0;
config.lock_on = 0; /* = OFF (can be TYPE_SK, TYPE_GG & TYPE_AR) */
config.ntsc = 0;
config.lcd = 0; /* 0.8 fixed point */
/* display options */
config.overscan = 0; /* 3 = all borders (0 = no borders , 1 = vertical borders only, 2 = horizontal borders only) */
config.gg_extra = 0; /* 1 = show extended Game Gear screen (256x192) */
config.render = 0; /* 1 = double resolution output (only when interlaced mode 2 is enabled) */
config.gcw0_fullscreen = 1; /* 1 = use IPU scaling */
config.keepaspectratio = 1; /* 1 = aspect ratio correct with black bars, 0 = fullscreen without correct aspect ratio */
config.gg_scanlines = 1; /* 1 = use scanlines on Game Gear */
config.smsmaskleftbar = 1; /* 1 = Mask left bar on SMS (better for horizontal scrolling) */
config.sl_autoresume = 1; /* 1 = Automatically resume when saving and loading snapshots */
config.a_stick = 1; /* 1 = A-Stick on */
config.lightgun_speed = 1; /* 1 = simple speed multiplier for lightgun */
config.gcw0_frameskip = 0; /* 0 = off, 1 = skip alternate frames, 2 = skip 2 in 3 frames, etc. Useful for FMV in MCD. */
/* controllers options */
config.cursor = 0; /* different cursor designs */
input.system[0] = SYSTEM_GAMEPAD;
input.system[1] = SYSTEM_GAMEPAD;
config.gun_cursor[0] = 1;
config.gun_cursor[1] = 1;
config.invert_mouse = 0;
for (i=0; i<MAX_INPUTS; i++)
{
/* autodetected control pad type */
config.input[i].padtype = DEVICE_PAD2B | DEVICE_PAD3B | DEVICE_PAD6B;
}
config.buttons[A] = SDLK_LSHIFT;//x
config.buttons[B] = SDLK_LALT;//b
config.buttons[C] = SDLK_LCTRL;//a
config.buttons[X] = SDLK_TAB;//l
config.buttons[Y] = SDLK_SPACE;//y
config.buttons[Z] = SDLK_BACKSPACE;//r
config.buttons[START] = SDLK_RETURN;//start
config.buttons[MODE] = SDLK_ESCAPE;//select
/* try to restore user config */
int loaded = config_load();
if (!loaded) {
printf("Default Settings restored\n");
}
}
void config_save(void)
{
//TODO: extract to function
const char *homedir;
if ((homedir = getenv("HOME")) == NULL) {
homedir = getpwuid(getuid())->pw_dir;
}
/* open configuration file */
char fname[MAXPATHLEN];
sprintf (fname, "%s%s/config.ini", homedir, DEFAULT_PATH);
//printf(fname);
FILE *fp = fopen(fname, "wb");
if (fp)
{
/* write file */
fwrite(&config, sizeof(config), 1, fp);
fclose(fp);
}
}

78
gcw0/config.h Normal file
View File

@ -0,0 +1,78 @@
#ifndef _CONFIG_H_
#define _CONFIG_H_
#include <pwd.h>
/****************************************************************************
* Config Option
*
****************************************************************************/
enum {A = 0, B, C, X, Y, Z, START, MODE};
typedef struct
{
uint8 padtype;
} t_input_config;
typedef struct
{
uint8 hq_fm;
uint8 filter;
uint8 psgBoostNoise;
uint8 dac_bits;
uint8 ym2413;
int16 psg_preamp;
int16 fm_preamp;
uint32 lp_range;
int16 low_freq;
int16 high_freq;
int16 lg;
int16 mg;
int16 hg;
uint8 mono;
uint8 system;
uint8 region_detect;
uint8 vdp_mode;
uint8 master_clock;
uint8 force_dtack;
uint8 addr_error;
uint8 bios;
uint8 lock_on;
uint8 hot_swap;
uint8 invert_mouse;
uint8 gun_cursor[2];
uint8 overscan;
uint8 gg_extra;
uint8 ntsc;
uint8 lcd;
uint8 render;
t_input_config input[MAX_INPUTS];
uint8 gcw0_fullscreen;
uint8 gcw0_frameskip;
uint8 keepaspectratio;
uint8 gg_scanlines;
uint8 smsmaskleftbar;
uint8 sl_autoresume;
uint8 lightgun_speed;
uint8 a_stick;
uint8 cursor;
SDLKey buttons[8];
//SDLKey button_a;
//SDLKey button_b;
//SDLKey button_c;
//SDLKey button_x;
//SDLKey button_y;
//SDLKey button_z;
//SDLKey button_start;
//SDLKey button_mode;
} t_config;
/* Global variables */
extern t_config config;
extern void config_save(void);
extern void set_config_defaults(void);
#endif /* _CONFIG_H_ */

35
gcw0/error.c Normal file
View File

@ -0,0 +1,35 @@
/*
error.c --
Error logging
*/
#include "osd.h"
static FILE *error_log;
void error_init(void)
{
#ifdef LOGERROR
error_log = fopen("error.log","w");
#endif
}
void error_shutdown(void)
{
#ifdef LOGERROR
if(error_log) fclose(error_log);
#endif
}
void error(char *format, ...)
{
#ifdef LOGERROR
if (log_error)
{
va_list ap;
va_start(ap, format);
if(error_log) vfprintf(error_log, format, ap);
va_end(ap);
}
#endif
}

10
gcw0/error.h Normal file
View File

@ -0,0 +1,10 @@
#ifndef _ERROR_H_
#define _ERROR_H_
/* Function prototypes */
void error_init(void);
void error_shutdown(void);
void error(char *format, ...);
#endif /* _ERROR_H_ */

158
gcw0/fileio.c Normal file
View File

@ -0,0 +1,158 @@
/*
* fileio.c
*
* Load a normal file, or ZIP/GZ archive into ROM buffer.
* Returns loaded ROM size (zero if an error occured)
*
*
* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 Charles Mac Donald
* modified by Eke-Eke (Genesis Plus GX)
*
* Redistribution and use of this code or any derivative works are permitted
* provided that the following conditions are met:
*
* - Redistributions may not be sold, nor may they be used in a commercial
* product or activity.
*
* - Redistributions that are modified from the original source must include the
* complete source code, including the source code for all components used by a
* binary built from the modified sources. However, as a special exception, the
* source code distributed need not include anything that is normally distributed
* (in either source or binary form) with the major components (compiler, kernel,
* and so on) of the operating system on which the executable runs, unless that
* component itself accompanies the executable.
*
* - Redistributions must reproduce the above copyright notice, this list of
* conditions and the following disclaimer in the documentation and/or other
* materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
****************************************************************************************/
#include "shared.h"
#include <zlib.h>
static int check_zip(char *filename);
int load_archive(char *filename, unsigned char *buffer, int maxsize, char *extension)
{
int size = 0;
if(check_zip(filename))
{
unz_file_info info;
int ret = 0;
char fname[256];
/* Attempt to open the archive */
unzFile *fd = unzOpen(filename);
if (!fd) return 0;
/* Go to first file in archive */
ret = unzGoToFirstFile(fd);
if(ret != UNZ_OK)
{
unzClose(fd);
return 0;
}
/* Get file informations and update filename */
ret = unzGetCurrentFileInfo(fd, &info, fname, 256, NULL, 0, NULL, 0);
if(ret != UNZ_OK)
{
unzClose(fd);
return 0;
}
/* Compressed filename extension */
if (extension)
{
strncpy(extension, &fname[strlen(fname) - 3], 3);
extension[3] = 0;
}
/* Open the file for reading */
ret = unzOpenCurrentFile(fd);
if(ret != UNZ_OK)
{
unzClose(fd);
return 0;
}
/* Retrieve uncompressed file size */
size = info.uncompressed_size;
if(size > maxsize)
{
size = maxsize;
}
/* Read (decompress) the file */
ret = unzReadCurrentFile(fd, buffer, size);
if(ret != 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;
}
else
{
/* Open file */
gzFile *gd = gzopen(filename, "rb");
if (!gd) return 0;
/* Read file data */
size = gzread(gd, buffer, maxsize);
/* filename extension */
if (extension)
{
strncpy(extension, &filename[strlen(filename) - 3], 3);
extension[3] = 0;
}
/* Close file */
gzclose(gd);
}
/* Return loaded ROM size */
return size;
}
/*
Verifies if a file is a ZIP archive or not.
Returns: 1= ZIP archive, 0= not a ZIP archive
*/
static int check_zip(char *filename)
{
uint8 buf[2];
FILE *fd = fopen(filename, "rb");
if(!fd) return (0);
fread(buf, 2, 1, fd);
fclose(fd);
if(memcmp(buf, "PK", 2) == 0) return (1);
return (0);
}

48
gcw0/fileio.h Normal file
View File

@ -0,0 +1,48 @@
/*
* fileio.c
*
* Load a normal file, or ZIP/GZ archive.
* Returns loaded ROM size (zero if an error occured)
*
* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 Charles Mac Donald
* modified by Eke-Eke (Genesis Plus GX)
*
* Redistribution and use of this code or any derivative works are permitted
* provided that the following conditions are met:
*
* - Redistributions may not be sold, nor may they be used in a commercial
* product or activity.
*
* - Redistributions that are modified from the original source must include the
* complete source code, including the source code for all components used by a
* binary built from the modified sources. However, as a special exception, the
* source code distributed need not include anything that is normally distributed
* (in either source or binary form) with the major components (compiler, kernel,
* and so on) of the operating system on which the executable runs, unless that
* component itself accompanies the executable.
*
* - Redistributions must reproduce the above copyright notice, this list of
* conditions and the following disclaimer in the documentation and/or other
* materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
****************************************************************************************/
#ifndef _FILEIO_H_
#define _FILEIO_H_
/* Function prototypes */
extern int load_archive(char *filename, unsigned char *buffer, int maxsize, char *extension);
#endif /* _FILEIO_H_ */

2585
gcw0/main.c Normal file

File diff suppressed because it is too large Load Diff

11
gcw0/main.h Normal file
View File

@ -0,0 +1,11 @@
#ifndef _MAIN_H_
#define _MAIN_H_
#define MAX_INPUTS 8
extern int debug_on;
extern int log_error;
extern int sdl_input_update(void);
#endif /* _MAIN_H_ */

Binary file not shown.

After

Width:  |  Height:  |  Size: 206 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 158 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 171 B

BIN
gcw0/opk-data/GG.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

621
gcw0/opk-data/LICENSE.txt Normal file
View File

@ -0,0 +1,621 @@
Unless otherwise explicitly stated, all code in Genesis Plus GX is released
under the following license:
Copyright (c) 1998-2003 Charles MacDonald
Some portions copyright Nicola Salmoria and the MAME team
All rights reserved.
Copyright (c) 2007-2015 Eke-Eke
All rights reserved.
Redistribution and use of this code or any derivative works are permitted
provided that the following conditions are met:
* Redistributions may not be sold, nor may they be used in a commercial
product or activity.
* Redistributions that are modified from the original source must include the
complete source code, including the source code for all components used by a
binary built from the modified sources. However, as a special exception, the
source code distributed need not include anything that is normally distributed
(in either source or binary form) with the major components (compiler, kernel,
and so on) of the operating system on which the executable runs, unless that
component itself accompanies the executable.
* Redistributions must reproduce the above copyright notice, this list of
conditions and the following disclaimer in the documentation and/or other
materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
----------------------------------------------------------------------------------------
TREMOR library is distributed under the following license:
Copyright (c) 2002, Xiph.org Foundation
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
- Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
- Neither the name of the Xiph.org Foundation nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION
OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
----------------------------------------------------------------------------------------
NTSC Filter and Blip Buffer libraries are distributed under the
terms of the GNU Lesser General Public License (LGPL)
GNU LESSER GENERAL PUBLIC LICENSE
Version 2.1, February 1999
Copyright (C) 1991, 1999 Free Software Foundation, Inc.
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
[This is the first released version of the Lesser GPL. It also counts
as the successor of the GNU Library Public License, version 2, hence
the version number 2.1.]
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
Licenses are intended to guarantee your freedom to share and change
free software--to make sure the software is free for all its users.
This license, the Lesser General Public License, applies to some
specially designated software packages--typically libraries--of the
Free Software Foundation and other authors who decide to use it. You
can use it too, but we suggest you first think carefully about whether
this license or the ordinary General Public License is the better
strategy to use in any particular case, based on the explanations below.
When we speak of free software, we are referring to freedom of use,
not price. Our General Public Licenses are designed to make sure that
you have the freedom to distribute copies of free software (and charge
for this service if you wish); that you receive source code or can get
it if you want it; that you can change the software and use pieces of
it in new free programs; and that you are informed that you can do
these things.
To protect your rights, we need to make restrictions that forbid
distributors to deny you these rights or to ask you to surrender these
rights. These restrictions translate to certain responsibilities for
you if you distribute copies of the library or if you modify it.
For example, if you distribute copies of the library, whether gratis
or for a fee, you must give the recipients all the rights that we gave
you. You must make sure that they, too, receive or can get the source
code. If you link other code with the library, you must provide
complete object files to the recipients, so that they can relink them
with the library after making changes to the library and recompiling
it. And you must show them these terms so they know their rights.
We protect your rights with a two-step method: (1) we copyright the
library, and (2) we offer you this license, which gives you legal
permission to copy, distribute and/or modify the library.
To protect each distributor, we want to make it very clear that
there is no warranty for the free library. Also, if the library is
modified by someone else and passed on, the recipients should know
that what they have is not the original version, so that the original
author's reputation will not be affected by problems that might be
introduced by others.
Finally, software patents pose a constant threat to the existence of
any free program. We wish to make sure that a company cannot
effectively restrict the users of a free program by obtaining a
restrictive license from a patent holder. Therefore, we insist that
any patent license obtained for a version of the library must be
consistent with the full freedom of use specified in this license.
Most GNU software, including some libraries, is covered by the
ordinary GNU General Public License. This license, the GNU Lesser
General Public License, applies to certain designated libraries, and
is quite different from the ordinary General Public License. We use
this license for certain libraries in order to permit linking those
libraries into non-free programs.
When a program is linked with a library, whether statically or using
a shared library, the combination of the two is legally speaking a
combined work, a derivative of the original library. The ordinary
General Public License therefore permits such linking only if the
entire combination fits its criteria of freedom. The Lesser General
Public License permits more lax criteria for linking other code with
the library.
We call this license the "Lesser" General Public License because it
does Less to protect the user's freedom than the ordinary General
Public License. It also provides other free software developers Less
of an advantage over competing non-free programs. These disadvantages
are the reason we use the ordinary General Public License for many
libraries. However, the Lesser license provides advantages in certain
special circumstances.
For example, on rare occasions, there may be a special need to
encourage the widest possible use of a certain library, so that it becomes
a de-facto standard. To achieve this, non-free programs must be
allowed to use the library. A more frequent case is that a free
library does the same job as widely used non-free libraries. In this
case, there is little to gain by limiting the free library to free
software only, so we use the Lesser General Public License.
In other cases, permission to use a particular library in non-free
programs enables a greater number of people to use a large body of
free software. For example, permission to use the GNU C Library in
non-free programs enables many more people to use the whole GNU
operating system, as well as its variant, the GNU/Linux operating
system.
Although the Lesser General Public License is Less protective of the
users' freedom, it does ensure that the user of a program that is
linked with the Library has the freedom and the wherewithal to run
that program using a modified version of the Library.
The precise terms and conditions for copying, distribution and
modification follow. Pay close attention to the difference between a
"work based on the library" and a "work that uses the library". The
former contains code derived from the library, whereas the latter must
be combined with the library in order to run.
GNU LESSER GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License Agreement applies to any software library or other
program which contains a notice placed by the copyright holder or
other authorized party saying it may be distributed under the terms of
this Lesser General Public License (also called "this License").
Each licensee is addressed as "you".
A "library" means a collection of software functions and/or data
prepared so as to be conveniently linked with application programs
(which use some of those functions and data) to form executables.
The "Library", below, refers to any such software library or work
which has been distributed under these terms. A "work based on the
Library" means either the Library or any derivative work under
copyright law: that is to say, a work containing the Library or a
portion of it, either verbatim or with modifications and/or translated
straightforwardly into another language. (Hereinafter, translation is
included without limitation in the term "modification".)
"Source code" for a work means the preferred form of the work for
making modifications to it. For a library, complete source code means
all the source code for all modules it contains, plus any associated
interface definition files, plus the scripts used to control compilation
and installation of the library.
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running a program using the Library is not restricted, and output from
such a program is covered only if its contents constitute a work based
on the Library (independent of the use of the Library in a tool for
writing it). Whether that is true depends on what the Library does
and what the program that uses the Library does.
1. You may copy and distribute verbatim copies of the Library's
complete source code as you receive it, in any medium, provided that
you conspicuously and appropriately publish on each copy an
appropriate copyright notice and disclaimer of warranty; keep intact
all the notices that refer to this License and to the absence of any
warranty; and distribute a copy of this License along with the
Library.
You may charge a fee for the physical act of transferring a copy,
and you may at your option offer warranty protection in exchange for a
fee.
2. You may modify your copy or copies of the Library or any portion
of it, thus forming a work based on the Library, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) The modified work must itself be a software library.
b) You must cause the files modified to carry prominent notices
stating that you changed the files and the date of any change.
c) You must cause the whole of the work to be licensed at no
charge to all third parties under the terms of this License.
d) If a facility in the modified Library refers to a function or a
table of data to be supplied by an application program that uses
the facility, other than as an argument passed when the facility
is invoked, then you must make a good faith effort to ensure that,
in the event an application does not supply such function or
table, the facility still operates, and performs whatever part of
its purpose remains meaningful.
(For example, a function in a library to compute square roots has
a purpose that is entirely well-defined independent of the
application. Therefore, Subsection 2d requires that any
application-supplied function or table used by this function must
be optional: if the application does not supply it, the square
root function must still compute square roots.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Library,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Library, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote
it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Library.
In addition, mere aggregation of another work not based on the Library
with the Library (or with a work based on the Library) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may opt to apply the terms of the ordinary GNU General Public
License instead of this License to a given copy of the Library. To do
this, you must alter all the notices that refer to this License, so
that they refer to the ordinary GNU General Public License, version 2,
instead of to this License. (If a newer version than version 2 of the
ordinary GNU General Public License has appeared, then you can specify
that version instead if you wish.) Do not make any other change in
these notices.
Once this change is made in a given copy, it is irreversible for
that copy, so the ordinary GNU General Public License applies to all
subsequent copies and derivative works made from that copy.
This option is useful when you wish to copy part of the code of
the Library into a program that is not a library.
4. You may copy and distribute the Library (or a portion or
derivative of it, under Section 2) in object code or executable form
under the terms of Sections 1 and 2 above provided that you accompany
it with the complete corresponding machine-readable source code, which
must be distributed under the terms of Sections 1 and 2 above on a
medium customarily used for software interchange.
If distribution of object code is made by offering access to copy
from a designated place, then offering equivalent access to copy the
source code from the same place satisfies the requirement to
distribute the source code, even though third parties are not
compelled to copy the source along with the object code.
5. A program that contains no derivative of any portion of the
Library, but is designed to work with the Library by being compiled or
linked with it, is called a "work that uses the Library". Such a
work, in isolation, is not a derivative work of the Library, and
therefore falls outside the scope of this License.
However, linking a "work that uses the Library" with the Library
creates an executable that is a derivative of the Library (because it
contains portions of the Library), rather than a "work that uses the
library". The executable is therefore covered by this License.
Section 6 states terms for distribution of such executables.
When a "work that uses the Library" uses material from a header file
that is part of the Library, the object code for the work may be a
derivative work of the Library even though the source code is not.
Whether this is true is especially significant if the work can be
linked without the Library, or if the work is itself a library. The
threshold for this to be true is not precisely defined by law.
If such an object file uses only numerical parameters, data
structure layouts and accessors, and small macros and small inline
functions (ten lines or less in length), then the use of the object
file is unrestricted, regardless of whether it is legally a derivative
work. (Executables containing this object code plus portions of the
Library will still fall under Section 6.)
Otherwise, if the work is a derivative of the Library, you may
distribute the object code for the work under the terms of Section 6.
Any executables containing that work also fall under Section 6,
whether or not they are linked directly with the Library itself.
6. As an exception to the Sections above, you may also combine or
link a "work that uses the Library" with the Library to produce a
work containing portions of the Library, and distribute that work
under terms of your choice, provided that the terms permit
modification of the work for the customer's own use and reverse
engineering for debugging such modifications.
You must give prominent notice with each copy of the work that the
Library is used in it and that the Library and its use are covered by
this License. You must supply a copy of this License. If the work
during execution displays copyright notices, you must include the
copyright notice for the Library among them, as well as a reference
directing the user to the copy of this License. Also, you must do one
of these things:
a) Accompany the work with the complete corresponding
machine-readable source code for the Library including whatever
changes were used in the work (which must be distributed under
Sections 1 and 2 above); and, if the work is an executable linked
with the Library, with the complete machine-readable "work that
uses the Library", as object code and/or source code, so that the
user can modify the Library and then relink to produce a modified
executable containing the modified Library. (It is understood
that the user who changes the contents of definitions files in the
Library will not necessarily be able to recompile the application
to use the modified definitions.)
b) Use a suitable shared library mechanism for linking with the
Library. A suitable mechanism is one that (1) uses at run time a
copy of the library already present on the user's computer system,
rather than copying library functions into the executable, and (2)
will operate properly with a modified version of the library, if
the user installs one, as long as the modified version is
interface-compatible with the version that the work was made with.
c) Accompany the work with a written offer, valid for at
least three years, to give the same user the materials
specified in Subsection 6a, above, for a charge no more
than the cost of performing this distribution.
d) If distribution of the work is made by offering access to copy
from a designated place, offer equivalent access to copy the above
specified materials from the same place.
e) Verify that the user has already received a copy of these
materials or that you have already sent this user a copy.
For an executable, the required form of the "work that uses the
Library" must include any data and utility programs needed for
reproducing the executable from it. However, as a special exception,
the materials to be distributed need not include anything that is
normally distributed (in either source or binary form) with the major
components (compiler, kernel, and so on) of the operating system on
which the executable runs, unless that component itself accompanies
the executable.
It may happen that this requirement contradicts the license
restrictions of other proprietary libraries that do not normally
accompany the operating system. Such a contradiction means you cannot
use both them and the Library together in an executable that you
distribute.
7. You may place library facilities that are a work based on the
Library side-by-side in a single library together with other library
facilities not covered by this License, and distribute such a combined
library, provided that the separate distribution of the work based on
the Library and of the other library facilities is otherwise
permitted, and provided that you do these two things:
a) Accompany the combined library with a copy of the same work
based on the Library, uncombined with any other library
facilities. This must be distributed under the terms of the
Sections above.
b) Give prominent notice with the combined library of the fact
that part of it is a work based on the Library, and explaining
where to find the accompanying uncombined form of the same work.
8. You may not copy, modify, sublicense, link with, or distribute
the Library except as expressly provided under this License. Any
attempt otherwise to copy, modify, sublicense, link with, or
distribute the Library is void, and will automatically terminate your
rights under this License. However, parties who have received copies,
or rights, from you under this License will not have their licenses
terminated so long as such parties remain in full compliance.
9. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Library or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Library (or any work based on the
Library), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Library or works based on it.
10. Each time you redistribute the Library (or any work based on the
Library), the recipient automatically receives a license from the
original licensor to copy, distribute, link with or modify the Library
subject to these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties with
this License.
11. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Library at all. For example, if a patent
license would not permit royalty-free redistribution of the Library by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Library.
If any portion of this section is held invalid or unenforceable under any
particular circumstance, the balance of the section is intended to apply,
and the section as a whole is intended to apply in other circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
12. If the distribution and/or use of the Library is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Library under this License may add
an explicit geographical distribution limitation excluding those countries,
so that distribution is permitted only in or among countries not thus
excluded. In such case, this License incorporates the limitation as if
written in the body of this License.
13. The Free Software Foundation may publish revised and/or new
versions of the Lesser General Public License from time to time.
Such new versions will be similar in spirit to the present version,
but may differ in detail to address new problems or concerns.
Each version is given a distinguishing version number. If the Library
specifies a version number of this License which applies to it and
"any later version", you have the option of following the terms and
conditions either of that version or of any later version published by
the Free Software Foundation. If the Library does not specify a
license version number, you may choose any version ever published by
the Free Software Foundation.
14. If you wish to incorporate parts of the Library into other free
programs whose distribution conditions are incompatible with these,
write to the author to ask for permission. For software which is
copyrighted by the Free Software Foundation, write to the Free
Software Foundation; we sometimes make exceptions for this. Our
decision will be guided by the two goals of preserving the free status
of all derivatives of our free software and of promoting the sharing
and reuse of software generally.
NO WARRANTY
15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
DAMAGES.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Libraries
If you develop a new library, and you want it to be of the greatest
possible use to the public, we recommend making it free software that
everyone can redistribute and change. You can do so by permitting
redistribution under these terms (or, alternatively, under the terms of the
ordinary General Public License).
To apply these terms, attach the following notices to the library. It is
safest to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least the
"copyright" line and a pointer to where the full notice is found.
<one line to give the library's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Also add information on how to contact you by electronic and paper mail.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the library, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the
library `Frob' (a library for tweaking knobs) written by James Random Hacker.
<signature of Ty Coon>, 1 April 1990
Ty Coon, President of Vice
That's all there is to it!
----------------------------------------------------------------------------------------
Gamecube & Wii ports are linked with LIBASND library and includes code distributed under
the following license:
Copyright (c) 2008 Hermes <www.entuwii.net>
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are
permitted provided that the following conditions are met:
- Redistributions of source code must retain the above copyright notice, this list of
conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright notice, this list
of conditions and the following disclaimer in the documentation and/or other
materials provided with the distribution.
- The names of the contributors may not be used to endorse or promote products derived
from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
----------------------------------------------------------------------------------------

BIN
gcw0/opk-data/MCD.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 51 KiB

BIN
gcw0/opk-data/MD.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

BIN
gcw0/opk-data/PICO.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

BIN
gcw0/opk-data/SG1000.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

BIN
gcw0/opk-data/SMS.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

BIN
gcw0/opk-data/SQUARE_02.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 181 B

View File

@ -0,0 +1,11 @@
[Desktop Entry]
Name=Genesis Plus GX
Comment=Genesis Plus GX for GCW-Zero
MimeType=application/zip;application/x-genesis-rom;application/x-megadrive-rom;application/x-sms-rom;application/x-cd-image;
Exec=gen_gcw0 %f
Terminal=false
Type=Application
StartupNotify=true
Icon=md
Categories=emulators;
X-OD-Manual=gcw0readme.txt

View File

@ -0,0 +1,154 @@
Genesis Plus GX port for the GCW0 Handheld Console
GCW0 port by:
Shin-NiL
David Knight
Source code available at:
https://bitbucket.org/shin_nil/genesis-plus-gx-gcw0/
Genesis Plus GX is an open-source emulator focused on accuracy and portability, now emulating SG-1000, Master System, Game Gear, Mega Drive / Genesis and Sega / Mega CD hardware. Initially ported and designed to be running on Gamecube / Wii consoles through libogc / devkitPPC, it is also available for many other platforms through various frontends.
The source code is based on Genesis Plus 1.3, originally developped by Charles MacDonald (http://cgfm2.emuviews.com). It has been heavily modified, with respect to initial goals and design, in order to improve accuracy of emulation, implementing new features and adding support for extra peripherals, cartridge & systems hardware.
The result is that Genesis Plus GX is now more a continuation of the original project than a simple port, providing very accurate emulation and 100% compatibility with Genesis / Mega Drive, Sega / Mega CD, Master System, Game Gear & SG-1000 software (including all unlicensed or pirate known dumps), also emulating backwards compatibility modes when available.
Multi-platform sourcecode is available through SVN and GIT so that other Genesis Plus ports can take advantage of it. The sourcecode is released under a specific non-commercial license, see LICENSE.txt for more informations.
INSTRUCTIONS
For SG-1000, Game Gear (GG), Master System (SMS) and Mega Drive (Genesis, MD) you don't need to do anything. Just locate the rom file you wish to use (zip files are supported) and run it through the gMenu.
For Sega CD games you will need the correct bios files. These are not included with this distribution for copyright reasons. Once you have located the correct bios you will need to rename them according to the correct region:
"/usr/local/home/.genplus/bios/bios_CD_U.bin"
"/usr/local/home/.genplus/bios/bios_CD_E.bin"
"/usr/local/home/.genplus/bios/bios_CD_J.bin"
If everything is setup correctly you will then need to locate your image files and run them. .bin/.cue and .iso files are supported, .ogg compressed tracks are supported, .mp3 is NOT supported for legal reasons. (ogg is better anyway :P)
To access the menu press SELECT+START. Controls can be reconfigured from there. In the menu A selects option, B will go back to the last menu.
Default controls are:
D-Pad/A-Stick: Directions
X: A
B: B
A: C
L: X
Y: Y
R: Z
START: Start
SELECT: Mode
SELECT + START: Menu
SELECT + L: Quicksave to Savestate 1
SELECT + R: Quickload savestate 1
In lightgun games for the Master system and Genesis/MD A-stick controls the cursor and A/B/C work as normal. Player 2 controls are mapped to the D-pad and X/Y/Z buttons.
This allows (in theory at least!) two player games. It also allows you to select which control method you prefer. Some games (eg Spacegun) require two controllers.
CONFIGURATION OPTIONS (Default setting)
Scaling (On)
The gcw0 has hardware bilinear scaling which when turned on will enlarge the image to fill the screen. By default this keeps aspect ration so you will still see small bars unless the scaled resolution is exactly 320x240. This is particularly useful for SMS and GG games.
Keep aspect ratio (On)
This does nothing unless Scaling is turned on. If aspect ratio is turned off the hardware scaler will fill the whole screen and there will be no black bars visible.
Scanlines (GG) (On)
This emulates the vertical scanlines visible on the LCD screen. It is only used when running Game Gear games.
Mask left bar (SMS) (On)
The Master System often displays a vertical bar on the left of the screen. Setting this to 'On' will remove it.
Frameskip (0)
In all games except Mega CD this is of no use as the emulation is near perfect speed (with the exception of Virtual Racing). Setting this value will render fewer frames allowing a little speed increase. This improves the performance of FMV scenes in Mega CD games.
Resume on Save/Load (On)
When saving from the menu, the menu will automatically exit and the game will continue. If turned off it will return you to the menu.
A-stick (On)
Some users have issues with their analog controls causing erratic movements. Turning off the A-stick will stop this.
Lock-on (Off)
If enabled, when loading a rom the selected file will be loaded first.
Rename each binary file as follows:
Game Genie: "/usr/local/home/.genplus/lock-on/ggenie.bin"
Action Replay: "/usr/local/home/.genplus/lock-on/areplay.bin"
Sonic & Knuckles: "/usr/local/home/.genplus/lock-on/sk.bin" and /usr/local/home/.genplus/lock-on/sk2chip.bin additional info
After changing the lock-on option, you must reload the game rom.
FM sound (SMS) (On)
Select whether to use enhanced sound on a few Master System titles. A list of compatible titles is at the foot of this readme.
Lightgun Speed (1)
Higher values will speed up the lightgun cursor for player 1.
Lightgun Cursor
Change the lightgun cursor. The cursor is only visible in compatible lightgun games.
FM (enhanced music) Compatible Master system titles (taken from http://segaretro.org/FM_Sound_Unit)
(Note in most cases, only the Japanese variants are compatible)
After Burner
Alex Kidd BMX Trial
Alex Kidd: The Lost Stars
Alien Syndrome
Aztec Adventure
Blade Eagle 3-D
Bomber Raid
Captain Silver
Cyborg Hunter
Double Dragon
Fantasy Zone II
Fantasy Zone: The Maze
Galactic Protector
Global Defense
Golvellius - Valley of Doom
Great Golf
Hoshi Wo Sagashite...
Kenseiden
Lord of The Sword
Maze Hunter 3-D
Megumi Rescue
Miracle Warriors - Seal of The Dark Lord
Nekkyuu Koushien
OutRun
Parlour Games
Penguin Land
Phantasy Star
Power Strike
R-Type
Shinobi
Solomon no Kagi - Oujo Rihita no Namida
Space Harrier 3-D
SpellCaster
Super Racing
Tensai Bakabon
Thunder Blade
Wonder Boy in Monster Land
Ys: The Vanished Omens
Zaxxon 3-D
Zillion II: The Tri Formation
The following games have FM soundtracks but were not released in Japan:
Altered Beast
California Games
Casino Games
Cloud Master
Galaxy Force
Golfamania
OutRun 3-D
Poseidon Wars 3-D
Rampage
Rastan
Rescue Mission
Scramble Spirits
Shanghai
Tennis Ace
Time Soldiers
Ultima IV
Vigilante
Wonder Boy III: The Dragon's Trap
2015/03/22

BIN
gcw0/opk-data/scanlines.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 621 B

3
gcw0/opk_build.sh Normal file
View File

@ -0,0 +1,3 @@
#!/bin/sh
rm -rf genplus.opk
mksquashfs gen_gcw0 opk-data/* genplus.opk -all-root -noappend -no-exports -no-xattrs

38
gcw0/osd.h Normal file
View File

@ -0,0 +1,38 @@
#ifndef _OSD_H_
#define _OSD_H_
#include <stdio.h>
#include <string.h>
#include <stdarg.h>
#include <time.h>
#include <SDL.h>
#include <stdlib.h>
#include "shared.h"
#include "main.h"
#include "config.h"
#include "error.h"
#include "unzip.h"
#include "fileio.h"
#define MAXPATHLEN 1024
#define DEFAULT_PATH "/.genplus"
#define osd_input_update sdl_input_update
#define GG_ROM "/usr/local/home/.genplus/lock-on/ggenie.bin"
#define AR_ROM "/usr/local/home/.genplus/lock-on/areplay.bin"
#define SK_ROM "/usr/local/home/.genplus/lock-on/sk.bin"
#define SK_UPMEM "/usr/local/home/.genplus/lock-on/sk2chip.bin"
#define CD_BIOS_US "/usr/local/home/.genplus/bios/bios_CD_U.bin"
#define CD_BIOS_EU "/usr/local/home/.genplus/bios/bios_CD_E.bin"
#define CD_BIOS_JP "/usr/local/home/.genplus/bios/bios_CD_J.bin"
#define MD_BIOS "/usr/local/home/.genplus/bios/bios_MD.bin"
#define MS_BIOS_US "/usr/local/home/.genplus/bios/bios_U.sms"
#define MS_BIOS_EU "/usr/local/home/.genplus/bios/bios_E.sms"
#define MS_BIOS_JP "/usr/local/home/.genplus/bios/bios_J.sms"
#define GG_BIOS "/usr/local/home/.genplus/bios/bios.gg"
#endif /* _OSD_H_ */

1294
gcw0/unzip.c Normal file

File diff suppressed because it is too large Load Diff

273
gcw0/unzip.h Normal file
View File

@ -0,0 +1,273 @@
/* 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 */

170
gcw0/utils.c Normal file
View File

@ -0,0 +1,170 @@
#include <sys/stat.h>
#include <dirent.h>
#include "utils.h"
#include "osd.h"
void create_default_directories(void) {
const char *homedir;
if ((homedir = getenv("HOME")) == NULL) {
homedir = getpwuid(getuid())->pw_dir;
}
char pathname[MAXPATHLEN];
/* base directory */
sprintf (pathname, "%s%s", homedir, DEFAULT_PATH);
DIR *dir = opendir(pathname);
if (dir) closedir(dir);
else mkdir(pathname,S_IRWXU);
/* default SRAM & Savestate files directories */
sprintf (pathname, "%s%s/saves", homedir, DEFAULT_PATH);
dir = opendir(pathname);
if (dir) closedir(dir);
else mkdir(pathname,S_IRWXU);
sprintf (pathname, "%s%s/saves/md", homedir, DEFAULT_PATH);
dir = opendir(pathname);
if (dir) closedir(dir);
else mkdir(pathname,S_IRWXU);
sprintf (pathname, "%s%s/saves/ms", homedir, DEFAULT_PATH);
dir = opendir(pathname);
if (dir) closedir(dir);
else mkdir(pathname,S_IRWXU);
sprintf (pathname, "%s%s/saves/gg", homedir, DEFAULT_PATH);
dir = opendir(pathname);
if (dir) closedir(dir);
else mkdir(pathname,S_IRWXU);
sprintf (pathname, "%s%s/saves/sg", homedir, DEFAULT_PATH);
dir = opendir(pathname);
if (dir) closedir(dir);
else mkdir(pathname,S_IRWXU);
sprintf (pathname, "%s%s/saves/cd", homedir, DEFAULT_PATH);
dir = opendir(pathname);
if (dir) closedir(dir);
else mkdir(pathname,S_IRWXU);
/* default Snapshot files directories */
sprintf (pathname, "%s%s/snaps", homedir, DEFAULT_PATH);
dir = opendir(pathname);
if (dir) closedir(dir);
else mkdir(pathname,S_IRWXU);
sprintf (pathname, "%s%s/snaps/md", homedir, DEFAULT_PATH);
dir = opendir(pathname);
if (dir) closedir(dir);
else mkdir(pathname,S_IRWXU);
sprintf (pathname, "%s%s/snaps/ms", homedir, DEFAULT_PATH);
dir = opendir(pathname);
if (dir) closedir(dir);
else mkdir(pathname,S_IRWXU);
sprintf (pathname, "%s%s/snaps/gg", homedir, DEFAULT_PATH);
dir = opendir(pathname);
if (dir) closedir(dir);
else mkdir(pathname,S_IRWXU);
sprintf (pathname, "%s%s/snaps/sg", homedir, DEFAULT_PATH);
dir = opendir(pathname);
if (dir) closedir(dir);
else mkdir(pathname,S_IRWXU);
sprintf (pathname, "%s%s/snaps/cd", homedir, DEFAULT_PATH);
dir = opendir(pathname);
if (dir) closedir(dir);
else mkdir(pathname,S_IRWXU);
/* default Cheat files directories */
sprintf (pathname, "%s%s/cheats", homedir, DEFAULT_PATH);
dir = opendir(pathname);
if (dir) closedir(dir);
else mkdir(pathname,S_IRWXU);
sprintf (pathname, "%s%s/cheats/md", homedir, DEFAULT_PATH);
dir = opendir(pathname);
if (dir) closedir(dir);
else mkdir(pathname,S_IRWXU);
sprintf (pathname, "%s%s/cheats/ms", homedir, DEFAULT_PATH);
dir = opendir(pathname);
if (dir) closedir(dir);
else mkdir(pathname,S_IRWXU);
sprintf (pathname, "%s%s/cheats/gg", homedir, DEFAULT_PATH);
dir = opendir(pathname);
if (dir) closedir(dir);
else mkdir(pathname,S_IRWXU);
sprintf (pathname, "%s%s/cheats/sg", homedir, DEFAULT_PATH);
dir = opendir(pathname);
if (dir) closedir(dir);
else mkdir(pathname,S_IRWXU);
sprintf (pathname, "%s%s/cheats/cd", homedir, DEFAULT_PATH);
dir = opendir(pathname);
if (dir) closedir(dir);
else mkdir(pathname,S_IRWXU);
/* default BIOS ROM files directories */
sprintf (pathname, "%s%s/bios", homedir, DEFAULT_PATH);
dir = opendir(pathname);
if (dir) closedir(dir);
else mkdir(pathname,S_IRWXU);
/* default LOCK-ON ROM files directories */
sprintf (pathname, "%s%s/lock-on", homedir, DEFAULT_PATH);
dir = opendir(pathname);
if (dir) closedir(dir);
else mkdir(pathname,S_IRWXU);
}
char* get_save_directory(void) {
const char *homedir;
const char *system_dir;
if ((homedir = getenv("HOME")) == NULL) {
homedir = getpwuid(getuid())->pw_dir;
}
char pathname[MAXPATHLEN];
if(system_hw <= SYSTEM_MARKIII){
system_dir = "/saves/sg";
} else if (system_hw > SYSTEM_MARKIII && system_hw <= SYSTEM_SMS2) {
system_dir = "/saves/ms";
} else if (system_hw > SYSTEM_SMS2 && system_hw <= SYSTEM_GGMS) {
system_dir = "/saves/gg";
} else if (system_hw == SYSTEM_MD) {
system_dir = "/saves/md";
} else if (system_hw == SYSTEM_MCD) {
system_dir = "/saves/cd";
} else {
system_dir = "/saves/";
}
sprintf (pathname, "%s%s%s", homedir, DEFAULT_PATH, system_dir);
return pathname;
}
char* gcw0_get_key_name(int keycode)
{
if (keycode == SDLK_UP) return "Up";
else if (keycode == SDLK_DOWN) return "Down";
else if (keycode == SDLK_LEFT) return "Left";
else if (keycode == SDLK_RIGHT) return "Right";
else if (keycode == SDLK_LCTRL) return "A";
else if (keycode == SDLK_LALT) return "B";
else if (keycode == SDLK_LSHIFT) return "X";
else if (keycode == SDLK_SPACE) return "Y";
else if (keycode == SDLK_TAB) return "L";
else if (keycode == SDLK_BACKSPACE) return "R";
else if (keycode == SDLK_RETURN) return "Start";
else if (keycode == SDLK_ESCAPE) return "Select";
else return "...";
}
char *get_file_name(char *full_path) {
char file_name[256];
sprintf(file_name, "%s", basename(full_path));
/* remove file extension */
int i = strlen(file_name) - 1;
while ((i > 0) && (file_name[i] != '.')) i--;
if (i > 0) file_name[i] = 0;
return file_name;
}

10
gcw0/utils.h Normal file
View File

@ -0,0 +1,10 @@
#ifndef _UTILS_H_
#define _UTILS_H_
/* Function prototypes */
void create_default_directories(void);
char* get_save_directory(void);
char* gcw0_get_key_name(int keycode);
char *get_file_name(char *full_path);
#endif /* _UTILS_H_ */