diff --git a/Source/Core/AudioCommon/Src/CoreAudioSoundStream.cpp b/Source/Core/AudioCommon/Src/CoreAudioSoundStream.cpp index a230d07a75..d09bce85f9 100644 --- a/Source/Core/AudioCommon/Src/CoreAudioSoundStream.cpp +++ b/Source/Core/AudioCommon/Src/CoreAudioSoundStream.cpp @@ -46,15 +46,14 @@ bool CoreAudioSound::Start() AURenderCallbackStruct callback_struct; AudioStreamBasicDescription format; ComponentDescription desc; - UInt32 enableIO = 1; + Component component; desc.componentType = kAudioUnitType_Output; desc.componentSubType = kAudioUnitSubType_DefaultOutput; desc.componentFlags = 0; desc.componentFlagsMask = 0; desc.componentManufacturer = kAudioUnitManufacturer_Apple; - - Component component = FindNextComponent(NULL, &desc); + component = FindNextComponent(NULL, &desc); if (component == NULL) { ERROR_LOG(AUDIO, "error finding audio component"); return false; @@ -66,11 +65,6 @@ bool CoreAudioSound::Start() return false; } - AudioUnitSetProperty(audioUnit, - kAudioOutputUnitProperty_EnableIO, - kAudioUnitScope_Output, 0, &enableIO, - sizeof enableIO); - FillOutASBDForLPCM(format, m_mixer->GetSampleRate(), 2, 16, 16, false, false, false); err = AudioUnitSetProperty(audioUnit, diff --git a/Source/Core/AudioCommon/Src/Mixer.cpp b/Source/Core/AudioCommon/Src/Mixer.cpp index bed8f0e21f..c8eece73c7 100644 --- a/Source/Core/AudioCommon/Src/Mixer.cpp +++ b/Source/Core/AudioCommon/Src/Mixer.cpp @@ -31,8 +31,6 @@ #include #endif -static const __m128i sr_mask = _mm_set_epi32(0x0C0D0E0FL, 0x08090A0BL, 0x04050607L, 0x00010203L); - // Executed from sound stream thread unsigned int CMixer::Mix(short* samples, unsigned int numSamples) { @@ -64,6 +62,10 @@ unsigned int CMixer::Mix(short* samples, unsigned int numSamples) if (m_sampleRate == 32000) { #if _M_SSE >= 0x301 + static const __m128i sr_mask = + _mm_set_epi32(0x0C0D0E0FL, 0x08090A0BL, + 0x04050607L, 0x00010203L); + if (cpu_info.bSSSE3 && !((numLeft * 2) % 8)) { for (unsigned int i = 0; i < numLeft * 2; i += 8) diff --git a/Source/Core/Core/CMakeLists.txt b/Source/Core/Core/CMakeLists.txt index 217bbce660..7abd2fc2d5 100644 --- a/Source/Core/Core/CMakeLists.txt +++ b/Source/Core/Core/CMakeLists.txt @@ -181,7 +181,7 @@ set(SRCS Src/ActionReplay.cpp Src/PowerPC/JitCommon/JitCache.cpp Src/PowerPC/JitCommon/Jit_Util.cpp) -set(LIBS bdisasm inputcommon videoogl videosoftware lua sfml-network) +set(LIBS bdisasm inputcommon videoogl videosoftware sfml-network) if(WIN32) set(SRCS ${SRCS} Src/HW/BBA-TAP/TAP_Win32.cpp Src/stdafx.cpp diff --git a/Source/Core/Core/Core.vcproj b/Source/Core/Core/Core.vcproj index b1160d3403..3164c3c034 100644 --- a/Source/Core/Core/Core.vcproj +++ b/Source/Core/Core/Core.vcproj @@ -45,7 +45,7 @@ Level3 Disabled - .\Src;..\Common\Src;..\VideoCommon\Src;..\AudioCommon\Src;..\DiscIO\Src;..\InputCommon\Src;..\wiiuse\Src;..\..\..\Externals\Bochs_disasm;..\..\..\Externals\SFML\include;..\..\..\Externals\LZO;..\..\..\Externals\zlib;..\..\..\Externals\Lua;%(AdditionalIncludeDirectories) + .\Src;..\Common\Src;..\VideoCommon\Src;..\AudioCommon\Src;..\DiscIO\Src;..\InputCommon\Src;..\wiiuse\Src;..\..\..\Externals\Bochs_disasm;..\..\..\Externals\SFML\include;..\..\..\Externals\LZO;..\..\..\Externals\zlib;%(AdditionalIncludeDirectories) _SECURE_SCL=0;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) MultiThreadedDebug stdafx.h @@ -146,7 +146,7 @@ Level3 Disabled - .\Src;..\Common\Src;..\VideoCommon\Src;..\AudioCommon\Src;..\DiscIO\Src;..\InputCommon\Src;..\wiiuse\Src;..\..\..\Externals\Bochs_disasm;..\..\..\Externals\SFML\include;..\..\..\Externals\LZO;..\..\..\Externals\zlib;..\..\..\Externals\Lua;%(AdditionalIncludeDirectories) + .\Src;..\Common\Src;..\VideoCommon\Src;..\AudioCommon\Src;..\DiscIO\Src;..\InputCommon\Src;..\wiiuse\Src;..\..\..\Externals\Bochs_disasm;..\..\..\Externals\SFML\include;..\..\..\Externals\LZO;..\..\..\Externals\zlib;%(AdditionalIncludeDirectories) _SECURE_SCL=0;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) MultiThreadedDebug stdafx.h @@ -167,7 +167,7 @@ MaxSpeed true true - .\Src;..\Common\Src;..\VideoCommon\Src;..\AudioCommon\Src;..\DiscIO\Src;..\InputCommon\Src;..\wiiuse\Src;..\..\..\Externals\Bochs_disasm;..\..\..\Externals\SFML\include;..\..\..\Externals\LZO;..\..\..\Externals\zlib;..\..\..\Externals\Lua;%(AdditionalIncludeDirectories) + .\Src;..\Common\Src;..\VideoCommon\Src;..\AudioCommon\Src;..\DiscIO\Src;..\InputCommon\Src;..\wiiuse\Src;..\..\..\Externals\Bochs_disasm;..\..\..\Externals\SFML\include;..\..\..\Externals\LZO;..\..\..\Externals\zlib;%(AdditionalIncludeDirectories) _SECURE_SCL=0;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) MultiThreaded false @@ -191,7 +191,7 @@ MaxSpeed true true - .\Src;..\Common\Src;..\VideoCommon\Src;..\AudioCommon\Src;..\DiscIO\Src;..\InputCommon\Src;..\wiiuse\Src;..\..\..\Externals\Bochs_disasm;..\..\..\Externals\SFML\include;..\..\..\Externals\LZO;..\..\..\Externals\zlib;..\..\..\Externals\Lua;%(AdditionalIncludeDirectories) + .\Src;..\Common\Src;..\VideoCommon\Src;..\AudioCommon\Src;..\DiscIO\Src;..\InputCommon\Src;..\wiiuse\Src;..\..\..\Externals\Bochs_disasm;..\..\..\Externals\SFML\include;..\..\..\Externals\LZO;..\..\..\Externals\zlib;%(AdditionalIncludeDirectories) DEBUGFAST;_SECURE_SCL=0;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) MultiThreaded false @@ -216,7 +216,7 @@ MaxSpeed true true - .\Src;..\Common\Src;..\VideoCommon\Src;..\AudioCommon\Src;..\DiscIO\Src;..\InputCommon\Src;..\wiiuse\Src;..\..\..\Externals\Bochs_disasm;..\..\..\Externals\SFML\include;..\..\..\Externals\LZO;..\..\..\Externals\zlib;..\..\..\Externals\Lua;%(AdditionalIncludeDirectories) + .\Src;..\Common\Src;..\VideoCommon\Src;..\AudioCommon\Src;..\DiscIO\Src;..\InputCommon\Src;..\wiiuse\Src;..\..\..\Externals\Bochs_disasm;..\..\..\Externals\SFML\include;..\..\..\Externals\LZO;..\..\..\Externals\zlib;%(AdditionalIncludeDirectories) _SECURE_SCL=0;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) MultiThreaded false @@ -240,7 +240,7 @@ MaxSpeed true true - .\Src;..\Common\Src;..\VideoCommon\Src;..\AudioCommon\Src;..\DiscIO\Src;..\InputCommon\Src;..\wiiuse\Src;..\..\..\Externals\Bochs_disasm;..\..\..\Externals\SFML\include;..\..\..\Externals\LZO;..\..\..\Externals\zlib;..\..\..\Externals\Lua;%(AdditionalIncludeDirectories) + .\Src;..\Common\Src;..\VideoCommon\Src;..\AudioCommon\Src;..\DiscIO\Src;..\InputCommon\Src;..\wiiuse\Src;..\..\..\Externals\Bochs_disasm;..\..\..\Externals\SFML\include;..\..\..\Externals\LZO;..\..\..\Externals\zlib;%(AdditionalIncludeDirectories) DEBUGFAST;_SECURE_SCL=0;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) MultiThreaded false @@ -639,4 +639,4 @@ - \ No newline at end of file + diff --git a/Source/Core/Core/Src/PowerPC/Jit64/Jit_Integer.cpp b/Source/Core/Core/Src/PowerPC/Jit64/Jit_Integer.cpp index 01c6d0b8c9..b41d8b1852 100644 --- a/Source/Core/Core/Src/PowerPC/Jit64/Jit_Integer.cpp +++ b/Source/Core/Core/Src/PowerPC/Jit64/Jit_Integer.cpp @@ -116,7 +116,7 @@ void Jit64::reg_imm(UGeckoInstruction inst) { INSTRUCTION_START JITDISABLE(Integer) - int d = inst.RD, a = inst.RA, s = inst.RS; + u32 d = inst.RD, a = inst.RA, s = inst.RS; switch (inst.OPCD) { case 14: // addi diff --git a/Source/Core/DolphinWX/CMakeLists.txt b/Source/Core/DolphinWX/CMakeLists.txt index 8c9b882be8..6a8355fe43 100644 --- a/Source/Core/DolphinWX/CMakeLists.txt +++ b/Source/Core/DolphinWX/CMakeLists.txt @@ -7,7 +7,6 @@ set(LIBS core inputcommon common audiocommon - lua z sfml-network SDL diff --git a/Source/Core/DolphinWX/Src/PHackSettings.cpp b/Source/Core/DolphinWX/Src/PHackSettings.cpp index 7b5b4c1891..ffa3d3d779 100644 --- a/Source/Core/DolphinWX/Src/PHackSettings.cpp +++ b/Source/Core/DolphinWX/Src/PHackSettings.cpp @@ -1,159 +1,159 @@ -// Copyright (C) 2003 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 "PHackSettings.h" -#include "ConfigManager.h" - -extern PHackData PHack_Data; - -BEGIN_EVENT_TABLE(CPHackSettings, wxDialog) - EVT_CHOICE(ID_PHACK_CHOICE, CPHackSettings::SetRefresh) - EVT_CLOSE(CPHackSettings::OnClose) - EVT_BUTTON(wxID_OK, CPHackSettings::SavePHackData) -END_EVENT_TABLE() - -CPHackSettings::CPHackSettings(wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& position, const wxSize& size, long style) - : wxDialog(parent, id, title, position, size, style) -{ - CreateGUIControls(); - std::string _iniFilename; - _iniFilename = std::string(File::GetUserPath(D_GAMECONFIG_IDX)) + "PH_PRESETS.ini"; - PHPresetsIni.Load(_iniFilename.c_str()); - //PHPresetsIni.SortSections(); - //PHPresetsIni.Save(_iniFilename.c_str()); - - LoadPHackData(); -} - -CPHackSettings::~CPHackSettings() -{ -} - -void CPHackSettings::CreateGUIControls() -{ - PHackChoiceText = new wxStaticText(this, ID_PHACK_CHOICE_TEXT, _("Presets: "), wxDefaultPosition, wxDefaultSize); - PHackChoice = new wxChoice(this, ID_PHACK_CHOICE, wxDefaultPosition, wxDefaultSize, wxArrayString(0, wxString("", *wxConvCurrent)), 0, wxDefaultValidator); - PHackChoice->SetToolTip(_("Load preset values from hack patterns available.")); - PHackZNearText = new wxStaticText(this, ID_PHACK_ZNEAR_TEXT, _("zNear Correction: "), wxDefaultPosition, wxDefaultSize); - PHackZNear = new wxTextCtrl(this, ID_PHACK_ZNEAR, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator); - PHackZNear->SetToolTip(_("Adds the specified value to zNear Parameter.\nTwo ways to express the floating point values.\nExample: entering '\'200'\' or '\'0.0002'\' directly, it produces equal effects, the acquired value will be '\'0.0002'\'.\nValues: (0->+/-Integer) or (0->+/-FP[6 digits of precision])\n\nNOTE: Check LogWindow/Console for the acquired values.")); - PHackSZNear = new wxCheckBox(this, ID_PHACK_SZNEAR, _("(-)+zNear"), wxDefaultPosition, wxDefaultSize, wxCHK_2STATE, wxDefaultValidator); - PHackSZNear->SetToolTip(_("Changes sign to zNear Parameter (after correction)")); - PHackZFarText = new wxStaticText(this, ID_PHACK_ZFAR_TEXT, _("zFar Correction: "), wxDefaultPosition, wxDefaultSize); - PHackZFar = new wxTextCtrl(this, ID_PHACK_ZFAR, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator); - PHackZFar->SetToolTip(_("Adds the specified value to zFar Parameter.\nTwo ways to express the floating point values.\nExample: entering '\'200'\' or '\'0.0002'\' directly, it produces equal effects, the acquired value will be '\'0.0002'\'.\nValues: (0->+/-Integer) or (0->+/-FP[6 digits of precision])\n\nNOTE: Check LogWindow/Console for the acquired values.")); - PHackSZFar = new wxCheckBox(this, ID_PHACK_SZFAR, _("(-)+zFar"), wxDefaultPosition, wxDefaultSize, wxCHK_2STATE, wxDefaultValidator); - PHackSZFar->SetToolTip(_("Changes sign to zFar Parameter (after correction)")); - PHackExP = new wxCheckBox(this, ID_PHACK_EXP, _("Extra Parameter"), wxDefaultPosition, wxDefaultSize, wxCHK_2STATE, wxDefaultValidator); - PHackExP->SetToolTip(_("Extra Parameter useful in '\'Metroid: Other M'\' only.")); - - wxStaticBoxSizer *sbPHackSettings = new wxStaticBoxSizer(wxVERTICAL, this, _("Parameters")); - wxFlexGridSizer *szrPHackSettings = new wxFlexGridSizer(3, 5, 5); - sbPHackSettings->Add(szrPHackSettings, 0, wxEXPAND|wxLEFT|wxTOP, 5); - szrPHackSettings->Add(PHackZNearText, 0, wxALIGN_CENTER_VERTICAL); - szrPHackSettings->Add(PHackZNear, 1, wxEXPAND); - szrPHackSettings->Add(PHackSZNear, 0, wxEXPAND|wxLEFT, 5); - szrPHackSettings->Add(PHackZFarText, 0, wxALIGN_CENTER_VERTICAL); - szrPHackSettings->Add(PHackZFar, 1, wxEXPAND); - szrPHackSettings->Add(PHackSZFar, 0, wxEXPAND|wxLEFT, 5); - szrPHackSettings->Add(PHackExP, 0, wxEXPAND|wxTOP|wxBOTTOM, 5); - - wxBoxSizer* sPHackButtons = 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); - sPHackButtons->Add(0, 0, 1, wxEXPAND, 5); - sPHackButtons->Add(bOK, 0, wxALL, 5); - sPHackButtons->Add(bCancel, 0, wxALL, 5); - - wxBoxSizer* sPHack = new wxBoxSizer(wxVERTICAL); - sPHack->Add(PHackChoiceText, 0, wxEXPAND|wxLEFT|wxRIGHT|wxTOP, 5); - sPHack->Add(PHackChoice, 0, wxEXPAND|wxLEFT|wxRIGHT|wxBOTTOM, 5); - sPHack->Add(sbPHackSettings, 0, wxEXPAND|wxALL, 5); - sPHack->Add(sPHackButtons, 0, wxEXPAND, 5); - - SetSizerAndFit(sPHack); -} - -void CPHackSettings::LoadPHackData() -{ - std::string sTemp; - char sIndex[15]; - - PHackChoice->Clear(); - PHackChoice->Append(_("[Custom]")); - for (int i=0 ; ; i++) - { - sprintf(sIndex,"%d",i); - if (!PHPresetsIni.Exists(sIndex, "Title")) - break; - PHPresetsIni.Get(sIndex, "Title", &sTemp); - if (sTemp.empty()) - sTemp = wxString(_("(UNKNOWN)")).char_str(); - if (i == 0) - PHackChoice->Append(wxString("-----------", *wxConvCurrent)); - PHackChoice->Append(wxString(sTemp.c_str(), *wxConvCurrent)); - } - PHackChoice->Select(0); - - PHackSZNear->Set3StateValue((wxCheckBoxState)PHack_Data.PHackSZNear); - PHackSZFar->Set3StateValue((wxCheckBoxState)PHack_Data.PHackSZFar); - PHackExP->Set3StateValue((wxCheckBoxState)PHack_Data.PHackExP); - - PHackZNear->SetValue(wxString(PHack_Data.PHZNear.c_str(), *wxConvCurrent)); - PHackZFar->SetValue(wxString(PHack_Data.PHZFar.c_str(), *wxConvCurrent)); -} - -void CPHackSettings::SetRefresh(wxCommandEvent& event) -{ - bool bTemp; - std::string sTemp; - char sIndex[15]; - int index = event.GetSelection(); - if (index > 1) - { - index -= 2; - sprintf(sIndex,"%d", index); - - PHPresetsIni.Get(sIndex, "PH_SZNear", &bTemp); - PHackSZNear->Set3StateValue((wxCheckBoxState)bTemp); - PHPresetsIni.Get(sIndex, "PH_SZFar", &bTemp); - PHackSZFar->Set3StateValue((wxCheckBoxState)bTemp); - PHPresetsIni.Get(sIndex, "PH_ExtraParam", &bTemp); - PHackExP->Set3StateValue((wxCheckBoxState)bTemp); - PHPresetsIni.Get(sIndex, "PH_ZNear", &sTemp); - PHackZNear->SetValue(wxString(sTemp.c_str(), *wxConvCurrent)); - PHPresetsIni.Get(sIndex, "PH_ZFar", &sTemp); - PHackZFar->SetValue(wxString(sTemp.c_str(), *wxConvCurrent)); - } -} - -void CPHackSettings::OnClose(wxCloseEvent& WXUNUSED (event)) -{ - Destroy(); -} - -void CPHackSettings::SavePHackData(wxCommandEvent& WXUNUSED (event)) -{ - PHack_Data.PHackSZNear = PHackSZNear->GetValue(); - PHack_Data.PHackSZFar = PHackSZFar->GetValue(); - PHack_Data.PHackExP = PHackExP->GetValue(); - - PHack_Data.PHZNear = PHackZNear->GetValue().char_str(); - PHack_Data.PHZFar = PHackZFar->GetValue().char_str(); - - AcceptAndClose(); -} \ No newline at end of file +// Copyright (C) 2003 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 "PHackSettings.h" +#include "ConfigManager.h" + +extern PHackData PHack_Data; + +BEGIN_EVENT_TABLE(CPHackSettings, wxDialog) + EVT_CHOICE(ID_PHACK_CHOICE, CPHackSettings::SetRefresh) + EVT_CLOSE(CPHackSettings::OnClose) + EVT_BUTTON(wxID_OK, CPHackSettings::SavePHackData) +END_EVENT_TABLE() + +CPHackSettings::CPHackSettings(wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& position, const wxSize& size, long style) + : wxDialog(parent, id, title, position, size, style) +{ + CreateGUIControls(); + std::string _iniFilename; + _iniFilename = std::string(File::GetUserPath(D_GAMECONFIG_IDX)) + "PH_PRESETS.ini"; + PHPresetsIni.Load(_iniFilename.c_str()); + //PHPresetsIni.SortSections(); + //PHPresetsIni.Save(_iniFilename.c_str()); + + LoadPHackData(); +} + +CPHackSettings::~CPHackSettings() +{ +} + +void CPHackSettings::CreateGUIControls() +{ + PHackChoiceText = new wxStaticText(this, ID_PHACK_CHOICE_TEXT, _("Presets: "), wxDefaultPosition, wxDefaultSize); + PHackChoice = new wxChoice(this, ID_PHACK_CHOICE, wxDefaultPosition, wxDefaultSize, wxArrayString(0, wxString("", *wxConvCurrent)), 0, wxDefaultValidator); + PHackChoice->SetToolTip(_("Load preset values from hack patterns available.")); + PHackZNearText = new wxStaticText(this, ID_PHACK_ZNEAR_TEXT, _("zNear Correction: "), wxDefaultPosition, wxDefaultSize); + PHackZNear = new wxTextCtrl(this, ID_PHACK_ZNEAR, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator); + PHackZNear->SetToolTip(_("Adds the specified value to zNear Parameter.\nTwo ways to express the floating point values.\nExample: entering '\'200'\' or '\'0.0002'\' directly, it produces equal effects, the acquired value will be '\'0.0002'\'.\nValues: (0->+/-Integer) or (0->+/-FP[6 digits of precision])\n\nNOTE: Check LogWindow/Console for the acquired values.")); + PHackSZNear = new wxCheckBox(this, ID_PHACK_SZNEAR, _("(-)+zNear"), wxDefaultPosition, wxDefaultSize, wxCHK_2STATE, wxDefaultValidator); + PHackSZNear->SetToolTip(_("Changes sign to zNear Parameter (after correction)")); + PHackZFarText = new wxStaticText(this, ID_PHACK_ZFAR_TEXT, _("zFar Correction: "), wxDefaultPosition, wxDefaultSize); + PHackZFar = new wxTextCtrl(this, ID_PHACK_ZFAR, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator); + PHackZFar->SetToolTip(_("Adds the specified value to zFar Parameter.\nTwo ways to express the floating point values.\nExample: entering '\'200'\' or '\'0.0002'\' directly, it produces equal effects, the acquired value will be '\'0.0002'\'.\nValues: (0->+/-Integer) or (0->+/-FP[6 digits of precision])\n\nNOTE: Check LogWindow/Console for the acquired values.")); + PHackSZFar = new wxCheckBox(this, ID_PHACK_SZFAR, _("(-)+zFar"), wxDefaultPosition, wxDefaultSize, wxCHK_2STATE, wxDefaultValidator); + PHackSZFar->SetToolTip(_("Changes sign to zFar Parameter (after correction)")); + PHackExP = new wxCheckBox(this, ID_PHACK_EXP, _("Extra Parameter"), wxDefaultPosition, wxDefaultSize, wxCHK_2STATE, wxDefaultValidator); + PHackExP->SetToolTip(_("Extra Parameter useful in '\'Metroid: Other M'\' only.")); + + wxStaticBoxSizer *sbPHackSettings = new wxStaticBoxSizer(wxVERTICAL, this, _("Parameters")); + wxFlexGridSizer *szrPHackSettings = new wxFlexGridSizer(3, 5, 5); + sbPHackSettings->Add(szrPHackSettings, 0, wxEXPAND|wxLEFT|wxTOP, 5); + szrPHackSettings->Add(PHackZNearText, 0, wxALIGN_CENTER_VERTICAL); + szrPHackSettings->Add(PHackZNear, 1, wxEXPAND); + szrPHackSettings->Add(PHackSZNear, 0, wxEXPAND|wxLEFT, 5); + szrPHackSettings->Add(PHackZFarText, 0, wxALIGN_CENTER_VERTICAL); + szrPHackSettings->Add(PHackZFar, 1, wxEXPAND); + szrPHackSettings->Add(PHackSZFar, 0, wxEXPAND|wxLEFT, 5); + szrPHackSettings->Add(PHackExP, 0, wxEXPAND|wxTOP|wxBOTTOM, 5); + + wxBoxSizer* sPHackButtons = 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); + sPHackButtons->Add(0, 0, 1, wxEXPAND, 5); + sPHackButtons->Add(bOK, 0, wxALL, 5); + sPHackButtons->Add(bCancel, 0, wxALL, 5); + + wxBoxSizer* sPHack = new wxBoxSizer(wxVERTICAL); + sPHack->Add(PHackChoiceText, 0, wxEXPAND|wxLEFT|wxRIGHT|wxTOP, 5); + sPHack->Add(PHackChoice, 0, wxEXPAND|wxLEFT|wxRIGHT|wxBOTTOM, 5); + sPHack->Add(sbPHackSettings, 0, wxEXPAND|wxALL, 5); + sPHack->Add(sPHackButtons, 0, wxEXPAND, 5); + + SetSizerAndFit(sPHack); +} + +void CPHackSettings::LoadPHackData() +{ + std::string sTemp; + char sIndex[15]; + + PHackChoice->Clear(); + PHackChoice->Append(_("[Custom]")); + for (int i=0 ; ; i++) + { + sprintf(sIndex,"%d",i); + if (!PHPresetsIni.Exists(sIndex, "Title")) + break; + PHPresetsIni.Get(sIndex, "Title", &sTemp); + if (sTemp.empty()) + sTemp = wxString(_("(UNKNOWN)")).char_str(); + if (i == 0) + PHackChoice->Append(wxString("-----------", *wxConvCurrent)); + PHackChoice->Append(wxString(sTemp.c_str(), *wxConvCurrent)); + } + PHackChoice->Select(0); + + PHackSZNear->Set3StateValue((wxCheckBoxState)PHack_Data.PHackSZNear); + PHackSZFar->Set3StateValue((wxCheckBoxState)PHack_Data.PHackSZFar); + PHackExP->Set3StateValue((wxCheckBoxState)PHack_Data.PHackExP); + + PHackZNear->SetValue(wxString(PHack_Data.PHZNear.c_str(), *wxConvCurrent)); + PHackZFar->SetValue(wxString(PHack_Data.PHZFar.c_str(), *wxConvCurrent)); +} + +void CPHackSettings::SetRefresh(wxCommandEvent& event) +{ + bool bTemp; + std::string sTemp; + char sIndex[15]; + int index = event.GetSelection(); + if (index > 1) + { + index -= 2; + sprintf(sIndex,"%d", index); + + PHPresetsIni.Get(sIndex, "PH_SZNear", &bTemp); + PHackSZNear->Set3StateValue((wxCheckBoxState)bTemp); + PHPresetsIni.Get(sIndex, "PH_SZFar", &bTemp); + PHackSZFar->Set3StateValue((wxCheckBoxState)bTemp); + PHPresetsIni.Get(sIndex, "PH_ExtraParam", &bTemp); + PHackExP->Set3StateValue((wxCheckBoxState)bTemp); + PHPresetsIni.Get(sIndex, "PH_ZNear", &sTemp); + PHackZNear->SetValue(wxString(sTemp.c_str(), *wxConvCurrent)); + PHPresetsIni.Get(sIndex, "PH_ZFar", &sTemp); + PHackZFar->SetValue(wxString(sTemp.c_str(), *wxConvCurrent)); + } +} + +void CPHackSettings::OnClose(wxCloseEvent& WXUNUSED (event)) +{ + Destroy(); +} + +void CPHackSettings::SavePHackData(wxCommandEvent& WXUNUSED (event)) +{ + PHack_Data.PHackSZNear = PHackSZNear->GetValue(); + PHack_Data.PHackSZFar = PHackSZFar->GetValue(); + PHack_Data.PHackExP = PHackExP->GetValue(); + + PHack_Data.PHZNear = PHackZNear->GetValue().char_str(); + PHack_Data.PHZFar = PHackZFar->GetValue().char_str(); + + AcceptAndClose(); +} diff --git a/Source/Core/DolphinWX/Src/PHackSettings.h b/Source/Core/DolphinWX/Src/PHackSettings.h index 56f7dcdac4..4480e264e2 100644 --- a/Source/Core/DolphinWX/Src/PHackSettings.h +++ b/Source/Core/DolphinWX/Src/PHackSettings.h @@ -1,70 +1,71 @@ -// Copyright (C) 2003 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/ - -#ifndef __PHACK_SETTINGS_h__ -#define __PHACK_SETTINGS_h__ - -#include -#include -#include "ISOProperties.h" - -class CPHackSettings : public wxDialog -{ - public: - CPHackSettings(wxWindow* parent, - wxWindowID id = 1, - const wxString& title = _("Custom Projection Hack Settings"), - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxDEFAULT_DIALOG_STYLE); - virtual ~CPHackSettings(); - - private: - DECLARE_EVENT_TABLE(); - - wxChoice *PHackChoice; - wxCheckBox *PHackSZNear; - wxCheckBox *PHackSZFar; - wxCheckBox *PHackExP; - wxStaticText *PHackChoiceText; - wxStaticText *PHackZNearText; - wxStaticText *PHackZFarText; - wxTextCtrl *PHackZNear; - wxTextCtrl *PHackZFar; - - enum { - ID_PHACK_CHOICE_TEXT = 1000, - ID_PHACK_CHOICE, - ID_PHACK_SZNEAR, - ID_PHACK_SZFAR, - ID_PHACK_ZNEAR_TEXT, - ID_PHACK_ZNEAR, - ID_PHACK_ZFAR_TEXT, - ID_PHACK_ZFAR, - ID_PHACK_EXP - }; - - IniFile PHPresetsIni; - - void SetRefresh(wxCommandEvent& event); - void CreateGUIControls(); - - void OnClose(wxCloseEvent& event); - void SavePHackData(wxCommandEvent& event); - void LoadPHackData(); -}; -#endif // __PHACK_SETTINGS_h__ +// Copyright (C) 2003 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/ + +#ifndef __PHACK_SETTINGS_h__ +#define __PHACK_SETTINGS_h__ + +#include +#include +#include "ISOProperties.h" + +class CPHackSettings : public wxDialog +{ + public: + CPHackSettings(wxWindow* parent, + wxWindowID id = 1, + const wxString& title = _("Custom Projection Hack Settings"), + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxDEFAULT_DIALOG_STYLE); + virtual ~CPHackSettings(); + + private: + DECLARE_EVENT_TABLE(); + + wxChoice *PHackChoice; + wxCheckBox *PHackSZNear; + wxCheckBox *PHackSZFar; + wxCheckBox *PHackExP; + wxStaticText *PHackChoiceText; + wxStaticText *PHackZNearText; + wxStaticText *PHackZFarText; + wxTextCtrl *PHackZNear; + wxTextCtrl *PHackZFar; + + enum { + ID_PHACK_CHOICE_TEXT = 1000, + ID_PHACK_CHOICE, + ID_PHACK_SZNEAR, + ID_PHACK_SZFAR, + ID_PHACK_ZNEAR_TEXT, + ID_PHACK_ZNEAR, + ID_PHACK_ZFAR_TEXT, + ID_PHACK_ZFAR, + ID_PHACK_EXP + }; + + IniFile PHPresetsIni; + + void SetRefresh(wxCommandEvent& event); + void CreateGUIControls(); + + void OnClose(wxCloseEvent& event); + void SavePHackData(wxCommandEvent& event); + void LoadPHackData(); +}; + +#endif // __PHACK_SETTINGS_h__ diff --git a/Source/Core/InputCommon/Src/ControllerInterface/OSX/OSXJoystick.mm b/Source/Core/InputCommon/Src/ControllerInterface/OSX/OSXJoystick.mm index d37e38fa72..418e4f4ef0 100644 --- a/Source/Core/InputCommon/Src/ControllerInterface/OSX/OSXJoystick.mm +++ b/Source/Core/InputCommon/Src/ControllerInterface/OSX/OSXJoystick.mm @@ -75,6 +75,8 @@ Joystick::Joystick(IOHIDDeviceRef device, std::string name, int index) ControlState Joystick::GetInputState( const ControllerInterface::Device::Input* const input) const { + if (input == NULL) // XXX + return 0; return ((Input*)input)->GetState(m_device); }