Cure some bit rot and allow building the standaline memcard manager on OS X.

The app appears broken though.


git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@5650 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
Soren Jorvang 2010-06-11 15:18:36 +00:00
parent e7f7eff2b6
commit d937b73d9c
4 changed files with 295 additions and 294 deletions

View File

@ -1,27 +1,31 @@
# -*- python -*-
Import('env')
import sys
wxenv = env.Clone()
# -*- python -*-
Import('env')
import sys
wxenv = env.Clone()
files = [
]
libs = [
'common',
]
if wxenv['HAVE_WX']:
]
libs = [
'common',
]
if wxenv['HAVE_WX']:
files += [
'Externals/MemcardManager/src/mcmMain.cpp',
'Externals/MemcardManager/src/mcmMain.cpp',
'Externals/MemcardManager/src/MCMdebug.cpp',
'Source/Core/DolphinWX/Src/MemcardManager.cpp',
'Source/Core/DolphinWX/Src/MemoryCards/GCMemcard.cpp',
'Source/Core/DolphinWX/Src/MemcardManager.cpp',
'Source/Core/DolphinWX/Src/MemoryCards/GCMemcard.cpp',
'Source/Core/DolphinWX/Src/WxUtils.cpp',
]
LIBS = libs
exeGUI = env['binary_dir'] + 'MemcardManager'
wxenv.Program(exeGUI, files)
]
LIBS = libs
wxenv.Append(
LIBS = libs
)
exeGUI = env['binary_dir'] + 'MemcardManager'
wxenv.Program(exeGUI, files)

View File

@ -1,253 +1,248 @@
# -*- python -*-
import os
import sys
import platform
# Home made tests
sys.path.append('SconsTests')
import wxconfig
import utils
# Some features need at least SCons 1.2
EnsureSConsVersion(1, 2)
warnings = [
'all',
'write-strings',
'shadow',
'pointer-arith',
'packed',
'no-conversion',
]
compileFlags = [
'-fno-exceptions',
'-fno-strict-aliasing',
'-msse2',
#'-fomit-frame-pointer'
]
if sys.platform != 'win32':
compileFlags += [ '-fvisibility=hidden' ]
cppDefines = [
( '_FILE_OFFSET_BITS', 64),
'_LARGEFILE_SOURCE',
'GCC_HASCLASSVISIBILITY',
]
basedir = os.getcwd()+ '/'
include_paths = [
# -*- python -*-
import os
import sys
import platform
# Home made tests
sys.path.append('SconsTests')
import wxconfig
import utils
# Some features need at least SCons 1.2
EnsureSConsVersion(1, 2)
warnings = [
'all',
'write-strings',
'shadow',
'pointer-arith',
'packed',
'no-conversion',
]
compileFlags = [
'-fno-exceptions',
'-fno-strict-aliasing',
'-msse2',
]
if sys.platform != 'win32':
compileFlags += [ '-fvisibility=hidden' ]
cppDefines = [
( '_FILE_OFFSET_BITS', 64),
'_LARGEFILE_SOURCE',
'GCC_HASCLASSVISIBILITY',
]
basedir = os.getcwd()+ '/'
include_paths = [
basedir + 'Source/Core/Common/Src',
basedir + 'Source/PluginSpecs',
basedir + 'Source/Core/DolphinWX/Src',
basedir + 'Externals/MemcardManager/src',
]
dirs = [
basedir + 'Source/Core/Common/Src',
basedir + '.',
]
builders = {}
if sys.platform == 'darwin':
from plistlib import writePlist
def createPlist(target, source, env):
properties = {}
for srcNode in source:
properties.update(srcNode.value)
for dstNode in target:
writePlist(properties, str(dstNode))
builders['Plist'] = Builder(action = createPlist)
# handle command line options
vars = Variables('args.cache')
vars.AddVariables(
BoolVariable('verbose', 'Set for compilation line', False),
BoolVariable('lint', 'Set for lint build (extra warnings)', False),
EnumVariable('flavor', 'Choose a build flavor', 'release',
allowed_values = ('release', 'devel', 'debug', 'fastlog', 'prof'),
ignorecase = 2
),
PathVariable('wxconfig', 'Path to the wxconfig', None),
('CC', 'The c compiler', 'gcc'),
('CXX', 'The c++ compiler', 'g++'),
)
if sys.platform == 'win32':
env = Environment(
CPPPATH = include_paths,
RPATH = [],
LIBS = [],
LIBPATH = [],
tools = [ 'mingw' ],
variables = vars,
ENV = os.environ,
BUILDERS = builders,
)
else:
env = Environment(
CPPPATH = include_paths,
RPATH = [],
LIBS = [],
LIBPATH = [],
variables = vars,
ENV = {
'PATH' : os.environ['PATH'],
'HOME' : os.environ['HOME']
},
BUILDERS = builders,
)
# save the given command line options
vars.Save('args.cache', env)
# verbose compile
if not env['verbose']:
env['CCCOMSTR'] = "Compiling $TARGET"
env['CXXCOMSTR'] = "Compiling $TARGET"
env['ARCOMSTR'] = "Archiving $TARGET"
env['LINKCOMSTR'] = "Linking $TARGET"
env['ASCOMSTR'] = "Assembling $TARGET"
env['ASPPCOMSTR'] = "Assembling $TARGET"
env['SHCCCOMSTR'] = "Compiling shared $TARGET"
env['SHCXXCOMSTR'] = "Compiling shared $TARGET"
env['SHLINKCOMSTR'] = "Linking shared $TARGET"
env['RANLIBCOMSTR'] = "Indexing $TARGET"
# build flavour
flavour = ARGUMENTS.get('flavor')
if (flavour == 'debug'):
compileFlags.append('-g')
cppDefines.append('_DEBUG') #enables LOGGING
# FIXME: this disable wx debugging how do we make it work?
cppDefines.append('NDEBUG')
elif (flavour == 'devel'):
compileFlags.append('-g')
elif (flavour == 'fastlog'):
compileFlags.append('-O3')
cppDefines.append('DEBUGFAST')
elif (flavour == 'prof'):
compileFlags.append('-O3')
compileFlags.append('-g')
elif (flavour == 'release'):
compileFlags.append('-O3')
# more warnings
if env['lint']:
warnings.append('error')
warnings.append('unreachable-code')
warnings.append('float-equal')
# add the warnings to the compile flags
compileFlags += [ '-W' + warning for warning in warnings ]
env['CCFLAGS'] = compileFlags
if sys.platform == 'win32':
env['CXXFLAGS'] = compileFlags
else:
env['CXXFLAGS'] = compileFlags + [ '-fvisibility-inlines-hidden' ]
env['CPPDEFINES'] = cppDefines
# Configuration tests section
tests = {'CheckWXConfig' : wxconfig.CheckWXConfig,
'CheckPKGConfig' : utils.CheckPKGConfig,
'CheckPKG' : utils.CheckPKG,
}
#object files
env['build_dir'] = os.path.join(basedir, 'Build', platform.system() + '-' + 'MemCardManager' + os.sep)
VariantDir(env['build_dir'], '.', duplicate=0)
conf = env.Configure(custom_tests = tests,
config_h="Source/Core/Common/Src/Config.h")
if not conf.CheckPKGConfig('0.15.0'):
print "Can't find pkg-config, some tests will fail"
basedir + 'Externals/MemcardManager/src',
]
dirs = [
basedir + 'Source/Core/Common/Src',
basedir + '.'
]
env['HAVE_X11'] = conf.CheckPKG('x11')
# handling wx flags CCFLAGS should be created before
wxmods = ['adv', 'core', 'base']
env['USE_WX'] = 0
env['HAVE_WX'] = conf.CheckWXConfig('2.8', wxmods, 0)
conf.Define('HAVE_WX', env['HAVE_WX'])
conf.Define('USE_WX', env['USE_WX'])
conf.Define('HAVE_X11', env['HAVE_X11'])
builders = {}
if sys.platform == 'darwin':
from plistlib import writePlist
def createPlist(target, source, env):
properties = {}
for srcNode in source:
properties.update(srcNode.value)
for dstNode in target:
writePlist(properties, str(dstNode))
builders['Plist'] = Builder(action = createPlist)
# profile
env['USE_OPROFILE'] = 0
if (flavour == 'prof'):
proflibs = [ '/usr/lib/oprofile', '/usr/local/lib/oprofile' ]
env['LIBPATH'].append(proflibs)
env['RPATH'].append(proflibs)
if conf.CheckPKG('opagent'):
env['USE_OPROFILE'] = 1
else:
print "Can't build prof without oprofile, disabling"
conf.Define('USE_OPROFILE', env['USE_OPROFILE'])
# After all configuration tests are done
conf.Finish()
#wx windows flags
if env['HAVE_WX']:
wxconfig.ParseWXConfig(env)
else:
print "WX not found or disabled, not building GUI"
# add methods from utils to env
env.AddMethod(utils.filterWarnings)
# Where do we run from
env['base_dir'] = os.getcwd()+ '/'
# install paths
extra=''
if flavour == 'debug':
extra = '-debug'
elif flavour == 'prof':
extra = '-prof'
# TODO: support global install
env['prefix'] = os.path.join(env['base_dir'] + 'Binary', 'MemCardManager' + extra +os.sep)
#TODO add bin
env['binary_dir'] = env['prefix']
# static libs goes here
# Handle command line options
vars = Variables('args.cache')
vars.AddVariables(
BoolVariable('verbose', 'Set for compilation line', False),
BoolVariable('lint', 'Set for lint build (extra warnings)', False),
EnumVariable('flavor', 'Choose a build flavor', 'release',
allowed_values = ('release','devel','debug','fastlog','prof'),
ignorecase = 2
),
PathVariable('wxconfig', 'Path to the wxconfig', None),
('CC', 'The c compiler', 'gcc'),
('CXX', 'The c++ compiler', 'g++'),
)
if sys.platform == 'win32':
env = Environment(
CPPPATH = include_paths,
RPATH = [],
LIBS = [],
LIBPATH = [],
tools = [ 'mingw' ],
variables = vars,
ENV = os.environ,
BUILDERS = builders,
)
else:
env = Environment(
CPPPATH = include_paths,
RPATH = [],
LIBS = [],
LIBPATH = [],
variables = vars,
ENV = {
'PATH' : os.environ['PATH'],
'HOME' : os.environ['HOME']
},
BUILDERS = builders,
)
# Save the given command line options
vars.Save('args.cache', env)
# Verbose compile
if not env['verbose']:
env['CCCOMSTR'] = "Compiling $TARGET"
env['CXXCOMSTR'] = "Compiling $TARGET"
env['ARCOMSTR'] = "Archiving $TARGET"
env['LINKCOMSTR'] = "Linking $TARGET"
env['ASCOMSTR'] = "Assembling $TARGET"
env['ASPPCOMSTR'] = "Assembling $TARGET"
env['SHCCCOMSTR'] = "Compiling shared $TARGET"
env['SHCXXCOMSTR'] = "Compiling shared $TARGET"
env['SHLINKCOMSTR'] = "Linking shared $TARGET"
env['RANLIBCOMSTR'] = "Indexing $TARGET"
# Build flavour
flavour = env['flavor']
if (flavour == 'debug'):
compileFlags.append('-ggdb')
cppDefines.append('_DEBUG') #enables LOGGING
# FIXME: this disable wx debugging how do we make it work?
cppDefines.append('NDEBUG')
elif (flavour == 'devel'):
compileFlags.append('-ggdb')
elif (flavour == 'fastlog'):
compileFlags.append('-O3')
cppDefines.append('DEBUGFAST')
elif (flavour == 'prof'):
compileFlags.append('-O3')
compileFlags.append('-ggdb')
elif (flavour == 'release'):
compileFlags.append('-O3')
# More warnings
if env['lint']:
warnings.append('error')
# Should check for the availability of these (in GCC 4.3 or newer)
if sys.platform != 'darwin':
warnings.append('no-array-bounds')
warnings.append('no-unused-result')
# wxWidgets causes too many warnings with these
#warnings.append('unreachable-code')
#warnings.append('float-equal')
# Add the warnings to the compile flags
compileFlags += [ '-W' + warning for warning in warnings ]
env['CCFLAGS'] = compileFlags
if sys.platform == 'win32':
env['CXXFLAGS'] = compileFlags
else:
env['CXXFLAGS'] = compileFlags + [ '-fvisibility-inlines-hidden' ]
env['CPPDEFINES'] = cppDefines
# Configuration tests section
tests = {'CheckWXConfig' : wxconfig.CheckWXConfig,
'CheckPKGConfig' : utils.CheckPKGConfig,
'CheckPKG' : utils.CheckPKG,
}
# Object files
env['build_dir'] = os.path.join(basedir, 'Build',
platform.system() + '-' + 'MemCardManager' + os.sep)
conf = env.Configure(custom_tests = tests,
config_h="Source/Core/Common/Src/Config.h")
if not conf.CheckPKGConfig('0.15.0'):
print "Can't find pkg-config, some tests will fail"
# OS X specifics
if sys.platform == 'darwin':
env['HAVE_X11'] = 0
compileFlags.append('-mmacosx-version-min=10.5')
conf.Define('MAP_32BIT', 0)
else:
env['HAVE_X11'] = conf.CheckPKG('x11')
# Handling wx flags CCFLAGS should be created before
wxmods = ['adv', 'core', 'base']
env['USE_WX'] = 0
env['HAVE_WX'] = conf.CheckWXConfig('2.8', wxmods, 0)
conf.Define('HAVE_WX', env['HAVE_WX'])
conf.Define('USE_WX', env['USE_WX'])
conf.Define('HAVE_X11', env['HAVE_X11'])
# Profile
env['USE_OPROFILE'] = 0
if (flavour == 'prof'):
proflibs = [ '/usr/lib/oprofile', '/usr/local/lib/oprofile' ]
env['LIBPATH'].append(proflibs)
env['RPATH'].append(proflibs)
if conf.CheckPKG('opagent'):
env['USE_OPROFILE'] = 1
else:
print "Can't build prof without oprofile, disabling"
conf.Define('USE_OPROFILE', env['USE_OPROFILE'])
# After all configuration tests are done
conf.Finish()
if env['HAVE_WX']:
wxconfig.ParseWXConfig(env)
else:
print "WX not found or disabled, not building GUI"
# Install paths
extra=''
if flavour == 'debug':
extra = '-debug'
elif flavour == 'prof':
extra = '-prof'
# TODO: support global install
env['prefix'] = os.path.join(env['base_dir'] + 'Binary',
'MemCardManager' + extra + os.sep)
# TODO: add bin
env['binary_dir'] = env['prefix']
# Static libs goes here
env['local_libs'] = env['build_dir'] + os.sep + 'libs' + os.sep
env['LIBPATH'].append(env['local_libs'])
# print a nice progress indication when not compiling
Progress(['-\r', '\\\r', '|\r', '/\r'], interval = 5)
# die on unknown variables
unknown = vars.UnknownVariables()
if unknown:
print "Unknown variables:", unknown.keys()
Exit(1)
# generate help
Help(vars.GenerateHelpText(env))
Export('env')
for subdir in dirs:
SConscript(
subdir + os.sep + 'SConscript',
variant_dir = env[ 'build_dir' ] + subdir + os.sep,
duplicate=0
)
env['LIBPATH'].append(env['local_libs'])
# Print a nice progress indication when not compiling
Progress(['-\r', '\\\r', '|\r', '/\r'], interval = 5)
# Die on unknown variables
unknown = vars.UnknownVariables()
if unknown:
print "Unknown variables:", unknown.keys()
Exit(1)
# Generate help
Help(vars.GenerateHelpText(env))
Export('env')
for subdir in dirs:
SConscript(
subdir + os.sep + 'SConscript',
variant_dir = env[ 'build_dir' ] + subdir + os.sep,
duplicate=0
)

View File

@ -55,9 +55,9 @@ void CMemcardManagerDebug::Init_ChildControls()
m_Notebook_MCMD->AddPage(m_Tab_BAT, _T("Bat"));
m_Notebook_MCMD->AddPage(m_Tab_BAT_b, _T("Bat_b"));
wxBoxSizer* sMain = new wxBoxSizer(wxVERTICAL);
sMain->Add(m_Notebook_MCMD, 1, wxEXPAND|wxALL, 5);
SetSizer(sMain);
wxBoxSizer* wMain = new wxBoxSizer(wxVERTICAL);
wMain->Add(m_Notebook_MCMD, 1, wxEXPAND|wxALL, 5);
SetSizer(wMain);
Layout();
Fit();
}
@ -68,10 +68,10 @@ void CMemcardManagerDebug::OnClose(wxCloseEvent& WXUNUSED (event))
void CMemcardManagerDebug::Init_HDR()
{
wxBoxSizer *sMain;
wxBoxSizer *wMain;
wxStaticBoxSizer *sHDR[2];
sMain = new wxBoxSizer(wxHORIZONTAL);
wMain = new wxBoxSizer(wxHORIZONTAL);
sHDR[0] = new wxStaticBoxSizer(wxVERTICAL, m_Tab_HDR, wxT("MEMCARD:A"));
sHDR[1] = new wxStaticBoxSizer(wxVERTICAL, m_Tab_HDR, wxT("MEMCARD:B"));
@ -142,9 +142,9 @@ void CMemcardManagerDebug::Init_HDR()
sOtPaths[i]->Add(t_HDR_CheckSum2[i], wxGBPosition(10, 1), wxGBSpan(1, 1), wxEXPAND|wxALL, 5);
sHDR[i]->Add(sOtPaths[i], 0, wxEXPAND|wxALL, 5);
sMain->Add(sHDR[i], 0, wxEXPAND|wxALL, 1);
wMain->Add(sHDR[i], 0, wxEXPAND|wxALL, 1);
}
m_Tab_HDR->SetSizer(sMain);
m_Tab_HDR->SetSizer(wMain);
m_Tab_HDR->Layout();
}
@ -221,9 +221,9 @@ void CMemcardManagerDebug::updateHDRtab(int card)
void CMemcardManagerDebug::Init_DIR()
{
wxBoxSizer *sMain;
wxBoxSizer *wMain;
wxStaticBoxSizer *sDIR[2];
sMain = new wxBoxSizer(wxHORIZONTAL);
wMain = new wxBoxSizer(wxHORIZONTAL);
sDIR[0] = new wxStaticBoxSizer(wxVERTICAL, m_Tab_DIR, wxT("MEMCARD:A"));
sDIR[1] = new wxStaticBoxSizer(wxVERTICAL, m_Tab_DIR, wxT("MEMCARD:B"));
@ -253,10 +253,10 @@ void CMemcardManagerDebug::Init_DIR()
sDIR[i]->Add(sOtPaths[i], 0, wxEXPAND|wxALL, 5);
sMain->Add(sDIR[i], 0, wxEXPAND|wxALL, 1);
wMain->Add(sDIR[i], 0, wxEXPAND|wxALL, 1);
}
m_Tab_DIR->SetSizer(sMain);
m_Tab_DIR->SetSizer(wMain);
m_Tab_DIR->Layout();
}
@ -284,9 +284,9 @@ void CMemcardManagerDebug::updateDIRtab(int card)
void CMemcardManagerDebug::Init_DIR_b()
{
wxBoxSizer *sMain;
wxBoxSizer *wMain;
wxStaticBoxSizer *sDIR_b[2];
sMain = new wxBoxSizer(wxHORIZONTAL);
wMain = new wxBoxSizer(wxHORIZONTAL);
sDIR_b[0] = new wxStaticBoxSizer(wxVERTICAL, m_Tab_DIR_b, wxT("MEMCARD:A"));
sDIR_b[1] = new wxStaticBoxSizer(wxVERTICAL, m_Tab_DIR_b, wxT("MEMCARD:B"));
@ -315,9 +315,9 @@ void CMemcardManagerDebug::Init_DIR_b()
sOtPaths[i]->Add(t_DIR_b_CheckSum2[i], wxGBPosition(2, 1), wxGBSpan(1, 1), wxEXPAND|wxALL, 5);
sDIR_b[i]->Add(sOtPaths[i], 0, wxEXPAND|wxALL, 5);
sMain->Add(sDIR_b[i], 0, wxEXPAND|wxALL, 1);
wMain->Add(sDIR_b[i], 0, wxEXPAND|wxALL, 1);
}
m_Tab_DIR_b->SetSizer(sMain);
m_Tab_DIR_b->SetSizer(wMain);
m_Tab_DIR_b->Layout();
}
@ -341,9 +341,9 @@ void CMemcardManagerDebug::updateDIRBtab(int card)
void CMemcardManagerDebug::Init_BAT()
{
wxBoxSizer *sMain;
wxBoxSizer *wMain;
wxStaticBoxSizer *sBAT[4];
sMain = new wxBoxSizer(wxHORIZONTAL);
wMain = new wxBoxSizer(wxHORIZONTAL);
sBAT[0] = new wxStaticBoxSizer(wxVERTICAL, m_Tab_BAT, wxT("MEMCARD:A"));
sBAT[1] = new wxStaticBoxSizer(wxVERTICAL, m_Tab_BAT, wxT("MEMCARD:B"));
sBAT[2] = new wxStaticBoxSizer(wxVERTICAL, m_Tab_BAT, wxT("MEMCARD:A MAP"));
@ -386,7 +386,7 @@ void CMemcardManagerDebug::Init_BAT()
sBAT[i]->Add(sOtPaths[i], 0, wxEXPAND|wxALL, 5);
sMain->Add(sBAT[i], 0, wxEXPAND|wxALL, 1);
wMain->Add(sBAT[i], 0, wxEXPAND|wxALL, 1);
}
for (int k=2;k<=3;k++) //256
@ -402,10 +402,10 @@ void CMemcardManagerDebug::Init_BAT()
}
sBAT[k]->Add(sOtPaths[k], 0, wxEXPAND|wxALL, 5);
sMain->Add(sBAT[k], 0, wxEXPAND|wxALL, 1);
wMain->Add(sBAT[k], 0, wxEXPAND|wxALL, 1);
}
m_Tab_BAT->SetSizer(sMain);
m_Tab_BAT->SetSizer(wMain);
m_Tab_BAT->Layout();
}
@ -449,9 +449,9 @@ void CMemcardManagerDebug::updateBATtab(int card)
void CMemcardManagerDebug::Init_BAT_b()
{
wxBoxSizer *sMain;
wxBoxSizer *wMain;
wxStaticBoxSizer *sBAT_b[2];
sMain = new wxBoxSizer(wxHORIZONTAL);
wMain = new wxBoxSizer(wxHORIZONTAL);
sBAT_b[0] = new wxStaticBoxSizer(wxVERTICAL, m_Tab_BAT_b, wxT("MEMCARD:A"));
sBAT_b[1] = new wxStaticBoxSizer(wxVERTICAL, m_Tab_BAT_b, wxT("MEMCARD:B"));
@ -490,10 +490,10 @@ void CMemcardManagerDebug::Init_BAT_b()
sOtPaths[i]->Add(t_BAT_b_LastAllocated[i], wxGBPosition(4, 1), wxGBSpan(1, 1), wxEXPAND|wxALL, 5);
sBAT_b[i]->Add(sOtPaths[i], 0, wxEXPAND|wxALL, 5);
sMain->Add(sBAT_b[i], 0, wxEXPAND|wxALL, 1);
wMain->Add(sBAT_b[i], 0, wxEXPAND|wxALL, 1);
}
m_Tab_BAT_b->SetSizer(sMain);
m_Tab_BAT_b->SetSizer(wMain);
m_Tab_BAT_b->Layout();
}

View File

@ -1,8 +1,10 @@
#ifndef _MCM__
#define _MCM__
void __Log(int logNumber, const char* text, ...){logNumber; text;}
void __Logv(int log, int v, const char *format, ...){log; v; format;}
void __Log(int logNumber, const char* text, ...)
{(void)logNumber; (void)text;}
void __Logv(int log, int v, const char *format, ...)
{(void)log; (void)v; (void)format;}
#include "MemcardManager.h"
#include "Timer.h"