mirror of https://github.com/stella-emu/stella.git
Added OSystem::logMessage(), which abstracts the logging of messages to
an outputstream. For now, the output simply goes to stdout or stderr, just like before, but the possibility is now there to redirect to a file if desired. Changed 'showinfo' commandline option to accept 'levels' of output instead of simply being a boolean. The new default is level 1, in which normal messages are output during a run. Level 2 will show more detailed info, and may be useful in debugging end-user problems. There's still more work to do wrt level 2. git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@2029 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
parent
f8adf5c314
commit
5de12952ec
|
@ -830,8 +830,8 @@
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<td><pre>-showinfo <1|0></pre></td>
|
<td><pre>-showinfo <0|1|2></pre></td>
|
||||||
<td>Shows some game info on the commandline while Stella is running.</td>
|
<td>Shows some application & game info on the commandline while Stella is running. Zero completely disables output (except for serious errors), while the remaining numbers show increasingly more detail.</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
|
|
|
@ -56,7 +56,7 @@ bool FrameBufferSoft::initSubsystem(VideoMode& mode)
|
||||||
|
|
||||||
if(!myRectList)
|
if(!myRectList)
|
||||||
{
|
{
|
||||||
cerr << "ERROR: Unable to get memory for SDL rects" << endl;
|
myOSystem->logMessage("ERROR: Unable to get memory for SDL rects\n", 0);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -96,7 +96,9 @@ bool FrameBufferSoft::setVidMode(VideoMode& mode)
|
||||||
myScreen = SDL_SetVideoMode(mode.screen_w, mode.screen_h, 0, mySDLFlags);
|
myScreen = SDL_SetVideoMode(mode.screen_w, mode.screen_h, 0, mySDLFlags);
|
||||||
if(myScreen == NULL)
|
if(myScreen == NULL)
|
||||||
{
|
{
|
||||||
cerr << "ERROR: Unable to open SDL window: " << SDL_GetError() << endl;
|
ostringstream buf;
|
||||||
|
buf << "ERROR: Unable to open SDL window: " << SDL_GetError() << endl;
|
||||||
|
myOSystem->logMessage(buf.str(), 0);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
myFormat = myScreen->format;
|
myFormat = myScreen->format;
|
||||||
|
|
|
@ -27,9 +27,7 @@
|
||||||
SoundNull::SoundNull(OSystem* osystem)
|
SoundNull::SoundNull(OSystem* osystem)
|
||||||
: Sound(osystem)
|
: Sound(osystem)
|
||||||
{
|
{
|
||||||
// Show some info
|
myOSystem->logMessage("Sound disabled.\n\n", 1);
|
||||||
if(myOSystem->settings().getBool("showinfo"))
|
|
||||||
cout << "Sound disabled." << endl << endl;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
|
|
@ -67,8 +67,7 @@ void SoundSDL::open()
|
||||||
if(!myIsEnabled)
|
if(!myIsEnabled)
|
||||||
{
|
{
|
||||||
close();
|
close();
|
||||||
if(myOSystem->settings().getBool("showinfo"))
|
myOSystem->logMessage("Sound disabled.\n\n", 1);
|
||||||
cout << "Sound disabled." << endl << endl;
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -82,10 +81,12 @@ void SoundSDL::open()
|
||||||
myIsMuted = false;
|
myIsMuted = false;
|
||||||
myLastRegisterSetCycle = 0;
|
myLastRegisterSetCycle = 0;
|
||||||
|
|
||||||
|
ostringstream buf;
|
||||||
if(SDL_InitSubSystem(SDL_INIT_AUDIO) < 0)
|
if(SDL_InitSubSystem(SDL_INIT_AUDIO) < 0)
|
||||||
{
|
{
|
||||||
cerr << "WARNING: Couldn't initialize SDL audio system! " << endl;
|
buf << "WARNING: Couldn't initialize SDL audio system! " << endl
|
||||||
cerr << " " << SDL_GetError() << endl;
|
<< " " << SDL_GetError() << endl;
|
||||||
|
myOSystem->logMessage(buf.str(), 0);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -108,8 +109,9 @@ void SoundSDL::open()
|
||||||
|
|
||||||
if(SDL_OpenAudio(&desired, &myHardwareSpec) < 0)
|
if(SDL_OpenAudio(&desired, &myHardwareSpec) < 0)
|
||||||
{
|
{
|
||||||
cerr << "WARNING: Couldn't open SDL audio system! " << endl;
|
buf << "WARNING: Couldn't open SDL audio system! " << endl
|
||||||
cerr << " " << SDL_GetError() << endl;
|
<< " " << SDL_GetError() << endl;
|
||||||
|
myOSystem->logMessage(buf.str(), 0);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -117,9 +119,10 @@ void SoundSDL::open()
|
||||||
// will not work so we'll need to disable the audio support)
|
// will not work so we'll need to disable the audio support)
|
||||||
if(((float)myHardwareSpec.samples / (float)myHardwareSpec.freq) >= 0.25)
|
if(((float)myHardwareSpec.samples / (float)myHardwareSpec.freq) >= 0.25)
|
||||||
{
|
{
|
||||||
cerr << "WARNING: Sound device doesn't support realtime audio! Make ";
|
buf << "WARNING: Sound device doesn't support realtime audio! Make "
|
||||||
cerr << "sure a sound" << endl;
|
<< "sure a sound" << endl
|
||||||
cerr << " server isn't running. Audio is disabled." << endl;
|
<< " server isn't running. Audio is disabled." << endl;
|
||||||
|
myOSystem->logMessage(buf.str(), 0);
|
||||||
|
|
||||||
SDL_CloseAudio();
|
SDL_CloseAudio();
|
||||||
return;
|
return;
|
||||||
|
@ -129,15 +132,6 @@ void SoundSDL::open()
|
||||||
myIsMuted = false;
|
myIsMuted = false;
|
||||||
myFragmentSizeLogBase2 = log((double)myHardwareSpec.samples) / log(2.0);
|
myFragmentSizeLogBase2 = log((double)myHardwareSpec.samples) / log(2.0);
|
||||||
|
|
||||||
/*
|
|
||||||
cerr << "Freq: " << (int)myHardwareSpec.freq << endl;
|
|
||||||
cerr << "Format: " << (int)myHardwareSpec.format << endl;
|
|
||||||
cerr << "Channels: " << (int)myHardwareSpec.channels << endl;
|
|
||||||
cerr << "Silence: " << (int)myHardwareSpec.silence << endl;
|
|
||||||
cerr << "Samples: " << (int)myHardwareSpec.samples << endl;
|
|
||||||
cerr << "Size: " << (int)myHardwareSpec.size << endl;
|
|
||||||
*/
|
|
||||||
|
|
||||||
// Now initialize the TIASound object which will actually generate sound
|
// Now initialize the TIASound object which will actually generate sound
|
||||||
myTIASound.outputFrequency(myHardwareSpec.freq);
|
myTIASound.outputFrequency(myHardwareSpec.freq);
|
||||||
myTIASound.tiaFrequency(tiafreq);
|
myTIASound.tiaFrequency(tiafreq);
|
||||||
|
@ -151,15 +145,16 @@ void SoundSDL::open()
|
||||||
setVolume(myVolume);
|
setVolume(myVolume);
|
||||||
|
|
||||||
// Show some info
|
// Show some info
|
||||||
if(myOSystem->settings().getBool("showinfo"))
|
buf << "Sound enabled:" << endl
|
||||||
cout << "Sound enabled:" << endl
|
<< " Volume: " << myVolume << endl
|
||||||
<< " Volume : " << myVolume << endl
|
<< " Frag size: " << fragsize << endl
|
||||||
<< " Frag size : " << fragsize << endl
|
<< " Frequency: " << myHardwareSpec.freq << endl
|
||||||
<< " Frequency : " << myHardwareSpec.freq << endl
|
<< " Format: " << myHardwareSpec.format << endl
|
||||||
<< " Format : " << myHardwareSpec.format << endl
|
<< " TIA Freq: " << tiafreq << endl
|
||||||
<< " TIA Freq. : " << tiafreq << endl
|
<< " Channels: " << myNumChannels << endl
|
||||||
<< " Channels : " << myNumChannels << endl
|
<< " Clip volume: " << (int)clipvol << endl
|
||||||
<< " Clip volume: " << (int)clipvol << endl << endl;
|
<< endl;
|
||||||
|
myOSystem->logMessage(buf.str(), 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -321,7 +316,6 @@ void SoundSDL::processFragment(uInt8* stream, Int32 length)
|
||||||
myTIASound.set(info.addr, info.value);
|
myTIASound.set(info.addr, info.value);
|
||||||
myRegWriteQueue.dequeue();
|
myRegWriteQueue.dequeue();
|
||||||
}
|
}
|
||||||
// cout << "Removed Items from RegWriteQueue!" << endl;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
double position = 0.0;
|
double position = 0.0;
|
||||||
|
@ -431,7 +425,9 @@ bool SoundSDL::save(Serializer& out) const
|
||||||
}
|
}
|
||||||
catch(const char* msg)
|
catch(const char* msg)
|
||||||
{
|
{
|
||||||
cerr << "ERROR: SoundSDL::save" << endl << " " << msg << endl;
|
ostringstream buf;
|
||||||
|
buf << "ERROR: SoundSDL::save" << endl << " " << msg << endl;
|
||||||
|
myOSystem->logMessage(buf.str(), 0);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -475,7 +471,9 @@ bool SoundSDL::load(Serializer& in)
|
||||||
}
|
}
|
||||||
catch(const char* msg)
|
catch(const char* msg)
|
||||||
{
|
{
|
||||||
cerr << "ERROR: SoundSDL::load" << endl << " " << msg << endl;
|
ostringstream buf;
|
||||||
|
buf << "ERROR: SoundSDL::load" << endl << " " << msg << endl;
|
||||||
|
myOSystem->logMessage(buf.str(), 0);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
|
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
|
|
||||||
#define STELLA_VERSION "3.1.1"
|
#define STELLA_VERSION "3.2_svn"
|
||||||
#define STELLA_BUILD atoi("$Rev$"+6)
|
#define STELLA_BUILD atoi("$Rev$"+6)
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -65,6 +65,8 @@ OSystem* theOSystem = (OSystem*) NULL;
|
||||||
// Does general Cleanup in case any operation failed (or at end of program)
|
// Does general Cleanup in case any operation failed (or at end of program)
|
||||||
int Cleanup()
|
int Cleanup()
|
||||||
{
|
{
|
||||||
|
theOSystem->logMessage("Cleanup from mainSDL\n", 2);
|
||||||
|
|
||||||
if(theOSystem)
|
if(theOSystem)
|
||||||
delete theOSystem;
|
delete theOSystem;
|
||||||
|
|
||||||
|
@ -99,21 +101,25 @@ int main(int argc, char* argv[])
|
||||||
#error Unsupported platform!
|
#error Unsupported platform!
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
theOSystem->logMessage("Loading config options ...\n", 2);
|
||||||
theOSystem->settings().loadConfig();
|
theOSystem->settings().loadConfig();
|
||||||
|
|
||||||
// Take care of commandline arguments
|
// Take care of commandline arguments
|
||||||
|
theOSystem->logMessage("Loading commandline arguments ...\n", 2);
|
||||||
string romfile = theOSystem->settings().loadCommandLine(argc, argv);
|
string romfile = theOSystem->settings().loadCommandLine(argc, argv);
|
||||||
FilesystemNode romnode(romfile);
|
FilesystemNode romnode(romfile);
|
||||||
|
|
||||||
// Finally, make sure the settings are valid
|
// Finally, make sure the settings are valid
|
||||||
// We do it once here, so the rest of the program can assume valid settings
|
// We do it once here, so the rest of the program can assume valid settings
|
||||||
|
theOSystem->logMessage("Validating config options ...\n", 2);
|
||||||
theOSystem->settings().validate();
|
theOSystem->settings().validate();
|
||||||
|
|
||||||
// Create the full OSystem after the settings, since settings are
|
// Create the full OSystem after the settings, since settings are
|
||||||
// probably needed for defaults
|
// probably needed for defaults
|
||||||
|
theOSystem->logMessage("Creating the OSystem ...\n", 2);
|
||||||
if(!theOSystem->create())
|
if(!theOSystem->create())
|
||||||
{
|
{
|
||||||
cout << "ERROR: Couldn't create OSystem" << endl;
|
theOSystem->logMessage("ERROR: Couldn't create OSystem\n", 0);
|
||||||
return Cleanup();
|
return Cleanup();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -122,20 +128,23 @@ int main(int argc, char* argv[])
|
||||||
// If so, show the information and immediately exit
|
// If so, show the information and immediately exit
|
||||||
if(theOSystem->settings().getBool("listrominfo"))
|
if(theOSystem->settings().getBool("listrominfo"))
|
||||||
{
|
{
|
||||||
|
theOSystem->logMessage("Showing output from 'listrominfo' ...\n", 2);
|
||||||
theOSystem->propSet().print();
|
theOSystem->propSet().print();
|
||||||
return Cleanup();
|
return Cleanup();
|
||||||
}
|
}
|
||||||
else if(theOSystem->settings().getBool("rominfo"))
|
else if(theOSystem->settings().getBool("rominfo"))
|
||||||
{
|
{
|
||||||
|
theOSystem->logMessage("Showing output from 'rominfo' ...\n", 2);
|
||||||
if(argc > 1 && romnode.exists())
|
if(argc > 1 && romnode.exists())
|
||||||
cout << theOSystem->getROMInfo(romfile);
|
theOSystem->logMessage(theOSystem->getROMInfo(romfile), 0);
|
||||||
else
|
else
|
||||||
cout << "ERROR: ROM doesn't exist" << endl;
|
theOSystem->logMessage("ERROR: ROM doesn't exist\n", 0);
|
||||||
|
|
||||||
return Cleanup();
|
return Cleanup();
|
||||||
}
|
}
|
||||||
else if(theOSystem->settings().getBool("help"))
|
else if(theOSystem->settings().getBool("help"))
|
||||||
{
|
{
|
||||||
|
theOSystem->logMessage("Displaying usage\n", 2);
|
||||||
theOSystem->settings().usage();
|
theOSystem->settings().usage();
|
||||||
return Cleanup();
|
return Cleanup();
|
||||||
}
|
}
|
||||||
|
@ -160,6 +169,7 @@ int main(int argc, char* argv[])
|
||||||
// mode and let the main event loop take care of opening a new console/ROM.
|
// mode and let the main event loop take care of opening a new console/ROM.
|
||||||
if(argc == 1 || romfile == "" || !romnode.exists() || romnode.isDirectory())
|
if(argc == 1 || romfile == "" || !romnode.exists() || romnode.isDirectory())
|
||||||
{
|
{
|
||||||
|
theOSystem->logMessage("Attempting to use ROM launcher ...\n", 2);
|
||||||
if(theOSystem->settings().getBool("uselauncher"))
|
if(theOSystem->settings().getBool("uselauncher"))
|
||||||
{
|
{
|
||||||
if(!theOSystem->createLauncher())
|
if(!theOSystem->createLauncher())
|
||||||
|
@ -167,6 +177,7 @@ int main(int argc, char* argv[])
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
theOSystem->logMessage("Launcher could not be started, showing usage\n", 2);
|
||||||
theOSystem->settings().usage();
|
theOSystem->settings().usage();
|
||||||
return Cleanup();
|
return Cleanup();
|
||||||
}
|
}
|
||||||
|
@ -175,6 +186,7 @@ int main(int argc, char* argv[])
|
||||||
{
|
{
|
||||||
if(theOSystem->settings().getBool("takesnapshot"))
|
if(theOSystem->settings().getBool("takesnapshot"))
|
||||||
{
|
{
|
||||||
|
theOSystem->logMessage("Taking snapshots with 'takesnapshot' ...\n", 2);
|
||||||
for(int i = 0; i < 30; ++i) theOSystem->frameBuffer().update();
|
for(int i = 0; i < 30; ++i) theOSystem->frameBuffer().update();
|
||||||
theOSystem->eventHandler().takeSnapshot();
|
theOSystem->eventHandler().takeSnapshot();
|
||||||
return Cleanup();
|
return Cleanup();
|
||||||
|
@ -205,7 +217,9 @@ int main(int argc, char* argv[])
|
||||||
while(SDL_PollEvent(&event)) /* swallow event */ ;
|
while(SDL_PollEvent(&event)) /* swallow event */ ;
|
||||||
|
|
||||||
// Start the main loop, and don't exit until the user issues a QUIT command
|
// Start the main loop, and don't exit until the user issues a QUIT command
|
||||||
|
theOSystem->logMessage("Starting main loop ...\n", 2);
|
||||||
theOSystem->mainLoop();
|
theOSystem->mainLoop();
|
||||||
|
theOSystem->logMessage("Finished main loop ...\n", 2);
|
||||||
|
|
||||||
// Cleanup time ...
|
// Cleanup time ...
|
||||||
return Cleanup();
|
return Cleanup();
|
||||||
|
|
|
@ -177,8 +177,6 @@ void EventHandler::reset(State state)
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
void EventHandler::setupJoysticks()
|
void EventHandler::setupJoysticks()
|
||||||
{
|
{
|
||||||
bool showinfo = myOSystem->settings().getBool("showinfo");
|
|
||||||
|
|
||||||
#ifdef JOYSTICK_SUPPORT
|
#ifdef JOYSTICK_SUPPORT
|
||||||
// Keep track of how many Stelladaptors we've found
|
// Keep track of how many Stelladaptors we've found
|
||||||
int saCount = 0;
|
int saCount = 0;
|
||||||
|
@ -198,12 +196,10 @@ void EventHandler::setupJoysticks()
|
||||||
}
|
}
|
||||||
|
|
||||||
// (Re)-Initialize the joystick subsystem
|
// (Re)-Initialize the joystick subsystem
|
||||||
if(showinfo)
|
myOSystem->logMessage("Joystick devices found:\n", 1);
|
||||||
cout << "Joystick devices found:" << endl;
|
|
||||||
if((SDL_InitSubSystem(SDL_INIT_JOYSTICK) == -1) || (SDL_NumJoysticks() <= 0))
|
if((SDL_InitSubSystem(SDL_INIT_JOYSTICK) == -1) || (SDL_NumJoysticks() <= 0))
|
||||||
{
|
{
|
||||||
if(showinfo)
|
myOSystem->logMessage("No joysticks present.\n\n", 1);
|
||||||
cout << "No joysticks present." << endl;
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -224,6 +220,7 @@ void EventHandler::setupJoysticks()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Figure out what type of joystick this is
|
// Figure out what type of joystick this is
|
||||||
|
ostringstream buf;
|
||||||
if(name.find("Stelladaptor", 0) != string::npos)
|
if(name.find("Stelladaptor", 0) != string::npos)
|
||||||
{
|
{
|
||||||
saCount++;
|
saCount++;
|
||||||
|
@ -234,33 +231,31 @@ void EventHandler::setupJoysticks()
|
||||||
else if(saCount == 2)
|
else if(saCount == 2)
|
||||||
ourJoysticks[i].name = "Stelladaptor 2";
|
ourJoysticks[i].name = "Stelladaptor 2";
|
||||||
|
|
||||||
if(showinfo)
|
buf << " " << i << ": " << ourJoysticks[i].name << endl;
|
||||||
cout << " " << i << ": " << ourJoysticks[i].name << endl;
|
myOSystem->logMessage(buf.str(), 1);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ourJoysticks[i].type = JT_REGULAR;
|
ourJoysticks[i].type = JT_REGULAR;
|
||||||
ourJoysticks[i].name = SDL_JoystickName(i);
|
ourJoysticks[i].name = SDL_JoystickName(i);
|
||||||
|
|
||||||
if(showinfo)
|
buf << " " << i << ": " << ourJoysticks[i].name << " with "
|
||||||
cout << " " << i << ": " << ourJoysticks[i].name << " with "
|
<< SDL_JoystickNumAxes(ourJoysticks[i].stick) << " axes, "
|
||||||
<< SDL_JoystickNumAxes(ourJoysticks[i].stick) << " axes, "
|
<< SDL_JoystickNumHats(ourJoysticks[i].stick) << " hats, "
|
||||||
<< SDL_JoystickNumHats(ourJoysticks[i].stick) << " hats, "
|
<< SDL_JoystickNumBalls(ourJoysticks[i].stick) << " balls, "
|
||||||
<< SDL_JoystickNumBalls(ourJoysticks[i].stick) << " balls, "
|
<< SDL_JoystickNumButtons(ourJoysticks[i].stick) << " buttons"
|
||||||
<< SDL_JoystickNumButtons(ourJoysticks[i].stick) << " buttons"
|
<< endl;
|
||||||
<< endl;
|
myOSystem->logMessage(buf.str(), 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(showinfo)
|
myOSystem->logMessage("\n", 1);
|
||||||
cout << endl;
|
|
||||||
|
|
||||||
// Map the stelladaptors we've found according to the specified ports
|
// Map the stelladaptors we've found according to the specified ports
|
||||||
const string& sa1 = myOSystem->settings().getString("sa1");
|
const string& sa1 = myOSystem->settings().getString("sa1");
|
||||||
const string& sa2 = myOSystem->settings().getString("sa2");
|
const string& sa2 = myOSystem->settings().getString("sa2");
|
||||||
mapStelladaptors(sa1, sa2);
|
mapStelladaptors(sa1, sa2);
|
||||||
#else
|
#else
|
||||||
if(showinfo)
|
myOSystem->logMessage("No joysticks present.\n", 1);
|
||||||
cout << "No joysticks present." << endl;
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -268,8 +263,6 @@ void EventHandler::setupJoysticks()
|
||||||
void EventHandler::mapStelladaptors(const string& sa1, const string& sa2)
|
void EventHandler::mapStelladaptors(const string& sa1, const string& sa2)
|
||||||
{
|
{
|
||||||
#ifdef JOYSTICK_SUPPORT
|
#ifdef JOYSTICK_SUPPORT
|
||||||
bool showinfo = myOSystem->settings().getBool("showinfo");
|
|
||||||
|
|
||||||
for(int i = 0; i < kNumJoysticks; i++)
|
for(int i = 0; i < kNumJoysticks; i++)
|
||||||
{
|
{
|
||||||
if(ourJoysticks[i].name == "Stelladaptor 1")
|
if(ourJoysticks[i].name == "Stelladaptor 1")
|
||||||
|
@ -277,14 +270,12 @@ void EventHandler::mapStelladaptors(const string& sa1, const string& sa2)
|
||||||
if(sa1 == "left")
|
if(sa1 == "left")
|
||||||
{
|
{
|
||||||
ourJoysticks[i].type = JT_STELLADAPTOR_LEFT;
|
ourJoysticks[i].type = JT_STELLADAPTOR_LEFT;
|
||||||
if(showinfo)
|
myOSystem->logMessage(" Stelladaptor 1 emulates left joystick port\n", 1);
|
||||||
cout << " Stelladaptor 1 emulates left joystick port\n";
|
|
||||||
}
|
}
|
||||||
else if(sa1 == "right")
|
else if(sa1 == "right")
|
||||||
{
|
{
|
||||||
ourJoysticks[i].type = JT_STELLADAPTOR_RIGHT;
|
ourJoysticks[i].type = JT_STELLADAPTOR_RIGHT;
|
||||||
if(showinfo)
|
myOSystem->logMessage(" Stelladaptor 1 emulates right joystick port\n", 1);
|
||||||
cout << " Stelladaptor 1 emulates right joystick port\n";
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(ourJoysticks[i].name == "Stelladaptor 2")
|
else if(ourJoysticks[i].name == "Stelladaptor 2")
|
||||||
|
@ -292,19 +283,16 @@ void EventHandler::mapStelladaptors(const string& sa1, const string& sa2)
|
||||||
if(sa2 == "left")
|
if(sa2 == "left")
|
||||||
{
|
{
|
||||||
ourJoysticks[i].type = JT_STELLADAPTOR_LEFT;
|
ourJoysticks[i].type = JT_STELLADAPTOR_LEFT;
|
||||||
if(showinfo)
|
myOSystem->logMessage(" Stelladaptor 2 emulates left joystick port\n", 1);
|
||||||
cout << " Stelladaptor 2 emulates left joystick port\n";
|
|
||||||
}
|
}
|
||||||
else if(sa2 == "right")
|
else if(sa2 == "right")
|
||||||
{
|
{
|
||||||
ourJoysticks[i].type = JT_STELLADAPTOR_RIGHT;
|
ourJoysticks[i].type = JT_STELLADAPTOR_RIGHT;
|
||||||
if(showinfo)
|
myOSystem->logMessage(" Stelladaptor 2 emulates right joystick port\n", 1);
|
||||||
cout << " Stelladaptor 2 emulates right joystick port\n";
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(showinfo)
|
myOSystem->logMessage("\n", 1);
|
||||||
cout << endl;
|
|
||||||
|
|
||||||
myOSystem->settings().setString("sa1", sa1);
|
myOSystem->settings().setString("sa1", sa1);
|
||||||
myOSystem->settings().setString("sa2", sa2);
|
myOSystem->settings().setString("sa2", sa2);
|
||||||
|
|
|
@ -68,13 +68,16 @@ FrameBuffer::~FrameBuffer(void)
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
bool FrameBuffer::initialize(const string& title, uInt32 width, uInt32 height)
|
bool FrameBuffer::initialize(const string& title, uInt32 width, uInt32 height)
|
||||||
{
|
{
|
||||||
|
ostringstream buf;
|
||||||
|
|
||||||
// Now (re)initialize the SDL video system
|
// Now (re)initialize the SDL video system
|
||||||
// These things only have to be done one per FrameBuffer creation
|
// These things only have to be done one per FrameBuffer creation
|
||||||
if(SDL_WasInit(SDL_INIT_VIDEO) == 0)
|
if(SDL_WasInit(SDL_INIT_VIDEO) == 0)
|
||||||
{
|
{
|
||||||
if(SDL_Init(SDL_INIT_VIDEO | SDL_INIT_TIMER) < 0)
|
if(SDL_Init(SDL_INIT_VIDEO | SDL_INIT_TIMER) < 0)
|
||||||
{
|
{
|
||||||
cerr << "ERROR: Couldn't initialize SDL: " << SDL_GetError() << endl;
|
buf << "ERROR: Couldn't initialize SDL: " << SDL_GetError() << endl;
|
||||||
|
myOSystem->logMessage(buf.str(), 0);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -108,7 +111,7 @@ bool FrameBuffer::initialize(const string& title, uInt32 width, uInt32 height)
|
||||||
|
|
||||||
if(!initSubsystem(mode))
|
if(!initSubsystem(mode))
|
||||||
{
|
{
|
||||||
cerr << "ERROR: Couldn't initialize video subsystem" << endl;
|
myOSystem->logMessage("ERROR: Couldn't initialize video subsystem\n", 0);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -155,8 +158,8 @@ bool FrameBuffer::initialize(const string& title, uInt32 width, uInt32 height)
|
||||||
|
|
||||||
// Finally, show some information about the framebuffer,
|
// Finally, show some information about the framebuffer,
|
||||||
// but only on the first initialization
|
// but only on the first initialization
|
||||||
if(myInitializedCount == 1 && myOSystem->settings().getBool("showinfo"))
|
if(myInitializedCount == 1)
|
||||||
cout << about() << endl;
|
myOSystem->logMessage(about() + "\n", 1);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -757,7 +760,7 @@ void FrameBuffer::setWindowIcon()
|
||||||
sscanf(stella_icon[0], "%u %u %u %u", &w, &h, &ncols, &nbytes);
|
sscanf(stella_icon[0], "%u %u %u %u", &w, &h, &ncols, &nbytes);
|
||||||
if((w != 32) || (h != 32) || (ncols > 255) || (nbytes > 1))
|
if((w != 32) || (h != 32) || (ncols > 255) || (nbytes > 1))
|
||||||
{
|
{
|
||||||
cerr << "ERROR: Couldn't load the icon.\n";
|
myOSystem->logMessage("ERROR: Couldn't load the application icon.\n", 0);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -779,7 +782,7 @@ void FrameBuffer::setWindowIcon()
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
cerr << "ERROR: Couldn't load the icon.\n";
|
myOSystem->logMessage("ERROR: Couldn't load the application icon.\n", 0);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
rgba[code] = col;
|
rgba[code] = col;
|
||||||
|
|
|
@ -123,33 +123,35 @@ OSystem::OSystem()
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
// Debugging info for the GUI widgets
|
// Debugging info for the GUI widgets
|
||||||
cerr << " kStaticTextWidget = " << kStaticTextWidget << endl;
|
ostringstream buf;
|
||||||
cerr << " kEditTextWidget = " << kEditTextWidget << endl;
|
buf << " kStaticTextWidget = " << kStaticTextWidget << endl
|
||||||
cerr << " kButtonWidget = " << kButtonWidget << endl;
|
<< " kEditTextWidget = " << kEditTextWidget << endl
|
||||||
cerr << " kCheckboxWidget = " << kCheckboxWidget << endl;
|
<< " kButtonWidget = " << kButtonWidget << endl
|
||||||
cerr << " kSliderWidget = " << kSliderWidget << endl;
|
<< " kCheckboxWidget = " << kCheckboxWidget << endl
|
||||||
cerr << " kListWidget = " << kListWidget << endl;
|
<< " kSliderWidget = " << kSliderWidget << endl
|
||||||
cerr << " kScrollBarWidget = " << kScrollBarWidget << endl;
|
<< " kListWidget = " << kListWidget << endl
|
||||||
cerr << " kPopUpWidget = " << kPopUpWidget << endl;
|
<< " kScrollBarWidget = " << kScrollBarWidget << endl
|
||||||
cerr << " kTabWidget = " << kTabWidget << endl;
|
<< " kPopUpWidget = " << kPopUpWidget << endl
|
||||||
cerr << " kEventMappingWidget = " << kEventMappingWidget << endl;
|
<< " kTabWidget = " << kTabWidget << endl
|
||||||
cerr << " kEditableWidget = " << kEditableWidget << endl;
|
<< " kEventMappingWidget = " << kEventMappingWidget << endl
|
||||||
cerr << " kAudioWidget = " << kAudioWidget << endl;
|
<< " kEditableWidget = " << kEditableWidget << endl
|
||||||
cerr << " kColorWidget = " << kColorWidget << endl;
|
<< " kAudioWidget = " << kAudioWidget << endl
|
||||||
cerr << " kCpuWidget = " << kCpuWidget << endl;
|
<< " kColorWidget = " << kColorWidget << endl
|
||||||
cerr << " kDataGridOpsWidget = " << kDataGridOpsWidget << endl;
|
<< " kCpuWidget = " << kCpuWidget << endl
|
||||||
cerr << " kDataGridWidget = " << kDataGridWidget << endl;
|
<< " kDataGridOpsWidget = " << kDataGridOpsWidget << endl
|
||||||
cerr << " kPromptWidget = " << kPromptWidget << endl;
|
<< " kDataGridWidget = " << kDataGridWidget << endl
|
||||||
cerr << " kRamWidget = " << kRamWidget << endl;
|
<< " kPromptWidget = " << kPromptWidget << endl
|
||||||
cerr << " kRomListWidget = " << kRomListWidget << endl;
|
<< " kRamWidget = " << kRamWidget << endl
|
||||||
cerr << " kRomWidget = " << kRomWidget << endl;
|
<< " kRomListWidget = " << kRomListWidget << endl
|
||||||
cerr << " kTiaInfoWidget = " << kTiaInfoWidget << endl;
|
<< " kRomWidget = " << kRomWidget << endl
|
||||||
cerr << " kTiaOutputWidget = " << kTiaOutputWidget << endl;
|
<< " kTiaInfoWidget = " << kTiaInfoWidget << endl
|
||||||
cerr << " kTiaWidget = " << kTiaWidget << endl;
|
<< " kTiaOutputWidget = " << kTiaOutputWidget << endl
|
||||||
cerr << " kTiaZoomWidget = " << kTiaZoomWidget << endl;
|
<< " kTiaWidget = " << kTiaWidget << endl
|
||||||
cerr << " kToggleBitWidget = " << kToggleBitWidget << endl;
|
<< " kTiaZoomWidget = " << kTiaZoomWidget << endl
|
||||||
cerr << " kTogglePixelWidget = " << kTogglePixelWidget << endl;
|
<< " kToggleBitWidget = " << kToggleBitWidget << endl
|
||||||
cerr << " kToggleWidget = " << kToggleWidget << endl;
|
<< " kTogglePixelWidget = " << kTogglePixelWidget << endl
|
||||||
|
<< " kToggleWidget = " << kToggleWidget << endl;
|
||||||
|
logMessage(buf.str(), 0);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -194,6 +196,12 @@ bool OSystem::create()
|
||||||
{
|
{
|
||||||
// Get updated paths for all configuration files
|
// Get updated paths for all configuration files
|
||||||
setConfigPaths();
|
setConfigPaths();
|
||||||
|
ostringstream buf;
|
||||||
|
buf << "Base directory: '" << myBaseDir << "'" << endl
|
||||||
|
<< "Configuration file: '" << myConfigFile << "'" << endl
|
||||||
|
<< "User game properties: '" << myPropertiesFile << "'" << endl
|
||||||
|
<< endl;
|
||||||
|
logMessage(buf.str(), 1);
|
||||||
|
|
||||||
// Get relevant information about the video hardware
|
// Get relevant information about the video hardware
|
||||||
// This must be done before any graphics context is created, since
|
// This must be done before any graphics context is created, since
|
||||||
|
@ -412,7 +420,7 @@ bool OSystem::createFrameBuffer()
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
default: // Should never happen
|
default: // Should never happen
|
||||||
cerr << "ERROR: Unknown emulation state in createFrameBuffer()" << endl;
|
logMessage("ERROR: Unknown emulation state in createFrameBuffer()\n", 0);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -434,7 +442,7 @@ bool OSystem::createFrameBuffer()
|
||||||
fallback:
|
fallback:
|
||||||
if(myFrameBuffer && myFrameBuffer->type() == kGLBuffer)
|
if(myFrameBuffer && myFrameBuffer->type() == kGLBuffer)
|
||||||
{
|
{
|
||||||
cerr << "ERROR: OpenGL mode failed, fallback to software" << endl;
|
logMessage("ERROR: OpenGL mode failed, fallback to software\n", 0);
|
||||||
delete myFrameBuffer; myFrameBuffer = NULL;
|
delete myFrameBuffer; myFrameBuffer = NULL;
|
||||||
mySettings->setString("video", "soft");
|
mySettings->setString("video", "soft");
|
||||||
bool ret = createFrameBuffer();
|
bool ret = createFrameBuffer();
|
||||||
|
@ -463,6 +471,8 @@ void OSystem::createSound()
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
bool OSystem::createConsole(const string& romfile, const string& md5sum)
|
bool OSystem::createConsole(const string& romfile, const string& md5sum)
|
||||||
{
|
{
|
||||||
|
ostringstream buf;
|
||||||
|
|
||||||
// Do a little error checking; it shouldn't be necessary
|
// Do a little error checking; it shouldn't be necessary
|
||||||
if(myConsole) deleteConsole();
|
if(myConsole) deleteConsole();
|
||||||
|
|
||||||
|
@ -474,7 +484,7 @@ bool OSystem::createConsole(const string& romfile, const string& md5sum)
|
||||||
showmessage = true; // we show a message if a ROM is being reloaded
|
showmessage = true; // we show a message if a ROM is being reloaded
|
||||||
if(myRomFile == "")
|
if(myRomFile == "")
|
||||||
{
|
{
|
||||||
cerr << "ERROR: Rom file not specified ..." << endl;
|
logMessage("ERROR: Rom file not specified ...\n", 0);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -511,7 +521,7 @@ bool OSystem::createConsole(const string& romfile, const string& md5sum)
|
||||||
myEventHandler->reset(EventHandler::S_EMULATE);
|
myEventHandler->reset(EventHandler::S_EMULATE);
|
||||||
if(!createFrameBuffer()) // Takes care of initializeVideo()
|
if(!createFrameBuffer()) // Takes care of initializeVideo()
|
||||||
{
|
{
|
||||||
cerr << "ERROR: Couldn't create framebuffer for console" << endl;
|
logMessage("ERROR: Couldn't create framebuffer for console\n", 0);
|
||||||
myEventHandler->reset(EventHandler::S_LAUNCHER);
|
myEventHandler->reset(EventHandler::S_LAUNCHER);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -524,10 +534,10 @@ bool OSystem::createConsole(const string& romfile, const string& md5sum)
|
||||||
else
|
else
|
||||||
myFrameBuffer->showMessage("Multicart " + type + ", loading ROM" + id);
|
myFrameBuffer->showMessage("Multicart " + type + ", loading ROM" + id);
|
||||||
}
|
}
|
||||||
if(mySettings->getBool("showinfo"))
|
buf << "Game console created:" << endl
|
||||||
cout << "Game console created:" << endl
|
<< " ROM file: " << myRomFile << endl << endl
|
||||||
<< " ROM file: " << myRomFile << endl << endl
|
<< getROMInfo(myConsole) << endl;
|
||||||
<< getROMInfo(myConsole) << endl;
|
logMessage(buf.str(), 1);
|
||||||
|
|
||||||
// Update the timing info for a new console run
|
// Update the timing info for a new console run
|
||||||
resetLoopTiming();
|
resetLoopTiming();
|
||||||
|
@ -537,7 +547,8 @@ bool OSystem::createConsole(const string& romfile, const string& md5sum)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
cerr << "ERROR: Couldn't create console for " << myRomFile << endl;
|
buf << "ERROR: Couldn't create console for " << myRomFile << endl;
|
||||||
|
logMessage(buf.str(), 0);
|
||||||
retval = false;
|
retval = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -562,16 +573,16 @@ void OSystem::deleteConsole()
|
||||||
#ifdef CHEATCODE_SUPPORT
|
#ifdef CHEATCODE_SUPPORT
|
||||||
myCheatManager->saveCheats(myConsole->properties().get(Cartridge_MD5));
|
myCheatManager->saveCheats(myConsole->properties().get(Cartridge_MD5));
|
||||||
#endif
|
#endif
|
||||||
if(mySettings->getBool("showinfo"))
|
ostringstream buf;
|
||||||
{
|
double executionTime = (double) myTimingInfo.totalTime / 1000000.0;
|
||||||
double executionTime = (double) myTimingInfo.totalTime / 1000000.0;
|
double framesPerSecond = (double) myTimingInfo.totalFrames / executionTime;
|
||||||
double framesPerSecond = (double) myTimingInfo.totalFrames / executionTime;
|
buf << "Game console stats:" << endl
|
||||||
cout << "Game console stats:" << endl
|
<< " Total frames drawn: " << myTimingInfo.totalFrames << endl
|
||||||
<< " Total frames drawn: " << myTimingInfo.totalFrames << endl
|
<< " Total time (sec): " << executionTime << endl
|
||||||
<< " Total time (sec): " << executionTime << endl
|
<< " Frames per second: " << framesPerSecond << endl
|
||||||
<< " Frames per second: " << framesPerSecond << endl
|
<< endl;
|
||||||
<< endl;
|
logMessage(buf.str(), 1);
|
||||||
}
|
|
||||||
delete myConsole; myConsole = NULL;
|
delete myConsole; myConsole = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -582,7 +593,7 @@ bool OSystem::createLauncher()
|
||||||
myEventHandler->reset(EventHandler::S_LAUNCHER);
|
myEventHandler->reset(EventHandler::S_LAUNCHER);
|
||||||
if(!createFrameBuffer())
|
if(!createFrameBuffer())
|
||||||
{
|
{
|
||||||
cerr << "ERROR: Couldn't create launcher" << endl;
|
logMessage("ERROR: Couldn't create launcher\n", 0);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
myLauncher->reStack();
|
myLauncher->reStack();
|
||||||
|
@ -625,6 +636,15 @@ string OSystem::MD5FromFile(const string& filename)
|
||||||
return md5;
|
return md5;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
void OSystem::logMessage(const string& message, uInt8 level)
|
||||||
|
{
|
||||||
|
if(level == 0)
|
||||||
|
cerr << message;
|
||||||
|
else if(level <= (uInt8)mySettings->getInt("showinfo"))
|
||||||
|
cout << message;
|
||||||
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
Console* OSystem::openConsole(const string& romfile, string& md5,
|
Console* OSystem::openConsole(const string& romfile, string& md5,
|
||||||
string& type, string& id)
|
string& type, string& id)
|
||||||
|
@ -689,7 +709,11 @@ Console* OSystem::openConsole(const string& romfile, string& md5,
|
||||||
console = new Console(this, cart, props);
|
console = new Console(this, cart, props);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
cerr << "ERROR: Couldn't open " << romfile << endl;
|
{
|
||||||
|
ostringstream buf;
|
||||||
|
buf << "ERROR: Couldn't open \'" << romfile << "\'" << endl;
|
||||||
|
logMessage(buf.str(), 0);
|
||||||
|
}
|
||||||
|
|
||||||
// Free the image since we don't need it any longer
|
// Free the image since we don't need it any longer
|
||||||
if(image != 0 && size > 0)
|
if(image != 0 && size > 0)
|
||||||
|
|
|
@ -358,7 +358,7 @@ class OSystem
|
||||||
Calculate the MD5sum of the given file.
|
Calculate the MD5sum of the given file.
|
||||||
|
|
||||||
@param filename Filename of potential ROM file
|
@param filename Filename of potential ROM file
|
||||||
*/
|
*/
|
||||||
string MD5FromFile(const string& filename);
|
string MD5FromFile(const string& filename);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -366,6 +366,15 @@ class OSystem
|
||||||
*/
|
*/
|
||||||
void quit() { myQuitLoop = true; }
|
void quit() { myQuitLoop = true; }
|
||||||
|
|
||||||
|
/**
|
||||||
|
Output a message to the a log (normally stdout).
|
||||||
|
|
||||||
|
@param message The message to be output
|
||||||
|
@param level If 0, always output the message, only output when
|
||||||
|
level is less than or equal to that in 'showinfo'
|
||||||
|
*/
|
||||||
|
void logMessage(const string& message, uInt8 level);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
//////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////
|
||||||
// The following methods are system-specific and must be implemented
|
// The following methods are system-specific and must be implemented
|
||||||
|
|
|
@ -49,9 +49,6 @@ PropertiesSet::~PropertiesSet()
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
void PropertiesSet::load(const string& filename)
|
void PropertiesSet::load(const string& filename)
|
||||||
{
|
{
|
||||||
if(myOSystem->settings().getBool("showinfo"))
|
|
||||||
cout << "User game properties: \'" << filename << "\'\n";
|
|
||||||
|
|
||||||
ifstream in(filename.c_str(), ios::in);
|
ifstream in(filename.c_str(), ios::in);
|
||||||
|
|
||||||
// Loop reading properties
|
// Loop reading properties
|
||||||
|
|
|
@ -118,7 +118,7 @@ Settings::Settings(OSystem* osystem)
|
||||||
|
|
||||||
// Misc options
|
// Misc options
|
||||||
setInternal("autoslot", "false");
|
setInternal("autoslot", "false");
|
||||||
setInternal("showinfo", "false");
|
setInternal("showinfo", "1");
|
||||||
setInternal("tiadriven", "false");
|
setInternal("tiadriven", "false");
|
||||||
setInternal("avoxport", "");
|
setInternal("avoxport", "");
|
||||||
setInternal("stats", "false");
|
setInternal("stats", "false");
|
||||||
|
@ -147,7 +147,7 @@ void Settings::loadConfig()
|
||||||
ifstream in(myOSystem->configFile().c_str());
|
ifstream in(myOSystem->configFile().c_str());
|
||||||
if(!in || !in.is_open())
|
if(!in || !in.is_open())
|
||||||
{
|
{
|
||||||
cout << "ERROR: Couldn't load settings file\n";
|
myOSystem->logMessage("ERROR: Couldn't load settings file\n", 0);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -212,7 +212,9 @@ string Settings::loadCommandLine(int argc, char** argv)
|
||||||
|
|
||||||
if(++i >= argc)
|
if(++i >= argc)
|
||||||
{
|
{
|
||||||
cerr << "Missing argument for '" << key << "'" << endl;
|
ostringstream buf;
|
||||||
|
buf << "Missing argument for '" << key << "'" << endl;
|
||||||
|
myOSystem->logMessage(buf.str(), 0);
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
string value = argv[i];
|
string value = argv[i];
|
||||||
|
@ -297,6 +299,10 @@ void Settings::validate()
|
||||||
s = getString("tv_noise");
|
s = getString("tv_noise");
|
||||||
if(s != "low" && s != "medium" && s != "high")
|
if(s != "low" && s != "medium" && s != "high")
|
||||||
setInternal("tv_noise", "off");
|
setInternal("tv_noise", "off");
|
||||||
|
|
||||||
|
i = getInt("showinfo");
|
||||||
|
if(i < 0 || i > 2)
|
||||||
|
setInternal("showinfo", "1");
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
@ -363,7 +369,7 @@ void Settings::usage()
|
||||||
<< endl
|
<< endl
|
||||||
#endif
|
#endif
|
||||||
<< " -cheat <code> Use the specified cheatcode (see manual for description)\n"
|
<< " -cheat <code> Use the specified cheatcode (see manual for description)\n"
|
||||||
<< " -showinfo <1|0> Shows some game info on commandline\n"
|
<< " -showinfo <0|1|2> Shows some application/game info on commandline\n"
|
||||||
<< " -joydeadzone <number> Sets 'deadzone' area for analog joysticks (0-29)\n"
|
<< " -joydeadzone <number> Sets 'deadzone' area for analog joysticks (0-29)\n"
|
||||||
<< " -joyallow4 <1|0> Allow all 4 directions on a joystick to be pressed simultaneously\n"
|
<< " -joyallow4 <1|0> Allow all 4 directions on a joystick to be pressed simultaneously\n"
|
||||||
<< " -usemouse <1|0> Use mouse for various controllers (paddle, driving, etc)\n"
|
<< " -usemouse <1|0> Use mouse for various controllers (paddle, driving, etc)\n"
|
||||||
|
@ -457,7 +463,7 @@ void Settings::saveConfig()
|
||||||
ofstream out(myOSystem->configFile().c_str());
|
ofstream out(myOSystem->configFile().c_str());
|
||||||
if(!out || !out.is_open())
|
if(!out || !out.is_open())
|
||||||
{
|
{
|
||||||
cout << "ERROR: Couldn't save settings file\n";
|
myOSystem->logMessage("ERROR: Couldn't save settings file\n", 0);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -35,19 +35,19 @@ class GameList
|
||||||
GameList();
|
GameList();
|
||||||
~GameList();
|
~GameList();
|
||||||
|
|
||||||
inline const string& name(int i)
|
inline const string& name(int i) const
|
||||||
{ return i < (int)myArray.size() ? myArray[i]._name : EmptyString; }
|
{ return i < (int)myArray.size() ? myArray[i]._name : EmptyString; }
|
||||||
inline const string& path(int i)
|
inline const string& path(int i) const
|
||||||
{ return i < (int)myArray.size() ? myArray[i]._path : EmptyString; }
|
{ return i < (int)myArray.size() ? myArray[i]._path : EmptyString; }
|
||||||
inline const string& md5(int i)
|
inline const string& md5(int i) const
|
||||||
{ return i < (int)myArray.size() ? myArray[i]._md5 : EmptyString; }
|
{ return i < (int)myArray.size() ? myArray[i]._md5 : EmptyString; }
|
||||||
inline const bool isDir(int i)
|
inline const bool isDir(int i) const
|
||||||
{ return i < (int)myArray.size() ? myArray[i]._isdir: false; }
|
{ return i < (int)myArray.size() ? myArray[i]._isdir: false; }
|
||||||
|
|
||||||
inline void setMd5(int i, const string& md5)
|
inline void setMd5(int i, const string& md5)
|
||||||
{ myArray[i]._md5 = md5; }
|
{ myArray[i]._md5 = md5; }
|
||||||
|
|
||||||
inline int size() { return myArray.size(); }
|
inline int size() const { return myArray.size(); }
|
||||||
inline void clear() { myArray.clear(); }
|
inline void clear() { myArray.clear(); }
|
||||||
|
|
||||||
void appendGame(const string& name, const string& path, const string& md5,
|
void appendGame(const string& name, const string& path, const string& md5,
|
||||||
|
|
Loading…
Reference in New Issue