Changes that allow a Linux machine to build, targeting either a Linux or Win32 host. (Maybe a newline at the end of a few header files for my sanity's sake too.)

This commit is contained in:
jeblanchard 2008-05-27 05:29:00 +00:00
parent 4c398a4a01
commit 9b7f730b43
30 changed files with 221 additions and 97 deletions

View File

@ -4,19 +4,23 @@ import sys
# XXX path separator fixed right now # XXX path separator fixed right now
opts = Options() opts = Options()
opts.AddOptions( opts.AddOptions(
BoolOption('PSS_STYLE', 'Path separator style', 1), BoolOption('DEBUG', 'Build with debugging information', 1),
#BoolOption('PSS_STYLE', 'Path separator style', 1),
BoolOption('LSB_FIRST', 'Least significant byte first?', None), BoolOption('LSB_FIRST', 'Least significant byte first?', None),
BoolOption('FRAMESKIP', 'Enable frameskipping', 1), BoolOption('FRAMESKIP', 'Enable frameskipping', 0),
BoolOption('OPENGL', 'Enable OpenGL support', 1) BoolOption('OPENGL', 'Enable OpenGL support (SDL only)', 1)
) )
env = Environment(options = opts, env = Environment(options = opts)
CPPDEFINES={'PSS_STYLE' : '${PSS_STYLE}'})
if os.environ.has_key('PLATFORM'):
env.Replace(PLATFORM = os.environ['PLATFORM'])
if os.environ.has_key('CC'): if os.environ.has_key('CC'):
env.Replace(CC = os.environ['CC']) env.Replace(CC = os.environ['CC'])
if os.environ.has_key('CXX'): if os.environ.has_key('CXX'):
env.Replace(CXX = os.environ['CXX']) env.Replace(CXX = os.environ['CXX'])
if os.environ.has_key('WINDRES'):
env.Append(WINDRES = os.environ['WINDRES'])
if os.environ.has_key('CFLAGS'): if os.environ.has_key('CFLAGS'):
env.Append(CCFLAGS = os.environ['CFLAGS']) env.Append(CCFLAGS = os.environ['CFLAGS'])
if os.environ.has_key('LDFLAGS'): if os.environ.has_key('LDFLAGS'):
@ -33,6 +37,17 @@ if env['PLATFORM'] == 'cygwin':
env['LIBS'] = ['wsock32']; env['LIBS'] = ['wsock32'];
conf = Configure(env) conf = Configure(env)
if env['PLATFORM'] == 'win32':
conf.env.Append(CPPPATH = [".", "drivers/win/", "drivers/common/", "drivers/", "drivers/win/zlib", "drivers/win/directx"])
conf.env.Append(CPPDEFINES = ["PSS_STYLE=2", "WIN32", "_USE_SHARED_MEMORY_", "NETWORK", "FCEUDEF_DEBUGGER", "NOMINMAX", "_WIN32_IE=0x0300"])
conf.env.Append(LIBS = ["rpcrt4", "comctl32", "vfw32", "winmm", "ws2_32", "comdlg32", "ole32", "gdi32"])
if env.has_key('DEBUG'):
if env['DEBUG']:
conf.env.Append(CCFLAGS = " -g")
conf.env.Append(CPPDEFINES = ["_DEBUG"])
else: # Should we do this?
conf.env.Append(CCFLAGS = " -O3 -fomit-frame-pointer")
else:
if not conf.CheckLib('SDL'): if not conf.CheckLib('SDL'):
print 'Did not find libSDL or SDL.lib, exiting!' print 'Did not find libSDL or SDL.lib, exiting!'
Exit(1) Exit(1)
@ -43,25 +58,26 @@ if conf.CheckFunc('asprintf'):
conf.env.Append(CCFLAGS = " -DHAVE_ASPRINTF") conf.env.Append(CCFLAGS = " -DHAVE_ASPRINTF")
if env['OPENGL'] and conf.CheckLibWithHeader('GL', 'GL/gl.h', 'c++', autoadd=1): if env['OPENGL'] and conf.CheckLibWithHeader('GL', 'GL/gl.h', 'c++', autoadd=1):
conf.env.Append(CCFLAGS = " -DOPENGL") conf.env.Append(CCFLAGS = " -DOPENGL")
# parse SDL cflags/libs
env.ParseConfig('sdl-config --cflags --libs')
conf.env.Append(CPPDEFINES = " PSS_STYLE=1")
env = conf.Finish() env = conf.Finish()
# option specified # option specified
if env.has_key('LSB_FIRST'): if env.has_key('LSB_FIRST'):
if env['LSB_FIRST']: if env['LSB_FIRST']:
env.Append(CCFLAGS = ' -DLSB_FIRST') env.Append(CPPDEFINES = ['LSB_FIRST'])
# option not specified, check host system # option not specified, check host system
elif sys.byteorder == 'little': elif sys.byteorder == 'little' or env['PLATFORM'] == 'win32':
env.Append(CCFLAGS = ' -DLSB_FIRST') env.Append(CPPDEFINES = ['LSB_FIRST'])
if env['FRAMESKIP']: if env['FRAMESKIP']:
env.Append(CCFLAGS = ' -DFRAMESKIP') env.Append(CPPDEFINES = ['FRAMESKIP'])
# parse SDL cflags/libs print "CPPDEFINES:",env['CPPDEFINES']
env.ParseConfig('sdl-config --cflags --libs') print "CCFLAGS:",env['CCFLAGS']
#print "LIBS:",env['LIBS']
print "LIBS:",env['CCFLAGS']
#env['IBS'] = ['wsock32', 'SDL', 'z', 'mingw32', 'SDL']
Export('env') Export('env')
SConscript(['src/SConscript']) SConscript(['src/SConscript'])

View File

@ -29,7 +29,6 @@ movie.cpp
subdirs = Split(""" subdirs = Split("""
boards boards
drivers/common drivers/common
drivers/sdl
fir fir
input input
utils utils
@ -42,6 +41,11 @@ Export('env')
for dir in subdirs: for dir in subdirs:
subdir_files = SConscript('%s/SConscript' % dir) subdir_files = SConscript('%s/SConscript' % dir)
file_list.append(subdir_files) file_list.append(subdir_files)
if env['PLATFORM'] == 'win32':
platform_files = SConscript('drivers/win/SConscript')
else:
platform_files = SConscript('drivers/sdl/SConscript')
file_list.append(platform_files)
print env['LINKFLAGS'] print env['LINKFLAGS']

View File

@ -208,7 +208,7 @@ KeyboardCommands()
// f5 to save state, Shift-f5 to save movie // f5 to save state, Shift-f5 to save movie
if(keyonly(F5)) { if(keyonly(F5)) {
if(is_shift) { if(is_shift) {
FCEUI_SaveMovie(NULL,0,NULL); FCEUI_SaveMovie(NULL,0);
} else { } else {
FCEUI_SaveState(NULL); FCEUI_SaveState(NULL);
} }

View File

@ -532,4 +532,4 @@ void FCEUI_AviVideoUpdate(const unsigned char* buffer) { }
int FCEUD_ShowStatusIcon(void) {return 0;} int FCEUD_ShowStatusIcon(void) {return 0;}
int FCEUI_AviIsRecording(void) {return 0;} int FCEUI_AviIsRecording(void) {return 0;}
void FCEUI_UseInputPreset(int preset) { } void FCEUI_UseInputPreset(int preset) { }
bool FCEUD_PauseAfterPlayback() { return false; }

View File

@ -0,0 +1,59 @@
Import('env')
my_list = Split("""
args.cpp
aviout.cpp
basicbot.cpp
cdlogger.cpp
cheat.cpp
common.cpp
config.cpp
debugger.cpp
debuggersp.cpp
directories.cpp
gui.cpp
guiconfig.cpp
input.cpp
joystick.cpp
keyboard.cpp
log.cpp
main.cpp
mapinput.cpp
memview.cpp
memviewsp.cpp
memwatch.cpp
monitor.cpp
netplay.cpp
ntview.cpp
OutputDS.cpp
palette.cpp
ppuview.cpp
pref.cpp
replay.cpp
sound.cpp
state.cpp
tasedit.cpp
throttle.cpp
timing.cpp
tracer.cpp
video.cpp
wave.cpp
window.cpp
""")
# TODO this is probably .obj if built on a Windows system...
my_list.append('res.o')
env.Command('res.o', 'res.rc', env['WINDRES'] + ' -o $TARGET $SOURCE')
subdirs = Split("""
directx
zlib""")
for x in range(len(my_list)):
my_list[x] = 'drivers/win/' + my_list[x]
for dir in subdirs:
subdir_files = SConscript('%s/SConscript' % dir)
my_list.append(subdir_files)
Return('my_list')

View File

@ -19,16 +19,16 @@
*/ */
#include "common.h" #include "common.h"
#include "..\..\fceu.h" #include "../../fceu.h"
#include "..\..\cart.h" //mbg merge 7/18/06 moved beneath fceu.h #include "../../cart.h" //mbg merge 7/18/06 moved beneath fceu.h
#include "..\..\x6502.h" #include "../../x6502.h"
#include "..\..\debug.h" #include "../../debug.h"
#include "debugger.h" #include "debugger.h"
#include "tracer.h" #include "tracer.h"
#include "cdlogger.h" #include "cdlogger.h"
#define INESPRIV #define INESPRIV
#include "..\..\ines.h" #include "../../ines.h"
void LoadCDLogFile(); void LoadCDLogFile();
void SaveCDLogFileAs(); void SaveCDLogFileAs();

View File

@ -23,8 +23,8 @@
#include "memview.h" #include "memview.h"
#include "memwatch.h" #include "memwatch.h"
#include "debugger.h" #include "debugger.h"
#include "..\..\fceu.h" #include "../../fceu.h"
#include "..\..\cart.h" #include "../../cart.h"
HWND hCheat; //mbg merge 7/19/06 had to add HWND hCheat; //mbg merge 7/19/06 had to add
int CheatWindow; int CheatWindow;

View File

@ -19,15 +19,16 @@
*/ */
#include "common.h" #include "common.h"
#include "..\..\utils/xstring.h" #include "../../utils/xstring.h"
#include "../../types.h"
#include "debugger.h" #include "debugger.h"
#include "..\..\x6502.h" #include "../../x6502.h"
#include "..\..\fceu.h" #include "../../fceu.h"
#include "..\..\debug.h" #include "../../debug.h"
#include "..\..\nsf.h" #include "../../nsf.h"
#include "..\..\cart.h" #include "../../cart.h"
#include "..\..\ines.h" #include "../../ines.h"
#include "..\..\asm.h" #include "../../asm.h"
#include "tracer.h" #include "tracer.h"
#include "memview.h" #include "memview.h"
#include "cheat.h" #include "cheat.h"

View File

@ -0,0 +1,10 @@
my_list = Split("""
dsound.lib
dxguid.lib
ddraw.lib
dinput.lib
""")
for x in range(len(my_list)):
my_list[x] = 'drivers/win/directx/' + my_list[x]
Return('my_list')

View File

@ -63,7 +63,6 @@ void SetEmulationSpeed(int type);
int FCEUD_TestCommandState(int c); int FCEUD_TestCommandState(int c);
void FCEUD_UpdateInput(); void FCEUD_UpdateInput();
extern const char* ScanNames[];
extern CFGSTRUCT HotkeyConfig[]; extern CFGSTRUCT HotkeyConfig[];
extern int FCEUD_CommandMapping[EMUCMD_MAX]; extern int FCEUD_CommandMapping[EMUCMD_MAX];

View File

@ -62,6 +62,7 @@
//--------------------------- //---------------------------
//mbg merge 6/29/06 - new aboutbox //mbg merge 6/29/06 - new aboutbox
#if defined(MSVC)
#ifdef _M_X64 #ifdef _M_X64
#define _MSVC_ARCH "x64" #define _MSVC_ARCH "x64"
#else #else
@ -77,6 +78,16 @@
#define _Py_STRINGIZE1(X) _Py_STRINGIZE2 ## X #define _Py_STRINGIZE1(X) _Py_STRINGIZE2 ## X
#define _Py_STRINGIZE2(X) #X #define _Py_STRINGIZE2(X) #X
//re: http://72.14.203.104/search?q=cache:HG-okth5NGkJ:mail.python.org/pipermail/python-checkins/2002-November/030704.html+_msc_ver+compiler+version+string&hl=en&gl=us&ct=clnk&cd=5 //re: http://72.14.203.104/search?q=cache:HG-okth5NGkJ:mail.python.org/pipermail/python-checkins/2002-November/030704.html+_msc_ver+compiler+version+string&hl=en&gl=us&ct=clnk&cd=5
#elif defined(__GNUC__)
#ifdef _DEBUG
#define _GCC_BUILD "debug"
#else
#define _GCC_BUILD "release"
#endif
#define __COMPILER__STRING__ "gcc " __VERSION__ " " _GCC_BUILD
#else
#define __COMPILER__STRING__ "unknown"
#endif
// External functions // External functions

View File

@ -5,6 +5,7 @@
#include "keyboard.h" #include "keyboard.h"
#include "gui.h" #include "gui.h"
#include "../../input.h" #include "../../input.h"
#include <commctrl.h>
void KeyboardUpdateState(void); //mbg merge 7/17/06 yech had to add this void KeyboardUpdateState(void); //mbg merge 7/17/06 yech had to add this

View File

@ -21,12 +21,12 @@
#include <algorithm> #include <algorithm>
#include "common.h" #include "common.h"
#include "..\..\types.h" #include "../../types.h"
#include "..\..\debug.h" #include "../../debug.h"
#include "..\..\fceu.h" #include "../../fceu.h"
#include "..\..\cheat.h" #include "../../cheat.h"
#include "..\..\cart.h" #include "../../cart.h"
#include "..\..\ines.h" #include "../../ines.h"
#include "memview.h" #include "memview.h"
#include "debugger.h" #include "debugger.h"
#include "cdlogger.h" #include "cdlogger.h"

View File

@ -19,9 +19,9 @@
*/ */
#include "common.h" #include "common.h"
#include "..\..\fceu.h" #include "../../fceu.h"
#include "memwatch.h" #include "memwatch.h"
#include "..\..\debug.h" #include "../../debug.h"
#include "debugger.h" #include "debugger.h"
const int NUMWATCHES = 24; const int NUMWATCHES = 24;

View File

@ -3,9 +3,9 @@
#include "debugger.h" #include "debugger.h"
#include "debuggersp.h" #include "debuggersp.h"
#include "memwatch.h" #include "memwatch.h"
#include "..\..\fceu.h" #include "../../fceu.h"
#include "..\..\debug.h" #include "../../debug.h"
#include "..\..\conddebug.h" #include "../../conddebug.h"
#include <assert.h> #include <assert.h>
HWND hMonitor = 0; HWND hMonitor = 0;

View File

@ -21,13 +21,13 @@
#include "common.h" #include "common.h"
#include "ntview.h" #include "ntview.h"
#include "debugger.h" #include "debugger.h"
#include "..\..\fceu.h" #include "../../fceu.h"
#include "..\..\debug.h" #include "../../debug.h"
#define INESPRIV #define INESPRIV
#include "..\..\cart.h" #include "../../cart.h"
#include "..\..\ines.h" #include "../../ines.h"
#include "..\..\palette.h" #include "../../palette.h"
#include "..\..\ppu.h" #include "../../ppu.h"
HWND hNTView; HWND hNTView;

Binary file not shown.

View File

@ -22,12 +22,12 @@
#include "common.h" #include "common.h"
#include "debugger.h" #include "debugger.h"
#include "..\..\x6502.h" #include "../../x6502.h"
#include "..\..\fceu.h" #include "../../fceu.h"
#include "..\..\cart.h" //mbg merge 7/19/06 moved after fceu.h #include "../../cart.h" //mbg merge 7/19/06 moved after fceu.h
#include "..\..\file.h" #include "../../file.h"
#include "..\..\debug.h" #include "../../debug.h"
#include "..\..\asm.h" #include "../../asm.h"
#include "cdlogger.h" #include "cdlogger.h"
#include "tracer.h" #include "tracer.h"
#include "memview.h" #include "memview.h"

View File

@ -627,7 +627,7 @@ static void BlitScreenFull(uint8 *XBuf)
"decb %%bl\n\t" "decb %%bl\n\t"
"jne akoop1\n\t" "jne akoop1\n\t"
: :
: "S" (XBuf+srendline*256+VNSCLIP), "D" (ScreenLoc+((240-totallines)/2)*pitch+(640-(VNSWID<<1))/2),"b" (totallines), "c" ((pitch-VNSWID)<<1) : "S" (XBuf+FSettings.FirstSLine*256+VNSCLIP), "D" (ScreenLoc+((240-FSettings.TotalScanlines())/2)*pitch+(640-(VNSWID<<1))/2),"b" (FSettings.TotalScanlines()), "c" ((pitch-VNSWID)<<1)
: "%al", "%edx", "%cc" ); : "%al", "%edx", "%cc" );
} }
else else
@ -649,7 +649,7 @@ static void BlitScreenFull(uint8 *XBuf)
"decb %%bl\n\t" "decb %%bl\n\t"
"jne koop1\n\t" "jne koop1\n\t"
: :
: "S" (XBuf+srendline*256), "D" (ScreenLoc+((240-totallines)/2)*pitch+(640-512)/2),"b" (totallines), "c" (pitch-512+pitch) : "S" (XBuf+FSettings.FirstSLine*256), "D" (ScreenLoc+((240-FSettings.TotalScanlines())/2)*pitch+(640-512)/2),"b" (FSettings.TotalScanlines()), "c" (pitch-512+pitch)
: "%al", "%edx", "%cc" ); : "%al", "%edx", "%cc" );
} }
} }
@ -676,7 +676,7 @@ static void BlitScreenFull(uint8 *XBuf)
"decb %%bl\n\t" "decb %%bl\n\t"
"jne ayoop1\n\t" "jne ayoop1\n\t"
: :
: "S" (XBuf+srendline*256+VNSCLIP), "D" (ScreenLoc+((240-totallines)/2)*pitch+(640-(VNSWID<<1))/2),"b" (totallines), "c" ((pitch-VNSWID)<<1) : "S" (XBuf+FSettings.FirstSLine*256+VNSCLIP), "D" (ScreenLoc+((240-FSettings.TotalScanlines())/2)*pitch+(640-(VNSWID<<1))/2),"b" (FSettings.TotalScanlines()), "c" ((pitch-VNSWID)<<1)
: "%al", "%edx", "%cc" ); : "%al", "%edx", "%cc" );
} }
else else
@ -699,7 +699,7 @@ static void BlitScreenFull(uint8 *XBuf)
"decb %%bl\n\t" "decb %%bl\n\t"
"jne yoop1\n\t" "jne yoop1\n\t"
: :
: "S" (XBuf+srendline*256), "D" (ScreenLoc+((240-totallines)/2)*pitch+(640-512)/2),"b" (totallines), "c" (pitch-512+pitch) : "S" (XBuf+FSettings.FirstSLine*256), "D" (ScreenLoc+((240-FSettings.TotalScanlines())/2)*pitch+(640-512)/2),"b" (FSettings.TotalScanlines()), "c" (pitch-512+pitch)
: "%al", "%edx", "%cc" ); : "%al", "%edx", "%cc" );
} }
} }

View File

@ -1054,7 +1054,10 @@ LRESULT FAR PASCAL AppWndProc(HWND hWnd,UINT msg,WPARAM wParam,LPARAM lParam)
// TODO: Proper stop logging // TODO: Proper stop logging
{ {
MENUITEMINFO mi; MENUITEMINFO mi;
char *str = CreateSoundSave() ? "Stop Sound Logging" : "Log Sound As..."; // Evil:
char *strT = "Stop Sound Logging";
char *strF = "Log Sound As...";
char *str = CreateSoundSave() ? strT : strF;
memset(&mi,0,sizeof(mi)); memset(&mi,0,sizeof(mi));
mi.fMask=MIIM_DATA|MIIM_TYPE; mi.fMask=MIIM_DATA|MIIM_TYPE;

View File

@ -0,0 +1,20 @@
my_list = Split("""
adler32.c
compress.c
crc32.c
deflate.c
gzio.c
infblock.c
infcodes.c
inffast.c
inflate.c
inftrees.c
infutil.c
trees.c
uncompr.c
zutil.c
""")
for x in range(len(my_list)):
my_list[x] = 'drivers/win/zlib/' + my_list[x]
Return('my_list')

View File

@ -6,7 +6,7 @@
#include <vector> #include <vector>
#include <map> #include <map>
#ifdef MSVC #ifdef WIN32
#include <windows.h> #include <windows.h>
#endif #endif
@ -391,7 +391,7 @@ void ParseGIInput(FCEUGI *GI); //mbg merge 7/17/06 - had to add. gross.
void InitOtherInput(void); //mbg merge 7/17/06 - had to add. gross. void InitOtherInput(void); //mbg merge 7/17/06 - had to add. gross.
static void ResetInputTypes() static void ResetInputTypes()
{ {
#ifdef MSVC #ifdef WIN32
extern int UsrInputType[3]; extern int UsrInputType[3];
UsrInputType[0] = SI_GAMEPAD; UsrInputType[0] = SI_GAMEPAD;
UsrInputType[1] = SI_GAMEPAD; UsrInputType[1] = SI_GAMEPAD;

View File

@ -263,7 +263,7 @@ static int ReadStateChunks(FILE *st, int32 totalsize)
extern uint8 *XBackBuf; extern uint8 *XBackBuf;
if(size != fread(XBackBuf,1,size,st)) if(size != fread(XBackBuf,1,size,st))
ret = 0; ret = 0;
#ifdef MSVC #ifdef WIN32
else else
{ {
FCEUD_BlitScreen(XBuf); FCEUD_BlitScreen(XBuf);

View File

@ -151,7 +151,7 @@ void FCEU_PutImageDummy(void)
FCEU_DrawSaveStates(XBuf); FCEU_DrawSaveStates(XBuf);
FCEU_DrawMovies(XBuf); FCEU_DrawMovies(XBuf);
} }
if(howlong) howlong--; /* DrawMessage() */ if(guiMessage.howlong) guiMessage.howlong--; /* DrawMessage() */
} }
#endif #endif

View File

@ -23,7 +23,7 @@ void FCEU_WriteWaveData(int32 *Buffer, int Count)
int16 *dest; int16 *dest;
int x; int x;
#ifndef MSVC #ifndef WIN32
if(!soundlog) return; if(!soundlog) return;
#else #else
if(!soundlog && !FCEUI_AviIsRecording()) return; if(!soundlog && !FCEUI_AviIsRecording()) return;
@ -45,7 +45,7 @@ void FCEU_WriteWaveData(int32 *Buffer, int Count)
if(soundlog) if(soundlog)
wsize+=fwrite(temp,1,Count*sizeof(int16),soundlog); wsize+=fwrite(temp,1,Count*sizeof(int16),soundlog);
#ifdef MSVC #ifdef WIN32
if(FCEUI_AviIsRecording()) if(FCEUI_AviIsRecording())
{ {
FCEUI_AviSoundUpdate((void*)temp, Count); FCEUI_AviSoundUpdate((void*)temp, Count);