Commit be1857fa authored by Libretro-Admin's avatar Libretro-Admin
Browse files

Cleanups

parent 30d522cc
Pipeline #58224 passed with stages
in 11 minutes and 30 seconds
DEPS_DIR = $(CORE_DIR)/deps
GME_DIR = $(DEPS_DIR)/game-music-emu
GME_DIR = $(DEPS_DIR)/game-music-emu
LIBRETRO_COMM_DIR = $(DEPS_DIR)/libretro-common
INCFLAGS = -I$(CORE_DIR) \
-I$(LIBRETRO_COMM_DIR)/include \
-I$(DEPS_DIR)/game-music-emu/gme \
-I$(DEPS_DIR)/zlib-1.2.8 \
-I$(DEPS_DIR)/zlib-1.2.8/contrib/minizip
INCFLAGS = -I$(CORE_DIR) \
-I$(LIBRETRO_COMM_DIR)/include \
-I$(DEPS_DIR)/game-music-emu/gme \
-I$(DEPS_DIR)/zlib-1.2.8 \
-I$(DEPS_DIR)/zlib-1.2.8/contrib/minizip
ifneq (,$(findstring msvc200,$(platform)))
INCFLAGS += -I$(LIBRETRO_COMM_DIR)/include/compat/msvc
endif
SOURCES_CXX := \
$(GME_DIR)/gme/Ay_Apu.cpp \
$(GME_DIR)/gme/Ay_Cpu.cpp \
$(GME_DIR)/gme/Ay_Emu.cpp \
$(GME_DIR)/gme/Blip_Buffer.cpp \
$(GME_DIR)/gme/Classic_Emu.cpp \
$(GME_DIR)/gme/Data_Reader.cpp \
$(GME_DIR)/gme/Dual_Resampler.cpp \
$(GME_DIR)/gme/Effects_Buffer.cpp \
$(GME_DIR)/gme/Fir_Resampler.cpp \
$(GME_DIR)/gme/Gbs_Emu.cpp \
$(GME_DIR)/gme/Gb_Apu.cpp \
$(GME_DIR)/gme/Gb_Cpu.cpp \
$(GME_DIR)/gme/Gb_Oscs.cpp \
$(GME_DIR)/gme/gme.cpp \
$(GME_DIR)/gme/Gme_File.cpp \
$(GME_DIR)/gme/Gym_Emu.cpp \
$(GME_DIR)/gme/Hes_Apu.cpp \
$(GME_DIR)/gme/Hes_Cpu.cpp \
$(GME_DIR)/gme/Hes_Emu.cpp \
$(GME_DIR)/gme/Kss_Cpu.cpp \
$(GME_DIR)/gme/Kss_Emu.cpp \
$(GME_DIR)/gme/Kss_Scc_Apu.cpp \
$(GME_DIR)/gme/M3u_Playlist.cpp \
$(GME_DIR)/gme/Multi_Buffer.cpp \
$(GME_DIR)/gme/Music_Emu.cpp \
$(GME_DIR)/gme/Nes_Apu.cpp \
$(GME_DIR)/gme/Nes_Cpu.cpp \
$(GME_DIR)/gme/Nes_Fme7_Apu.cpp \
$(GME_DIR)/gme/Nes_Namco_Apu.cpp \
$(GME_DIR)/gme/Nes_Oscs.cpp \
$(GME_DIR)/gme/Nes_Vrc6_Apu.cpp \
$(GME_DIR)/gme/Nsfe_Emu.cpp \
$(GME_DIR)/gme/Nsf_Emu.cpp \
$(GME_DIR)/gme/Sap_Apu.cpp \
$(GME_DIR)/gme/Sap_Cpu.cpp \
$(GME_DIR)/gme/Sap_Emu.cpp \
$(GME_DIR)/gme/Sms_Apu.cpp \
$(GME_DIR)/gme/Snes_Spc.cpp \
$(GME_DIR)/gme/Spc_Cpu.cpp \
$(GME_DIR)/gme/Spc_Dsp.cpp \
$(GME_DIR)/gme/Spc_Emu.cpp \
$(GME_DIR)/gme/Spc_Filter.cpp \
$(GME_DIR)/gme/Vgm_Emu.cpp \
$(GME_DIR)/gme/Vgm_Emu_Impl.cpp \
$(GME_DIR)/gme/Ym2413_Emu.cpp \
$(GME_DIR)/gme/Ym2612_Emu.cpp
$(GME_DIR)/gme/Ay_Apu.cpp \
$(GME_DIR)/gme/Ay_Cpu.cpp \
$(GME_DIR)/gme/Ay_Emu.cpp \
$(GME_DIR)/gme/Blip_Buffer.cpp \
$(GME_DIR)/gme/Classic_Emu.cpp \
$(GME_DIR)/gme/Data_Reader.cpp \
$(GME_DIR)/gme/Dual_Resampler.cpp \
$(GME_DIR)/gme/Effects_Buffer.cpp \
$(GME_DIR)/gme/Fir_Resampler.cpp \
$(GME_DIR)/gme/Gbs_Emu.cpp \
$(GME_DIR)/gme/Gb_Apu.cpp \
$(GME_DIR)/gme/Gb_Cpu.cpp \
$(GME_DIR)/gme/Gb_Oscs.cpp \
$(GME_DIR)/gme/gme.cpp \
$(GME_DIR)/gme/Gme_File.cpp \
$(GME_DIR)/gme/Gym_Emu.cpp \
$(GME_DIR)/gme/Hes_Apu.cpp \
$(GME_DIR)/gme/Hes_Cpu.cpp \
$(GME_DIR)/gme/Hes_Emu.cpp \
$(GME_DIR)/gme/Kss_Cpu.cpp \
$(GME_DIR)/gme/Kss_Emu.cpp \
$(GME_DIR)/gme/Kss_Scc_Apu.cpp \
$(GME_DIR)/gme/M3u_Playlist.cpp \
$(GME_DIR)/gme/Multi_Buffer.cpp \
$(GME_DIR)/gme/Music_Emu.cpp \
$(GME_DIR)/gme/Nes_Apu.cpp \
$(GME_DIR)/gme/Nes_Cpu.cpp \
$(GME_DIR)/gme/Nes_Fme7_Apu.cpp \
$(GME_DIR)/gme/Nes_Namco_Apu.cpp \
$(GME_DIR)/gme/Nes_Oscs.cpp \
$(GME_DIR)/gme/Nes_Vrc6_Apu.cpp \
$(GME_DIR)/gme/Nsfe_Emu.cpp \
$(GME_DIR)/gme/Nsf_Emu.cpp \
$(GME_DIR)/gme/Sap_Apu.cpp \
$(GME_DIR)/gme/Sap_Cpu.cpp \
$(GME_DIR)/gme/Sap_Emu.cpp \
$(GME_DIR)/gme/Sms_Apu.cpp \
$(GME_DIR)/gme/Snes_Spc.cpp \
$(GME_DIR)/gme/Spc_Cpu.cpp \
$(GME_DIR)/gme/Spc_Dsp.cpp \
$(GME_DIR)/gme/Spc_Emu.cpp \
$(GME_DIR)/gme/Spc_Filter.cpp \
$(GME_DIR)/gme/Vgm_Emu.cpp \
$(GME_DIR)/gme/Vgm_Emu_Impl.cpp \
$(GME_DIR)/gme/Ym2413_Emu.cpp \
$(GME_DIR)/gme/Ym2612_Emu.cpp
SOURCES_C := $(CORE_DIR)/src/libretro.c \
$(CORE_DIR)/src/graphics.c \
$(CORE_DIR)/src/player.c \
$(CORE_DIR)/src/playlist.c \
$(CORE_DIR)/src/log.c \
$(CORE_DIR)/src/fileformat.c \
$(DEPS_DIR)/zlib-1.2.8/adler32.c \
$(DEPS_DIR)/zlib-1.2.8/crc32.c \
$(DEPS_DIR)/zlib-1.2.8/inflate.c \
$(DEPS_DIR)/zlib-1.2.8/inftrees.c \
$(DEPS_DIR)/zlib-1.2.8/inffast.c \
$(DEPS_DIR)/zlib-1.2.8/zutil.c \
$(DEPS_DIR)/zlib-1.2.8/contrib/minizip/ioapi.c \
$(DEPS_DIR)/zlib-1.2.8/contrib/minizip/unzip.c \
$(DEPS_DIR)/zlib-1.2.8/deflate.c \
$(DEPS_DIR)/zlib-1.2.8/gzclose.c \
$(DEPS_DIR)/zlib-1.2.8/gzlib.c \
$(DEPS_DIR)/zlib-1.2.8/gzread.c \
$(DEPS_DIR)/zlib-1.2.8/gzwrite.c \
$(DEPS_DIR)/zlib-1.2.8/trees.c \
$(DEPS_DIR)/libretro-common/compat/compat_snprintf.c \
$(DEPS_DIR)/libretro-common/compat/compat_posix_string.c \
$(DEPS_DIR)/libretro-common/compat/compat_strcasestr.c \
$(DEPS_DIR)/libretro-common/compat/compat_strl.c \
$(DEPS_DIR)/libretro-common/file/file_path.c \
$(DEPS_DIR)/libretro-common/string/stdstring.c
$(CORE_DIR)/src/graphics.c \
$(CORE_DIR)/src/player.c \
$(CORE_DIR)/src/playlist.c \
$(CORE_DIR)/src/fileformat.c \
$(DEPS_DIR)/zlib-1.2.8/adler32.c \
$(DEPS_DIR)/zlib-1.2.8/crc32.c \
$(DEPS_DIR)/zlib-1.2.8/inflate.c \
$(DEPS_DIR)/zlib-1.2.8/inftrees.c \
$(DEPS_DIR)/zlib-1.2.8/inffast.c \
$(DEPS_DIR)/zlib-1.2.8/zutil.c \
$(DEPS_DIR)/zlib-1.2.8/contrib/minizip/ioapi.c \
$(DEPS_DIR)/zlib-1.2.8/contrib/minizip/unzip.c \
$(DEPS_DIR)/zlib-1.2.8/deflate.c \
$(DEPS_DIR)/zlib-1.2.8/gzclose.c \
$(DEPS_DIR)/zlib-1.2.8/gzlib.c \
$(DEPS_DIR)/zlib-1.2.8/gzread.c \
$(DEPS_DIR)/zlib-1.2.8/gzwrite.c \
$(DEPS_DIR)/zlib-1.2.8/trees.c \
$(DEPS_DIR)/libretro-common/compat/compat_snprintf.c \
$(DEPS_DIR)/libretro-common/compat/compat_posix_string.c \
$(DEPS_DIR)/libretro-common/compat/compat_strcasestr.c \
$(DEPS_DIR)/libretro-common/compat/compat_strl.c \
$(DEPS_DIR)/libretro-common/file/file_path.c \
$(DEPS_DIR)/libretro-common/string/stdstring.c
......@@ -6,7 +6,6 @@
#include "fileformat.h"
#include "unzip.h"
#include "log.h"
static const char *gme_allowed_exts[] = {
"ay","AY",
......@@ -25,8 +24,7 @@ static const char *gme_allowed_exts[] = {
static bool is_gme_allowed_ext(char *ext)
{
int i;
int arr_length;
arr_length = sizeof(gme_allowed_exts) / sizeof(char*);
int arr_length = sizeof(gme_allowed_exts) / sizeof(char*);
for(i=0;i<arr_length;i++)
{
if(strcmp(ext,gme_allowed_exts[i])==0)
......@@ -43,28 +41,27 @@ static bool uncompress_file_data(file_data** fd)
file_data* src_fd = *fd;
file_data* dest_fd = NULL;
srcLen = src_fd->length;
srcLen = src_fd->length;
memcpy(&dstLen,&(src_fd->data[src_fd->length-4]),4);
dest_fd = malloc(sizeof(file_data));
dest_fd->length = dstLen;
dest_fd->name = calloc(strlen(src_fd->name)+1,sizeof(char));
dest_fd = malloc(sizeof(file_data));
dest_fd->length = dstLen;
dest_fd->name = calloc(strlen(src_fd->name)+1,sizeof(char));
strcpy(dest_fd->name,src_fd->name);
dest_fd->data = malloc(dstLen * sizeof(char));
strm.total_in = strm.avail_in = srcLen;
strm.total_out = strm.avail_out = dstLen;
strm.next_in = (Bytef *) src_fd->data;
strm.next_out = (Bytef *) dest_fd->data;
dest_fd->data = malloc(dstLen * sizeof(char));
strm.total_in = strm.avail_in = srcLen;
strm.total_out = strm.avail_out = dstLen;
strm.next_in = (Bytef *) src_fd->data;
strm.next_out = (Bytef *) dest_fd->data;
strm.zalloc = Z_NULL;
strm.zfree = Z_NULL;
strm.opaque = Z_NULL;
strm.zalloc = Z_NULL;
strm.zfree = Z_NULL;
strm.opaque = Z_NULL;
err = inflateInit2(&strm, (15 + 32)); //15 window bits, and the +32 tells zlib to to detect if using gzip or zlib
if (err == Z_OK)
// 15 window bits, and the +32 tells zlib
// to to detect if using gzip or zlib
if ((err = inflateInit2(&strm, (15 + 32))) == Z_OK)
{
err = inflate(&strm, Z_FINISH);
if (err != Z_STREAM_END)
if ((err = inflate(&strm, Z_FINISH)) != Z_STREAM_END)
{
inflateEnd(&strm);
return false;
......@@ -75,6 +72,7 @@ static bool uncompress_file_data(file_data** fd)
inflateEnd(&strm);
return false;
}
inflateEnd(&strm);
free(src_fd->data);
free(src_fd->name);
......@@ -83,35 +81,31 @@ static bool uncompress_file_data(file_data** fd)
return true;
}
static bool get_files_from_zip(const char *path, file_data ***dest_files, int *dest_numfiles)
static bool get_files_from_zip(const char *path,
file_data ***dest_files, int *dest_numfiles)
{
unzFile uf = NULL;
int i;
char *ext;
unz_global_info64 gi;
unz_file_info64 file_info;
int i;
char filename_inzip[256];
char *ext;
file_data **files;
int numfiles,position;
//load zip content
uf = unzOpen64(path);
unzFile uf = unzOpen64(path);
unzGetGlobalInfo64(uf,&gi);
numfiles = (int)gi.number_entry;
files = malloc(sizeof(file_data*) * numfiles);
files = malloc(sizeof(file_data*) * numfiles);
position = 0;
for(i=0;i<gi.number_entry;i++)
{
void* buf;
int err;
int bytes_read;
uInt size_buf = 8192;
//read compressed file info
err = unzGetCurrentFileInfo64(uf,&file_info,filename_inzip,sizeof(filename_inzip),NULL,0,NULL,0);
int err = unzGetCurrentFileInfo64(uf,&file_info,filename_inzip,sizeof(filename_inzip),NULL,0,NULL,0);
if(err!=UNZ_OK)
{
return false;
}
if(filename_inzip[file_info.size_filename -1]=='/')
ext = strrchr(filename_inzip,'/');
else
......@@ -132,7 +126,7 @@ static bool get_files_from_zip(const char *path, file_data ***dest_files, int *d
return false;
//read file from zip
err = unzOpenCurrentFilePassword(uf,NULL);
if (err!=UNZ_OK)
if (err != UNZ_OK)
return false;
//get data from zip
do
......
......@@ -6,8 +6,7 @@
unsigned short get_color(char r, char g, char b)
{
unsigned short color= (r << 11) | (g << 5) | b;
return color;
return (r << 11) | (g << 5) | b;
}
surface *create_surface(unsigned int width, unsigned int height, unsigned int bpp)
......@@ -131,56 +130,55 @@ void draw_shape(surface *surf, unsigned short color, int pos_x, int pos_y, int w
void draw_letter(surface *surf, unsigned short color, char letter, int pos_x, int pos_y)
{
int y, x;
//calculate letter offset
int charx = (letter % 16) * 8;
int chary = (letter >> 4) * 8;
//calculate letter offset
int charx = (letter % 16) * 8;
int chary = (letter >> 4) * 8;
for(y=0;y<8;y++)
{
for(x=0;x<8;x++)
{
if(is_font_pixel(charx+x,chary+y))
set_pixel(surf,pos_x+x,pos_y+y,color);
}
}
for(y=0;y<8;y++)
{
for(x=0;x<8;x++)
{
if(is_font_pixel(charx+x,chary+y))
set_pixel(surf,pos_x+x,pos_y+y,color);
}
}
}
void draw_string(surface *surf, unsigned short color, char* text, int pos_x, int pos_y, unsigned int framecounter)
{
int x;
int x_offset = 0;
int delta = 0;
int delay = 30;
int modulo = 0;
int frame_delay = 2;
int msglen = strlen(text);
int x_offset = 0;
int delta = 0;
int delay = 30;
int modulo = 0;
int frame_delay = 2;
int msglen = strlen(text);
surface *clipped_surface = NULL;
surface *temp_surface = create_surface((msglen*8),8,2);
surface *temp_surface = create_surface((msglen*8),8,2);
for(x=0;x<msglen;x++)
draw_letter(temp_surface,color,text[x],(x*8),0);
for(x=0;x<msglen;x++)
draw_letter(temp_surface,color,text[x],(x*8),0);
if((msglen*8)>280)
{
delta = (msglen*8) -280;
modulo = delta + (delay * 2);
x_offset = (modulo - abs(framecounter/frame_delay % (2*modulo) - modulo)) - delay; // triangle function
x_offset = MAX(x_offset,0); //clamp left to add delay
x_offset = MIN(x_offset,delta); //clamp right to add delay
}
if((msglen*8)>280)
{
delta = (msglen*8) -280;
modulo = delta + (delay * 2);
x_offset = (modulo - abs(framecounter/frame_delay % (2*modulo) - modulo)) - delay; // triangle function
x_offset = MAX(x_offset,0); //clamp left to add delay
x_offset = MIN(x_offset,delta); //clamp right to add delay
}
clipped_surface = clip_surface(temp_surface,pos_x-x_offset,pos_y,21,21,299,219);
clipped_surface = clip_surface(temp_surface,pos_x-x_offset,pos_y,21,21,299,219);
if (clipped_surface)
{
copy_surface(clipped_surface,surf,0,0,pos_x,pos_y,clipped_surface->width,clipped_surface->height);
free_surface(clipped_surface);
}
free_surface(temp_surface);
if (clipped_surface)
{
copy_surface(clipped_surface,surf,0,0,pos_x,pos_y,clipped_surface->width,clipped_surface->height);
free_surface(clipped_surface);
}
free_surface(temp_surface);
}
int get_string_length(char* text)
{
int ln = strlen(text);
return ln * 8;
return strlen(text) * 8;
}
......@@ -7,7 +7,6 @@
#include "graphics.h"
#include "player.h"
#include "log.h"
// Static globals
static surface *framebuffer = NULL;
......@@ -15,6 +14,8 @@ static uint16_t previnput = 0;
// Callbacks
retro_log_printf_t log_cb;
static retro_video_refresh_t video_cb;
static retro_input_poll_t input_poll_cb;
static retro_input_state_t input_state_cb;
......@@ -76,9 +77,6 @@ static void draw_ui(void)
free(message);
}
void handle_error( const char* error );
void handle_info( const char* info);
/*
* Tell libretro about this core, it's name, version and which rom files it supports.
*/
......@@ -114,7 +112,12 @@ void retro_init(void)
{
unsigned level = 0;
/* set up some logging */
init_log(environ_cb);
struct retro_log_callback log;
if (environ_cb(RETRO_ENVIRONMENT_GET_LOG_INTERFACE, &log))
log_cb = log.log;
else
log_cb = NULL;
// the performance level is guide to frontend to give an idea of how intensive this core is to run
environ_cb(RETRO_ENVIRONMENT_SET_PERFORMANCE_LEVEL, &level);
framebuffer = create_surface(320,240,2);
......@@ -171,12 +174,7 @@ void retro_run(void)
// File Loading
bool retro_load_game(const struct retro_game_info *info)
{
long sample_rate = 44100;
if (!info)
return false;
if(open_file(info->path,sample_rate))
if (info && open_file(info->path, 44100))
return true;
return false;
}
......
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <assert.h>
#include "libretro.h"
static retro_log_printf_t log_cb;
void init_log(retro_environment_t environ_cb)
{
struct retro_log_callback log;
if (environ_cb(RETRO_ENVIRONMENT_GET_LOG_INTERFACE, &log))
log_cb = log.log;
else
log_cb = NULL;
}
void handle_error( const char* error )
{
char str [256];
if(error)
{
sprintf( str, "Error: %s", error );
log_cb(RETRO_LOG_ERROR, str );
}
}
void handle_info( const char* info )
{
char str [256];
if(info)
{
sprintf( str, "Info: %s\n", info );
log_cb(RETRO_LOG_INFO, str );
}
}
#ifndef GME_LIBRETRO_LOG_H__
#define GME_LIBRETRO_LOG_H__
#include "libretro.h"
void init_log(retro_environment_t environ_cb);
void handle_error( const char* error );
void handle_info( const char* info );
#endif
......@@ -4,7 +4,9 @@
#include "player.h"
#include "playlist.h"
#include "fileformat.h"
#include "log.h"
#include "libretro.h"
extern retro_log_printf_t log_cb;
static playlist *plist = NULL;
static gme_track_data *track = NULL;
......@@ -45,38 +47,36 @@ void close_file(void)
void start_track(int tracknr)
{
char message[256];
memset(audio_buffer,0,8192 * sizeof(short));
current_track = tracknr;
track = plist->tracks[tracknr];
if(track)
{
//change emu if file changes
if(track->file_id != prev_fileid)
{
is_playing_ = false;
file = plist->files[track->file_id];
prev_fileid = track->file_id;
if (emu)
gme_delete (emu);
emu = gme_new_emu(file->file_type,sample_rate_);
gme_load_data(emu,file->data,file->length);
is_playing_ = true;
}
}
else
{
strcpy(message,"Unknown track type");
handle_error(message);
is_playing_ = false;
}
if(is_playing_)
gme_start_track(emu, track->track_id);
memset(audio_buffer,0,8192 * sizeof(short));
current_track = tracknr;
track = plist->tracks[tracknr];
if(track)
{
//change emu if file changes
if(track->file_id != prev_fileid)
{
is_playing_ = false;
file = plist->files[track->file_id];
prev_fileid = track->file_id;
if (emu)
gme_delete (emu);
emu = gme_new_emu(file->file_type,sample_rate_);
gme_load_data(emu,file->data,file->length);
is_playing_ = true;
}
}
else
{
log_cb(RETRO_LOG_ERROR, "[GME] Error: Unknown track type.\n" );
is_playing_ = false;
}
if (is_playing_)
gme_start_track(emu, track->track_id);
}
short *play(void)
{
if(is_playing_)
if (is_playing_)
{
if(gme_track_ended(emu))
{
......@@ -125,15 +125,15 @@ char *get_song_name(char *buf)
char *get_track_position(char *buf)
{
long seconds = track->track_length / 1000;
long elapsed_seconds = gme_tell(emu) / 1000;
sprintf(buf, "(%ld:%02ld / %ld:%02ld)",elapsed_seconds/60,elapsed_seconds%60,seconds/60,seconds % 60);
return buf;
long seconds = track->track_length / 1000;
long elapsed_seconds = gme_tell(emu) / 1000;
sprintf(buf, "(%ld:%02ld / %ld:%02ld)",elapsed_seconds/60,elapsed_seconds%60,seconds/60,seconds % 60);
return buf;
}
int get_track_elapsed_frames(void)
{
return gme_tell_samples(emu)/1470;
return gme_tell_samples(emu) / 1470;
}
void play_pause(void)
......
......@@ -4,7 +4,9 @@
#include "file/file_path.h"
#include "playlist.h"
#include "log.h"
#include "libretro.h"
extern retro_log_printf_t log_cb;
bool get_playlist(const char *path, playlist **dest_pl)
{
......@@ -97,54 +99,54 @@ bool get_playlist_gme_files(const char *path,gme_file_data ***dest_files,int *de
bool get_gme_file_data(file_data *fd,gme_file_data **dest_gfd)
{
Music_Emu* temp_emu;
gme_err_t err_msg;
gme_file_data *gfd = malloc(sizeof(gme_file_data));
//set playlist type
char *ext = strrchr(fd->name,'.') +1;
//check extension to determine player type
if(strcmp(ext,"ay")==0 || strcmp(ext,"AY")==0)
gfd->file_type = gme_ay_type;
else if(strcmp(ext,"gbs")==0 || strcmp(ext,"GBS")==0)
gfd->file_type = gme_gbs_type;
else if(strcmp(ext,"gym")==0 || strcmp(ext,"GYM")==0)
gfd->file_type = gme_gym_type;
else if(strcmp(ext,"hes")==0 || strcmp(ext,"HES")==0)
gfd->file_type = gme_hes_type;
else if(strcmp(ext,"kss")==0 || strcmp(ext,"KSS")==0)
gfd->file_type = gme_kss_type;
else if(strcmp(ext,"nsf")==0 || strcmp(ext,"NSF")==0)
gfd->file_type = gme_nsf_type;