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
opts = Options()
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('FRAMESKIP', 'Enable frameskipping', 1),
BoolOption('OPENGL', 'Enable OpenGL support', 1)
BoolOption('FRAMESKIP', 'Enable frameskipping', 0),
BoolOption('OPENGL', 'Enable OpenGL support (SDL only)', 1)
)
env = Environment(options = opts,
CPPDEFINES={'PSS_STYLE' : '${PSS_STYLE}'})
env = Environment(options = opts)
if os.environ.has_key('PLATFORM'):
env.Replace(PLATFORM = os.environ['PLATFORM'])
if os.environ.has_key('CC'):
env.Replace(CC = os.environ['CC'])
if os.environ.has_key('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'):
env.Append(CCFLAGS = os.environ['CFLAGS'])
if os.environ.has_key('LDFLAGS'):
@ -33,35 +37,47 @@ if env['PLATFORM'] == 'cygwin':
env['LIBS'] = ['wsock32'];
conf = Configure(env)
if not conf.CheckLib('SDL'):
print 'Did not find libSDL or SDL.lib, exiting!'
Exit(1)
if not conf.CheckLib('z', autoadd=1):
print 'Did not find libz or z.lib, exiting!'
Exit(1)
if conf.CheckFunc('asprintf'):
conf.env.Append(CCFLAGS = " -DHAVE_ASPRINTF")
if env['OPENGL'] and conf.CheckLibWithHeader('GL', 'GL/gl.h', 'c++', autoadd=1):
conf.env.Append(CCFLAGS = " -DOPENGL")
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'):
print 'Did not find libSDL or SDL.lib, exiting!'
Exit(1)
if not conf.CheckLib('z', autoadd=1):
print 'Did not find libz or z.lib, exiting!'
Exit(1)
if conf.CheckFunc('asprintf'):
conf.env.Append(CCFLAGS = " -DHAVE_ASPRINTF")
if env['OPENGL'] and conf.CheckLibWithHeader('GL', 'GL/gl.h', 'c++', autoadd=1):
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()
# option specified
if env.has_key('LSB_FIRST'):
if env['LSB_FIRST']:
env.Append(CCFLAGS = ' -DLSB_FIRST')
env.Append(CPPDEFINES = ['LSB_FIRST'])
# option not specified, check host system
elif sys.byteorder == 'little':
env.Append(CCFLAGS = ' -DLSB_FIRST')
elif sys.byteorder == 'little' or env['PLATFORM'] == 'win32':
env.Append(CPPDEFINES = ['LSB_FIRST'])
if env['FRAMESKIP']:
env.Append(CCFLAGS = ' -DFRAMESKIP')
env.Append(CPPDEFINES = ['FRAMESKIP'])
# parse SDL cflags/libs
env.ParseConfig('sdl-config --cflags --libs')
print "LIBS:",env['CCFLAGS']
#env['IBS'] = ['wsock32', 'SDL', 'z', 'mingw32', 'SDL']
print "CPPDEFINES:",env['CPPDEFINES']
print "CCFLAGS:",env['CCFLAGS']
#print "LIBS:",env['LIBS']
Export('env')
SConscript(['src/SConscript'])

View File

@ -29,7 +29,6 @@ movie.cpp
subdirs = Split("""
boards
drivers/common
drivers/sdl
fir
input
utils
@ -42,6 +41,11 @@ Export('env')
for dir in subdirs:
subdir_files = SConscript('%s/SConscript' % dir)
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']

View File

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

View File

@ -532,4 +532,4 @@ void FCEUI_AviVideoUpdate(const unsigned char* buffer) { }
int FCEUD_ShowStatusIcon(void) {return 0;}
int FCEUI_AviIsRecording(void) {return 0;}
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 "..\..\fceu.h"
#include "..\..\cart.h" //mbg merge 7/18/06 moved beneath fceu.h
#include "..\..\x6502.h"
#include "..\..\debug.h"
#include "../../fceu.h"
#include "../../cart.h" //mbg merge 7/18/06 moved beneath fceu.h
#include "../../x6502.h"
#include "../../debug.h"
#include "debugger.h"
#include "tracer.h"
#include "cdlogger.h"
#define INESPRIV
#include "..\..\ines.h"
#include "../../ines.h"
void LoadCDLogFile();
void SaveCDLogFileAs();

View File

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

View File

@ -19,15 +19,16 @@
*/
#include "common.h"
#include "..\..\utils/xstring.h"
#include "../../utils/xstring.h"
#include "../../types.h"
#include "debugger.h"
#include "..\..\x6502.h"
#include "..\..\fceu.h"
#include "..\..\debug.h"
#include "..\..\nsf.h"
#include "..\..\cart.h"
#include "..\..\ines.h"
#include "..\..\asm.h"
#include "../../x6502.h"
#include "../../fceu.h"
#include "../../debug.h"
#include "../../nsf.h"
#include "../../cart.h"
#include "../../ines.h"
#include "../../asm.h"
#include "tracer.h"
#include "memview.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,11 +63,10 @@ void SetEmulationSpeed(int type);
int FCEUD_TestCommandState(int c);
void FCEUD_UpdateInput();
extern const char* ScanNames[];
extern CFGSTRUCT HotkeyConfig[];
extern int FCEUD_CommandMapping[EMUCMD_MAX];
#endif
#endif
#endif

View File

@ -62,21 +62,32 @@
//---------------------------
//mbg merge 6/29/06 - new aboutbox
#ifdef _M_X64
#define _MSVC_ARCH "x64"
#if defined(MSVC)
#ifdef _M_X64
#define _MSVC_ARCH "x64"
#else
#define _MSVC_ARCH "x86"
#endif
#ifdef _DEBUG
#define _MSVC_BUILD "debug"
#else
#define _MSVC_BUILD "release"
#endif
#define __COMPILER__STRING__ "msvc " _Py_STRINGIZE(_MSC_VER) " " _MSVC_ARCH " " _MSVC_BUILD
#define _Py_STRINGIZE(X) _Py_STRINGIZE1((X))
#define _Py_STRINGIZE1(X) _Py_STRINGIZE2 ## 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
#elif defined(__GNUC__)
#ifdef _DEBUG
#define _GCC_BUILD "debug"
#else
#define _GCC_BUILD "release"
#endif
#define __COMPILER__STRING__ "gcc " __VERSION__ " " _GCC_BUILD
#else
#define _MSVC_ARCH "x86"
#define __COMPILER__STRING__ "unknown"
#endif
#ifdef _DEBUG
#define _MSVC_BUILD "debug"
#else
#define _MSVC_BUILD "release"
#endif
#define __COMPILER__STRING__ "msvc " _Py_STRINGIZE(_MSC_VER) " " _MSVC_ARCH " " _MSVC_BUILD
#define _Py_STRINGIZE(X) _Py_STRINGIZE1((X))
#define _Py_STRINGIZE1(X) _Py_STRINGIZE2 ## 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
// External functions

View File

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

View File

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

View File

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

View File

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

View File

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

Binary file not shown.

View File

@ -5,4 +5,4 @@ int InitSound();
void TrashSound();
void win_SoundSetScale(int scale);
void win_SoundWriteData(int32 *buffer, int count);
void win_Throttle();
void win_Throttle();

View File

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

View File

@ -627,7 +627,7 @@ static void BlitScreenFull(uint8 *XBuf)
"decb %%bl\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" );
}
else
@ -649,7 +649,7 @@ static void BlitScreenFull(uint8 *XBuf)
"decb %%bl\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" );
}
}
@ -676,7 +676,7 @@ static void BlitScreenFull(uint8 *XBuf)
"decb %%bl\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" );
}
else
@ -699,7 +699,7 @@ static void BlitScreenFull(uint8 *XBuf)
"decb %%bl\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" );
}
}

View File

@ -1054,7 +1054,10 @@ LRESULT FAR PASCAL AppWndProc(HWND hWnd,UINT msg,WPARAM wParam,LPARAM lParam)
// TODO: Proper stop logging
{
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));
mi.fMask=MIIM_DATA|MIIM_TYPE;
@ -1511,4 +1514,4 @@ void FCEUD_CmdOpen(void)
bool FCEUD_PauseAfterPlayback()
{
return pauseAfterPlayback!=0;
}
}

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 <map>
#ifdef MSVC
#ifdef WIN32
#include <windows.h>
#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.
static void ResetInputTypes()
{
#ifdef MSVC
#ifdef WIN32
extern int UsrInputType[3];
UsrInputType[0] = SI_GAMEPAD;
UsrInputType[1] = SI_GAMEPAD;

View File

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

View File

@ -202,4 +202,4 @@ struct FCEU_Guid : public ValueArray<uint8,16>
}
};
#endif
#endif

View File

@ -11,4 +11,4 @@ uint64 FCEU_de64lsb(uint8 *morp);
uint32 FCEU_de32lsb(uint8 *morp);
uint16 FCEU_de16lsb(uint8 *morp);
#endif
#endif

View File

@ -43,4 +43,4 @@ std::string BytesToString(void* data, int len);
bool StringToBytes(std::string& str, void* data, int len);
std::vector<std::string> tokenize_str(const std::string & str,const std::string & delims);
void splitpath(const char* path, char* drv, char* dir, char* name, char* ext);
void splitpath(const char* path, char* drv, char* dir, char* name, char* ext);

View File

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

View File

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

View File

@ -1,4 +1,4 @@
#include "types.h"
void FCEU_WriteWaveData(int32 *Buffer, int Count);
int FCEUI_EndWaveRecord();
int FCEUI_EndWaveRecord();