From 21aa0759da3432988c41b38c29c38248cec3c514 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Thu, 6 Aug 2015 13:34:20 +0200 Subject: [PATCH] Remove unused files --- src/driver.h | 16 ++ src/drivers/libretro/griffin.c | 5 - src/fceu.c | 1 - src/fceustr.c | 29 ---- src/fceustr.h | 9 - src/fds.c | 1 - src/input.c | 1 - src/input/pads.c | 1 - src/input/share.h | 2 - src/movie.c | 253 --------------------------- src/movie.h | 11 -- src/netplay.c | 303 --------------------------------- src/netplay.h | 28 --- src/sound.c | 1 - src/state.c | 2 - src/vsuni.c | 1 - src/wave.c | 104 ----------- src/wave.h | 6 - 18 files changed, 16 insertions(+), 758 deletions(-) delete mode 100644 src/fceustr.c delete mode 100644 src/fceustr.h delete mode 100644 src/movie.c delete mode 100644 src/movie.h delete mode 100644 src/netplay.c delete mode 100644 src/netplay.h delete mode 100644 src/wave.c delete mode 100644 src/wave.h diff --git a/src/driver.h b/src/driver.h index 1d97c61..c3767ca 100644 --- a/src/driver.h +++ b/src/driver.h @@ -11,6 +11,22 @@ extern "C" { #include "git.h" #include "debug.h" +#define FCEUNPCMD_RESET 0x01 +#define FCEUNPCMD_POWER 0x02 + +#define FCEUNPCMD_VSUNICOIN 0x07 +#define FCEUNPCMD_VSUNIDIP0 0x08 +#define FCEUNPCMD_FDSINSERTx 0x10 +#define FCEUNPCMD_FDSINSERT 0x18 +#define FCEUNPCMD_FDSEJECT 0x19 +#define FCEUNPCMD_FDSSELECT 0x1A + +#define FCEUNPCMD_LOADSTATE 0x80 + +#define FCEUNPCMD_SAVESTATE 0x81 /* Sent from server to client. */ +#define FCEUNPCMD_LOADCHEATS 0x82 +#define FCEUNPCMD_TEXT 0x90 + FILE *FCEUD_UTF8fopen(const char *fn, const char *mode); /* This makes me feel dirty for some reason. */ diff --git a/src/drivers/libretro/griffin.c b/src/drivers/libretro/griffin.c index 078d8f8..4c005c5 100644 --- a/src/drivers/libretro/griffin.c +++ b/src/drivers/libretro/griffin.c @@ -12,15 +12,12 @@ #include "fceu-memory.c" #include "misc.c" #include "fceu.c" -//#include "fceustr.c" #include "fds.c" #include "file.c" #include "filter.c" #include "general.c" #include "input.c" #include "md5.c" -//#include "movie.c" -//#include "netplay.c" #include "nsf.c" #include "palette.c" #include "ppu.c" @@ -28,8 +25,6 @@ #include "state.c" #include "video.c" #include "vsuni.c" -//#include "wave.c" - //#include "x6502.c" //#include "ines.c" diff --git a/src/fceu.c b/src/fceu.c index ffabf10..d2c20cb 100644 --- a/src/fceu.c +++ b/src/fceu.c @@ -28,7 +28,6 @@ #include "fceu.h" #include "ppu.h" #include "sound.h" -#include "netplay.h" #include "general.h" #include "fceu-endian.h" #include "fceu-memory.h" diff --git a/src/fceustr.c b/src/fceustr.c deleted file mode 100644 index 1dbd181..0000000 --- a/src/fceustr.c +++ /dev/null @@ -1,29 +0,0 @@ -#include -#include - -#include "fceu-types.h" -#include "fceustr.h" - - -/* Creates a fceustr from a C-style string. */ -fceustr *fceustr_create(const char *str) { - fceustr *ret; - - ret = malloc(sizeof(fceustr)); - - ret->data = malloc(strlen(str) + 1); - strcpy(ret->data, str); - - ret->len = strlen(str); - - return(ret); -} - -void fceustr_destroy(fceustr *str) { - if (str->data) { - free(str->data); - str->data = 0; - } - free(str); - str = 0; -} diff --git a/src/fceustr.h b/src/fceustr.h deleted file mode 100644 index cebf441..0000000 --- a/src/fceustr.h +++ /dev/null @@ -1,9 +0,0 @@ -#ifndef _FCEU_STR_H -#define _FCEU_STR_H - -typedef struct { - uint8 *data; - uint32 len; /* Not including extra NULL character. */ -} fceustr; - -#endif diff --git a/src/fds.c b/src/fds.c index 97a1654..747dd62 100644 --- a/src/fds.c +++ b/src/fds.c @@ -33,7 +33,6 @@ #include "fceu-memory.h" #include "cart.h" #include "md5.h" -#include "netplay.h" // TODO: Add code to put a delay in between the time a disk is inserted // and the when it can be successfully read/written to. This should diff --git a/src/input.c b/src/input.c index 918d41b..893ba3f 100644 --- a/src/input.c +++ b/src/input.c @@ -24,7 +24,6 @@ #include "x6502.h" #include "fceu.h" -#include "netplay.h" #include "input.h" #include "vsuni.h" #include "fds.h" diff --git a/src/input/pads.c b/src/input/pads.c index ae07636..7fedc39 100644 --- a/src/input/pads.c +++ b/src/input/pads.c @@ -20,7 +20,6 @@ #include #include "share.h" -#include "../movie.h" #include "../vsuni.h" static uint8 joy_readbit[2]; diff --git a/src/input/share.h b/src/input/share.h index 36cf1fa..adb39b4 100644 --- a/src/input/share.h +++ b/src/input/share.h @@ -5,8 +5,6 @@ #include "../x6502.h" #include "../palette.h" #include "../state.h" -#include "../netplay.h" - void FCEU_DrawCursor(uint8 *buf, int xc, int yc); void FCEU_DrawGunSight(uint8 *buf, int xc, int yc); diff --git a/src/movie.c b/src/movie.c deleted file mode 100644 index e9a5851..0000000 --- a/src/movie.c +++ /dev/null @@ -1,253 +0,0 @@ -#include -#include -#include - -#include "fceu-types.h" -#include "input.h" -#include "fceu.h" -#include "driver.h" -#include "state.h" -#include "general.h" -#include "video.h" - -static int current = 0; // > 0 for recording, < 0 for playback -static FILE *slots[10] = { 0 }; -static uint8 joop[4]; -static uint32 framets; - -/* Cache variables used for playback. */ -static uint32 nextts; -static int nextd; - - -static int CurrentMovie = 0; -static int MovieShow = 0; - -static int MovieStatus[10]; - -static void DoEncode(int joy, int button, int); - -int FCEUMOV_IsPlaying(void) { - if (current < 0) return(1); - else return(0); -} - -void FCEUI_SaveMovie(char *fname) { - FILE *fp; - char *fn; - - if (current < 0) /* Can't interrupt playback.*/ - return; - - if (current > 0) { /* Stop saving. */ - DoEncode(0, 0, 1); /* Write a dummy timestamp value so that the movie will keep - "playing" after user input has stopped. */ - fclose(slots[current - 1]); - MovieStatus[current - 1] = 1; - current = 0; - FCEU_DispMessage("Movie recording stopped."); - return; - } - - current = CurrentMovie; - - if (fname) - fp = FCEUD_UTF8fopen(fname, "wb"); - else { - fp = FCEUD_UTF8fopen(fn = FCEU_MakeFName(FCEUMKF_MOVIE, CurrentMovie, 0), "wb"); - free(fn); - } - - if (!fp) return; - - FCEUSS_SaveFP(fp); - fseek(fp, 0, SEEK_END); - slots[current] = fp; - memset(joop, 0, sizeof(joop)); - current++; - framets = 0; - FCEUI_SelectMovie(CurrentMovie); /* Quick hack to display status. */ -} - -static void StopPlayback(void) { - fclose(slots[-1 - current]); - current = 0; - FCEU_DispMessage("Movie playback stopped."); -} - -void FCEUMOV_Stop(void) { - if (current < 0) StopPlayback(); -} - -void FCEUI_LoadMovie(char *fname) { - FILE *fp; - char *fn; - - if (current > 0) /* Can't interrupt recording.*/ - return; - - if (current < 0) { /* Stop playback. */ - StopPlayback(); - return; - } - - if (fname) - fp = FCEUD_UTF8fopen(fname, "rb"); - else { - fp = FCEUD_UTF8fopen(fn = FCEU_MakeFName(FCEUMKF_MOVIE, CurrentMovie, 0), "rb"); - free(fn); - } - if (!fp) return; - - if (!FCEUSS_LoadFP(fp)) return; - - current = CurrentMovie; - slots[current] = fp; - - memset(joop, 0, sizeof(joop)); - current = -1 - current; - framets = 0; - nextts = 0; - nextd = -1; - MovieStatus[CurrentMovie] = 1; - FCEUI_SelectMovie(CurrentMovie); /* Quick hack to display status. */ -} - - -static void DoEncode(int joy, int button, int dummy) { - uint8 d; - - d = 0; - - if (framets >= 65536) - d = 3 << 5; - else if (framets >= 256) - d = 2 << 5; - else if (framets > 0) - d = 1 << 5; - - if (dummy) d |= 0x80; - - d |= joy << 3; - d |= button; - - fputc(d, slots[current - 1]); - //printf("Wr: %02x, %d\n",d,slots[current-1]); - while (framets) { - fputc(framets & 0xff, slots[current - 1]); - //printf("Wrts: %02x\n",framets & 0xff); - framets >>= 8; - } -} - -void FCEUMOV_AddJoy(uint8 *js) { - int x, y; - - if (!current) return; /* Not playback nor recording. */ - - if (current < 0) { /* Playback */ - while (nextts == framets) { - int tmp, ti; - uint8 d; - - if (nextd != -1) { - if (nextd & 0x80) { - //puts("Egads"); - FCEU_DoSimpleCommand(nextd & 0x1F); - } else - joop[(nextd >> 3) & 0x3] ^= 1 << (nextd & 0x7); - } - - - tmp = fgetc(slots[-1 - current]); - d = tmp; - - if (tmp < 0) { - StopPlayback(); - return; - } - - nextts = 0; - tmp >>= 5; - tmp &= 0x3; - ti = 0; - - { - int tmpfix = tmp; - while (tmp--) { - nextts |= fgetc(slots[-1 - current]) << (ti * 8); ti++; - } - - // This fixes a bug in movies recorded before version 0.98.11 - // It's probably not necessary, but it may keep away CRAZY PEOPLE who recorded - // movies on <= 0.98.10 and don't work on playback. - if (tmpfix == 1 && !nextts) { - nextts |= fgetc(slots[-1 - current]) << 8; - } else if (tmpfix == 2 && !nextts) { - nextts |= fgetc(slots[-1 - current]) << 16; - } - - framets = 0; - nextd = d; - } - } - memcpy(js, joop, 4); - } else { /* Recording */ - for (x = 0; x < 4; x++) { - if (js[x] != joop[x]) { - for (y = 0; y < 8; y++) - if ((js[x] ^ joop[x]) & (1 << y)) - DoEncode(x, y, 0); - joop[x] = js[x]; - } else if (framets == ((1 << 24) - 1)) DoEncode(0, 0, 1); /* Overflow will happen, so do dummy update. */ - } - } - framets++; -} - -void FCEUMOV_AddCommand(int cmd) { - if (current <= 0) return; /* Return if not recording a movie */ - //printf("%d\n",cmd); - DoEncode((cmd >> 3) & 0x3, cmd & 0x7, 1); -} - -void FCEUMOV_CheckMovies(void) { - FILE *st = NULL; - char *fn; - int ssel; - - for (ssel = 0; ssel < 10; ssel++) { - st = FCEUD_UTF8fopen(fn = FCEU_MakeFName(FCEUMKF_MOVIE, ssel, 0), "rb"); - free(fn); - if (st) { - MovieStatus[ssel] = 1; - fclose(st); - } else - MovieStatus[ssel] = 0; - } -} - -void FCEUI_SelectMovie(int w) { - if (w == -1) { - MovieShow = 0; return; - } - FCEUI_SelectState(-1); - - CurrentMovie = w; - MovieShow = 180; - - if (current > 0) - FCEU_DispMessage("-recording movie %d-", current - 1); - else if (current < 0) - FCEU_DispMessage("-playing movie %d-", -1 - current); - else - FCEU_DispMessage("-select movie-"); -} - -void FCEU_DrawMovies(uint8 *XBuf) { - if (!MovieShow) return; - - FCEU_DrawNumberRow(XBuf, MovieStatus, CurrentMovie); - MovieShow--; -} - diff --git a/src/movie.h b/src/movie.h deleted file mode 100644 index 2976468..0000000 --- a/src/movie.h +++ /dev/null @@ -1,11 +0,0 @@ -#ifndef _FCEU_MOVIE_H -#define _FCEU_MOVIE_H - -void FCEUMOV_AddJoy(uint8 *); -void FCEUMOV_CheckMovies(void); -void FCEUMOV_Stop(void); -void FCEUMOV_AddCommand(int cmd); -void FCEU_DrawMovies(uint8 *); -int FCEUMOV_IsPlaying(void); - -#endif diff --git a/src/netplay.c b/src/netplay.c deleted file mode 100644 index 77bbcaa..0000000 --- a/src/netplay.c +++ /dev/null @@ -1,303 +0,0 @@ -/* FCE Ultra - NES/Famicom Emulator - * - * Copyright notice for this file: - * Copyright (C) 2002 Xodnizel - * - * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - - -#include -#include -#include -#include -#include -#ifdef _WIN32 -#include -#else -#include -#endif -#include - -#include "fceu-types.h" -#include "netplay.h" -#include "fceu.h" -#include "general.h" -#include "state.h" -#include "cheat.h" -#include "input.h" -#include "fceu-endian.h" - -int FCEUnetplay = 0; - -static uint8 netjoy[4]; /* Controller cache. */ -static int numlocal; -static int netdivisor; -static int netdcount; - -/* NetError should only be called after a FCEUD_*Data function returned 0, in the function - that called FCEUD_*Data, to prevent it from being called twice. -*/ - -static void NetError(void) { - FCEU_DispMessage("Network error/connection lost!"); - FCEUD_NetworkClose(); -} - -void FCEUI_NetplayStop(void) { - if (FCEUnetplay) { - FCEUnetplay = 0; - FCEU_FlushGameCheats(0, 1); /* Don't save netplay cheats. */ - FCEU_LoadGameCheats(0); /* Reload our original cheats. */ - } else puts("Check your code!"); -} - -int FCEUI_NetplayStart(int nlocal, int divisor) { - FCEU_FlushGameCheats(0, 0); /* Save our pre-netplay cheats. */ - FCEU_LoadGameCheats(0); /* Load them again, for pre-multiplayer action. */ - FCEUnetplay = 1; - memset(netjoy, 0, sizeof(netjoy)); - numlocal = nlocal; - netdivisor = divisor; - netdcount = 0; - return(1); -} - -int FCEUNET_SendCommand(uint8 cmd, uint32 len) { - uint8 buf[numlocal + 1 + 4]; - - buf[0] = 0xFF; - FCEU_en32lsb(&buf[numlocal], len); - buf[numlocal + 4] = cmd; - #ifdef NETWORK - if (!FCEUD_SendData(buf, numlocal + 1 + 4)) { - NetError(); - return(0); - } - #endif - return(1); -} - -void FCEUI_NetplayText(uint8 *text) { - uint32 len; - - len = strlen(text); - - if (!FCEUNET_SendCommand(FCEUNPCMD_TEXT, len)) return; - - if (!FCEUD_SendData(text, len)) - NetError(); -} - -int FCEUNET_SendFile(uint8 cmd, char *fn) { - uint32 len; - uLongf clen; - char *buf, *cbuf; - FILE *fp; - struct stat sb; - - if (!(fp = FCEUD_UTF8fopen(fn, "rb"))) return(0); - - fstat(fileno(fp), &sb); - len = sb.st_size; - buf = malloc(len); - fread(buf, 1, len, fp); - fclose(fp); - - cbuf = malloc(4 + len + len / 1000 + 12); - FCEU_en32lsb(cbuf, len); - compress2(cbuf + 4, &clen, buf, len, 7); - free(buf); - - //printf("Sending file: %s, %d, %d\n",fn,len,clen); - - len = clen + 4; - - #ifdef NETWORK - if (!FCEUNET_SendCommand(cmd, len)) { - free(cbuf); - return(0); - } - if (!FCEUD_SendData(cbuf, len)) { - NetError(); - free(cbuf); - return(0); - } - #endif - free(cbuf); - return(1); -} - -static FILE *FetchFile(uint32 remlen) { - uint32 clen = remlen; - char *cbuf; - uLongf len; - char *buf; - FILE *fp; - char *fn; - - if (clen > 500000) { // Sanity check - NetError(); - return(0); - } - - //printf("Receiving file: %d...\n",clen); - fn = FCEU_MakeFName(FCEUMKF_NPTEMP, 0, 0); - if ((fp = fopen(fn, "w+b"))) { - cbuf = malloc(clen); - if (!FCEUD_RecvData(cbuf, clen)) { - NetError(); - unlink(fn); - fclose(fp); - free(cbuf); - free(fn); - return(0); - } - - len = FCEU_de32lsb(cbuf); - if (len > 500000) { // Another sanity check - NetError(); - unlink(fn); - fclose(fp); - free(cbuf); - free(fn); - return(0); - } - buf = malloc(len); - uncompress(buf, &len, cbuf + 4, clen - 4); - - fwrite(buf, 1, len, fp); - free(buf); - fseek(fp, 0, SEEK_SET); - unlink(fn); - free(fn); - return(fp); - } - free(fn); - return(0); -} - -void NetplayUpdate(uint8 *joyp) { - static uint8 buf[5]; /* 4 play states, + command/extra byte */ - static uint8 joypb[4]; - - memcpy(joypb, joyp, 4); - - /* This shouldn't happen, but just in case. 0xFF is used as a command escape elsewhere. */ - if (joypb[0] == 0xFF) - joypb[0] = 0xF; - #ifdef NETWORK - if (!netdcount) - if (!FCEUD_SendData(joypb, numlocal)) { - NetError(); - return; - } - - if (!netdcount) - do { - if (!FCEUD_RecvData(buf, 5)) { - NetError(); - return; - } - - switch (buf[4]) { - default: FCEU_DoSimpleCommand(buf[4]); break; - case FCEUNPCMD_TEXT: - { - uint8 *tbuf; - uint32 len = FCEU_de32lsb(buf); - - if (len > 100000) { // Insanity check! - NetError(); - return; - } - tbuf = malloc(len + 1); - tbuf[len] = 0; - if (!FCEUD_RecvData(tbuf, len)) { - NetError(); - free(tbuf); - return; - } - FCEUD_NetplayText(tbuf); - free(tbuf); - } - break; - case FCEUNPCMD_SAVESTATE: - { - char *fn; - FILE *fp; - - /* Send the cheats first, then the save state, since - there might be a frame or two in between the two sendfile - commands on the server side. - */ - fn = FCEU_MakeFName(FCEUMKF_CHEAT, 0, 0); - //if(! - FCEUNET_SendFile(FCEUNPCMD_LOADCHEATS, fn); - - // { - // free(fn); - // return; - // } - free(fn); - if (!FCEUnetplay) return; - - fn = FCEU_MakeFName(FCEUMKF_NPTEMP, 0, 0); - fp = fopen(fn, "wb"); - if (FCEUSS_SaveFP(fp)) { - fclose(fp); - if (!FCEUNET_SendFile(FCEUNPCMD_LOADSTATE, fn)) { - unlink(fn); - free(fn); - return; - } - unlink(fn); - free(fn); - } else { - fclose(fp); - FCEUD_PrintError("File error. (K)ill, (M)aim, (D)estroy? Now!"); - unlink(fn); - free(fn); - return; - } - } - break; - case FCEUNPCMD_LOADCHEATS: - { - FILE *fp = FetchFile(FCEU_de32lsb(buf)); - if (!fp) return; - FCEU_FlushGameCheats(0, 1); - FCEU_LoadGameCheats(fp); - } - break; - case FCEUNPCMD_LOADSTATE: - { - FILE *fp = FetchFile(FCEU_de32lsb(buf)); - if (!fp) return; - if (FCEUSS_LoadFP(fp)) { - fclose(fp); - FCEU_DispMessage("Remote state loaded."); - } else FCEUD_PrintError("File error. (K)ill, (M)aim, (D)estroy?"); - } - break; - } - } while (buf[4]); - #endif - - netdcount = (netdcount + 1) % netdivisor; - - memcpy(netjoy, buf, 4); - *(uint32*)joyp = *(uint32*)netjoy; -} diff --git a/src/netplay.h b/src/netplay.h deleted file mode 100644 index 3837ede..0000000 --- a/src/netplay.h +++ /dev/null @@ -1,28 +0,0 @@ -#ifndef _FCEU_NETPLAY_H -#define _FCEU_NETPLAY_H - -int InitNetplay(void); -void NetplayUpdate(uint8 *joyp); -extern int FCEUnetplay; - - -#define FCEUNPCMD_RESET 0x01 -#define FCEUNPCMD_POWER 0x02 - -#define FCEUNPCMD_VSUNICOIN 0x07 -#define FCEUNPCMD_VSUNIDIP0 0x08 -#define FCEUNPCMD_FDSINSERTx 0x10 -#define FCEUNPCMD_FDSINSERT 0x18 -#define FCEUNPCMD_FDSEJECT 0x19 -#define FCEUNPCMD_FDSSELECT 0x1A - -#define FCEUNPCMD_LOADSTATE 0x80 - -#define FCEUNPCMD_SAVESTATE 0x81 /* Sent from server to client. */ -#define FCEUNPCMD_LOADCHEATS 0x82 -#define FCEUNPCMD_TEXT 0x90 - -int FCEUNET_SendCommand(uint8, uint32); -int FCEUNET_SendFile(uint8 cmd, char *); - -#endif diff --git a/src/sound.c b/src/sound.c index f07794a..f60083e 100644 --- a/src/sound.c +++ b/src/sound.c @@ -30,7 +30,6 @@ #include "sound.h" #include "filter.h" #include "state.h" -#include "wave.h" static uint32 wlookup1[32]; static uint32 wlookup2[203]; diff --git a/src/state.c b/src/state.c index 5958970..945b7a7 100644 --- a/src/state.c +++ b/src/state.c @@ -35,10 +35,8 @@ #include "fds.h" #include "general.h" #include "state.h" -#include "movie.h" #include "fceu-memory.h" #include "ppu.h" -#include "netplay.h" #include "video.h" static void (*SPreSave)(void); diff --git a/src/vsuni.c b/src/vsuni.c index a3a6912..c201cff 100644 --- a/src/vsuni.c +++ b/src/vsuni.c @@ -25,7 +25,6 @@ #include "x6502.h" #include "fceu.h" #include "input.h" -#include "netplay.h" #include "vsuni.h" #include "state.h" diff --git a/src/wave.c b/src/wave.c deleted file mode 100644 index d055f26..0000000 --- a/src/wave.c +++ /dev/null @@ -1,104 +0,0 @@ -#include - -#include "fceu-types.h" -#include "fceu.h" - -#include "driver.h" -#include "sound.h" -#include "wave.h" - -static FILE *soundlog = 0; -static long wsize; - -// Checking whether the file exists before wiping it out is left up to the -// reader..err...I mean, the driver code, if it feels so inclined(I don't feel -// so). - -void FCEU_WriteWaveData(int32 *Buffer, int Count) { - int16 temp[Count]; /* Yay. Is this the first use of this "feature" of C in FCE Ultra? */ - int16 *dest; - int x; - - if (!soundlog) return; - - dest = temp; - x = Count; - - while (x--) { - int16 tmp = *Buffer; - - *(uint8*)dest = (((uint16)tmp) & 255); - *(((uint8*)dest) + 1) = (((uint16)tmp) >> 8); - dest++; - Buffer++; - } - wsize += fwrite(temp, 1, Count * sizeof(int16), soundlog); -} - -int FCEUI_EndWaveRecord(void) { - long s; - - if (!soundlog) return 0; - s = ftell(soundlog) - 8; - fseek(soundlog, 4, SEEK_SET); - fputc(s & 0xFF, soundlog); - fputc((s >> 8) & 0xFF, soundlog); - fputc((s >> 16) & 0xFF, soundlog); - fputc((s >> 24) & 0xFF, soundlog); - - fseek(soundlog, 0x28, SEEK_SET); - s = wsize; - fputc(s & 0xFF, soundlog); - fputc((s >> 8) & 0xFF, soundlog); - fputc((s >> 16) & 0xFF, soundlog); - fputc((s >> 24) & 0xFF, soundlog); - - fclose(soundlog); - soundlog = 0; - return 1; -} - - -int FCEUI_BeginWaveRecord(char *fn) { - int r; - - if (!(soundlog = FCEUD_UTF8fopen(fn, "wb"))) - return 0; - wsize = 0; - - // Write the header. - fputs("RIFF", soundlog); - fseek(soundlog, 4, SEEK_CUR); // Skip size - fputs("WAVEfmt ", soundlog); - - fputc(0x10, soundlog); - fputc(0, soundlog); - fputc(0, soundlog); - fputc(0, soundlog); - - fputc(1, soundlog); // PCM - fputc(0, soundlog); - - fputc(1, soundlog); // Monophonic - fputc(0, soundlog); - - r = FSettings.SndRate; - fputc(r & 0xFF, soundlog); - fputc((r >> 8) & 0xFF, soundlog); - fputc((r >> 16) & 0xFF, soundlog); - fputc((r >> 24) & 0xFF, soundlog); - r <<= 1; - fputc(r & 0xFF, soundlog); - fputc((r >> 8) & 0xFF, soundlog); - fputc((r >> 16) & 0xFF, soundlog); - fputc((r >> 24) & 0xFF, soundlog); - fputc(2, soundlog); - fputc(0, soundlog); - fputc(16, soundlog); - fputc(0, soundlog); - - fputs("data", soundlog); - fseek(soundlog, 4, SEEK_CUR); - - return(1); -} diff --git a/src/wave.h b/src/wave.h deleted file mode 100644 index b8afc09..0000000 --- a/src/wave.h +++ /dev/null @@ -1,6 +0,0 @@ -#ifndef _FCEU_WAVE_H -#define _FCEU_WAVE_H - -void FCEU_WriteWaveData(int32 *Buffer, int Count); - -#endif