Kill most (non-const) static vars in header files

This commit is contained in:
jeblanchard 2008-05-29 06:24:39 +00:00
parent 6755343a52
commit ce72bbad0b
11 changed files with 88 additions and 80 deletions

View File

@ -52,12 +52,12 @@ int CLImain(int argc, char *argv[]);
// GamePad defaults
#define GAMEPAD_NUM_DEVICES 4
#define GAMEPAD_NUM_BUTTONS 10
static char *GamePadNames[GAMEPAD_NUM_BUTTONS] =
static const char *GamePadNames[GAMEPAD_NUM_BUTTONS] =
{"A", "B", "Select", "Start",
"Up", "Down", "Left", "Right", "TurboA", "TurboB"};
static char *DefaultGamePadDevice[GAMEPAD_NUM_DEVICES] =
static const char *DefaultGamePadDevice[GAMEPAD_NUM_DEVICES] =
{"Keyboard", "None", "None", "None"};
static int DefaultGamePad[GAMEPAD_NUM_DEVICES][GAMEPAD_NUM_BUTTONS] =
static const int DefaultGamePad[GAMEPAD_NUM_DEVICES][GAMEPAD_NUM_BUTTONS] =
{ { SDLK_KP2, SDLK_KP3, SDLK_TAB, SDLK_RETURN,
SDLK_w, SDLK_s, SDLK_a, SDLK_d, 0, 0 },
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
@ -67,11 +67,11 @@ static int DefaultGamePad[GAMEPAD_NUM_DEVICES][GAMEPAD_NUM_BUTTONS] =
// PowerPad defaults
#define POWERPAD_NUM_DEVICES 2
#define POWERPAD_NUM_BUTTONS 12
static char *PowerPadNames[POWERPAD_NUM_BUTTONS] =
static const char *PowerPadNames[POWERPAD_NUM_BUTTONS] =
{"0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "A", "B"};
static char *DefaultPowerPadDevice[POWERPAD_NUM_DEVICES] =
static const char *DefaultPowerPadDevice[POWERPAD_NUM_DEVICES] =
{"Keyboard", "None"};
static int DefaultPowerPad[POWERPAD_NUM_DEVICES][POWERPAD_NUM_BUTTONS] =
static const int DefaultPowerPad[POWERPAD_NUM_DEVICES][POWERPAD_NUM_BUTTONS] =
{ { SDLK_o, SDLK_p, SDLK_LEFTBRACKET, SDLK_RIGHTBRACKET,
SDLK_k, SDLK_l, SDLK_SEMICOLON, SDLK_QUOTE,
SDLK_m, SDLK_COMMA, SDLK_PERIOD, SDLK_SLASH },
@ -79,53 +79,53 @@ static int DefaultPowerPad[POWERPAD_NUM_DEVICES][POWERPAD_NUM_BUTTONS] =
// QuizKing defaults
#define QUIZKING_NUM_BUTTONS 6
static char *QuizKingNames[QUIZKING_NUM_BUTTONS] =
static const char *QuizKingNames[QUIZKING_NUM_BUTTONS] =
{ "0", "1", "2", "3", "4", "5" };
static char *DefaultQuizKingDevice = "Keyboard";
static int DefaultQuizKing[QUIZKING_NUM_BUTTONS] =
static const char *DefaultQuizKingDevice = "Keyboard";
static const int DefaultQuizKing[QUIZKING_NUM_BUTTONS] =
{ SDLK_q, SDLK_w, SDLK_e, SDLK_r, SDLK_t, SDLK_y };
// HyperShot defaults
#define HYPERSHOT_NUM_BUTTONS 4
static char *HyperShotNames[HYPERSHOT_NUM_BUTTONS] =
static const char *HyperShotNames[HYPERSHOT_NUM_BUTTONS] =
{ "0", "1", "2", "3" };
static char *DefaultHyperShotDevice = "Keyboard";
static int DefaultHyperShot[HYPERSHOT_NUM_BUTTONS] =
static const char *DefaultHyperShotDevice = "Keyboard";
static const int DefaultHyperShot[HYPERSHOT_NUM_BUTTONS] =
{ SDLK_q, SDLK_w, SDLK_e, SDLK_r };
// Mahjong defaults
#define MAHJONG_NUM_BUTTONS 21
static char *MahjongNames[MAHJONG_NUM_BUTTONS] =
static const char *MahjongNames[MAHJONG_NUM_BUTTONS] =
{ "00", "01", "02", "03", "04", "05", "06", "07",
"08", "09", "10", "11", "12", "13", "14", "15",
"16", "17", "18", "19", "20" };
static char *DefaultMahjongDevice = "Keyboard";
static int DefaultMahjong[MAHJONG_NUM_BUTTONS] =
static const char *DefaultMahjongDevice = "Keyboard";
static const int DefaultMahjong[MAHJONG_NUM_BUTTONS] =
{ SDLK_q, SDLK_w, SDLK_e, SDLK_r, SDLK_t, SDLK_a, SDLK_s, SDLK_d,
SDLK_f, SDLK_g, SDLK_h, SDLK_j, SDLK_k, SDLK_l, SDLK_z, SDLK_x,
SDLK_c, SDLK_v, SDLK_b, SDLK_n, SDLK_m };
// TopRider defaults
#define TOPRIDER_NUM_BUTTONS 8
static char *TopRiderNames[TOPRIDER_NUM_BUTTONS] =
static const char *TopRiderNames[TOPRIDER_NUM_BUTTONS] =
{ "0", "1", "2", "3", "4", "5", "6", "7" };
static char *DefaultTopRiderDevice = "Keyboard";
static int DefaultTopRider[TOPRIDER_NUM_BUTTONS] =
static const char *DefaultTopRiderDevice = "Keyboard";
static const int DefaultTopRider[TOPRIDER_NUM_BUTTONS] =
{ SDLK_q, SDLK_w, SDLK_e, SDLK_r, SDLK_t, SDLK_y, SDLK_u, SDLK_i };
// FTrainer defaults
#define FTRAINER_NUM_BUTTONS 12
static char *FTrainerNames[FTRAINER_NUM_BUTTONS] =
static const char *FTrainerNames[FTRAINER_NUM_BUTTONS] =
{ "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "A", "B" };
static char *DefaultFTrainerDevice = "Keyboard";
static int DefaultFTrainer[FTRAINER_NUM_BUTTONS] =
static const char *DefaultFTrainerDevice = "Keyboard";
static const int DefaultFTrainer[FTRAINER_NUM_BUTTONS] =
{ SDLK_o, SDLK_p, SDLK_LEFTBRACKET, SDLK_RIGHTBRACKET,
SDLK_k, SDLK_l, SDLK_SEMICOLON, SDLK_QUOTE,
SDLK_m, SDLK_COMMA, SDLK_PERIOD, SDLK_SLASH };
// FamilyKeyBoard defaults
#define FAMILYKEYBOARD_NUM_BUTTONS 0x48
static char *FamilyKeyBoardNames[FAMILYKEYBOARD_NUM_BUTTONS] =
static const char *FamilyKeyBoardNames[FAMILYKEYBOARD_NUM_BUTTONS] =
{ "F1", "F2", "F3", "F4", "F5", "F6", "F7", "F8",
"1", "2", "3", "4", "5", "6", "7", "8", "9", "0",
"MINUS", "EQUAL", "BACKSLASH", "BACKSPACE",
@ -137,8 +137,8 @@ static char *FamilyKeyBoardNames[FAMILYKEYBOARD_NUM_BUTTONS] =
"PERIOD", "SLASH", "RIGHTALT", "RIGHTSHIFT", "LEFTALT", "SPACE",
"DELETE", "END", "PAGEDOWN",
"CURSORUP", "CURSORLEFT", "CURSORRIGHT", "CURSORDOWN" };
static char *DefaultFamilyKeyBoardDevice = "Keyboard";
static int DefaultFamilyKeyBoard[FAMILYKEYBOARD_NUM_BUTTONS] =
static const char *DefaultFamilyKeyBoardDevice = "Keyboard";
static const int DefaultFamilyKeyBoard[FAMILYKEYBOARD_NUM_BUTTONS] =
{ SDLK_F1, SDLK_F2, SDLK_F3, SDLK_F4, SDLK_F5, SDLK_F6, SDLK_F7, SDLK_F8,
SDLK_1, SDLK_2, SDLK_3, SDLK_4, SDLK_5,
SDLK_6, SDLK_7, SDLK_8, SDLK_9, SDLK_0,

View File

@ -42,6 +42,7 @@ extern int input_display;
extern char *BasicBotDir;
extern int allowUDLR;
extern int pauseAfterPlayback;
extern int EnableBackgroundInput;
//window positions:
extern int ChtPosX,ChtPosY;

View File

@ -116,6 +116,9 @@ int soundvolume = 100;
int soundquality = 0;
double saspectw = 1, saspecth = 1;
double winsizemulx = 1, winsizemuly = 1;
int genie = 0;
int pal_emulation = 0;
int ntsccol = 0, ntsctint, ntschue;
// Contains the names of the overridden standard directories
@ -616,14 +619,14 @@ int main(int argc,char *argv[])
/* Bleh, need to find a better place for this. */
{
pal_emulation &= 1;
pal_emulation = !!pal_emulation;
FCEUI_SetVidSystem(pal_emulation);
genie &= 1;
genie = !!genie;
FCEUI_SetGameGenie(genie);
fullscreen &= 1;
soundo &= 1;
fullscreen = !!fullscreen;
soundo = !!soundo;
FCEUI_SetSoundVolume(soundvolume);
FCEUI_SetSoundQuality(soundquality);
@ -1226,6 +1229,8 @@ FILE *FCEUD_UTF8fopen(const char *n, const char *m)
return(fopen(n, m));
}
int status_icon = 1;
int FCEUD_ShowStatusIcon(void)
{
return status_icon;

View File

@ -26,15 +26,14 @@ extern int maxconbskip;
extern int ffbskip;
static int fullscreen = 0;
static int soundflush = 0;
// Flag that indicates whether Game Genie is enabled or not.
static int genie = 0;
extern int genie;
// Flag that indicates whether PAL Emulation is enabled or not.
static int pal_emulation = 0;
static int status_icon = 1;
extern int pal_emulation;
extern int status_icon;
static int vmod = 0;
extern int vmod;
static char *gfsdir=0;
extern char* directory_names[13];
@ -62,30 +61,27 @@ static const char *default_directory_names[12] = {
extern double saspectw, saspecth;
extern double winsizemulx, winsizemuly;
static int winwidth, winheight;
static int ismaximized = 0;
extern int ismaximized;
extern int soundoptions;
extern int soundrate;
extern int soundbuftime;
extern int soundvolume;
extern int soundquality;
static uint8 cpalette[192];
extern uint8 cpalette[192];
extern int srendlinen;
extern int erendlinen;
extern int srendlinep;
extern int erendlinep;
static int ntsccol = 0, ntsctint, ntschue;
extern int ntsccol, ntsctint, ntschue;
//mbg merge 7/17/06 did these have to be unsigned?
//static int srendline, erendline;
static int changerecursive=0;
static volatile int nofocus = 0;
/**
* Contains the base directory of FCE
**/

View File

@ -3,6 +3,8 @@
#include "window.h"
#include "gui.h"
uint8 cpalette[192];
/**
* Prompts the user for a palette file and opens that file.
*

View File

@ -40,6 +40,22 @@ int disvaccel = 0; /* Disable video hardware acceleration. */
int fssync=0;
int winsync=0;
int winspecial = 0;
int vmod = 0;
vmdef vmodes[11]={
{320,240,8,0,1,1,0}, //0
{320,240,8,0,1,1,0}, //1
{512,384,8,0,1,1,0}, //2
{640,480,8,0,1,1,0}, //3
{640,480,8,0,1,1,0}, //4
{640,480,8,0,1,1,0}, //5
{640,480,8,VMDF_DXBLT,2,2,0}, //6
{1024,768,8,VMDF_DXBLT,4,3,0}, //7
{1280,1024,8,VMDF_DXBLT,5,4,0}, //8
{1600,1200,8,VMDF_DXBLT,6,5,0}, //9
{800,600,8,VMDF_DXBLT|VMDF_STRFS,0,0} //10
};
PALETTEENTRY *color_palette;

View File

@ -38,21 +38,8 @@ typedef struct {
} vmdef;
// left, top, right, bottom
static vmdef vmodes[11]={
{320,240,8,0,1,1,0}, //0
{320,240,8,0,1,1,0}, //1
{512,384,8,0,1,1,0}, //2
{640,480,8,0,1,1,0}, //3
{640,480,8,0,1,1,0}, //4
{640,480,8,0,1,1,0}, //5
{640,480,8,VMDF_DXBLT,2,2,0}, //6
{1024,768,8,VMDF_DXBLT,4,3,0}, //7
{1280,1024,8,VMDF_DXBLT,5,4,0}, //8
{1600,1200,8,VMDF_DXBLT,6,5,0}, //9
{800,600,8,VMDF_DXBLT|VMDF_STRFS,0,0} //10
};
static int winspecial = 0;
extern vmdef vmodes[11];
extern int winspecial;
extern int disvaccel;
extern int fssync;

View File

@ -77,6 +77,8 @@ void MapInput(void);
// Internal variables
int pauseAfterPlayback = 0;
static int winwidth, winheight;
static volatile int nofocus = 0;
// Contains recent file strings
char *recent_files[] = { 0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 };
@ -86,7 +88,10 @@ const unsigned int MENU_FIRST_RECENT_FILE = 600;
const unsigned int MAX_NUMBER_OF_RECENT_FILES = sizeof(recent_files)/sizeof(*recent_files);
const unsigned int MAX_NUMBER_OF_RECENT_DIRS = sizeof(recent_directories)/sizeof(*recent_directories);
// Exported variables
HWND pwindow;
int EnableBackgroundInput = 0;
int ismaximized = 0;
/**
* Menu handle of the main menu.
@ -96,7 +101,6 @@ static HMENU fceumenu = 0;
static int tog = 0;
static int CheckedAutoFirePattern = MENU_AUTOFIRE_PATTERN_1;
static int CheckedAutoFireOffset = MENU_AUTOFIRE_OFFSET_1;
//static int EnableBackgroundInput = 0;
static HMENU recentmenu, recentdmenu;

View File

@ -12,8 +12,6 @@ struct CreateMovieParameters
char* szSavestateFilename;
};
static int EnableBackgroundInput = 0;
extern char *recent_files[];
extern char *recent_directories[10];
extern HWND pwindow;

View File

@ -1,41 +1,37 @@
#define SQ2NCOEFFS 1024
static int32 sq2coeffs[SQ2NCOEFFS];
static int32 SQ2C44100NTSC[SQ2NCOEFFS/2]=
static const int32 SQ2C44100NTSC[SQ2NCOEFFS/2]=
{
#include "fir/c44100ntsc.h"
};
static int32 SQ2C48000NTSC[SQ2NCOEFFS/2]=
static const int32 SQ2C48000NTSC[SQ2NCOEFFS/2]=
{
#include "fir/c48000ntsc.h"
};
static int32 SQ2C96000NTSC[SQ2NCOEFFS/2]=
static const int32 SQ2C96000NTSC[SQ2NCOEFFS/2]=
{
#include "fir/c96000ntsc.h"
};
static int32 SQ2C44100PAL[SQ2NCOEFFS/2]=
static const int32 SQ2C44100PAL[SQ2NCOEFFS/2]=
{
#include "fir/c44100pal.h"
};
static int32 SQ2C48000PAL[SQ2NCOEFFS/2]=
static const int32 SQ2C48000PAL[SQ2NCOEFFS/2]=
{
#include "fir/c48000pal.h"
};
static int32 SQ2C96000PAL[SQ2NCOEFFS/2]=
static const int32 SQ2C96000PAL[SQ2NCOEFFS/2]=
{
#include "fir/c96000pal.h"
};
#define NCOEFFS 484
static int32 coeffs[NCOEFFS];
/* 96000hz filter could probably be improved. */
/*
@ -50,7 +46,7 @@ Stopband attenuation: 103.0 dB
Coefficients:
*/
static int32 C96000NTSC[NCOEFFS/2]=
static const int32 C96000NTSC[NCOEFFS/2]=
{
/*0*/ 65536*16* -5.9950991853042605E-6
/*1*/, 65536*16* -3.0394382502604395E-6
@ -309,7 +305,7 @@ Stopband attenuation: 114.0 dB
Coefficients:
*/
static int32 C96000PAL[NCOEFFS/2]=
static const int32 C96000PAL[NCOEFFS/2]=
{
/*0*/ 65536*16* 3.850781559466991E-7
/*1*/, 65536*16* -1.280019401722687E-6
@ -565,7 +561,7 @@ Passband ripple: 0.1 dB
Transition band: 0.005625
Stopband attenuation: 60.0 dB
*/
static int32 C48000NTSC[NCOEFFS/2]=
static const int32 C48000NTSC[NCOEFFS/2]=
{
/*0*/ 65536*16* -1.2211019733097893E-4
/*1*/ , 65536*16* 5.374660789759626E-4
@ -826,7 +822,7 @@ Stopband attenuation: 66.4 dB
Coefficients:
*/
static int32 C44100NTSC[NCOEFFS/2]=
static const int32 C44100NTSC[NCOEFFS/2]=
{
/*0*/ 65536 *16 * 2.7250584077004043E-4
/*1*/, 65536 *16 * -5.6651407794062126E-5
@ -1084,7 +1080,7 @@ Stopband attenuation: 63.0 dB
Coefficients:
*/
static int32 C48000PAL[NCOEFFS/2]=
static const int32 C48000PAL[NCOEFFS/2]=
{
/*0*/ 65536 *16 * -4.8720337170268194E-4
/*1*/, 65536 *16 * 7.629902642634879E-7
@ -1342,7 +1338,7 @@ Stopband attenuation: 60.5 dB
Coefficients:
*/
static int32 C44100PAL[NCOEFFS/2]=
static const int32 C44100PAL[NCOEFFS/2]=
{
/*0*/ 65536 *16 * 5.793783958720019E-4
/*1*/, 65536 *16 * 1.0571291666629312E-4

View File

@ -12,6 +12,9 @@
#include "fcoeffs.h"
static int32 sq2coeffs[SQ2NCOEFFS];
static int32 coeffs[NCOEFFS];
static uint32 mrindex;
static uint32 mrratio;
@ -124,7 +127,7 @@ int32 NeoFilterSound(int32 *in, int32 *out, uint32 inlen, int32 *leftover)
{
int32 acc=0,acc2=0;
unsigned int c;
int32 *S,*D;
const int32 *S,*D;
for(c=NCOEFFS,S=&in[(x>>16)-NCOEFFS],D=coeffs;c;c--,D++)
{
@ -162,12 +165,12 @@ int32 NeoFilterSound(int32 *in, int32 *out, uint32 inlen, int32 *leftover)
void MakeFilters(int32 rate)
{
int32 *tabs[6]={C44100NTSC,C44100PAL,C48000NTSC,C48000PAL,C96000NTSC,
const int32 *tabs[6]={C44100NTSC,C44100PAL,C48000NTSC,C48000PAL,C96000NTSC,
C96000PAL};
int32 *sq2tabs[6]={SQ2C44100NTSC,SQ2C44100PAL,SQ2C48000NTSC,SQ2C48000PAL,
const int32 *sq2tabs[6]={SQ2C44100NTSC,SQ2C44100PAL,SQ2C48000NTSC,SQ2C48000PAL,
SQ2C96000NTSC,SQ2C96000PAL};
int32 *tmp;
const int32 *tmp;
int32 x;
uint32 nco;