Remove unused files
This commit is contained in:
16
src/driver.h
16
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. */
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -1,29 +0,0 @@
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#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;
|
||||
}
|
||||
@@ -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
|
||||
@@ -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
|
||||
|
||||
@@ -24,7 +24,6 @@
|
||||
#include "x6502.h"
|
||||
|
||||
#include "fceu.h"
|
||||
#include "netplay.h"
|
||||
#include "input.h"
|
||||
#include "vsuni.h"
|
||||
#include "fds.h"
|
||||
|
||||
@@ -20,7 +20,6 @@
|
||||
|
||||
#include <string.h>
|
||||
#include "share.h"
|
||||
#include "../movie.h"
|
||||
#include "../vsuni.h"
|
||||
|
||||
static uint8 joy_readbit[2];
|
||||
|
||||
@@ -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);
|
||||
|
||||
253
src/movie.c
253
src/movie.c
@@ -1,253 +0,0 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#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--;
|
||||
}
|
||||
|
||||
11
src/movie.h
11
src/movie.h
@@ -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
|
||||
303
src/netplay.c
303
src/netplay.c
@@ -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 <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#ifdef _WIN32
|
||||
#include <direct.h>
|
||||
#else
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
#include <zlib.h>
|
||||
|
||||
#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;
|
||||
}
|
||||
@@ -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
|
||||
@@ -30,7 +30,6 @@
|
||||
#include "sound.h"
|
||||
#include "filter.h"
|
||||
#include "state.h"
|
||||
#include "wave.h"
|
||||
|
||||
static uint32 wlookup1[32];
|
||||
static uint32 wlookup2[203];
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -25,7 +25,6 @@
|
||||
#include "x6502.h"
|
||||
#include "fceu.h"
|
||||
#include "input.h"
|
||||
#include "netplay.h"
|
||||
#include "vsuni.h"
|
||||
#include "state.h"
|
||||
|
||||
|
||||
104
src/wave.c
104
src/wave.c
@@ -1,104 +0,0 @@
|
||||
#include <stdio.h>
|
||||
|
||||
#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);
|
||||
}
|
||||
@@ -1,6 +0,0 @@
|
||||
#ifndef _FCEU_WAVE_H
|
||||
#define _FCEU_WAVE_H
|
||||
|
||||
void FCEU_WriteWaveData(int32 *Buffer, int Count);
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user