mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-25 15:19:42 -06:00
set svn:eol-style=native for **.cpp
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@1442 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
@ -1,93 +1,93 @@
|
||||
// Copyright (C) 2003-2008 Dolphin Project.
|
||||
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, version 2.0.
|
||||
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License 2.0 for more details.
|
||||
|
||||
// A copy of the GPL 2.0 should have been included with the program.
|
||||
// If not, see http://www.gnu.org/licenses/
|
||||
|
||||
// Official SVN repository and contact information can be found at
|
||||
// http://code.google.com/p/dolphin-emu/
|
||||
#include "AboutDolphin.h"
|
||||
#include "svnrev.h"
|
||||
#include "CPUDetect.h"
|
||||
#include "../resources/dolphin_logo.cpp"
|
||||
|
||||
|
||||
BEGIN_EVENT_TABLE(AboutDolphin, wxDialog)
|
||||
EVT_CLOSE(AboutDolphin::OnClose)
|
||||
EVT_BUTTON(ID_CLOSE, AboutDolphin::CloseClick)
|
||||
END_EVENT_TABLE()
|
||||
|
||||
AboutDolphin::AboutDolphin(wxWindow *parent, wxWindowID id, const wxString &title, const wxPoint &position, const wxSize& size, long style)
|
||||
: wxDialog(parent, id, title, position, size, style)
|
||||
{
|
||||
CreateGUIControls();
|
||||
}
|
||||
|
||||
AboutDolphin::~AboutDolphin()
|
||||
{
|
||||
}
|
||||
|
||||
void AboutDolphin::CreateGUIControls()
|
||||
{
|
||||
m_Close = new wxButton(this, ID_CLOSE, wxT("Close"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
|
||||
//miloszwl@miloszwl.com (miloszwl.deviantart.com)
|
||||
|
||||
wxMemoryInputStream istream(dolphin_logo_png, sizeof dolphin_logo_png);
|
||||
wxImage iDolphinLogo(istream, wxBITMAP_TYPE_PNG);
|
||||
DolphinLogo = new wxBitmap(iDolphinLogo);
|
||||
sbDolphinLogo = new wxStaticBitmap(this, ID_LOGO, wxNullBitmap, wxDefaultPosition, wxDefaultSize, 0);
|
||||
sbDolphinLogo->SetBitmap(*DolphinLogo);
|
||||
std::string Text = std::string("Dolphin SVN revision ") + SVN_REV_STR + "\nCPU: " + cpu_info.Summarize() + "\n\n" // Maybe add OS/arch info too?
|
||||
"Copyright (c) by F|RES & ector 2003-2008\n"
|
||||
"Additional code by zerofrog, yaz0r, Schibo, Costis, JPeterson, etc etc...\n\n"
|
||||
"Greets to Azimer, Caustik, Costis, Desktopman, EFX, Epsilon, Falcon4Ever, Hotquik, Jazzmin, mamedevs, Masken, Martin64, or9, "
|
||||
" tmbinc, vEX, Zezu, Zilmar, and everyone we forget.\n\n"
|
||||
"Special thanks to Costis, CrowTRobo, Titanik, or9 and Hotquik for their reverse engineering and docs/demos.\n\n"
|
||||
"Big thanks to Gilles Mouchard whose Microlib PPC emulator gave our development a kickstart.\n\n"
|
||||
"Thanks to Frank Wille for his PowerPC disassembler, which or9 and we modified to include Gekko specifics.\n\n"
|
||||
"Thanks to Shinji Chiba for his GC ADPCM decoder.\n\n"
|
||||
"We are not affiliated with Nintendo in any way. Gamecube and Wii are trademarks of Nintendo.\n"
|
||||
"The emulator is for educational purposes only and should not be used to play games you do not legally own.\n\n";
|
||||
Message = new wxStaticText(this, ID_MESSAGE,
|
||||
wxString::FromAscii(Text.c_str()),
|
||||
wxDefaultPosition, wxDefaultSize, 0);
|
||||
Message->Wrap(this->GetSize().GetWidth());
|
||||
|
||||
sMain = new wxBoxSizer(wxVERTICAL);
|
||||
sMainHor = new wxBoxSizer(wxHORIZONTAL);
|
||||
sMainHor->Add(sbDolphinLogo);
|
||||
|
||||
sInfo = new wxBoxSizer(wxVERTICAL);
|
||||
sInfo->Add(Message, 1, wxEXPAND|wxALL, 5);
|
||||
sMainHor->Add(sInfo);
|
||||
sMain->Add(sMainHor, 1, wxEXPAND);
|
||||
|
||||
sButtons = new wxBoxSizer(wxHORIZONTAL);
|
||||
sButtons->Add(0, 0, 1, wxEXPAND, 5);
|
||||
sButtons->Add(m_Close, 0, wxALL, 5);
|
||||
sMain->Add(sButtons, 0, wxEXPAND);
|
||||
|
||||
this->SetSizer(sMain);
|
||||
sMain->Layout();
|
||||
|
||||
CenterOnParent();
|
||||
Fit();
|
||||
}
|
||||
|
||||
void AboutDolphin::OnClose(wxCloseEvent& WXUNUSED (event))
|
||||
{
|
||||
Destroy();
|
||||
}
|
||||
|
||||
void AboutDolphin::CloseClick(wxCommandEvent& WXUNUSED (event))
|
||||
{
|
||||
Close();
|
||||
}
|
||||
// Copyright (C) 2003-2008 Dolphin Project.
|
||||
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, version 2.0.
|
||||
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License 2.0 for more details.
|
||||
|
||||
// A copy of the GPL 2.0 should have been included with the program.
|
||||
// If not, see http://www.gnu.org/licenses/
|
||||
|
||||
// Official SVN repository and contact information can be found at
|
||||
// http://code.google.com/p/dolphin-emu/
|
||||
#include "AboutDolphin.h"
|
||||
#include "svnrev.h"
|
||||
#include "CPUDetect.h"
|
||||
#include "../resources/dolphin_logo.cpp"
|
||||
|
||||
|
||||
BEGIN_EVENT_TABLE(AboutDolphin, wxDialog)
|
||||
EVT_CLOSE(AboutDolphin::OnClose)
|
||||
EVT_BUTTON(ID_CLOSE, AboutDolphin::CloseClick)
|
||||
END_EVENT_TABLE()
|
||||
|
||||
AboutDolphin::AboutDolphin(wxWindow *parent, wxWindowID id, const wxString &title, const wxPoint &position, const wxSize& size, long style)
|
||||
: wxDialog(parent, id, title, position, size, style)
|
||||
{
|
||||
CreateGUIControls();
|
||||
}
|
||||
|
||||
AboutDolphin::~AboutDolphin()
|
||||
{
|
||||
}
|
||||
|
||||
void AboutDolphin::CreateGUIControls()
|
||||
{
|
||||
m_Close = new wxButton(this, ID_CLOSE, wxT("Close"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
|
||||
//miloszwl@miloszwl.com (miloszwl.deviantart.com)
|
||||
|
||||
wxMemoryInputStream istream(dolphin_logo_png, sizeof dolphin_logo_png);
|
||||
wxImage iDolphinLogo(istream, wxBITMAP_TYPE_PNG);
|
||||
DolphinLogo = new wxBitmap(iDolphinLogo);
|
||||
sbDolphinLogo = new wxStaticBitmap(this, ID_LOGO, wxNullBitmap, wxDefaultPosition, wxDefaultSize, 0);
|
||||
sbDolphinLogo->SetBitmap(*DolphinLogo);
|
||||
std::string Text = std::string("Dolphin SVN revision ") + SVN_REV_STR + "\nCPU: " + cpu_info.Summarize() + "\n\n" // Maybe add OS/arch info too?
|
||||
"Copyright (c) by F|RES & ector 2003-2008\n"
|
||||
"Additional code by zerofrog, yaz0r, Schibo, Costis, JPeterson, etc etc...\n\n"
|
||||
"Greets to Azimer, Caustik, Costis, Desktopman, EFX, Epsilon, Falcon4Ever, Hotquik, Jazzmin, mamedevs, Masken, Martin64, or9, "
|
||||
" tmbinc, vEX, Zezu, Zilmar, and everyone we forget.\n\n"
|
||||
"Special thanks to Costis, CrowTRobo, Titanik, or9 and Hotquik for their reverse engineering and docs/demos.\n\n"
|
||||
"Big thanks to Gilles Mouchard whose Microlib PPC emulator gave our development a kickstart.\n\n"
|
||||
"Thanks to Frank Wille for his PowerPC disassembler, which or9 and we modified to include Gekko specifics.\n\n"
|
||||
"Thanks to Shinji Chiba for his GC ADPCM decoder.\n\n"
|
||||
"We are not affiliated with Nintendo in any way. Gamecube and Wii are trademarks of Nintendo.\n"
|
||||
"The emulator is for educational purposes only and should not be used to play games you do not legally own.\n\n";
|
||||
Message = new wxStaticText(this, ID_MESSAGE,
|
||||
wxString::FromAscii(Text.c_str()),
|
||||
wxDefaultPosition, wxDefaultSize, 0);
|
||||
Message->Wrap(this->GetSize().GetWidth());
|
||||
|
||||
sMain = new wxBoxSizer(wxVERTICAL);
|
||||
sMainHor = new wxBoxSizer(wxHORIZONTAL);
|
||||
sMainHor->Add(sbDolphinLogo);
|
||||
|
||||
sInfo = new wxBoxSizer(wxVERTICAL);
|
||||
sInfo->Add(Message, 1, wxEXPAND|wxALL, 5);
|
||||
sMainHor->Add(sInfo);
|
||||
sMain->Add(sMainHor, 1, wxEXPAND);
|
||||
|
||||
sButtons = new wxBoxSizer(wxHORIZONTAL);
|
||||
sButtons->Add(0, 0, 1, wxEXPAND, 5);
|
||||
sButtons->Add(m_Close, 0, wxALL, 5);
|
||||
sMain->Add(sButtons, 0, wxEXPAND);
|
||||
|
||||
this->SetSizer(sMain);
|
||||
sMain->Layout();
|
||||
|
||||
CenterOnParent();
|
||||
Fit();
|
||||
}
|
||||
|
||||
void AboutDolphin::OnClose(wxCloseEvent& WXUNUSED (event))
|
||||
{
|
||||
Destroy();
|
||||
}
|
||||
|
||||
void AboutDolphin::CloseClick(wxCommandEvent& WXUNUSED (event))
|
||||
{
|
||||
Close();
|
||||
}
|
||||
|
@ -1,181 +1,181 @@
|
||||
// Copyright (C) 2003-2008 Dolphin Project.
|
||||
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, version 2.0.
|
||||
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License 2.0 for more details.
|
||||
|
||||
// A copy of the GPL 2.0 should have been included with the program.
|
||||
// If not, see http://www.gnu.org/licenses/
|
||||
|
||||
// Official SVN repository and contact information can be found at
|
||||
// http://code.google.com/p/dolphin-emu/
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "Globals.h"
|
||||
#include "Common.h"
|
||||
#include "IniFile.h"
|
||||
#include "BootManager.h"
|
||||
#include "ISOFile.h"
|
||||
#include "Volume.h"
|
||||
#include "VolumeCreator.h"
|
||||
#include "Config.h"
|
||||
#include "Core.h"
|
||||
#if defined(HAVE_WX) && HAVE_WX
|
||||
#include "ConfigMain.h"
|
||||
#include "Frame.h"
|
||||
#include "CodeWindow.h"
|
||||
#endif
|
||||
|
||||
static std::string s_DataBasePath_EUR = "Data_EUR";
|
||||
static std::string s_DataBasePath_USA = "Data_USA";
|
||||
static std::string s_DataBasePath_JAP = "Data_JAP";
|
||||
|
||||
#if defined(HAVE_WX) && HAVE_WX
|
||||
extern CFrame* main_frame;
|
||||
extern CCodeWindow* g_pCodeWindow;
|
||||
#endif
|
||||
|
||||
namespace BootManager
|
||||
{
|
||||
#ifdef _WIN32
|
||||
extern "C" HINSTANCE wxGetInstance();
|
||||
#endif
|
||||
|
||||
bool BootCore(const std::string& _rFilename)
|
||||
{
|
||||
SCoreStartupParameter StartUp = SConfig::GetInstance().m_LocalCoreStartupParameter;
|
||||
|
||||
#if defined(HAVE_WX) && HAVE_WX
|
||||
if (g_pCodeWindow)
|
||||
{
|
||||
// StartUp.bUseDualCore = code_frame->UseDualCore();
|
||||
StartUp.bUseJIT = !g_pCodeWindow->UseInterpreter();
|
||||
StartUp.bAutomaticStart = g_pCodeWindow->AutomaticStart();
|
||||
}
|
||||
else
|
||||
{
|
||||
// StartUp.bUseDualCore = false;
|
||||
// StartUp.bUseJIT = true;
|
||||
}
|
||||
#endif
|
||||
StartUp.m_BootType = SCoreStartupParameter::BOOT_ISO;
|
||||
StartUp.m_strFilename = _rFilename;
|
||||
SConfig::GetInstance().m_LastFilename = StartUp.m_strFilename;
|
||||
StartUp.bRunCompareClient = false;
|
||||
StartUp.bRunCompareServer = false;
|
||||
#if defined(HAVE_WX) && HAVE_WX
|
||||
StartUp.bEnableDebugging = g_pCodeWindow ? true : false; // RUNNING_DEBUG
|
||||
#endif
|
||||
std::string BaseDataPath;
|
||||
#ifdef _WIN32
|
||||
StartUp.hInstance = wxGetInstance();
|
||||
#ifdef _M_X64
|
||||
StartUp.bUseFastMem = true;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
if ( !StartUp.AutoSetup(SCoreStartupParameter::BOOT_DEFAULT) )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// ------------------------------------------------
|
||||
// Load game specific settings
|
||||
// ----------------
|
||||
IniFile ini;
|
||||
std::string unique_id = StartUp.GetUniqueID();
|
||||
if (unique_id.size() == 6 && ini.Load((FULL_GAMECONFIG_DIR + unique_id + ".ini").c_str()))
|
||||
{
|
||||
// ------------------------------------------------
|
||||
// General settings
|
||||
// ----------------
|
||||
ini.Get("Core", "UseDualCore", &StartUp.bUseDualCore, StartUp.bUseDualCore);
|
||||
ini.Get("Core", "SkipIdle", &StartUp.bSkipIdle, StartUp.bSkipIdle);
|
||||
ini.Get("Core", "OptimizeQuantizers", &StartUp.bOptimizeQuantizers, StartUp.bOptimizeQuantizers);
|
||||
|
||||
|
||||
// ------------------------------------------------
|
||||
// Update SYSCONF with game specific settings
|
||||
// ----------------
|
||||
bool bEnableProgressiveScan, bEnableWideScreen;
|
||||
//bRefreshList = false;
|
||||
FILE* pStream; // file handle
|
||||
u8 m_SYSCONF[0x4000]; // SYSCONF file
|
||||
u16 IPL_PGS = 0x17CC; // pregressive scan
|
||||
u16 IPL_AR = 0x04D9; // widescreen
|
||||
std::string FullSYSCONFPath = FULL_WII_USER_DIR "shared2/sys/SYSCONF";
|
||||
|
||||
// Load Wii SYSCONF
|
||||
pStream = NULL;
|
||||
pStream = fopen(FullSYSCONFPath.c_str(), "rb");
|
||||
if (pStream != NULL)
|
||||
{
|
||||
fread(m_SYSCONF, 1, 0x4000, pStream);
|
||||
fclose(pStream);
|
||||
|
||||
//wxMessageBox(wxString::Format(": %02x", m_SYSCONF[IPL_AR]));
|
||||
|
||||
ini.Get("Core", "EnableProgressiveScan", &bEnableProgressiveScan, (int)m_SYSCONF[IPL_PGS]);
|
||||
ini.Get("Core", "EnableWideScreen", &bEnableWideScreen, (int)m_SYSCONF[IPL_AR]);
|
||||
|
||||
m_SYSCONF[IPL_PGS] = bEnableProgressiveScan;
|
||||
m_SYSCONF[IPL_AR] = bEnableWideScreen;
|
||||
|
||||
//wxMessageBox(wxString::Format(": %02x", m_SYSCONF[IPL_AR]));
|
||||
|
||||
// Enable custom Wii SYSCONF settings by saving the file to shared2
|
||||
pStream = NULL;
|
||||
pStream = fopen(FullSYSCONFPath.c_str(), "wb");
|
||||
if (pStream != NULL)
|
||||
{
|
||||
fwrite(m_SYSCONF, 1, 0x4000, pStream);
|
||||
fclose(pStream);
|
||||
}
|
||||
else
|
||||
{
|
||||
PanicAlert("Could not write to %s", FullSYSCONFPath.c_str());
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
PanicAlert("Could not read %s", FullSYSCONFPath.c_str());
|
||||
}
|
||||
// ---------
|
||||
}
|
||||
// ---------
|
||||
#if defined(HAVE_WX) && HAVE_WX
|
||||
if(main_frame)
|
||||
StartUp.hMainWindow = main_frame->GetRenderHandle();
|
||||
#endif
|
||||
// init the core
|
||||
if (!Core::Init(StartUp))
|
||||
{
|
||||
PanicAlert("Couldn't init the core.\nCheck your configuration.");
|
||||
return(false);
|
||||
}
|
||||
|
||||
#if defined(HAVE_WX) && HAVE_WX
|
||||
// Boot to pause or not
|
||||
Core::SetState((g_pCodeWindow && !StartUp.bAutomaticStart)
|
||||
? Core::CORE_PAUSE : Core::CORE_RUN);
|
||||
#else
|
||||
Core::SetState(Core::CORE_RUN);
|
||||
#endif
|
||||
return(true);
|
||||
}
|
||||
|
||||
|
||||
void Stop()
|
||||
{
|
||||
Core::Stop();
|
||||
}
|
||||
} // namespace
|
||||
|
||||
// Copyright (C) 2003-2008 Dolphin Project.
|
||||
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, version 2.0.
|
||||
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License 2.0 for more details.
|
||||
|
||||
// A copy of the GPL 2.0 should have been included with the program.
|
||||
// If not, see http://www.gnu.org/licenses/
|
||||
|
||||
// Official SVN repository and contact information can be found at
|
||||
// http://code.google.com/p/dolphin-emu/
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "Globals.h"
|
||||
#include "Common.h"
|
||||
#include "IniFile.h"
|
||||
#include "BootManager.h"
|
||||
#include "ISOFile.h"
|
||||
#include "Volume.h"
|
||||
#include "VolumeCreator.h"
|
||||
#include "Config.h"
|
||||
#include "Core.h"
|
||||
#if defined(HAVE_WX) && HAVE_WX
|
||||
#include "ConfigMain.h"
|
||||
#include "Frame.h"
|
||||
#include "CodeWindow.h"
|
||||
#endif
|
||||
|
||||
static std::string s_DataBasePath_EUR = "Data_EUR";
|
||||
static std::string s_DataBasePath_USA = "Data_USA";
|
||||
static std::string s_DataBasePath_JAP = "Data_JAP";
|
||||
|
||||
#if defined(HAVE_WX) && HAVE_WX
|
||||
extern CFrame* main_frame;
|
||||
extern CCodeWindow* g_pCodeWindow;
|
||||
#endif
|
||||
|
||||
namespace BootManager
|
||||
{
|
||||
#ifdef _WIN32
|
||||
extern "C" HINSTANCE wxGetInstance();
|
||||
#endif
|
||||
|
||||
bool BootCore(const std::string& _rFilename)
|
||||
{
|
||||
SCoreStartupParameter StartUp = SConfig::GetInstance().m_LocalCoreStartupParameter;
|
||||
|
||||
#if defined(HAVE_WX) && HAVE_WX
|
||||
if (g_pCodeWindow)
|
||||
{
|
||||
// StartUp.bUseDualCore = code_frame->UseDualCore();
|
||||
StartUp.bUseJIT = !g_pCodeWindow->UseInterpreter();
|
||||
StartUp.bAutomaticStart = g_pCodeWindow->AutomaticStart();
|
||||
}
|
||||
else
|
||||
{
|
||||
// StartUp.bUseDualCore = false;
|
||||
// StartUp.bUseJIT = true;
|
||||
}
|
||||
#endif
|
||||
StartUp.m_BootType = SCoreStartupParameter::BOOT_ISO;
|
||||
StartUp.m_strFilename = _rFilename;
|
||||
SConfig::GetInstance().m_LastFilename = StartUp.m_strFilename;
|
||||
StartUp.bRunCompareClient = false;
|
||||
StartUp.bRunCompareServer = false;
|
||||
#if defined(HAVE_WX) && HAVE_WX
|
||||
StartUp.bEnableDebugging = g_pCodeWindow ? true : false; // RUNNING_DEBUG
|
||||
#endif
|
||||
std::string BaseDataPath;
|
||||
#ifdef _WIN32
|
||||
StartUp.hInstance = wxGetInstance();
|
||||
#ifdef _M_X64
|
||||
StartUp.bUseFastMem = true;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
if ( !StartUp.AutoSetup(SCoreStartupParameter::BOOT_DEFAULT) )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// ------------------------------------------------
|
||||
// Load game specific settings
|
||||
// ----------------
|
||||
IniFile ini;
|
||||
std::string unique_id = StartUp.GetUniqueID();
|
||||
if (unique_id.size() == 6 && ini.Load((FULL_GAMECONFIG_DIR + unique_id + ".ini").c_str()))
|
||||
{
|
||||
// ------------------------------------------------
|
||||
// General settings
|
||||
// ----------------
|
||||
ini.Get("Core", "UseDualCore", &StartUp.bUseDualCore, StartUp.bUseDualCore);
|
||||
ini.Get("Core", "SkipIdle", &StartUp.bSkipIdle, StartUp.bSkipIdle);
|
||||
ini.Get("Core", "OptimizeQuantizers", &StartUp.bOptimizeQuantizers, StartUp.bOptimizeQuantizers);
|
||||
|
||||
|
||||
// ------------------------------------------------
|
||||
// Update SYSCONF with game specific settings
|
||||
// ----------------
|
||||
bool bEnableProgressiveScan, bEnableWideScreen;
|
||||
//bRefreshList = false;
|
||||
FILE* pStream; // file handle
|
||||
u8 m_SYSCONF[0x4000]; // SYSCONF file
|
||||
u16 IPL_PGS = 0x17CC; // pregressive scan
|
||||
u16 IPL_AR = 0x04D9; // widescreen
|
||||
std::string FullSYSCONFPath = FULL_WII_USER_DIR "shared2/sys/SYSCONF";
|
||||
|
||||
// Load Wii SYSCONF
|
||||
pStream = NULL;
|
||||
pStream = fopen(FullSYSCONFPath.c_str(), "rb");
|
||||
if (pStream != NULL)
|
||||
{
|
||||
fread(m_SYSCONF, 1, 0x4000, pStream);
|
||||
fclose(pStream);
|
||||
|
||||
//wxMessageBox(wxString::Format(": %02x", m_SYSCONF[IPL_AR]));
|
||||
|
||||
ini.Get("Core", "EnableProgressiveScan", &bEnableProgressiveScan, (int)m_SYSCONF[IPL_PGS]);
|
||||
ini.Get("Core", "EnableWideScreen", &bEnableWideScreen, (int)m_SYSCONF[IPL_AR]);
|
||||
|
||||
m_SYSCONF[IPL_PGS] = bEnableProgressiveScan;
|
||||
m_SYSCONF[IPL_AR] = bEnableWideScreen;
|
||||
|
||||
//wxMessageBox(wxString::Format(": %02x", m_SYSCONF[IPL_AR]));
|
||||
|
||||
// Enable custom Wii SYSCONF settings by saving the file to shared2
|
||||
pStream = NULL;
|
||||
pStream = fopen(FullSYSCONFPath.c_str(), "wb");
|
||||
if (pStream != NULL)
|
||||
{
|
||||
fwrite(m_SYSCONF, 1, 0x4000, pStream);
|
||||
fclose(pStream);
|
||||
}
|
||||
else
|
||||
{
|
||||
PanicAlert("Could not write to %s", FullSYSCONFPath.c_str());
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
PanicAlert("Could not read %s", FullSYSCONFPath.c_str());
|
||||
}
|
||||
// ---------
|
||||
}
|
||||
// ---------
|
||||
#if defined(HAVE_WX) && HAVE_WX
|
||||
if(main_frame)
|
||||
StartUp.hMainWindow = main_frame->GetRenderHandle();
|
||||
#endif
|
||||
// init the core
|
||||
if (!Core::Init(StartUp))
|
||||
{
|
||||
PanicAlert("Couldn't init the core.\nCheck your configuration.");
|
||||
return(false);
|
||||
}
|
||||
|
||||
#if defined(HAVE_WX) && HAVE_WX
|
||||
// Boot to pause or not
|
||||
Core::SetState((g_pCodeWindow && !StartUp.bAutomaticStart)
|
||||
? Core::CORE_PAUSE : Core::CORE_RUN);
|
||||
#else
|
||||
Core::SetState(Core::CORE_RUN);
|
||||
#endif
|
||||
return(true);
|
||||
}
|
||||
|
||||
|
||||
void Stop()
|
||||
{
|
||||
Core::Stop();
|
||||
}
|
||||
} // namespace
|
||||
|
||||
|
@ -1,178 +1,178 @@
|
||||
// Copyright (C) 2003-2008 Dolphin Project.
|
||||
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, version 2.0.
|
||||
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License 2.0 for more details.
|
||||
|
||||
// A copy of the GPL 2.0 should have been included with the program.
|
||||
// If not, see http://www.gnu.org/licenses/
|
||||
|
||||
// Official SVN repository and contact information can be found at
|
||||
// http://code.google.com/p/dolphin-emu/
|
||||
|
||||
#include "Globals.h"
|
||||
#include "CheatsWindow.h"
|
||||
#include "ActionReplay.h"
|
||||
#include "Core.h"
|
||||
|
||||
BEGIN_EVENT_TABLE(wxCheatsWindow, wxWindow)
|
||||
EVT_SIZE( wxCheatsWindow::OnEvent_Window_Resize)
|
||||
EVT_CLOSE( wxCheatsWindow::OnEvent_Window_Close)
|
||||
EVT_BUTTON(ID_BUTTON_CLOSE, wxCheatsWindow::OnEvent_ButtonClose_Press)
|
||||
EVT_LISTBOX(ID_CHECKLISTBOX_CHEATSLIST, wxCheatsWindow::OnEvent_CheatsList_ItemSelected)
|
||||
EVT_CHECKLISTBOX(ID_CHECKLISTBOX_CHEATSLIST, wxCheatsWindow::OnEvent_CheatsList_ItemToggled)
|
||||
EVT_BUTTON(ID_BUTTON_APPLYCODES, wxCheatsWindow::OnEvent_ButtonUpdateCodes_Press)
|
||||
END_EVENT_TABLE()
|
||||
|
||||
wxCheatsWindow::wxCheatsWindow(wxFrame* parent, const wxPoint& pos, const wxSize& size) : wxFrame(parent, wxID_ANY, _T("Action Replay"), pos, size, wxCHEATSWINDOW_STYLE)
|
||||
{
|
||||
// Create the GUI controls
|
||||
Init_ChildControls();
|
||||
|
||||
// Setup Window
|
||||
SetBackgroundColour(m_Notebook_Main->GetBackgroundColour());
|
||||
SetSize(size);
|
||||
SetPosition(pos);
|
||||
|
||||
// Load Data
|
||||
Load_ARCodes();
|
||||
|
||||
Layout();
|
||||
Show();
|
||||
}
|
||||
|
||||
wxCheatsWindow::~wxCheatsWindow()
|
||||
{
|
||||
// On Disposal
|
||||
}
|
||||
|
||||
void wxCheatsWindow::Init_ChildControls()
|
||||
{
|
||||
// Main Notebook
|
||||
m_Notebook_Main = new wxNotebook(this, ID_NOTEBOOK_MAIN, wxDefaultPosition, wxDefaultSize);
|
||||
// --- Tabs ---
|
||||
// $ Cheats List Tab
|
||||
m_Tab_Cheats = new wxPanel(m_Notebook_Main, ID_TAB_CHEATS, wxDefaultPosition, wxDefaultSize);
|
||||
m_CheckListBox_CheatsList = new wxCheckListBox(m_Tab_Cheats, ID_CHECKLISTBOX_CHEATSLIST, wxDefaultPosition, wxSize(300, 0), m_CheatStringList, wxLB_HSCROLL, wxDefaultValidator);
|
||||
m_Label_Codename = new wxStaticText(m_Tab_Cheats, ID_LABEL_CODENAME, _T("Name: "), wxDefaultPosition, wxDefaultSize);
|
||||
m_GroupBox_Info = new wxStaticBox(m_Tab_Cheats, ID_GROUPBOX_INFO, _T("Code Info"), wxDefaultPosition, wxDefaultSize);
|
||||
m_Button_ApplyCodes = new wxButton(m_Tab_Cheats, ID_BUTTON_APPLYCODES, _T("Apply Changes"), wxDefaultPosition, wxDefaultSize);
|
||||
m_Label_NumCodes = new wxStaticText(m_Tab_Cheats, ID_LABEL_NUMCODES, _T("Number Of Codes: "), wxDefaultPosition, wxDefaultSize);
|
||||
m_ListBox_CodesList = new wxListBox(m_Tab_Cheats, ID_LISTBOX_CODESLIST, wxDefaultPosition, wxSize(120, 150), 0, 0, wxLB_HSCROLL);
|
||||
|
||||
wxBoxSizer* sCheatsListH = new wxBoxSizer(wxHORIZONTAL);
|
||||
sCheatsListH->Add(m_CheckListBox_CheatsList, 1, wxALL|wxEXPAND, 5);
|
||||
|
||||
wxStaticBoxSizer* sGroupBoxInfo = new wxStaticBoxSizer(m_GroupBox_Info, wxVERTICAL);
|
||||
sGroupBoxInfo->Add(m_Label_Codename, 0, wxALL, 5);
|
||||
sGroupBoxInfo->Add(m_Label_NumCodes, 0, wxALL, 5);
|
||||
sGroupBoxInfo->Add(m_ListBox_CodesList, 0, wxALL, 5);
|
||||
|
||||
wxBoxSizer* sB1 = new wxBoxSizer(wxVERTICAL);
|
||||
sB1->Add(m_Button_ApplyCodes, 0, wxALL, 5);
|
||||
sB1->Add(sGroupBoxInfo, 0, wxALL, 5);
|
||||
|
||||
m_Sizer_TabCheats = new wxGridBagSizer();
|
||||
m_Sizer_TabCheats->AddGrowableRow(0);
|
||||
m_Sizer_TabCheats->Add(sCheatsListH, wxGBPosition(0, 0), wxGBSpan(1, 1), wxEXPAND|wxALL, 5);
|
||||
m_Sizer_TabCheats->Add(sB1, wxGBPosition(0, 1), wxGBSpan(1, 1), wxALIGN_LEFT|wxALL, 5);
|
||||
|
||||
m_Tab_Cheats->SetSizer(m_Sizer_TabCheats);
|
||||
m_Tab_Cheats->Layout();
|
||||
|
||||
|
||||
// $ Log Tab
|
||||
m_Tab_Log = new wxPanel(m_Notebook_Main, ID_TAB_LOG, wxDefaultPosition, wxDefaultSize);
|
||||
|
||||
// Add Tabs to Notebook
|
||||
m_Notebook_Main->AddPage(m_Tab_Cheats, _T("Codes List"));
|
||||
m_Notebook_Main->AddPage(m_Tab_Log, _T("Logging"));
|
||||
|
||||
// Button Strip
|
||||
m_Button_Close = new wxButton(this, ID_BUTTON_CLOSE, _T("Close"), wxDefaultPosition, wxDefaultSize);
|
||||
wxBoxSizer* sButtons = new wxBoxSizer(wxHORIZONTAL);
|
||||
sButtons->Add(m_Button_Close, 0, wxALL, 5);
|
||||
|
||||
wxBoxSizer* sMain = new wxBoxSizer(wxVERTICAL);
|
||||
sMain->Add(m_Notebook_Main, 1, wxEXPAND|wxALL, 5);
|
||||
sMain->Add(sButtons, 0, wxALL, 5);
|
||||
SetSizer(sMain);
|
||||
Layout();
|
||||
|
||||
Fit();
|
||||
}
|
||||
void wxCheatsWindow::OnEvent_Window_Resize(wxSizeEvent& WXUNUSED (event))
|
||||
{
|
||||
Layout();
|
||||
}
|
||||
void wxCheatsWindow::OnEvent_ButtonClose_Press(wxCommandEvent& WXUNUSED (event))
|
||||
{
|
||||
Destroy();
|
||||
}
|
||||
void wxCheatsWindow::OnEvent_Window_Close(wxCloseEvent& WXUNUSED (event))
|
||||
{
|
||||
Destroy();
|
||||
}
|
||||
void wxCheatsWindow::Load_ARCodes()
|
||||
{
|
||||
indexList.clear();
|
||||
size_t size = ActionReplay_GetCodeListSize();
|
||||
for (size_t i = 0; i < size; i++)
|
||||
{
|
||||
ARCode code = ActionReplay_GetARCode(i);
|
||||
ARCodeIndex ind;
|
||||
u32 index = m_CheckListBox_CheatsList->Append(wxString::FromAscii(code.name.c_str()));
|
||||
m_CheckListBox_CheatsList->Check(index, code.active);
|
||||
ind.index = i;
|
||||
ind.uiIndex = index;
|
||||
indexList.push_back(ind);
|
||||
}
|
||||
}
|
||||
void wxCheatsWindow::OnEvent_CheatsList_ItemSelected(wxCommandEvent& WXUNUSED (event))
|
||||
{
|
||||
int index = m_CheckListBox_CheatsList->GetSelection();
|
||||
for (size_t i = 0; i < indexList.size(); i++)
|
||||
{
|
||||
if ((int)indexList[i].uiIndex == index)
|
||||
{
|
||||
ARCode code = ActionReplay_GetARCode(i);
|
||||
m_Label_Codename->SetLabel(wxT("Name: ") + wxString::FromAscii(code.name.c_str()));
|
||||
char text[CHAR_MAX];
|
||||
char* numcodes = text;
|
||||
sprintf(numcodes, "Number of Codes: %i", code.ops.size());
|
||||
m_Label_NumCodes->SetLabel(wxString::FromAscii(numcodes));
|
||||
m_ListBox_CodesList->Clear();
|
||||
for (size_t j = 0; j < code.ops.size(); j++)
|
||||
{
|
||||
char text2[CHAR_MAX];
|
||||
char* ops = text2;
|
||||
sprintf(ops, "%08x %08x", code.ops[j].cmd_addr, code.ops[j].value);
|
||||
m_ListBox_CodesList->Append(wxString::FromAscii(ops));
|
||||
}
|
||||
}
|
||||
}
|
||||
m_Sizer_TabCheats->Layout();
|
||||
}
|
||||
void wxCheatsWindow::OnEvent_CheatsList_ItemToggled(wxCommandEvent& WXUNUSED (event))
|
||||
{
|
||||
int index = m_CheckListBox_CheatsList->GetSelection();
|
||||
for (size_t i = 0; i < indexList.size(); i++)
|
||||
{
|
||||
if ((int)indexList[i].uiIndex == index)
|
||||
{
|
||||
ActionReplay_SetARCode_IsActive(m_CheckListBox_CheatsList->IsChecked(index), indexList[i].index);
|
||||
}
|
||||
}
|
||||
}
|
||||
void wxCheatsWindow::OnEvent_ButtonUpdateCodes_Press(wxCommandEvent& WXUNUSED (event))
|
||||
{
|
||||
for (size_t i = 0; i < indexList.size(); i++)
|
||||
{
|
||||
ActionReplay_SetARCode_IsActive(m_CheckListBox_CheatsList->IsChecked(indexList[i].uiIndex), indexList[i].index);
|
||||
}
|
||||
}
|
||||
// Copyright (C) 2003-2008 Dolphin Project.
|
||||
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, version 2.0.
|
||||
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License 2.0 for more details.
|
||||
|
||||
// A copy of the GPL 2.0 should have been included with the program.
|
||||
// If not, see http://www.gnu.org/licenses/
|
||||
|
||||
// Official SVN repository and contact information can be found at
|
||||
// http://code.google.com/p/dolphin-emu/
|
||||
|
||||
#include "Globals.h"
|
||||
#include "CheatsWindow.h"
|
||||
#include "ActionReplay.h"
|
||||
#include "Core.h"
|
||||
|
||||
BEGIN_EVENT_TABLE(wxCheatsWindow, wxWindow)
|
||||
EVT_SIZE( wxCheatsWindow::OnEvent_Window_Resize)
|
||||
EVT_CLOSE( wxCheatsWindow::OnEvent_Window_Close)
|
||||
EVT_BUTTON(ID_BUTTON_CLOSE, wxCheatsWindow::OnEvent_ButtonClose_Press)
|
||||
EVT_LISTBOX(ID_CHECKLISTBOX_CHEATSLIST, wxCheatsWindow::OnEvent_CheatsList_ItemSelected)
|
||||
EVT_CHECKLISTBOX(ID_CHECKLISTBOX_CHEATSLIST, wxCheatsWindow::OnEvent_CheatsList_ItemToggled)
|
||||
EVT_BUTTON(ID_BUTTON_APPLYCODES, wxCheatsWindow::OnEvent_ButtonUpdateCodes_Press)
|
||||
END_EVENT_TABLE()
|
||||
|
||||
wxCheatsWindow::wxCheatsWindow(wxFrame* parent, const wxPoint& pos, const wxSize& size) : wxFrame(parent, wxID_ANY, _T("Action Replay"), pos, size, wxCHEATSWINDOW_STYLE)
|
||||
{
|
||||
// Create the GUI controls
|
||||
Init_ChildControls();
|
||||
|
||||
// Setup Window
|
||||
SetBackgroundColour(m_Notebook_Main->GetBackgroundColour());
|
||||
SetSize(size);
|
||||
SetPosition(pos);
|
||||
|
||||
// Load Data
|
||||
Load_ARCodes();
|
||||
|
||||
Layout();
|
||||
Show();
|
||||
}
|
||||
|
||||
wxCheatsWindow::~wxCheatsWindow()
|
||||
{
|
||||
// On Disposal
|
||||
}
|
||||
|
||||
void wxCheatsWindow::Init_ChildControls()
|
||||
{
|
||||
// Main Notebook
|
||||
m_Notebook_Main = new wxNotebook(this, ID_NOTEBOOK_MAIN, wxDefaultPosition, wxDefaultSize);
|
||||
// --- Tabs ---
|
||||
// $ Cheats List Tab
|
||||
m_Tab_Cheats = new wxPanel(m_Notebook_Main, ID_TAB_CHEATS, wxDefaultPosition, wxDefaultSize);
|
||||
m_CheckListBox_CheatsList = new wxCheckListBox(m_Tab_Cheats, ID_CHECKLISTBOX_CHEATSLIST, wxDefaultPosition, wxSize(300, 0), m_CheatStringList, wxLB_HSCROLL, wxDefaultValidator);
|
||||
m_Label_Codename = new wxStaticText(m_Tab_Cheats, ID_LABEL_CODENAME, _T("Name: "), wxDefaultPosition, wxDefaultSize);
|
||||
m_GroupBox_Info = new wxStaticBox(m_Tab_Cheats, ID_GROUPBOX_INFO, _T("Code Info"), wxDefaultPosition, wxDefaultSize);
|
||||
m_Button_ApplyCodes = new wxButton(m_Tab_Cheats, ID_BUTTON_APPLYCODES, _T("Apply Changes"), wxDefaultPosition, wxDefaultSize);
|
||||
m_Label_NumCodes = new wxStaticText(m_Tab_Cheats, ID_LABEL_NUMCODES, _T("Number Of Codes: "), wxDefaultPosition, wxDefaultSize);
|
||||
m_ListBox_CodesList = new wxListBox(m_Tab_Cheats, ID_LISTBOX_CODESLIST, wxDefaultPosition, wxSize(120, 150), 0, 0, wxLB_HSCROLL);
|
||||
|
||||
wxBoxSizer* sCheatsListH = new wxBoxSizer(wxHORIZONTAL);
|
||||
sCheatsListH->Add(m_CheckListBox_CheatsList, 1, wxALL|wxEXPAND, 5);
|
||||
|
||||
wxStaticBoxSizer* sGroupBoxInfo = new wxStaticBoxSizer(m_GroupBox_Info, wxVERTICAL);
|
||||
sGroupBoxInfo->Add(m_Label_Codename, 0, wxALL, 5);
|
||||
sGroupBoxInfo->Add(m_Label_NumCodes, 0, wxALL, 5);
|
||||
sGroupBoxInfo->Add(m_ListBox_CodesList, 0, wxALL, 5);
|
||||
|
||||
wxBoxSizer* sB1 = new wxBoxSizer(wxVERTICAL);
|
||||
sB1->Add(m_Button_ApplyCodes, 0, wxALL, 5);
|
||||
sB1->Add(sGroupBoxInfo, 0, wxALL, 5);
|
||||
|
||||
m_Sizer_TabCheats = new wxGridBagSizer();
|
||||
m_Sizer_TabCheats->AddGrowableRow(0);
|
||||
m_Sizer_TabCheats->Add(sCheatsListH, wxGBPosition(0, 0), wxGBSpan(1, 1), wxEXPAND|wxALL, 5);
|
||||
m_Sizer_TabCheats->Add(sB1, wxGBPosition(0, 1), wxGBSpan(1, 1), wxALIGN_LEFT|wxALL, 5);
|
||||
|
||||
m_Tab_Cheats->SetSizer(m_Sizer_TabCheats);
|
||||
m_Tab_Cheats->Layout();
|
||||
|
||||
|
||||
// $ Log Tab
|
||||
m_Tab_Log = new wxPanel(m_Notebook_Main, ID_TAB_LOG, wxDefaultPosition, wxDefaultSize);
|
||||
|
||||
// Add Tabs to Notebook
|
||||
m_Notebook_Main->AddPage(m_Tab_Cheats, _T("Codes List"));
|
||||
m_Notebook_Main->AddPage(m_Tab_Log, _T("Logging"));
|
||||
|
||||
// Button Strip
|
||||
m_Button_Close = new wxButton(this, ID_BUTTON_CLOSE, _T("Close"), wxDefaultPosition, wxDefaultSize);
|
||||
wxBoxSizer* sButtons = new wxBoxSizer(wxHORIZONTAL);
|
||||
sButtons->Add(m_Button_Close, 0, wxALL, 5);
|
||||
|
||||
wxBoxSizer* sMain = new wxBoxSizer(wxVERTICAL);
|
||||
sMain->Add(m_Notebook_Main, 1, wxEXPAND|wxALL, 5);
|
||||
sMain->Add(sButtons, 0, wxALL, 5);
|
||||
SetSizer(sMain);
|
||||
Layout();
|
||||
|
||||
Fit();
|
||||
}
|
||||
void wxCheatsWindow::OnEvent_Window_Resize(wxSizeEvent& WXUNUSED (event))
|
||||
{
|
||||
Layout();
|
||||
}
|
||||
void wxCheatsWindow::OnEvent_ButtonClose_Press(wxCommandEvent& WXUNUSED (event))
|
||||
{
|
||||
Destroy();
|
||||
}
|
||||
void wxCheatsWindow::OnEvent_Window_Close(wxCloseEvent& WXUNUSED (event))
|
||||
{
|
||||
Destroy();
|
||||
}
|
||||
void wxCheatsWindow::Load_ARCodes()
|
||||
{
|
||||
indexList.clear();
|
||||
size_t size = ActionReplay_GetCodeListSize();
|
||||
for (size_t i = 0; i < size; i++)
|
||||
{
|
||||
ARCode code = ActionReplay_GetARCode(i);
|
||||
ARCodeIndex ind;
|
||||
u32 index = m_CheckListBox_CheatsList->Append(wxString::FromAscii(code.name.c_str()));
|
||||
m_CheckListBox_CheatsList->Check(index, code.active);
|
||||
ind.index = i;
|
||||
ind.uiIndex = index;
|
||||
indexList.push_back(ind);
|
||||
}
|
||||
}
|
||||
void wxCheatsWindow::OnEvent_CheatsList_ItemSelected(wxCommandEvent& WXUNUSED (event))
|
||||
{
|
||||
int index = m_CheckListBox_CheatsList->GetSelection();
|
||||
for (size_t i = 0; i < indexList.size(); i++)
|
||||
{
|
||||
if ((int)indexList[i].uiIndex == index)
|
||||
{
|
||||
ARCode code = ActionReplay_GetARCode(i);
|
||||
m_Label_Codename->SetLabel(wxT("Name: ") + wxString::FromAscii(code.name.c_str()));
|
||||
char text[CHAR_MAX];
|
||||
char* numcodes = text;
|
||||
sprintf(numcodes, "Number of Codes: %i", code.ops.size());
|
||||
m_Label_NumCodes->SetLabel(wxString::FromAscii(numcodes));
|
||||
m_ListBox_CodesList->Clear();
|
||||
for (size_t j = 0; j < code.ops.size(); j++)
|
||||
{
|
||||
char text2[CHAR_MAX];
|
||||
char* ops = text2;
|
||||
sprintf(ops, "%08x %08x", code.ops[j].cmd_addr, code.ops[j].value);
|
||||
m_ListBox_CodesList->Append(wxString::FromAscii(ops));
|
||||
}
|
||||
}
|
||||
}
|
||||
m_Sizer_TabCheats->Layout();
|
||||
}
|
||||
void wxCheatsWindow::OnEvent_CheatsList_ItemToggled(wxCommandEvent& WXUNUSED (event))
|
||||
{
|
||||
int index = m_CheckListBox_CheatsList->GetSelection();
|
||||
for (size_t i = 0; i < indexList.size(); i++)
|
||||
{
|
||||
if ((int)indexList[i].uiIndex == index)
|
||||
{
|
||||
ActionReplay_SetARCode_IsActive(m_CheckListBox_CheatsList->IsChecked(index), indexList[i].index);
|
||||
}
|
||||
}
|
||||
}
|
||||
void wxCheatsWindow::OnEvent_ButtonUpdateCodes_Press(wxCommandEvent& WXUNUSED (event))
|
||||
{
|
||||
for (size_t i = 0; i < indexList.size(); i++)
|
||||
{
|
||||
ActionReplay_SetARCode_IsActive(m_CheckListBox_CheatsList->IsChecked(indexList[i].uiIndex), indexList[i].index);
|
||||
}
|
||||
}
|
||||
|
@ -1,137 +1,137 @@
|
||||
// Copyright (C) 2003-2008 Dolphin Project.
|
||||
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, version 2.0.
|
||||
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License 2.0 for more details.
|
||||
|
||||
// A copy of the GPL 2.0 should have been included with the program.
|
||||
// If not, see http://www.gnu.org/licenses/
|
||||
|
||||
// Official SVN repository and contact information can be found at
|
||||
// http://code.google.com/p/dolphin-emu/
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "Globals.h"
|
||||
#include "Common.h"
|
||||
#include "IniFile.h"
|
||||
#include "Config.h"
|
||||
|
||||
SConfig SConfig::m_Instance;
|
||||
|
||||
|
||||
SConfig::SConfig()
|
||||
{
|
||||
LoadSettings();
|
||||
}
|
||||
|
||||
|
||||
SConfig::~SConfig()
|
||||
{
|
||||
SaveSettings();
|
||||
}
|
||||
|
||||
|
||||
void SConfig::SaveSettings()
|
||||
{
|
||||
IniFile ini;
|
||||
// ini.Load(CONFIG_FILE); // yes we must load first to not kill unknown stuff
|
||||
|
||||
// misc
|
||||
{
|
||||
ini.Set("General", "LastFilename", m_LastFilename);
|
||||
|
||||
// ISO folders
|
||||
ini.Set("General", "GCMPathes", (int)m_ISOFolder.size());
|
||||
|
||||
for (size_t i = 0; i < m_ISOFolder.size(); i++)
|
||||
{
|
||||
TCHAR tmp[16];
|
||||
sprintf(tmp, "GCMPath%i", (int)i);
|
||||
ini.Set("General", tmp, m_ISOFolder[i]);
|
||||
}
|
||||
}
|
||||
|
||||
// core
|
||||
{
|
||||
ini.Set("Core", "GFXPlugin", m_LocalCoreStartupParameter.m_strVideoPlugin);
|
||||
ini.Set("Core", "DSPPlugin", m_LocalCoreStartupParameter.m_strDSPPlugin);
|
||||
ini.Set("Core", "PadPlugin", m_LocalCoreStartupParameter.m_strPadPlugin);
|
||||
ini.Set("Core", "WiiMotePlugin", m_LocalCoreStartupParameter.m_strWiimotePlugin);
|
||||
|
||||
ini.Set("Core", "HLEBios", m_LocalCoreStartupParameter.bHLEBios);
|
||||
ini.Set("Core", "UseDynarec", m_LocalCoreStartupParameter.bUseJIT);
|
||||
ini.Set("Core", "UseDualCore", m_LocalCoreStartupParameter.bUseDualCore);
|
||||
ini.Set("Core", "SkipIdle", m_LocalCoreStartupParameter.bSkipIdle);
|
||||
ini.Set("Core", "LockThreads", m_LocalCoreStartupParameter.bLockThreads);
|
||||
ini.Set("Core", "DefaultGCM", m_LocalCoreStartupParameter.m_strDefaultGCM);
|
||||
ini.Set("Core", "DVDRoot", m_LocalCoreStartupParameter.m_strDVDRoot);
|
||||
ini.Set("Core", "OptimizeQuantizers", m_LocalCoreStartupParameter.bOptimizeQuantizers);
|
||||
ini.Set("Core", "EnableCheats", m_LocalCoreStartupParameter.bEnableCheats);
|
||||
ini.Set("Core", "SelectedLanguage", m_LocalCoreStartupParameter.SelectedLanguage);
|
||||
ini.Set("Core", "RunCompareServer", m_LocalCoreStartupParameter.bRunCompareServer);
|
||||
ini.Set("Core", "RunCompareClient", m_LocalCoreStartupParameter.bRunCompareClient);
|
||||
}
|
||||
|
||||
ini.Save(CONFIG_FILE);
|
||||
}
|
||||
|
||||
|
||||
void SConfig::LoadSettings()
|
||||
{
|
||||
IniFile ini;
|
||||
ini.Load(CONFIG_FILE);
|
||||
|
||||
// hard coded default plugin
|
||||
{
|
||||
m_DefaultGFXPlugin = PLUGINS_DIR DIR_SEP DEFAULT_GFX_PLUGIN;
|
||||
m_DefaultDSPPlugin = PLUGINS_DIR DIR_SEP DEFAULT_DSP_PLUGIN;
|
||||
m_DefaultPADPlugin = PLUGINS_DIR DIR_SEP DEFAULT_PAD_PLUGIN;
|
||||
m_DefaultWiiMotePlugin = PLUGINS_DIR DIR_SEP DEFAULT_WIIMOTE_PLUGIN;
|
||||
}
|
||||
|
||||
// misc
|
||||
{
|
||||
ini.Get("General", "LastFilename", &m_LastFilename);
|
||||
|
||||
m_ISOFolder.clear();
|
||||
int numGCMPaths;
|
||||
|
||||
if (ini.Get("General", "GCMPathes", &numGCMPaths, 0))
|
||||
{
|
||||
for (int i = 0; i < numGCMPaths; i++)
|
||||
{
|
||||
TCHAR tmp[16];
|
||||
sprintf(tmp, "GCMPath%i", i);
|
||||
std::string tmpPath;
|
||||
ini.Get("General", tmp, &tmpPath, "");
|
||||
m_ISOFolder.push_back(tmpPath);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// core
|
||||
{
|
||||
ini.Get("Core", "GFXPlugin", &m_LocalCoreStartupParameter.m_strVideoPlugin, m_DefaultGFXPlugin.c_str());
|
||||
ini.Get("Core", "DSPPlugin", &m_LocalCoreStartupParameter.m_strDSPPlugin, m_DefaultDSPPlugin.c_str());
|
||||
ini.Get("Core", "PadPlugin", &m_LocalCoreStartupParameter.m_strPadPlugin, m_DefaultPADPlugin.c_str());
|
||||
ini.Get("Core", "WiiMotePlugin", &m_LocalCoreStartupParameter.m_strWiimotePlugin, m_DefaultWiiMotePlugin.c_str());
|
||||
ini.Get("Core", "HLEBios", &m_LocalCoreStartupParameter.bHLEBios, true);
|
||||
ini.Get("Core", "UseDynarec", &m_LocalCoreStartupParameter.bUseJIT, true);
|
||||
ini.Get("Core", "UseDualCore", &m_LocalCoreStartupParameter.bUseDualCore, false);
|
||||
ini.Get("Core", "SkipIdle", &m_LocalCoreStartupParameter.bSkipIdle, true);
|
||||
ini.Get("Core", "LockThreads", &m_LocalCoreStartupParameter.bLockThreads, true);
|
||||
ini.Get("Core", "DefaultGCM", &m_LocalCoreStartupParameter.m_strDefaultGCM);
|
||||
ini.Get("Core", "DVDRoot", &m_LocalCoreStartupParameter.m_strDVDRoot);
|
||||
ini.Get("Core", "OptimizeQuantizers", &m_LocalCoreStartupParameter.bOptimizeQuantizers, true);
|
||||
ini.Get("Core", "EnableCheats", &m_LocalCoreStartupParameter.bEnableCheats, false);
|
||||
ini.Get("Core", "SelectedLanguage", &m_LocalCoreStartupParameter.SelectedLanguage, 0);
|
||||
ini.Get("Core", "RunCompareServer", &m_LocalCoreStartupParameter.bRunCompareServer, false);
|
||||
ini.Get("Core", "RunCompareClient", &m_LocalCoreStartupParameter.bRunCompareClient, false);
|
||||
}
|
||||
}
|
||||
// Copyright (C) 2003-2008 Dolphin Project.
|
||||
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, version 2.0.
|
||||
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License 2.0 for more details.
|
||||
|
||||
// A copy of the GPL 2.0 should have been included with the program.
|
||||
// If not, see http://www.gnu.org/licenses/
|
||||
|
||||
// Official SVN repository and contact information can be found at
|
||||
// http://code.google.com/p/dolphin-emu/
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "Globals.h"
|
||||
#include "Common.h"
|
||||
#include "IniFile.h"
|
||||
#include "Config.h"
|
||||
|
||||
SConfig SConfig::m_Instance;
|
||||
|
||||
|
||||
SConfig::SConfig()
|
||||
{
|
||||
LoadSettings();
|
||||
}
|
||||
|
||||
|
||||
SConfig::~SConfig()
|
||||
{
|
||||
SaveSettings();
|
||||
}
|
||||
|
||||
|
||||
void SConfig::SaveSettings()
|
||||
{
|
||||
IniFile ini;
|
||||
// ini.Load(CONFIG_FILE); // yes we must load first to not kill unknown stuff
|
||||
|
||||
// misc
|
||||
{
|
||||
ini.Set("General", "LastFilename", m_LastFilename);
|
||||
|
||||
// ISO folders
|
||||
ini.Set("General", "GCMPathes", (int)m_ISOFolder.size());
|
||||
|
||||
for (size_t i = 0; i < m_ISOFolder.size(); i++)
|
||||
{
|
||||
TCHAR tmp[16];
|
||||
sprintf(tmp, "GCMPath%i", (int)i);
|
||||
ini.Set("General", tmp, m_ISOFolder[i]);
|
||||
}
|
||||
}
|
||||
|
||||
// core
|
||||
{
|
||||
ini.Set("Core", "GFXPlugin", m_LocalCoreStartupParameter.m_strVideoPlugin);
|
||||
ini.Set("Core", "DSPPlugin", m_LocalCoreStartupParameter.m_strDSPPlugin);
|
||||
ini.Set("Core", "PadPlugin", m_LocalCoreStartupParameter.m_strPadPlugin);
|
||||
ini.Set("Core", "WiiMotePlugin", m_LocalCoreStartupParameter.m_strWiimotePlugin);
|
||||
|
||||
ini.Set("Core", "HLEBios", m_LocalCoreStartupParameter.bHLEBios);
|
||||
ini.Set("Core", "UseDynarec", m_LocalCoreStartupParameter.bUseJIT);
|
||||
ini.Set("Core", "UseDualCore", m_LocalCoreStartupParameter.bUseDualCore);
|
||||
ini.Set("Core", "SkipIdle", m_LocalCoreStartupParameter.bSkipIdle);
|
||||
ini.Set("Core", "LockThreads", m_LocalCoreStartupParameter.bLockThreads);
|
||||
ini.Set("Core", "DefaultGCM", m_LocalCoreStartupParameter.m_strDefaultGCM);
|
||||
ini.Set("Core", "DVDRoot", m_LocalCoreStartupParameter.m_strDVDRoot);
|
||||
ini.Set("Core", "OptimizeQuantizers", m_LocalCoreStartupParameter.bOptimizeQuantizers);
|
||||
ini.Set("Core", "EnableCheats", m_LocalCoreStartupParameter.bEnableCheats);
|
||||
ini.Set("Core", "SelectedLanguage", m_LocalCoreStartupParameter.SelectedLanguage);
|
||||
ini.Set("Core", "RunCompareServer", m_LocalCoreStartupParameter.bRunCompareServer);
|
||||
ini.Set("Core", "RunCompareClient", m_LocalCoreStartupParameter.bRunCompareClient);
|
||||
}
|
||||
|
||||
ini.Save(CONFIG_FILE);
|
||||
}
|
||||
|
||||
|
||||
void SConfig::LoadSettings()
|
||||
{
|
||||
IniFile ini;
|
||||
ini.Load(CONFIG_FILE);
|
||||
|
||||
// hard coded default plugin
|
||||
{
|
||||
m_DefaultGFXPlugin = PLUGINS_DIR DIR_SEP DEFAULT_GFX_PLUGIN;
|
||||
m_DefaultDSPPlugin = PLUGINS_DIR DIR_SEP DEFAULT_DSP_PLUGIN;
|
||||
m_DefaultPADPlugin = PLUGINS_DIR DIR_SEP DEFAULT_PAD_PLUGIN;
|
||||
m_DefaultWiiMotePlugin = PLUGINS_DIR DIR_SEP DEFAULT_WIIMOTE_PLUGIN;
|
||||
}
|
||||
|
||||
// misc
|
||||
{
|
||||
ini.Get("General", "LastFilename", &m_LastFilename);
|
||||
|
||||
m_ISOFolder.clear();
|
||||
int numGCMPaths;
|
||||
|
||||
if (ini.Get("General", "GCMPathes", &numGCMPaths, 0))
|
||||
{
|
||||
for (int i = 0; i < numGCMPaths; i++)
|
||||
{
|
||||
TCHAR tmp[16];
|
||||
sprintf(tmp, "GCMPath%i", i);
|
||||
std::string tmpPath;
|
||||
ini.Get("General", tmp, &tmpPath, "");
|
||||
m_ISOFolder.push_back(tmpPath);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// core
|
||||
{
|
||||
ini.Get("Core", "GFXPlugin", &m_LocalCoreStartupParameter.m_strVideoPlugin, m_DefaultGFXPlugin.c_str());
|
||||
ini.Get("Core", "DSPPlugin", &m_LocalCoreStartupParameter.m_strDSPPlugin, m_DefaultDSPPlugin.c_str());
|
||||
ini.Get("Core", "PadPlugin", &m_LocalCoreStartupParameter.m_strPadPlugin, m_DefaultPADPlugin.c_str());
|
||||
ini.Get("Core", "WiiMotePlugin", &m_LocalCoreStartupParameter.m_strWiimotePlugin, m_DefaultWiiMotePlugin.c_str());
|
||||
ini.Get("Core", "HLEBios", &m_LocalCoreStartupParameter.bHLEBios, true);
|
||||
ini.Get("Core", "UseDynarec", &m_LocalCoreStartupParameter.bUseJIT, true);
|
||||
ini.Get("Core", "UseDualCore", &m_LocalCoreStartupParameter.bUseDualCore, false);
|
||||
ini.Get("Core", "SkipIdle", &m_LocalCoreStartupParameter.bSkipIdle, true);
|
||||
ini.Get("Core", "LockThreads", &m_LocalCoreStartupParameter.bLockThreads, true);
|
||||
ini.Get("Core", "DefaultGCM", &m_LocalCoreStartupParameter.m_strDefaultGCM);
|
||||
ini.Get("Core", "DVDRoot", &m_LocalCoreStartupParameter.m_strDVDRoot);
|
||||
ini.Get("Core", "OptimizeQuantizers", &m_LocalCoreStartupParameter.bOptimizeQuantizers, true);
|
||||
ini.Get("Core", "EnableCheats", &m_LocalCoreStartupParameter.bEnableCheats, false);
|
||||
ini.Get("Core", "SelectedLanguage", &m_LocalCoreStartupParameter.SelectedLanguage, 0);
|
||||
ini.Get("Core", "RunCompareServer", &m_LocalCoreStartupParameter.bRunCompareServer, false);
|
||||
ini.Get("Core", "RunCompareClient", &m_LocalCoreStartupParameter.bRunCompareClient, false);
|
||||
}
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -1,18 +1,18 @@
|
||||
// Copyright (C) 2003-2008 Dolphin Project.
|
||||
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, version 2.0.
|
||||
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License 2.0 for more details.
|
||||
|
||||
// A copy of the GPL 2.0 should have been included with the program.
|
||||
// If not, see http://www.gnu.org/licenses/
|
||||
|
||||
// Official SVN repository and contact information can be found at
|
||||
// http://code.google.com/p/dolphin-emu/
|
||||
|
||||
#include "Globals.h"
|
||||
// Copyright (C) 2003-2008 Dolphin Project.
|
||||
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, version 2.0.
|
||||
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License 2.0 for more details.
|
||||
|
||||
// A copy of the GPL 2.0 should have been included with the program.
|
||||
// If not, see http://www.gnu.org/licenses/
|
||||
|
||||
// Official SVN repository and contact information can be found at
|
||||
// http://code.google.com/p/dolphin-emu/
|
||||
|
||||
#include "Globals.h"
|
||||
|
@ -1,172 +1,172 @@
|
||||
// Copyright (C) 2003-2008 Dolphin Project.
|
||||
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, version 2.0.
|
||||
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License 2.0 for more details.
|
||||
|
||||
// A copy of the GPL 2.0 should have been included with the program.
|
||||
// If not, see http://www.gnu.org/licenses/
|
||||
|
||||
// Official SVN repository and contact information can be found at
|
||||
// http://code.google.com/p/dolphin-emu/
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <wx/mstream.h>
|
||||
|
||||
#include "Globals.h"
|
||||
#include "FileUtil.h"
|
||||
#include "ISOFile.h"
|
||||
#include "StringUtil.h"
|
||||
|
||||
#include "VolumeCreator.h"
|
||||
#include "Filesystem.h"
|
||||
#include "BannerLoader.h"
|
||||
#include "FileSearch.h"
|
||||
#include "CompressedBlob.h"
|
||||
#include "ChunkFile.h"
|
||||
#include "../resources/no_banner.cpp"
|
||||
|
||||
#define CACHE_REVISION 0x105
|
||||
|
||||
#define DVD_BANNER_WIDTH 96
|
||||
#define DVD_BANNER_HEIGHT 32
|
||||
|
||||
static u32 g_ImageTemp[DVD_BANNER_WIDTH * DVD_BANNER_HEIGHT];
|
||||
|
||||
GameListItem::GameListItem(const std::string& _rFileName)
|
||||
: m_FileName(_rFileName)
|
||||
, m_FileSize(0)
|
||||
, m_Valid(false)
|
||||
, m_BlobCompressed(false)
|
||||
, m_pImage(NULL)
|
||||
, m_ImageSize(0)
|
||||
{
|
||||
|
||||
if (LoadFromCache())
|
||||
{
|
||||
m_Valid = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
DiscIO::IVolume* pVolume = DiscIO::CreateVolumeFromFilename(_rFileName);
|
||||
|
||||
if (pVolume != NULL)
|
||||
{
|
||||
m_Name = _rFileName;
|
||||
m_Country = pVolume->GetCountry();
|
||||
m_FileSize = File::GetSize(_rFileName.c_str());
|
||||
m_VolumeSize = pVolume->GetSize();
|
||||
m_Name = pVolume->GetName();
|
||||
m_UniqueID = pVolume->GetUniqueID();
|
||||
m_BlobCompressed = DiscIO::IsCompressedBlob(_rFileName.c_str());
|
||||
|
||||
// check if we can get some infos from the banner file too
|
||||
DiscIO::IFileSystem* pFileSystem = DiscIO::CreateFileSystem(pVolume);
|
||||
|
||||
if (pFileSystem != NULL)
|
||||
{
|
||||
DiscIO::IBannerLoader* pBannerLoader = DiscIO::CreateBannerLoader(*pFileSystem);
|
||||
|
||||
if (pBannerLoader != NULL)
|
||||
{
|
||||
if (pBannerLoader->IsValid())
|
||||
{
|
||||
pBannerLoader->GetName(m_Name, 0); //m_Country == DiscIO::IVolume::COUNTRY_JAP ? 1 : 0);
|
||||
pBannerLoader->GetCompany(m_Company);
|
||||
pBannerLoader->GetDescription(m_Description);
|
||||
if (pBannerLoader->GetBanner(g_ImageTemp))
|
||||
{
|
||||
m_ImageSize = DVD_BANNER_WIDTH * DVD_BANNER_HEIGHT * 3;
|
||||
m_pImage = new u8[m_ImageSize]; //(u8*)malloc(m_ImageSize);
|
||||
|
||||
for (size_t i = 0; i < DVD_BANNER_WIDTH * DVD_BANNER_HEIGHT; i++)
|
||||
{
|
||||
m_pImage[i * 3 + 0] = (g_ImageTemp[i] & 0xFF0000) >> 16;
|
||||
m_pImage[i * 3 + 1] = (g_ImageTemp[i] & 0x00FF00) >> 8;
|
||||
m_pImage[i * 3 + 2] = (g_ImageTemp[i] & 0x0000FF) >> 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
delete pBannerLoader;
|
||||
}
|
||||
|
||||
delete pFileSystem;
|
||||
}
|
||||
|
||||
delete pVolume;
|
||||
|
||||
m_Valid = true;
|
||||
|
||||
// just if we have an image create a cache file
|
||||
// Wii isos create their images after you have generated the first savegame
|
||||
if (m_pImage)
|
||||
SaveToCache();
|
||||
}
|
||||
}
|
||||
|
||||
// i am not sure if this is a leak or if wxImage will release the code
|
||||
if (m_pImage)
|
||||
{
|
||||
#if defined(HAVE_WX) && HAVE_WX
|
||||
m_Image.Create(DVD_BANNER_WIDTH, DVD_BANNER_HEIGHT, m_pImage);
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
// default banner
|
||||
wxMemoryInputStream istream(no_banner_png, sizeof no_banner_png);
|
||||
wxImage iNoBanner(istream, wxBITMAP_TYPE_PNG);
|
||||
m_Image = iNoBanner;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
GameListItem::~GameListItem()
|
||||
{
|
||||
}
|
||||
|
||||
bool GameListItem::LoadFromCache()
|
||||
{
|
||||
return CChunkFileReader::Load<GameListItem>(CreateCacheFilename(), CACHE_REVISION, *this);
|
||||
}
|
||||
|
||||
void GameListItem::SaveToCache()
|
||||
{
|
||||
if (!File::IsDirectory(FULL_CACHE_DIR))
|
||||
{
|
||||
File::CreateDir(FULL_CACHE_DIR);
|
||||
}
|
||||
|
||||
CChunkFileReader::Save<GameListItem>(CreateCacheFilename(), CACHE_REVISION, *this);
|
||||
}
|
||||
|
||||
void GameListItem::DoState(PointerWrap &p)
|
||||
{
|
||||
p.Do(m_Name);
|
||||
p.Do(m_Company);
|
||||
p.Do(m_Description);
|
||||
p.Do(m_UniqueID);
|
||||
p.Do(m_FileSize);
|
||||
p.Do(m_VolumeSize);
|
||||
p.Do(m_Country);
|
||||
p.Do(m_BlobCompressed);
|
||||
p.DoBuffer(&m_pImage, m_ImageSize);
|
||||
}
|
||||
|
||||
std::string GameListItem::CreateCacheFilename()
|
||||
{
|
||||
std::string Filename;
|
||||
SplitPath(m_FileName, NULL, &Filename, NULL);
|
||||
Filename.append(".cache");
|
||||
|
||||
std::string fullname(FULL_CACHE_DIR);
|
||||
fullname += Filename;
|
||||
return fullname;
|
||||
}
|
||||
// Copyright (C) 2003-2008 Dolphin Project.
|
||||
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, version 2.0.
|
||||
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License 2.0 for more details.
|
||||
|
||||
// A copy of the GPL 2.0 should have been included with the program.
|
||||
// If not, see http://www.gnu.org/licenses/
|
||||
|
||||
// Official SVN repository and contact information can be found at
|
||||
// http://code.google.com/p/dolphin-emu/
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <wx/mstream.h>
|
||||
|
||||
#include "Globals.h"
|
||||
#include "FileUtil.h"
|
||||
#include "ISOFile.h"
|
||||
#include "StringUtil.h"
|
||||
|
||||
#include "VolumeCreator.h"
|
||||
#include "Filesystem.h"
|
||||
#include "BannerLoader.h"
|
||||
#include "FileSearch.h"
|
||||
#include "CompressedBlob.h"
|
||||
#include "ChunkFile.h"
|
||||
#include "../resources/no_banner.cpp"
|
||||
|
||||
#define CACHE_REVISION 0x105
|
||||
|
||||
#define DVD_BANNER_WIDTH 96
|
||||
#define DVD_BANNER_HEIGHT 32
|
||||
|
||||
static u32 g_ImageTemp[DVD_BANNER_WIDTH * DVD_BANNER_HEIGHT];
|
||||
|
||||
GameListItem::GameListItem(const std::string& _rFileName)
|
||||
: m_FileName(_rFileName)
|
||||
, m_FileSize(0)
|
||||
, m_Valid(false)
|
||||
, m_BlobCompressed(false)
|
||||
, m_pImage(NULL)
|
||||
, m_ImageSize(0)
|
||||
{
|
||||
|
||||
if (LoadFromCache())
|
||||
{
|
||||
m_Valid = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
DiscIO::IVolume* pVolume = DiscIO::CreateVolumeFromFilename(_rFileName);
|
||||
|
||||
if (pVolume != NULL)
|
||||
{
|
||||
m_Name = _rFileName;
|
||||
m_Country = pVolume->GetCountry();
|
||||
m_FileSize = File::GetSize(_rFileName.c_str());
|
||||
m_VolumeSize = pVolume->GetSize();
|
||||
m_Name = pVolume->GetName();
|
||||
m_UniqueID = pVolume->GetUniqueID();
|
||||
m_BlobCompressed = DiscIO::IsCompressedBlob(_rFileName.c_str());
|
||||
|
||||
// check if we can get some infos from the banner file too
|
||||
DiscIO::IFileSystem* pFileSystem = DiscIO::CreateFileSystem(pVolume);
|
||||
|
||||
if (pFileSystem != NULL)
|
||||
{
|
||||
DiscIO::IBannerLoader* pBannerLoader = DiscIO::CreateBannerLoader(*pFileSystem);
|
||||
|
||||
if (pBannerLoader != NULL)
|
||||
{
|
||||
if (pBannerLoader->IsValid())
|
||||
{
|
||||
pBannerLoader->GetName(m_Name, 0); //m_Country == DiscIO::IVolume::COUNTRY_JAP ? 1 : 0);
|
||||
pBannerLoader->GetCompany(m_Company);
|
||||
pBannerLoader->GetDescription(m_Description);
|
||||
if (pBannerLoader->GetBanner(g_ImageTemp))
|
||||
{
|
||||
m_ImageSize = DVD_BANNER_WIDTH * DVD_BANNER_HEIGHT * 3;
|
||||
m_pImage = new u8[m_ImageSize]; //(u8*)malloc(m_ImageSize);
|
||||
|
||||
for (size_t i = 0; i < DVD_BANNER_WIDTH * DVD_BANNER_HEIGHT; i++)
|
||||
{
|
||||
m_pImage[i * 3 + 0] = (g_ImageTemp[i] & 0xFF0000) >> 16;
|
||||
m_pImage[i * 3 + 1] = (g_ImageTemp[i] & 0x00FF00) >> 8;
|
||||
m_pImage[i * 3 + 2] = (g_ImageTemp[i] & 0x0000FF) >> 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
delete pBannerLoader;
|
||||
}
|
||||
|
||||
delete pFileSystem;
|
||||
}
|
||||
|
||||
delete pVolume;
|
||||
|
||||
m_Valid = true;
|
||||
|
||||
// just if we have an image create a cache file
|
||||
// Wii isos create their images after you have generated the first savegame
|
||||
if (m_pImage)
|
||||
SaveToCache();
|
||||
}
|
||||
}
|
||||
|
||||
// i am not sure if this is a leak or if wxImage will release the code
|
||||
if (m_pImage)
|
||||
{
|
||||
#if defined(HAVE_WX) && HAVE_WX
|
||||
m_Image.Create(DVD_BANNER_WIDTH, DVD_BANNER_HEIGHT, m_pImage);
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
// default banner
|
||||
wxMemoryInputStream istream(no_banner_png, sizeof no_banner_png);
|
||||
wxImage iNoBanner(istream, wxBITMAP_TYPE_PNG);
|
||||
m_Image = iNoBanner;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
GameListItem::~GameListItem()
|
||||
{
|
||||
}
|
||||
|
||||
bool GameListItem::LoadFromCache()
|
||||
{
|
||||
return CChunkFileReader::Load<GameListItem>(CreateCacheFilename(), CACHE_REVISION, *this);
|
||||
}
|
||||
|
||||
void GameListItem::SaveToCache()
|
||||
{
|
||||
if (!File::IsDirectory(FULL_CACHE_DIR))
|
||||
{
|
||||
File::CreateDir(FULL_CACHE_DIR);
|
||||
}
|
||||
|
||||
CChunkFileReader::Save<GameListItem>(CreateCacheFilename(), CACHE_REVISION, *this);
|
||||
}
|
||||
|
||||
void GameListItem::DoState(PointerWrap &p)
|
||||
{
|
||||
p.Do(m_Name);
|
||||
p.Do(m_Company);
|
||||
p.Do(m_Description);
|
||||
p.Do(m_UniqueID);
|
||||
p.Do(m_FileSize);
|
||||
p.Do(m_VolumeSize);
|
||||
p.Do(m_Country);
|
||||
p.Do(m_BlobCompressed);
|
||||
p.DoBuffer(&m_pImage, m_ImageSize);
|
||||
}
|
||||
|
||||
std::string GameListItem::CreateCacheFilename()
|
||||
{
|
||||
std::string Filename;
|
||||
SplitPath(m_FileName, NULL, &Filename, NULL);
|
||||
Filename.append(".cache");
|
||||
|
||||
std::string fullname(FULL_CACHE_DIR);
|
||||
fullname += Filename;
|
||||
return fullname;
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,395 +1,395 @@
|
||||
// Copyright (C) 2003-2008 Dolphin Project.
|
||||
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, version 2.0.
|
||||
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License 2.0 for more details.
|
||||
|
||||
// A copy of the GPL 2.0 should have been included with the program.
|
||||
// If not, see http://www.gnu.org/licenses/
|
||||
|
||||
// Official SVN repository and contact information can be found at
|
||||
// http://code.google.com/p/dolphin-emu/
|
||||
|
||||
#include <vector>
|
||||
#include <string>
|
||||
#include "svnrev.h"
|
||||
|
||||
#ifdef WIN32
|
||||
#include <crtdbg.h>
|
||||
#endif
|
||||
|
||||
#include "Globals.h" // Core
|
||||
#include "Host.h"
|
||||
|
||||
#include "Common.h" // Common
|
||||
#include "CPUDetect.h"
|
||||
#include "IniFile.h"
|
||||
#include "FileUtil.h"
|
||||
|
||||
#include "Main.h" // Local
|
||||
#include "Frame.h"
|
||||
#include "Config.h"
|
||||
#include "CodeWindow.h"
|
||||
#include "ExtendedTrace.h"
|
||||
#include "BootManager.h"
|
||||
|
||||
IMPLEMENT_APP(DolphinApp)
|
||||
|
||||
CFrame* main_frame = NULL;
|
||||
CCodeWindow* g_pCodeWindow = NULL;
|
||||
|
||||
#ifdef WIN32
|
||||
//Has no error handling.
|
||||
//I think that if an error occurs here there's no way to handle it anyway.
|
||||
LONG WINAPI MyUnhandledExceptionFilter(LPEXCEPTION_POINTERS e) {
|
||||
//EnterCriticalSection(&g_uefcs);
|
||||
|
||||
FILE* file=NULL;
|
||||
fopen_s(&file, "exceptioninfo.txt", "a");
|
||||
fseek(file, 0, SEEK_END);
|
||||
etfprint(file, "\n");
|
||||
//etfprint(file, g_buildtime);
|
||||
//etfprint(file, "\n");
|
||||
//dumpCurrentDate(file);
|
||||
etfprintf(file, "Unhandled Exception\n Code: 0x%08X\n",
|
||||
e->ExceptionRecord->ExceptionCode);
|
||||
#ifndef _M_X64
|
||||
STACKTRACE2(file, e->ContextRecord->Eip, e->ContextRecord->Esp, e->ContextRecord->Ebp);
|
||||
#else
|
||||
STACKTRACE2(file, e->ContextRecord->Rip, e->ContextRecord->Rsp, e->ContextRecord->Rbp);
|
||||
#endif
|
||||
fclose(file);
|
||||
_flushall();
|
||||
|
||||
//LeaveCriticalSection(&g_uefcs);
|
||||
return EXCEPTION_CONTINUE_SEARCH;
|
||||
}
|
||||
#endif
|
||||
|
||||
// The `main program' equivalent, creating the windows and returning the
|
||||
// main frame
|
||||
bool DolphinApp::OnInit()
|
||||
{
|
||||
DetectCPU();
|
||||
|
||||
#ifdef _DEBUG
|
||||
int tmpflag = _CrtSetDbgFlag(_CRTDBG_REPORT_FLAG);
|
||||
tmpflag |= _CRTDBG_DELAY_FREE_MEM_DF;
|
||||
_CrtSetDbgFlag(tmpflag);
|
||||
#endif
|
||||
|
||||
#ifndef _WIN32
|
||||
// RegisterPanicAlertHandler(&wxPanicAlert);
|
||||
#endif
|
||||
|
||||
#ifdef _WIN32
|
||||
EXTENDEDTRACEINITIALIZE(".");
|
||||
SetUnhandledExceptionFilter(&MyUnhandledExceptionFilter);
|
||||
|
||||
// TODO: if First Boot
|
||||
if (!cpu_info.bSSE2)
|
||||
{
|
||||
MessageBox(0, _T("Hi,\n\nDolphin requires that your CPU has support for SSE2 extensions.\n"
|
||||
"Unfortunately your CPU does not support them, so Dolphin will not run.\n\n"
|
||||
"Sayonara!\n"), "Dolphin", MB_ICONINFORMATION);
|
||||
return false;
|
||||
}
|
||||
#else
|
||||
if (!cpu_info.bSSE2)
|
||||
{
|
||||
printf("%s", "Hi,\n\nDolphin requires that your CPU has support for SSE2 extensions.\n"
|
||||
"Unfortunately your CPU does not support them, so Dolphin will not run.\n\n"
|
||||
"Sayonara!\n");
|
||||
exit(0);
|
||||
}
|
||||
#endif
|
||||
|
||||
// ============
|
||||
// Check for debugger
|
||||
bool UseDebugger = false;
|
||||
bool LoadElf = false; wxString ElfFile;
|
||||
|
||||
#if wxUSE_CMDLINE_PARSER
|
||||
wxCmdLineEntryDesc cmdLineDesc[] =
|
||||
{
|
||||
{
|
||||
wxCMD_LINE_SWITCH, _T("h"), _T("help"), _T("Show this help message"),
|
||||
wxCMD_LINE_VAL_NONE, wxCMD_LINE_OPTION_HELP
|
||||
},
|
||||
{
|
||||
wxCMD_LINE_SWITCH, _T("d"), _T("debugger"), _T("Opens the debugger")
|
||||
},
|
||||
{
|
||||
wxCMD_LINE_OPTION, _T("e"), _T("elf"), _T("Loads an elf file"),
|
||||
wxCMD_LINE_VAL_STRING, wxCMD_LINE_PARAM_OPTIONAL
|
||||
},
|
||||
{
|
||||
wxCMD_LINE_NONE
|
||||
}
|
||||
};
|
||||
|
||||
#if defined(__APPLE__)
|
||||
// HACK: Get rid of bogous osx param
|
||||
if (argc > 1 && wxString(argv[argc - 1]).StartsWith(_("-psn_"))) {
|
||||
delete argv[argc-1];
|
||||
argv[argc-1] = NULL;
|
||||
argc--;
|
||||
}
|
||||
#endif
|
||||
|
||||
// Gets the passed media files from command line
|
||||
wxCmdLineParser parser(cmdLineDesc, argc, argv);
|
||||
|
||||
// Get filenames from the command line
|
||||
if (parser.Parse() != 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
UseDebugger = parser.Found(_T("debugger"));
|
||||
LoadElf = parser.Found(_T("elf"), &ElfFile);
|
||||
|
||||
if( LoadElf && ElfFile == wxEmptyString )
|
||||
PanicAlert("You did not specify a file name");
|
||||
|
||||
// ============
|
||||
#endif
|
||||
|
||||
SConfig::GetInstance().LoadSettings();
|
||||
wxInitAllImageHandlers();
|
||||
// Create the main frame window
|
||||
|
||||
#ifdef _DEBUG
|
||||
const char *title = "Dolphin Debug SVN R " SVN_REV_STR;
|
||||
#else
|
||||
const char *title = "Dolphin SVN R " SVN_REV_STR;
|
||||
#endif
|
||||
|
||||
// ---------------------------------------------------------------------------------------
|
||||
// If we are debugging let use save the main window position and size
|
||||
// TODO: Save position and size on exit
|
||||
// ---------
|
||||
IniFile ini;
|
||||
ini.Load(DEBUGGER_CONFIG_FILE);
|
||||
|
||||
int x, y, w, h;
|
||||
|
||||
ini.Get("MainWindow", "x", &x, 100);
|
||||
ini.Get("MainWindow", "y", &y, 100);
|
||||
ini.Get("MainWindow", "w", &w, 600);
|
||||
ini.Get("MainWindow", "h", &h, 800);
|
||||
// ---------
|
||||
if(UseDebugger)
|
||||
{
|
||||
main_frame = new CFrame((wxFrame*) NULL, wxID_ANY, wxString::FromAscii(title),
|
||||
wxPoint(x, y), wxSize(h, w));
|
||||
}
|
||||
else
|
||||
{
|
||||
main_frame = new CFrame((wxFrame*) NULL, wxID_ANY, wxString::FromAscii(title),
|
||||
wxPoint(100, 100), wxSize(800, 600));
|
||||
}
|
||||
// ---------
|
||||
|
||||
// Create debugger
|
||||
if (UseDebugger)
|
||||
{
|
||||
g_pCodeWindow = new CCodeWindow(SConfig::GetInstance().m_LocalCoreStartupParameter, main_frame);
|
||||
g_pCodeWindow->Show(true);
|
||||
}
|
||||
|
||||
// First check if we have a elf command line
|
||||
if (LoadElf && ElfFile != wxEmptyString)
|
||||
{
|
||||
BootManager::BootCore(std::string(ElfFile.ToAscii()));
|
||||
}
|
||||
/* If we have selected Automatic Start, start the default ISO, or if no default
|
||||
ISO exists, start the last loaded ISO */
|
||||
else if (UseDebugger && g_pCodeWindow->AutomaticStart())
|
||||
{
|
||||
if(!SConfig::GetInstance().m_LocalCoreStartupParameter.m_strDefaultGCM.empty()
|
||||
&& File::Exists(SConfig::GetInstance().m_LocalCoreStartupParameter.
|
||||
m_strDefaultGCM.c_str()))
|
||||
{
|
||||
BootManager::BootCore(SConfig::GetInstance().m_LocalCoreStartupParameter.
|
||||
m_strDefaultGCM);
|
||||
}
|
||||
else if(!SConfig::GetInstance().m_LastFilename.empty()
|
||||
&& File::Exists(SConfig::GetInstance().m_LastFilename.c_str()))
|
||||
{
|
||||
BootManager::BootCore(SConfig::GetInstance().m_LastFilename);
|
||||
}
|
||||
}
|
||||
|
||||
SetTopWindow(main_frame);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void DolphinApp::OnEndSession()
|
||||
{
|
||||
SConfig::GetInstance().SaveSettings();
|
||||
}
|
||||
|
||||
|
||||
bool wxPanicAlert(const char* text, bool /*yes_no*/)
|
||||
{
|
||||
wxMessageBox(wxString::FromAscii(text), _T("PANIC ALERT"));
|
||||
return(true);
|
||||
}
|
||||
|
||||
|
||||
void Host_BootingStarted()
|
||||
{
|
||||
wxCommandEvent event(wxEVT_HOST_COMMAND, IDM_BOOTING_STARTED);
|
||||
wxPostEvent(main_frame, event);
|
||||
|
||||
if (g_pCodeWindow)
|
||||
{
|
||||
wxPostEvent(g_pCodeWindow, event);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Host_BootingEnded()
|
||||
{
|
||||
wxCommandEvent event(wxEVT_HOST_COMMAND, IDM_BOOTING_ENDED);
|
||||
wxPostEvent(main_frame, event);
|
||||
|
||||
if (g_pCodeWindow)
|
||||
{
|
||||
wxPostEvent(g_pCodeWindow, event);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// OK, this thread boundary is DANGEROUS on linux
|
||||
// wxPostEvent / wxAddPendingEvent is the solution.
|
||||
void Host_NotifyMapLoaded()
|
||||
{
|
||||
wxCommandEvent event(wxEVT_HOST_COMMAND, IDM_NOTIFYMAPLOADED);
|
||||
wxPostEvent(main_frame, event);
|
||||
|
||||
if (g_pCodeWindow)
|
||||
{
|
||||
wxPostEvent(g_pCodeWindow, event);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Host_UpdateLogDisplay()
|
||||
{
|
||||
wxCommandEvent event(wxEVT_HOST_COMMAND, IDM_UPDATELOGDISPLAY);
|
||||
wxPostEvent(main_frame, event);
|
||||
|
||||
if (g_pCodeWindow)
|
||||
{
|
||||
wxPostEvent(g_pCodeWindow, event);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Host_UpdateDisasmDialog()
|
||||
{
|
||||
wxCommandEvent event(wxEVT_HOST_COMMAND, IDM_UPDATEDISASMDIALOG);
|
||||
wxPostEvent(main_frame, event);
|
||||
if (g_pCodeWindow)
|
||||
{
|
||||
wxPostEvent(g_pCodeWindow, event);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Host_UpdateMainFrame()
|
||||
{
|
||||
wxCommandEvent event(wxEVT_HOST_COMMAND, IDM_UPDATEGUI);
|
||||
wxPostEvent(main_frame, event);
|
||||
|
||||
if (g_pCodeWindow)
|
||||
{
|
||||
wxPostEvent(g_pCodeWindow, event);
|
||||
}
|
||||
}
|
||||
|
||||
void Host_UpdateBreakPointView()
|
||||
{
|
||||
wxCommandEvent event(wxEVT_HOST_COMMAND, IDM_UPDATEBREAKPOINTS);
|
||||
wxPostEvent(main_frame, event);
|
||||
|
||||
if (g_pCodeWindow)
|
||||
{
|
||||
wxPostEvent(g_pCodeWindow, event);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Host_UpdateMemoryView()
|
||||
{}
|
||||
|
||||
|
||||
void Host_SetDebugMode(bool)
|
||||
{}
|
||||
|
||||
|
||||
void Host_SetWaitCursor(bool enable)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
if (enable)
|
||||
{
|
||||
SetCursor(LoadCursor(NULL, IDC_WAIT));
|
||||
}
|
||||
else
|
||||
{
|
||||
SetCursor(LoadCursor(NULL, IDC_ARROW));
|
||||
}
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
void Host_UpdateStatusBar(const char* _pText)
|
||||
{
|
||||
wxCommandEvent event(wxEVT_HOST_COMMAND, IDM_UPDATESTATUSBAR);
|
||||
event.SetString(wxString::FromAscii(_pText));
|
||||
event.SetInt(0);
|
||||
|
||||
wxPostEvent(main_frame, event);
|
||||
}
|
||||
|
||||
void Host_SysMessage(const char *fmt, ...)
|
||||
{
|
||||
va_list list;
|
||||
char msg[512];
|
||||
|
||||
va_start(list, fmt);
|
||||
vsprintf(msg, fmt, list);
|
||||
va_end(list);
|
||||
|
||||
if (msg[strlen(msg)-1] == '\n') msg[strlen(msg)-1] = 0;
|
||||
wxMessageBox(wxString::FromAscii(msg));
|
||||
}
|
||||
|
||||
void Host_SetWiiMoteConnectionState(int _State)
|
||||
{
|
||||
static int currentState = -1;
|
||||
if (_State == currentState)
|
||||
return;
|
||||
currentState = _State;
|
||||
|
||||
wxCommandEvent event(wxEVT_HOST_COMMAND, IDM_UPDATESTATUSBAR);
|
||||
|
||||
switch(_State)
|
||||
{
|
||||
case 0: event.SetString(wxString::FromAscii("Not connected")); break;
|
||||
case 1: event.SetString(wxString::FromAscii("Connecting...")); break;
|
||||
case 2: event.SetString(wxString::FromAscii("Wiimote Connected")); break;
|
||||
}
|
||||
|
||||
event.SetInt(1);
|
||||
|
||||
wxPostEvent(main_frame, event);
|
||||
}
|
||||
// Copyright (C) 2003-2008 Dolphin Project.
|
||||
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, version 2.0.
|
||||
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License 2.0 for more details.
|
||||
|
||||
// A copy of the GPL 2.0 should have been included with the program.
|
||||
// If not, see http://www.gnu.org/licenses/
|
||||
|
||||
// Official SVN repository and contact information can be found at
|
||||
// http://code.google.com/p/dolphin-emu/
|
||||
|
||||
#include <vector>
|
||||
#include <string>
|
||||
#include "svnrev.h"
|
||||
|
||||
#ifdef WIN32
|
||||
#include <crtdbg.h>
|
||||
#endif
|
||||
|
||||
#include "Globals.h" // Core
|
||||
#include "Host.h"
|
||||
|
||||
#include "Common.h" // Common
|
||||
#include "CPUDetect.h"
|
||||
#include "IniFile.h"
|
||||
#include "FileUtil.h"
|
||||
|
||||
#include "Main.h" // Local
|
||||
#include "Frame.h"
|
||||
#include "Config.h"
|
||||
#include "CodeWindow.h"
|
||||
#include "ExtendedTrace.h"
|
||||
#include "BootManager.h"
|
||||
|
||||
IMPLEMENT_APP(DolphinApp)
|
||||
|
||||
CFrame* main_frame = NULL;
|
||||
CCodeWindow* g_pCodeWindow = NULL;
|
||||
|
||||
#ifdef WIN32
|
||||
//Has no error handling.
|
||||
//I think that if an error occurs here there's no way to handle it anyway.
|
||||
LONG WINAPI MyUnhandledExceptionFilter(LPEXCEPTION_POINTERS e) {
|
||||
//EnterCriticalSection(&g_uefcs);
|
||||
|
||||
FILE* file=NULL;
|
||||
fopen_s(&file, "exceptioninfo.txt", "a");
|
||||
fseek(file, 0, SEEK_END);
|
||||
etfprint(file, "\n");
|
||||
//etfprint(file, g_buildtime);
|
||||
//etfprint(file, "\n");
|
||||
//dumpCurrentDate(file);
|
||||
etfprintf(file, "Unhandled Exception\n Code: 0x%08X\n",
|
||||
e->ExceptionRecord->ExceptionCode);
|
||||
#ifndef _M_X64
|
||||
STACKTRACE2(file, e->ContextRecord->Eip, e->ContextRecord->Esp, e->ContextRecord->Ebp);
|
||||
#else
|
||||
STACKTRACE2(file, e->ContextRecord->Rip, e->ContextRecord->Rsp, e->ContextRecord->Rbp);
|
||||
#endif
|
||||
fclose(file);
|
||||
_flushall();
|
||||
|
||||
//LeaveCriticalSection(&g_uefcs);
|
||||
return EXCEPTION_CONTINUE_SEARCH;
|
||||
}
|
||||
#endif
|
||||
|
||||
// The `main program' equivalent, creating the windows and returning the
|
||||
// main frame
|
||||
bool DolphinApp::OnInit()
|
||||
{
|
||||
DetectCPU();
|
||||
|
||||
#ifdef _DEBUG
|
||||
int tmpflag = _CrtSetDbgFlag(_CRTDBG_REPORT_FLAG);
|
||||
tmpflag |= _CRTDBG_DELAY_FREE_MEM_DF;
|
||||
_CrtSetDbgFlag(tmpflag);
|
||||
#endif
|
||||
|
||||
#ifndef _WIN32
|
||||
// RegisterPanicAlertHandler(&wxPanicAlert);
|
||||
#endif
|
||||
|
||||
#ifdef _WIN32
|
||||
EXTENDEDTRACEINITIALIZE(".");
|
||||
SetUnhandledExceptionFilter(&MyUnhandledExceptionFilter);
|
||||
|
||||
// TODO: if First Boot
|
||||
if (!cpu_info.bSSE2)
|
||||
{
|
||||
MessageBox(0, _T("Hi,\n\nDolphin requires that your CPU has support for SSE2 extensions.\n"
|
||||
"Unfortunately your CPU does not support them, so Dolphin will not run.\n\n"
|
||||
"Sayonara!\n"), "Dolphin", MB_ICONINFORMATION);
|
||||
return false;
|
||||
}
|
||||
#else
|
||||
if (!cpu_info.bSSE2)
|
||||
{
|
||||
printf("%s", "Hi,\n\nDolphin requires that your CPU has support for SSE2 extensions.\n"
|
||||
"Unfortunately your CPU does not support them, so Dolphin will not run.\n\n"
|
||||
"Sayonara!\n");
|
||||
exit(0);
|
||||
}
|
||||
#endif
|
||||
|
||||
// ============
|
||||
// Check for debugger
|
||||
bool UseDebugger = false;
|
||||
bool LoadElf = false; wxString ElfFile;
|
||||
|
||||
#if wxUSE_CMDLINE_PARSER
|
||||
wxCmdLineEntryDesc cmdLineDesc[] =
|
||||
{
|
||||
{
|
||||
wxCMD_LINE_SWITCH, _T("h"), _T("help"), _T("Show this help message"),
|
||||
wxCMD_LINE_VAL_NONE, wxCMD_LINE_OPTION_HELP
|
||||
},
|
||||
{
|
||||
wxCMD_LINE_SWITCH, _T("d"), _T("debugger"), _T("Opens the debugger")
|
||||
},
|
||||
{
|
||||
wxCMD_LINE_OPTION, _T("e"), _T("elf"), _T("Loads an elf file"),
|
||||
wxCMD_LINE_VAL_STRING, wxCMD_LINE_PARAM_OPTIONAL
|
||||
},
|
||||
{
|
||||
wxCMD_LINE_NONE
|
||||
}
|
||||
};
|
||||
|
||||
#if defined(__APPLE__)
|
||||
// HACK: Get rid of bogous osx param
|
||||
if (argc > 1 && wxString(argv[argc - 1]).StartsWith(_("-psn_"))) {
|
||||
delete argv[argc-1];
|
||||
argv[argc-1] = NULL;
|
||||
argc--;
|
||||
}
|
||||
#endif
|
||||
|
||||
// Gets the passed media files from command line
|
||||
wxCmdLineParser parser(cmdLineDesc, argc, argv);
|
||||
|
||||
// Get filenames from the command line
|
||||
if (parser.Parse() != 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
UseDebugger = parser.Found(_T("debugger"));
|
||||
LoadElf = parser.Found(_T("elf"), &ElfFile);
|
||||
|
||||
if( LoadElf && ElfFile == wxEmptyString )
|
||||
PanicAlert("You did not specify a file name");
|
||||
|
||||
// ============
|
||||
#endif
|
||||
|
||||
SConfig::GetInstance().LoadSettings();
|
||||
wxInitAllImageHandlers();
|
||||
// Create the main frame window
|
||||
|
||||
#ifdef _DEBUG
|
||||
const char *title = "Dolphin Debug SVN R " SVN_REV_STR;
|
||||
#else
|
||||
const char *title = "Dolphin SVN R " SVN_REV_STR;
|
||||
#endif
|
||||
|
||||
// ---------------------------------------------------------------------------------------
|
||||
// If we are debugging let use save the main window position and size
|
||||
// TODO: Save position and size on exit
|
||||
// ---------
|
||||
IniFile ini;
|
||||
ini.Load(DEBUGGER_CONFIG_FILE);
|
||||
|
||||
int x, y, w, h;
|
||||
|
||||
ini.Get("MainWindow", "x", &x, 100);
|
||||
ini.Get("MainWindow", "y", &y, 100);
|
||||
ini.Get("MainWindow", "w", &w, 600);
|
||||
ini.Get("MainWindow", "h", &h, 800);
|
||||
// ---------
|
||||
if(UseDebugger)
|
||||
{
|
||||
main_frame = new CFrame((wxFrame*) NULL, wxID_ANY, wxString::FromAscii(title),
|
||||
wxPoint(x, y), wxSize(h, w));
|
||||
}
|
||||
else
|
||||
{
|
||||
main_frame = new CFrame((wxFrame*) NULL, wxID_ANY, wxString::FromAscii(title),
|
||||
wxPoint(100, 100), wxSize(800, 600));
|
||||
}
|
||||
// ---------
|
||||
|
||||
// Create debugger
|
||||
if (UseDebugger)
|
||||
{
|
||||
g_pCodeWindow = new CCodeWindow(SConfig::GetInstance().m_LocalCoreStartupParameter, main_frame);
|
||||
g_pCodeWindow->Show(true);
|
||||
}
|
||||
|
||||
// First check if we have a elf command line
|
||||
if (LoadElf && ElfFile != wxEmptyString)
|
||||
{
|
||||
BootManager::BootCore(std::string(ElfFile.ToAscii()));
|
||||
}
|
||||
/* If we have selected Automatic Start, start the default ISO, or if no default
|
||||
ISO exists, start the last loaded ISO */
|
||||
else if (UseDebugger && g_pCodeWindow->AutomaticStart())
|
||||
{
|
||||
if(!SConfig::GetInstance().m_LocalCoreStartupParameter.m_strDefaultGCM.empty()
|
||||
&& File::Exists(SConfig::GetInstance().m_LocalCoreStartupParameter.
|
||||
m_strDefaultGCM.c_str()))
|
||||
{
|
||||
BootManager::BootCore(SConfig::GetInstance().m_LocalCoreStartupParameter.
|
||||
m_strDefaultGCM);
|
||||
}
|
||||
else if(!SConfig::GetInstance().m_LastFilename.empty()
|
||||
&& File::Exists(SConfig::GetInstance().m_LastFilename.c_str()))
|
||||
{
|
||||
BootManager::BootCore(SConfig::GetInstance().m_LastFilename);
|
||||
}
|
||||
}
|
||||
|
||||
SetTopWindow(main_frame);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void DolphinApp::OnEndSession()
|
||||
{
|
||||
SConfig::GetInstance().SaveSettings();
|
||||
}
|
||||
|
||||
|
||||
bool wxPanicAlert(const char* text, bool /*yes_no*/)
|
||||
{
|
||||
wxMessageBox(wxString::FromAscii(text), _T("PANIC ALERT"));
|
||||
return(true);
|
||||
}
|
||||
|
||||
|
||||
void Host_BootingStarted()
|
||||
{
|
||||
wxCommandEvent event(wxEVT_HOST_COMMAND, IDM_BOOTING_STARTED);
|
||||
wxPostEvent(main_frame, event);
|
||||
|
||||
if (g_pCodeWindow)
|
||||
{
|
||||
wxPostEvent(g_pCodeWindow, event);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Host_BootingEnded()
|
||||
{
|
||||
wxCommandEvent event(wxEVT_HOST_COMMAND, IDM_BOOTING_ENDED);
|
||||
wxPostEvent(main_frame, event);
|
||||
|
||||
if (g_pCodeWindow)
|
||||
{
|
||||
wxPostEvent(g_pCodeWindow, event);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// OK, this thread boundary is DANGEROUS on linux
|
||||
// wxPostEvent / wxAddPendingEvent is the solution.
|
||||
void Host_NotifyMapLoaded()
|
||||
{
|
||||
wxCommandEvent event(wxEVT_HOST_COMMAND, IDM_NOTIFYMAPLOADED);
|
||||
wxPostEvent(main_frame, event);
|
||||
|
||||
if (g_pCodeWindow)
|
||||
{
|
||||
wxPostEvent(g_pCodeWindow, event);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Host_UpdateLogDisplay()
|
||||
{
|
||||
wxCommandEvent event(wxEVT_HOST_COMMAND, IDM_UPDATELOGDISPLAY);
|
||||
wxPostEvent(main_frame, event);
|
||||
|
||||
if (g_pCodeWindow)
|
||||
{
|
||||
wxPostEvent(g_pCodeWindow, event);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Host_UpdateDisasmDialog()
|
||||
{
|
||||
wxCommandEvent event(wxEVT_HOST_COMMAND, IDM_UPDATEDISASMDIALOG);
|
||||
wxPostEvent(main_frame, event);
|
||||
if (g_pCodeWindow)
|
||||
{
|
||||
wxPostEvent(g_pCodeWindow, event);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Host_UpdateMainFrame()
|
||||
{
|
||||
wxCommandEvent event(wxEVT_HOST_COMMAND, IDM_UPDATEGUI);
|
||||
wxPostEvent(main_frame, event);
|
||||
|
||||
if (g_pCodeWindow)
|
||||
{
|
||||
wxPostEvent(g_pCodeWindow, event);
|
||||
}
|
||||
}
|
||||
|
||||
void Host_UpdateBreakPointView()
|
||||
{
|
||||
wxCommandEvent event(wxEVT_HOST_COMMAND, IDM_UPDATEBREAKPOINTS);
|
||||
wxPostEvent(main_frame, event);
|
||||
|
||||
if (g_pCodeWindow)
|
||||
{
|
||||
wxPostEvent(g_pCodeWindow, event);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Host_UpdateMemoryView()
|
||||
{}
|
||||
|
||||
|
||||
void Host_SetDebugMode(bool)
|
||||
{}
|
||||
|
||||
|
||||
void Host_SetWaitCursor(bool enable)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
if (enable)
|
||||
{
|
||||
SetCursor(LoadCursor(NULL, IDC_WAIT));
|
||||
}
|
||||
else
|
||||
{
|
||||
SetCursor(LoadCursor(NULL, IDC_ARROW));
|
||||
}
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
void Host_UpdateStatusBar(const char* _pText)
|
||||
{
|
||||
wxCommandEvent event(wxEVT_HOST_COMMAND, IDM_UPDATESTATUSBAR);
|
||||
event.SetString(wxString::FromAscii(_pText));
|
||||
event.SetInt(0);
|
||||
|
||||
wxPostEvent(main_frame, event);
|
||||
}
|
||||
|
||||
void Host_SysMessage(const char *fmt, ...)
|
||||
{
|
||||
va_list list;
|
||||
char msg[512];
|
||||
|
||||
va_start(list, fmt);
|
||||
vsprintf(msg, fmt, list);
|
||||
va_end(list);
|
||||
|
||||
if (msg[strlen(msg)-1] == '\n') msg[strlen(msg)-1] = 0;
|
||||
wxMessageBox(wxString::FromAscii(msg));
|
||||
}
|
||||
|
||||
void Host_SetWiiMoteConnectionState(int _State)
|
||||
{
|
||||
static int currentState = -1;
|
||||
if (_State == currentState)
|
||||
return;
|
||||
currentState = _State;
|
||||
|
||||
wxCommandEvent event(wxEVT_HOST_COMMAND, IDM_UPDATESTATUSBAR);
|
||||
|
||||
switch(_State)
|
||||
{
|
||||
case 0: event.SetString(wxString::FromAscii("Not connected")); break;
|
||||
case 1: event.SetString(wxString::FromAscii("Connecting...")); break;
|
||||
case 2: event.SetString(wxString::FromAscii("Wiimote Connected")); break;
|
||||
}
|
||||
|
||||
event.SetInt(1);
|
||||
|
||||
wxPostEvent(main_frame, event);
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -1,109 +1,109 @@
|
||||
// Copyright (C) 2003-2008 Dolphin Project.
|
||||
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, version 2.0.
|
||||
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License 2.0 for more details.
|
||||
|
||||
// A copy of the GPL 2.0 should have been included with the program.
|
||||
// If not, see http://www.gnu.org/licenses/
|
||||
|
||||
// Official SVN repository and contact information can be found at
|
||||
// http://code.google.com/p/dolphin-emu/
|
||||
|
||||
#include "PatchAddEdit.h"
|
||||
|
||||
extern std::vector<PatchEngine::Patch> onFrame;
|
||||
|
||||
BEGIN_EVENT_TABLE(CPatchAddEdit, wxDialog)
|
||||
EVT_CLOSE(CPatchAddEdit::OnClose)
|
||||
EVT_SPIN(ID_ENTRY_SELECT, CPatchAddEdit::ChangeEntry)
|
||||
END_EVENT_TABLE()
|
||||
|
||||
CPatchAddEdit::CPatchAddEdit(int _selection, wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& position, const wxSize& size, long style)
|
||||
: wxDialog(parent, id, title, position, size, style)
|
||||
{
|
||||
selection = _selection;
|
||||
CreateGUIControls(selection);
|
||||
}
|
||||
|
||||
CPatchAddEdit::~CPatchAddEdit()
|
||||
{
|
||||
}
|
||||
|
||||
void CPatchAddEdit::CreateGUIControls(int _selection)
|
||||
{
|
||||
std::string currentName = onFrame.at(_selection).name;
|
||||
std::vector<PatchEngine::PatchEntry> currentEntries = onFrame.at(_selection).entries;
|
||||
|
||||
wxBoxSizer* sEditPatch = new wxBoxSizer(wxVERTICAL);
|
||||
wxStaticText* EditPatchNameText = new wxStaticText(this, ID_EDITPATCH_NAME_TEXT, _("Name:"), wxDefaultPosition, wxDefaultSize);
|
||||
EditPatchName = new wxTextCtrl(this, ID_EDITPATCH_NAME, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0);
|
||||
EditPatchName->SetValue(wxString::FromAscii(currentName.c_str()));
|
||||
wxStaticText* EditPatchOffsetText = new wxStaticText(this, ID_EDITPATCH_OFFSET_TEXT, _("Offset:"), wxDefaultPosition, wxDefaultSize);
|
||||
EditPatchOffset = new wxTextCtrl(this, ID_EDITPATCH_OFFSET, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0);
|
||||
EditPatchOffset->SetValue(wxString::Format(wxT("%08X"), currentEntries.at(0).address));
|
||||
EntrySelection = new wxSpinButton(this, ID_ENTRY_SELECT, wxDefaultPosition, wxDefaultSize, wxVERTICAL);
|
||||
EntrySelection->SetRange(0, (int)currentEntries.size()-1);
|
||||
wxArrayString wxArrayStringFor_EditPatchType;
|
||||
for (int i = 0; i < 3; ++i)
|
||||
wxArrayStringFor_EditPatchType.Add(wxString::FromAscii(PatchEngine::PatchTypeStrings[i]));
|
||||
EditPatchType = new wxRadioBox(this, ID_EDITPATCH_TYPE, _("Type"), wxDefaultPosition, wxDefaultSize, wxArrayStringFor_EditPatchType, 3, wxRA_SPECIFY_COLS, wxDefaultValidator);
|
||||
EditPatchType->SetSelection((int)currentEntries.at(0).type);
|
||||
wxStaticText* EditPatchValueText = new wxStaticText(this, ID_EDITPATCH_VALUE_TEXT, _("Value:"), wxDefaultPosition, wxDefaultSize);
|
||||
EditPatchValue = new wxTextCtrl(this, ID_EDITPATCH_VALUE, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0);
|
||||
EditPatchValue->SetValue(wxString::Format(wxT("%08X"), currentEntries.at(0).value));
|
||||
|
||||
wxBoxSizer* sEditPatchName = new wxBoxSizer(wxHORIZONTAL);
|
||||
sEditPatchName->Add(EditPatchNameText, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
|
||||
sEditPatchName->Add(EditPatchName, 1, wxEXPAND|wxALL, 5);
|
||||
sEditPatch->Add(sEditPatchName, 0, wxEXPAND);
|
||||
wxStaticBoxSizer* sbEntry = new wxStaticBoxSizer(wxVERTICAL, this, _("Entry"));
|
||||
wxGridBagSizer* sgEntry = new wxGridBagSizer(0, 0);
|
||||
sgEntry->AddGrowableCol(1);
|
||||
sgEntry->Add(EditPatchType, wxGBPosition(0, 0), wxGBSpan(1, 2), wxEXPAND|wxALL, 5);
|
||||
sgEntry->Add(EditPatchOffsetText, wxGBPosition(1, 0), wxGBSpan(1, 1), wxALIGN_CENTER_VERTICAL|wxALL, 5);
|
||||
sgEntry->Add(EditPatchOffset, wxGBPosition(1, 1), wxGBSpan(1, 1), wxEXPAND|wxALL, 5);
|
||||
sgEntry->Add(EditPatchValueText, wxGBPosition(2, 0), wxGBSpan(1, 1), wxALIGN_CENTER_VERTICAL|wxALL, 5);
|
||||
sgEntry->Add(EditPatchValue, wxGBPosition(2, 1), wxGBSpan(1, 1), wxEXPAND|wxALL, 5);
|
||||
sgEntry->Add(EntrySelection, wxGBPosition(0, 2), wxGBSpan(3, 1), wxEXPAND|wxALL, 5);
|
||||
sbEntry->Add(sgEntry, 0, wxEXPAND);
|
||||
sEditPatch->Add(sbEntry, 0, wxEXPAND|wxALL, 5);
|
||||
wxBoxSizer* sEditPatchButtons = new wxBoxSizer(wxHORIZONTAL);
|
||||
wxButton* bOK = new wxButton(this, wxID_OK, _("OK"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
|
||||
wxButton* bCancel = new wxButton(this, wxID_CANCEL, _("Cancel"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
|
||||
sEditPatchButtons->Add(0, 0, 1, wxEXPAND, 5);
|
||||
sEditPatchButtons->Add(bOK, 0, wxALL, 5);
|
||||
sEditPatchButtons->Add(bCancel, 0, wxALL, 5);
|
||||
sEditPatch->Add(sEditPatchButtons, 0, wxEXPAND, 5);
|
||||
this->SetSizer(sEditPatch);
|
||||
sEditPatch->Layout();
|
||||
|
||||
/*if (this->ShowModal() == wxID_OK)
|
||||
{
|
||||
onFrame.at(selection).name = std::string(EditPatchName->GetValue().mb_str());
|
||||
unsigned long value;
|
||||
if (EditPatchOffset->GetValue().ToULong(&value, 16))
|
||||
onFrame.at(selection).entries.at(0).address = value;
|
||||
onFrame.at(selection).entries.at(0).type = (PatchEngine::PatchType)EditPatchType->GetSelection();
|
||||
if (EditPatchValue->GetValue().ToULong(&value, 16))
|
||||
onFrame.at(selection).entries.at(0).value = value;
|
||||
}*/
|
||||
}
|
||||
|
||||
void CPatchAddEdit::OnClose(wxCloseEvent& WXUNUSED (event))
|
||||
{
|
||||
Destroy();
|
||||
}
|
||||
|
||||
void CPatchAddEdit::ChangeEntry(wxSpinEvent& event)
|
||||
{
|
||||
PatchEngine::PatchEntry pE = onFrame.at(selection).entries.at(event.GetPosition());
|
||||
EditPatchOffset->SetValue(wxString::Format(wxT("%08X"), pE.address));
|
||||
EditPatchType->SetSelection(pE.type);
|
||||
EditPatchValue->SetValue(wxString::Format(wxT("%08X"), pE.value));
|
||||
}
|
||||
// Copyright (C) 2003-2008 Dolphin Project.
|
||||
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, version 2.0.
|
||||
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License 2.0 for more details.
|
||||
|
||||
// A copy of the GPL 2.0 should have been included with the program.
|
||||
// If not, see http://www.gnu.org/licenses/
|
||||
|
||||
// Official SVN repository and contact information can be found at
|
||||
// http://code.google.com/p/dolphin-emu/
|
||||
|
||||
#include "PatchAddEdit.h"
|
||||
|
||||
extern std::vector<PatchEngine::Patch> onFrame;
|
||||
|
||||
BEGIN_EVENT_TABLE(CPatchAddEdit, wxDialog)
|
||||
EVT_CLOSE(CPatchAddEdit::OnClose)
|
||||
EVT_SPIN(ID_ENTRY_SELECT, CPatchAddEdit::ChangeEntry)
|
||||
END_EVENT_TABLE()
|
||||
|
||||
CPatchAddEdit::CPatchAddEdit(int _selection, wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& position, const wxSize& size, long style)
|
||||
: wxDialog(parent, id, title, position, size, style)
|
||||
{
|
||||
selection = _selection;
|
||||
CreateGUIControls(selection);
|
||||
}
|
||||
|
||||
CPatchAddEdit::~CPatchAddEdit()
|
||||
{
|
||||
}
|
||||
|
||||
void CPatchAddEdit::CreateGUIControls(int _selection)
|
||||
{
|
||||
std::string currentName = onFrame.at(_selection).name;
|
||||
std::vector<PatchEngine::PatchEntry> currentEntries = onFrame.at(_selection).entries;
|
||||
|
||||
wxBoxSizer* sEditPatch = new wxBoxSizer(wxVERTICAL);
|
||||
wxStaticText* EditPatchNameText = new wxStaticText(this, ID_EDITPATCH_NAME_TEXT, _("Name:"), wxDefaultPosition, wxDefaultSize);
|
||||
EditPatchName = new wxTextCtrl(this, ID_EDITPATCH_NAME, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0);
|
||||
EditPatchName->SetValue(wxString::FromAscii(currentName.c_str()));
|
||||
wxStaticText* EditPatchOffsetText = new wxStaticText(this, ID_EDITPATCH_OFFSET_TEXT, _("Offset:"), wxDefaultPosition, wxDefaultSize);
|
||||
EditPatchOffset = new wxTextCtrl(this, ID_EDITPATCH_OFFSET, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0);
|
||||
EditPatchOffset->SetValue(wxString::Format(wxT("%08X"), currentEntries.at(0).address));
|
||||
EntrySelection = new wxSpinButton(this, ID_ENTRY_SELECT, wxDefaultPosition, wxDefaultSize, wxVERTICAL);
|
||||
EntrySelection->SetRange(0, (int)currentEntries.size()-1);
|
||||
wxArrayString wxArrayStringFor_EditPatchType;
|
||||
for (int i = 0; i < 3; ++i)
|
||||
wxArrayStringFor_EditPatchType.Add(wxString::FromAscii(PatchEngine::PatchTypeStrings[i]));
|
||||
EditPatchType = new wxRadioBox(this, ID_EDITPATCH_TYPE, _("Type"), wxDefaultPosition, wxDefaultSize, wxArrayStringFor_EditPatchType, 3, wxRA_SPECIFY_COLS, wxDefaultValidator);
|
||||
EditPatchType->SetSelection((int)currentEntries.at(0).type);
|
||||
wxStaticText* EditPatchValueText = new wxStaticText(this, ID_EDITPATCH_VALUE_TEXT, _("Value:"), wxDefaultPosition, wxDefaultSize);
|
||||
EditPatchValue = new wxTextCtrl(this, ID_EDITPATCH_VALUE, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0);
|
||||
EditPatchValue->SetValue(wxString::Format(wxT("%08X"), currentEntries.at(0).value));
|
||||
|
||||
wxBoxSizer* sEditPatchName = new wxBoxSizer(wxHORIZONTAL);
|
||||
sEditPatchName->Add(EditPatchNameText, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
|
||||
sEditPatchName->Add(EditPatchName, 1, wxEXPAND|wxALL, 5);
|
||||
sEditPatch->Add(sEditPatchName, 0, wxEXPAND);
|
||||
wxStaticBoxSizer* sbEntry = new wxStaticBoxSizer(wxVERTICAL, this, _("Entry"));
|
||||
wxGridBagSizer* sgEntry = new wxGridBagSizer(0, 0);
|
||||
sgEntry->AddGrowableCol(1);
|
||||
sgEntry->Add(EditPatchType, wxGBPosition(0, 0), wxGBSpan(1, 2), wxEXPAND|wxALL, 5);
|
||||
sgEntry->Add(EditPatchOffsetText, wxGBPosition(1, 0), wxGBSpan(1, 1), wxALIGN_CENTER_VERTICAL|wxALL, 5);
|
||||
sgEntry->Add(EditPatchOffset, wxGBPosition(1, 1), wxGBSpan(1, 1), wxEXPAND|wxALL, 5);
|
||||
sgEntry->Add(EditPatchValueText, wxGBPosition(2, 0), wxGBSpan(1, 1), wxALIGN_CENTER_VERTICAL|wxALL, 5);
|
||||
sgEntry->Add(EditPatchValue, wxGBPosition(2, 1), wxGBSpan(1, 1), wxEXPAND|wxALL, 5);
|
||||
sgEntry->Add(EntrySelection, wxGBPosition(0, 2), wxGBSpan(3, 1), wxEXPAND|wxALL, 5);
|
||||
sbEntry->Add(sgEntry, 0, wxEXPAND);
|
||||
sEditPatch->Add(sbEntry, 0, wxEXPAND|wxALL, 5);
|
||||
wxBoxSizer* sEditPatchButtons = new wxBoxSizer(wxHORIZONTAL);
|
||||
wxButton* bOK = new wxButton(this, wxID_OK, _("OK"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
|
||||
wxButton* bCancel = new wxButton(this, wxID_CANCEL, _("Cancel"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
|
||||
sEditPatchButtons->Add(0, 0, 1, wxEXPAND, 5);
|
||||
sEditPatchButtons->Add(bOK, 0, wxALL, 5);
|
||||
sEditPatchButtons->Add(bCancel, 0, wxALL, 5);
|
||||
sEditPatch->Add(sEditPatchButtons, 0, wxEXPAND, 5);
|
||||
this->SetSizer(sEditPatch);
|
||||
sEditPatch->Layout();
|
||||
|
||||
/*if (this->ShowModal() == wxID_OK)
|
||||
{
|
||||
onFrame.at(selection).name = std::string(EditPatchName->GetValue().mb_str());
|
||||
unsigned long value;
|
||||
if (EditPatchOffset->GetValue().ToULong(&value, 16))
|
||||
onFrame.at(selection).entries.at(0).address = value;
|
||||
onFrame.at(selection).entries.at(0).type = (PatchEngine::PatchType)EditPatchType->GetSelection();
|
||||
if (EditPatchValue->GetValue().ToULong(&value, 16))
|
||||
onFrame.at(selection).entries.at(0).value = value;
|
||||
}*/
|
||||
}
|
||||
|
||||
void CPatchAddEdit::OnClose(wxCloseEvent& WXUNUSED (event))
|
||||
{
|
||||
Destroy();
|
||||
}
|
||||
|
||||
void CPatchAddEdit::ChangeEntry(wxSpinEvent& event)
|
||||
{
|
||||
PatchEngine::PatchEntry pE = onFrame.at(selection).entries.at(event.GetPosition());
|
||||
EditPatchOffset->SetValue(wxString::Format(wxT("%08X"), pE.address));
|
||||
EditPatchType->SetSelection(pE.type);
|
||||
EditPatchValue->SetValue(wxString::Format(wxT("%08X"), pE.value));
|
||||
}
|
||||
|
@ -1,192 +1,192 @@
|
||||
// Copyright (C) 2003-2008 Dolphin Project.
|
||||
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, version 2.0.
|
||||
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License 2.0 for more details.
|
||||
|
||||
// A copy of the GPL 2.0 should have been included with the program.
|
||||
// If not, see http://www.gnu.org/licenses/
|
||||
|
||||
// Official SVN repository and contact information can be found at
|
||||
// http://code.google.com/p/dolphin-emu/
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "Globals.h"
|
||||
#include "FileSearch.h"
|
||||
#include "FileUtil.h"
|
||||
#include "PluginManager.h"
|
||||
#include "StringUtil.h"
|
||||
|
||||
/* Why does it crash if we try to open the debugger in the same instance like this? */
|
||||
namespace PluginVideo
|
||||
{
|
||||
extern DynamicLibrary plugin;
|
||||
extern bool IsLoaded();
|
||||
extern bool LoadPlugin(const char *_Filename);
|
||||
extern void Debug(HWND _hwnd, bool Show);
|
||||
}
|
||||
|
||||
|
||||
namespace PluginDSP
|
||||
{
|
||||
extern DynamicLibrary plugin;
|
||||
extern bool IsLoaded();
|
||||
extern bool LoadPlugin(const char *_Filename);
|
||||
extern void Debug(HWND _hwnd, bool Show);
|
||||
}
|
||||
|
||||
|
||||
//void(__cdecl * m_DllDebugger) (HWND _hParent) = 0;
|
||||
|
||||
|
||||
CPluginManager CPluginManager::m_Instance;
|
||||
|
||||
|
||||
CPluginManager::CPluginManager()
|
||||
{}
|
||||
|
||||
|
||||
CPluginManager::~CPluginManager()
|
||||
{}
|
||||
|
||||
|
||||
// ----------------------------------------
|
||||
// Create list of avaliable plugins
|
||||
// -------------
|
||||
void CPluginManager::ScanForPlugins(wxWindow* _wxWindow)
|
||||
{
|
||||
m_PluginInfos.clear();
|
||||
|
||||
CFileSearch::XStringVector Directories;
|
||||
Directories.push_back(std::string(PLUGINS_DIR));
|
||||
|
||||
CFileSearch::XStringVector Extensions;
|
||||
Extensions.push_back("*" PLUGIN_SUFFIX);
|
||||
|
||||
CFileSearch FileSearch(Extensions, Directories);
|
||||
const CFileSearch::XStringVector& rFilenames = FileSearch.GetFileNames();
|
||||
|
||||
if (rFilenames.size() > 0)
|
||||
{
|
||||
/*
|
||||
wxProgressDialog dialog(_T("Scanning for Plugins"),
|
||||
_T("Scanning..."),
|
||||
(int)rFilenames.size(), // range
|
||||
_wxWindow, // parent
|
||||
wxPD_CAN_ABORT |
|
||||
wxPD_APP_MODAL |
|
||||
// wxPD_AUTO_HIDE | -- try this as well
|
||||
wxPD_ELAPSED_TIME |
|
||||
wxPD_ESTIMATED_TIME |
|
||||
wxPD_REMAINING_TIME |
|
||||
wxPD_SMOOTH // - makes indeterminate mode bar on WinXP very small
|
||||
);
|
||||
dialog.CenterOnParent();
|
||||
*/
|
||||
|
||||
for (size_t i = 0; i < rFilenames.size(); i++)
|
||||
{
|
||||
std::string orig_name = rFilenames[i];
|
||||
std::string FileName;
|
||||
|
||||
if (!SplitPath(rFilenames[i], NULL, &FileName, NULL))
|
||||
{
|
||||
printf("Bad Path %s\n", rFilenames[i].c_str());
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
wxString msg;
|
||||
char temp[128];
|
||||
sprintf(temp,"Scanning %s", FileName.c_str());
|
||||
msg = wxString::FromAscii(temp);
|
||||
bool Cont = dialog.Update((int)i, msg);
|
||||
|
||||
if (!Cont)
|
||||
{
|
||||
break;
|
||||
}
|
||||
*/
|
||||
CPluginInfo PluginInfo(orig_name.c_str());
|
||||
if (PluginInfo.IsValid())
|
||||
{
|
||||
m_PluginInfos.push_back(PluginInfo);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ----------------------------------------
|
||||
// Open config window. _rFilename = plugin filename ,ret = the dll slot number
|
||||
// -------------
|
||||
void CPluginManager::OpenConfig(void* _Parent, const char *_rFilename)
|
||||
{
|
||||
Common::CPlugin::Load(_rFilename);
|
||||
|
||||
Common::CPlugin::Config((HWND)_Parent);
|
||||
Common::CPlugin::Release();
|
||||
}
|
||||
|
||||
// ----------------------------------------
|
||||
// Open debugging window. Type = Video or DSP. Show = Show or hide window.
|
||||
// -------------
|
||||
void CPluginManager::OpenDebug(void* _Parent, const char *_rFilename, bool Type, bool Show)
|
||||
{
|
||||
//int ret = 1;
|
||||
//int ret = Common::CPlugin::Load(_rFilename, true);
|
||||
//int ret = PluginVideo::LoadPlugin(_rFilename);
|
||||
//int ret = PluginDSP::LoadPlugin(_rFilename);
|
||||
|
||||
if(Type)
|
||||
{
|
||||
//Common::CPlugin::Debug((HWND)_Parent);
|
||||
if(!PluginVideo::IsLoaded()) PluginVideo::LoadPlugin(_rFilename);
|
||||
PluginVideo::Debug((HWND)_Parent, Show);
|
||||
}
|
||||
else
|
||||
{
|
||||
if(!PluginDSP::IsLoaded()) PluginDSP::LoadPlugin(_rFilename);
|
||||
PluginDSP::Debug((HWND)_Parent, Show);
|
||||
}
|
||||
//Common::CPlugin::Release(); // this is only if the wx dialog is called with ShowModal()
|
||||
|
||||
//m_DllDebugger = (void (__cdecl*)(HWND))PluginVideo::plugin.Get("DllDebugger");
|
||||
//m_DllDebugger(NULL);
|
||||
}
|
||||
|
||||
|
||||
// ----------------------------------------
|
||||
// Get dll info
|
||||
// -------------
|
||||
CPluginInfo::CPluginInfo(const char *_rFileName)
|
||||
: m_FileName(_rFileName)
|
||||
, m_Valid(false)
|
||||
{
|
||||
if (Common::CPlugin::Load(_rFileName))
|
||||
{
|
||||
if (Common::CPlugin::GetInfo(m_PluginInfo))
|
||||
m_Valid = true;
|
||||
else
|
||||
PanicAlert("Could not get info about plugin %s", _rFileName);
|
||||
|
||||
Common::CPlugin::Release();
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!File::Exists(_rFileName)) {
|
||||
PanicAlert("Could not load plugin %s - file does not exist", _rFileName);
|
||||
} else {
|
||||
PanicAlert("Failed to load plugin %s - unknown error.\n", _rFileName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Copyright (C) 2003-2008 Dolphin Project.
|
||||
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, version 2.0.
|
||||
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License 2.0 for more details.
|
||||
|
||||
// A copy of the GPL 2.0 should have been included with the program.
|
||||
// If not, see http://www.gnu.org/licenses/
|
||||
|
||||
// Official SVN repository and contact information can be found at
|
||||
// http://code.google.com/p/dolphin-emu/
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "Globals.h"
|
||||
#include "FileSearch.h"
|
||||
#include "FileUtil.h"
|
||||
#include "PluginManager.h"
|
||||
#include "StringUtil.h"
|
||||
|
||||
/* Why does it crash if we try to open the debugger in the same instance like this? */
|
||||
namespace PluginVideo
|
||||
{
|
||||
extern DynamicLibrary plugin;
|
||||
extern bool IsLoaded();
|
||||
extern bool LoadPlugin(const char *_Filename);
|
||||
extern void Debug(HWND _hwnd, bool Show);
|
||||
}
|
||||
|
||||
|
||||
namespace PluginDSP
|
||||
{
|
||||
extern DynamicLibrary plugin;
|
||||
extern bool IsLoaded();
|
||||
extern bool LoadPlugin(const char *_Filename);
|
||||
extern void Debug(HWND _hwnd, bool Show);
|
||||
}
|
||||
|
||||
|
||||
//void(__cdecl * m_DllDebugger) (HWND _hParent) = 0;
|
||||
|
||||
|
||||
CPluginManager CPluginManager::m_Instance;
|
||||
|
||||
|
||||
CPluginManager::CPluginManager()
|
||||
{}
|
||||
|
||||
|
||||
CPluginManager::~CPluginManager()
|
||||
{}
|
||||
|
||||
|
||||
// ----------------------------------------
|
||||
// Create list of avaliable plugins
|
||||
// -------------
|
||||
void CPluginManager::ScanForPlugins(wxWindow* _wxWindow)
|
||||
{
|
||||
m_PluginInfos.clear();
|
||||
|
||||
CFileSearch::XStringVector Directories;
|
||||
Directories.push_back(std::string(PLUGINS_DIR));
|
||||
|
||||
CFileSearch::XStringVector Extensions;
|
||||
Extensions.push_back("*" PLUGIN_SUFFIX);
|
||||
|
||||
CFileSearch FileSearch(Extensions, Directories);
|
||||
const CFileSearch::XStringVector& rFilenames = FileSearch.GetFileNames();
|
||||
|
||||
if (rFilenames.size() > 0)
|
||||
{
|
||||
/*
|
||||
wxProgressDialog dialog(_T("Scanning for Plugins"),
|
||||
_T("Scanning..."),
|
||||
(int)rFilenames.size(), // range
|
||||
_wxWindow, // parent
|
||||
wxPD_CAN_ABORT |
|
||||
wxPD_APP_MODAL |
|
||||
// wxPD_AUTO_HIDE | -- try this as well
|
||||
wxPD_ELAPSED_TIME |
|
||||
wxPD_ESTIMATED_TIME |
|
||||
wxPD_REMAINING_TIME |
|
||||
wxPD_SMOOTH // - makes indeterminate mode bar on WinXP very small
|
||||
);
|
||||
dialog.CenterOnParent();
|
||||
*/
|
||||
|
||||
for (size_t i = 0; i < rFilenames.size(); i++)
|
||||
{
|
||||
std::string orig_name = rFilenames[i];
|
||||
std::string FileName;
|
||||
|
||||
if (!SplitPath(rFilenames[i], NULL, &FileName, NULL))
|
||||
{
|
||||
printf("Bad Path %s\n", rFilenames[i].c_str());
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
wxString msg;
|
||||
char temp[128];
|
||||
sprintf(temp,"Scanning %s", FileName.c_str());
|
||||
msg = wxString::FromAscii(temp);
|
||||
bool Cont = dialog.Update((int)i, msg);
|
||||
|
||||
if (!Cont)
|
||||
{
|
||||
break;
|
||||
}
|
||||
*/
|
||||
CPluginInfo PluginInfo(orig_name.c_str());
|
||||
if (PluginInfo.IsValid())
|
||||
{
|
||||
m_PluginInfos.push_back(PluginInfo);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ----------------------------------------
|
||||
// Open config window. _rFilename = plugin filename ,ret = the dll slot number
|
||||
// -------------
|
||||
void CPluginManager::OpenConfig(void* _Parent, const char *_rFilename)
|
||||
{
|
||||
Common::CPlugin::Load(_rFilename);
|
||||
|
||||
Common::CPlugin::Config((HWND)_Parent);
|
||||
Common::CPlugin::Release();
|
||||
}
|
||||
|
||||
// ----------------------------------------
|
||||
// Open debugging window. Type = Video or DSP. Show = Show or hide window.
|
||||
// -------------
|
||||
void CPluginManager::OpenDebug(void* _Parent, const char *_rFilename, bool Type, bool Show)
|
||||
{
|
||||
//int ret = 1;
|
||||
//int ret = Common::CPlugin::Load(_rFilename, true);
|
||||
//int ret = PluginVideo::LoadPlugin(_rFilename);
|
||||
//int ret = PluginDSP::LoadPlugin(_rFilename);
|
||||
|
||||
if(Type)
|
||||
{
|
||||
//Common::CPlugin::Debug((HWND)_Parent);
|
||||
if(!PluginVideo::IsLoaded()) PluginVideo::LoadPlugin(_rFilename);
|
||||
PluginVideo::Debug((HWND)_Parent, Show);
|
||||
}
|
||||
else
|
||||
{
|
||||
if(!PluginDSP::IsLoaded()) PluginDSP::LoadPlugin(_rFilename);
|
||||
PluginDSP::Debug((HWND)_Parent, Show);
|
||||
}
|
||||
//Common::CPlugin::Release(); // this is only if the wx dialog is called with ShowModal()
|
||||
|
||||
//m_DllDebugger = (void (__cdecl*)(HWND))PluginVideo::plugin.Get("DllDebugger");
|
||||
//m_DllDebugger(NULL);
|
||||
}
|
||||
|
||||
|
||||
// ----------------------------------------
|
||||
// Get dll info
|
||||
// -------------
|
||||
CPluginInfo::CPluginInfo(const char *_rFileName)
|
||||
: m_FileName(_rFileName)
|
||||
, m_Valid(false)
|
||||
{
|
||||
if (Common::CPlugin::Load(_rFileName))
|
||||
{
|
||||
if (Common::CPlugin::GetInfo(m_PluginInfo))
|
||||
m_Valid = true;
|
||||
else
|
||||
PanicAlert("Could not get info about plugin %s", _rFileName);
|
||||
|
||||
Common::CPlugin::Release();
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!File::Exists(_rFileName)) {
|
||||
PanicAlert("Could not load plugin %s - file does not exist", _rFileName);
|
||||
} else {
|
||||
PanicAlert("Failed to load plugin %s - unknown error.\n", _rFileName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user