diff options
| author | degasus <wickmarkus@web.de> | 2013-01-09 11:00:26 +0100 |
|---|---|---|
| committer | degasus <wickmarkus@web.de> | 2013-01-09 11:00:26 +0100 |
| commit | bff02b3b7348c36d54acd7823ddeef66ec996350 (patch) | |
| tree | 597a6453c11c56c857990607cbeadc2edc00452d /Source/Core | |
| parent | b7906b49c98ffaf29a5c9e25cfbabec16b7f4a8d (diff) | |
| parent | 84debc17d530dc3324c06a971d61fadf1cedf1e4 (diff) | |
Merge branch 'arb_framebuffer' into GLSL-master
Conflicts:
Source/Plugins/Plugin_VideoOGL/Src/FramebufferManager.cpp
Source/Plugins/Plugin_VideoOGL/Src/RasterFont.cpp
Source/Plugins/Plugin_VideoOGL/Src/Render.cpp
Source/Plugins/Plugin_VideoOGL/Src/TextureCache.cpp
Source/Plugins/Plugin_VideoOGL/Src/TextureConverter.cpp
Diffstat (limited to 'Source/Core')
24 files changed, 132 insertions, 69 deletions
diff --git a/Source/Core/Common/Src/ChunkFile.h b/Source/Core/Common/Src/ChunkFile.h index 5935b7f53a..be8b49a3a3 100644 --- a/Source/Core/Common/Src/ChunkFile.h +++ b/Source/Core/Common/Src/ChunkFile.h @@ -158,7 +158,7 @@ public: case MODE_READ: x = (wchar_t*)*ptr; break; case MODE_WRITE: memcpy(*ptr, x.c_str(), stringLen); break; case MODE_MEASURE: break; - case MODE_VERIFY: _dbg_assert_msg_(COMMON, x == (wchar_t*)*ptr, "Savestate verification failure: \"%s\" != \"%s\" (at %p).\n", x.c_str(), (wchar_t*)*ptr, ptr); break; + case MODE_VERIFY: _dbg_assert_msg_(COMMON, x == (wchar_t*)*ptr, "Savestate verification failure: \"%ls\" != \"%ls\" (at %p).\n", x.c_str(), (wchar_t*)*ptr, ptr); break; } (*ptr) += stringLen; } diff --git a/Source/Core/Common/Src/x64Emitter.cpp b/Source/Core/Common/Src/x64Emitter.cpp index 19e96478d1..5f8d0a66f1 100644 --- a/Source/Core/Common/Src/x64Emitter.cpp +++ b/Source/Core/Common/Src/x64Emitter.cpp @@ -1068,8 +1068,10 @@ void XEmitter::XOR (int bits, const OpArg &a1, const OpArg &a2) {WriteNormalOp(t void XEmitter::MOV (int bits, const OpArg &a1, const OpArg &a2) { #ifdef _DEBUG +#ifndef _M_X64 _assert_msg_(DYNA_REC, !a1.IsSimpleReg() || !a2.IsSimpleReg() || a1.GetSimpleReg() != a2.GetSimpleReg(), "Redundant MOV @ %p - bug in JIT?", - code); + code); +#endif #endif WriteNormalOp(this, bits, nrmMOV, a1, a2); } diff --git a/Source/Core/Core/Src/DSP/Jit/DSPJitRegCache.cpp b/Source/Core/Core/Src/DSP/Jit/DSPJitRegCache.cpp index ee5908889a..687982cfb9 100644 --- a/Source/Core/Core/Src/DSP/Jit/DSPJitRegCache.cpp +++ b/Source/Core/Core/Src/DSP/Jit/DSPJitRegCache.cpp @@ -218,13 +218,12 @@ void DSPJitRegCache::flushRegs(DSPJitRegCache &cache, bool emit) do { movcnt = 0; for(i = 0; i <= DSP_REG_MAX_MEM_BACKED; i++) { - if (cache.regs[i].loc.GetSimpleReg() != - regs[i].loc.GetSimpleReg() && - xregs[cache.regs[i].loc.GetSimpleReg()].guest_reg == DSP_REG_NONE) + X64Reg simple = regs[i].loc.GetSimpleReg(); + X64Reg simple_cache = cache.regs[i].loc.GetSimpleReg(); + if (simple_cache != simple + && xregs[simple_cache].guest_reg == DSP_REG_NONE) { - movToHostReg(i, - cache.regs[i].loc.GetSimpleReg(), - true); + movToHostReg(i, simple_cache, true); movcnt++; } } diff --git a/Source/Core/Core/Src/HW/EXI_DeviceEthernet.cpp b/Source/Core/Core/Src/HW/EXI_DeviceEthernet.cpp index 4197d01350..50c7de4cd2 100644 --- a/Source/Core/Core/Src/HW/EXI_DeviceEthernet.cpp +++ b/Source/Core/Core/Src/HW/EXI_DeviceEthernet.cpp @@ -290,7 +290,7 @@ bool CEXIETHERNET::IsWriteCommand(u32 const data) return IsMXCommand(data) ? !!(data & (1 << 30)) : !!(data & (1 << 14)); } -char const * const CEXIETHERNET::GetRegisterName() const +const char* CEXIETHERNET::GetRegisterName() const { #define STR_RETURN(x) case x: return #x; diff --git a/Source/Core/Core/Src/HW/EXI_DeviceEthernet.h b/Source/Core/Core/Src/HW/EXI_DeviceEthernet.h index 6a3a552f38..0ee352eea5 100644 --- a/Source/Core/Core/Src/HW/EXI_DeviceEthernet.h +++ b/Source/Core/Core/Src/HW/EXI_DeviceEthernet.h @@ -297,7 +297,7 @@ public: bool IsMXCommand(u32 const data); bool IsWriteCommand(u32 const data); - char const * const GetRegisterName() const; + const char* GetRegisterName() const; void MXHardReset(); void MXCommandHandler(u32 data, u32 size); void DirectFIFOWrite(u8 *data, u32 size); diff --git a/Source/Core/Core/Src/HW/EXI_DeviceIPL.h b/Source/Core/Core/Src/HW/EXI_DeviceIPL.h index 4788f21adb..ed5cf0c922 100644 --- a/Source/Core/Core/Src/HW/EXI_DeviceIPL.h +++ b/Source/Core/Core/Src/HW/EXI_DeviceIPL.h @@ -78,7 +78,7 @@ private: virtual void TransferByte(u8 &_uByte); bool IsWriteCommand() const { return !!(m_uAddress & (1 << 31)); } - u32 const CommandRegion() const { return (m_uAddress & ~(1 << 31)) >> 8; } + const u32 CommandRegion() const { return (m_uAddress & ~(1 << 31)) >> 8; } void LoadFileToIPL(std::string filename, u32 offset); }; diff --git a/Source/Core/Core/Src/HW/SI_DeviceGCController.cpp b/Source/Core/Core/Src/HW/SI_DeviceGCController.cpp index 74c020fd39..8c4c562b82 100644 --- a/Source/Core/Core/Src/HW/SI_DeviceGCController.cpp +++ b/Source/Core/Core/Src/HW/SI_DeviceGCController.cpp @@ -132,14 +132,12 @@ bool CSIDevice_GCController::GetData(u32& _Hi, u32& _Low) if(Movie::IsPlayingInput()) { Movie::PlayController(&PadStatus, ISIDevice::m_iDeviceNumber); - if(!Movie::IsUsingWiimote(0)) - Movie::InputUpdate(); + Movie::InputUpdate(); } else if(Movie::IsRecordingInput()) { Movie::RecordInput(&PadStatus, ISIDevice::m_iDeviceNumber); - if(!Movie::IsUsingWiimote(0)) - Movie::InputUpdate(); + Movie::InputUpdate(); } else Movie::CheckPadStatus(&PadStatus, ISIDevice::m_iDeviceNumber); diff --git a/Source/Core/Core/Src/HW/WiimoteReal/WiimoteReal.cpp b/Source/Core/Core/Src/HW/WiimoteReal/WiimoteReal.cpp index 28ce6106c7..204a1fc698 100644 --- a/Source/Core/Core/Src/HW/WiimoteReal/WiimoteReal.cpp +++ b/Source/Core/Core/Src/HW/WiimoteReal/WiimoteReal.cpp @@ -173,7 +173,7 @@ bool Wiimote::Read() return true; } - delete rpt.first; + delete[] rpt.first; return false; } diff --git a/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE.cpp b/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE.cpp index db45802e6f..47737326f4 100644 --- a/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE.cpp +++ b/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE.cpp @@ -387,7 +387,7 @@ void ExecuteCommand(u32 _Address) INFO_LOG(WII_IPC_FILEIO, "IOP: Open File (Device=%s, ID=%08x, Mode=%i)", pDevice->GetDeviceName().c_str(), DeviceID, Mode); - if (Memory::Read_U32(_Address + 4) == DeviceID) + if (Memory::Read_U32(_Address + 4) == (u32)DeviceID) { g_FdMap[DeviceID] = pDevice; } diff --git a/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_FileIO.cpp b/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_FileIO.cpp index 6b490a1922..2061a106e0 100644 --- a/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_FileIO.cpp +++ b/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_FileIO.cpp @@ -196,7 +196,7 @@ bool CWII_IPC_HLE_Device_FileIO::Seek(u32 _CommandAddress) switch (Mode){ case 0: { - if (SeekPosition >=0 && SeekPosition <= fileSize) + if (SeekPosition <= fileSize) { m_SeekPos = SeekPosition; ReturnValue = m_SeekPos; @@ -206,7 +206,7 @@ bool CWII_IPC_HLE_Device_FileIO::Seek(u32 _CommandAddress) case 1: { u32 wantedPos = SeekPosition+m_SeekPos; - if (wantedPos >=0 && wantedPos <= fileSize) + if (wantedPos <= fileSize) { m_SeekPos = wantedPos; ReturnValue = m_SeekPos; @@ -216,7 +216,7 @@ bool CWII_IPC_HLE_Device_FileIO::Seek(u32 _CommandAddress) case 2: { u64 wantedPos = fileSize+m_SeekPos; - if (wantedPos >=0 && wantedPos <= fileSize) + if (wantedPos <= fileSize) { m_SeekPos = wantedPos; ReturnValue = m_SeekPos; diff --git a/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_es.cpp b/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_es.cpp index f409c88c83..5e23819d7b 100644 --- a/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_es.cpp +++ b/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_es.cpp @@ -789,8 +789,8 @@ bool CWII_IPC_HLE_Device_es::IOCtlV(u32 _CommandAddress) { static CWII_IPC_HLE_Device_usb_oh1_57e_305* s_Usb = GetUsbPointer(); bool* wiiMoteConnected = new bool[s_Usb->m_WiiMotes.size()]; - for(unsigned int i = 0; i < s_Usb->m_WiiMotes.size(); - i++) wiiMoteConnected[i] = s_Usb->m_WiiMotes[i].IsConnected(); + for (unsigned int i = 0; i < s_Usb->m_WiiMotes.size(); i++) + wiiMoteConnected[i] = s_Usb->m_WiiMotes[i].IsConnected(); std::string tContentFile(m_ContentFile.c_str()); WII_IPC_HLE_Interface::Reset(true); diff --git a/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_fs.h b/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_fs.h index 1afb01cf8d..c98338e39d 100644 --- a/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_fs.h +++ b/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_fs.h @@ -31,7 +31,7 @@ struct NANDStat }; enum { - FS_RESULT_OK = 0,
+ FS_RESULT_OK = 0, FS_INVALID = -4, FS_DIRFILE_NOT_FOUND = -6, FS_RESULT_FATAL = -101, diff --git a/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp b/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp index af10e98d60..29e3c64a7c 100644 --- a/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp +++ b/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_usb.cpp @@ -116,26 +116,26 @@ void CWII_IPC_HLE_Device_usb_oh1_57e_305::DoState(PointerWrap &p) p.Do(m_EventQueue); m_acl_pool.DoState(p); - for (unsigned int i = 0; i < 4; i++)
- m_WiiMotes[i].DoState(p);
-
- // Reset the connection of real and hybrid wiimotes
- if (p.GetMode() == PointerWrap::MODE_READ && SConfig::GetInstance().m_WiimoteReconnectOnLoad)
- {
- for (unsigned int i = 0; i < 4; i++)
- {
- if (WIIMOTE_SRC_EMU == g_wiimote_sources[i] || WIIMOTE_SRC_NONE == g_wiimote_sources[i])
- continue;
- // TODO: Selectively clear real wiimote messages if possible. Or create a real wiimote channel and reporting mode pre-setup to vacate the need for m_WiimoteReconnectOnLoad.
- m_EventQueue.clear();
- if (!m_WiiMotes[i].IsInactive())
- {
- m_WiiMotes[i].Activate(false);
- m_WiiMotes[i].Activate(true);
- }
- else
- m_WiiMotes[i].Activate(false);
- }
+ for (unsigned int i = 0; i < 4; i++) + m_WiiMotes[i].DoState(p); + + // Reset the connection of real and hybrid wiimotes + if (p.GetMode() == PointerWrap::MODE_READ && SConfig::GetInstance().m_WiimoteReconnectOnLoad) + { + for (unsigned int i = 0; i < 4; i++) + { + if (WIIMOTE_SRC_EMU == g_wiimote_sources[i] || WIIMOTE_SRC_NONE == g_wiimote_sources[i]) + continue; + // TODO: Selectively clear real wiimote messages if possible. Or create a real wiimote channel and reporting mode pre-setup to vacate the need for m_WiimoteReconnectOnLoad. + m_EventQueue.clear(); + if (!m_WiiMotes[i].IsInactive()) + { + m_WiiMotes[i].Activate(false); + m_WiiMotes[i].Activate(true); + } + else + m_WiiMotes[i].Activate(false); + } } } diff --git a/Source/Core/Core/Src/Movie.cpp b/Source/Core/Core/Src/Movie.cpp index 5eb1660d8e..316181d449 100644 --- a/Source/Core/Core/Src/Movie.cpp +++ b/Source/Core/Core/Src/Movie.cpp @@ -36,6 +36,7 @@ #include "HW/DVDInterface.h" #include "../../Common/Src/NandPaths.h" #include "Crypto/md5.h" +#include "scmrev.h" // The chunk to allocate movie data in multiples of. #define DTM_BASE_LENGTH (1024) @@ -72,6 +73,7 @@ std::string author = ""; u64 g_titleID = 0; unsigned char MD5[16]; u8 bongos; +u8 revision[20]; bool g_bRecordingFromSaveState = false; bool g_bPolled = false; @@ -687,6 +689,7 @@ void ReadHeader() g_bClearSave = tmpHeader.bClearSave; bMemcard = tmpHeader.bMemcard; bongos = tmpHeader.bongos; + memcpy(revision, tmpHeader.revision, ARRAYSIZE(revision)); } else { @@ -1132,6 +1135,7 @@ void SaveRecording(const char *filename) strncpy((char *)header.author, author.c_str(),ARRAYSIZE(header.author)); memcpy(header.md5,MD5,16); header.bongos = bongos; + memcpy(header.revision, revision, ARRAYSIZE(header.revision)); // TODO header.uniqueID = 0; @@ -1189,6 +1193,10 @@ void GetSettings() if (!Core::g_CoreStartupParameter.bWii) g_bClearSave = !File::Exists(SConfig::GetInstance().m_strMemoryCardA); bMemcard = SConfig::GetInstance().m_EXIDevice[0] == EXIDEVICE_MEMORYCARD; + + std::stringstream ss; + ss << std::hex << SCM_REV_STR; + ss >> revision; } void CheckMD5() diff --git a/Source/Core/Core/Src/Movie.h b/Source/Core/Core/Src/Movie.h index 2cb4c78e23..79b5e72f29 100644 --- a/Source/Core/Core/Src/Movie.h +++ b/Source/Core/Core/Src/Movie.h @@ -121,7 +121,8 @@ struct DTMHeader { u8 bongos; u8 reserved[15]; // Padding for any new config options u8 discChange[40]; // Name of iso file to switch to, for two disc games. - u8 reserved2[47]; // Make heading 256 bytes, just because we can + u8 revision[20]; // Git hash + u8 reserved2[27]; // Make heading 256 bytes, just because we can }; static_assert(sizeof(DTMHeader) == 256, "DTMHeader should be 256 bytes"); diff --git a/Source/Core/DolphinWX/Src/Frame.cpp b/Source/Core/DolphinWX/Src/Frame.cpp index c9408203ea..750696f6c7 100644 --- a/Source/Core/DolphinWX/Src/Frame.cpp +++ b/Source/Core/DolphinWX/Src/Frame.cpp @@ -365,8 +365,6 @@ CFrame::CFrame(wxFrame* parent, // --------------- // Manager - // wxAUI_MGR_LIVE_RESIZE does not exist in the wxWidgets 2.8.9 that comes with Ubuntu 9.04 - // Could just check for wxWidgets version if it becomes a problem. m_Mgr = new wxAuiManager(this, wxAUI_MGR_DEFAULT | wxAUI_MGR_LIVE_RESIZE); m_Mgr->AddPane(m_Panel, wxAuiPaneInfo() diff --git a/Source/Core/DolphinWX/Src/FrameTools.cpp b/Source/Core/DolphinWX/Src/FrameTools.cpp index 7b595c485e..b79e890f3b 100644 --- a/Source/Core/DolphinWX/Src/FrameTools.cpp +++ b/Source/Core/DolphinWX/Src/FrameTools.cpp @@ -50,6 +50,7 @@ Core::GetWindowHandle(). #include "LogConfigWindow.h" #include "FifoPlayerDlg.h" #include "WxUtils.h" +#include "Host.h" #include "ConfigManager.h" // Core #include "Core.h" @@ -96,6 +97,8 @@ extern "C" { #include "../resources/KDE.h" }; +bool confirmStop = false; + // Create menu items // --------------------- void CFrame::CreateMenu() @@ -1070,6 +1073,9 @@ void CFrame::DoPause() // Stop the emulation void CFrame::DoStop() { + if (confirmStop) + return; + m_bGameLoading = false; if (Core::GetState() != Core::CORE_UNINITIALIZED || m_RenderParent != NULL) @@ -1082,17 +1088,23 @@ void CFrame::DoStop() // Ask for confirmation in case the user accidentally clicked Stop / Escape if (SConfig::GetInstance().m_LocalCoreStartupParameter.bConfirmStop) { - wxMessageDialog *m_StopDlg = new wxMessageDialog( + Core::EState state = Core::GetState(); + confirmStop = true; + Core::SetState(Core::CORE_PAUSE); + wxMessageDialog m_StopDlg( this, _("Do you want to stop the current emulation?"), _("Please confirm..."), wxYES_NO | wxSTAY_ON_TOP | wxICON_EXCLAMATION, wxDefaultPosition); - int Ret = m_StopDlg->ShowModal(); - m_StopDlg->Destroy(); + int Ret = m_StopDlg.ShowModal(); + confirmStop = false; if (Ret != wxID_YES) + { + Core::SetState(state); return; + } } // TODO: Show the author/description dialog here @@ -1457,12 +1469,17 @@ void CFrame::ConnectWiimote(int wm_idx, bool connect) wxString msg(wxString::Format(wxT("Wiimote %i %s"), wm_idx + 1, connect ? wxT("Connected") : wxT("Disconnected"))); Core::DisplayMessage(msg.ToAscii(), 3000); + + // Wait for the wiimote to connect + while (GetUsbPointer()->AccessWiiMote(wm_idx | 0x100)->IsConnected() != connect) + {} + Host_UpdateMainFrame(); } } void CFrame::OnConnectWiimote(wxCommandEvent& event) { - ConnectWiimote(event.GetId() - IDM_CONNECT_WIIMOTE1, event.IsChecked()); + ConnectWiimote(event.GetId() - IDM_CONNECT_WIIMOTE1, !GetUsbPointer()->AccessWiiMote((event.GetId() - IDM_CONNECT_WIIMOTE1) | 0x100)->IsConnected()); } // Toogle fullscreen. In Windows the fullscreen mode is accomplished by expanding the m_Panel to cover diff --git a/Source/Core/DolphinWX/Src/GLInterface/GLX.cpp b/Source/Core/DolphinWX/Src/GLInterface/GLX.cpp index ef60873531..578479f77c 100644 --- a/Source/Core/DolphinWX/Src/GLInterface/GLX.cpp +++ b/Source/Core/DolphinWX/Src/GLInterface/GLX.cpp @@ -60,8 +60,6 @@ bool cInterfaceGLX::Create(void *&window_handle) GLX_GREEN_SIZE, 8, GLX_BLUE_SIZE, 8, GLX_DEPTH_SIZE, 24, - GLX_SAMPLE_BUFFERS_ARB, g_Config.iMultisampleMode != MULTISAMPLE_OFF?1:0, - GLX_SAMPLES_ARB, g_Config.iMultisampleMode != MULTISAMPLE_OFF?1:0, None }; int attrListDefault[] = { diff --git a/Source/Core/DolphinWX/Src/GLInterface/WX.cpp b/Source/Core/DolphinWX/Src/GLInterface/WX.cpp index 0db1f8d632..d5415c8ed9 100644 --- a/Source/Core/DolphinWX/Src/GLInterface/WX.cpp +++ b/Source/Core/DolphinWX/Src/GLInterface/WX.cpp @@ -50,6 +50,7 @@ bool cInterfaceWX::Create(void *&window_handle) GLWin.glCanvas->Show(true); if (GLWin.glCtxt == NULL) // XXX dirty hack GLWin.glCtxt = new wxGLContext(GLWin.glCanvas); + return true; } bool cInterfaceWX::MakeCurrent() diff --git a/Source/Core/DolphinWX/Src/Main.cpp b/Source/Core/DolphinWX/Src/Main.cpp index fc3e2c41a7..338ed59547 100644 --- a/Source/Core/DolphinWX/Src/Main.cpp +++ b/Source/Core/DolphinWX/Src/Main.cpp @@ -45,6 +45,10 @@ #include <wx/intl.h> +#ifdef _WIN32 +#include <shellapi.h> +#endif + // Nvidia drivers >= v302 will check if the application exports a global // variable named NvOptimusEnablement to know if it should run the app in high // performance graphics mode or using the IGP. @@ -264,6 +268,19 @@ bool DolphinApp::OnInit() int w = SConfig::GetInstance().m_LocalCoreStartupParameter.iWidth; int h = SConfig::GetInstance().m_LocalCoreStartupParameter.iHeight; +#ifdef _WIN32 + if (File::Exists("www.dolphin-emulator.com.txt")) + { + File::Delete("www.dolphin-emulator.com.txt"); + MessageBox(NULL, + L"This version of Dolphin was downloaded from a website stealing money from developers of the emulator. Please " + L"download Dolphin from the official website instead: http://dolphin-emu.org/", + L"Unofficial version detected", MB_OK | MB_ICONWARNING); + ShellExecute(NULL, L"open", L"http://dolphin-emu.org/?ref=badver", NULL, NULL, SW_SHOWDEFAULT); + exit(0); + } +#endif + // The following is not needed with X11, where window managers // do not allow windows to be created off the desktop. #ifdef _WIN32 diff --git a/Source/Core/DolphinWX/Src/VideoConfigDiag.cpp b/Source/Core/DolphinWX/Src/VideoConfigDiag.cpp index 552590fd35..389d8f16fe 100644 --- a/Source/Core/DolphinWX/Src/VideoConfigDiag.cpp +++ b/Source/Core/DolphinWX/Src/VideoConfigDiag.cpp @@ -405,6 +405,7 @@ VideoConfigDiag::VideoConfigDiag(wxWindow* parent, const std::string &title, con _3d_vision = CreateCheckBox(page_enh, _("3D Vision"), wxGetTranslation(_3d_vision_desc), vconfig.b3DVision); _3d_vision->Show(vconfig.backend_info.bSupports3DVision); szr_enh->Add(_3d_vision); + szr_enh->Add(CreateCheckBox(page_enh, _("Widescreen Hack"), wxGetTranslation(ws_hack_desc), vconfig.bWidescreenHack)); // TODO: Add anaglyph 3d here wxStaticBoxSizer* const group_enh = new wxStaticBoxSizer(wxVERTICAL, page_enh, _("Enhancements")); @@ -553,8 +554,6 @@ VideoConfigDiag::VideoConfigDiag(wxWindow* parent, const std::string &title, con szr_misc->Add(CreateCheckBox(page_advanced, _("Crop"), wxGetTranslation(crop_desc), vconfig.bCrop)); szr_misc->Add(CreateCheckBox(page_advanced, _("Enable Hotkeys"), wxGetTranslation(hotkeys_desc), vconfig.bOSDHotKey)); - szr_misc->Add(CreateCheckBox(page_advanced, _("Widescreen Hack"), wxGetTranslation(ws_hack_desc), vconfig.bWidescreenHack)); - // Progressive Scan { wxCheckBox* const cb_prog_scan = new wxCheckBox(page_advanced, wxID_ANY, _("Enable Progressive Scan")); diff --git a/Source/Core/VideoCommon/Src/PixelShaderManager.cpp b/Source/Core/VideoCommon/Src/PixelShaderManager.cpp index e56f646c15..78129bf56b 100644 --- a/Source/Core/VideoCommon/Src/PixelShaderManager.cpp +++ b/Source/Core/VideoCommon/Src/PixelShaderManager.cpp @@ -304,8 +304,7 @@ void PixelShaderManager::SetConstants() float GC_ALIGNED16(material[4]); float NormalizationCoef = 1 / 255.0f; - // TODO: This code is wrong. i goes out of range for xfregs.ambColor. - for (int i = 0; i < 4; ++i) + for (int i = 0; i < 2; ++i) { if (nMaterialsChanged & (1 << i)) { @@ -319,6 +318,21 @@ void PixelShaderManager::SetConstants() SetPSConstant4fv(C_PMATERIALS + i, material); } } + + for (int i = 0; i < 2; ++i) + { + if (nMaterialsChanged & (1 << (i + 2))) + { + u32 data = *(xfregs.matColor + i); + + material[0] = ((data >> 24) & 0xFF) * NormalizationCoef; + material[1] = ((data >> 16) & 0xFF) * NormalizationCoef; + material[2] = ((data >> 8) & 0xFF) * NormalizationCoef; + material[3] = ( data & 0xFF) * NormalizationCoef; + + SetPSConstant4fv(C_PMATERIALS + i + 2, material); + } + } nMaterialsChanged = 0; } diff --git a/Source/Core/VideoCommon/Src/VertexShaderManager.cpp b/Source/Core/VideoCommon/Src/VertexShaderManager.cpp index 5beaefb631..0297ae125d 100644 --- a/Source/Core/VideoCommon/Src/VertexShaderManager.cpp +++ b/Source/Core/VideoCommon/Src/VertexShaderManager.cpp @@ -253,8 +253,7 @@ void VertexShaderManager::SetConstants() float GC_ALIGNED16(material[4]); float NormalizationCoef = 1 / 255.0f; - // TODO: This code is wrong. i goes out of range for xfregs.ambColor. - for (int i = 0; i < 4; ++i) + for (int i = 0; i < 2; ++i) { if (nMaterialsChanged & (1 << i)) { @@ -268,6 +267,21 @@ void VertexShaderManager::SetConstants() SetVSConstant4fv(C_MATERIALS + i, material); } } + + for (int i = 0; i < 2; ++i) + { + if (nMaterialsChanged & (1 << (i + 2))) + { + u32 data = *(xfregs.matColor + i); + + material[0] = ((data >> 24) & 0xFF) * NormalizationCoef; + material[1] = ((data >> 16) & 0xFF) * NormalizationCoef; + material[2] = ((data >> 8) & 0xFF) * NormalizationCoef; + material[3] = ( data & 0xFF) * NormalizationCoef; + + SetVSConstant4fv(C_MATERIALS + i + 2, material); + } + } nMaterialsChanged = 0; } diff --git a/Source/Core/VideoCommon/Src/VideoCommon.h b/Source/Core/VideoCommon/Src/VideoCommon.h index 7031a296e2..a1b72c9284 100644 --- a/Source/Core/VideoCommon/Src/VideoCommon.h +++ b/Source/Core/VideoCommon/Src/VideoCommon.h @@ -44,17 +44,14 @@ enum EFB_HEIGHT = 528, }; -enum -{ - // XFB width is decided by EFB copy operation. The VI can do horizontal - // scaling (TODO: emulate). - MAX_XFB_WIDTH = EFB_WIDTH, - - // Although EFB height is 528, 574-line XFB's can be created either with - // vertical scaling by the EFB copy operation or copying to multiple XFB's - // that are next to each other in memory (TODO: handle that situation). - MAX_XFB_HEIGHT = 574 -}; +// XFB width is decided by EFB copy operation. The VI can do horizontal +// scaling (TODO: emulate). +const u32 MAX_XFB_WIDTH = EFB_WIDTH; + +// Although EFB height is 528, 574-line XFB's can be created either with +// vertical scaling by the EFB copy operation or copying to multiple XFB's +// that are next to each other in memory (TODO: handle that situation). +const u32 MAX_XFB_HEIGHT = 574; // Logging // ---------- |
