NoGUI: general cleanup, add initialization stuff added in r5064, fixed the cocoa event loop not shutting down when not booting a game on OSX.

SysConf: removed the Save call in the dtor, this crashes on linux trying to read m_Filename (which might be already freed).
Common: set eol-style native, again.

Fixes Issue 2332

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@5082 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
j4ck.fr0st 2010-02-19 17:05:26 +00:00
parent 0819740b6a
commit 3a5a7de906
17 changed files with 3025 additions and 3029 deletions

View File

@ -27,10 +27,10 @@ SysConf::SysConf()
void SysConf::Reload() void SysConf::Reload()
{ {
if (m_IsValid) if (m_IsValid)
return; return;
if (LoadFromFile(File::GetUserPath(F_WIISYSCONF_IDX))) if (LoadFromFile(File::GetUserPath(F_WIISYSCONF_IDX)))
m_IsValid = true; m_IsValid = true;
} }
SysConf::~SysConf() SysConf::~SysConf()
@ -38,8 +38,6 @@ SysConf::~SysConf()
if (!m_IsValid) if (!m_IsValid)
return; return;
Save();
for (size_t i = 0; i < m_Entries.size() - 1; i++) for (size_t i = 0; i < m_Entries.size() - 1; i++)
{ {
delete [] m_Entries.at(i).data; delete [] m_Entries.at(i).data;

View File

@ -44,15 +44,12 @@
#include "cmdline.h" #include "cmdline.h"
#include "Thread.h" #include "Thread.h"
#include "PowerPC/PowerPC.h" #include "PowerPC/PowerPC.h"
#include "PluginManager.h" #include "PluginManager.h"
#include "ConfigManager.h"
#include "LogManager.h"
#include "BootManager.h" #include "BootManager.h"
void* g_pCodeWindow = NULL;
void* main_frame = NULL;
// OK, this thread boundary is DANGEROUS on linux
// wxPostEvent / wxAddPendingEvent is the solution.
void Host_NotifyMapLoaded(){} void Host_NotifyMapLoaded(){}
void Host_ShowJitResults(unsigned int address){} void Host_ShowJitResults(unsigned int address){}
@ -99,7 +96,7 @@ void Host_SysMessage(const char *fmt, ...)
msg[len - 1] = '\n'; msg[len - 1] = '\n';
msg[len] = '\0'; msg[len] = '\0';
} }
fprintf(stderr, msg); fprintf(stderr, "%s", msg);
} }
void Host_UpdateLeds(int led_bits) void Host_UpdateLeds(int led_bits)
@ -167,6 +164,7 @@ int appleMain(int argc, char *argv[]);
@end @end
volatile bool running;
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
@ -182,9 +180,10 @@ int main(int argc, char *argv[])
NSEvent *event = [[NSEvent alloc] init]; NSEvent *event = [[NSEvent alloc] init];
[thread cocoaThreadStart]; [thread cocoaThreadStart];
running = true;
//cocoa event loop //cocoa event loop
while(true) while(running)
{ {
event = [NSApp nextEventMatchingMask:NSAnyEventMask untilDate:[NSDate distantPast] inMode:NSDefaultRunLoopMode dequeue:YES ]; event = [NSApp nextEventMatchingMask:NSAnyEventMask untilDate:[NSDate distantPast] inMode:NSDefaultRunLoopMode dequeue:YES ];
if(cocoaSendEvent(event)) if(cocoaSendEvent(event))
@ -212,7 +211,7 @@ int main(int argc, char* argv[])
{ {
gengetopt_args_info args_info; gengetopt_args_info args_info;
if (cmdline_parser (argc, argv, &args_info) != 0) if (cmdline_parser(argc, argv, &args_info) != 0)
return(1); return(1);
if (args_info.inputs_num < 1) if (args_info.inputs_num < 1)
@ -224,30 +223,29 @@ int main(int argc, char* argv[])
updateMainFrameEvent.Init(); updateMainFrameEvent.Init();
cpu_info.Detect(); cpu_info.Detect();
LogManager::Init();
EventHandler::Init();
SConfig::Init();
CPluginManager::Init();
CPluginManager::GetInstance().ScanForPlugins(); CPluginManager::GetInstance().ScanForPlugins();
// check to see if ~/Library/Application Support/Dolphin exists; if not, create it if (BootManager::BootCore(bootFile)) //no use running the loop when booting fails
char AppSupportDir[MAXPATHLEN];
snprintf(AppSupportDir, sizeof(AppSupportDir), "%s/Library/Application Support", getenv("HOME"));
if (!File::Exists(AppSupportDir) || !File::IsDirectory(AppSupportDir))
PanicAlert("Could not open ~/Library/Application Support");
strncat(AppSupportDir, "/Dolphin", sizeof(AppSupportDir));
if (!File::Exists(AppSupportDir))
File::CreateDir(AppSupportDir);
if (!File::IsDirectory(AppSupportDir))
PanicAlert("~/Library/Application Support/Dolphin exists, but is not a directory");
chdir(AppSupportDir);
BootManager::BootCore(bootFile);
while (PowerPC::GetState() != PowerPC::CPU_POWERDOWN)
{ {
updateMainFrameEvent.Wait(); while (PowerPC::GetState() != PowerPC::CPU_POWERDOWN)
{
updateMainFrameEvent.Wait();
}
} }
#if defined(HAVE_COCOA) && HAVE_COCOA
running = false;
#endif
CPluginManager::Shutdown();
SConfig::Shutdown();
EventHandler::Shutdown();
LogManager::Shutdown();
cmdline_parser_free (&args_info); cmdline_parser_free (&args_info);
return(0); return(0);