From 2e783d976902ea1ce8d6558d3c49282dc644301a Mon Sep 17 00:00:00 2001 From: luisr142004 Date: Sat, 5 Jun 2010 01:38:22 +0000 Subject: [PATCH] space changes, merge #defines, language fix, and code reorder/cleanup :P git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@5614 8ced0084-cf51-0410-be5f-012b33b47a6e --- Source/Core/Common/Src/Common.h | 11 +- Source/Core/Common/Src/DynamicLibrary.h | 4 +- Source/Core/Common/Src/Plugin.cpp | 6 +- Source/Core/Common/Src/Plugin.h | 16 +- Source/Core/Core/Src/ConfigManager.cpp | 10 +- Source/Core/Core/Src/Core.cpp | 40 +- Source/Core/Core/Src/CoreParameter.cpp | 16 +- Source/Core/Core/Src/CoreParameter.h | 6 +- .../IPC_HLE/WII_IPC_HLE_Device_sdio_slot0.cpp | 38 +- Source/Core/Core/Src/OnFrame.cpp | 153 ++-- Source/Core/Core/Src/PluginManager.cpp | 28 +- Source/Core/Core/Src/PluginManager.h | 4 +- Source/Core/DolphinWX/Src/ConfigMain.cpp | 675 ++++++++++-------- Source/Core/DolphinWX/Src/ConfigMain.h | 239 ++++--- Source/Core/DolphinWX/Src/Frame.cpp | 43 +- Source/Core/DolphinWX/Src/FrameTools.cpp | 19 +- Source/Core/DolphinWX/Src/Main.cpp | 56 +- .../DirectInput/DirectInputJoystick.cpp | 2 +- Source/Core/InputCommon/Src/SDL_Util.cpp | 18 +- Source/Core/InputCommon/Src/XInput_Util.cpp | 31 +- Source/Core/InputCommon/Src/XInput_Util.h | 1 - Source/Core/VideoCommon/Src/BPStructs.cpp | 129 ++-- .../VideoCommon/Src/VertexShaderManager.cpp | 460 ++++++------ Source/Core/VideoCommon/Src/VideoConfig.cpp | 158 ++-- Source/Core/VideoCommon/Src/VideoConfig.h | 74 +- Source/PluginSpecs/PluginSpecs.h | 19 +- Source/Plugins/Plugin_DSP_HLE/Src/Config.h | 10 +- .../Plugins/Plugin_DSP_HLE/Src/ConfigDlg.cpp | 4 +- Source/Plugins/Plugin_DSP_HLE/Src/ConfigDlg.h | 50 +- Source/Plugins/Plugin_DSP_HLE/Src/main.cpp | 22 +- .../Plugins/Plugin_VideoDX9/Src/D3DBase.cpp | 49 +- .../Plugins/Plugin_VideoDX9/Src/D3DUtil.cpp | 40 +- .../Plugin_VideoDX9/Src/DlgSettings.cpp | 26 +- .../Plugins/Plugin_VideoDX9/Src/EmuWindow.cpp | 2 +- .../Src/FramebufferManager.cpp | 202 +++--- .../Plugin_VideoDX9/Src/FramebufferManager.h | 3 +- Source/Plugins/Plugin_VideoDX9/Src/Render.cpp | 9 +- .../Plugin_VideoDX9/Src/TextureCache.cpp | 229 +++--- .../Plugin_VideoDX9/Src/VertexManager.cpp | 85 +-- .../Plugin_VideoDX9/Src/VertexManager.h | 3 - Source/Plugins/Plugin_VideoOGL/Src/Render.cpp | 485 +++++++------ .../Plugin_Wiimote/Src/wiimote_real.cpp | 188 ++--- 42 files changed, 1870 insertions(+), 1793 deletions(-) diff --git a/Source/Core/Common/Src/Common.h b/Source/Core/Common/Src/Common.h index aa2f01b662..80bd3d75e8 100644 --- a/Source/Core/Common/Src/Common.h +++ b/Source/Core/Common/Src/Common.h @@ -27,12 +27,7 @@ // Force enable logging in the right modes. For some reason, something had changed // so that debugfast no longer logged. -#ifdef _DEBUG -#undef LOGGING -#define LOGGING 1 -#endif - -#ifdef DEBUGFAST +#if defined(_DEBUG) || defined(DEBUGFAST) #undef LOGGING #define LOGGING 1 #endif @@ -137,7 +132,7 @@ // A macro to disallow the copy constructor and operator= functions // This should be used in the private: declarations for a class #define DISALLOW_COPY_AND_ASSIGN(TypeName) \ - TypeName(const TypeName&); \ - void operator=(const TypeName&) + TypeName(const TypeName&); \ + void operator=(const TypeName&) #endif // _COMMON_H_ diff --git a/Source/Core/Common/Src/DynamicLibrary.h b/Source/Core/Common/Src/DynamicLibrary.h index 11ea225340..b48783ce37 100644 --- a/Source/Core/Common/Src/DynamicLibrary.h +++ b/Source/Core/Common/Src/DynamicLibrary.h @@ -38,10 +38,10 @@ public: int Unload(); // Gets a pointer to the function symbol of funcname by getting it from the - // share object + // shared object void *Get(const char *funcname) const; - // Returns true is the library is loaded + // Returns true if the library is loaded bool IsLoaded() const { return library != 0; } private: diff --git a/Source/Core/Common/Src/Plugin.cpp b/Source/Core/Common/Src/Plugin.cpp index 8cadbdbad6..b4e3a4262a 100644 --- a/Source/Core/Common/Src/Plugin.cpp +++ b/Source/Core/Common/Src/Plugin.cpp @@ -43,7 +43,7 @@ CPlugin::CPlugin(const char* _szName) : valid(false) m_EmuStateChange = NULL; if (m_hInstLib.Load(_szName)) - { + { m_GetDllInfo = reinterpret_cast (m_hInstLib.Get("GetDllInfo")); m_DllConfig = reinterpret_cast @@ -61,7 +61,7 @@ CPlugin::CPlugin(const char* _szName) : valid(false) m_EmuStateChange = reinterpret_cast (m_hInstLib.Get("EmuStateChange")); - // Check if the plugin has all the functions it shold have + // Check if the plugin has all the functions it should have if (m_GetDllInfo != 0 && m_DllConfig != 0 && m_DllDebugger != 0 && @@ -88,7 +88,7 @@ bool CPlugin::GetInfo(PLUGIN_INFO& _pluginInfo) if (m_GetDllInfo != NULL) { m_GetDllInfo(&_pluginInfo); return true; - } + } return false; } diff --git a/Source/Core/Common/Src/Plugin.h b/Source/Core/Common/Src/Plugin.h index 5d91bb0c49..97c8b981ad 100644 --- a/Source/Core/Common/Src/Plugin.h +++ b/Source/Core/Common/Src/Plugin.h @@ -24,14 +24,14 @@ namespace Common { - typedef void (__cdecl * TGetDllInfo)(PLUGIN_INFO*); - typedef void (__cdecl * TDllConfig)(HWND); - typedef void (__cdecl * TDllDebugger)(HWND, bool); - typedef void (__cdecl * TSetDllGlobals)(PLUGIN_GLOBALS*); - typedef void (__cdecl * TInitialize)(void *); - typedef void (__cdecl * TShutdown)(); - typedef void (__cdecl * TDoState)(unsigned char**, int); - typedef void (__cdecl * TEmuStateChange)(PLUGIN_EMUSTATE); + typedef void (__cdecl * TGetDllInfo)(PLUGIN_INFO*); + typedef void (__cdecl * TDllConfig)(HWND); + typedef void (__cdecl * TDllDebugger)(HWND, bool); + typedef void (__cdecl * TSetDllGlobals)(PLUGIN_GLOBALS*); + typedef void (__cdecl * TInitialize)(void *); + typedef void (__cdecl * TShutdown)(); + typedef void (__cdecl * TDoState)(unsigned char**, int); + typedef void (__cdecl * TEmuStateChange)(PLUGIN_EMUSTATE); class CPlugin { diff --git a/Source/Core/Core/Src/ConfigManager.cpp b/Source/Core/Core/Src/ConfigManager.cpp index 8f88b00545..04d224e44f 100644 --- a/Source/Core/Core/Src/ConfigManager.cpp +++ b/Source/Core/Core/Src/ConfigManager.cpp @@ -85,7 +85,7 @@ void SConfig::SaveSettings() ini.Set("General", tmp, m_ISOFolder[i]); } - ini.Set("General", "RecersiveGCMPaths", m_RecursiveISOFolder); + ini.Set("General", "RecursiveGCMPaths", m_RecursiveISOFolder); // Interface ini.Set("Interface", "ConfirmStop", m_LocalCoreStartupParameter.bConfirmStop); @@ -209,7 +209,7 @@ void SConfig::LoadSettings() } } - ini.Get("General", "RecersiveGCMPaths", &m_RecursiveISOFolder, false); + ini.Get("General", "RecursiveGCMPaths", &m_RecursiveISOFolder, false); } { @@ -287,13 +287,13 @@ void SConfig::LoadSettings() ini.Get("Core", sidevicenum, (u32*)&m_SIDevice[i], i==0 ? SI_GC_CONTROLLER:SI_NONE); } - ini.Get("Core", "WiiSDCard", &m_WiiSDCard, false); - ini.Get("Core", "WiiKeyboard", &m_WiiKeyboard, false); + ini.Get("Core", "WiiSDCard", &m_WiiSDCard, false); + ini.Get("Core", "WiiKeyboard", &m_WiiKeyboard, false); ini.Get("Core", "RunCompareServer", &m_LocalCoreStartupParameter.bRunCompareServer, false); ini.Get("Core", "RunCompareClient", &m_LocalCoreStartupParameter.bRunCompareClient, false); ini.Get("Core", "TLBHack", &m_LocalCoreStartupParameter.iTLBHack, 0); ini.Get("Core", "FrameLimit", &m_Framelimit, 1); // auto frame limit by default - ini.Get("Core", "UseFPS", &b_UseFPS, false); // use vps as default + ini.Get("Core", "UseFPS", &b_UseFPS, false); // use vps as default // Plugins ini.Get("Core", "GFXPlugin", &m_LocalCoreStartupParameter.m_strVideoPlugin, m_DefaultGFXPlugin.c_str()); diff --git a/Source/Core/Core/Src/Core.cpp b/Source/Core/Core/Src/Core.cpp index 1fb2c4e1be..1a7b10a213 100644 --- a/Source/Core/Core/Src/Core.cpp +++ b/Source/Core/Core/Src/Core.cpp @@ -130,13 +130,13 @@ bool PanicAlertToVideo(const char* text, bool yes_no) void DisplayMessage(const std::string &message, int time_in_ms) { CPluginManager::GetInstance().GetVideo()->Video_AddMessage(message.c_str(), - time_in_ms); + time_in_ms); } void DisplayMessage(const char *message, int time_in_ms) { CPluginManager::GetInstance().GetVideo()->Video_AddMessage(message, - time_in_ms); + time_in_ms); } void Callback_DebuggerBreak() @@ -325,25 +325,25 @@ THREAD_RETURN EmuThread(void *pArg) // Load the VideoPlugin SVideoInitialize VideoInitialize; - VideoInitialize.pGetMemoryPointer = Memory::GetPointer; - VideoInitialize.pSetInterrupt = ProcessorInterface::SetInterrupt; - VideoInitialize.pRegisterEvent = CoreTiming::RegisterEvent; - VideoInitialize.pScheduleEvent_Threadsafe = CoreTiming::ScheduleEvent_Threadsafe; + VideoInitialize.pGetMemoryPointer = Memory::GetPointer; + VideoInitialize.pSetInterrupt = ProcessorInterface::SetInterrupt; + VideoInitialize.pRegisterEvent = CoreTiming::RegisterEvent; + VideoInitialize.pScheduleEvent_Threadsafe = CoreTiming::ScheduleEvent_Threadsafe; // This is first the m_Panel handle, then it is updated to have the new window handle - VideoInitialize.pWindowHandle = _CoreParameter.hMainWindow; - VideoInitialize.pLog = Callback_VideoLog; - VideoInitialize.pSysMessage = Host_SysMessage; - VideoInitialize.pRequestWindowSize = Callback_VideoRequestWindowSize; - VideoInitialize.pCopiedToXFB = Callback_VideoCopiedToXFB; - VideoInitialize.pPeekMessages = NULL; - VideoInitialize.pUpdateFPSDisplay = NULL; - VideoInitialize.pMemoryBase = Memory::base; - VideoInitialize.pCoreMessage = Callback_CoreMessage; - VideoInitialize.bWii = _CoreParameter.bWii; + VideoInitialize.pWindowHandle = _CoreParameter.hMainWindow; + VideoInitialize.pLog = Callback_VideoLog; + VideoInitialize.pSysMessage = Host_SysMessage; + VideoInitialize.pRequestWindowSize = Callback_VideoRequestWindowSize; + VideoInitialize.pCopiedToXFB = Callback_VideoCopiedToXFB; + VideoInitialize.pPeekMessages = NULL; + VideoInitialize.pUpdateFPSDisplay = NULL; + VideoInitialize.pMemoryBase = Memory::base; + VideoInitialize.pCoreMessage = Callback_CoreMessage; + VideoInitialize.bWii = _CoreParameter.bWii; VideoInitialize.bOnThread = _CoreParameter.bCPUThread; - VideoInitialize.Fifo_CPUBase = &ProcessorInterface::Fifo_CPUBase; - VideoInitialize.Fifo_CPUEnd = &ProcessorInterface::Fifo_CPUEnd; - VideoInitialize.Fifo_CPUWritePointer = &ProcessorInterface::Fifo_CPUWritePointer; + VideoInitialize.Fifo_CPUBase = &ProcessorInterface::Fifo_CPUBase; + VideoInitialize.Fifo_CPUEnd = &ProcessorInterface::Fifo_CPUEnd; + VideoInitialize.Fifo_CPUWritePointer = &ProcessorInterface::Fifo_CPUWritePointer; bool aspectWide = _CoreParameter.bWii; if (aspectWide) { @@ -351,7 +351,7 @@ THREAD_RETURN EmuThread(void *pArg) gameIni.Load(_CoreParameter.m_strGameIni.c_str()); gameIni.Get("Wii", "Widescreen", &aspectWide, !!SConfig::GetInstance().m_SYSCONF->GetData("IPL.AR")); } - VideoInitialize.bAutoAspectIs16_9 = aspectWide; + VideoInitialize.bAutoAspectIs16_9 = aspectWide; Plugins.GetVideo()->Initialize(&VideoInitialize); // Call the dll diff --git a/Source/Core/Core/Src/CoreParameter.cpp b/Source/Core/Core/Src/CoreParameter.cpp index 7635becd41..11953ce43f 100644 --- a/Source/Core/Core/Src/CoreParameter.cpp +++ b/Source/Core/Core/Src/CoreParameter.cpp @@ -110,7 +110,7 @@ void SCoreStartupParameter::LoadDefaults() bool SCoreStartupParameter::AutoSetup(EBootBS2 _BootBS2) { std::string Region(EUR_DIR); - + switch (_BootBS2) { case BOOT_DEFAULT: @@ -123,7 +123,7 @@ bool SCoreStartupParameter::AutoSetup(EBootBS2 _BootBS2) PanicAlert("The file you specified (%s) does not exists", m_strFilename.c_str()); return false; } - + std::string Extension; SplitPath(m_strFilename, NULL, NULL, &Extension); if (!strcasecmp(Extension.c_str(), ".gcm") || @@ -143,7 +143,7 @@ bool SCoreStartupParameter::AutoSetup(EBootBS2 _BootBS2) } m_strName = pVolume->GetName(); m_strUniqueID = pVolume->GetUniqueID(); - + // Check if we have a Wii disc bWii = DiscIO::IsVolumeWiiDisc(pVolume); switch (pVolume->GetCountry()) @@ -152,7 +152,7 @@ bool SCoreStartupParameter::AutoSetup(EBootBS2 _BootBS2) bNTSC = true; Region = USA_DIR; break; - + case DiscIO::IVolume::COUNTRY_TAIWAN: case DiscIO::IVolume::COUNTRY_KOREA: // TODO: Should these have their own Region Dir? @@ -160,14 +160,14 @@ bool SCoreStartupParameter::AutoSetup(EBootBS2 _BootBS2) bNTSC = true; Region = JAP_DIR; break; - + case DiscIO::IVolume::COUNTRY_EUROPE: case DiscIO::IVolume::COUNTRY_FRANCE: case DiscIO::IVolume::COUNTRY_ITALY: bNTSC = false; Region = EUR_DIR; break; - + default: if (PanicYesNo("Your GCM/ISO file seems to be invalid (invalid country)." "\nContinue with PAL region?")) @@ -177,7 +177,7 @@ bool SCoreStartupParameter::AutoSetup(EBootBS2 _BootBS2) break; }else return false; } - + delete pVolume; } else if (!strcasecmp(Extension.c_str(), ".elf")) @@ -194,7 +194,7 @@ bool SCoreStartupParameter::AutoSetup(EBootBS2 _BootBS2) m_BootType = BOOT_DOL; bNTSC = true; } - else if (DiscIO::CNANDContentManager::Access().GetNANDLoader(m_strFilename).IsValid()) + else if (DiscIO::CNANDContentManager::Access().GetNANDLoader(m_strFilename).IsValid()) { const DiscIO::IVolume* pVolume = DiscIO::CreateVolumeFromFilename(m_strFilename.c_str()); const DiscIO::INANDContentLoader& ContentLoader = DiscIO::CNANDContentManager::Access().GetNANDLoader(m_strFilename); diff --git a/Source/Core/Core/Src/CoreParameter.h b/Source/Core/Core/Src/CoreParameter.h index 0a6c073877..e769b682e6 100644 --- a/Source/Core/Core/Src/CoreParameter.h +++ b/Source/Core/Core/Src/CoreParameter.h @@ -37,7 +37,7 @@ enum Hotkey { struct SCoreStartupParameter { - void * hInstance; // HINSTANCE but we don't want to include + void* hInstance; // HINSTANCE but we don't want to include // Windows/GUI related void* hMainWindow; @@ -93,12 +93,12 @@ struct SCoreStartupParameter int iHotkeyModifier[NUM_HOTKEYS]; // Display settings - bool bFullscreen, bRenderToMain; std::string strFullscreenResolution; int iRenderWindowXPos, iRenderWindowYPos; int iRenderWindowWidth, iRenderWindowHeight; + bool bFullscreen, bRenderToMain; - int iTheme; + int iTheme; int iPosX, iPosY, iWidth, iHeight; enum EBootBS2 diff --git a/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_sdio_slot0.cpp b/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_sdio_slot0.cpp index 75f2d3e57f..5179d977a8 100644 --- a/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_sdio_slot0.cpp +++ b/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_Device_sdio_slot0.cpp @@ -27,7 +27,7 @@ #include "../Core.h" CWII_IPC_HLE_Device_sdio_slot0::CWII_IPC_HLE_Device_sdio_slot0(u32 _DeviceID, const std::string& _rDeviceName) - : IWII_IPC_HLE_Device(_DeviceID, _rDeviceName) + : IWII_IPC_HLE_Device(_DeviceID, _rDeviceName) , m_Status(CARD_NOT_EXIST) , m_BlockLength(0) , m_BusWidth(0) @@ -64,9 +64,9 @@ bool CWII_IPC_HLE_Device_sdio_slot0::Open(u32 _CommandAddress, u32 _Mode) } } - Memory::Write_U32(GetDeviceID(), _CommandAddress + 0x4); + Memory::Write_U32(GetDeviceID(), _CommandAddress + 0x4); m_Active = true; - return true; + return true; } bool CWII_IPC_HLE_Device_sdio_slot0::Close(u32 _CommandAddress, bool _bForce) @@ -82,9 +82,9 @@ bool CWII_IPC_HLE_Device_sdio_slot0::Close(u32 _CommandAddress, bool _bForce) m_BusWidth = 0; if (!_bForce) - Memory::Write_U32(0, _CommandAddress + 0x4); + Memory::Write_U32(0, _CommandAddress + 0x4); m_Active = false; - return true; + return true; } // The front SD slot @@ -94,8 +94,8 @@ bool CWII_IPC_HLE_Device_sdio_slot0::IOCtl(u32 _CommandAddress) u32 BufferIn = Memory::Read_U32(_CommandAddress + 0x10); u32 BufferInSize = Memory::Read_U32(_CommandAddress + 0x14); - u32 BufferOut = Memory::Read_U32(_CommandAddress + 0x18); - u32 BufferOutSize = Memory::Read_U32(_CommandAddress + 0x1C); + u32 BufferOut = Memory::Read_U32(_CommandAddress + 0x18); + u32 BufferOutSize = Memory::Read_U32(_CommandAddress + 0x1C); // As a safety precaution we fill the out buffer with zeros to avoid // returning nonsense values @@ -163,7 +163,7 @@ bool CWII_IPC_HLE_Device_sdio_slot0::IOCtl(u32 _CommandAddress) { INFO_LOG(WII_IPC_SD, "IOCTL_SENDCMD 0x%08x", Memory::Read_U32(BufferIn)); } - ReturnValue = ExecuteCommand(BufferIn, BufferInSize, 0, 0, BufferOut, BufferOutSize); + ReturnValue = ExecuteCommand(BufferIn, BufferInSize, 0, 0, BufferOut, BufferOutSize); break; case IOCTL_GETSTATUS: @@ -197,7 +197,7 @@ bool CWII_IPC_HLE_Device_sdio_slot0::IOCtl(u32 _CommandAddress) return true; } -bool CWII_IPC_HLE_Device_sdio_slot0::IOCtlV(u32 _CommandAddress) +bool CWII_IPC_HLE_Device_sdio_slot0::IOCtlV(u32 _CommandAddress) { // PPC sending commands @@ -212,7 +212,7 @@ bool CWII_IPC_HLE_Device_sdio_slot0::IOCtlV(u32 _CommandAddress) } u32 ReturnValue = 0; - switch(CommandBuffer.Parameter) { + switch(CommandBuffer.Parameter) { case IOCTLV_SENDCMD: INFO_LOG(WII_IPC_SD, "IOCTLV_SENDCMD 0x%08x", Memory::Read_U32(CommandBuffer.InBuffer[0].m_Address)); ReturnValue = ExecuteCommand( @@ -230,7 +230,7 @@ bool CWII_IPC_HLE_Device_sdio_slot0::IOCtlV(u32 _CommandAddress) Memory::Write_U32(ReturnValue, _CommandAddress + 0x4); - return true; + return true; } u32 CWII_IPC_HLE_Device_sdio_slot0::ExecuteCommand(u32 _BufferIn, u32 _BufferInSize, @@ -251,13 +251,13 @@ u32 CWII_IPC_HLE_Device_sdio_slot0::ExecuteCommand(u32 _BufferIn, u32 _BufferInS u32 pad0; } req; - req.command = Memory::Read_U32(_BufferIn + 0); - req.type = Memory::Read_U32(_BufferIn + 4); - req.resp = Memory::Read_U32(_BufferIn + 8); - req.arg = Memory::Read_U32(_BufferIn + 12); - req.blocks = Memory::Read_U32(_BufferIn + 16); - req.bsize = Memory::Read_U32(_BufferIn + 20); - req.addr = Memory::Read_U32(_BufferIn + 24); + req.command = Memory::Read_U32(_BufferIn + 0); + req.type = Memory::Read_U32(_BufferIn + 4); + req.resp = Memory::Read_U32(_BufferIn + 8); + req.arg = Memory::Read_U32(_BufferIn + 12); + req.blocks = Memory::Read_U32(_BufferIn + 16); + req.bsize = Memory::Read_U32(_BufferIn + 20); + req.addr = Memory::Read_U32(_BufferIn + 24); req.isDMA = Memory::Read_U32(_BufferIn + 28); req.pad0 = Memory::Read_U32(_BufferIn + 32); @@ -431,5 +431,5 @@ u32 CWII_IPC_HLE_Device_sdio_slot0::ExecuteCommand(u32 _BufferIn, u32 _BufferInS break; } - return rwFail; + return rwFail; } diff --git a/Source/Core/Core/Src/OnFrame.cpp b/Source/Core/Core/Src/OnFrame.cpp index 8c9a38b251..c81803ba03 100644 --- a/Source/Core/Core/Src/OnFrame.cpp +++ b/Source/Core/Core/Src/OnFrame.cpp @@ -46,15 +46,16 @@ bool g_bPolled = false; int g_numRerecords = 0; std::string g_recordFile; -void FrameUpdate() { +void FrameUpdate() +{ g_frameCounter++; if(!g_bPolled) g_lagCounter++; - + if (g_bFrameStep) Core::SetState(Core::CORE_PAUSE); - + // ("framestop") the only purpose of this is to cause interpreter/jit Run() to return temporarily. // after that we set it back to CPU_RUNNING and continue as normal. if (g_bFrameStop) @@ -62,7 +63,7 @@ void FrameUpdate() { if(g_framesToSkip) FrameSkipping(); - + if (g_bAutoFire) g_bFirstKey = !g_bFirstKey; @@ -70,35 +71,38 @@ void FrameUpdate() { if(IsRecordingInput()) fwrite(g_padStates, sizeof(ControllerState), g_numPads, g_recordfd); else if(IsPlayingInput()) { - fread(g_padStates, sizeof(ControllerState), g_numPads, g_recordfd); + fread(g_padStates, sizeof(ControllerState), g_numPads, g_recordfd); // End of recording if(feof(g_recordfd)) EndPlayInput(); } - + g_bPolled = false; } -void SetFrameSkipping(unsigned int framesToSkip) { +void SetFrameSkipping(unsigned int framesToSkip) +{ cs_frameSkip.Enter(); - + g_framesToSkip = framesToSkip; g_frameSkipCounter = 0; - + // Don't forget to re-enable rendering in case it wasn't... // as this won't be changed anymore when frameskip is turned off if (framesToSkip == 0) CPluginManager::GetInstance().GetVideo()->Video_SetRendering(true); - + cs_frameSkip.Leave(); } -int FrameSkippingFactor() { +int FrameSkippingFactor() +{ return g_framesToSkip; } -void SetPolledDevice() { +void SetPolledDevice() +{ g_bPolled = true; } @@ -119,15 +123,17 @@ void SetAutoFire(bool bEnabled, u32 keyOne, u32 keyTwo) g_autoSecondKey = keyTwo; } else g_autoFirstKey = g_autoSecondKey = 0; - + g_bFirstKey = true; } -bool IsAutoFiring() { +bool IsAutoFiring() +{ return g_bAutoFire; } -void SetFrameStepping(bool bEnabled) { +void SetFrameStepping(bool bEnabled) +{ g_bFrameStep = bEnabled; } void SetFrameStopping(bool bEnabled) { @@ -138,18 +144,18 @@ void ModifyController(SPADStatus *PadStatus, int controllerID) { if(controllerID < 0) return; - + u32 keyToPress = (g_bFirstKey) ? g_autoFirstKey : g_autoSecondKey; if (!keyToPress) return; PadStatus->button |= keyToPress; - + switch(keyToPress) { default: return; - + case PAD_BUTTON_A: PadStatus->analogA = 255; break; @@ -164,7 +170,6 @@ void ModifyController(SPADStatus *PadStatus, int controllerID) PadStatus->triggerRight = 255; break; } - } void FrameSkipping() @@ -174,9 +179,9 @@ void FrameSkipping() g_frameSkipCounter++; if (g_frameSkipCounter > g_framesToSkip || Core::report_slow(g_frameSkipCounter) == false) g_frameSkipCounter = 0; - + CPluginManager::GetInstance().GetVideo()->Video_SetRendering(!g_frameSkipCounter); - + cs_frameSkip.Leave(); } @@ -195,30 +200,30 @@ bool BeginRecordingInput(const char *filename, int controllers) { if(!filename || g_playMode != MODE_NONE || g_recordfd) return false; - + if(File::Exists(filename)) File::Delete(filename); - + g_recordfd = fopen(filename, "wb"); if(!g_recordfd) { PanicAlert("Error opening file %s for recording", filename); return false; } - + // Write initial empty header DTMHeader dummy; fwrite(&dummy, sizeof(DTMHeader), 1, g_recordfd); - + g_numPads = controllers; g_padStates = new ControllerState[controllers]; - + g_frameCounter = 0; g_lagCounter = 0; - + g_playMode = MODE_RECORDING; - + g_recordFile = filename; - + return true; } @@ -229,31 +234,31 @@ void EndRecordingInput() // Create the real header now and write it DTMHeader header; memset(&header, 0, sizeof(DTMHeader)); - + header.filetype[0] = 'D'; header.filetype[1] = 'T'; header.filetype[2] = 'M'; header.filetype[3] = 0x1A; strncpy((char *)header.gameID, Core::g_CoreStartupParameter.GetUniqueID().c_str(), 6); header.bWii = Core::g_CoreStartupParameter.bWii; - header.numControllers = g_numPads; - - header.bFromSaveState = false; // TODO: add the case where it's true + header.numControllers = g_numPads; + + header.bFromSaveState = false; // TODO: add the case where it's true header.frameCount = g_frameCounter; header.lagCount = g_lagCounter; - - // TODO - header.uniqueID = 0; - header.numRerecords = 0; - // header.author; - // header.videoPlugin; - // header.audioPlugin; - // header.padPlugin; - + + // TODO + header.uniqueID = 0; + header.numRerecords = 0; + // header.author; + // header.videoPlugin; + // header.audioPlugin; + // header.padPlugin; + fwrite(&header, sizeof(DTMHeader), 1, g_recordfd); - + fclose(g_recordfd); g_recordfd = NULL; - + delete[] g_padStates; - + g_playMode = MODE_NONE; } @@ -262,27 +267,27 @@ void RecordInput(SPADStatus *PadStatus, int controllerID) if(!IsRecordingInput() || controllerID >= g_numPads || controllerID < 0) return; - g_padStates[controllerID].A = ((PadStatus->button & PAD_BUTTON_A) != 0); - g_padStates[controllerID].B = ((PadStatus->button & PAD_BUTTON_B) != 0); - g_padStates[controllerID].X = ((PadStatus->button & PAD_BUTTON_X) != 0); - g_padStates[controllerID].Y = ((PadStatus->button & PAD_BUTTON_Y) != 0); - g_padStates[controllerID].Z = ((PadStatus->button & PAD_TRIGGER_Z) != 0); + g_padStates[controllerID].A = ((PadStatus->button & PAD_BUTTON_A) != 0); + g_padStates[controllerID].B = ((PadStatus->button & PAD_BUTTON_B) != 0); + g_padStates[controllerID].X = ((PadStatus->button & PAD_BUTTON_X) != 0); + g_padStates[controllerID].Y = ((PadStatus->button & PAD_BUTTON_Y) != 0); + g_padStates[controllerID].Z = ((PadStatus->button & PAD_TRIGGER_Z) != 0); g_padStates[controllerID].Start = ((PadStatus->button & PAD_BUTTON_START) != 0); - - g_padStates[controllerID].DPadUp = ((PadStatus->button & PAD_BUTTON_UP) != 0); + + g_padStates[controllerID].DPadUp = ((PadStatus->button & PAD_BUTTON_UP) != 0); g_padStates[controllerID].DPadDown = ((PadStatus->button & PAD_BUTTON_DOWN) != 0); g_padStates[controllerID].DPadLeft = ((PadStatus->button & PAD_BUTTON_LEFT) != 0); g_padStates[controllerID].DPadRight = ((PadStatus->button & PAD_BUTTON_RIGHT) != 0); - + g_padStates[controllerID].L = PadStatus->triggerLeft; g_padStates[controllerID].R = PadStatus->triggerRight; - + g_padStates[controllerID].AnalogStickX = PadStatus->stickX; g_padStates[controllerID].AnalogStickY = PadStatus->stickY; - + g_padStates[controllerID].CStickX = PadStatus->substickX; g_padStates[controllerID].CStickY = PadStatus->substickY; - + PlayController(PadStatus, controllerID); } @@ -290,23 +295,23 @@ bool PlayInput(const char *filename) { if(!filename || g_playMode != MODE_NONE || g_recordfd) return false; - + if(!File::Exists(filename)) return false; - + DTMHeader header; - + g_recordfd = fopen(filename, "rb"); if(!g_recordfd) return false; - + fread(&header, sizeof(DTMHeader), 1, g_recordfd); - + if(header.filetype[0] != 'D' || header.filetype[1] != 'T' || header.filetype[2] != 'M' || header.filetype[3] != 0x1A) { PanicAlert("Invalid recording file"); goto cleanup; } - + // Load savestate (and skip to frame data) if(header.bFromSaveState) { // TODO @@ -318,22 +323,22 @@ bool PlayInput(const char *filename) PanicAlert("Recording Unique ID Verification Failed"); goto cleanup; } - + if(strncmp((char *)header.gameID, Core::g_CoreStartupParameter.GetUniqueID().c_str(), 6)) { PanicAlert("The recorded game (%s) is not the same as the selected game (%s)", header.gameID, Core::g_CoreStartupParameter.GetUniqueID().c_str()); goto cleanup; } */ - + g_numPads = header.numControllers; g_padStates = new ControllerState[g_numPads]; g_numRerecords = header.numRerecords; g_recordFile = filename; - + g_playMode = MODE_PLAYING; - + return true; - + cleanup: fclose(g_recordfd); g_recordfd = NULL; @@ -344,11 +349,11 @@ void PlayController(SPADStatus *PadStatus, int controllerID) { if(!IsPlayingInput() || controllerID >= g_numPads || controllerID < 0) return; - + memset(PadStatus, 0, sizeof(SPADStatus)); - + PadStatus->button |= PAD_USE_ORIGIN; - + if(g_padStates[controllerID].A) { PadStatus->button |= PAD_BUTTON_A; PadStatus->analogA = 0xFF; @@ -365,7 +370,7 @@ void PlayController(SPADStatus *PadStatus, int controllerID) PadStatus->button |= PAD_TRIGGER_Z; if(g_padStates[controllerID].Start) PadStatus->button |= PAD_BUTTON_START; - + if(g_padStates[controllerID].DPadUp) PadStatus->button |= PAD_BUTTON_UP; if(g_padStates[controllerID].DPadDown) @@ -374,17 +379,17 @@ void PlayController(SPADStatus *PadStatus, int controllerID) PadStatus->button |= PAD_BUTTON_LEFT; if(g_padStates[controllerID].DPadRight) PadStatus->button |= PAD_BUTTON_RIGHT; - + PadStatus->triggerLeft = g_padStates[controllerID].L; if(PadStatus->triggerLeft > 230) PadStatus->button |= PAD_TRIGGER_L; PadStatus->triggerRight = g_padStates[controllerID].R; if(PadStatus->triggerRight > 230) PadStatus->button |= PAD_TRIGGER_R; - + PadStatus->stickX = g_padStates[controllerID].AnalogStickX; PadStatus->stickY = g_padStates[controllerID].AnalogStickY; - + PadStatus->substickX = g_padStates[controllerID].CStickX; PadStatus->substickY = g_padStates[controllerID].CStickY; } diff --git a/Source/Core/Core/Src/PluginManager.cpp b/Source/Core/Core/Src/PluginManager.cpp index 43eb23831e..32d7ed8cf0 100644 --- a/Source/Core/Core/Src/PluginManager.cpp +++ b/Source/Core/Core/Src/PluginManager.cpp @@ -108,8 +108,6 @@ CPluginManager::~CPluginManager() } - - // Init and Shutdown Plugins // ------------ // Function: Point the m_pad[] and other variables to a certain plugin @@ -122,10 +120,6 @@ bool CPluginManager::InitPlugins() } strcpy(m_PluginGlobals->game_ini, SConfig::GetInstance().m_LocalCoreStartupParameter.m_strGameIni.c_str()); strcpy(m_PluginGlobals->unique_id, SConfig::GetInstance().m_LocalCoreStartupParameter.GetUniqueID().c_str()); - if (!GetDSP()) { - PanicAlert("Can't init DSP Plugin"); - return false; - } INFO_LOG(CONSOLE, "Before GetVideo\n"); if (!GetVideo()) { @@ -134,6 +128,10 @@ bool CPluginManager::InitPlugins() } INFO_LOG(CONSOLE, "After GetVideo\n"); + if (!GetDSP()) { + PanicAlert("Can't init DSP Plugin"); + return false; + } // Check if we get at least one pad or wiimote bool pad = false; bool wiimote = false; @@ -291,7 +289,7 @@ void *CPluginManager::LoadPlugin(const char *_rFilename) return NULL; } - PLUGIN_TYPE type = info->GetPluginInfo().Type; + PLUGIN_TYPE type = info->GetPluginInfo().Type; Common::CPlugin *plugin = NULL; switch (type) @@ -379,8 +377,6 @@ void CPluginManager::ScanForPlugins() } - - /* Create or return the already created plugin pointers. This will be called often for the Pad and Wiimote from the SI_.cpp files. And often for the DSP from the DSP files. @@ -442,7 +438,7 @@ Common::PluginVideo *CPluginManager::GetVideo() // Check if the video plugin has been changed if (m_video->GetFilename() == m_params->m_strVideoPlugin) return m_video; - // Then free the current video plugin, + // Then free the current video plugin else FreeVideo(); } @@ -475,7 +471,7 @@ void CPluginManager::FreePad(u32 Pad) if (Pad < MAXPADS) { delete m_pad[Pad]; - m_pad[Pad] = NULL; + m_pad[Pad] = NULL; } } @@ -484,7 +480,7 @@ void CPluginManager::FreeWiimote(u32 Wiimote) if (Wiimote < MAXWIIMOTES) { delete m_wiimote[Wiimote]; - m_wiimote[Wiimote] = NULL; + m_wiimote[Wiimote] = NULL; } } @@ -494,7 +490,7 @@ void CPluginManager::EmuStateChange(PLUGIN_EMUSTATE newState) GetDSP()->EmuStateChange(newState); //TODO: OpenConfig below only uses GetXxx(0) aswell // Would we need to call all plugins? - // If yes, how would one check if the plugin was not + // If yes, how would one check if the plugin was not // just created by GetXxx(idx) because there was none? GetPad(0)->EmuStateChange(newState); GetWiimote(0)->EmuStateChange(newState); @@ -528,7 +524,7 @@ void CPluginManager::OpenConfig(void* _Parent, const char *_rFilename, PLUGIN_TY GetWiimote(0)->Config((HWND)_Parent); break; default: - PanicAlert("Type %d config not supported in plugin %s", Type, _rFilename); + PanicAlert("Type %d config not supported in plugin %s", Type, _rFilename); } } @@ -541,7 +537,7 @@ void CPluginManager::OpenDebug(void* _Parent, const char *_rFilename, PLUGIN_TYP return; } - switch(Type) + switch(Type) { case PLUGIN_TYPE_VIDEO: GetVideo()->Debug((HWND)_Parent, Show); @@ -550,7 +546,7 @@ void CPluginManager::OpenDebug(void* _Parent, const char *_rFilename, PLUGIN_TYP GetDSP()->Debug((HWND)_Parent, Show); break; default: - PanicAlert("Type %d debug not supported in plugin %s", Type, _rFilename); + PanicAlert("Type %d debug not supported in plugin %s", Type, _rFilename); } } diff --git a/Source/Core/Core/Src/PluginManager.h b/Source/Core/Core/Src/PluginManager.h index 38b0420908..e001408d5c 100644 --- a/Source/Core/Core/Src/PluginManager.h +++ b/Source/Core/Core/Src/PluginManager.h @@ -75,10 +75,10 @@ private: CPluginInfos m_PluginInfos; PLUGIN_GLOBALS *m_PluginGlobals; - Common::PluginPAD *m_pad[4]; Common::PluginVideo *m_video; - Common::PluginWiimote *m_wiimote[4]; Common::PluginDSP *m_dsp; + Common::PluginPAD *m_pad[4]; + Common::PluginWiimote *m_wiimote[4]; SCoreStartupParameter * m_params; CPluginManager(); diff --git a/Source/Core/DolphinWX/Src/ConfigMain.cpp b/Source/Core/DolphinWX/Src/ConfigMain.cpp index 330d72ec2b..e263117ab2 100644 --- a/Source/Core/DolphinWX/Src/ConfigMain.cpp +++ b/Source/Core/DolphinWX/Src/ConfigMain.cpp @@ -52,33 +52,37 @@ extern CFrame* main_frame; BEGIN_EVENT_TABLE(CConfigMain, wxDialog) EVT_CLOSE(CConfigMain::OnClose) -EVT_BUTTON(wxID_CLOSE, CConfigMain::CloseClick) +EVT_BUTTON(wxID_OK, CConfigMain::OnOk) -EVT_CHECKBOX(ID_INTERFACE_CONFIRMSTOP, CConfigMain::CoreSettingsChanged) -EVT_CHECKBOX(ID_INTERFACE_USEPANICHANDLERS, CConfigMain::CoreSettingsChanged) -EVT_CHECKBOX(ID_FRAMELIMIT_USEFPSFORLIMITING, CConfigMain::CoreSettingsChanged) -EVT_CHOICE(ID_DISPLAY_FULLSCREENRES, CConfigMain::CoreSettingsChanged) -EVT_CHECKBOX(ID_DISPLAY_FULLSCREEN, CConfigMain::CoreSettingsChanged) -EVT_TEXT(ID_DISPLAY_WINDOWWIDTH, CConfigMain::CoreSettingsChanged) -EVT_TEXT(ID_DISPLAY_WINDOWHEIGHT, CConfigMain::CoreSettingsChanged) -EVT_CHECKBOX(ID_DISPLAY_HIDECURSOR, CConfigMain::CoreSettingsChanged) -EVT_CHECKBOX(ID_DISPLAY_RENDERTOMAIN, CConfigMain::CoreSettingsChanged) -EVT_RADIOBOX(ID_INTERFACE_THEME, CConfigMain::CoreSettingsChanged) -EVT_CHOICE(ID_INTERFACE_LANG, CConfigMain::CoreSettingsChanged) -EVT_BUTTON(ID_HOTKEY_CONFIG, CConfigMain::CoreSettingsChanged) -EVT_CHECKBOX(ID_ALWAYS_HLE_BS2, CConfigMain::CoreSettingsChanged) -EVT_RADIOBUTTON(ID_RADIOJIT, CConfigMain::CoreSettingsChanged) -EVT_RADIOBUTTON(ID_RADIOJITIL, CConfigMain::CoreSettingsChanged) -EVT_RADIOBUTTON(ID_RADIOINT, CConfigMain::CoreSettingsChanged) EVT_CHECKBOX(ID_CPUTHREAD, CConfigMain::CoreSettingsChanged) -EVT_CHECKBOX(ID_DSPTHREAD, CConfigMain::CoreSettingsChanged) -EVT_CHECKBOX(ID_LOCKTHREADS, CConfigMain::CoreSettingsChanged) EVT_CHECKBOX(ID_IDLESKIP, CConfigMain::CoreSettingsChanged) EVT_CHECKBOX(ID_ENABLECHEATS, CConfigMain::CoreSettingsChanged) EVT_CHOICE(ID_FRAMELIMIT, CConfigMain::CoreSettingsChanged) +EVT_CHECKBOX(ID_FRAMELIMIT_USEFPSFORLIMITING, CConfigMain::CoreSettingsChanged) + +EVT_CHECKBOX(ID_ALWAYS_HLE_BS2, CConfigMain::CoreSettingsChanged) +EVT_RADIOBOX(ID_CPUENGINE, CConfigMain::CoreSettingsChanged) +EVT_CHECKBOX(ID_LOCKTHREADS, CConfigMain::CoreSettingsChanged) +EVT_CHECKBOX(ID_DSPTHREAD, CConfigMain::CoreSettingsChanged) + + +EVT_CHOICE(ID_DISPLAY_FULLSCREENRES, CConfigMain::DisplaySettingsChanged) +EVT_TEXT(ID_DISPLAY_WINDOWWIDTH, CConfigMain::DisplaySettingsChanged) +EVT_TEXT(ID_DISPLAY_WINDOWHEIGHT, CConfigMain::DisplaySettingsChanged) +EVT_CHECKBOX(ID_DISPLAY_FULLSCREEN, CConfigMain::DisplaySettingsChanged) +EVT_CHECKBOX(ID_DISPLAY_HIDECURSOR, CConfigMain::DisplaySettingsChanged) +EVT_CHECKBOX(ID_DISPLAY_RENDERTOMAIN, CConfigMain::DisplaySettingsChanged) + +EVT_CHECKBOX(ID_INTERFACE_CONFIRMSTOP, CConfigMain::DisplaySettingsChanged) +EVT_CHECKBOX(ID_INTERFACE_USEPANICHANDLERS, CConfigMain::DisplaySettingsChanged) +EVT_RADIOBOX(ID_INTERFACE_THEME, CConfigMain::DisplaySettingsChanged) +EVT_CHOICE(ID_INTERFACE_LANG, CConfigMain::DisplaySettingsChanged) +EVT_BUTTON(ID_HOTKEY_CONFIG, CConfigMain::DisplaySettingsChanged) + EVT_CHOICE(ID_GC_SRAM_LNG, CConfigMain::GCSettingsChanged) + EVT_CHOICE(ID_GC_EXIDEVICE_SLOTA, CConfigMain::GCSettingsChanged) EVT_BUTTON(ID_GC_EXIDEVICE_SLOTA_PATH, CConfigMain::GCSettingsChanged) EVT_CHOICE(ID_GC_EXIDEVICE_SLOTB, CConfigMain::GCSettingsChanged) @@ -89,29 +93,38 @@ EVT_CHOICE(ID_GC_SIDEVICE1, CConfigMain::GCSettingsChanged) EVT_CHOICE(ID_GC_SIDEVICE2, CConfigMain::GCSettingsChanged) EVT_CHOICE(ID_GC_SIDEVICE3, CConfigMain::GCSettingsChanged) + EVT_CHOICE(ID_WII_BT_BAR, CConfigMain::WiiSettingsChanged) + EVT_CHECKBOX(ID_WII_IPL_SSV, CConfigMain::WiiSettingsChanged) EVT_CHECKBOX(ID_WII_IPL_PGS, CConfigMain::WiiSettingsChanged) EVT_CHECKBOX(ID_WII_IPL_E60, CConfigMain::WiiSettingsChanged) EVT_CHOICE(ID_WII_IPL_AR, CConfigMain::WiiSettingsChanged) EVT_CHOICE(ID_WII_IPL_LNG, CConfigMain::WiiSettingsChanged) + EVT_CHECKBOX(ID_WII_SD_CARD, CConfigMain::WiiSettingsChanged) EVT_CHECKBOX(ID_WII_KEYBOARD, CConfigMain::WiiSettingsChanged) + EVT_LISTBOX(ID_ISOPATHS, CConfigMain::ISOPathsSelectionChanged) +EVT_CHECKBOX(ID_RECURSIVEISOPATH, CConfigMain::RecursiveDirectoryChanged) EVT_BUTTON(ID_ADDISOPATH, CConfigMain::AddRemoveISOPaths) EVT_BUTTON(ID_REMOVEISOPATH, CConfigMain::AddRemoveISOPaths) -EVT_CHECKBOX(ID_RECERSIVEISOPATH, CConfigMain::RecursiveDirectoryChanged) + EVT_FILEPICKER_CHANGED(ID_DEFAULTISO, CConfigMain::DefaultISOChanged) EVT_DIRPICKER_CHANGED(ID_DVDROOT, CConfigMain::DVDRootChanged) EVT_FILEPICKER_CHANGED(ID_APPLOADERPATH, CConfigMain::ApploaderPathChanged) + EVT_CHOICE(ID_GRAPHIC_CB, CConfigMain::OnSelectionChanged) EVT_BUTTON(ID_GRAPHIC_CONFIG, CConfigMain::OnConfig) + EVT_CHOICE(ID_DSP_CB, CConfigMain::OnSelectionChanged) EVT_BUTTON(ID_DSP_CONFIG, CConfigMain::OnConfig) + EVT_CHOICE(ID_PAD_CB, CConfigMain::OnSelectionChanged) EVT_BUTTON(ID_PAD_CONFIG, CConfigMain::OnConfig) + EVT_CHOICE(ID_WIIMOTE_CB, CConfigMain::OnSelectionChanged) EVT_BUTTON(ID_WIIMOTE_CONFIG, CConfigMain::OnConfig) @@ -143,20 +156,26 @@ void CConfigMain::UpdateGUI() if(Core::GetState() != Core::CORE_UNINITIALIZED) { // Disable the Core stuff on GeneralPage - AlwaysHLE_BS2->Disable(); - m_RadioJIT->Disable(); - m_RadioJITIL->Disable(); - m_RadioInt->Disable(); CPUThread->Disable(); - DSPThread->Disable(); - LockThreads->Disable(); SkipIdle->Disable(); EnableCheats->Disable(); - RenderToMain->Disable(); - FullscreenResolution->Disable(); + AlwaysHLE_BS2->Disable(); + CPUEngine->Disable(); + LockThreads->Disable(); + DSPThread->Disable(); + + + // Disable stuff on DisplayPage + FullscreenResolution->Disable(); + RenderToMain->Disable(); + + + // Disable stuff on GamecubePage GCSystemLang->Disable(); + + // Disable stuff on WiiPage WiiSensBarPos->Disable(); WiiScreenSaver->Disable(); WiiProgressiveScan->Disable(); @@ -164,8 +183,12 @@ void CConfigMain::UpdateGUI() WiiAspectRatio->Disable(); WiiSystemLang->Disable(); + + // Disable stuff on PathsPage PathsPage->Disable(); + + // Disable stuff on PluginsPage GraphicSelection->Disable(); DSPSelection->Disable(); PADSelection->Disable(); @@ -175,48 +198,62 @@ void CConfigMain::UpdateGUI() void CConfigMain::InitializeGUILists() { - // Deal with all the language arrayStrings here - // GC - arrayStringFor_GCSystemLang.Add(wxT("English")); - arrayStringFor_GCSystemLang.Add(wxT("German")); - arrayStringFor_GCSystemLang.Add(wxT("French")); - arrayStringFor_GCSystemLang.Add(wxT("Spanish")); - arrayStringFor_GCSystemLang.Add(wxT("Italian")); - arrayStringFor_GCSystemLang.Add(wxT("Dutch")); - // Wii - arrayStringFor_WiiSystemLang = arrayStringFor_GCSystemLang; - arrayStringFor_WiiSystemLang.Insert(wxT("Japanese"), 0); - arrayStringFor_WiiSystemLang.Add(wxT("Simplified Chinese")); - arrayStringFor_WiiSystemLang.Add(wxT("Traditional Chinese")); - arrayStringFor_WiiSystemLang.Add(wxT("Korean")); - // GUI - arrayStringFor_InterfaceLang = arrayStringFor_GCSystemLang; - - // Resolutions - if (arrayStringFor_FullscreenResolution.empty()) - arrayStringFor_FullscreenResolution.Add(wxT("")); - + // General page // Framelimit arrayStringFor_Framelimit.Add(wxT("Off")); arrayStringFor_Framelimit.Add(wxT("Auto")); for (int i = 10; i <= 120; i += 5) // from 10 to 120 arrayStringFor_Framelimit.Add(wxString::Format(wxT("%i"), i)); + // Emulator Engine + arrayStringFor_CPUEngine.Add(wxT("Interpreter (VERY slow)")); + arrayStringFor_CPUEngine.Add(wxT("JIT Recompiler (recommended)")); + arrayStringFor_CPUEngine.Add(wxT("JITIL experimental recompiler")); + + + // Display page + // Resolutions + if (arrayStringFor_FullscreenResolution.empty()) + arrayStringFor_FullscreenResolution.Add(wxT("")); + // Themes arrayStringFor_Themes.Add(wxT("Boomy")); arrayStringFor_Themes.Add(wxT("Vista")); arrayStringFor_Themes.Add(wxT("X-Plastik")); arrayStringFor_Themes.Add(wxT("KDE")); - // Wii + // GUI language arrayStrings + arrayStringFor_InterfaceLang.Add(wxT("English")); + arrayStringFor_InterfaceLang.Add(wxT("German")); + arrayStringFor_InterfaceLang.Add(wxT("French")); + arrayStringFor_InterfaceLang.Add(wxT("Spanish")); + arrayStringFor_InterfaceLang.Add(wxT("Italian")); + arrayStringFor_InterfaceLang.Add(wxT("Dutch")); + + + // Gamecube page + // GC Language arrayStrings + arrayStringFor_GCSystemLang = arrayStringFor_InterfaceLang; + + + // Wii page // Sensorbar Position arrayStringFor_WiiSensBarPos.Add(wxT("Bottom")); arrayStringFor_WiiSensBarPos.Add(wxT("Top")); + // Aspect ratio arrayStringFor_WiiAspectRatio.Add(wxT("4:3")); arrayStringFor_WiiAspectRatio.Add(wxT("16:9")); - + + // Wii Language arrayStrings + arrayStringFor_WiiSystemLang = arrayStringFor_InterfaceLang; + arrayStringFor_WiiSystemLang.Insert(wxT("Japanese"), 0); + arrayStringFor_WiiSystemLang.Add(wxT("Simplified Chinese")); + arrayStringFor_WiiSystemLang.Add(wxT("Traditional Chinese")); + arrayStringFor_WiiSystemLang.Add(wxT("Korean")); + } + void CConfigMain::InitializeGUIValues() { // General - Basic @@ -228,31 +265,26 @@ void CConfigMain::InitializeGUIValues() // General - Advanced AlwaysHLE_BS2->SetValue(SConfig::GetInstance().m_LocalCoreStartupParameter.bHLE_BS2); - switch (SConfig::GetInstance().m_LocalCoreStartupParameter.iCPUCore) - { - case 0: m_RadioInt->SetValue(true); break; - case 1: m_RadioJIT->SetValue(true); break; - case 2: m_RadioJITIL->SetValue(true); break; - } + CPUEngine->SetSelection(SConfig::GetInstance().m_LocalCoreStartupParameter.iCPUCore); LockThreads->SetValue(SConfig::GetInstance().m_LocalCoreStartupParameter.bLockThreads); DSPThread->SetValue(SConfig::GetInstance().m_LocalCoreStartupParameter.bDSPThread); - // General - Interface + + // Display - Display + FullscreenResolution->SetStringSelection(wxString::FromAscii(SConfig::GetInstance().m_LocalCoreStartupParameter.strFullscreenResolution.c_str())); + WindowWidth->SetValue(SConfig::GetInstance().m_LocalCoreStartupParameter.iRenderWindowWidth); + WindowHeight->SetValue(SConfig::GetInstance().m_LocalCoreStartupParameter.iRenderWindowHeight); + Fullscreen->SetValue(SConfig::GetInstance().m_LocalCoreStartupParameter.bFullscreen); + HideCursor->SetValue(SConfig::GetInstance().m_LocalCoreStartupParameter.bHideCursor); + RenderToMain->SetValue(SConfig::GetInstance().m_LocalCoreStartupParameter.bRenderToMain); + + // Display - Interface ConfirmStop->SetValue(SConfig::GetInstance().m_LocalCoreStartupParameter.bConfirmStop); UsePanicHandlers->SetValue(SConfig::GetInstance().m_LocalCoreStartupParameter.bUsePanicHandlers); Theme->SetSelection(SConfig::GetInstance().m_LocalCoreStartupParameter.iTheme); // need redesign InterfaceLang->SetSelection(SConfig::GetInstance().m_InterfaceLanguage); - // General - Display - int num = 0; - num = FullscreenResolution->FindString(wxString::FromAscii(SConfig::GetInstance().m_LocalCoreStartupParameter.strFullscreenResolution.c_str())); - FullscreenResolution->SetSelection(num); - WindowWidth->SetValue(SConfig::GetInstance().m_LocalCoreStartupParameter.iRenderWindowWidth); - WindowHeight->SetValue(SConfig::GetInstance().m_LocalCoreStartupParameter.iRenderWindowHeight); - Fullscreen->SetValue(SConfig::GetInstance().m_LocalCoreStartupParameter.bFullscreen); - HideCursor->SetValue(SConfig::GetInstance().m_LocalCoreStartupParameter.bHideCursor); - RenderToMain->SetValue(SConfig::GetInstance().m_LocalCoreStartupParameter.bRenderToMain); // Gamecube - IPL GCSystemLang->SetSelection(SConfig::GetInstance().m_LocalCoreStartupParameter.SelectedLanguage); @@ -261,32 +293,38 @@ void CConfigMain::InitializeGUIValues() // Not here. They use some locals over in CreateGUIControls for initialization, // which is why they are still there. - // Wii + + // Wii - Wiimote WiiSensBarPos->SetSelection(SConfig::GetInstance().m_SYSCONF->GetData("BT.BAR")); + // Wii - Misc WiiScreenSaver->SetValue(!!SConfig::GetInstance().m_SYSCONF->GetData("IPL.SSV")); WiiProgressiveScan->SetValue(!!SConfig::GetInstance().m_SYSCONF->GetData("IPL.PGS")); WiiEuRGB60->SetValue(!!SConfig::GetInstance().m_SYSCONF->GetData("IPL.E60")); WiiAspectRatio->SetSelection(SConfig::GetInstance().m_SYSCONF->GetData("IPL.AR")); WiiSystemLang->SetSelection(SConfig::GetInstance().m_SYSCONF->GetData("IPL.LNG")); + // Wii - Devices WiiSDCard->SetValue(SConfig::GetInstance().m_WiiSDCard); WiiKeyboard->SetValue(SConfig::GetInstance().m_WiiKeyboard); + // Paths - RecersiveISOPath->SetValue(SConfig::GetInstance().m_RecursiveISOFolder); + RecursiveISOPath->SetValue(SConfig::GetInstance().m_RecursiveISOFolder); DefaultISO->SetPath(wxString(SConfig::GetInstance().m_LocalCoreStartupParameter.m_strDefaultGCM.c_str(), *wxConvCurrent)); DVDRoot->SetPath(wxString(SConfig::GetInstance().m_LocalCoreStartupParameter.m_strDVDRoot.c_str(), *wxConvCurrent)); ApploaderPath->SetPath(wxString(SConfig::GetInstance().m_LocalCoreStartupParameter.m_strApploader.c_str(), *wxConvCurrent)); + // Plugins FillChoiceBox(GraphicSelection, PLUGIN_TYPE_VIDEO, SConfig::GetInstance().m_LocalCoreStartupParameter.m_strVideoPlugin); FillChoiceBox(DSPSelection, PLUGIN_TYPE_DSP, SConfig::GetInstance().m_LocalCoreStartupParameter.m_strDSPPlugin); for (int i = 0; i < MAXPADS; i++) FillChoiceBox(PADSelection, PLUGIN_TYPE_PAD, SConfig::GetInstance().m_LocalCoreStartupParameter.m_strPadPlugin[i]); for (int i=0; i < MAXWIIMOTES; i++) - FillChoiceBox(WiimoteSelection, PLUGIN_TYPE_WIIMOTE, SConfig::GetInstance().m_LocalCoreStartupParameter.m_strWiimotePlugin[i]); + FillChoiceBox(WiimoteSelection, PLUGIN_TYPE_WIIMOTE, SConfig::GetInstance().m_LocalCoreStartupParameter.m_strWiimotePlugin[i]); } + void CConfigMain::InitializeGUITooltips() { // General - Basic @@ -298,21 +336,8 @@ void CConfigMain::InitializeGUITooltips() // General - Advanced DSPThread->SetToolTip(wxT("Run DSPLLE on a dedicated thread (not recommended).")); - // General - Interface - ConfirmStop->SetToolTip(wxT("Show a confirmation box before stopping a game.")); - UsePanicHandlers->SetToolTip(wxT("Show a message box when a potentially serious error has occured.") - wxT(" Disabling this may avoid annoying and non-fatal messages, but it may also mean that Dolphin") - wxT(" suddenly crashes without any explanation at all.")); - InterfaceLang->SetToolTip(wxT("For the time being this will only change the text shown in") - wxT("\nthe game list of PAL GC games.")); - // Themes: Copyright notice - Theme->SetItemToolTip(0, wxT("Created by Milosz Wlazlo [miloszwl@miloszwl.com, miloszwl.deviantart.com]")); - Theme->SetItemToolTip(1, wxT("Created by VistaIcons.com")); - Theme->SetItemToolTip(2, wxT("Created by black_rider and published on ForumW.org > Web Developments")); - Theme->SetItemToolTip(3, wxT("Created by KDE-Look.org")); - - // General - Display + // Display - Display FullscreenResolution->SetToolTip(wxT("Select resolution for fullscreen mode")); WindowWidth->SetToolTip(wxT("Window width for windowed mode")); WindowHeight->SetToolTip(wxT("Window height for windowed mode")); @@ -321,7 +346,27 @@ void CConfigMain::InitializeGUITooltips() wxT("\n and the rendering window has focus.")); RenderToMain->SetToolTip(wxT("Render to main window.")); - // Wii + // Display - Interface + ConfirmStop->SetToolTip(wxT("Show a confirmation box before stopping a game.")); + UsePanicHandlers->SetToolTip(wxT("Show a message box when a potentially serious error has occured.") + wxT(" Disabling this may avoid annoying and non-fatal messages, but it may also mean that Dolphin") + wxT(" suddenly crashes without any explanation at all.")); + + // Display - Themes: Copyright notice + Theme->SetItemToolTip(0, wxT("Created by Milosz Wlazlo [miloszwl@miloszwl.com, miloszwl.deviantart.com]")); + Theme->SetItemToolTip(1, wxT("Created by VistaIcons.com")); + Theme->SetItemToolTip(2, wxT("Created by black_rider and published on ForumW.org > Web Developments")); + Theme->SetItemToolTip(3, wxT("Created by KDE-Look.org")); + + InterfaceLang->SetToolTip(wxT("For the time being this will only change the text shown in") + wxT("\nthe game list of PAL GC games.")); + + + // Gamecube - Devices + GCEXIDevice[2]->SetToolTip(wxT("Serial Port 1 - This is the port which devices such as the net adapter use")); + + + // Wii - Devices WiiKeyboard->SetToolTip(wxT("This could cause slow down in Wii Menu and some games.")); } @@ -336,34 +381,30 @@ void CConfigMain::CreateGUIControls() GamecubePage = new wxPanel(Notebook, ID_GAMECUBEPAGE, wxDefaultPosition, wxDefaultSize); WiiPage = new wxPanel(Notebook, ID_WIIPAGE, wxDefaultPosition, wxDefaultSize); PathsPage = new wxPanel(Notebook, ID_PATHSPAGE, wxDefaultPosition, wxDefaultSize); - PluginPage = new wxPanel(Notebook, ID_PLUGINPAGE, wxDefaultPosition, wxDefaultSize); + PluginsPage = new wxPanel(Notebook, ID_PLUGINPAGE, wxDefaultPosition, wxDefaultSize); Notebook->AddPage(GeneralPage, wxT("General")); Notebook->AddPage(DisplayPage, wxT("Display")); Notebook->AddPage(GamecubePage, wxT("Gamecube")); Notebook->AddPage(WiiPage, wxT("Wii")); Notebook->AddPage(PathsPage, wxT("Paths")); - Notebook->AddPage(PluginPage, wxT("Plugins")); + Notebook->AddPage(PluginsPage, wxT("Plugins")); // General page - sbBasic = new wxStaticBoxSizer(wxVERTICAL, GeneralPage, wxT("Basic Settings")); - sbAdvanced = new wxStaticBoxSizer(wxVERTICAL, GeneralPage, wxT("Advanced Settings")); // Core Settings - Basic + sbBasic = new wxStaticBoxSizer(wxVERTICAL, GeneralPage, wxT("Basic Settings")); CPUThread = new wxCheckBox(GeneralPage, ID_CPUTHREAD, wxT("Enable Dual Core (speedup)"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator); SkipIdle = new wxCheckBox(GeneralPage, ID_IDLESKIP, wxT("Enable Idle Skipping (speedup)"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator); EnableCheats = new wxCheckBox(GeneralPage, ID_ENABLECHEATS, wxT("Enable Cheats"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator); - // Framelimit - wxStaticText *FramelimitText = new wxStaticText(GeneralPage, ID_FRAMELIMIT_TEXT, wxT("Framelimit :"), wxDefaultPosition, wxDefaultSize); + wxStaticText* FramelimitText = new wxStaticText(GeneralPage, ID_FRAMELIMIT_TEXT, wxT("Framelimit :"), wxDefaultPosition, wxDefaultSize); Framelimit = new wxChoice(GeneralPage, ID_FRAMELIMIT, wxDefaultPosition, wxDefaultSize, arrayStringFor_Framelimit, 0, wxDefaultValidator); UseFPSForLimiting = new wxCheckBox(GeneralPage, ID_FRAMELIMIT_USEFPSFORLIMITING, wxT("Use FPS For Limiting"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator); // Core Settings - Advanced - wxStaticBoxSizer* sizerCoreType = new wxStaticBoxSizer(wxVERTICAL, GeneralPage, wxT("CPU Emulator Engine")); + sbAdvanced = new wxStaticBoxSizer(wxVERTICAL, GeneralPage, wxT("Advanced Settings")); AlwaysHLE_BS2 = new wxCheckBox(GeneralPage, ID_ALWAYS_HLE_BS2, wxT("HLE the IPL (recommended)"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator); - m_RadioJIT = new wxRadioButton(GeneralPage, ID_RADIOJIT, wxT("JIT recompiler (recommended)")); - m_RadioJITIL = new wxRadioButton(GeneralPage, ID_RADIOJITIL, wxT("JitIL experimental recompiler")); - m_RadioInt = new wxRadioButton(GeneralPage, ID_RADIOINT, wxT("Interpreter (VERY slow)")); + CPUEngine = new wxRadioBox(GeneralPage, ID_CPURECOMPILER, wxT("CPU Emulator Engine"), wxDefaultPosition, wxDefaultSize, arrayStringFor_CPURec, 0, wxRA_SPECIFY_ROWS); LockThreads = new wxCheckBox(GeneralPage, ID_LOCKTHREADS, wxT("Lock threads to cores"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator); DSPThread = new wxCheckBox(GeneralPage, ID_DSPTHREAD, wxT("DSPLLE on thread"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator); @@ -371,50 +412,65 @@ void CConfigMain::CreateGUIControls() sbBasic->Add(CPUThread, 0, wxALL, 5); sbBasic->Add(SkipIdle, 0, wxALL, 5); sbBasic->Add(EnableCheats, 0, wxALL, 5); - wxBoxSizer *sFramelimit = new wxBoxSizer(wxHORIZONTAL); - sFramelimit->Add(FramelimitText, 0, wxALL | wxALIGN_CENTER, 1); + wxBoxSizer* sFramelimit = new wxBoxSizer(wxHORIZONTAL); + sFramelimit->Add(FramelimitText, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5); sFramelimit->Add(Framelimit, 0, wxALL | wxEXPAND, 5); sFramelimit->Add(UseFPSForLimiting, 0, wxALL | wxEXPAND, 5); sbBasic->Add(sFramelimit, 0, wxALL | wxEXPAND, 5); sbAdvanced->Add(AlwaysHLE_BS2, 0, wxALL, 5); - sizerCoreType->Add(m_RadioJIT, 0, wxALL | wxEXPAND, 5); - sizerCoreType->Add(m_RadioJITIL, 0, wxALL | wxEXPAND, 5); - sizerCoreType->Add(m_RadioInt, 0, wxALL | wxEXPAND, 5); - sbAdvanced->Add(sizerCoreType, 0, wxALL, 5); + sbAdvanced->Add(CPUEngine, 0, wxALL, 5); sbAdvanced->Add(LockThreads, 0, wxALL, 5); sbAdvanced->Add(DSPThread, 0, wxALL, 5); - // Populate the entire page + // Populate the General page sGeneralPage = new wxBoxSizer(wxVERTICAL); sGeneralPage->Add(sbBasic, 0, wxEXPAND | wxALL, 5); sGeneralPage->Add(sbAdvanced, 0, wxEXPAND | wxALL, 5); GeneralPage->SetSizer(sGeneralPage); sGeneralPage->Layout(); - + + + // Display page - sbInterface = new wxStaticBoxSizer(wxVERTICAL, DisplayPage, wxT("Interface Settings")); - sbDisplay = new wxStaticBoxSizer(wxVERTICAL, DisplayPage, wxT("Emulator Display Settings")); - // General display settings - wxStaticText *FullscreenResolutionText = new wxStaticText(DisplayPage, wxID_ANY, wxT("Fullscreen Display Resolution:"), wxDefaultPosition, wxDefaultSize, 0); + sbDisplay = new wxStaticBoxSizer(wxVERTICAL, DisplayPage, wxT("Emulator Display Settings")); + wxStaticText* FullscreenResolutionText = new wxStaticText(DisplayPage, wxID_ANY, wxT("Fullscreen Display Resolution:"), wxDefaultPosition, wxDefaultSize, 0); FullscreenResolution = new wxChoice(DisplayPage, ID_DISPLAY_FULLSCREENRES, wxDefaultPosition, wxDefaultSize, arrayStringFor_FullscreenResolution, 0, wxDefaultValidator, arrayStringFor_FullscreenResolution[0]); wxStaticText *WindowSizeText = new wxStaticText(DisplayPage, wxID_ANY, wxT("Window Size:"), wxDefaultPosition, wxDefaultSize, 0); - WindowWidth = new wxSpinCtrl(DisplayPage, ID_DISPLAY_WINDOWWIDTH, wxEmptyString, wxDefaultPosition, wxDefaultSize); - wxStaticText *WindowXText = new wxStaticText(DisplayPage, wxID_ANY, wxT("x"), wxDefaultPosition, wxDefaultSize, 0); + WindowWidth = new wxSpinCtrl(DisplayPage, ID_DISPLAY_WINDOWWIDTH, wxEmptyString, wxDefaultPosition, wxDefaultSize); WindowWidth->SetRange(0,3280); - WindowHeight = new wxSpinCtrl(DisplayPage, ID_DISPLAY_WINDOWHEIGHT, wxEmptyString, wxDefaultPosition, wxDefaultSize); + wxStaticText *WindowXText = new wxStaticText(DisplayPage, wxID_ANY, wxT("x"), wxDefaultPosition, wxDefaultSize, 0); + WindowHeight = new wxSpinCtrl(DisplayPage, ID_DISPLAY_WINDOWHEIGHT, wxEmptyString, wxDefaultPosition, wxDefaultSize); WindowHeight->SetRange(0,2048); Fullscreen = new wxCheckBox(DisplayPage, ID_DISPLAY_FULLSCREEN, wxT("Start Renderer in Fullscreen"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator); HideCursor = new wxCheckBox(DisplayPage, ID_DISPLAY_HIDECURSOR, wxT("Hide Mouse Cursor")); RenderToMain = new wxCheckBox(DisplayPage, ID_DISPLAY_RENDERTOMAIN, wxT("Render to Main Window"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator); - wxBoxSizer *sDisplayRes = new wxBoxSizer(wxHORIZONTAL); + // Interface settings + sbInterface = new wxStaticBoxSizer(wxVERTICAL, DisplayPage, wxT("Interface Settings")); + ConfirmStop = new wxCheckBox(DisplayPage, ID_INTERFACE_CONFIRMSTOP, wxT("Confirm On Stop"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator); + UsePanicHandlers = new wxCheckBox(DisplayPage, ID_INTERFACE_USEPANICHANDLERS, wxT("Use Panic Handlers"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator); + + // Themes - this should really be a wxChoice... + Theme = new wxRadioBox(DisplayPage, ID_INTERFACE_THEME, wxT("Theme"), wxDefaultPosition, wxDefaultSize, arrayStringFor_Themes, 1, wxRA_SPECIFY_ROWS); + + // Interface Language + // At the moment this only changes the language displayed in m_gamelistctrl + // If someone wants to control the whole GUI's language, it should be set here too + wxStaticText* InterfaceLangText = new wxStaticText(DisplayPage, ID_INTERFACE_LANG_TEXT, wxT("Game List Language:"), wxDefaultPosition, wxDefaultSize); + InterfaceLang = new wxChoice(DisplayPage, ID_INTERFACE_LANG, wxDefaultPosition, wxDefaultSize, arrayStringFor_InterfaceLang, 0, wxDefaultValidator); + + // Hotkey configuration + HotkeyConfig = new wxButton(DisplayPage, ID_HOTKEY_CONFIG, wxT("Hotkeys"), wxDefaultPosition, wxDefaultSize, wxBU_EXACTFIT, wxDefaultValidator); + + // Populate the settings + wxBoxSizer* sDisplayRes = new wxBoxSizer(wxHORIZONTAL); sDisplayRes->Add(FullscreenResolutionText, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5); sDisplayRes->Add(FullscreenResolution, 0, wxEXPAND | wxALL, 5); sbDisplay->Add(sDisplayRes, 0, wxALL, 5); - wxBoxSizer *sDisplaySize = new wxBoxSizer(wxHORIZONTAL); + wxBoxSizer* sDisplaySize = new wxBoxSizer(wxHORIZONTAL); sDisplaySize->Add(WindowSizeText, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5); sDisplaySize->Add(WindowWidth, 0, wxEXPAND | wxALL, 5); sDisplaySize->Add(WindowXText, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5); @@ -424,33 +480,17 @@ void CConfigMain::CreateGUIControls() sbDisplay->Add(HideCursor, 0, wxALL, 5); sbDisplay->Add(RenderToMain, 0, wxEXPAND | wxALL, 5); - // Interface settings - ConfirmStop = new wxCheckBox(DisplayPage, ID_INTERFACE_CONFIRMSTOP, wxT("Confirm On Stop"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator); - UsePanicHandlers = new wxCheckBox(DisplayPage, ID_INTERFACE_USEPANICHANDLERS, wxT("Use Panic Handlers"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator); - - // Interface Language - // At the moment this only changes the language displayed in m_gamelistctrl - // If someone wants to control the whole GUI's language, it should be set here too - wxStaticText *InterfaceLangText = new wxStaticText(DisplayPage, ID_INTERFACE_LANG_TEXT, wxT("Game List Language:"), wxDefaultPosition, wxDefaultSize); - InterfaceLang = new wxChoice(DisplayPage, ID_INTERFACE_LANG, wxDefaultPosition, wxDefaultSize, arrayStringFor_InterfaceLang, 0, wxDefaultValidator); - - // Hotkey configuration - HotkeyConfig = new wxButton(DisplayPage, ID_HOTKEY_CONFIG, wxT("Hotkeys"), wxDefaultPosition, wxDefaultSize, wxBU_EXACTFIT, wxDefaultValidator); - - // Themes - this should really be a wxChoice... - Theme = new wxRadioBox(DisplayPage, ID_INTERFACE_THEME, wxT("Theme"),wxDefaultPosition, wxDefaultSize, arrayStringFor_Themes, 1, wxRA_SPECIFY_ROWS); - sbInterface->Add(ConfirmStop, 0, wxALL, 5); sbInterface->Add(UsePanicHandlers, 0, wxALL, 5); sbInterface->Add(Theme, 0, wxEXPAND | wxALL, 5); - wxBoxSizer *sInterface = new wxBoxSizer(wxHORIZONTAL); + wxBoxSizer* sInterface = new wxBoxSizer(wxHORIZONTAL); sInterface->Add(InterfaceLangText, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5); sInterface->Add(InterfaceLang, 0, wxEXPAND | wxALL, 5); sInterface->AddStretchSpacer(); sInterface->Add(HotkeyConfig, 0, wxALIGN_RIGHT | wxALL, 5); sbInterface->Add(sInterface, 0, wxEXPAND | wxALL, 5); - // sizers + // Populate the Display page sDisplayPage = new wxBoxSizer(wxVERTICAL); sDisplayPage->Add(sbDisplay, 0, wxEXPAND | wxALL, 5); sDisplayPage->Add(sbInterface, 0, wxEXPAND | wxALL, 5); @@ -458,26 +498,27 @@ void CConfigMain::CreateGUIControls() DisplayPage->SetSizer(sDisplayPage); sDisplayPage->Layout(); + + // Gamecube page - sbGamecubeIPLSettings = new wxStaticBoxSizer(wxVERTICAL, GamecubePage, wxT("IPL Settings")); // IPL settings - GCSystemLangText = new wxStaticText(GamecubePage, ID_GC_SRAM_LNG_TEXT, wxT("System Language:"), wxDefaultPosition, wxDefaultSize); + sbGamecubeIPLSettings = new wxStaticBoxSizer(wxVERTICAL, GamecubePage, wxT("IPL Settings")); + wxStaticText* GCSystemLangText = new wxStaticText(GamecubePage, ID_GC_SRAM_LNG_TEXT, wxT("System Language:"), wxDefaultPosition, wxDefaultSize); GCSystemLang = new wxChoice(GamecubePage, ID_GC_SRAM_LNG, wxDefaultPosition, wxDefaultSize, arrayStringFor_GCSystemLang, 0, wxDefaultValidator); - // Devices - wxStaticBoxSizer *sbGamecubeDeviceSettings = new wxStaticBoxSizer(wxVERTICAL, GamecubePage, wxT("Device Settings")); + // Device settings // EXI Devices - wxStaticText *GCEXIDeviceText[3]; + wxStaticBoxSizer *sbGamecubeDeviceSettings = new wxStaticBoxSizer(wxVERTICAL, GamecubePage, wxT("Device Settings")); + wxStaticText* GCEXIDeviceText[3]; GCEXIDeviceText[0] = new wxStaticText(GamecubePage, ID_GC_EXIDEVICE_SLOTA_TEXT, wxT("Slot A"), wxDefaultPosition, wxDefaultSize); GCEXIDeviceText[1] = new wxStaticText(GamecubePage, ID_GC_EXIDEVICE_SLOTB_TEXT, wxT("Slot B"), wxDefaultPosition, wxDefaultSize); GCEXIDeviceText[2] = new wxStaticText(GamecubePage, ID_GC_EXIDEVICE_SP1_TEXT, wxT("SP1 "), wxDefaultPosition, wxDefaultSize); - GCEXIDeviceText[2]->SetToolTip(wxT("Serial Port 1 - This is the port which devices such as the net adapter use")); - const wxString SlotDevices[] = {wxT(DEV_NONE_STR),wxT(DEV_DUMMY_STR),wxT(EXIDEV_MEMCARD_STR) + const wxString SlotDevices[] = {wxT(DEV_NONE_STR), wxT(DEV_DUMMY_STR), wxT(EXIDEV_MEMCARD_STR) #if HAVE_PORTAUDIO , wxT(EXIDEV_MIC_STR) #endif }; static const int numSlotDevices = sizeof(SlotDevices)/sizeof(wxString); - const wxString SP1Devices[] = {wxT(DEV_NONE_STR),wxT(DEV_DUMMY_STR),wxT(EXIDEV_BBA_STR),wxT(EXIDEV_AM_BB_STR)}; + const wxString SP1Devices[] = { wxT(DEV_NONE_STR), wxT(DEV_DUMMY_STR), wxT(EXIDEV_BBA_STR), wxT(EXIDEV_AM_BB_STR) }; static const int numSP1Devices = sizeof(SP1Devices)/sizeof(wxString); GCEXIDevice[0] = new wxChoice(GamecubePage, ID_GC_EXIDEVICE_SLOTA, wxDefaultPosition, wxDefaultSize, numSlotDevices, SlotDevices, 0, wxDefaultValidator); GCEXIDevice[1] = new wxChoice(GamecubePage, ID_GC_EXIDEVICE_SLOTB, wxDefaultPosition, wxDefaultSize, numSlotDevices, SlotDevices, 0, wxDefaultValidator); @@ -515,7 +556,7 @@ void CConfigMain::CreateGUIControls() GCMemcardPath[i]->Disable(); } //SI Devices - wxStaticText *GCSIDeviceText[4]; + wxStaticText* GCSIDeviceText[4]; GCSIDeviceText[0] = new wxStaticText(GamecubePage, ID_GC_SIDEVICE_TEXT, wxT("Port 1"), wxDefaultPosition, wxDefaultSize); GCSIDeviceText[1] = new wxStaticText(GamecubePage, ID_GC_SIDEVICE_TEXT, wxT("Port 2"), wxDefaultPosition, wxDefaultSize); GCSIDeviceText[2] = new wxStaticText(GamecubePage, ID_GC_SIDEVICE_TEXT, wxT("Port 3"), wxDefaultPosition, wxDefaultSize); @@ -547,14 +588,13 @@ void CConfigMain::CreateGUIControls() break; } } - sGamecube = new wxBoxSizer(wxVERTICAL); - sGamecubeIPLSettings = new wxGridBagSizer(0, 0); - sGamecubeIPLSettings->Add(GCSystemLangText, wxGBPosition(0, 0), wxGBSpan(1, 1), wxALIGN_CENTER_VERTICAL|wxALL, 5); - sGamecubeIPLSettings->Add(GCSystemLang, wxGBPosition(0, 1), wxGBSpan(1, 1), wxALL, 5); + + // Populate the settings + sGamecubeIPLSettings = new wxGridBagSizer(); + sGamecubeIPLSettings->Add(GCSystemLangText, wxGBPosition(0, 0), wxDefaultSpan, wxALIGN_CENTER_VERTICAL|wxALL, 5); + sGamecubeIPLSettings->Add(GCSystemLang, wxGBPosition(0, 1), wxDefaultSpan, wxALL, 5); sbGamecubeIPLSettings->Add(sGamecubeIPLSettings); - sGamecube->Add(sbGamecubeIPLSettings, 0, wxEXPAND|wxALL, 5); - wxBoxSizer *sEXIDevices[4]; - wxBoxSizer *sSIDevices[4]; + wxBoxSizer *sEXIDevices[4], *sSIDevices[4]; for (int i = 0; i < 3; ++i) { sEXIDevices[i] = new wxBoxSizer(wxHORIZONTAL); @@ -571,145 +611,162 @@ void CConfigMain::CreateGUIControls() sSIDevices[i]->Add(GCSIDevice[i], 0, wxALL, 5); sbGamecubeDeviceSettings->Add(sSIDevices[i]); } - sGamecube->Add(sbGamecubeDeviceSettings, 0, wxEXPAND|wxALL, 5); - GamecubePage->SetSizer(sGamecube); - sGamecube->Layout(); + + // Populate the Gamecube page + sGamecubePage = new wxBoxSizer(wxVERTICAL); + sGamecubePage->Add(sbGamecubeIPLSettings, 0, wxEXPAND|wxALL, 5); + sGamecubePage->Add(sbGamecubeDeviceSettings, 0, wxEXPAND|wxALL, 5); + + GamecubePage->SetSizer(sGamecubePage); + sGamecubePage->Layout(); + + // Wii page - sbWiimoteSettings = new wxStaticBoxSizer(wxVERTICAL, WiiPage, wxT("Wiimote Settings")); - WiiSensBarPosText = new wxStaticText(WiiPage, ID_WII_BT_BAR_TEXT, wxT("Sensor Bar Position:"), wxDefaultPosition, wxDefaultSize); + // Wiimote Settings + sbWiimoteSettings = new wxStaticBoxSizer(wxHORIZONTAL, WiiPage, wxT("Wiimote Settings")); + wxStaticText* WiiSensBarPosText = new wxStaticText(WiiPage, ID_WII_BT_BAR_TEXT, wxT("Sensor Bar Position:"), wxDefaultPosition, wxDefaultSize); WiiSensBarPos = new wxChoice(WiiPage, ID_WII_BT_BAR, wxDefaultPosition, wxDefaultSize, arrayStringFor_WiiSensBarPos, 0, wxDefaultValidator); + // Misc Settings sbWiiIPLSettings = new wxStaticBoxSizer(wxVERTICAL, WiiPage, wxT("Misc Settings")); WiiScreenSaver = new wxCheckBox(WiiPage, ID_WII_IPL_SSV, wxT("Enable Screen Saver (burn-in reduction)"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator); WiiProgressiveScan = new wxCheckBox(WiiPage, ID_WII_IPL_PGS, wxT("Enable Progressive Scan"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator); WiiEuRGB60 = new wxCheckBox(WiiPage, ID_WII_IPL_E60, wxT("Use EuRGB60 Mode (PAL60)"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator); - WiiAspectRatioText = new wxStaticText(WiiPage, ID_WII_IPL_AR_TEXT, wxT("Aspect Ratio:"), wxDefaultPosition, wxDefaultSize); + wxStaticText* WiiAspectRatioText = new wxStaticText(WiiPage, ID_WII_IPL_AR_TEXT, wxT("Aspect Ratio:"), wxDefaultPosition, wxDefaultSize); WiiAspectRatio = new wxChoice(WiiPage, ID_WII_IPL_AR, wxDefaultPosition, wxDefaultSize, arrayStringFor_WiiAspectRatio, 0, wxDefaultValidator); - WiiSystemLangText = new wxStaticText(WiiPage, ID_WII_IPL_LNG_TEXT, wxT("System Language:"), wxDefaultPosition, wxDefaultSize); + wxStaticText* WiiSystemLangText = new wxStaticText(WiiPage, ID_WII_IPL_LNG_TEXT, wxT("System Language:"), wxDefaultPosition, wxDefaultSize); WiiSystemLang = new wxChoice(WiiPage, ID_WII_IPL_LNG, wxDefaultPosition, wxDefaultSize, arrayStringFor_WiiSystemLang, 0, wxDefaultValidator); - // Devices + // Device Settings sbWiiDeviceSettings = new wxStaticBoxSizer(wxVERTICAL, WiiPage, wxT("Device Settings")); - WiiSDCard = new wxCheckBox(WiiPage, ID_WII_SD_CARD, wxT("Insert SD Card"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator); WiiKeyboard = new wxCheckBox(WiiPage, ID_WII_KEYBOARD, wxT("Connect USB Keyboard"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator); - // Populate sbWiimoteSettings - sWii = new wxBoxSizer(wxVERTICAL); - sWiimoteSettings = new wxGridBagSizer(0, 0); - sWiimoteSettings->Add(WiiSensBarPosText, wxGBPosition(0, 0), wxGBSpan(1, 1), wxALIGN_CENTER_VERTICAL|wxALL, 5); - sWiimoteSettings->Add(WiiSensBarPos, wxGBPosition(0, 1), wxGBSpan(1, 1), wxALL, 5); + // Populate the settings + sWiimoteSettings = new wxGridBagSizer(); + sWiimoteSettings->Add(WiiSensBarPosText, wxGBPosition(0, 0), wxDefaultSpan, wxALIGN_CENTER_VERTICAL|wxALL, 5); + sWiimoteSettings->Add(WiiSensBarPos, wxGBPosition(0, 1), wxDefaultSpan, wxALL, 5); sbWiimoteSettings->Add(sWiimoteSettings); - sWii->Add(sbWiimoteSettings, 0, wxEXPAND|wxALL, 5); - sWiiIPLSettings = new wxGridBagSizer(0, 0); + sWiiIPLSettings = new wxGridBagSizer(); sWiiIPLSettings->Add(WiiScreenSaver, wxGBPosition(0, 0), wxGBSpan(1, 2), wxALL, 5); sWiiIPLSettings->Add(WiiProgressiveScan, wxGBPosition(1, 0), wxGBSpan(1, 2), wxALL, 5); sWiiIPLSettings->Add(WiiEuRGB60, wxGBPosition(2, 0), wxGBSpan(1, 2), wxALL, 5); - sWiiIPLSettings->Add(WiiAspectRatioText, wxGBPosition(3, 0), wxGBSpan(1, 1), wxALIGN_CENTER_VERTICAL|wxALL, 5); - sWiiIPLSettings->Add(WiiAspectRatio, wxGBPosition(3, 1), wxGBSpan(1, 1), wxALL, 5); - sWiiIPLSettings->Add(WiiSystemLangText, wxGBPosition(4, 0), wxGBSpan(1, 1), wxALIGN_CENTER_VERTICAL|wxALL, 5); - sWiiIPLSettings->Add(WiiSystemLang, wxGBPosition(4, 1), wxGBSpan(1, 1), wxALL, 5); + sWiiIPLSettings->Add(WiiAspectRatioText, wxGBPosition(3, 0), wxDefaultSpan, wxALIGN_CENTER_VERTICAL|wxALL, 5); + sWiiIPLSettings->Add(WiiAspectRatio, wxGBPosition(3, 1), wxDefaultSpan, wxALL, 5); + sWiiIPLSettings->Add(WiiSystemLangText, wxGBPosition(4, 0), wxDefaultSpan, wxALIGN_CENTER_VERTICAL|wxALL, 5); + sWiiIPLSettings->Add(WiiSystemLang, wxGBPosition(4, 1), wxDefaultSpan, wxALL, 5); sbWiiIPLSettings->Add(sWiiIPLSettings); - sWii->Add(sbWiiIPLSettings, 0, wxEXPAND|wxALL, 5); sbWiiDeviceSettings->Add(WiiSDCard, 0, wxALL, 5); sbWiiDeviceSettings->Add(WiiKeyboard, 0, wxALL, 5); - sWii->Add(sbWiiDeviceSettings, 0, wxEXPAND|wxALL, 5); - WiiPage->SetSizer(sWii); - sWii->Layout(); + + // Populate the Wii page + sWiiPage = new wxBoxSizer(wxVERTICAL); + sWiiPage->Add(sbWiimoteSettings, 0, wxEXPAND|wxALL, 5); + sWiiPage->Add(sbWiiIPLSettings, 0, wxEXPAND|wxALL, 5); + sWiiPage->Add(sbWiiDeviceSettings, 0, wxEXPAND|wxALL, 5); + + WiiPage->SetSizer(sWiiPage); + sWiiPage->Layout(); // Paths page sbISOPaths = new wxStaticBoxSizer(wxVERTICAL, PathsPage, wxT("ISO Directories")); ISOPaths = new wxListBox(PathsPage, ID_ISOPATHS, wxDefaultPosition, wxDefaultSize, arrayStringFor_ISOPaths, wxLB_SINGLE, wxDefaultValidator); + RecursiveISOPath = new wxCheckBox(PathsPage, ID_RECURSIVEISOPATH, wxT("Search Subfolders"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator); AddISOPath = new wxButton(PathsPage, ID_ADDISOPATH, wxT("Add..."), wxDefaultPosition, wxDefaultSize, 0); RemoveISOPath = new wxButton(PathsPage, ID_REMOVEISOPATH, wxT("Remove"), wxDefaultPosition, wxDefaultSize, 0); RemoveISOPath->Enable(false); - RecersiveISOPath = new wxCheckBox(PathsPage, ID_RECERSIVEISOPATH, wxT("Search Subfolders"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator); - DefaultISOText = new wxStaticText(PathsPage, ID_DEFAULTISO_TEXT, wxT("Default ISO:"), wxDefaultPosition, wxDefaultSize); + + wxStaticText* DefaultISOText = new wxStaticText(PathsPage, ID_DEFAULTISO_TEXT, wxT("Default ISO:"), wxDefaultPosition, wxDefaultSize); DefaultISO = new wxFilePickerCtrl(PathsPage, ID_DEFAULTISO, wxEmptyString, wxT("Choose a default ISO:"), wxString::Format(wxT("All GC/Wii images (gcm, iso, gcz)|*.gcm;*.iso;*.gcz|All files (%s)|%s"), wxFileSelectorDefaultWildcardStr, wxFileSelectorDefaultWildcardStr), wxDefaultPosition, wxDefaultSize, wxFLP_USE_TEXTCTRL|wxFLP_OPEN); - - DVDRootText = new wxStaticText(PathsPage, ID_DVDROOT_TEXT, wxT("DVD Root:"), wxDefaultPosition, wxDefaultSize); + wxStaticText* DVDRootText = new wxStaticText(PathsPage, ID_DVDROOT_TEXT, wxT("DVD Root:"), wxDefaultPosition, wxDefaultSize); DVDRoot = new wxDirPickerCtrl(PathsPage, ID_DVDROOT, wxEmptyString, wxT("Choose a DVD root directory:"), wxDefaultPosition, wxDefaultSize, wxDIRP_USE_TEXTCTRL); - ApploaderPathText = new wxStaticText(PathsPage, ID_APPLOADERPATH_TEXT, wxT("Apploader:"), wxDefaultPosition, wxDefaultSize); + wxStaticText* ApploaderPathText = new wxStaticText(PathsPage, ID_APPLOADERPATH_TEXT, wxT("Apploader:"), wxDefaultPosition, wxDefaultSize); ApploaderPath = new wxFilePickerCtrl(PathsPage, ID_APPLOADERPATH, wxEmptyString, wxT("Choose file to use as apploader: (applies to discs constructed from directories only)"), wxString::Format(wxT("apploader (.img)|*.img|All files (%s)|%s"), wxFileSelectorDefaultWildcardStr, wxFileSelectorDefaultWildcardStr), wxDefaultPosition, wxDefaultSize, wxFLP_USE_TEXTCTRL|wxFLP_OPEN); - sPaths = new wxBoxSizer(wxVERTICAL); - + // Populate the settings sbISOPaths->Add(ISOPaths, 1, wxEXPAND|wxALL, 0); - - sISOButtons = new wxBoxSizer(wxHORIZONTAL); - sISOButtons->Add(RecersiveISOPath, 0, wxALL|wxALIGN_CENTER, 0); - sISOButtons->AddStretchSpacer(1); + wxBoxSizer* sISOButtons = new wxBoxSizer(wxHORIZONTAL); + sISOButtons->Add(RecursiveISOPath, 0, wxALL|wxALIGN_CENTER, 0); + sISOButtons->AddStretchSpacer(); sISOButtons->Add(AddISOPath, 0, wxALL, 0); sISOButtons->Add(RemoveISOPath, 0, wxALL, 0); sbISOPaths->Add(sISOButtons, 0, wxEXPAND|wxALL, 5); - sPaths->Add(sbISOPaths, 1, wxEXPAND|wxALL, 5); - sOtherPaths = new wxGridBagSizer(0, 0); - sOtherPaths->Add(DefaultISOText, wxGBPosition(0, 0), wxGBSpan(1, 1), wxALIGN_CENTER_VERTICAL|wxALL, 5); - sOtherPaths->Add(DefaultISO, wxGBPosition(0, 1), wxGBSpan(1, 1), wxEXPAND|wxALL, 5); - sOtherPaths->Add(DVDRootText, wxGBPosition(1, 0), wxGBSpan(1, 1), wxALIGN_CENTER_VERTICAL|wxALL, 5); - sOtherPaths->Add(DVDRoot, wxGBPosition(1, 1), wxGBSpan(1, 1), wxEXPAND|wxALL, 5); - sOtherPaths->Add(ApploaderPathText, wxGBPosition(2, 0), wxGBSpan(1, 1), wxALIGN_CENTER_VERTICAL|wxALL, 5); - sOtherPaths->Add(ApploaderPath, wxGBPosition(2, 1), wxGBSpan(1, 1), wxEXPAND|wxALL, 5); + sOtherPaths = new wxGridBagSizer(); + sOtherPaths->Add(DefaultISOText, wxGBPosition(0, 0), wxDefaultSpan, wxALIGN_CENTER_VERTICAL|wxALL, 5); + sOtherPaths->Add(DefaultISO, wxGBPosition(0, 1), wxDefaultSpan, wxEXPAND|wxALL, 5); + sOtherPaths->Add(DVDRootText, wxGBPosition(1, 0), wxDefaultSpan, wxALIGN_CENTER_VERTICAL|wxALL, 5); + sOtherPaths->Add(DVDRoot, wxGBPosition(1, 1), wxDefaultSpan, wxEXPAND|wxALL, 5); + sOtherPaths->Add(ApploaderPathText, wxGBPosition(2, 0), wxDefaultSpan, wxALIGN_CENTER_VERTICAL|wxALL, 5); + sOtherPaths->Add(ApploaderPath, wxGBPosition(2, 1), wxDefaultSpan, wxEXPAND|wxALL, 5); sOtherPaths->AddGrowableCol(1); - sPaths->Add(sOtherPaths, 0, wxEXPAND|wxALL, 5); - PathsPage->SetSizer(sPaths); - sPaths->Layout(); + + // Populate the Paths page + sPathsPage = new wxBoxSizer(wxVERTICAL); + sPathsPage->Add(sbISOPaths, 1, wxEXPAND|wxALL, 5); + sPathsPage->Add(sOtherPaths, 0, wxEXPAND|wxALL, 5); + + PathsPage->SetSizer(sPathsPage); + sPathsPage->Layout(); + // Plugins page - sbGraphicsPlugin = new wxStaticBoxSizer(wxHORIZONTAL, PluginPage, wxT("Graphics")); - GraphicSelection = new wxChoice(PluginPage, ID_GRAPHIC_CB, wxDefaultPosition, wxDefaultSize, NULL, 0, wxDefaultValidator); - GraphicConfig = new wxButton(PluginPage, ID_GRAPHIC_CONFIG, wxT("Config..."), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator); + sbGraphicsPlugin = new wxStaticBoxSizer(wxHORIZONTAL, PluginsPage, wxT("Graphics")); + GraphicSelection = new wxChoice(PluginsPage, ID_GRAPHIC_CB, wxDefaultPosition, wxDefaultSize, NULL, 0, wxDefaultValidator); + GraphicConfig = new wxButton(PluginsPage, ID_GRAPHIC_CONFIG, wxT("Config..."), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator); - sbDSPPlugin = new wxStaticBoxSizer(wxHORIZONTAL, PluginPage, wxT("DSP")); - DSPSelection = new wxChoice(PluginPage, ID_DSP_CB, wxDefaultPosition, wxDefaultSize, NULL, 0, wxDefaultValidator); - DSPConfig = new wxButton(PluginPage, ID_DSP_CONFIG, wxT("Config..."), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator); + sbDSPPlugin = new wxStaticBoxSizer(wxHORIZONTAL, PluginsPage, wxT("DSP")); + DSPSelection = new wxChoice(PluginsPage, ID_DSP_CB, wxDefaultPosition, wxDefaultSize, NULL, 0, wxDefaultValidator); + DSPConfig = new wxButton(PluginsPage, ID_DSP_CONFIG, wxT("Config..."), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator); - sbPadPlugin = new wxStaticBoxSizer(wxHORIZONTAL, PluginPage, wxT("Gamecube Pad")); - PADSelection = new wxChoice(PluginPage, ID_PAD_CB, wxDefaultPosition, wxDefaultSize, NULL, 0, wxDefaultValidator); - PADConfig = new wxButton(PluginPage, ID_PAD_CONFIG, wxT("Config..."), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator); + sbPadPlugin = new wxStaticBoxSizer(wxHORIZONTAL, PluginsPage, wxT("Gamecube Pad")); + PADSelection = new wxChoice(PluginsPage, ID_PAD_CB, wxDefaultPosition, wxDefaultSize, NULL, 0, wxDefaultValidator); + PADConfig = new wxButton(PluginsPage, ID_PAD_CONFIG, wxT("Config..."), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator); - sbWiimotePlugin = new wxStaticBoxSizer(wxHORIZONTAL, PluginPage, wxT("Wiimote")); - WiimoteSelection = new wxChoice(PluginPage, ID_WIIMOTE_CB, wxDefaultPosition, wxDefaultSize, NULL, 0, wxDefaultValidator); - WiimoteConfig = new wxButton(PluginPage, ID_WIIMOTE_CONFIG, wxT("Config..."), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator); + sbWiimotePlugin = new wxStaticBoxSizer(wxHORIZONTAL, PluginsPage, wxT("Wiimote")); + WiimoteSelection = new wxChoice(PluginsPage, ID_WIIMOTE_CB, wxDefaultPosition, wxDefaultSize, NULL, 0, wxDefaultValidator); + WiimoteConfig = new wxButton(PluginsPage, ID_WIIMOTE_CONFIG, wxT("Config..."), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator); - - sPlugins = new wxBoxSizer(wxVERTICAL); + // Populate the settings sbGraphicsPlugin->Add(GraphicSelection, 1, wxEXPAND|wxALL, 5); sbGraphicsPlugin->Add(GraphicConfig, 0, wxALL, 5); - sPlugins->Add(sbGraphicsPlugin, 0, wxEXPAND|wxALL, 5); sbDSPPlugin->Add(DSPSelection, 1, wxEXPAND|wxALL, 5); sbDSPPlugin->Add(DSPConfig, 0, wxALL, 5); - sPlugins->Add(sbDSPPlugin, 0, wxEXPAND|wxALL, 5); sbPadPlugin->Add(PADSelection, 1, wxEXPAND|wxALL, 5); sbPadPlugin->Add(PADConfig, 0, wxALL, 5); - sPlugins->Add(sbPadPlugin, 0, wxEXPAND|wxALL, 5); sbWiimotePlugin->Add(WiimoteSelection, 1, wxEXPAND|wxALL, 5); sbWiimotePlugin->Add(WiimoteConfig, 0, wxALL, 5); - sPlugins->Add(sbWiimotePlugin, 0, wxEXPAND|wxALL, 5); - PluginPage->SetSizer(sPlugins); - sPlugins->Layout(); + + // Populate the Plugins page + sPluginsPage = new wxBoxSizer(wxVERTICAL); + sPluginsPage->Add(sbGraphicsPlugin, 0, wxEXPAND|wxALL, 5); + sPluginsPage->Add(sbDSPPlugin, 0, wxEXPAND|wxALL, 5); + sPluginsPage->Add(sbPadPlugin, 0, wxEXPAND|wxALL, 5); + sPluginsPage->Add(sbWiimotePlugin, 0, wxEXPAND|wxALL, 5); + + PluginsPage->SetSizer(sPluginsPage); + sPluginsPage->Layout(); - m_Close = new wxButton(this, wxID_CLOSE); + m_Ok = new wxButton(this, wxID_OK); wxBoxSizer* sButtons = new wxBoxSizer(wxHORIZONTAL); sButtons->Add(0, 0, 1, wxEXPAND, 5); - sButtons->Add(m_Close, 0, wxALL, 5); + sButtons->Add(m_Ok, 0, wxALL, 5); wxBoxSizer* sMain = new wxBoxSizer(wxVERTICAL); sMain->Add(Notebook, 1, wxEXPAND|wxALL, 5); @@ -720,8 +777,8 @@ void CConfigMain::CreateGUIControls() UpdateGUI(); - this->SetSizer(sMain); - this->Layout(); + SetSizer(sMain); + Layout(); Fit(); Center(); @@ -730,7 +787,11 @@ void CConfigMain::CreateGUIControls() void CConfigMain::OnClose(wxCloseEvent& WXUNUSED (event)) { EndModal((bRefreshList) ? wxID_OK : wxID_CLOSE); +} +void CConfigMain::OnOk(wxCommandEvent& WXUNUSED (event)) +{ + Close(); // Sysconf saves when it gets deleted //delete SConfig::GetInstance().m_SYSCONF; @@ -738,23 +799,79 @@ void CConfigMain::OnClose(wxCloseEvent& WXUNUSED (event)) SConfig::GetInstance().SaveSettings(); } -void CConfigMain::CloseClick(wxCommandEvent& WXUNUSED (event)) -{ - Close(); -} - -// Core AND Interface settings +// Core settings void CConfigMain::CoreSettingsChanged(wxCommandEvent& event) { switch (event.GetId()) { + // Core - Basic + case ID_CPUTHREAD: + SConfig::GetInstance().m_LocalCoreStartupParameter.bCPUThread = CPUThread->IsChecked(); + break; + case ID_IDLESKIP: + SConfig::GetInstance().m_LocalCoreStartupParameter.bSkipIdle = SkipIdle->IsChecked(); + break; + case ID_ENABLECHEATS: + SConfig::GetInstance().m_LocalCoreStartupParameter.bEnableCheats = EnableCheats->IsChecked(); + break; + case ID_FRAMELIMIT: + SConfig::GetInstance().m_Framelimit = Framelimit->GetSelection(); + break; case ID_FRAMELIMIT_USEFPSFORLIMITING: SConfig::GetInstance().b_UseFPS = UseFPSForLimiting->IsChecked(); break; - case ID_INTERFACE_CONFIRMSTOP: // Interface + // Core - Advanced + case ID_ALWAYS_HLE_BS2: + SConfig::GetInstance().m_LocalCoreStartupParameter.bHLE_BS2 = AlwaysHLE_BS2->IsChecked(); + break; + case ID_CPUENGINE: + SConfig::GetInstance().m_LocalCoreStartupParameter.iCPUCore = CPUEngine->GetSelection(); + if (main_frame->g_pCodeWindow) + main_frame->g_pCodeWindow->GetMenuBar()->Check(IDM_INTERPRETER, + SConfig::GetInstance().m_LocalCoreStartupParameter.iCPUCore?false:true); + break; + case ID_DSPTHREAD: + SConfig::GetInstance().m_LocalCoreStartupParameter.bDSPThread = DSPThread->IsChecked(); + break; + case ID_LOCKTHREADS: + SConfig::GetInstance().m_LocalCoreStartupParameter.bLockThreads = LockThreads->IsChecked(); + break; + } +} + +// Display and Interface settings +void CConfigMain::DisplaySettingsChanged(wxCommandEvent& event) +{ + switch (event.GetId()) + { + // Display - Display + case ID_DISPLAY_FULLSCREENRES: + SConfig::GetInstance().m_LocalCoreStartupParameter.strFullscreenResolution = + FullscreenResolution->GetStringSelection().mb_str(); +#if defined(HAVE_XRANDR) && HAVE_XRANDR + main_frame->m_XRRConfig->Update(); +#endif + break; + case ID_DISPLAY_WINDOWWIDTH: + SConfig::GetInstance().m_LocalCoreStartupParameter.iRenderWindowWidth = WindowWidth->GetValue(); + break; + case ID_DISPLAY_WINDOWHEIGHT: + SConfig::GetInstance().m_LocalCoreStartupParameter.iRenderWindowHeight = WindowHeight->GetValue(); + break; + case ID_DISPLAY_FULLSCREEN: + SConfig::GetInstance().m_LocalCoreStartupParameter.bFullscreen = Fullscreen->IsChecked(); + break; + case ID_DISPLAY_HIDECURSOR: + SConfig::GetInstance().m_LocalCoreStartupParameter.bHideCursor = HideCursor->IsChecked(); + break; + case ID_DISPLAY_RENDERTOMAIN: + SConfig::GetInstance().m_LocalCoreStartupParameter.bRenderToMain = RenderToMain->IsChecked(); + break; + // Display - Interface + case ID_INTERFACE_CONFIRMSTOP: SConfig::GetInstance().m_LocalCoreStartupParameter.bConfirmStop = ConfirmStop->IsChecked(); break; - case ID_INTERFACE_USEPANICHANDLERS: // Interface + case ID_INTERFACE_USEPANICHANDLERS: SConfig::GetInstance().m_LocalCoreStartupParameter.bUsePanicHandlers = UsePanicHandlers->IsChecked(); SetEnableAlert(UsePanicHandlers->IsChecked()); break; @@ -775,61 +892,6 @@ void CConfigMain::CoreSettingsChanged(wxCommandEvent& event) main_frame->UpdateGUI(); } break; - case ID_FRAMELIMIT: - SConfig::GetInstance().m_Framelimit = (u32)Framelimit->GetSelection(); - break; - case ID_ALWAYS_HLE_BS2: // Core - SConfig::GetInstance().m_LocalCoreStartupParameter.bHLE_BS2 = AlwaysHLE_BS2->IsChecked(); - break; - case ID_RADIOJIT: - SConfig::GetInstance().m_LocalCoreStartupParameter.iCPUCore = 1; - if (main_frame->g_pCodeWindow) main_frame->g_pCodeWindow->GetMenuBar()->Check(IDM_INTERPRETER, false); - break; - case ID_RADIOJITIL: - SConfig::GetInstance().m_LocalCoreStartupParameter.iCPUCore = 2; - if (main_frame->g_pCodeWindow) main_frame->g_pCodeWindow->GetMenuBar()->Check(IDM_INTERPRETER, false); - break; - case ID_RADIOINT: - SConfig::GetInstance().m_LocalCoreStartupParameter.iCPUCore = 0; - if (main_frame->g_pCodeWindow) main_frame->g_pCodeWindow->GetMenuBar()->Check(IDM_INTERPRETER, true); - break; - case ID_CPUTHREAD: - SConfig::GetInstance().m_LocalCoreStartupParameter.bCPUThread = CPUThread->IsChecked(); - break; - case ID_DSPTHREAD: - SConfig::GetInstance().m_LocalCoreStartupParameter.bDSPThread = DSPThread->IsChecked(); - break; - case ID_LOCKTHREADS: - SConfig::GetInstance().m_LocalCoreStartupParameter.bLockThreads = LockThreads->IsChecked(); - break; - case ID_IDLESKIP: - SConfig::GetInstance().m_LocalCoreStartupParameter.bSkipIdle = SkipIdle->IsChecked(); - break; - case ID_ENABLECHEATS: - SConfig::GetInstance().m_LocalCoreStartupParameter.bEnableCheats = EnableCheats->IsChecked(); - break; - case ID_DISPLAY_FULLSCREENRES: - SConfig::GetInstance().m_LocalCoreStartupParameter.strFullscreenResolution = - FullscreenResolution->GetStringSelection().mb_str(); -#if defined(HAVE_XRANDR) && HAVE_XRANDR - main_frame->m_XRRConfig->Update(); -#endif - break; - case ID_DISPLAY_WINDOWWIDTH: - SConfig::GetInstance().m_LocalCoreStartupParameter.iRenderWindowWidth = WindowWidth->GetValue(); - break; - case ID_DISPLAY_WINDOWHEIGHT: - SConfig::GetInstance().m_LocalCoreStartupParameter.iRenderWindowHeight = WindowHeight->GetValue(); - break; - case ID_DISPLAY_FULLSCREEN: // Display - SConfig::GetInstance().m_LocalCoreStartupParameter.bFullscreen = Fullscreen->IsChecked(); - break; - case ID_DISPLAY_HIDECURSOR: - SConfig::GetInstance().m_LocalCoreStartupParameter.bHideCursor = HideCursor->IsChecked(); - break; - case ID_DISPLAY_RENDERTOMAIN: - SConfig::GetInstance().m_LocalCoreStartupParameter.bRenderToMain = RenderToMain->IsChecked(); - break; } } @@ -842,33 +904,33 @@ void CConfigMain::GCSettingsChanged(wxCommandEvent& event) int exidevice = 0; switch (event.GetId()) { + // Gamecube - IPL case ID_GC_SRAM_LNG: SConfig::GetInstance().m_LocalCoreStartupParameter.SelectedLanguage = GCSystemLang->GetSelection(); break; - + // Gamecube - Devices case ID_GC_EXIDEVICE_SP1: exidevice++; case ID_GC_EXIDEVICE_SLOTB: exidevice++; - case ID_GC_EXIDEVICE_SLOTA: + case ID_GC_EXIDEVICE_SLOTA: ChooseEXIDevice(std::string(event.GetString().mb_str()), exidevice); - break; + break; case ID_GC_EXIDEVICE_SLOTA_PATH: ChooseMemcardPath(SConfig::GetInstance().m_strMemoryCardA, true); break; case ID_GC_EXIDEVICE_SLOTB_PATH: ChooseMemcardPath(SConfig::GetInstance().m_strMemoryCardB, false); break; - - case ID_GC_SIDEVICE3: + case ID_GC_SIDEVICE3: sidevice++; - case ID_GC_SIDEVICE2: + case ID_GC_SIDEVICE2: sidevice++; - case ID_GC_SIDEVICE1: - sidevice++; - case ID_GC_SIDEVICE0: + case ID_GC_SIDEVICE1: + sidevice++; + case ID_GC_SIDEVICE0: ChooseSIDevice(std::string(event.GetString().mb_str()), sidevice); - break; + break; } } @@ -971,25 +1033,27 @@ void CConfigMain::WiiSettingsChanged(wxCommandEvent& event) { switch (event.GetId()) { - case ID_WII_BT_BAR: // Wiimote settings + // Wii - Wiimote settings + case ID_WII_BT_BAR: SConfig::GetInstance().m_SYSCONF->SetData("BT.BAR", WiiSensBarPos->GetSelection()); break; - - case ID_WII_IPL_AR: // SYSCONF settings - SConfig::GetInstance().m_SYSCONF->SetData("IPL.AR", WiiAspectRatio->GetSelection()); - break; + // SYSCONF settings case ID_WII_IPL_SSV: SConfig::GetInstance().m_SYSCONF->SetData("IPL.SSV", WiiScreenSaver->IsChecked()); break; - case ID_WII_IPL_LNG: - SConfig::GetInstance().m_SYSCONF->SetData("IPL.LNG", WiiSystemLang->GetSelection()); - break; case ID_WII_IPL_PGS: SConfig::GetInstance().m_SYSCONF->SetData("IPL.PGS", WiiProgressiveScan->IsChecked()); break; case ID_WII_IPL_E60: SConfig::GetInstance().m_SYSCONF->SetData("IPL.E60", WiiEuRGB60->IsChecked()); break; + case ID_WII_IPL_AR: + SConfig::GetInstance().m_SYSCONF->SetData("IPL.AR", WiiAspectRatio->GetSelection()); + break; + case ID_WII_IPL_LNG: + SConfig::GetInstance().m_SYSCONF->SetData("IPL.LNG", WiiSystemLang->GetSelection()); + break; + // Wii - Devices case ID_WII_SD_CARD: SConfig::GetInstance().m_WiiSDCard = WiiSDCard->IsChecked(); break; @@ -1054,7 +1118,7 @@ void CConfigMain::AddRemoveISOPaths(wxCommandEvent& event) void CConfigMain::RecursiveDirectoryChanged(wxCommandEvent& WXUNUSED (event)) { - SConfig::GetInstance().m_RecursiveISOFolder = RecersiveISOPath->IsChecked(); + SConfig::GetInstance().m_RecursiveISOFolder = RecursiveISOPath->IsChecked(); bRefreshList = true; } @@ -1090,18 +1154,18 @@ void CConfigMain::OnConfig(wxCommandEvent& event) { switch (event.GetId()) { - case ID_GRAPHIC_CONFIG: - CallConfig(GraphicSelection); - break; + case ID_GRAPHIC_CONFIG: + CallConfig(GraphicSelection); + break; case ID_DSP_CONFIG: - CallConfig(DSPSelection); - break; + CallConfig(DSPSelection); + break; case ID_PAD_CONFIG: CallConfig(PADSelection); break; case ID_WIIMOTE_CONFIG: - CallConfig(WiimoteSelection); - break; + CallConfig(WiimoteSelection); + break; } } @@ -1220,4 +1284,3 @@ void CConfigMain::AddResolutions() #endif } - diff --git a/Source/Core/DolphinWX/Src/ConfigMain.h b/Source/Core/DolphinWX/Src/ConfigMain.h index a24824a7d9..9261fd8953 100644 --- a/Source/Core/DolphinWX/Src/ConfigMain.h +++ b/Source/Core/DolphinWX/Src/ConfigMain.h @@ -39,7 +39,7 @@ public: long style = wxDEFAULT_DIALOG_STYLE); virtual ~CConfigMain(); - void OnClick(wxMouseEvent& event); + void OnOk(wxCommandEvent& event); void CloseClick(wxCommandEvent& event); void OnSelectionChanged(wxCommandEvent& event); void OnConfig(wxCommandEvent& event); @@ -47,119 +47,131 @@ public: bool bRefreshList; private: - - DECLARE_EVENT_TABLE(); + wxNotebook* Notebook; + wxPanel* GeneralPage; + wxPanel* GamecubePage; + wxPanel* DisplayPage; + wxPanel* WiiPage; + wxPanel* PathsPage; + wxPanel* PluginsPage; wxBoxSizer* sGeneralPage; // General Settings - wxCheckBox* ConfirmStop, *UsePanicHandlers, *UseFPSForLimiting; - wxChoice* InterfaceLang; - wxChoice* Framelimit; - wxRadioBox* Theme; - - wxStaticBoxSizer* sbBasic, *sbAdvanced, *sbInterface, *sbDisplay; - wxCheckBox* AlwaysHLE_BS2; - wxRadioButton* m_RadioInt; - wxRadioButton* m_RadioJIT; - wxRadioButton* m_RadioJITIL; + wxStaticBoxSizer* sbBasic, *sbAdvanced; // Basic and Advanced sections + + // Basic wxCheckBox* CPUThread; - wxCheckBox* DSPThread; - wxCheckBox* LockThreads; wxCheckBox* SkipIdle; wxCheckBox* EnableCheats; + wxChoice* Framelimit; + wxCheckBox* UseFPSForLimiting; + + // Advanced + wxCheckBox* AlwaysHLE_BS2; + wxRadioBox* CPUEngine; + wxCheckBox* DSPThread; + wxCheckBox* LockThreads; - // Display settings - wxBoxSizer* sDisplayPage; - wxCheckBox* HideCursor; - wxCheckBox* Fullscreen; + + wxBoxSizer* sDisplayPage; // Display settings + wxStaticBoxSizer* sbDisplay, *sbInterface; // Display and Interface sections + + // Display wxChoice* FullscreenResolution; - wxSpinCtrl *WindowWidth; - wxSpinCtrl *WindowHeight; + wxSpinCtrl* WindowWidth, *WindowHeight; + wxCheckBox* Fullscreen; + wxCheckBox* HideCursor; wxCheckBox* RenderToMain; + + // Interface + wxCheckBox* ConfirmStop; + wxCheckBox* UsePanicHandlers; + wxRadioBox* Theme; + wxChoice* InterfaceLang; wxButton* HotkeyConfig; - wxBoxSizer* sGamecube; // GC settings + + wxBoxSizer* sGamecubePage; // GC settings wxStaticBoxSizer* sbGamecubeIPLSettings; wxGridBagSizer* sGamecubeIPLSettings; - wxStaticText* GCSystemLangText; + + // IPL wxChoice* GCSystemLang; - wxChoice *GCEXIDevice[3]; - wxButton *GCMemcardPath[2]; - wxChoice *GCSIDevice[4]; - wxBoxSizer* sWii; // Wii settings - wxStaticBoxSizer* sbWiimoteSettings; - wxGridBagSizer* sWiimoteSettings; - wxStaticBoxSizer* sbWiiIPLSettings; - wxGridBagSizer* sWiiIPLSettings; - wxStaticBoxSizer* sbWiiDeviceSettings; - wxBoxSizer* sPaths; - wxStaticBoxSizer* sbISOPaths; - wxBoxSizer* sISOButtons; - wxGridBagSizer* sOtherPaths; - wxBoxSizer* sPlugins; - wxStaticBoxSizer* sbGraphicsPlugin; - wxStaticBoxSizer* sbDSPPlugin; - wxStaticBoxSizer* sbPadPlugin; - wxStaticBoxSizer* sbWiimotePlugin; + // Device + wxChoice* GCEXIDevice[3]; + wxButton* GCMemcardPath[2]; + wxChoice* GCSIDevice[4]; - wxNotebook *Notebook; - wxPanel *GeneralPage; - wxPanel *DisplayPage; - wxPanel *GamecubePage; - wxPanel *WiiPage; - wxPanel *PathsPage; - wxPanel *PluginPage; - wxButton* m_Close; + wxBoxSizer* sWiiPage; // Wii settings + wxStaticBoxSizer* sbWiimoteSettings, *sbWiiIPLSettings, *sbWiiDeviceSettings; // Wiimote, Misc and Device sections + wxGridBagSizer* sWiimoteSettings, *sWiiIPLSettings; - FILE* pStream; - - wxStaticText* WiiSensBarPosText; + // Wiimote wxChoice* WiiSensBarPos; - wxCheckBox* WiiScreenSaver; // IPL settings + // Misc + wxCheckBox* WiiScreenSaver; wxCheckBox* WiiProgressiveScan; wxCheckBox* WiiEuRGB60; - wxStaticText* WiiAspectRatioText; wxChoice* WiiAspectRatio; - wxStaticText* WiiSystemLangText; wxChoice* WiiSystemLang; + + // Device wxCheckBox* WiiSDCard; wxCheckBox* WiiKeyboard; + + wxBoxSizer* sPathsPage; // Paths settings + wxStaticBoxSizer* sbISOPaths; + wxGridBagSizer* sOtherPaths; + + // ISO Directories wxListBox* ISOPaths; + wxCheckBox* RecursiveISOPath; wxButton* AddISOPath; wxButton* RemoveISOPath; - wxCheckBox* RecersiveISOPath; - wxStaticText* DefaultISOText; + + // DefaultISO, DVD Root, Apploader wxFilePickerCtrl* DefaultISO; - wxStaticText* DVDRootText; wxDirPickerCtrl* DVDRoot; - wxStaticText* ApploaderPathText; wxFilePickerCtrl* ApploaderPath; - wxStaticText* PADText; - wxButton* PADConfig; - wxChoice* PADSelection; - wxButton* DSPConfig; - wxStaticText* DSPText; - wxChoice* DSPSelection; - wxButton* GraphicConfig; - wxStaticText* GraphicText; - wxChoice* GraphicSelection; - wxButton* WiimoteConfig; - wxStaticText* WiimoteText; - wxChoice* WiimoteSelection; - wxArrayString arrayStringFor_InterfaceLang; + wxBoxSizer* sPluginsPage; // Plugins settings + wxStaticBoxSizer* sbGraphicsPlugin, *sbDSPPlugin, *sbPadPlugin, *sbWiimotePlugin; // Graphics, DSP, Pad and Wiimote sections + + // Graphics + wxChoice* GraphicSelection; + wxButton* GraphicConfig; + + // DSP + wxChoice* DSPSelection; + wxButton* DSPConfig; + + // Pad + wxChoice* PADSelection; + wxButton* PADConfig; + + // Wiimote + wxChoice* WiimoteSelection; + wxButton* WiimoteConfig; + + + wxButton* m_Ok; + + FILE* pStream; + wxArrayString arrayStringFor_Framelimit; + wxArrayString arrayStringFor_CPUEngine; + wxArrayString arrayStringFor_Themes; + wxArrayString arrayStringFor_InterfaceLang; + wxArrayString arrayStringFor_FullscreenResolution; wxArrayString arrayStringFor_GCSystemLang; wxArrayString arrayStringFor_WiiSensBarPos; wxArrayString arrayStringFor_WiiAspectRatio; wxArrayString arrayStringFor_WiiSystemLang; wxArrayString arrayStringFor_ISOPaths; - wxArrayString arrayStringFor_Themes; - wxArrayString arrayStringFor_FullscreenResolution; enum { @@ -171,33 +183,36 @@ private: ID_PATHSPAGE, ID_PLUGINPAGE, - ID_ALWAYS_HLE_BS2, - ID_RADIOJIT, - ID_RADIOJITIL, - ID_RADIOINT, ID_CPUTHREAD, - ID_DSPTHREAD, - ID_LOCKTHREADS, ID_IDLESKIP, ID_ENABLECHEATS, + ID_FRAMELIMIT_TEXT, ID_FRAMELIMIT, + ID_FRAMELIMIT_USEFPSFORLIMITING, + + ID_ALWAYS_HLE_BS2, + ID_CPUENGINE, + ID_LOCKTHREADS, + ID_DSPTHREAD, + - ID_INTERFACE_CONFIRMSTOP, // Interface settings - ID_INTERFACE_USEPANICHANDLERS, ID_DISPLAY_FULLSCREENRES, ID_DISPLAY_WINDOWWIDTH, ID_DISPLAY_WINDOWHEIGHT, ID_DISPLAY_FULLSCREEN, ID_DISPLAY_HIDECURSOR, ID_DISPLAY_RENDERTOMAIN, - ID_HOTKEY_CONFIG, - ID_INTERFACE_LANG_TEXT, ID_INTERFACE_LANG, + + // Interface settings + ID_INTERFACE_CONFIRMSTOP, + ID_INTERFACE_USEPANICHANDLERS, ID_INTERFACE_THEME, - ID_FRAMELIMIT_TEXT, - ID_FRAMELIMIT, - ID_FRAMELIMIT_USEFPSFORLIMITING, + ID_INTERFACE_LANG_TEXT, ID_INTERFACE_LANG, + ID_HOTKEY_CONFIG, + ID_GC_SRAM_LNG_TEXT, ID_GC_SRAM_LNG, + ID_GC_EXIDEVICE_SLOTA_TEXT, ID_GC_EXIDEVICE_SLOTA, ID_GC_EXIDEVICE_SLOTA_PATH, @@ -212,8 +227,10 @@ private: ID_GC_SIDEVICE2, ID_GC_SIDEVICE3, + ID_WII_BT_BAR_TEXT, ID_WII_BT_BAR, + ID_WII_IPL_SSV, ID_WII_IPL_PGS, ID_WII_IPL_E60, @@ -221,13 +238,16 @@ private: ID_WII_IPL_AR, ID_WII_IPL_LNG_TEXT, ID_WII_IPL_LNG, + ID_WII_SD_CARD, ID_WII_KEYBOARD, + ID_ISOPATHS, + ID_RECURSIVEISOPATH, ID_ADDISOPATH, ID_REMOVEISOPATH, - ID_RECERSIVEISOPATH, + ID_DEFAULTISO_TEXT, ID_DEFAULTISO, ID_DVDROOT_TEXT, @@ -235,22 +255,26 @@ private: ID_APPLOADERPATH_TEXT, ID_APPLOADERPATH, - ID_WIIMOTE_ABOUT, - ID_WIIMOTE_CONFIG, - ID_WIIMOTE_TEXT, - ID_WIIMOTE_CB, - ID_PAD_TEXT, - ID_PAD_ABOUT , - ID_PAD_CONFIG, - ID_PAD_CB, - ID_DSP_ABOUT, - ID_DSP_CONFIG, + + ID_GRAPHIC_TEXT, + ID_GRAPHIC_CB, + ID_GRAPHIC_CONFIG, + ID_GRAPHIC_ABOUT, + ID_DSP_TEXT, ID_DSP_CB, - ID_GRAPHIC_ABOUT, - ID_GRAPHIC_CONFIG, - ID_GRAPHIC_TEXT, - ID_GRAPHIC_CB + ID_DSP_CONFIG, + ID_DSP_ABOUT, + + ID_PAD_TEXT, + ID_PAD_CB, + ID_PAD_CONFIG, + ID_PAD_ABOUT, + + ID_WIIMOTE_TEXT, + ID_WIIMOTE_CB, + ID_WIIMOTE_CONFIG, + ID_WIIMOTE_ABOUT }; void InitializeGUILists(); @@ -260,13 +284,20 @@ private: void CreateGUIControls(); void UpdateGUI(); void OnClose(wxCloseEvent& event); - void OnSpin(wxSpinEvent& event); + void CoreSettingsChanged(wxCommandEvent& event); + + void DisplaySettingsChanged(wxCommandEvent& event); + void AddResolutions(); + void OnSpin(wxSpinEvent& event); + void GCSettingsChanged(wxCommandEvent& event); void ChooseMemcardPath(std::string& strMemcard, bool isSlotA); void ChooseSIDevice(std::string deviceName, int deviceNum); void ChooseEXIDevice(std::string deviceName, int deviceNum); + void WiiSettingsChanged(wxCommandEvent& event); + void ISOPathsSelectionChanged(wxCommandEvent& event); void RecursiveDirectoryChanged(wxCommandEvent& event); void AddRemoveISOPaths(wxCommandEvent& event); @@ -277,6 +308,6 @@ private: void FillChoiceBox(wxChoice* _pChoice, int _PluginType, const std::string& _SelectFilename); void CallConfig(wxChoice* _pChoice); bool GetFilename(wxChoice* _pChoice, std::string& _rFilename); - void AddResolutions(); + DECLARE_EVENT_TABLE(); }; #endif diff --git a/Source/Core/DolphinWX/Src/Frame.cpp b/Source/Core/DolphinWX/Src/Frame.cpp index 4795bcf0cc..75c3f06440 100644 --- a/Source/Core/DolphinWX/Src/Frame.cpp +++ b/Source/Core/DolphinWX/Src/Frame.cpp @@ -357,7 +357,6 @@ CFrame::CFrame(wxFrame* parent, #if wxUSE_TIMER , m_timer(this) #endif - { if (ShowLogWindow) SConfig::GetInstance().m_InterfaceLogWindow = true; @@ -616,7 +615,7 @@ void CFrame::OnMove(wxMoveEvent& event) event.Skip(); if (!IsMaximized() && - !(SConfig::GetInstance().m_LocalCoreStartupParameter.bRenderToMain && RendererIsFullscreen())) + !(SConfig::GetInstance().m_LocalCoreStartupParameter.bRenderToMain && RendererIsFullscreen())) { SConfig::GetInstance().m_LocalCoreStartupParameter.iPosX = GetPosition().x; SConfig::GetInstance().m_LocalCoreStartupParameter.iPosY = GetPosition().y; @@ -627,7 +626,7 @@ void CFrame::OnResize(wxSizeEvent& event) { event.Skip(); if (!IsMaximized() && - !(SConfig::GetInstance().m_LocalCoreStartupParameter.bRenderToMain && RendererIsFullscreen())) + !(SConfig::GetInstance().m_LocalCoreStartupParameter.bRenderToMain && RendererIsFullscreen())) { SConfig::GetInstance().m_LocalCoreStartupParameter.iWidth = GetSize().GetWidth(); SConfig::GetInstance().m_LocalCoreStartupParameter.iHeight = GetSize().GetHeight(); @@ -745,7 +744,7 @@ bool CFrame::RendererHasFocus() // Host_RendererHasFocus()? if (m_RenderParent) if (m_RenderParent->GetParent()->GetHWND() == GetForegroundWindow()) - return true; + return true; return false; #else return m_RenderParent && (m_RenderParent == wxWindow::FindFocus()); @@ -930,15 +929,17 @@ wxFrame * CFrame::CreateParentFrame(wxWindowID Id, const wxString& Title, wxWind Frame->Show(); return Frame; } + wxPanel* CFrame::CreateEmptyPanel(wxWindowID Id) -{ - wxPanel* Panel = new wxPanel(this, Id); - return Panel; +{ + wxPanel* Panel = new wxPanel(this, Id); + return Panel; } + wxAuiNotebook* CFrame::CreateEmptyNotebook() -{ - wxAuiNotebook* NB = new wxAuiNotebook(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, NOTEBOOK_STYLE); - return NB; +{ + wxAuiNotebook* NB = new wxAuiNotebook(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, NOTEBOOK_STYLE); + return NB; } void CFrame::DoFullscreen(bool bF) @@ -1034,22 +1035,22 @@ void CFrame::ListChildren() void CFrame::ListTopWindows() { - wxWindowList::const_iterator i; + wxWindowList::const_iterator i; int j = 0; - const wxWindowList::const_iterator end = wxTopLevelWindows.end(); + const wxWindowList::const_iterator end = wxTopLevelWindows.end(); - for (i = wxTopLevelWindows.begin(); i != end; ++i) - { - wxTopLevelWindow * const Win = wx_static_cast(wxTopLevelWindow *, *i); + for (i = wxTopLevelWindows.begin(); i != end; ++i) + { + wxTopLevelWindow * const Win = wx_static_cast(wxTopLevelWindow *, *i); NOTICE_LOG(CONSOLE, "%i: %i %s", j, Win, (const char *)Win->GetTitle().mb_str()); /* - if ( win->ShouldPreventAppExit() ) - { - // there remains at least one important TLW, don't exit - return false; - } + if ( win->ShouldPreventAppExit() ) + { + // there remains at least one important TLW, don't exit + return false; + } */ j++; - } + } NOTICE_LOG(CONSOLE, "\n"); } diff --git a/Source/Core/DolphinWX/Src/FrameTools.cpp b/Source/Core/DolphinWX/Src/FrameTools.cpp index e87e996b65..211c5811d2 100644 --- a/Source/Core/DolphinWX/Src/FrameTools.cpp +++ b/Source/Core/DolphinWX/Src/FrameTools.cpp @@ -316,7 +316,7 @@ wxString CFrame::GetMenuLabel(int Id) void CFrame::PopulateToolbar(wxAuiToolBar* ToolBar) { int w = m_Bitmaps[Toolbar_FileOpen].GetWidth(), - h = m_Bitmaps[Toolbar_FileOpen].GetHeight(); + h = m_Bitmaps[Toolbar_FileOpen].GetHeight(); ToolBar->SetToolBitmapSize(wxSize(w, h)); @@ -549,7 +549,7 @@ void CFrame::OnOpen(wxCommandEvent& WXUNUSED (event)) void CFrame::DoOpen(bool Boot) { - std::string currentDir = File::GetCurrentDir(); + std::string currentDir = File::GetCurrentDir(); wxString path = wxFileSelector( _T("Select the file to load"), @@ -565,13 +565,13 @@ void CFrame::DoOpen(bool Boot) bool fileChosen = !path.IsEmpty(); - std::string currentDir2 = File::GetCurrentDir(); + std::string currentDir2 = File::GetCurrentDir(); - if (currentDir != currentDir2) - { - PanicAlert("Current dir changed from %s to %s after wxFileSelector!",currentDir.c_str(),currentDir2.c_str()); - File::SetCurrentDir(currentDir.c_str()); - } + if (currentDir != currentDir2) + { + PanicAlert("Current dir changed from %s to %s after wxFileSelector!",currentDir.c_str(),currentDir2.c_str()); + File::SetCurrentDir(currentDir.c_str()); + } // Should we boot a new game or just change the disc? @@ -1311,7 +1311,7 @@ void CFrame::UpdateGUI() } else { - // Game has been loaded, enable the play button + // Game has been loaded, enable the pause button if (m_ToolBar) m_ToolBar->EnableTool(IDM_PLAY, true); GetMenuBar()->FindItem(IDM_PLAY)->Enable(true); @@ -1424,4 +1424,3 @@ void CFrame::OnToggleStatusbar(wxCommandEvent& event) this->SendSizeEvent(); } - diff --git a/Source/Core/DolphinWX/Src/Main.cpp b/Source/Core/DolphinWX/Src/Main.cpp index 16093e4a09..be95d24bd5 100644 --- a/Source/Core/DolphinWX/Src/Main.cpp +++ b/Source/Core/DolphinWX/Src/Main.cpp @@ -189,25 +189,25 @@ bool DolphinApp::OnInit() return false; } #if wxCHECK_VERSION(2, 9, 0) - UseDebugger = parser.Found("debugger"); - UseLogger = parser.Found("logger"); - LoadElf = parser.Found("elf", &ElfFile); + UseDebugger = parser.Found(wxT("debugger")); + UseLogger = parser.Found(wxT("logger")); + LoadElf = parser.Found(wxT("elf"), &ElfFile); #else - UseDebugger = parser.Found(_("debugger")); - UseLogger = parser.Found(_("logger")); - LoadElf = parser.Found(_("elf"), &ElfFile); + UseDebugger = parser.Found(wxT("debugger")); + UseLogger = parser.Found(wxT("logger")); + LoadElf = parser.Found(wxT("elf"), &ElfFile); #endif #if wxCHECK_VERSION(2, 9, 0) - selectVideoPlugin = parser.Found("video_plugin", &videoPluginFilename); - selectAudioPlugin = parser.Found("audio_plugin", &audioPluginFilename); - selectPadPlugin = parser.Found("pad_plugin", &padPluginFilename); - selectWiimotePlugin = parser.Found("wiimote_plugin", &wiimotePluginFilename); + selectVideoPlugin = parser.Found(wxT("video_plugin"), &videoPluginFilename); + selectAudioPlugin = parser.Found(wxT("audio_plugin"), &audioPluginFilename); + selectPadPlugin = parser.Found(wxT"pad_plugin", &padPluginFilename); + selectWiimotePlugin = parser.Found(wxT("wiimote_plugin"), &wiimotePluginFilename); #else - selectVideoPlugin = parser.Found(_T("video_plugin"), &videoPluginFilename); - selectAudioPlugin = parser.Found(_T("audio_plugin"), &audioPluginFilename); + selectVideoPlugin = parser.Found(wxT("video_plugin"), &videoPluginFilename); + selectAudioPlugin = parser.Found(wxT("audio_plugin"), &audioPluginFilename); selectPadPlugin = parser.Found(_T("pad_plugin"), &padPluginFilename); - selectWiimotePlugin = parser.Found(_T("wiimote_plugin"), &wiimotePluginFilename); + selectWiimotePlugin = parser.Found(wxT("wiimote_plugin"), &wiimotePluginFilename); #endif #endif // wxUSE_CMDLINE_PARSER @@ -324,21 +324,21 @@ bool DolphinApp::OnInit() File::CopyDir(SHARED_USER_DIR WII_USER_DIR DIR_SEP, File::GetUserPath(D_WIIUSER_IDX)); if (!File::Exists(File::GetUserPath(D_GCUSER_IDX))) - File::CreateFullPath(File::GetUserPath(D_GCUSER_IDX)); + File::CreateFullPath(File::GetUserPath(D_GCUSER_IDX)); if (!File::Exists(File::GetUserPath(D_CACHE_IDX))) - File::CreateFullPath(File::GetUserPath(D_CACHE_IDX)); + File::CreateFullPath(File::GetUserPath(D_CACHE_IDX)); if (!File::Exists(File::GetUserPath(D_DUMPDSP_IDX))) - File::CreateFullPath(File::GetUserPath(D_DUMPDSP_IDX)); + File::CreateFullPath(File::GetUserPath(D_DUMPDSP_IDX)); if (!File::Exists(File::GetUserPath(D_DUMPTEXTURES_IDX))) - File::CreateFullPath(File::GetUserPath(D_DUMPTEXTURES_IDX)); + File::CreateFullPath(File::GetUserPath(D_DUMPTEXTURES_IDX)); if (!File::Exists(File::GetUserPath(D_HIRESTEXTURES_IDX))) - File::CreateFullPath(File::GetUserPath(D_HIRESTEXTURES_IDX)); + File::CreateFullPath(File::GetUserPath(D_HIRESTEXTURES_IDX)); if (!File::Exists(File::GetUserPath(D_SCREENSHOTS_IDX))) - File::CreateFullPath(File::GetUserPath(D_SCREENSHOTS_IDX)); + File::CreateFullPath(File::GetUserPath(D_SCREENSHOTS_IDX)); if (!File::Exists(File::GetUserPath(D_STATESAVES_IDX))) - File::CreateFullPath(File::GetUserPath(D_STATESAVES_IDX)); + File::CreateFullPath(File::GetUserPath(D_STATESAVES_IDX)); if (!File::Exists(File::GetUserPath(D_MAILLOGS_IDX))) - File::CreateFullPath(File::GetUserPath(D_MAILLOGS_IDX)); + File::CreateFullPath(File::GetUserPath(D_MAILLOGS_IDX)); #endif LogManager::Init(); @@ -352,7 +352,7 @@ bool DolphinApp::OnInit() if (selectAudioPlugin && audioPluginFilename != wxEmptyString) SConfig::GetInstance().m_LocalCoreStartupParameter.m_strDSPPlugin = - std::string(audioPluginFilename.mb_str()); + std::string(audioPluginFilename.mb_str()); if (selectPadPlugin && padPluginFilename != wxEmptyString) { @@ -367,7 +367,7 @@ bool DolphinApp::OnInit() int k; for(k=0;kBootGame(std::string(ElfFile.mb_str())); @@ -493,7 +491,7 @@ void Host_SysMessage(const char *fmt, ...) bool wxMsgAlert(const char* caption, const char* text, bool yes_no, int /*Style*/) { - return wxYES == wxMessageBox(wxString::FromAscii(text), + return wxYES == wxMessageBox(wxString::FromAscii(text), wxString::FromAscii(caption), (yes_no)?wxYES_NO:wxOK); } diff --git a/Source/Core/InputCommon/Src/ControllerInterface/DirectInput/DirectInputJoystick.cpp b/Source/Core/InputCommon/Src/ControllerInterface/DirectInput/DirectInputJoystick.cpp index 7731577629..c1234f7f4c 100644 --- a/Source/Core/InputCommon/Src/ControllerInterface/DirectInput/DirectInputJoystick.cpp +++ b/Source/Core/InputCommon/Src/ControllerInterface/DirectInput/DirectInputJoystick.cpp @@ -455,7 +455,7 @@ std::string Joystick::Axis::GetName() const { std::ostringstream ss; // axis - if ( m_index < 6 ) + if ( m_index < 6 ) { ss << "Axis " << "XYZ"[m_index%3]; if ( m_index > 2 ) diff --git a/Source/Core/InputCommon/Src/SDL_Util.cpp b/Source/Core/InputCommon/Src/SDL_Util.cpp index cf97a608fb..0ae94ad95e 100644 --- a/Source/Core/InputCommon/Src/SDL_Util.cpp +++ b/Source/Core/InputCommon/Src/SDL_Util.cpp @@ -56,7 +56,7 @@ bool SearchDevices(std::vector &_joyinfo, int &_NumPads, int &_ // Get device status int numjoy = SDL_NumJoysticks(); - for (int i = 0; i < numjoy; i++ ) + for (int i = 0; i < numjoy; i++) { CONTROLLER_INFO Tmp; @@ -97,16 +97,16 @@ bool SearchDevices(std::vector &_joyinfo, int &_NumPads, int &_ // Avoid extreme axis values // --------------------- -/* Function: We have to avoid very big values to becuse some triggers are -0x8000 in the +/* Function: We have to avoid very big values because some triggers are -0x8000 in the unpressed state (and then go from -0x8000 to 0x8000 as they are fully pressed) */ bool AvoidValues(int value, bool NoTriggerFilter) { // Avoid detecting very small or very big (for triggers) values - if( (value > -0x1000 && value < 0x1000) // Small values + if((value > -0x1000 && value < 0x1000) // Small values || ((value < -0x7000 || value > 0x7000) && !NoTriggerFilter)) // Big values return true; // Avoid else - return false; // Keep + return false; // Keep } @@ -141,14 +141,14 @@ void GetButton(SDL_Joystick *joy, int ControllerID, int buttons, int axes, int h if(Hat) { for(int i = 0; i < hats; i++) - { + { value = SDL_JoystickGetHat(joy, i); if(value) { pressed = i; type = InputCommon::CTL_HAT; Succeed = true; - } + } } } @@ -156,7 +156,7 @@ void GetButton(SDL_Joystick *joy, int ControllerID, int buttons, int axes, int h if(Button) { for(int i = 0; i < buttons; i++) - { + { // Some kind of bug in SDL 1.3 would give button 9 and 10 (nonexistent) the value 48 on the 360 pad if (SDL_JoystickGetButton(joy, i) > 1) continue; @@ -174,7 +174,7 @@ void GetButton(SDL_Joystick *joy, int ControllerID, int buttons, int axes, int h if(XInput && LeftRight) { for(int i = 0; i <= InputCommon::XI_TRIGGER_R; i++) - { + { if(XInput::GetXI(ControllerID, i)) { pressed = i + 1000; @@ -209,7 +209,7 @@ void GetButton(SDL_Joystick *joy, int ControllerID, int buttons, int axes, int h } // Only accept the escape key else if (KeyboardKey == WXK_ESCAPE) - { + { Succeed = true; KeyboardKey = 0; pressed = -1; diff --git a/Source/Core/InputCommon/Src/XInput_Util.cpp b/Source/Core/InputCommon/Src/XInput_Util.cpp index 0e9d6f4b24..88e0d0e54c 100644 --- a/Source/Core/InputCommon/Src/XInput_Util.cpp +++ b/Source/Core/InputCommon/Src/XInput_Util.cpp @@ -48,9 +48,10 @@ namespace XInput struct CONTROLER_STATE { - XINPUT_STATE state; - bool bConnected; + XINPUT_STATE state; + bool bConnected; }; + CONTROLER_STATE g_Controllers[MAX_CONTROLLERS]; @@ -61,33 +62,32 @@ CONTROLER_STATE g_Controllers[MAX_CONTROLLERS]; we currently only try to connect to XInput device 0 */ void Init() { - // Init state - //ZeroMemory( g_Controllers, sizeof( CONTROLER_STATE ) * MAX_CONTROLLERS ); + // Init state + //ZeroMemory( g_Controllers, sizeof( CONTROLER_STATE ) * MAX_CONTROLLERS ); // Declaration DWORD dwResult; // Calculate the number of connected XInput devices for( DWORD i = 0; i < MAX_CONTROLLERS; i++ ) - { - // Simply get the state of the controller from XInput. - dwResult = XInputGetState( i, &g_Controllers[i].state ); + { + // Simply get the state of the controller from XInput. + dwResult = XInputGetState( i, &g_Controllers[i].state ); - if( dwResult == ERROR_SUCCESS ) - g_Controllers[i].bConnected = true; - else - g_Controllers[i].bConnected = false; - } - -} + if( dwResult == ERROR_SUCCESS ) + g_Controllers[i].bConnected = true; + else + g_Controllers[i].bConnected = false; + } +} // Get the trigger status // ------------------- int GetXI(int Controller, int Button) { // Update the internal status - DWORD dwResult; + DWORD dwResult; dwResult = XInputGetState(Controller, &g_Controllers[Controller].state); if (dwResult != ERROR_SUCCESS) return -1; @@ -105,7 +105,6 @@ int GetXI(int Controller, int Button) } } - // Check if a certain controller is connected // ------------------- bool IsConnected(int Controller) diff --git a/Source/Core/InputCommon/Src/XInput_Util.h b/Source/Core/InputCommon/Src/XInput_Util.h index fd4b23bb98..411e1958a0 100644 --- a/Source/Core/InputCommon/Src/XInput_Util.h +++ b/Source/Core/InputCommon/Src/XInput_Util.h @@ -36,7 +36,6 @@ void Init(); int GetXI(int Controller, int Button); bool IsConnected(int Controller); - } // XInput #endif diff --git a/Source/Core/VideoCommon/Src/BPStructs.cpp b/Source/Core/VideoCommon/Src/BPStructs.cpp index 2a0fecf0a3..e620f80b43 100644 --- a/Source/Core/VideoCommon/Src/BPStructs.cpp +++ b/Source/Core/VideoCommon/Src/BPStructs.cpp @@ -17,6 +17,7 @@ #include +#include "VideoConfig.h" #include "Profiler.h" #include "Statistics.h" #include "Render.h" @@ -35,8 +36,8 @@ using namespace BPFunctions; void BPInit() { - memset(&bpmem, 0, sizeof(bpmem)); - bpmem.bpMask = 0xFFFFFF; + memset(&bpmem, 0, sizeof(bpmem)); + bpmem.bpMask = 0xFFFFFF; } void RenderToXFB(const BPCmd &bp, const EFBRectangle &rc, float yScale, float xfbLines, u32 xfbAddr, const u32 dstWidth, const u32 dstHeight) @@ -46,22 +47,22 @@ void RenderToXFB(const BPCmd &bp, const EFBRectangle &rc, float yScale, float xf void BPWritten(const BPCmd& bp) { - /* - ---------------------------------------------------------------------------------------------------------------- - Purpose: Writes to the BP registers - Called: At the end of every: OpcodeDecoding.cpp ExecuteDisplayList > Decode() > LoadBPReg - How It Works: First the pipeline is flushed then update the bpmem with the new value. - Some of the BP cases have to call certain functions while others just update the bpmem. - some bp cases check the changes variable, because they might not have to be updated all the time - NOTE: it seems not all bp cases like checking changes, so calling if (bp.changes == 0 ? false : true) - had to be ditched and the games seem to work fine with out it. - NOTE2: Yet Another Gamecube Documentation calls them Bypass Raster State Registers but possibly completely wrong - NOTE3: This controls the register groups: RAS1/2, SU, TF, TEV, C/Z, PEC - TODO: Turn into function table. The (future) DisplayList (DL) jit can then call the functions directly, - getting rid of dynamic dispatch. Unfortunately, few games use DLs properly - most\ - just stuff geometry in them and don't put state changes there. - ---------------------------------------------------------------------------------------------------------------- - */ + /* + ---------------------------------------------------------------------------------------------------------------- + Purpose: Writes to the BP registers + Called: At the end of every: OpcodeDecoding.cpp ExecuteDisplayList > Decode() > LoadBPReg + How It Works: First the pipeline is flushed then update the bpmem with the new value. + Some of the BP cases have to call certain functions while others just update the bpmem. + some bp cases check the changes variable, because they might not have to be updated all the time + NOTE: it seems not all bp cases like checking changes, so calling if (bp.changes == 0 ? false : true) + had to be ditched and the games seem to work fine with out it. + NOTE2: Yet Another Gamecube Documentation calls them Bypass Raster State Registers but possibly completely wrong + NOTE3: This controls the register groups: RAS1/2, SU, TF, TEV, C/Z, PEC + TODO: Turn into function table. The (future) DisplayList (DL) jit can then call the functions directly, + getting rid of dynamic dispatch. Unfortunately, few games use DLs properly - most\ + just stuff geometry in them and don't put state changes there + ---------------------------------------------------------------------------------------------------------------- + */ // Debugging only, this lets you skip a bp update //static int times = 0; @@ -83,13 +84,13 @@ void BPWritten(const BPCmd& bp) //s_bpCritical.Enter(); FlushPipeline(); - ((u32*)&bpmem)[bp.address] = bp.newvalue; + ((u32*)&bpmem)[bp.address] = bp.newvalue; switch (bp.address) { case BPMEM_GENMODE: // Set the Generation Mode { - PRIM_LOG("genmode: texgen=%d, col=%d, ms_en=%d, tev=%d, culmode=%d, ind=%d, zfeeze=%d", + PRIM_LOG("genmode: texgen=%d, col=%d, ms_en=%d, tev=%d, cullmode=%d, ind=%d, zfeeze=%d", bpmem.genMode.numtexgens, bpmem.genMode.numcolchans, bpmem.genMode.ms_en, bpmem.genMode.numtevstages+1, bpmem.genMode.cullmode, bpmem.genMode.numindstages, bpmem.genMode.zfreeze); @@ -108,9 +109,9 @@ void BPWritten(const BPCmd& bp) PixelShaderManager::SetIndMatrixChanged((bp.address - BPMEM_IND_MTXA) / 3); break; case BPMEM_RAS1_SS0: // Index Texture Coordinate Scale 0 - PixelShaderManager::SetIndTexScaleChanged(0x03); + PixelShaderManager::SetIndTexScaleChanged(0x03); case BPMEM_RAS1_SS1: // Index Texture Coordinate Scale 1 - PixelShaderManager::SetIndTexScaleChanged(0x0c); + PixelShaderManager::SetIndTexScaleChanged(0x0c); break; // ---------------- // Scissor Control @@ -159,31 +160,31 @@ void BPWritten(const BPCmd& bp) // This is called when the game is done drawing the new frame (eg: like in DX: Begin(); Draw(); End();) // Triggers an interrupt on the PPC side so that the game knows when the GPU has finished drawing. // Tokens are similar. - case BPMEM_SETDRAWDONE: + case BPMEM_SETDRAWDONE: switch (bp.newvalue & 0xFF) - { - case 0x02: - PixelEngine::SetFinish(); // may generate interrupt - DEBUG_LOG(VIDEO, "GXSetDrawDone SetPEFinish (value: 0x%02X)", (bp.newvalue & 0xFFFF)); - break; + { + case 0x02: + PixelEngine::SetFinish(); // may generate interrupt + DEBUG_LOG(VIDEO, "GXSetDrawDone SetPEFinish (value: 0x%02X)", (bp.newvalue & 0xFFFF)); + break; - default: - WARN_LOG(VIDEO, "GXSetDrawDone ??? (value 0x%02X)", (bp.newvalue & 0xFFFF)); - break; - } - break; + default: + WARN_LOG(VIDEO, "GXSetDrawDone ??? (value 0x%02X)", (bp.newvalue & 0xFFFF)); + break; + } + break; case BPMEM_PE_TOKEN_ID: // Pixel Engine Token ID - PixelEngine::SetToken(static_cast(bp.newvalue & 0xFFFF), FALSE); - DEBUG_LOG(VIDEO, "SetPEToken 0x%04x", (bp.newvalue & 0xFFFF)); - break; - case BPMEM_PE_TOKEN_INT_ID: // Pixel Engine Interrupt Token ID - PixelEngine::SetToken(static_cast(bp.newvalue & 0xFFFF), TRUE); - DEBUG_LOG(VIDEO, "SetPEToken + INT 0x%04x", (bp.newvalue & 0xFFFF)); - break; + PixelEngine::SetToken(static_cast(bp.newvalue & 0xFFFF), FALSE); + DEBUG_LOG(VIDEO, "SetPEToken 0x%04x", (bp.newvalue & 0xFFFF)); + break; + case BPMEM_PE_TOKEN_INT_ID: // Pixel Engine Interrupt Token ID + PixelEngine::SetToken(static_cast(bp.newvalue & 0xFFFF), TRUE); + DEBUG_LOG(VIDEO, "SetPEToken + INT 0x%04x", (bp.newvalue & 0xFFFF)); + break; // ------------------------ // EFB copy command. This copies a rectangle from the EFB to either RAM in a texture format or to XFB as YUYV. // It can also optionally clear the EFB while copying from it. To emulate this, we of course copy first and clear afterwards. - case BPMEM_TRIGGER_EFB_COPY: // Copy EFB Region or Render to the XFB or Clear the screen. + case BPMEM_TRIGGER_EFB_COPY: // Copy EFB Region or Render to the XFB or Clear the screen. { DVSTARTSUBPROFILE("LoadBPReg:swap"); // The bottom right is within the rectangle @@ -200,7 +201,7 @@ void BPWritten(const BPCmd& bp) // Check if we are to copy from the EFB or draw to the XFB if (PE_copy.copy_to_xfb == 0) { - if (GetConfig(CONFIG_SHOWEFBREGIONS)) + if (GetConfig(CONFIG_SHOWEFBREGIONS)) stats.efb_regions.push_back(rc); CopyEFB(bp, rc, bpmem.copyTexDest << 5, @@ -244,21 +245,21 @@ void BPWritten(const BPCmd& bp) } RestoreRenderState(bp); - + break; } case BPMEM_LOADTLUT0: // This one updates bpmem.tlutXferSrc, no need to do anything here. break; case BPMEM_LOADTLUT1: // Load a Texture Look Up Table - { - DVSTARTSUBPROFILE("LoadBPReg:GXLoadTlut"); + { + DVSTARTSUBPROFILE("LoadBPReg:GXLoadTlut"); - u32 tlutTMemAddr = (bp.newvalue & 0x3FF) << 9; - u32 tlutXferCount = (bp.newvalue & 0x1FFC00) >> 5; + u32 tlutTMemAddr = (bp.newvalue & 0x3FF) << 9; + u32 tlutXferCount = (bp.newvalue & 0x1FFC00) >> 5; u8 *ptr = 0; - // TODO - figure out a cleaner way. + // TODO - figure out a cleaner way. if (GetConfig(CONFIG_ISWII)) ptr = GetPointer(bpmem.tlutXferSrc << 5); else @@ -269,10 +270,10 @@ void BPWritten(const BPCmd& bp) else PanicAlert("Invalid palette pointer %08x %08x %08x", bpmem.tlutXferSrc, bpmem.tlutXferSrc << 5, (bpmem.tlutXferSrc & 0xFFFFF)<< 5); - // TODO(ector) : kill all textures that use this palette - // Not sure if it's a good idea, though. For now, we hash texture palettes + // TODO(ector) : kill all textures that use this palette + // Not sure if it's a good idea, though. For now, we hash texture palettes break; - } + } case BPMEM_FOGRANGE: // Fog Settings Control case BPMEM_FOGRANGE+1: case BPMEM_FOGRANGE+2: @@ -293,15 +294,15 @@ void BPWritten(const BPCmd& bp) case BPMEM_ALPHACOMPARE: // Compare Alpha Values PRIM_LOG("alphacmp: ref0=%d, ref1=%d, comp0=%d, comp1=%d, logic=%d", bpmem.alphaFunc.ref0, bpmem.alphaFunc.ref1, bpmem.alphaFunc.comp0, bpmem.alphaFunc.comp1, bpmem.alphaFunc.logic); - PixelShaderManager::SetAlpha(bpmem.alphaFunc); + PixelShaderManager::SetAlpha(bpmem.alphaFunc); break; case BPMEM_BIAS: // BIAS PRIM_LOG("ztex bias=0x%x", bpmem.ztex1.bias); - PixelShaderManager::SetZTextureBias(bpmem.ztex1.bias); + PixelShaderManager::SetZTextureBias(bpmem.ztex1.bias); break; case BPMEM_ZTEX2: // Z Texture type { - if (bp.changes & 3) + if (bp.changes & 3) PixelShaderManager::SetZTextureTypeChanged(); #if defined(_DEBUG) || defined(DEBUGFAST) const char* pzop[] = {"DISABLE", "ADD", "REPLACE", "?"}; @@ -381,8 +382,8 @@ void BPWritten(const BPCmd& bp) } #endif break; - } - case BPMEM_TEXINVALIDATE: // Used, if game has manual control the Texture Cache, which we don't allow + } + case BPMEM_TEXINVALIDATE: // Used, if game has manual control the Texture Cache, which we don't allow DEBUG_LOG(VIDEO, "BP Texture Invalid: %08x", bp.newvalue); case BPMEM_ZCOMPARE: // Set the Z-Compare and EFB pixel format case BPMEM_MIPMAP_STRIDE: // MipMap Stride Channel @@ -395,7 +396,7 @@ void BPWritten(const BPCmd& bp) 9 BC1 - Ind. Tex Stage 1 NTexCoord 6 BI1 - Ind. Tex Stage 1 NTexMap 3 BC0 - Ind. Tex Stage 0 NTexCoord - 0 BI0 - Ind. Tex Stage 0 NTexMap */ + 0 BI0 - Ind. Tex Stage 0 NTexMap*/ case BPMEM_TEV_KSEL: // Texture Environment Swap Mode Table 0 case BPMEM_TEV_KSEL+1:// Texture Environment Swap Mode Table 1 case BPMEM_TEV_KSEL+2:// Texture Environment Swap Mode Table 2 @@ -405,7 +406,7 @@ void BPWritten(const BPCmd& bp) case BPMEM_TEV_KSEL+6:// Texture Environment Swap Mode Table 6 case BPMEM_TEV_KSEL+7:// Texture Environment Swap Mode Table 7 case BPMEM_BP_MASK: // This Register can be used to limit to which bits of BP registers is actually written to. the mask is - // only valid for the next BP command, and will reset itself. + // only valid for the next BP command, and will reset itself. case BPMEM_IND_IMASK: // Index Mask ? case BPMEM_REVBITS: // Always set to 0x0F when GX_InitRevBits() is called. break; @@ -439,7 +440,7 @@ void BPWritten(const BPCmd& bp) break; // ---------------------- // Set wrap size - // ---------------------- + // ---------------------- case BPMEM_SU_SSIZE: case BPMEM_SU_TSIZE: case BPMEM_SU_SSIZE+2: @@ -456,12 +457,12 @@ void BPWritten(const BPCmd& bp) case BPMEM_SU_TSIZE+12: case BPMEM_SU_SSIZE+14: case BPMEM_SU_TSIZE+14: - PixelShaderManager::SetTexCoordChanged((bp.address - BPMEM_SU_SSIZE) >> 1); + PixelShaderManager::SetTexCoordChanged((bp.address - BPMEM_SU_SSIZE) >> 1); break; // ------------------------ // BPMEM_TX_SETMODE0 - (Texture lookup and filtering mode) LOD/BIAS Clamp, MaxAnsio, LODBIAS, DiagLoad, Min Filter, Mag Filter, Wrap T, S // BPMEM_TX_SETMODE1 - (LOD Stuff) - Max LOD, Min LOD - // ------------------------ + // ------------------------ case BPMEM_TX_SETMODE0: // (0x90 for linear) case BPMEM_TX_SETMODE0_4: // Shouldn't need to call this here, we call it for each active texture right before rendering @@ -476,7 +477,7 @@ void BPWritten(const BPCmd& bp) // BPMEM_TX_SETIMAGE1 - even LOD address in TMEM - Image Type, Cache Height, Cache Width, TMEM Offset // BPMEM_TX_SETIMAGE2 - odd LOD address in TMEM - Cache Height, Cache Width, TMEM Offset // BPMEM_TX_SETIMAGE3 - Address of Texture in main memory - // -------------------------------------------- + // -------------------------------------------- case BPMEM_TX_SETIMAGE0: case BPMEM_TX_SETIMAGE0_4: case BPMEM_TX_SETIMAGE1: @@ -489,14 +490,14 @@ void BPWritten(const BPCmd& bp) // ------------------------------- // Set a TLUT // BPMEM_TX_SETTLUT - Format, TMEM Offset (offset of TLUT from start of TMEM high bank > > 5) - // ------------------------------- + // ------------------------------- case BPMEM_TX_SETTLUT: case BPMEM_TX_SETLUT_4: break; // --------------------------------------------------- // Set the TEV Color - // --------------------------------------------------- + // --------------------------------------------------- case BPMEM_TEV_REGISTER_L: // Reg 1 case BPMEM_TEV_REGISTER_H: case BPMEM_TEV_REGISTER_L+2: // Reg 2 diff --git a/Source/Core/VideoCommon/Src/VertexShaderManager.cpp b/Source/Core/VideoCommon/Src/VertexShaderManager.cpp index 6569fb0b89..d7d1d83df2 100644 --- a/Source/Core/VideoCommon/Src/VertexShaderManager.cpp +++ b/Source/Core/VideoCommon/Src/VertexShaderManager.cpp @@ -138,8 +138,8 @@ void VertexShaderManager::Init() Dirty(); memset(&xfregs, 0, sizeof(xfregs)); - memset(xfmem, 0, sizeof(xfmem)); - ResetView(); + memset(xfmem, 0, sizeof(xfmem)); + ResetView(); } void VertexShaderManager::Shutdown() @@ -163,154 +163,154 @@ void VertexShaderManager::Dirty() // TODO: A cleaner way to control the matricies without making a mess in the parameters field void VertexShaderManager::SetConstants() { - if (nTransformMatricesChanged[0] >= 0) + if (nTransformMatricesChanged[0] >= 0) { - int startn = nTransformMatricesChanged[0] / 4; - int endn = (nTransformMatricesChanged[1] + 3) / 4; - const float* pstart = (const float*)&xfmem[startn * 4]; + int startn = nTransformMatricesChanged[0] / 4; + int endn = (nTransformMatricesChanged[1] + 3) / 4; + const float* pstart = (const float*)&xfmem[startn * 4]; SetMultiVSConstant4fv(C_TRANSFORMMATRICES + startn, endn - startn, pstart); - nTransformMatricesChanged[0] = nTransformMatricesChanged[1] = -1; - } - if (nNormalMatricesChanged[0] >= 0) + nTransformMatricesChanged[0] = nTransformMatricesChanged[1] = -1; + } + if (nNormalMatricesChanged[0] >= 0) { - int startn = nNormalMatricesChanged[0] / 3; - int endn = (nNormalMatricesChanged[1] + 2) / 3; - const float *pnstart = (const float*)&xfmem[XFMEM_NORMALMATRICES+3*startn]; - SetMultiVSConstant3fv(C_NORMALMATRICES + startn, endn - startn, pnstart); + int startn = nNormalMatricesChanged[0] / 3; + int endn = (nNormalMatricesChanged[1] + 2) / 3; + const float *pnstart = (const float*)&xfmem[XFMEM_NORMALMATRICES+3*startn]; + SetMultiVSConstant3fv(C_NORMALMATRICES + startn, endn - startn, pnstart); nNormalMatricesChanged[0] = nNormalMatricesChanged[1] = -1; - } + } - if (nPostTransformMatricesChanged[0] >= 0) + if (nPostTransformMatricesChanged[0] >= 0) { - int startn = nPostTransformMatricesChanged[0] / 4; - int endn = (nPostTransformMatricesChanged[1] + 3 ) / 4; - const float* pstart = (const float*)&xfmem[XFMEM_POSTMATRICES + startn * 4]; - SetMultiVSConstant4fv(C_POSTTRANSFORMMATRICES + startn, endn - startn, pstart); - } + int startn = nPostTransformMatricesChanged[0] / 4; + int endn = (nPostTransformMatricesChanged[1] + 3 ) / 4; + const float* pstart = (const float*)&xfmem[XFMEM_POSTMATRICES + startn * 4]; + SetMultiVSConstant4fv(C_POSTTRANSFORMMATRICES + startn, endn - startn, pstart); + } - if (nLightsChanged[0] >= 0) + if (nLightsChanged[0] >= 0) { - // lights don't have a 1 to 1 mapping, the color component needs to be converted to 4 floats - int istart = nLightsChanged[0] / 0x10; - int iend = (nLightsChanged[1] + 15) / 0x10; - const float* xfmemptr = (const float*)&xfmem[0x10 * istart + XFMEM_LIGHTS]; + // lights don't have a 1 to 1 mapping, the color component needs to be converted to 4 floats + int istart = nLightsChanged[0] / 0x10; + int iend = (nLightsChanged[1] + 15) / 0x10; + const float* xfmemptr = (const float*)&xfmem[0x10 * istart + XFMEM_LIGHTS]; - for (int i = istart; i < iend; ++i) + for (int i = istart; i < iend; ++i) { - u32 color = *(const u32*)(xfmemptr + 3); + u32 color = *(const u32*)(xfmemptr + 3); float NormalizationCoef = 1 / 255.0f; - SetVSConstant4f(C_LIGHTS + 5 * i, - ((color >> 24) & 0xFF) * NormalizationCoef, + SetVSConstant4f(C_LIGHTS + 5 * i, + ((color >> 24) & 0xFF) * NormalizationCoef, ((color >> 16) & 0xFF) * NormalizationCoef, ((color >> 8) & 0xFF) * NormalizationCoef, ((color) & 0xFF) * NormalizationCoef); - xfmemptr += 4; + xfmemptr += 4; - for (int j = 0; j < 4; ++j, xfmemptr += 3) + for (int j = 0; j < 4; ++j, xfmemptr += 3) { if (j == 1 && fabs(xfmemptr[0]) < 0.00001f && fabs(xfmemptr[1]) < 0.00001f && - fabs(xfmemptr[2]) < 0.00001f) + fabs(xfmemptr[2]) < 0.00001f) { - // dist attenuation, make sure not equal to 0!!! - SetVSConstant4f(C_LIGHTS+5*i+j+1, 0.00001f, xfmemptr[1], xfmemptr[2], 0); - } - else - SetVSConstant4fv(C_LIGHTS+5*i+j+1, xfmemptr); - } - } + // dist attenuation, make sure not equal to 0!!! + SetVSConstant4f(C_LIGHTS+5*i+j+1, 0.00001f, xfmemptr[1], xfmemptr[2], 0); + } + else + SetVSConstant4fv(C_LIGHTS+5*i+j+1, xfmemptr); + } + } - nLightsChanged[0] = nLightsChanged[1] = -1; - } + nLightsChanged[0] = nLightsChanged[1] = -1; + } - if (nMaterialsChanged) + if (nMaterialsChanged) { - for (int i = 0; i < 4; ++i) - if (nMaterialsChanged & (1 << i)) - SetVSConstant4fv(C_MATERIALS + i, &s_fMaterials[4 * i]); + for (int i = 0; i < 4; ++i) + if (nMaterialsChanged & (1 << i)) + SetVSConstant4fv(C_MATERIALS + i, &s_fMaterials[4 * i]); - nMaterialsChanged = 0; - } + nMaterialsChanged = 0; + } - if (bPosNormalMatrixChanged) + if (bPosNormalMatrixChanged) { - bPosNormalMatrixChanged = false; + bPosNormalMatrixChanged = false; - const float *pos = (const float *)xfmem + MatrixIndexA.PosNormalMtxIdx * 4; - const float *norm = (const float *)xfmem + XFMEM_NORMALMATRICES + 3 * (MatrixIndexA.PosNormalMtxIdx & 31); + const float *pos = (const float *)xfmem + MatrixIndexA.PosNormalMtxIdx * 4; + const float *norm = (const float *)xfmem + XFMEM_NORMALMATRICES + 3 * (MatrixIndexA.PosNormalMtxIdx & 31); - SetMultiVSConstant4fv(C_POSNORMALMATRIX, 3, pos); + SetMultiVSConstant4fv(C_POSNORMALMATRIX, 3, pos); SetMultiVSConstant3fv(C_POSNORMALMATRIX + 3, 3, norm); } - if (bTexMatricesChanged[0]) + if (bTexMatricesChanged[0]) { - bTexMatricesChanged[0] = false; - const float *fptrs[] = + bTexMatricesChanged[0] = false; + const float *fptrs[] = { (const float *)xfmem + MatrixIndexA.Tex0MtxIdx * 4, (const float *)xfmem + MatrixIndexA.Tex1MtxIdx * 4, - (const float *)xfmem + MatrixIndexA.Tex2MtxIdx * 4, (const float *)xfmem + MatrixIndexA.Tex3MtxIdx * 4 + (const float *)xfmem + MatrixIndexA.Tex2MtxIdx * 4, (const float *)xfmem + MatrixIndexA.Tex3MtxIdx * 4 }; - for (int i = 0; i < 4; ++i) + for (int i = 0; i < 4; ++i) { - SetMultiVSConstant4fv(C_TEXMATRICES + 3 * i, 3, fptrs[i]); - } - } + SetMultiVSConstant4fv(C_TEXMATRICES + 3 * i, 3, fptrs[i]); + } + } - if (bTexMatricesChanged[1]) + if (bTexMatricesChanged[1]) { - bTexMatricesChanged[1] = false; - const float *fptrs[] = { + bTexMatricesChanged[1] = false; + const float *fptrs[] = { (const float *)xfmem + MatrixIndexB.Tex4MtxIdx * 4, (const float *)xfmem + MatrixIndexB.Tex5MtxIdx * 4, - (const float *)xfmem + MatrixIndexB.Tex6MtxIdx * 4, (const float *)xfmem + MatrixIndexB.Tex7MtxIdx * 4 + (const float *)xfmem + MatrixIndexB.Tex6MtxIdx * 4, (const float *)xfmem + MatrixIndexB.Tex7MtxIdx * 4 }; - for (int i = 0; i < 4; ++i) + for (int i = 0; i < 4; ++i) { - SetMultiVSConstant4fv(C_TEXMATRICES+3 * i + 12, 3, fptrs[i]); - } - } + SetMultiVSConstant4fv(C_TEXMATRICES+3 * i + 12, 3, fptrs[i]); + } + } - if (bViewportChanged) + if (bViewportChanged) { - bViewportChanged = false; + bViewportChanged = false; // This is so implementation-dependent that we can't have it here. UpdateViewport(); - } + } - if (bProjectionChanged) + if (bProjectionChanged) { - bProjectionChanged = false; + bProjectionChanged = false; - if (xfregs.rawProjection[6] == 0) - { + if (xfregs.rawProjection[6] == 0) + { // Perspective g_fProjectionMatrix[0] = xfregs.rawProjection[0] * g_ActiveConfig.fAspectRatioHackW; g_fProjectionMatrix[1] = 0.0f; - g_fProjectionMatrix[2] = xfregs.rawProjection[1]; - g_fProjectionMatrix[3] = 0.0f; + g_fProjectionMatrix[2] = xfregs.rawProjection[1]; + g_fProjectionMatrix[3] = 0.0f; - g_fProjectionMatrix[4] = 0.0f; - g_fProjectionMatrix[5] = xfregs.rawProjection[2] * g_ActiveConfig.fAspectRatioHackH; - g_fProjectionMatrix[6] = xfregs.rawProjection[3]; - g_fProjectionMatrix[7] = 0.0f; + g_fProjectionMatrix[4] = 0.0f; + g_fProjectionMatrix[5] = xfregs.rawProjection[2] * g_ActiveConfig.fAspectRatioHackH; + g_fProjectionMatrix[6] = xfregs.rawProjection[3]; + g_fProjectionMatrix[7] = 0.0f; - g_fProjectionMatrix[8] = 0.0f; - g_fProjectionMatrix[9] = 0.0f; - g_fProjectionMatrix[10] = xfregs.rawProjection[4]; + g_fProjectionMatrix[8] = 0.0f; + g_fProjectionMatrix[9] = 0.0f; + g_fProjectionMatrix[10] = xfregs.rawProjection[4]; g_fProjectionMatrix[11] = xfregs.rawProjection[5]; - g_fProjectionMatrix[12] = 0.0f; - g_fProjectionMatrix[13] = 0.0f; + g_fProjectionMatrix[12] = 0.0f; + g_fProjectionMatrix[13] = 0.0f; // donkopunchstania: GC GPU rounds differently? // -(1 + epsilon) so objects are clipped as they are on the real HW - g_fProjectionMatrix[14] = -1.00000011921f; - g_fProjectionMatrix[15] = 0.0f; + g_fProjectionMatrix[14] = -1.00000011921f; + g_fProjectionMatrix[15] = 0.0f; SETSTAT_FT(stats.gproj_0, g_fProjectionMatrix[0]); SETSTAT_FT(stats.gproj_1, g_fProjectionMatrix[1]); @@ -328,29 +328,29 @@ void VertexShaderManager::SetConstants() SETSTAT_FT(stats.gproj_13, g_fProjectionMatrix[13]); SETSTAT_FT(stats.gproj_14, g_fProjectionMatrix[14]); SETSTAT_FT(stats.gproj_15, g_fProjectionMatrix[15]); - } - else + } + else { // Orthographic Projection - g_fProjectionMatrix[0] = xfregs.rawProjection[0]; - g_fProjectionMatrix[1] = 0.0f; - g_fProjectionMatrix[2] = 0.0f; - g_fProjectionMatrix[3] = xfregs.rawProjection[1]; + g_fProjectionMatrix[0] = xfregs.rawProjection[0]; + g_fProjectionMatrix[1] = 0.0f; + g_fProjectionMatrix[2] = 0.0f; + g_fProjectionMatrix[3] = xfregs.rawProjection[1]; - g_fProjectionMatrix[4] = 0.0f; - g_fProjectionMatrix[5] = xfregs.rawProjection[2]; - g_fProjectionMatrix[6] = 0.0f; - g_fProjectionMatrix[7] = xfregs.rawProjection[3]; + g_fProjectionMatrix[4] = 0.0f; + g_fProjectionMatrix[5] = xfregs.rawProjection[2]; + g_fProjectionMatrix[6] = 0.0f; + g_fProjectionMatrix[7] = xfregs.rawProjection[3]; - g_fProjectionMatrix[8] = 0.0f; - g_fProjectionMatrix[9] = 0.0f; - g_fProjectionMatrix[10] = (g_ProjHack1.enabled ? -(g_ProjHack1.value + xfregs.rawProjection[4]) : xfregs.rawProjection[4]); - g_fProjectionMatrix[11] = (g_ProjHack2.enabled ? -(g_ProjHack2.value + xfregs.rawProjection[5]) : xfregs.rawProjection[5]) + (g_ProjHack0 ? 0.1f : 0.0f); - - g_fProjectionMatrix[12] = 0.0f; - g_fProjectionMatrix[13] = 0.0f; - g_fProjectionMatrix[14] = 0.0f; - g_fProjectionMatrix[15] = 1.0f; + g_fProjectionMatrix[8] = 0.0f; + g_fProjectionMatrix[9] = 0.0f; + g_fProjectionMatrix[10] = (g_ProjHack1.enabled ? -(g_ProjHack1.value + xfregs.rawProjection[4]) : xfregs.rawProjection[4]); + g_fProjectionMatrix[11] = (g_ProjHack2.enabled ? -(g_ProjHack2.value + xfregs.rawProjection[5]) : xfregs.rawProjection[5]) + (g_ProjHack0 ? 0.1f : 0.0f); + + g_fProjectionMatrix[12] = 0.0f; + g_fProjectionMatrix[13] = 0.0f; + g_fProjectionMatrix[14] = 0.0f; + g_fProjectionMatrix[15] = 1.0f; SETSTAT_FT(stats.g2proj_0, g_fProjectionMatrix[0]); SETSTAT_FT(stats.g2proj_1, g_fProjectionMatrix[1]); @@ -375,140 +375,140 @@ void VertexShaderManager::SetConstants() SETSTAT_FT(stats.proj_4, xfregs.rawProjection[4]); SETSTAT_FT(stats.proj_5, xfregs.rawProjection[5]); SETSTAT_FT(stats.proj_6, xfregs.rawProjection[6]); - } + } - PRIM_LOG("Projection: %f %f %f %f %f %f\n", xfregs.rawProjection[0], xfregs.rawProjection[1], xfregs.rawProjection[2], xfregs.rawProjection[3], xfregs.rawProjection[4], xfregs.rawProjection[5]); + PRIM_LOG("Projection: %f %f %f %f %f %f\n", xfregs.rawProjection[0], xfregs.rawProjection[1], xfregs.rawProjection[2], xfregs.rawProjection[3], xfregs.rawProjection[4], xfregs.rawProjection[5]); - if (g_ActiveConfig.bFreeLook) + if (g_ActiveConfig.bFreeLook) { - Matrix44 mtxA; - Matrix44 mtxB; - Matrix44 viewMtx; + Matrix44 mtxA; + Matrix44 mtxB; + Matrix44 viewMtx; - Matrix44::Translate(mtxA, s_fViewTranslationVector); - Matrix44::LoadMatrix33(mtxB, s_viewRotationMatrix); - Matrix44::Multiply(mtxB, mtxA, viewMtx); // view = rotation x translation - Matrix44::Set(mtxB, g_fProjectionMatrix); - Matrix44::Multiply(mtxB, viewMtx, mtxA); // mtxA = projection x view + Matrix44::Translate(mtxA, s_fViewTranslationVector); + Matrix44::LoadMatrix33(mtxB, s_viewRotationMatrix); + Matrix44::Multiply(mtxB, mtxA, viewMtx); // view = rotation x translation + Matrix44::Set(mtxB, g_fProjectionMatrix); + Matrix44::Multiply(mtxB, viewMtx, mtxA); // mtxA = projection x view - SetMultiVSConstant4fv(C_PROJECTION, 4, &mtxA.data[0]); - } - else + SetMultiVSConstant4fv(C_PROJECTION, 4, &mtxA.data[0]); + } + else { - SetMultiVSConstant4fv(C_PROJECTION, 4, &g_fProjectionMatrix[0]); - } - } + SetMultiVSConstant4fv(C_PROJECTION, 4, &g_fProjectionMatrix[0]); + } + } } void VertexShaderManager::InvalidateXFRange(int start, int end) { - if (((u32)start >= (u32)MatrixIndexA.PosNormalMtxIdx * 4 && + if (((u32)start >= (u32)MatrixIndexA.PosNormalMtxIdx * 4 && (u32)start < (u32)MatrixIndexA.PosNormalMtxIdx * 4 + 12) || - ((u32)start >= XFMEM_NORMALMATRICES + ((u32)MatrixIndexA.PosNormalMtxIdx & 31) * 3 && + ((u32)start >= XFMEM_NORMALMATRICES + ((u32)MatrixIndexA.PosNormalMtxIdx & 31) * 3 && (u32)start < XFMEM_NORMALMATRICES + ((u32)MatrixIndexA.PosNormalMtxIdx & 31) * 3 + 9)) { - bPosNormalMatrixChanged = true; - } + bPosNormalMatrixChanged = true; + } - if (((u32)start >= (u32)MatrixIndexA.Tex0MtxIdx*4 && (u32)start < (u32)MatrixIndexA.Tex0MtxIdx*4+12) || - ((u32)start >= (u32)MatrixIndexA.Tex1MtxIdx*4 && (u32)start < (u32)MatrixIndexA.Tex1MtxIdx*4+12) || - ((u32)start >= (u32)MatrixIndexA.Tex2MtxIdx*4 && (u32)start < (u32)MatrixIndexA.Tex2MtxIdx*4+12) || - ((u32)start >= (u32)MatrixIndexA.Tex3MtxIdx*4 && (u32)start < (u32)MatrixIndexA.Tex3MtxIdx*4+12)) { - bTexMatricesChanged[0] = true; - } + if (((u32)start >= (u32)MatrixIndexA.Tex0MtxIdx*4 && (u32)start < (u32)MatrixIndexA.Tex0MtxIdx*4+12) || + ((u32)start >= (u32)MatrixIndexA.Tex1MtxIdx*4 && (u32)start < (u32)MatrixIndexA.Tex1MtxIdx*4+12) || + ((u32)start >= (u32)MatrixIndexA.Tex2MtxIdx*4 && (u32)start < (u32)MatrixIndexA.Tex2MtxIdx*4+12) || + ((u32)start >= (u32)MatrixIndexA.Tex3MtxIdx*4 && (u32)start < (u32)MatrixIndexA.Tex3MtxIdx*4+12)) { + bTexMatricesChanged[0] = true; + } - if (((u32)start >= (u32)MatrixIndexB.Tex4MtxIdx*4 && (u32)start < (u32)MatrixIndexB.Tex4MtxIdx*4+12) || - ((u32)start >= (u32)MatrixIndexB.Tex5MtxIdx*4 && (u32)start < (u32)MatrixIndexB.Tex5MtxIdx*4+12) || - ((u32)start >= (u32)MatrixIndexB.Tex6MtxIdx*4 && (u32)start < (u32)MatrixIndexB.Tex6MtxIdx*4+12) || - ((u32)start >= (u32)MatrixIndexB.Tex7MtxIdx*4 && (u32)start < (u32)MatrixIndexB.Tex7MtxIdx*4+12)) { - bTexMatricesChanged[1] = true; - } + if (((u32)start >= (u32)MatrixIndexB.Tex4MtxIdx*4 && (u32)start < (u32)MatrixIndexB.Tex4MtxIdx*4+12) || + ((u32)start >= (u32)MatrixIndexB.Tex5MtxIdx*4 && (u32)start < (u32)MatrixIndexB.Tex5MtxIdx*4+12) || + ((u32)start >= (u32)MatrixIndexB.Tex6MtxIdx*4 && (u32)start < (u32)MatrixIndexB.Tex6MtxIdx*4+12) || + ((u32)start >= (u32)MatrixIndexB.Tex7MtxIdx*4 && (u32)start < (u32)MatrixIndexB.Tex7MtxIdx*4+12)) { + bTexMatricesChanged[1] = true; + } - if (start < XFMEM_POSMATRICES_END) + if (start < XFMEM_POSMATRICES_END) { - if (nTransformMatricesChanged[0] == -1) + if (nTransformMatricesChanged[0] == -1) { - nTransformMatricesChanged[0] = start; - nTransformMatricesChanged[1] = end>XFMEM_POSMATRICES_END?XFMEM_POSMATRICES_END:end; - } - else + nTransformMatricesChanged[0] = start; + nTransformMatricesChanged[1] = end>XFMEM_POSMATRICES_END?XFMEM_POSMATRICES_END:end; + } + else { - if (nTransformMatricesChanged[0] > start) nTransformMatricesChanged[0] = start; - if (nTransformMatricesChanged[1] < end) nTransformMatricesChanged[1] = end>XFMEM_POSMATRICES_END?XFMEM_POSMATRICES_END:end; - } - } + if (nTransformMatricesChanged[0] > start) nTransformMatricesChanged[0] = start; + if (nTransformMatricesChanged[1] < end) nTransformMatricesChanged[1] = end>XFMEM_POSMATRICES_END?XFMEM_POSMATRICES_END:end; + } + } - if (start < XFMEM_NORMALMATRICES_END && end > XFMEM_NORMALMATRICES) + if (start < XFMEM_NORMALMATRICES_END && end > XFMEM_NORMALMATRICES) { - int _start = start < XFMEM_NORMALMATRICES ? 0 : start-XFMEM_NORMALMATRICES; - int _end = end < XFMEM_NORMALMATRICES_END ? end-XFMEM_NORMALMATRICES : XFMEM_NORMALMATRICES_END-XFMEM_NORMALMATRICES; + int _start = start < XFMEM_NORMALMATRICES ? 0 : start-XFMEM_NORMALMATRICES; + int _end = end < XFMEM_NORMALMATRICES_END ? end-XFMEM_NORMALMATRICES : XFMEM_NORMALMATRICES_END-XFMEM_NORMALMATRICES; - if (nNormalMatricesChanged[0] == -1) + if (nNormalMatricesChanged[0] == -1) { - nNormalMatricesChanged[0] = _start; - nNormalMatricesChanged[1] = _end; - } - else + nNormalMatricesChanged[0] = _start; + nNormalMatricesChanged[1] = _end; + } + else { - if (nNormalMatricesChanged[0] > _start) nNormalMatricesChanged[0] = _start; - if (nNormalMatricesChanged[1] < _end) nNormalMatricesChanged[1] = _end; - } - } + if (nNormalMatricesChanged[0] > _start) nNormalMatricesChanged[0] = _start; + if (nNormalMatricesChanged[1] < _end) nNormalMatricesChanged[1] = _end; + } + } - if (start < XFMEM_POSTMATRICES_END && end > XFMEM_POSTMATRICES) + if (start < XFMEM_POSTMATRICES_END && end > XFMEM_POSTMATRICES) { - int _start = start < XFMEM_POSTMATRICES ? XFMEM_POSTMATRICES : start-XFMEM_POSTMATRICES; - int _end = end < XFMEM_POSTMATRICES_END ? end-XFMEM_POSTMATRICES : XFMEM_POSTMATRICES_END-XFMEM_POSTMATRICES; + int _start = start < XFMEM_POSTMATRICES ? XFMEM_POSTMATRICES : start-XFMEM_POSTMATRICES; + int _end = end < XFMEM_POSTMATRICES_END ? end-XFMEM_POSTMATRICES : XFMEM_POSTMATRICES_END-XFMEM_POSTMATRICES; - if (nPostTransformMatricesChanged[0] == -1) + if (nPostTransformMatricesChanged[0] == -1) { - nPostTransformMatricesChanged[0] = _start; - nPostTransformMatricesChanged[1] = _end; - } - else + nPostTransformMatricesChanged[0] = _start; + nPostTransformMatricesChanged[1] = _end; + } + else { - if (nPostTransformMatricesChanged[0] > _start) nPostTransformMatricesChanged[0] = _start; - if (nPostTransformMatricesChanged[1] < _end) nPostTransformMatricesChanged[1] = _end; - } - } + if (nPostTransformMatricesChanged[0] > _start) nPostTransformMatricesChanged[0] = _start; + if (nPostTransformMatricesChanged[1] < _end) nPostTransformMatricesChanged[1] = _end; + } + } - if (start < XFMEM_LIGHTS_END && end > XFMEM_LIGHTS) + if (start < XFMEM_LIGHTS_END && end > XFMEM_LIGHTS) { - int _start = start < XFMEM_LIGHTS ? XFMEM_LIGHTS : start-XFMEM_LIGHTS; - int _end = end < XFMEM_LIGHTS_END ? end-XFMEM_LIGHTS : XFMEM_LIGHTS_END-XFMEM_LIGHTS; + int _start = start < XFMEM_LIGHTS ? XFMEM_LIGHTS : start-XFMEM_LIGHTS; + int _end = end < XFMEM_LIGHTS_END ? end-XFMEM_LIGHTS : XFMEM_LIGHTS_END-XFMEM_LIGHTS; - if (nLightsChanged[0] == -1 ) + if (nLightsChanged[0] == -1 ) { - nLightsChanged[0] = _start; - nLightsChanged[1] = _end; - } - else + nLightsChanged[0] = _start; + nLightsChanged[1] = _end; + } + else { - if (nLightsChanged[0] > _start) nLightsChanged[0] = _start; - if (nLightsChanged[1] < _end) nLightsChanged[1] = _end; - } - } + if (nLightsChanged[0] > _start) nLightsChanged[0] = _start; + if (nLightsChanged[1] < _end) nLightsChanged[1] = _end; + } + } } void VertexShaderManager::SetTexMatrixChangedA(u32 Value) { - if (MatrixIndexA.Hex != Value) + if (MatrixIndexA.Hex != Value) { - VertexManager::Flush(); - if (MatrixIndexA.PosNormalMtxIdx != (Value&0x3f)) - bPosNormalMatrixChanged = true; - bTexMatricesChanged[0] = true; - MatrixIndexA.Hex = Value; - } + VertexManager::Flush(); + if (MatrixIndexA.PosNormalMtxIdx != (Value&0x3f)) + bPosNormalMatrixChanged = true; + bTexMatricesChanged[0] = true; + MatrixIndexA.Hex = Value; + } } void VertexShaderManager::SetTexMatrixChangedB(u32 Value) { - if (MatrixIndexB.Hex != Value) + if (MatrixIndexB.Hex != Value) { - VertexManager::Flush(); - bTexMatricesChanged[1] = true; - MatrixIndexB.Hex = Value; - } + VertexManager::Flush(); + bTexMatricesChanged[1] = true; + MatrixIndexB.Hex = Value; + } } void VertexShaderManager::SetViewport(float* _Viewport, int constantIndex) @@ -521,20 +521,20 @@ void VertexShaderManager::SetViewport(float* _Viewport, int constantIndex) { xfregs.rawViewport[constantIndex] = _Viewport[0]; } - /*//Tino: i think this is nod needed so let this commented til confirmed + /*//Tino: i think this is not needed so leave this commented till confirmed // Workaround for paper mario, yep this is bizarre. - for (size_t i = 0; i < ARRAYSIZE(xfregs.rawViewport); ++i) + for (size_t i = 0; i < ARRAYSIZE(xfregs.rawViewport); ++i) { - if (*(u32*)(_Viewport + i) == 0x7f800000) // invalid fp number - return; - } - memcpy(xfregs.rawViewport, _Viewport, sizeof(xfregs.rawViewport));*/ - bViewportChanged = true; + if (*(u32*)(_Viewport + i) == 0x7f800000) // invalid fp number + return; + } + memcpy(xfregs.rawViewport, _Viewport, sizeof(xfregs.rawViewport));*/ + bViewportChanged = true; } void VertexShaderManager::SetViewportChanged() { - bViewportChanged = true; + bViewportChanged = true; } void VertexShaderManager::SetProjection(float* _pProjection, int constantIndex) @@ -547,7 +547,7 @@ void VertexShaderManager::SetProjection(float* _pProjection, int constantIndex) { xfregs.rawProjection[constantIndex] = _pProjection[0]; } - bProjectionChanged = true; + bProjectionChanged = true; } void VertexShaderManager::SetMaterialColor(int index, u32 data) @@ -564,42 +564,42 @@ void VertexShaderManager::SetMaterialColor(int index, u32 data) void VertexShaderManager::TranslateView(float x, float y) { - float result[3]; - float vector[3] = { x,0,y }; + float result[3]; + float vector[3] = { x,0,y }; - Matrix33::Multiply(s_viewInvRotationMatrix, vector, result); + Matrix33::Multiply(s_viewInvRotationMatrix, vector, result); - for (int i = 0; i < 3; i++) - s_fViewTranslationVector[i] += result[i]; + for (int i = 0; i < 3; i++) + s_fViewTranslationVector[i] += result[i]; - bProjectionChanged = true; + bProjectionChanged = true; } void VertexShaderManager::RotateView(float x, float y) { - s_fViewRotation[0] += x; - s_fViewRotation[1] += y; + s_fViewRotation[0] += x; + s_fViewRotation[1] += y; - Matrix33 mx; - Matrix33 my; - Matrix33::RotateX(mx, s_fViewRotation[1]); - Matrix33::RotateY(my, s_fViewRotation[0]); - Matrix33::Multiply(mx, my, s_viewRotationMatrix); + Matrix33 mx; + Matrix33 my; + Matrix33::RotateX(mx, s_fViewRotation[1]); + Matrix33::RotateY(my, s_fViewRotation[0]); + Matrix33::Multiply(mx, my, s_viewRotationMatrix); - // reverse rotation - Matrix33::RotateX(mx, -s_fViewRotation[1]); - Matrix33::RotateY(my, -s_fViewRotation[0]); - Matrix33::Multiply(my, mx, s_viewInvRotationMatrix); + // reverse rotation + Matrix33::RotateX(mx, -s_fViewRotation[1]); + Matrix33::RotateY(my, -s_fViewRotation[0]); + Matrix33::Multiply(my, mx, s_viewInvRotationMatrix); - bProjectionChanged = true; + bProjectionChanged = true; } void VertexShaderManager::ResetView() { - memset(s_fViewTranslationVector, 0, sizeof(s_fViewTranslationVector)); - Matrix33::LoadIdentity(s_viewRotationMatrix); - Matrix33::LoadIdentity(s_viewInvRotationMatrix); - s_fViewRotation[0] = s_fViewRotation[1] = 0.0f; + memset(s_fViewTranslationVector, 0, sizeof(s_fViewTranslationVector)); + Matrix33::LoadIdentity(s_viewRotationMatrix); + Matrix33::LoadIdentity(s_viewInvRotationMatrix); + s_fViewRotation[0] = s_fViewRotation[1] = 0.0f; - bProjectionChanged = true; + bProjectionChanged = true; } diff --git a/Source/Core/VideoCommon/Src/VideoConfig.cpp b/Source/Core/VideoCommon/Src/VideoConfig.cpp index 0b97e604a2..0a17262235 100644 --- a/Source/Core/VideoCommon/Src/VideoConfig.cpp +++ b/Source/Core/VideoCommon/Src/VideoConfig.cpp @@ -26,7 +26,7 @@ VideoConfig g_Config; VideoConfig g_ActiveConfig; -void UpdateActiveConfig() +void UpdateActiveConfig() { g_ActiveConfig = g_Config; } @@ -35,7 +35,7 @@ VideoConfig::VideoConfig() { bRunning = false; bAllowSignedBytes = !IsD3D(); - + // Needed for the first frame, I think fAspectRatioHackW = 1; fAspectRatioHackH = 1; @@ -43,63 +43,63 @@ VideoConfig::VideoConfig() void VideoConfig::Load(const char *ini_file) { - std::string temp; - IniFile iniFile; - iniFile.Load(ini_file); - - iniFile.Get("Hardware", "VSync", &bVSync, 0); // Hardware - iniFile.Get("Settings", "StretchToFit", &bNativeResolution, true); + std::string temp; + IniFile iniFile; + iniFile.Load(ini_file); + + iniFile.Get("Hardware", "VSync", &bVSync, 0); // Hardware + iniFile.Get("Settings", "StretchToFit", &bNativeResolution, true); iniFile.Get("Settings", "2xResolution", &b2xResolution, false); iniFile.Get("Settings", "wideScreenHack", &bWidescreenHack, false); iniFile.Get("Settings", "AspectRatio", &iAspectRatio, (int)ASPECT_AUTO); iniFile.Get("Settings", "Crop", &bCrop, false); - iniFile.Get("Settings", "UseXFB", &bUseXFB, 0); + iniFile.Get("Settings", "UseXFB", &bUseXFB, 0); iniFile.Get("Settings", "UseRealXFB", &bUseRealXFB, 0); - iniFile.Get("Settings", "AutoScale", &bAutoScale, true); + iniFile.Get("Settings", "AutoScale", &bAutoScale, true); iniFile.Get("Settings", "UseNativeMips", &bUseNativeMips, true); - - iniFile.Get("Settings", "SafeTextureCache", &bSafeTextureCache, false); // Settings + + iniFile.Get("Settings", "SafeTextureCache", &bSafeTextureCache, false); // Settings //Safe texture cache params iniFile.Get("Settings", "SafeTextureCacheColorSamples", &iSafeTextureCache_ColorSamples,512); - - iniFile.Get("Settings", "ShowFPS", &bShowFPS, false); // Settings - iniFile.Get("Settings", "OverlayStats", &bOverlayStats, false); + + iniFile.Get("Settings", "ShowFPS", &bShowFPS, false); // Settings + iniFile.Get("Settings", "OverlayStats", &bOverlayStats, false); iniFile.Get("Settings", "OverlayProjStats", &bOverlayProjStats, false); iniFile.Get("Settings", "ShowEFBCopyRegions", &bShowEFBCopyRegions, false); - iniFile.Get("Settings", "DLOptimize", &iCompileDLsLevel, 0); - iniFile.Get("Settings", "DumpTextures", &bDumpTextures, 0); - iniFile.Get("Settings", "HiresTextures", &bHiresTextures, 0); + iniFile.Get("Settings", "DLOptimize", &iCompileDLsLevel, 0); + iniFile.Get("Settings", "DumpTextures", &bDumpTextures, 0); + iniFile.Get("Settings", "HiresTextures", &bHiresTextures, 0); iniFile.Get("Settings", "DumpEFBTarget", &bDumpEFBTarget, 0); iniFile.Get("Settings", "DumpFrames", &bDumpFrames, 0); - iniFile.Get("Settings", "FreeLook", &bFreeLook, 0); - iniFile.Get("Settings", "ShowShaderErrors", &bShowShaderErrors, 0); - iniFile.Get("Settings", "MSAA", &iMultisampleMode, 0); - iniFile.Get("Settings", "DstAlphaPass", &bDstAlphaPass, false); - - iniFile.Get("Settings", "TexFmtOverlayEnable", &bTexFmtOverlayEnable, 0); - iniFile.Get("Settings", "TexFmtOverlayCenter", &bTexFmtOverlayCenter, 0); - iniFile.Get("Settings", "WireFrame", &bWireFrame, 0); - iniFile.Get("Settings", "DisableLighting", &bDisableLighting, 0); - iniFile.Get("Settings", "DisableTexturing", &bDisableTexturing, 0); + iniFile.Get("Settings", "FreeLook", &bFreeLook, 0); + iniFile.Get("Settings", "ShowShaderErrors", &bShowShaderErrors, 0); + iniFile.Get("Settings", "MSAA", &iMultisampleMode, 0); + iniFile.Get("Settings", "DstAlphaPass", &bDstAlphaPass, false); + + iniFile.Get("Settings", "TexFmtOverlayEnable", &bTexFmtOverlayEnable, 0); + iniFile.Get("Settings", "TexFmtOverlayCenter", &bTexFmtOverlayCenter, 0); + iniFile.Get("Settings", "WireFrame", &bWireFrame, 0); + iniFile.Get("Settings", "DisableLighting", &bDisableLighting, 0); + iniFile.Get("Settings", "DisableTexturing", &bDisableTexturing, 0); iniFile.Get("Settings", "DisableFog", &bDisableFog, 0); - - iniFile.Get("Enhancements", "ForceFiltering", &bForceFiltering, 0); - iniFile.Get("Enhancements", "MaxAnisotropy", &iMaxAnisotropy, 1); // NOTE - this is x in (1 << x) + + iniFile.Get("Enhancements", "ForceFiltering", &bForceFiltering, 0); + iniFile.Get("Enhancements", "MaxAnisotropy", &iMaxAnisotropy, 1); // NOTE - this is x in (1 << x) iniFile.Get("Enhancements", "PostProcessingShader", &sPostProcessingShader, ""); - - iniFile.Get("Hacks", "EFBAccessEnable", &bEFBAccessEnable, true); - iniFile.Get("Hacks", "EFBCopyDisable", &bEFBCopyDisable, false); - iniFile.Get("Hacks", "EFBCopyDisableHotKey", &bOSDHotKey, 0); + + iniFile.Get("Hacks", "EFBAccessEnable", &bEFBAccessEnable, true); + iniFile.Get("Hacks", "EFBCopyDisable", &bEFBCopyDisable, false); + iniFile.Get("Hacks", "EFBCopyDisableHotKey", &bOSDHotKey, 0); iniFile.Get("Hacks", "EFBToTextureEnable", &bCopyEFBToTexture, false); iniFile.Get("Hacks", "EFBScaledCopy", &bCopyEFBScaled, true); iniFile.Get("Hacks", "FIFOBPHack", &bFIFOBPhack, false); iniFile.Get("Hacks", "ProjectionHack", &iPhackvalue, 0); iniFile.Get("Hardware", "Adapter", &iAdapter, 0); - if (iAdapter == -1) + if (iAdapter == -1) iAdapter = 0; iniFile.Get("Hardware", "SimpleFB", &bSimpleFB, false); - + // Load common settings iniFile.Load(File::GetUserPath(F_DOLPHINCONFIG_IDX)); bool bTmp; @@ -109,9 +109,9 @@ void VideoConfig::Load(const char *ini_file) void VideoConfig::GameIniLoad(const char *ini_file) { - IniFile iniFile; - iniFile.Load(ini_file); - + IniFile iniFile; + iniFile.Load(ini_file); + if (iniFile.Exists("Video", "ForceFiltering")) iniFile.Get("Video", "ForceFiltering", &bForceFiltering); if (iniFile.Exists("Video", "MaxAnisotropy")) @@ -148,60 +148,60 @@ void VideoConfig::GameIniLoad(const char *ini_file) void VideoConfig::Save(const char *ini_file) { - IniFile iniFile; - iniFile.Load(ini_file); - iniFile.Set("Hardware", "VSync", bVSync); - iniFile.Set("Settings", "StretchToFit", bNativeResolution); + IniFile iniFile; + iniFile.Load(ini_file); + iniFile.Set("Hardware", "VSync", bVSync); + iniFile.Set("Settings", "StretchToFit", bNativeResolution); iniFile.Set("Settings", "2xResolution", b2xResolution); iniFile.Set("Settings", "AspectRatio", iAspectRatio); iniFile.Set("Settings", "Crop", bCrop); iniFile.Set("Settings", "wideScreenHack", bWidescreenHack); - iniFile.Set("Settings", "UseXFB", bUseXFB); + iniFile.Set("Settings", "UseXFB", bUseXFB); iniFile.Set("Settings", "UseRealXFB", bUseRealXFB); - iniFile.Set("Settings", "AutoScale", bAutoScale); + iniFile.Set("Settings", "AutoScale", bAutoScale); iniFile.Set("Settings", "UseNativeMips", bUseNativeMips); - iniFile.Set("Settings", "SafeTextureCache", bSafeTextureCache); + iniFile.Set("Settings", "SafeTextureCache", bSafeTextureCache); //safe texture cache params iniFile.Set("Settings", "SafeTextureCacheColorSamples", iSafeTextureCache_ColorSamples); - iniFile.Set("Settings", "ShowFPS", bShowFPS); - iniFile.Set("Settings", "OverlayStats", bOverlayStats); + iniFile.Set("Settings", "ShowFPS", bShowFPS); + iniFile.Set("Settings", "OverlayStats", bOverlayStats); iniFile.Set("Settings", "OverlayProjStats", bOverlayProjStats); - iniFile.Set("Settings", "DLOptimize", iCompileDLsLevel); + iniFile.Set("Settings", "DLOptimize", iCompileDLsLevel); iniFile.Set("Settings", "Show", iCompileDLsLevel); - iniFile.Set("Settings", "DumpTextures", bDumpTextures); - iniFile.Set("Settings", "HiresTextures", bHiresTextures); + iniFile.Set("Settings", "DumpTextures", bDumpTextures); + iniFile.Set("Settings", "HiresTextures", bHiresTextures); iniFile.Set("Settings", "DumpEFBTarget", bDumpEFBTarget); iniFile.Set("Settings", "DumpFrames", bDumpFrames); - iniFile.Set("Settings", "FreeLook", bFreeLook); - iniFile.Set("Settings", "ShowEFBCopyRegions", bShowEFBCopyRegions); + iniFile.Set("Settings", "FreeLook", bFreeLook); + iniFile.Set("Settings", "ShowEFBCopyRegions", bShowEFBCopyRegions); iniFile.Set("Settings", "ShowShaderErrors", bShowShaderErrors); - iniFile.Set("Settings", "MSAA", iMultisampleMode); - iniFile.Set("Settings", "TexFmtOverlayEnable", bTexFmtOverlayEnable); - iniFile.Set("Settings", "TexFmtOverlayCenter", bTexFmtOverlayCenter); - iniFile.Set("Settings", "Wireframe", bWireFrame); - iniFile.Set("Settings", "DisableLighting", bDisableLighting); - iniFile.Set("Settings", "DisableTexturing", bDisableTexturing); - iniFile.Set("Settings", "DstAlphaPass", bDstAlphaPass); + iniFile.Set("Settings", "MSAA", iMultisampleMode); + iniFile.Set("Settings", "TexFmtOverlayEnable", bTexFmtOverlayEnable); + iniFile.Set("Settings", "TexFmtOverlayCenter", bTexFmtOverlayCenter); + iniFile.Set("Settings", "Wireframe", bWireFrame); + iniFile.Set("Settings", "DisableLighting", bDisableLighting); + iniFile.Set("Settings", "DisableTexturing", bDisableTexturing); + iniFile.Set("Settings", "DstAlphaPass", bDstAlphaPass); iniFile.Set("Settings", "DisableFog", bDisableFog); - - iniFile.Set("Enhancements", "ForceFiltering", bForceFiltering); - iniFile.Set("Enhancements", "MaxAnisotropy", iMaxAnisotropy); + + iniFile.Set("Enhancements", "ForceFiltering", bForceFiltering); + iniFile.Set("Enhancements", "MaxAnisotropy", iMaxAnisotropy); iniFile.Set("Enhancements", "PostProcessingShader", sPostProcessingShader); - - iniFile.Set("Hacks", "EFBAccessEnable", bEFBAccessEnable); - iniFile.Set("Hacks", "EFBCopyDisable", bEFBCopyDisable); - iniFile.Set("Hacks", "EFBCopyDisableHotKey", bOSDHotKey); + + iniFile.Set("Hacks", "EFBAccessEnable", bEFBAccessEnable); + iniFile.Set("Hacks", "EFBCopyDisable", bEFBCopyDisable); + iniFile.Set("Hacks", "EFBCopyDisableHotKey", bOSDHotKey); iniFile.Set("Hacks", "EFBToTextureEnable", bCopyEFBToTexture); iniFile.Set("Hacks", "EFBScaledCopy", bCopyEFBScaled); iniFile.Set("Hacks", "FIFOBPHack", bFIFOBPhack); iniFile.Set("Hacks", "ProjectionHack", iPhackvalue); - + iniFile.Set("Hardware", "Adapter", iAdapter); iniFile.Set("Hardware", "SimpleFB", bSimpleFB); - - iniFile.Save(ini_file); + + iniFile.Save(ini_file); } // TODO: Figure out a better place for this function. @@ -211,15 +211,15 @@ void ComputeDrawRectangle(int backbuffer_width, int backbuffer_height, bool flip float FloatGLHeight = (float)backbuffer_height; float FloatXOffset = 0; float FloatYOffset = 0; - + // The rendering window size const float WinWidth = FloatGLWidth; const float WinHeight = FloatGLHeight; - + // Handle aspect ratio. // Default to auto. bool use16_9 = g_VideoInitialize.bAutoAspectIs16_9; - + // Update aspect ratio hack values // Won't take effect until next frame // Don't know if there is a better place for this code so there isn't a 1 frame delay @@ -227,7 +227,7 @@ void ComputeDrawRectangle(int backbuffer_width, int backbuffer_height, bool flip { float source_aspect = use16_9 ? (16.0f / 9.0f) : (4.0f / 3.0f); float target_aspect; - + switch ( g_ActiveConfig.iAspectRatio ) { case ASPECT_FORCE_16_9 : @@ -244,7 +244,7 @@ void ComputeDrawRectangle(int backbuffer_width, int backbuffer_height, bool flip target_aspect = source_aspect; break; } - + float adjust = source_aspect / target_aspect; if ( adjust > 1 ) { @@ -271,7 +271,7 @@ void ComputeDrawRectangle(int backbuffer_width, int backbuffer_height, bool flip use16_9 = true; else if (g_ActiveConfig.iAspectRatio == ASPECT_FORCE_4_3) use16_9 = false; - + if (g_ActiveConfig.iAspectRatio != ASPECT_STRETCH) { // The rendering window aspect ratio as a proportion of the 4:3 or 16:9 ratio @@ -291,7 +291,7 @@ void ComputeDrawRectangle(int backbuffer_width, int backbuffer_height, bool flip FloatYOffset = FloatYOffset + (WinHeight - FloatGLHeight) / 2.0f; } } - + // ----------------------------------------------------------------------- // Crop the picture from 4:3 to 5:4 or from 16:9 to 16:10. // Output: FloatGLWidth, FloatGLHeight, FloatXOffset, FloatYOffset @@ -309,7 +309,7 @@ void ComputeDrawRectangle(int backbuffer_width, int backbuffer_height, bool flip FloatXOffset = FloatXOffset - (IncreasedWidth * 0.5f); FloatYOffset = FloatYOffset - (IncreasedHeight * 0.5f); } - + int XOffset = (int)(FloatXOffset + 0.5f); int YOffset = (int)(FloatYOffset + 0.5f); int iWhidth = (int)ceil(FloatGLWidth); diff --git a/Source/Core/VideoCommon/Src/VideoConfig.h b/Source/Core/VideoCommon/Src/VideoConfig.h index 8740590727..4b156d4e08 100644 --- a/Source/Core/VideoCommon/Src/VideoConfig.h +++ b/Source/Core/VideoCommon/Src/VideoConfig.h @@ -60,60 +60,60 @@ class IniFile; // NEVER inherit from this class. struct VideoConfig { - VideoConfig(); - void Load(const char *ini_file); + VideoConfig(); + void Load(const char *ini_file); void GameIniLoad(const char *ini_file); - void Save(const char *ini_file); + void Save(const char *ini_file); void UpdateProjectionHack(); - // General + // General bool bVSync; - bool bNativeResolution, b2xResolution, bRunning; // Should possibly be augmented with 2x, 4x native. + bool bNativeResolution, b2xResolution, bRunning; // Should possibly be augmented with 2x, 4x native. bool bWidescreenHack; int iAspectRatio; - bool bCrop; // Aspect ratio controls. - bool bUseXFB; + bool bCrop; // Aspect ratio controls. + bool bUseXFB; bool bUseRealXFB; - bool bAutoScale; // Removes annoying borders without using XFB. Doesn't always work perfectly. + bool bAutoScale; // Removes annoying borders without using XFB. Doesn't always work perfectly. bool bUseNativeMips; - + // Enhancements - int iMultisampleMode; - bool bForceFiltering; - int iMaxAnisotropy; + int iMultisampleMode; + bool bForceFiltering; + int iMaxAnisotropy; std::string sPostProcessingShader; // Information - bool bShowFPS; - bool bOverlayStats; + bool bShowFPS; + bool bOverlayStats; bool bOverlayProjStats; - bool bTexFmtOverlayEnable; - bool bTexFmtOverlayCenter; + bool bTexFmtOverlayEnable; + bool bTexFmtOverlayCenter; bool bShowEFBCopyRegions; - - // Render - bool bWireFrame; - bool bDisableLighting; - bool bDisableTexturing; - bool bDstAlphaPass; + + // Render + bool bWireFrame; + bool bDisableLighting; + bool bDisableTexturing; + bool bDstAlphaPass; bool bDisableFog; - - // Utility - bool bDumpTextures; + + // Utility + bool bDumpTextures; bool bHiresTextures; bool bDumpEFBTarget; bool bDumpFrames; - bool bFreeLook; - - // Hacks - bool bEFBAccessEnable; + bool bFreeLook; + + // Hacks + bool bEFBAccessEnable; bool bEFBCopyDisable; // should reverse polarity of this one :) true=disabled can be confusing - bool bOSDHotKey; + bool bOSDHotKey; bool bHack; bool bCopyEFBToTexture; bool bCopyEFBScaled; - bool bSafeTextureCache; + bool bSafeTextureCache; int iSafeTextureCache_ColorSamples; bool bFIFOBPhack; int iPhackvalue; @@ -122,12 +122,12 @@ struct VideoConfig bool bProjHack1; float fAspectRatioHackW, fAspectRatioHackH; - int iLog; // CONF_ bits - int iSaveTargetId; - - //currently unused: - int iCompileDLsLevel; - bool bShowShaderErrors; + int iLog; // CONF_ bits + int iSaveTargetId; + + //currently unused: + int iCompileDLsLevel; + bool bShowShaderErrors; // D3D only config, mostly to be merged into the above int iAdapter; diff --git a/Source/PluginSpecs/PluginSpecs.h b/Source/PluginSpecs/PluginSpecs.h index 1e7d21076a..671bc930cd 100644 --- a/Source/PluginSpecs/PluginSpecs.h +++ b/Source/PluginSpecs/PluginSpecs.h @@ -23,7 +23,6 @@ enum PLUGIN_COMM WM_USER_CREATE, WM_USER_SETCURSOR, WM_USER_KEYDOWN, - WM_USER_VIDEO_STOP, VIDEO_DESTROY, // The video debugging window was destroyed AUDIO_DESTROY, // The audio debugging window was destroyed WIIMOTE_DISCONNECT, // Disconnect Wiimote @@ -62,13 +61,13 @@ enum PLUGIN_COMM // Plugin types enum PLUGIN_TYPE { - PLUGIN_TYPE_VIDEO = 1, - PLUGIN_TYPE_DVD, - PLUGIN_TYPE_PAD, - PLUGIN_TYPE_AUDIO, - PLUGIN_TYPE_COMPILER, - PLUGIN_TYPE_DSP, - PLUGIN_TYPE_WIIMOTE, + PLUGIN_TYPE_VIDEO = 1, + PLUGIN_TYPE_DVD, + PLUGIN_TYPE_PAD, + PLUGIN_TYPE_AUDIO, + PLUGIN_TYPE_COMPILER, + PLUGIN_TYPE_DSP, + PLUGIN_TYPE_WIIMOTE, }; #define STATE_MODE_READ 1 @@ -100,8 +99,8 @@ typedef struct // This design is just wrong and ugly - the plugins shouldn't have this much access. typedef struct { - void *eventHandler; - void *logManager; + void *eventHandler; + void *logManager; char game_ini[MAX_PATH]; char unique_id[16]; } PLUGIN_GLOBALS; diff --git a/Source/Plugins/Plugin_DSP_HLE/Src/Config.h b/Source/Plugins/Plugin_DSP_HLE/Src/Config.h index 5d30ec516d..e34ee252a6 100644 --- a/Source/Plugins/Plugin_DSP_HLE/Src/Config.h +++ b/Source/Plugins/Plugin_DSP_HLE/Src/Config.h @@ -22,12 +22,12 @@ struct CConfig { - bool m_EnableHLEAudio; + bool m_EnableHLEAudio; - CConfig(); - - void Load(); - void Save(); + CConfig(); + + void Load(); + void Save(); }; extern CConfig g_Config; diff --git a/Source/Plugins/Plugin_DSP_HLE/Src/ConfigDlg.cpp b/Source/Plugins/Plugin_DSP_HLE/Src/ConfigDlg.cpp index 66788917a8..b6c60b991b 100644 --- a/Source/Plugins/Plugin_DSP_HLE/Src/ConfigDlg.cpp +++ b/Source/Plugins/Plugin_DSP_HLE/Src/ConfigDlg.cpp @@ -95,7 +95,7 @@ DSPConfigDialogHLE::DSPConfigDialogHLE(wxWindow *parent, wxWindowID id, const wx void DSPConfigDialogHLE::AddBackend(const char* backend) { // Update values - m_BackendSelection->Append(wxString::FromAscii(backend)); + m_BackendSelection->Append(wxString::FromAscii(backend)); #ifdef __APPLE__ int num = m_BackendSelection->FindString(wxString::FromAscii(ac_Config.sBackend)); #else @@ -145,7 +145,7 @@ bool DSPConfigDialogHLE::SupportsVolumeChanges(std::string backend) // but getting the backend from string etc. is probably // too much just to enable/disable a stupid slider... return (backend == BACKEND_DIRECTSOUND || - backend == BACKEND_OPENAL); + backend == BACKEND_OPENAL); } void DSPConfigDialogHLE::BackendChanged(wxCommandEvent& event) diff --git a/Source/Plugins/Plugin_DSP_HLE/Src/ConfigDlg.h b/Source/Plugins/Plugin_DSP_HLE/Src/ConfigDlg.h index 1f3c96eb56..834b5ec9ab 100644 --- a/Source/Plugins/Plugin_DSP_HLE/Src/ConfigDlg.h +++ b/Source/Plugins/Plugin_DSP_HLE/Src/ConfigDlg.h @@ -28,38 +28,38 @@ class DSPConfigDialogHLE : public wxDialog { public: DSPConfigDialogHLE(wxWindow *parent, - wxWindowID id = wxID_ANY, - const wxString &title = wxT("Dolphin DSP-HLE Plugin Settings"), - const wxPoint& pos = wxDefaultPosition, - const wxSize& size = wxDefaultSize, - long style = wxDEFAULT_DIALOG_STYLE); - virtual ~DSPConfigDialogHLE(); - void AddBackend(const char *backend); + wxWindowID id = wxID_ANY, + const wxString &title = wxT("Dolphin DSP-HLE Plugin Settings"), + const wxPoint& pos = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + long style = wxDEFAULT_DIALOG_STYLE); + virtual ~DSPConfigDialogHLE(); + void AddBackend(const char *backend); void ClearBackends(); - + private: - DECLARE_EVENT_TABLE(); - - wxSlider *m_volumeSlider; - wxStaticText *m_volumeText; - wxButton *m_OK; - wxCheckBox *m_buttonEnableHLEAudio; - wxCheckBox *m_buttonEnableDTKMusic; - wxCheckBox *m_buttonEnableThrottle; + DECLARE_EVENT_TABLE(); + + wxSlider* m_volumeSlider; + wxStaticText* m_volumeText; + wxButton* m_OK; + wxCheckBox* m_buttonEnableHLEAudio; + wxCheckBox* m_buttonEnableDTKMusic; + wxCheckBox* m_buttonEnableThrottle; wxArrayString wxArrayBackends; - wxChoice *m_BackendSelection; + wxChoice* m_BackendSelection; - enum + enum { - ID_ENABLE_HLE_AUDIO, - ID_ENABLE_DTK_MUSIC, - ID_ENABLE_THROTTLE, - ID_BACKEND, + ID_ENABLE_HLE_AUDIO, + ID_ENABLE_DTK_MUSIC, + ID_ENABLE_THROTTLE, + ID_BACKEND, ID_VOLUME }; - - void OnOK(wxCommandEvent& event); - void SettingsChanged(wxCommandEvent& event); + + void OnOK(wxCommandEvent& event); + void SettingsChanged(wxCommandEvent& event); void VolumeChanged(wxScrollEvent& event); bool SupportsVolumeChanges(std::string backend); void BackendChanged(wxCommandEvent& event); diff --git a/Source/Plugins/Plugin_DSP_HLE/Src/main.cpp b/Source/Plugins/Plugin_DSP_HLE/Src/main.cpp index a76db444f4..84aa9e37c3 100644 --- a/Source/Plugins/Plugin_DSP_HLE/Src/main.cpp +++ b/Source/Plugins/Plugin_DSP_HLE/Src/main.cpp @@ -72,7 +72,7 @@ class wxDLLApp : public wxApp return true; } }; -IMPLEMENT_APP_NO_MAIN(wxDLLApp) +IMPLEMENT_APP_NO_MAIN(wxDLLApp) WXDLLIMPEXP_BASE void wxSetInstance(HINSTANCE hInst); #endif @@ -89,7 +89,7 @@ BOOL APIENTRY DllMain(HINSTANCE hinstDLL, // DLL module handle wxInitialize(); #endif } - break; + break; case DLL_PROCESS_DETACH: #if defined(HAVE_WX) && HAVE_WX @@ -129,13 +129,11 @@ void GetDllInfo(PLUGIN_INFO* _PluginInfo) _PluginInfo->Version = 0x0100; _PluginInfo->Type = PLUGIN_TYPE_DSP; #ifdef DEBUGFAST - sprintf(_PluginInfo->Name, "Dolphin DSP-HLE Plugin (DebugFast) "); + sprintf(_PluginInfo->Name, "Dolphin DSP-HLE Plugin (DebugFast)"); +#elif defined _DEBUG + sprintf(_PluginInfo->Name, "Dolphin DSP-HLE Plugin (Debug)"); #else -#ifndef _DEBUG - sprintf(_PluginInfo->Name, "Dolphin DSP-HLE Plugin "); -#else - sprintf(_PluginInfo->Name, "Dolphin DSP-HLE Plugin (Debug) "); -#endif + sprintf(_PluginInfo->Name, "Dolphin DSP-HLE Plugin"); #endif } @@ -143,7 +141,7 @@ void GetDllInfo(PLUGIN_INFO* _PluginInfo) void SetDllGlobals(PLUGIN_GLOBALS* _pPluginGlobals) { globals = _pPluginGlobals; - LogManager::SetInstance((LogManager *)globals->logManager); + LogManager::SetInstance((LogManager*)globals->logManager); } void DllConfig(HWND _hParent) @@ -198,10 +196,6 @@ void Initialize(void *init) CDSPHandler::CreateInstance(); } -void DSP_StopSoundStream() -{ -} - void Shutdown() { AudioCommon::ShutdownSoundStream(); @@ -285,7 +279,7 @@ unsigned short DSP_WriteControlRegister(unsigned short _Value) { unsigned int AISampleRate, DACSampleRate; g_dspInitialize.pGetSampleRate(AISampleRate, DACSampleRate); - soundStream = AudioCommon::InitSoundStream(new HLEMixer(AISampleRate, DACSampleRate)); + soundStream = AudioCommon::InitSoundStream(new HLEMixer(AISampleRate, DACSampleRate)); if(!soundStream) PanicAlert("Error starting up sound stream"); // Mixer is initialized g_InitMixer = true; diff --git a/Source/Plugins/Plugin_VideoDX9/Src/D3DBase.cpp b/Source/Plugins/Plugin_VideoDX9/Src/D3DBase.cpp index d7b2175e99..633e342b11 100644 --- a/Source/Plugins/Plugin_VideoDX9/Src/D3DBase.cpp +++ b/Source/Plugins/Plugin_VideoDX9/Src/D3DBase.cpp @@ -102,7 +102,7 @@ void EnableAlphaToCoverage() if (GetCurAdapter().ident.VendorId == VENDOR_ATI) D3D::SetRenderState(D3DRS_POINTSIZE, (D3DFORMAT)MAKEFOURCC('A', '2', 'M', '1')); else - D3D::SetRenderState(D3DRS_ADAPTIVETESS_Y, (D3DFORMAT)MAKEFOURCC('A', 'T', 'O', 'C')); + D3D::SetRenderState(D3DRS_ADAPTIVETESS_Y, (D3DFORMAT)MAKEFOURCC('A', 'T', 'O', 'C')); } void InitPP(int adapter, int f, int aa_mode, D3DPRESENT_PARAMETERS *pp) @@ -191,7 +191,7 @@ void Enumerate() } } if (D3DERR_NOTAVAILABLE != D3D::D3D->CheckDeviceMultiSampleType( - i, D3DDEVTYPE_HAL, D3DFMT_X8R8G8B8, TRUE, D3DMULTISAMPLE_8_SAMPLES, &qlevels)) + i, D3DDEVTYPE_HAL, D3DFMT_X8R8G8B8, TRUE, D3DMULTISAMPLE_8_SAMPLES, &qlevels)) { if (qlevels > 2) { @@ -211,14 +211,14 @@ void Enumerate() // Also check for RAWZ (nvidia only, but the only option to get Z24 textures on sub GF8800 a.supports_rawz = D3D_OK == D3D->CheckDeviceFormat( i, D3DDEVTYPE_HAL, D3DFMT_X8R8G8B8, - D3DUSAGE_DEPTHSTENCIL, D3DRTYPE_TEXTURE, FOURCC_RAWZ); + D3DUSAGE_DEPTHSTENCIL, D3DRTYPE_TEXTURE, FOURCC_RAWZ); // Might as well check for RESZ and NULL too. a.supports_resz = D3D_OK == D3D->CheckDeviceFormat( i, D3DDEVTYPE_HAL, D3DFMT_X8R8G8B8, - D3DUSAGE_DEPTHSTENCIL, D3DRTYPE_TEXTURE, FOURCC_RESZ); + D3DUSAGE_DEPTHSTENCIL, D3DRTYPE_TEXTURE, FOURCC_RESZ); a.supports_null = D3D_OK == D3D->CheckDeviceFormat( i, D3DDEVTYPE_HAL, D3DFMT_X8R8G8B8, - D3DUSAGE_DEPTHSTENCIL, D3DRTYPE_TEXTURE, FOURCC_NULL); + D3DUSAGE_DEPTHSTENCIL, D3DRTYPE_TEXTURE, FOURCC_NULL); if (a.aa_levels.size() == 1) { @@ -291,7 +291,7 @@ HRESULT Create(int adapter, HWND wnd, int _resolution, int aa_mode, bool auto_de dev->GetRenderTarget(0, &back_buffer); if (dev->GetDepthStencilSurface(&back_buffer_z) == D3DERR_NOTFOUND) back_buffer_z = NULL; - D3D::SetRenderState(D3DRS_ZENABLE, D3DZB_TRUE ); + D3D::SetRenderState(D3DRS_ZENABLE, D3DZB_TRUE ); D3D::SetRenderState(D3DRS_FILLMODE, g_Config.bWireFrame ? D3DFILL_WIREFRAME : D3DFILL_SOLID); memset(m_Textures, 0, sizeof(m_Textures)); memset(m_TextureStageStatesSet, 0, sizeof(m_TextureStageStatesSet)); @@ -312,14 +312,15 @@ void Close() if (back_buffer_z) back_buffer_z->Release(); back_buffer_z = NULL; - back_buffer->Release(); + if( back_buffer ) + back_buffer->Release(); back_buffer = NULL; ULONG references = dev->Release(); if (references) ERROR_LOG(VIDEO, "Unreleased references: %i.", references); - dev = 0; + dev = NULL; } const D3DCAPS9 &GetCaps() @@ -353,14 +354,22 @@ LPDIRECT3DSURFACE9 GetBackBufferDepthSurface() void ShowD3DError(HRESULT err) { - switch (err) + switch (err) { - case D3DERR_DEVICELOST: PanicAlert("Device Lost"); break; - case D3DERR_INVALIDCALL: PanicAlert("Invalid Call"); break; - case D3DERR_DRIVERINTERNALERROR: PanicAlert("Driver Internal Error"); break; - case D3DERR_OUTOFVIDEOMEMORY: PanicAlert("Out of vid mem"); break; + case D3DERR_DEVICELOST: + PanicAlert("Device Lost"); + break; + case D3DERR_INVALIDCALL: + PanicAlert("Invalid Call"); + break; + case D3DERR_DRIVERINTERNALERROR: + PanicAlert("Driver Internal Error"); + break; + case D3DERR_OUTOFVIDEOMEMORY: + PanicAlert("Out of vid mem"); + break; default: - // MessageBoxA(0,"Other error or success","ERROR",0); + // MessageBox(0,_T("Other error or success"),_T("ERROR"),0); break; } } @@ -378,7 +387,7 @@ void Reset() back_buffer->Release(); back_buffer = NULL; - D3DPRESENT_PARAMETERS d3dpp; + D3DPRESENT_PARAMETERS d3dpp; InitPP(cur_adapter, resolution, multisample, &d3dpp); HRESULT hr = dev->Reset(&d3dpp); ShowD3DError(hr); @@ -457,7 +466,7 @@ void ApplyCachedState() // so no stale state is around. memset(m_Textures, 0, sizeof(m_Textures)); memset(m_TextureStageStatesSet, 0, sizeof(m_TextureStageStatesSet)); - memset(m_TextureStageStatesChanged, 0, sizeof(m_TextureStageStatesChanged)); + memset(m_TextureStageStatesChanged, 0, sizeof(m_TextureStageStatesChanged)); m_VtxDecl = NULL; m_PixelShader = NULL; m_VertexShader = NULL; @@ -553,7 +562,7 @@ void RefreshSamplerState(DWORD Sampler, D3DSAMPLERSTATETYPE Type) { if(m_SamplerStatesSet[Sampler][Type] && m_SamplerStatesChanged[Sampler][Type]) { - D3D::dev->SetSamplerState(Sampler, Type, m_SamplerStates[Sampler][Type]); + D3D::dev->SetSamplerState(Sampler, Type, m_SamplerStates[Sampler][Type]); m_SamplerStatesChanged[Sampler][Type] = false; } } @@ -575,7 +584,7 @@ void RefreshVertexDeclaration() { if (m_VtxDecl) { - D3D::dev->SetVertexDeclaration(m_VtxDecl); + D3D::dev->SetVertexDeclaration(m_VtxDecl); } } @@ -596,7 +605,7 @@ void RefreshVertexShader() { if (m_VertexShader) { - D3D::dev->SetVertexShader(m_VertexShader); + D3D::dev->SetVertexShader(m_VertexShader); } } @@ -617,7 +626,7 @@ void RefreshPixelShader() { if (m_PixelShader) { - D3D::dev->SetPixelShader(m_PixelShader); + D3D::dev->SetPixelShader(m_PixelShader); } } diff --git a/Source/Plugins/Plugin_VideoDX9/Src/D3DUtil.cpp b/Source/Plugins/Plugin_VideoDX9/Src/D3DUtil.cpp index d956165f88..9cc2dd19ba 100644 --- a/Source/Plugins/Plugin_VideoDX9/Src/D3DUtil.cpp +++ b/Source/Plugins/Plugin_VideoDX9/Src/D3DUtil.cpp @@ -45,8 +45,8 @@ inline FONT2DVERTEX InitFont2DVertex(float x, float y, u32 color, float tu, floa CD3DFont::CD3DFont() { - m_pTexture = NULL; - m_pVB = NULL; + m_pTexture = NULL; + m_pVB = NULL; } enum {m_dwTexWidth = 512, m_dwTexHeight = 512}; @@ -74,7 +74,7 @@ int CD3DFont::Init() bmi.bmiHeader.biBitCount = 32; // Create a DC and a bitmap for the font - HDC hDC = CreateCompatibleDC(NULL); + HDC hDC = CreateCompatibleDC(NULL); HBITMAP hbmBitmap = CreateDIBSection(hDC, &bmi, DIB_RGB_COLORS, (VOID**)&pBitmapBits, NULL, 0); SetMapMode(hDC, MM_TEXT); @@ -125,7 +125,7 @@ int CD3DFont::Init() // Create a new texture for the font hr = dev->CreateTexture(m_dwTexWidth, m_dwTexHeight, 1, D3DUSAGE_DYNAMIC, - D3DFMT_A4R4G4B4, D3DPOOL_DEFAULT, &m_pTexture, NULL); + D3DFMT_A4R4G4B4, D3DPOOL_DEFAULT, &m_pTexture, NULL); if (FAILED(hr)) { PanicAlert("Failed to create font texture"); @@ -172,11 +172,11 @@ int CD3DFont::Shutdown() const int RS[6][2] = { {D3DRS_ALPHABLENDENABLE, TRUE}, - {D3DRS_SRCBLEND, D3DBLEND_SRCALPHA}, - {D3DRS_DESTBLEND, D3DBLEND_INVSRCALPHA}, - {D3DRS_CULLMODE, D3DCULL_NONE}, - {D3DRS_ZENABLE, FALSE}, - {D3DRS_FOGENABLE, FALSE}, + {D3DRS_SRCBLEND, D3DBLEND_SRCALPHA}, + {D3DRS_DESTBLEND, D3DBLEND_INVSRCALPHA}, + {D3DRS_CULLMODE, D3DCULL_NONE}, + {D3DRS_ZENABLE, FALSE}, + {D3DRS_FOGENABLE, FALSE}, }; const int TS[6][2] = { @@ -193,10 +193,10 @@ bool DXCheck( std::wstring& msg ) HINSTANCE hDll = LoadLibrary(StringFromFormat( _T("d3dx9_%d.dll"), D3DX_SDK_VERSION).c_str()); if( !hDll ) { - msg = _T("Please make sure that you have the latest version of DirectX 9.0c correctly installed."); + msg = _T("Please make sure that you have the latest version of DirectX correctly installed."); return false; } else - msg = _T("DirectX9 is up to date and ready to be used!"); + msg = _T("DirectX is up to date and ready to be used!"); FreeLibrary( hDll ); return true; } @@ -209,7 +209,7 @@ void RestoreShaders() D3D::SetTexture(0, 0); D3D::RefreshVertexDeclaration(); D3D::RefreshPixelShader(); - D3D::RefreshVertexShader(); + D3D::RefreshVertexShader(); } void RestoreRenderStates() @@ -250,7 +250,7 @@ int CD3DFont::DrawTextScaled(float x, float y, float fXScale, float fYScale, flo float vpWidth = 1; float vpHeight = 1; - float sx = x*vpWidth-0.5f; + float sx = x*vpWidth-0.5f; float sy = y*vpHeight-0.5f; float fStartX = sx; @@ -329,7 +329,7 @@ int CD3DFont::DrawTextScaled(float x, float y, float fXScale, float fYScale, flo v[4] = v[2]; v[5] = v[1]; - memcpy(pVertices, v, 6*sizeof(FONT2DVERTEX)); + memcpy(pVertices, v, 6*sizeof(FONT2DVERTEX)); pVertices+=6; dwNumTriangles += 2; @@ -395,10 +395,10 @@ void drawShadedTexQuad(IDirect3DTexture9 *texture, { 1.0f - dw, 1.0f + dh, 0.0f,1.0f, u2, v1, sw, sh,u1,v1,u2,v2} }; dev->SetVertexShader(Vshader); - dev->SetPixelShader(PShader); + dev->SetPixelShader(PShader); D3D::SetTexture(0, texture); dev->SetFVF(D3DFVF_XYZW | D3DFVF_TEX3 | D3DFVF_TEXCOORDSIZE4(2)); - dev->DrawPrimitiveUP(D3DPT_TRIANGLESTRIP, 2, coords, sizeof(Q2DVertex)); + dev->DrawPrimitiveUP(D3DPT_TRIANGLESTRIP, 2, coords, sizeof(Q2DVertex)); RestoreShaders(); } @@ -428,10 +428,10 @@ void drawShadedTexSubQuad(IDirect3DTexture9 *texture, { rDest->right - dw , rDest->bottom + dh, 1.0f,1.0f, u2, v1, sw, sh,u1,v1,u2,v2} }; dev->SetVertexShader(Vshader); - dev->SetPixelShader(PShader); + dev->SetPixelShader(PShader); D3D::SetTexture(0, texture); dev->SetFVF(D3DFVF_XYZW | D3DFVF_TEX3 | D3DFVF_TEXCOORDSIZE4(2)); - dev->DrawPrimitiveUP(D3DPT_TRIANGLESTRIP, 2, coords, sizeof(Q2DVertex)); + dev->DrawPrimitiveUP(D3DPT_TRIANGLESTRIP, 2, coords, sizeof(Q2DVertex)); RestoreShaders(); } @@ -444,9 +444,9 @@ void drawClearQuad(u32 Color,float z,IDirect3DPixelShader9 *PShader,IDirect3DVer {-1.0f, -1.0f, z, 1.0f, Color} }; dev->SetVertexShader(Vshader); - dev->SetPixelShader(PShader); + dev->SetPixelShader(PShader); dev->SetFVF(D3DFVF_XYZW | D3DFVF_DIFFUSE); - dev->DrawPrimitiveUP(D3DPT_TRIANGLEFAN, 2, coords, sizeof(Q2DVertex)); + dev->DrawPrimitiveUP(D3DPT_TRIANGLEFAN, 2, coords, sizeof(Q2DVertex)); RestoreShaders(); } diff --git a/Source/Plugins/Plugin_VideoDX9/Src/DlgSettings.cpp b/Source/Plugins/Plugin_VideoDX9/Src/DlgSettings.cpp index 0f94025832..d0a15c69fb 100644 --- a/Source/Plugins/Plugin_VideoDX9/Src/DlgSettings.cpp +++ b/Source/Plugins/Plugin_VideoDX9/Src/DlgSettings.cpp @@ -60,7 +60,7 @@ struct TabDirect3D : public W32Util::Tab } ComboBox_SetCurSel(GetDlgItem(hDlg, IDC_ANTIALIASMODE), g_Config.iMultisampleMode); - if (adapter.aa_levels.size() == 1) + if (adapter.aa_levels.size() == 1) { ComboBox_Enable(GetDlgItem(hDlg, IDC_ANTIALIASMODE), FALSE); } @@ -153,7 +153,7 @@ struct TabDirect3D : public W32Util::Tab g_Config.bVSync = Button_GetCheck(GetDlgItem(hDlg, IDC_VSYNC)) ? true : false; if(Button_GetCheck(GetDlgItem(hDlg, IDC_SAFE_TEXTURE_CACHE_SAFE))) { - g_Config.iSafeTextureCache_ColorSamples = 0; + g_Config.iSafeTextureCache_ColorSamples = 0; } else { @@ -162,14 +162,14 @@ struct TabDirect3D : public W32Util::Tab if(g_Config.iSafeTextureCache_ColorSamples < 512) { g_Config.iSafeTextureCache_ColorSamples = 512; - } + } } else { if(g_Config.iSafeTextureCache_ColorSamples > 128 || g_Config.iSafeTextureCache_ColorSamples == 0) { g_Config.iSafeTextureCache_ColorSamples = 128; - } + } } } g_Config.Save((std::string(File::GetUserPath(D_CONFIG_IDX)) + "gfx_dx9.ini").c_str()); @@ -274,10 +274,10 @@ struct TabEnhancements : public W32Util::Tab { void Init(HWND hDlg) { - Button_SetCheck(GetDlgItem(hDlg,IDC_FORCEFILTERING),g_Config.bForceFiltering); - Button_SetCheck(GetDlgItem(hDlg,IDC_FORCEANISOTROPY),g_Config.iMaxAnisotropy > 1); + Button_SetCheck(GetDlgItem(hDlg, IDC_FORCEFILTERING),g_Config.bForceFiltering); + Button_SetCheck(GetDlgItem(hDlg, IDC_FORCEANISOTROPY),g_Config.iMaxAnisotropy > 1); Button_SetCheck(GetDlgItem(hDlg, IDC_LOADHIRESTEXTURE), g_Config.bHiresTextures); - Button_SetCheck(GetDlgItem(hDlg,IDC_EFBSCALEDCOPY), g_Config.bCopyEFBScaled); + Button_SetCheck(GetDlgItem(hDlg, IDC_EFBSCALEDCOPY), g_Config.bCopyEFBScaled); /* Temporarily disabled the old postprocessing code since it wasn't working anyway. @@ -299,7 +299,7 @@ struct TabEnhancements : public W32Util::Tab ComboBox_SetCurSel(pp, g_Config.iPostprocessEffect); */ } - void Command(HWND hDlg,WPARAM wParam) + void Command(HWND hDlg, WPARAM wParam) { /* switch (LOWORD(wParam)) @@ -314,7 +314,7 @@ struct TabEnhancements : public W32Util::Tab g_Config.iMaxAnisotropy = Button_GetCheck(GetDlgItem(hDlg, IDC_FORCEANISOTROPY)) ? 8 : 1; g_Config.bForceFiltering = Button_GetCheck(GetDlgItem(hDlg, IDC_FORCEFILTERING)) ? true : false; g_Config.bHiresTextures = Button_GetCheck(GetDlgItem(hDlg, IDC_LOADHIRESTEXTURE)) ? true : false; - g_Config.bCopyEFBScaled = Button_GetCheck(GetDlgItem(hDlg,IDC_EFBSCALEDCOPY)) ? true : false; + g_Config.bCopyEFBScaled = Button_GetCheck(GetDlgItem(hDlg, IDC_EFBSCALEDCOPY)) ? true : false; g_Config.Save((std::string(File::GetUserPath(D_CONFIG_IDX)) + "gfx_dx9.ini").c_str()); } }; @@ -333,12 +333,10 @@ void DlgSettings_Show(HINSTANCE hInstance, HWND _hParent) #ifdef DEBUGFAST sheet.Show(hInstance,_hParent,_T("DX9 Graphics Plugin (DEBUGFAST)")); -#else -#ifndef _DEBUG - sheet.Show(hInstance,_hParent,_T("DX9 Graphics Plugin")); -#else +#elif defined _DEBUG sheet.Show(hInstance,_hParent,_T("DX9 Graphics Plugin (DEBUG)")); -#endif +#else + sheet.Show(hInstance,_hParent,_T("DX9 Graphics Plugin")); #endif if ((tfoe != g_Config.bTexFmtOverlayEnable) || diff --git a/Source/Plugins/Plugin_VideoDX9/Src/EmuWindow.cpp b/Source/Plugins/Plugin_VideoDX9/Src/EmuWindow.cpp index a4390f892e..9cf1dfc213 100644 --- a/Source/Plugins/Plugin_VideoDX9/Src/EmuWindow.cpp +++ b/Source/Plugins/Plugin_VideoDX9/Src/EmuWindow.cpp @@ -181,7 +181,7 @@ void OSDMenu(WPARAM wParam) case '7': OSDChoice = 5; g_Config.bDisableLighting = !g_Config.bDisableLighting; - break; + break; } } diff --git a/Source/Plugins/Plugin_VideoDX9/Src/FramebufferManager.cpp b/Source/Plugins/Plugin_VideoDX9/Src/FramebufferManager.cpp index 6149cbde80..d18f9ebb92 100644 --- a/Source/Plugins/Plugin_VideoDX9/Src/FramebufferManager.cpp +++ b/Source/Plugins/Plugin_VideoDX9/Src/FramebufferManager.cpp @@ -24,187 +24,197 @@ #include "TextureConverter.h" #undef CHECK -#define CHECK(hr,Message) if (FAILED(hr)) { PanicAlert(__FUNCTION__ " FAIL: %s" ,Message); } +#define CHECK(hr, Message) if (FAILED(hr)) { PanicAlert(__FUNCTION__ " FAIL: %s" , Message); } FramebufferManager FBManager; -LPDIRECT3DSURFACE9 FramebufferManager::GetEFBColorRTSurface() -{ - return s_efb_color_surface; +LPDIRECT3DSURFACE9 FramebufferManager::GetEFBColorRTSurface() +{ + return s_efb_color_surface; } -LPDIRECT3DSURFACE9 FramebufferManager::GetEFBDepthRTSurface() -{ - return s_efb_depth_surface; +LPDIRECT3DSURFACE9 FramebufferManager::GetEFBDepthRTSurface() +{ + return s_efb_depth_surface; } -LPDIRECT3DSURFACE9 FramebufferManager::GetEFBColorOffScreenRTSurface() -{ - return s_efb_color_OffScreenReadBuffer; -} -LPDIRECT3DSURFACE9 FramebufferManager::GetEFBDepthOffScreenRTSurface() -{ - return s_efb_depth_OffScreenReadBuffer; +LPDIRECT3DSURFACE9 FramebufferManager::GetEFBColorOffScreenRTSurface() +{ + return s_efb_color_OffScreenReadBuffer; } -LPDIRECT3DSURFACE9 FramebufferManager::GetEFBColorReadSurface() -{ - return s_efb_color_ReadBuffer; +LPDIRECT3DSURFACE9 FramebufferManager::GetEFBDepthOffScreenRTSurface() +{ + return s_efb_depth_OffScreenReadBuffer; } -LPDIRECT3DSURFACE9 FramebufferManager::GetEFBDepthReadSurface() -{ - return s_efb_depth_ReadBuffer; +LPDIRECT3DSURFACE9 FramebufferManager::GetEFBColorReadSurface() +{ + return s_efb_color_ReadBuffer; } -D3DFORMAT FramebufferManager::GetEFBDepthRTSurfaceFormat(){return s_efb_depth_surface_Format;} -D3DFORMAT FramebufferManager::GetEFBDepthReadSurfaceFormat(){return s_efb_depth_ReadBuffer_Format;} -D3DFORMAT FramebufferManager::GetEFBColorRTSurfaceFormat(){return s_efb_color_surface_Format;} +LPDIRECT3DSURFACE9 FramebufferManager::GetEFBDepthReadSurface() +{ + return s_efb_depth_ReadBuffer; +} +D3DFORMAT FramebufferManager::GetEFBDepthRTSurfaceFormat() +{ + return s_efb_depth_surface_Format; +} + +D3DFORMAT FramebufferManager::GetEFBDepthReadSurfaceFormat() +{ + return s_efb_depth_ReadBuffer_Format; +} + +D3DFORMAT FramebufferManager::GetEFBColorRTSurfaceFormat() +{ + return s_efb_color_surface_Format; +} LPDIRECT3DTEXTURE9 FramebufferManager::GetEFBColorTexture(const EFBRectangle& sourceRc) { return s_efb_color_texture; } - LPDIRECT3DTEXTURE9 FramebufferManager::GetEFBDepthTexture(const EFBRectangle &sourceRc) { return s_efb_depth_texture; } - - void FramebufferManager::Create() -{ +{ // Simplest possible setup to start with. int target_width = Renderer::GetFullTargetWidth(); int target_height = Renderer::GetFullTargetHeight(); s_efb_color_surface_Format = D3DFMT_A8R8G8B8; //get the framebuffer texture - HRESULT hr = D3D::dev->CreateTexture(target_width, target_height, 1, D3DUSAGE_RENDERTARGET, s_efb_color_surface_Format, - D3DPOOL_DEFAULT, &s_efb_color_texture, NULL); + HRESULT hr = D3D::dev->CreateTexture(target_width, target_height, 1, D3DUSAGE_RENDERTARGET, s_efb_color_surface_Format, + D3DPOOL_DEFAULT, &s_efb_color_texture, NULL); if(s_efb_color_texture) { - hr = s_efb_color_texture->GetSurfaceLevel(0,&s_efb_color_surface); - } - CHECK(hr,"Create Color Texture"); - hr = D3D::dev->CreateTexture(1, 1, 1, D3DUSAGE_RENDERTARGET, s_efb_color_surface_Format, - D3DPOOL_DEFAULT, &s_efb_colorRead_texture, NULL); - CHECK(hr,"Create Color Read Texture"); + hr = s_efb_color_texture->GetSurfaceLevel(0, &s_efb_color_surface); + } + CHECK(hr, "Create Color Texture"); + hr = D3D::dev->CreateTexture(1, 1, 1, D3DUSAGE_RENDERTARGET, s_efb_color_surface_Format, + D3DPOOL_DEFAULT, &s_efb_colorRead_texture, NULL); + CHECK(hr, "Create Color Read Texture"); if(s_efb_colorRead_texture) { - s_efb_colorRead_texture->GetSurfaceLevel(0,&s_efb_color_ReadBuffer); + s_efb_colorRead_texture->GetSurfaceLevel(0, &s_efb_color_ReadBuffer); } //create an offscreen surface that we can lock to retrieve the data - hr = D3D::dev->CreateOffscreenPlainSurface(1, 1, s_efb_color_surface_Format, D3DPOOL_SYSTEMMEM, &s_efb_color_OffScreenReadBuffer, NULL ); - CHECK(hr,"Create Color offScreen Surface"); + hr = D3D::dev->CreateOffscreenPlainSurface(1, 1, s_efb_color_surface_Format, D3DPOOL_SYSTEMMEM, &s_efb_color_OffScreenReadBuffer, NULL); + CHECK(hr, "Create Color offScreen Surface"); //Select Zbuffer format supported by hadware. if (g_ActiveConfig.bEFBAccessEnable) - { + { D3DFORMAT *DepthTexFormats = new D3DFORMAT[5]; - DepthTexFormats[0] = FOURCC_INTZ; + DepthTexFormats[0] = FOURCC_INTZ; DepthTexFormats[1] = FOURCC_DF24; DepthTexFormats[2] = FOURCC_RAWZ; DepthTexFormats[3] = FOURCC_DF16; DepthTexFormats[4] = D3DFMT_D24X8; - for(int i = 0;i<5;i++) + for(int i = 0; i < 5; i++) { s_efb_depth_surface_Format = DepthTexFormats[i]; //get the framebuffer Depth texture - hr = D3D::dev->CreateTexture(target_width, target_height, 1, D3DUSAGE_DEPTHSTENCIL, s_efb_depth_surface_Format, + hr = D3D::dev->CreateTexture(target_width, target_height, 1, D3DUSAGE_DEPTHSTENCIL, s_efb_depth_surface_Format, D3DPOOL_DEFAULT, &s_efb_depth_texture, NULL); - if (!FAILED(hr)) break; - } + if (!FAILED(hr)) + break; + } CHECK(hr,"Depth Color Texture"); //get the Surface if(s_efb_depth_texture) { - s_efb_depth_texture->GetSurfaceLevel(0,&s_efb_depth_surface); + s_efb_depth_texture->GetSurfaceLevel(0, &s_efb_depth_surface); } //create a 4x4 pixel texture to work as a buffer for peeking if(s_efb_depth_surface_Format == FOURCC_RAWZ || s_efb_depth_surface_Format == D3DFMT_D24X8) { - DepthTexFormats[0] = D3DFMT_A8R8G8B8; + DepthTexFormats[0] = D3DFMT_A8R8G8B8; } else { DepthTexFormats[0] = D3DFMT_R32F; } - DepthTexFormats[1] = D3DFMT_A8R8G8B8; + DepthTexFormats[1] = D3DFMT_A8R8G8B8; - for(int i = 0;i<2;i++) + for(int i = 0; i < 2; i++) { s_efb_depth_ReadBuffer_Format = DepthTexFormats[i]; //get the framebuffer Depth texture - hr = D3D::dev->CreateTexture(4, 4, 1, D3DUSAGE_RENDERTARGET, s_efb_depth_ReadBuffer_Format, + hr = D3D::dev->CreateTexture(4, 4, 1, D3DUSAGE_RENDERTARGET, s_efb_depth_ReadBuffer_Format, D3DPOOL_DEFAULT, &s_efb_depthRead_texture, NULL); - if (!FAILED(hr)) break; + if (!FAILED(hr)) + break; } - CHECK(hr,"Create Depth Read texture"); + CHECK(hr, "Create Depth Read texture"); if(s_efb_depthRead_texture) { - s_efb_depthRead_texture->GetSurfaceLevel(0,&s_efb_depth_ReadBuffer); + s_efb_depthRead_texture->GetSurfaceLevel(0, &s_efb_depth_ReadBuffer); } //create an offscreen surface that we can lock to retrieve the data - hr = D3D::dev->CreateOffscreenPlainSurface(4, 4, s_efb_depth_ReadBuffer_Format, D3DPOOL_SYSTEMMEM, &s_efb_depth_OffScreenReadBuffer, NULL ); - CHECK(hr,"Create Depth offScreen Surface"); - delete [] DepthTexFormats; + hr = D3D::dev->CreateOffscreenPlainSurface(4, 4, s_efb_depth_ReadBuffer_Format, D3DPOOL_SYSTEMMEM, &s_efb_depth_OffScreenReadBuffer, NULL); + CHECK(hr, "Create Depth offScreen Surface"); + delete [] DepthTexFormats; } else { s_efb_depth_surface_Format = D3DFMT_D24X8; - hr = D3D::dev->CreateDepthStencilSurface(target_width, target_height, s_efb_depth_surface_Format, + hr = D3D::dev->CreateDepthStencilSurface(target_width, target_height, s_efb_depth_surface_Format, D3DMULTISAMPLE_NONE, 0, FALSE, &s_efb_depth_surface, NULL); - CHECK(hr,"CreateDepthStencilSurface"); - } + CHECK(hr, "CreateDepthStencilSurface"); + } } void FramebufferManager::Destroy() -{ +{ if (s_efb_depth_surface) s_efb_depth_surface->Release(); - s_efb_depth_surface=NULL; + s_efb_depth_surface = NULL; if (s_efb_color_surface) s_efb_color_surface->Release(); - s_efb_color_surface=NULL; + s_efb_color_surface = NULL; if (s_efb_color_ReadBuffer) s_efb_color_ReadBuffer->Release(); - s_efb_color_ReadBuffer=NULL; + s_efb_color_ReadBuffer = NULL; if (s_efb_depth_ReadBuffer) s_efb_depth_ReadBuffer->Release(); - s_efb_depth_ReadBuffer=NULL; + s_efb_depth_ReadBuffer = NULL; if (s_efb_color_OffScreenReadBuffer) s_efb_color_OffScreenReadBuffer->Release(); - s_efb_color_OffScreenReadBuffer=NULL; + s_efb_color_OffScreenReadBuffer = NULL; if (s_efb_depth_OffScreenReadBuffer) s_efb_depth_OffScreenReadBuffer->Release(); - s_efb_depth_OffScreenReadBuffer=NULL; + s_efb_depth_OffScreenReadBuffer = NULL; if (s_efb_color_texture) s_efb_color_texture->Release(); - s_efb_color_texture=NULL; + s_efb_color_texture = NULL; if (s_efb_colorRead_texture) s_efb_colorRead_texture->Release(); - s_efb_colorRead_texture=NULL; + s_efb_colorRead_texture = NULL; if (s_efb_depth_texture) s_efb_depth_texture->Release(); - s_efb_depth_texture=NULL; + s_efb_depth_texture = NULL; if (s_efb_depthRead_texture) s_efb_depthRead_texture->Release(); - s_efb_depthRead_texture=NULL; + s_efb_depthRead_texture = NULL; for (VirtualXFBListType::iterator it = m_virtualXFBList.begin(); it != m_virtualXFBList.end(); ++it) { @@ -213,7 +223,7 @@ void FramebufferManager::Destroy() } m_virtualXFBList.clear(); if(m_realXFBSource.texture) - m_realXFBSource.texture->Release(); + m_realXFBSource.texture->Release(); m_realXFBSource.texture = NULL; } @@ -255,7 +265,7 @@ FramebufferManager::VirtualXFBListType::iterator FramebufferManager::findVirtual void FramebufferManager::replaceVirtualXFB() { - VirtualXFBListType::iterator it = m_virtualXFBList.begin(); + VirtualXFBListType::iterator it = m_virtualXFBList.begin(); s32 srcLower = it->xfbAddr; s32 srcUpper = it->xfbAddr + 2 * it->xfbWidth * it->xfbHeight; @@ -276,7 +286,7 @@ void FramebufferManager::replaceVirtualXFB() it->xfbWidth = 0; } else if (addrRangesOverlap(srcLower, srcUpper, dstLower, dstUpper)) - { + { s32 upperOverlap = (srcUpper - dstLower) / lineSize; s32 lowerOverlap = (dstUpper - srcLower) / lineSize; @@ -343,15 +353,15 @@ void FramebufferManager::copyToVirtualXFB(u32 xfbAddr, u32 fbWidth, u32 fbHeight it->xfbSource.srcAddr = xfbAddr; it->xfbSource.srcWidth = fbWidth; - it->xfbSource.srcHeight = fbHeight; + it->xfbSource.srcHeight = fbHeight; if(it->xfbSource.texWidth != target_width || it->xfbSource.texHeight != target_height || !(it->xfbSource.texture)) { if(it->xfbSource.texture) it->xfbSource.texture->Release(); it->xfbSource.texture = NULL; - hr = D3D::dev->CreateTexture(target_width, target_height, 1, D3DUSAGE_RENDERTARGET, s_efb_color_surface_Format, - D3DPOOL_DEFAULT, &(it->xfbSource.texture), NULL); + hr = D3D::dev->CreateTexture(target_width, target_height, 1, D3DUSAGE_RENDERTARGET, s_efb_color_surface_Format, + D3DPOOL_DEFAULT, &(it->xfbSource.texture), NULL); } @@ -370,8 +380,8 @@ void FramebufferManager::copyToVirtualXFB(u32 xfbAddr, u32 fbWidth, u32 fbHeight { // Create a new Virtual XFB and place it at the front of the list. - D3D::dev->CreateTexture(target_width, target_height, 1, D3DUSAGE_RENDERTARGET, s_efb_color_surface_Format, - D3DPOOL_DEFAULT, &xfbTexture, NULL); + D3D::dev->CreateTexture(target_width, target_height, 1, D3DUSAGE_RENDERTARGET, s_efb_color_surface_Format, + D3DPOOL_DEFAULT, &xfbTexture, NULL); VirtualXFB newVirt; newVirt.xfbAddr = xfbAddr; @@ -380,7 +390,7 @@ void FramebufferManager::copyToVirtualXFB(u32 xfbAddr, u32 fbWidth, u32 fbHeight newVirt.xfbSource.texture = xfbTexture; newVirt.xfbSource.texWidth = target_width; - newVirt.xfbSource.texHeight = target_height; + newVirt.xfbSource.texHeight = target_height; // Add the new Virtual XFB to the list @@ -399,14 +409,14 @@ void FramebufferManager::copyToVirtualXFB(u32 xfbAddr, u32 fbWidth, u32 fbHeight if(!xfbTexture) return; LPDIRECT3DTEXTURE9 read_texture = GetEFBColorTexture(sourceRc); - + Renderer::ResetAPIState(); // reset any game specific settings LPDIRECT3DSURFACE9 Rendersurf = NULL; - xfbTexture->GetSurfaceLevel(0,&Rendersurf); + xfbTexture->GetSurfaceLevel(0, &Rendersurf); D3D::dev->SetDepthStencilSurface(NULL); - D3D::dev->SetRenderTarget(0, Rendersurf); - + D3D::dev->SetRenderTarget(0, Rendersurf); + D3DVIEWPORT9 vp; vp.X = 0; @@ -424,27 +434,25 @@ void FramebufferManager::copyToVirtualXFB(u32 xfbAddr, u32 fbWidth, u32 fbHeight D3D::ChangeSamplerState(0, D3DSAMP_MINFILTER, D3DTEXF_LINEAR); D3D::ChangeSamplerState(0, D3DSAMP_MAGFILTER, D3DTEXF_LINEAR); - D3D::drawShadedTexQuad( - read_texture, + read_texture, &sourcerect, - Renderer::GetFullTargetWidth() , - Renderer::GetFullTargetHeight(), - target_width, - target_height, - PixelShaderCache::GetColorCopyProgram( g_ActiveConfig.iMultisampleMode), - VertexShaderCache::GetSimpleVertexShader( g_ActiveConfig.iMultisampleMode)); + Renderer::GetFullTargetWidth(), + Renderer::GetFullTargetHeight(), + target_width, + target_height, + PixelShaderCache::GetColorCopyProgram( g_ActiveConfig.iMultisampleMode), + VertexShaderCache::GetSimpleVertexShader( g_ActiveConfig.iMultisampleMode)); D3D::RefreshSamplerState(0, D3DSAMP_MINFILTER); D3D::RefreshSamplerState(0, D3DSAMP_MAGFILTER); - D3D::SetTexture(0,NULL); + D3D::SetTexture(0, NULL); D3D::dev->SetRenderTarget(0, GetEFBColorRTSurface()); - D3D::dev->SetDepthStencilSurface(GetEFBDepthRTSurface()); + D3D::dev->SetDepthStencilSurface(GetEFBDepthRTSurface()); Renderer::RestoreAPIState(); - Rendersurf->Release(); - + Rendersurf->Release(); } const XFBSource** FramebufferManager::getRealXFBSource(u32 xfbAddr, u32 fbWidth, u32 fbHeight, u32 &xfbCount) @@ -456,12 +464,12 @@ const XFBSource** FramebufferManager::getRealXFBSource(u32 xfbAddr, u32 fbWidth, m_realXFBSource.srcAddr = xfbAddr; m_realXFBSource.srcWidth = fbWidth; - m_realXFBSource.srcHeight = fbHeight; + m_realXFBSource.srcHeight = fbHeight; if (!m_realXFBSource.texture) { - D3D::dev->CreateTexture(fbWidth, fbHeight, 1, D3DUSAGE_RENDERTARGET, s_efb_color_surface_Format, - D3DPOOL_DEFAULT, &m_realXFBSource.texture, NULL); + D3D::dev->CreateTexture(fbWidth, fbHeight, 1, D3DUSAGE_RENDERTARGET, s_efb_color_surface_Format, + D3DPOOL_DEFAULT, &m_realXFBSource.texture, NULL); } // Decode YUYV data from GameCube RAM diff --git a/Source/Plugins/Plugin_VideoDX9/Src/FramebufferManager.h b/Source/Plugins/Plugin_VideoDX9/Src/FramebufferManager.h index e6deec19b8..00b2a14002 100644 --- a/Source/Plugins/Plugin_VideoDX9/Src/FramebufferManager.h +++ b/Source/Plugins/Plugin_VideoDX9/Src/FramebufferManager.h @@ -121,7 +121,7 @@ public: D3DFORMAT GetEFBColorRTSurfaceFormat(); D3DFORMAT GetEFBDepthReadSurfaceFormat(); LPDIRECT3DSURFACE9 GetEFBColorReadSurface(); - LPDIRECT3DSURFACE9 GetEFBDepthReadSurface(); + LPDIRECT3DSURFACE9 GetEFBDepthReadSurface(); private: @@ -163,7 +163,6 @@ private: LPDIRECT3DSURFACE9 s_efb_color_OffScreenReadBuffer;//System memory Surface that can be locked to retriebe the data LPDIRECT3DSURFACE9 s_efb_depth_OffScreenReadBuffer;//System memory Surface that can be locked to retriebe the data - D3DFORMAT s_efb_color_surface_Format;//Format of the color Surface D3DFORMAT s_efb_depth_surface_Format;//Format of the Depth Surface D3DFORMAT s_efb_depth_ReadBuffer_Format;//Format of the Depth color Read Surface diff --git a/Source/Plugins/Plugin_VideoDX9/Src/Render.cpp b/Source/Plugins/Plugin_VideoDX9/Src/Render.cpp index 72d55aa0b2..1ea435ad50 100644 --- a/Source/Plugins/Plugin_VideoDX9/Src/Render.cpp +++ b/Source/Plugins/Plugin_VideoDX9/Src/Render.cpp @@ -116,7 +116,7 @@ static const D3DBLEND d3dDestFactors[8] = D3DBLEND_INVDESTALPHA }; -static const D3DBLENDOP d3dLogincOPop[16] = +static const D3DBLENDOP d3dLogicOpop[16] = { D3DBLENDOP_ADD, D3DBLENDOP_ADD, @@ -239,7 +239,6 @@ void TeardownDeviceObjects() FBManager.Destroy(); D3D::font.Shutdown(); TextureCache::Invalidate(false); - VertexManager::DestroyDeviceObjects(); VertexLoaderManager::Shutdown(); VertexShaderCache::Clear(); PixelShaderCache::Clear(); @@ -1248,10 +1247,10 @@ void Renderer::Swap(u32 xfbAddr, FieldType field, u32 fbWidth, u32 fbHeight) void Renderer::ResetAPIState() { D3D::SetRenderState(D3DRS_SCISSORTESTENABLE, FALSE); - D3D::SetRenderState(D3DRS_CULLMODE, D3DCULL_NONE); + D3D::SetRenderState(D3DRS_CULLMODE, D3DCULL_CCW); D3D::SetRenderState(D3DRS_ALPHABLENDENABLE, FALSE); D3D::SetRenderState(D3DRS_ZENABLE, FALSE); - D3D::SetRenderState(D3DRS_ZWRITEENABLE, FALSE); + D3D::SetRenderState(D3DRS_ZWRITEENABLE, TRUE); DWORD color_mask = D3DCOLORWRITEENABLE_ALPHA| D3DCOLORWRITEENABLE_RED | D3DCOLORWRITEENABLE_GREEN | D3DCOLORWRITEENABLE_BLUE; D3D::SetRenderState(D3DRS_COLORWRITEENABLE, color_mask); } @@ -1294,7 +1293,7 @@ void Renderer::SetLogicOpMode() { s_blendMode = 0; D3D::SetRenderState(D3DRS_ALPHABLENDENABLE, 1); - D3D::SetRenderState(D3DRS_BLENDOP, d3dLogincOPop[bpmem.blendmode.logicmode]); + D3D::SetRenderState(D3DRS_BLENDOP, d3dLogicOpop[bpmem.blendmode.logicmode]); D3D::SetRenderState(D3DRS_SRCBLEND, d3dLogicOpSrcFactors[bpmem.blendmode.logicmode]); D3D::SetRenderState(D3DRS_DESTBLEND, d3dLogicOpDestFactors[bpmem.blendmode.logicmode]); } diff --git a/Source/Plugins/Plugin_VideoDX9/Src/TextureCache.cpp b/Source/Plugins/Plugin_VideoDX9/Src/TextureCache.cpp index f17a1774ea..f7e0820115 100644 --- a/Source/Plugins/Plugin_VideoDX9/Src/TextureCache.cpp +++ b/Source/Plugins/Plugin_VideoDX9/Src/TextureCache.cpp @@ -106,7 +106,7 @@ bool TextureCache::TCacheEntry::IntersectsMemoryRange(u32 range_address, u32 ran void TextureCache::Shutdown() { Invalidate(true); - FreeMemoryPages(temp, TEMP_SIZE); + FreeMemoryPages(temp, TEMP_SIZE); temp = NULL; } @@ -131,8 +131,8 @@ void TextureCache::Cleanup() } else { - ++iter; - } + ++iter; + } } } @@ -196,7 +196,7 @@ TextureCache::TCacheEntry *TextureCache::Load(int stage, u32 address, int width, } else { - // Let's reload the new texture data into the same texture, + // Let's reload the new texture data into the same texture, // instead of destroying it and having to create a new one. // Might speed up movie playback very, very slightly. @@ -274,7 +274,7 @@ TextureCache::TCacheEntry *TextureCache::Load(int stage, u32 address, int width, else { entry.hash = (u32)(((double)rand() / RAND_MAX) * 0xFFFFFFFF); - ((u32 *)ptr)[0] = entry.hash; + ((u32 *)ptr)[0] = entry.hash; } entry.addr = address; @@ -287,11 +287,11 @@ TextureCache::TCacheEntry *TextureCache::Load(int stage, u32 address, int width, if(TexLevels > maxlevel && maxlevel > 0) TexLevels = maxlevel; entry.MipLevels = maxlevel; - if (!skip_texture_create) - { + if (!skip_texture_create) + { entry.texture = D3D::CreateTexture2D((BYTE*)temp, width, height, expandedWidth, d3d_fmt, swap_r_b, TexLevels); - } - else + } + else { D3D::ReplaceTexture2D(entry.texture, (BYTE*)temp, width, height, expandedWidth, d3d_fmt, swap_r_b, 0); } @@ -366,7 +366,7 @@ void TextureCache::CopyRenderTargetToTexture(u32 address, bool bFromZBuffer, boo SuperSampleCompensation = 1.0f / SuperSampleCompensation; float xScale = Renderer::GetTargetScaleX(); float yScale = Renderer::GetTargetScaleY(); - + int Scaledtex_w = (g_ActiveConfig.bCopyEFBScaled)?((int)(xScale * SuperSampleCompensation * tex_w)):tex_w; int Scaledtex_h = (g_ActiveConfig.bCopyEFBScaled)?((int)(yScale * SuperSampleCompensation * tex_h)):tex_h; @@ -376,7 +376,7 @@ void TextureCache::CopyRenderTargetToTexture(u32 address, bool bFromZBuffer, boo if (iter != textures.end()) { if (iter->second.isRenderTarget && iter->second.Scaledw == Scaledtex_w && iter->second.Scaledh == Scaledtex_h) - { + { tex = iter->second.texture; iter->second.frameCount = frameCount; } @@ -409,122 +409,122 @@ void TextureCache::CopyRenderTargetToTexture(u32 address, bool bFromZBuffer, boo float colmat[16]= {0.0f}; - float fConstAdd[4] = {0.0f}; + float fConstAdd[4] = {0.0f}; - if (bFromZBuffer) + if (bFromZBuffer) { - switch(copyfmt) + switch(copyfmt) { - case 0: // Z4 - case 1: // Z8 - colmat[0] = colmat[4] = colmat[8] = colmat[12] =1.0f; - break; - case 3: // Z16 //? - colmat[1] = colmat[5] = colmat[9] = colmat[12] = 1.0f; - case 11: // Z16 (reverse order) - colmat[0] = colmat[4] = colmat[8] = colmat[13] = 1.0f; - break; - case 6: // Z24X8 - colmat[0] = colmat[5] = colmat[10] = 1.0f; - break; - case 9: // Z8M - colmat[1] = colmat[5] = colmat[9] = colmat[13] = 1.0f; - break; - case 10: // Z8L - colmat[2] = colmat[6] = colmat[10] = colmat[14] = 1.0f; - break; - case 12: // Z16L - colmat[2] = colmat[6] = colmat[10] = colmat[13] = 1.0f; - break; - default: - ERROR_LOG(VIDEO, "Unknown copy zbuf format: 0x%x", copyfmt); - colmat[2] = colmat[5] = colmat[8] = 1.0f; - break; - } - } - else if (bIsIntensityFmt) + case 0: // Z4 + case 1: // Z8 + colmat[0] = colmat[4] = colmat[8] = colmat[12] =1.0f; + break; + case 3: // Z16 //? + colmat[1] = colmat[5] = colmat[9] = colmat[12] = 1.0f; + case 11: // Z16 (reverse order) + colmat[0] = colmat[4] = colmat[8] = colmat[13] = 1.0f; + break; + case 6: // Z24X8 + colmat[0] = colmat[5] = colmat[10] = 1.0f; + break; + case 9: // Z8M + colmat[1] = colmat[5] = colmat[9] = colmat[13] = 1.0f; + break; + case 10: // Z8L + colmat[2] = colmat[6] = colmat[10] = colmat[14] = 1.0f; + break; + case 12: // Z16L + colmat[2] = colmat[6] = colmat[10] = colmat[13] = 1.0f; + break; + default: + ERROR_LOG(VIDEO, "Unknown copy zbuf format: 0x%x", copyfmt); + colmat[2] = colmat[5] = colmat[8] = 1.0f; + break; + } + } + else if (bIsIntensityFmt) { - fConstAdd[0] = fConstAdd[1] = fConstAdd[2] = 16.0f/255.0f; - switch (copyfmt) + fConstAdd[0] = fConstAdd[1] = fConstAdd[2] = 16.0f/255.0f; + switch (copyfmt) { - case 0: // I4 - case 1: // I8 - case 2: // IA4 - case 3: // IA8 + case 0: // I4 + case 1: // I8 + case 2: // IA4 + case 3: // IA8 // TODO - verify these coefficients - colmat[0] = 0.257f; colmat[1] = 0.504f; colmat[2] = 0.098f; - colmat[4] = 0.257f; colmat[5] = 0.504f; colmat[6] = 0.098f; - colmat[8] = 0.257f; colmat[9] = 0.504f; colmat[10] = 0.098f; + colmat[0] = 0.257f; colmat[1] = 0.504f; colmat[2] = 0.098f; + colmat[4] = 0.257f; colmat[5] = 0.504f; colmat[6] = 0.098f; + colmat[8] = 0.257f; colmat[9] = 0.504f; colmat[10] = 0.098f; - if (copyfmt < 2) + if (copyfmt < 2) { - fConstAdd[3] = 16.0f / 255.0f; - colmat[12] = 0.257f; colmat[13] = 0.504f; colmat[14] = 0.098f; - } - else// alpha - colmat[15] = 1; + fConstAdd[3] = 16.0f / 255.0f; + colmat[12] = 0.257f; colmat[13] = 0.504f; colmat[14] = 0.098f; + } + else// alpha + colmat[15] = 1; - break; - default: - ERROR_LOG(VIDEO, "Unknown copy intensity format: 0x%x", copyfmt); - colmat[0] = colmat[5] = colmat[10] = colmat[15] = 1; - break; - } - } - else + break; + default: + ERROR_LOG(VIDEO, "Unknown copy intensity format: 0x%x", copyfmt); + colmat[0] = colmat[5] = colmat[10] = colmat[15] = 1; + break; + } + } + else { - switch (copyfmt) + switch (copyfmt) { - case 0: // R4 - case 8: // R8 - colmat[0] = colmat[4] = colmat[8] = colmat[12] = 1; - break; - case 2: // RA4 - case 3: // RA8 - colmat[0] = colmat[4] = colmat[8] = colmat[15] = 1; - break; + case 0: // R4 + case 8: // R8 + colmat[0] = colmat[4] = colmat[8] = colmat[12] = 1; + break; + case 2: // RA4 + case 3: // RA8 + colmat[0] = colmat[4] = colmat[8] = colmat[15] = 1; + break; - case 7: // A8 - colmat[3] = colmat[7] = colmat[11] = colmat[15] = 1; - break; - case 9: // G8 - colmat[1] = colmat[5] = colmat[9] = colmat[13] = 1; - break; - case 10: // B8 - colmat[2] = colmat[6] = colmat[10] = colmat[14] = 1; - break; - case 11: // RG8 - colmat[0] = colmat[4] = colmat[8] = colmat[13] = 1; - break; - case 12: // GB8 - colmat[1] = colmat[5] = colmat[9] = colmat[14] = 1; - break; + case 7: // A8 + colmat[3] = colmat[7] = colmat[11] = colmat[15] = 1; + break; + case 9: // G8 + colmat[1] = colmat[5] = colmat[9] = colmat[13] = 1; + break; + case 10: // B8 + colmat[2] = colmat[6] = colmat[10] = colmat[14] = 1; + break; + case 11: // RG8 + colmat[0] = colmat[4] = colmat[8] = colmat[13] = 1; + break; + case 12: // GB8 + colmat[1] = colmat[5] = colmat[9] = colmat[14] = 1; + break; - case 4: // RGB565 - colmat[0] = colmat[5] = colmat[10] = 1; - fConstAdd[3] = 1; // set alpha to 1 - break; - case 5: // RGB5A3 - case 6: // RGBA8 - colmat[0] = colmat[5] = colmat[10] = colmat[15] = 1; - break; + case 4: // RGB565 + colmat[0] = colmat[5] = colmat[10] = 1; + fConstAdd[3] = 1; // set alpha to 1 + break; + case 5: // RGB5A3 + case 6: // RGBA8 + colmat[0] = colmat[5] = colmat[10] = colmat[15] = 1; + break; - default: - ERROR_LOG(VIDEO, "Unknown copy color format: 0x%x", copyfmt); - colmat[0] = colmat[5] = colmat[10] = colmat[15] = 1; - break; - } - } + default: + ERROR_LOG(VIDEO, "Unknown copy color format: 0x%x", copyfmt); + colmat[0] = colmat[5] = colmat[10] = colmat[15] = 1; + break; + } + } // Make sure to resolve anything we need to read from. LPDIRECT3DTEXTURE9 read_texture = bFromZBuffer ? FBManager.GetEFBDepthTexture(source_rect) : FBManager.GetEFBColorTexture(source_rect); - - // We have to run a pixel shader, for color conversion. - Renderer::ResetAPIState(); // reset any game specific settings + + // We have to run a pixel shader, for color conversion. + Renderer::ResetAPIState(); // reset any game specific settings LPDIRECT3DSURFACE9 Rendersurf = NULL; tex->GetSurfaceLevel(0,&Rendersurf); D3D::dev->SetDepthStencilSurface(NULL); - D3D::dev->SetRenderTarget(0, Rendersurf); - + D3D::dev->SetRenderTarget(0, Rendersurf); + D3DVIEWPORT9 vp; // Stretch picture with increased internal resolution @@ -553,14 +553,14 @@ void TextureCache::CopyRenderTargetToTexture(u32 address, bool bFromZBuffer, boo if(bScaleByHalf) { D3D::ChangeSamplerState(0, D3DSAMP_MINFILTER, D3DTEXF_LINEAR); - D3D::ChangeSamplerState(0, D3DSAMP_MAGFILTER, D3DTEXF_LINEAR); + D3D::ChangeSamplerState(0, D3DSAMP_MAGFILTER, D3DTEXF_LINEAR); } - else + else { D3D::ChangeSamplerState(0, D3DSAMP_MINFILTER, D3DTEXF_POINT); D3D::ChangeSamplerState(0, D3DSAMP_MAGFILTER, D3DTEXF_POINT); } - + D3DFORMAT bformat = FBManager.GetEFBDepthRTSurfaceFormat(); int SSAAMode = ( g_ActiveConfig.iMultisampleMode > 3 )? 0 : g_ActiveConfig.iMultisampleMode; @@ -572,14 +572,15 @@ void TextureCache::CopyRenderTargetToTexture(u32 address, bool bFromZBuffer, boo Scaledtex_w, Scaledtex_h, ((bformat != FOURCC_RAWZ && bformat != D3DFMT_D24X8) && bFromZBuffer)? PixelShaderCache::GetDepthMatrixProgram(SSAAMode): PixelShaderCache::GetColorMatrixProgram(SSAAMode), - VertexShaderCache::GetSimpleVertexShader(SSAAMode)); + VertexShaderCache::GetSimpleVertexShader(SSAAMode)); D3D::RefreshSamplerState(0, D3DSAMP_MINFILTER); D3D::RefreshSamplerState(0, D3DSAMP_MAGFILTER); D3D::SetTexture(0,NULL); D3D::dev->SetRenderTarget(0, FBManager.GetEFBColorRTSurface()); - D3D::dev->SetDepthStencilSurface(FBManager.GetEFBDepthRTSurface()); - Renderer::RestoreAPIState(); + D3D::dev->SetDepthStencilSurface(FBManager.GetEFBDepthRTSurface()); + Renderer::RestoreAPIState(); Rendersurf->Release(); } + diff --git a/Source/Plugins/Plugin_VideoDX9/Src/VertexManager.cpp b/Source/Plugins/Plugin_VideoDX9/Src/VertexManager.cpp index 8ca9354710..3e9b595f48 100644 --- a/Source/Plugins/Plugin_VideoDX9/Src/VertexManager.cpp +++ b/Source/Plugins/Plugin_VideoDX9/Src/VertexManager.cpp @@ -50,17 +50,14 @@ namespace VertexManager static int lastPrimitive; -static u8 *LocalVBuffer; +static u8 *LocalVBuffer; static u16 *TIBuffer; -static u16 *LIBuffer; +static u16 *LIBuffer; static u16 *PIBuffer; #define MAXVBUFFERSIZE 0x50000 #define MAXIBUFFERSIZE 0xFFFF static bool Flushed=false; -void CreateDeviceObjects(); -void DestroyDeviceObjects(); - bool Init() { LocalVBuffer = new u8[MAXVBUFFERSIZE]; @@ -69,18 +66,17 @@ bool Init() PIBuffer = new u16[MAXIBUFFERSIZE]; s_pCurBufferPointer = LocalVBuffer; Flushed=false; - IndexGenerator::Start(TIBuffer,LIBuffer,PIBuffer); + IndexGenerator::Start(TIBuffer,LIBuffer,PIBuffer); return true; } void ResetBuffer() { - s_pCurBufferPointer = LocalVBuffer; + s_pCurBufferPointer = LocalVBuffer; } void Shutdown() { - DestroyDeviceObjects(); delete [] LocalVBuffer; delete [] TIBuffer; delete [] LIBuffer; @@ -88,25 +84,16 @@ void Shutdown() ResetBuffer(); } -void CreateDeviceObjects() -{ - -} - -void DestroyDeviceObjects() -{ -} - void AddIndices(int _primitive, int _numVertices) { switch (_primitive) { - case GX_DRAW_QUADS: IndexGenerator::AddQuads(_numVertices); break; + case GX_DRAW_QUADS: IndexGenerator::AddQuads(_numVertices); break; case GX_DRAW_TRIANGLES: IndexGenerator::AddList(_numVertices); break; case GX_DRAW_TRIANGLE_STRIP: IndexGenerator::AddStrip(_numVertices); break; case GX_DRAW_TRIANGLE_FAN: IndexGenerator::AddFan(_numVertices); break; case GX_DRAW_LINE_STRIP: IndexGenerator::AddLineStrip(_numVertices); break; - case GX_DRAW_LINES: IndexGenerator::AddLineList(_numVertices); break; + case GX_DRAW_LINES: IndexGenerator::AddLineList(_numVertices); break; case GX_DRAW_POINTS: IndexGenerator::AddPoints(_numVertices); break; } } @@ -122,10 +109,10 @@ int GetRemainingVertices(int primitive) { switch (primitive) { - case GX_DRAW_QUADS: - case GX_DRAW_TRIANGLES: - case GX_DRAW_TRIANGLE_STRIP: - case GX_DRAW_TRIANGLE_FAN: + case GX_DRAW_QUADS: + case GX_DRAW_TRIANGLES: + case GX_DRAW_TRIANGLE_STRIP: + case GX_DRAW_TRIANGLE_FAN: return (MAXIBUFFERSIZE - IndexGenerator::GetTriangleindexLen())/3; case GX_DRAW_LINE_STRIP: case GX_DRAW_LINES: @@ -142,10 +129,10 @@ void AddVertices(int _primitive, int _numVertices) return; switch (_primitive) { - case GX_DRAW_QUADS: - case GX_DRAW_TRIANGLES: - case GX_DRAW_TRIANGLE_STRIP: - case GX_DRAW_TRIANGLE_FAN: + case GX_DRAW_QUADS: + case GX_DRAW_TRIANGLES: + case GX_DRAW_TRIANGLE_STRIP: + case GX_DRAW_TRIANGLE_FAN: if(MAXIBUFFERSIZE - IndexGenerator::GetTriangleindexLen() < 3 * _numVertices) Flush(); break; @@ -165,7 +152,7 @@ void AddVertices(int _primitive, int _numVertices) IndexGenerator::Start(TIBuffer,LIBuffer,PIBuffer); Flushed=false; } - lastPrimitive = _primitive; + lastPrimitive = _primitive; ADDSTAT(stats.thisFrame.numPrims, _numVertices); INCSTAT(stats.thisFrame.numPrimitiveJoins); AddIndices(_primitive, _numVertices); @@ -195,11 +182,11 @@ inline void Draw(int stride) { if (FAILED(D3D::dev->DrawIndexedPrimitiveUP( D3DPT_TRIANGLELIST, - 0, IndexGenerator::GetNumVerts(), IndexGenerator::GetNumTriangles(), - TIBuffer, - D3DFMT_INDEX16, - LocalVBuffer, - stride))) + 0, IndexGenerator::GetNumVerts(), IndexGenerator::GetNumTriangles(), + TIBuffer, + D3DFMT_INDEX16, + LocalVBuffer, + stride))) { DumpBadShaders(); } @@ -209,11 +196,11 @@ inline void Draw(int stride) { if (FAILED(D3D::dev->DrawIndexedPrimitiveUP( D3DPT_LINELIST, - 0, IndexGenerator::GetNumVerts(), IndexGenerator::GetNumLines(), - LIBuffer, - D3DFMT_INDEX16, - LocalVBuffer, - stride))) + 0, IndexGenerator::GetNumVerts(), IndexGenerator::GetNumLines(), + LIBuffer, + D3DFMT_INDEX16, + LocalVBuffer, + stride))) { DumpBadShaders(); } @@ -223,11 +210,11 @@ inline void Draw(int stride) { if (FAILED(D3D::dev->DrawIndexedPrimitiveUP( D3DPT_POINTLIST, - 0, IndexGenerator::GetNumVerts(), IndexGenerator::GetNumPoints(), - PIBuffer, - D3DFMT_INDEX16, - LocalVBuffer, - stride))) + 0, IndexGenerator::GetNumVerts(), IndexGenerator::GetNumPoints(), + PIBuffer, + D3DFMT_INDEX16, + LocalVBuffer, + stride))) { DumpBadShaders(); } @@ -237,7 +224,7 @@ inline void Draw(int stride) void Flush() { - if (LocalVBuffer == s_pCurBufferPointer) return; + if (LocalVBuffer == s_pCurBufferPointer) return; if(Flushed) return; Flushed=true; @@ -264,11 +251,11 @@ void Flush() Renderer::SetSamplerState(i & 3, i >> 2); FourTexUnits &tex = bpmem.tex[i >> 2]; TextureCache::TCacheEntry* tentry = TextureCache::Load(i, - (tex.texImage3[i&3].image_base/* & 0x1FFFFF*/) << 5, - tex.texImage0[i&3].width + 1, tex.texImage0[i&3].height + 1, + (tex.texImage3[i&3].image_base/* & 0x1FFFFF*/) << 5, + tex.texImage0[i&3].width + 1, tex.texImage0[i&3].height + 1, tex.texImage0[i&3].format, tex.texTlut[i&3].tmem_offset<<9, tex.texTlut[i&3].tlut_format, - (tex.texMode0[i&3].min_filter & 3) && (tex.texMode0[i&3].min_filter != 8) && g_ActiveConfig.bUseNativeMips, + (tex.texMode0[i&3].min_filter & 3) && (tex.texMode0[i&3].min_filter != 8) && g_ActiveConfig.bUseNativeMips, (tex.texMode1[i&3].max_lod >> 5)); if (tentry) { @@ -307,7 +294,7 @@ void Flush() Draw(stride); - if (bpmem.dstalpha.enable && bpmem.blendmode.alphaupdate) + if (bpmem.dstalpha.enable && bpmem.blendmode.alphaupdate) { DWORD write = 0; if (!PixelShaderCache::SetShader(true)) @@ -323,7 +310,7 @@ void Flush() Draw(stride); D3D::RefreshRenderState(D3DRS_COLORWRITEENABLE); - D3D::RefreshRenderState(D3DRS_ALPHABLENDENABLE); + D3D::RefreshRenderState(D3DRS_ALPHABLENDENABLE); } DEBUGGER_PAUSE_AT(NEXT_FLUSH,true); diff --git a/Source/Plugins/Plugin_VideoDX9/Src/VertexManager.h b/Source/Plugins/Plugin_VideoDX9/Src/VertexManager.h index 6215b9d547..2fcb8c0639 100644 --- a/Source/Plugins/Plugin_VideoDX9/Src/VertexManager.h +++ b/Source/Plugins/Plugin_VideoDX9/Src/VertexManager.h @@ -30,9 +30,6 @@ void Shutdown(); void AddVertices(int _primitive, int _numVertices); void Flush(); -void CreateDeviceObjects(); -void DestroyDeviceObjects(); - } // namespace #endif diff --git a/Source/Plugins/Plugin_VideoOGL/Src/Render.cpp b/Source/Plugins/Plugin_VideoOGL/Src/Render.cpp index c7893230d5..f178afb074 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/Render.cpp +++ b/Source/Plugins/Plugin_VideoOGL/Src/Render.cpp @@ -145,22 +145,22 @@ typedef struct static const GLenum glSrcFactors[8] = { - GL_ZERO, - GL_ONE, - GL_DST_COLOR, - GL_ONE_MINUS_DST_COLOR, - GL_SRC_ALPHA, - GL_ONE_MINUS_SRC_ALPHA, - GL_DST_ALPHA, - GL_ONE_MINUS_DST_ALPHA + GL_ZERO, + GL_ONE, + GL_DST_COLOR, + GL_ONE_MINUS_DST_COLOR, + GL_SRC_ALPHA, + GL_ONE_MINUS_SRC_ALPHA, + GL_DST_ALPHA, + GL_ONE_MINUS_DST_ALPHA }; static const GLenum glDestFactors[8] = { - GL_ZERO, + GL_ZERO, GL_ONE, GL_SRC_COLOR, GL_ONE_MINUS_SRC_COLOR, - GL_SRC_ALPHA, + GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_DST_ALPHA, GL_ONE_MINUS_DST_ALPHA @@ -178,7 +178,7 @@ static const GLenum glCmpFuncs[8] = { }; static const GLenum glLogicOpCodes[16] = { - GL_CLEAR, + GL_CLEAR, GL_AND, GL_AND_REVERSE, GL_COPY, @@ -199,15 +199,15 @@ static const GLenum glLogicOpCodes[16] = { void SetDefaultRectTexParams() { // Set some standard texture filter modes. - glTexParameteri(GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); - glTexParameteri(GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); - if (glGetError() != GL_NO_ERROR) { - glTexParameteri(GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_WRAP_S, GL_CLAMP); - glTexParameteri(GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_WRAP_T, GL_CLAMP); - GL_REPORT_ERRORD(); - } - glTexParameteri(GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_MAG_FILTER, GL_LINEAR); - glTexParameteri(GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_MIN_FILTER, GL_LINEAR); + glTexParameteri(GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); + glTexParameteri(GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); + if (glGetError() != GL_NO_ERROR) { + glTexParameteri(GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_WRAP_S, GL_CLAMP); + glTexParameteri(GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_WRAP_T, GL_CLAMP); + GL_REPORT_ERRORD(); + } + glTexParameteri(GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_MAG_FILTER, GL_LINEAR); + glTexParameteri(GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_MIN_FILTER, GL_LINEAR); } void HandleCgError(CGcontext ctx, CGerror err, void* appdata) @@ -230,7 +230,7 @@ void VideoConfig::UpdateProjectionHack() bool Renderer::Init() { UpdateActiveConfig(); - bool bSuccess = true; + bool bSuccess = true; s_blendMode = 0; s_MSAACoverageSamples = 0; switch (g_ActiveConfig.iMultisampleMode) @@ -247,49 +247,49 @@ bool Renderer::Init() s_MSAASamples = 1; } GLint numvertexattribs = 0; - g_cgcontext = cgCreateContext(); + g_cgcontext = cgCreateContext(); - cgGetError(); + cgGetError(); cgSetErrorHandler(HandleCgError, NULL); - // Look for required extensions. - const char *ptoken = (const char*)glGetString(GL_EXTENSIONS); + // Look for required extensions. + const char *ptoken = (const char*)glGetString(GL_EXTENSIONS); if (!ptoken) { PanicAlert("Your OpenGL Driver seems to be not working.\n" - "Please make sure your drivers are up-to-date and\n" + "Please make sure your drivers are up-to-date and\n" "that your video hardware is OpenGL 2.x compatible " ); return false; } - INFO_LOG(VIDEO, "Supported OpenGL Extensions:"); - INFO_LOG(VIDEO, ptoken); // write to the log file - INFO_LOG(VIDEO, ""); + INFO_LOG(VIDEO, "Supported OpenGL Extensions:"); + INFO_LOG(VIDEO, ptoken); // write to the log file + INFO_LOG(VIDEO, ""); OSD::AddMessage(StringFromFormat("Video Info: %s, %s, %s", (const char*)glGetString(GL_VENDOR), (const char*)glGetString(GL_RENDERER), (const char*)glGetString(GL_VERSION)).c_str(), 5000); glGetIntegerv(GL_MAX_VERTEX_ATTRIBS, &numvertexattribs); - if (numvertexattribs < 11) { - ERROR_LOG(VIDEO, "*********\nGPU: OGL ERROR: Number of attributes %d not enough\nGPU: *********Does your video card support OpenGL 2.x?", numvertexattribs); - bSuccess = false; - } + if (numvertexattribs < 11) { + ERROR_LOG(VIDEO, "*********\nGPU: OGL ERROR: Number of attributes %d not enough\nGPU: *********Does your video card support OpenGL 2.x?", numvertexattribs); + bSuccess = false; + } // Init extension support. if (glewInit() != GLEW_OK) { - ERROR_LOG(VIDEO, "glewInit() failed!Does your video card support OpenGL 2.x?"); - return false; - } - if (!GLEW_EXT_framebuffer_object) { - ERROR_LOG(VIDEO, "*********\nGPU: ERROR: Need GL_EXT_framebufer_object for multiple render targets\nGPU: *********Does your video card support OpenGL 2.x?"); - bSuccess = false; - } - if (!GLEW_EXT_secondary_color) { - ERROR_LOG(VIDEO, "*********\nGPU: OGL ERROR: Need GL_EXT_secondary_color\nGPU: *********Does your video card support OpenGL 2.x?"); - bSuccess = false; - } + ERROR_LOG(VIDEO, "glewInit() failed!Does your video card support OpenGL 2.x?"); + return false; + } + if (!GLEW_EXT_framebuffer_object) { + ERROR_LOG(VIDEO, "*********\nGPU: ERROR: Need GL_EXT_framebufer_object for multiple render targets\nGPU: *********Does your video card support OpenGL 2.x?"); + bSuccess = false; + } + if (!GLEW_EXT_secondary_color) { + ERROR_LOG(VIDEO, "*********\nGPU: OGL ERROR: Need GL_EXT_secondary_color\nGPU: *********Does your video card support OpenGL 2.x?"); + bSuccess = false; + } s_bHaveFramebufferBlit = strstr(ptoken, "GL_EXT_framebuffer_blit") != NULL; if (!s_bHaveFramebufferBlit) { @@ -302,8 +302,8 @@ bool Renderer::Init() s_MSAACoverageSamples = 0; } - if (!bSuccess) - return false; + if (!bSuccess) + return false; // Handle VSync on/off #if defined USE_WX && USE_WX @@ -320,7 +320,7 @@ bool Renderer::Init() ERROR_LOG(VIDEO, "no support for SwapInterval (framerate clamped to monitor refresh rate)"); #endif - // check the max texture width and height + // check the max texture width and height GLint max_texture_size; glGetIntegerv(GL_MAX_TEXTURE_SIZE, (GLint *)&max_texture_size); if (max_texture_size < 1024) { @@ -330,8 +330,8 @@ bool Renderer::Init() if (GL_REPORT_ERROR() != GL_NO_ERROR) bSuccess = false; - if (glDrawBuffers == NULL && !GLEW_ARB_draw_buffers) - glDrawBuffers = glDrawBuffersARB; + if (glDrawBuffers == NULL && !GLEW_ARB_draw_buffers) + glDrawBuffers = glDrawBuffersARB; if (!GLEW_ARB_texture_non_power_of_two) { WARN_LOG(VIDEO, "ARB_texture_non_power_of_two not supported."); @@ -377,7 +377,7 @@ bool Renderer::Init() // Because of the fixed framebuffer size we need to disable the resolution options while running g_Config.bRunning = true; - if (GL_REPORT_ERROR() != GL_NO_ERROR) + if (GL_REPORT_ERROR() != GL_NO_ERROR) bSuccess = false; // Initialize the FramebufferManager @@ -385,93 +385,93 @@ bool Renderer::Init() glDrawBuffer(GL_COLOR_ATTACHMENT0_EXT); - if (GL_REPORT_ERROR() != GL_NO_ERROR) + if (GL_REPORT_ERROR() != GL_NO_ERROR) bSuccess = false; - s_pfont = new RasterFont(); + s_pfont = new RasterFont(); - // load the effect, find the best profiles (if any) - if (cgGLIsProfileSupported(CG_PROFILE_ARBVP1) != CG_TRUE) { - ERROR_LOG(VIDEO, "arbvp1 not supported"); - return false; - } + // load the effect, find the best profiles (if any) + if (cgGLIsProfileSupported(CG_PROFILE_ARBVP1) != CG_TRUE) { + ERROR_LOG(VIDEO, "arbvp1 not supported"); + return false; + } - if (cgGLIsProfileSupported(CG_PROFILE_ARBFP1) != CG_TRUE) { - ERROR_LOG(VIDEO, "arbfp1 not supported"); - return false; - } + if (cgGLIsProfileSupported(CG_PROFILE_ARBFP1) != CG_TRUE) { + ERROR_LOG(VIDEO, "arbfp1 not supported"); + return false; + } - g_cgvProf = cgGLGetLatestProfile(CG_GL_VERTEX); - g_cgfProf = cgGLGetLatestProfile(CG_GL_FRAGMENT); - cgGLSetOptimalOptions(g_cgvProf); - cgGLSetOptimalOptions(g_cgfProf); + g_cgvProf = cgGLGetLatestProfile(CG_GL_VERTEX); + g_cgfProf = cgGLGetLatestProfile(CG_GL_FRAGMENT); + cgGLSetOptimalOptions(g_cgvProf); + cgGLSetOptimalOptions(g_cgfProf); - INFO_LOG(VIDEO, "Max buffer sizes: %d %d", cgGetProgramBufferMaxSize(g_cgvProf), cgGetProgramBufferMaxSize(g_cgfProf)); - int nenvvertparams, nenvfragparams, naddrregisters[2]; - glGetProgramivARB(GL_VERTEX_PROGRAM_ARB, GL_MAX_PROGRAM_ENV_PARAMETERS_ARB, (GLint *)&nenvvertparams); - glGetProgramivARB(GL_FRAGMENT_PROGRAM_ARB, GL_MAX_PROGRAM_ENV_PARAMETERS_ARB, (GLint *)&nenvfragparams); - glGetProgramivARB(GL_VERTEX_PROGRAM_ARB, GL_MAX_PROGRAM_ADDRESS_REGISTERS_ARB, (GLint *)&naddrregisters[0]); - glGetProgramivARB(GL_FRAGMENT_PROGRAM_ARB, GL_MAX_PROGRAM_ADDRESS_REGISTERS_ARB, (GLint *)&naddrregisters[1]); - DEBUG_LOG(VIDEO, "Max program env parameters: vert=%d, frag=%d", nenvvertparams, nenvfragparams); - DEBUG_LOG(VIDEO, "Max program address register parameters: vert=%d, frag=%d", naddrregisters[0], naddrregisters[1]); + INFO_LOG(VIDEO, "Max buffer sizes: %d %d", cgGetProgramBufferMaxSize(g_cgvProf), cgGetProgramBufferMaxSize(g_cgfProf)); + int nenvvertparams, nenvfragparams, naddrregisters[2]; + glGetProgramivARB(GL_VERTEX_PROGRAM_ARB, GL_MAX_PROGRAM_ENV_PARAMETERS_ARB, (GLint *)&nenvvertparams); + glGetProgramivARB(GL_FRAGMENT_PROGRAM_ARB, GL_MAX_PROGRAM_ENV_PARAMETERS_ARB, (GLint *)&nenvfragparams); + glGetProgramivARB(GL_VERTEX_PROGRAM_ARB, GL_MAX_PROGRAM_ADDRESS_REGISTERS_ARB, (GLint *)&naddrregisters[0]); + glGetProgramivARB(GL_FRAGMENT_PROGRAM_ARB, GL_MAX_PROGRAM_ADDRESS_REGISTERS_ARB, (GLint *)&naddrregisters[1]); + DEBUG_LOG(VIDEO, "Max program env parameters: vert=%d, frag=%d", nenvvertparams, nenvfragparams); + DEBUG_LOG(VIDEO, "Max program address register parameters: vert=%d, frag=%d", naddrregisters[0], naddrregisters[1]); if (nenvvertparams < 238) - ERROR_LOG(VIDEO, "Not enough vertex shader environment constants!!"); + ERROR_LOG(VIDEO, "Not enough vertex shader environment constants!!"); #ifndef _DEBUG - cgGLSetDebugMode(GL_FALSE); + cgGLSetDebugMode(GL_FALSE); #endif - - glStencilFunc(GL_ALWAYS, 0, 0); - glBlendFunc(GL_ONE, GL_ONE); + + glStencilFunc(GL_ALWAYS, 0, 0); + glBlendFunc(GL_ONE, GL_ONE); - glViewport(0, 0, GetTargetWidth(), GetTargetHeight()); // Reset The Current Viewport + glViewport(0, 0, GetTargetWidth(), GetTargetHeight()); // Reset The Current Viewport - glMatrixMode(GL_PROJECTION); - glLoadIdentity(); - glMatrixMode(GL_MODELVIEW); - glLoadIdentity(); + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); - glShadeModel(GL_SMOOTH); - glClearColor(0.0f, 0.0f, 0.0f, 0.0f); - glClearDepth(1.0f); - glEnable(GL_DEPTH_TEST); - glDisable(GL_LIGHTING); - glDepthFunc(GL_LEQUAL); - - glPixelStorei(GL_UNPACK_ALIGNMENT, 4); // 4-byte pixel alignment - - glDisable(GL_STENCIL_TEST); - glEnable(GL_SCISSOR_TEST); + glShadeModel(GL_SMOOTH); + glClearColor(0.0f, 0.0f, 0.0f, 0.0f); + glClearDepth(1.0f); + glEnable(GL_DEPTH_TEST); + glDisable(GL_LIGHTING); + glDepthFunc(GL_LEQUAL); + + glPixelStorei(GL_UNPACK_ALIGNMENT, 4); // 4-byte pixel alignment + + glDisable(GL_STENCIL_TEST); + glEnable(GL_SCISSOR_TEST); - glScissor(0, 0, GetTargetWidth(), GetTargetHeight()); - glBlendColorEXT(0, 0, 0, 0.5f); - glClearDepth(1.0f); + glScissor(0, 0, GetTargetWidth(), GetTargetHeight()); + glBlendColorEXT(0, 0, 0, 0.5f); + glClearDepth(1.0f); - glMatrixMode(GL_PROJECTION); - glLoadIdentity(); - glMatrixMode(GL_MODELVIEW); - glLoadIdentity(); + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); - // legacy multitexturing: select texture channel only. - glActiveTexture(GL_TEXTURE0); - glClientActiveTexture(GL_TEXTURE0); - glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE); + // legacy multitexturing: select texture channel only. + glActiveTexture(GL_TEXTURE0); + glClientActiveTexture(GL_TEXTURE0); + glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE); UpdateActiveConfig(); - return glGetError() == GL_NO_ERROR && bSuccess; + return glGetError() == GL_NO_ERROR && bSuccess; } void Renderer::Shutdown(void) -{ +{ g_Config.bRunning = false; UpdateActiveConfig(); - delete s_pfont; + delete s_pfont; s_pfont = 0; - if (g_cgcontext) { - cgDestroyContext(g_cgcontext); - g_cgcontext = 0; + if (g_cgcontext) { + cgDestroyContext(g_cgcontext); + g_cgcontext = 0; } if(s_tempScreenshotFramebuffer) glDeleteFramebuffersEXT(1, &s_tempScreenshotFramebuffer); @@ -535,12 +535,12 @@ int Renderer::GetTargetHeight() } float Renderer::GetTargetScaleX() { - return EFBxScale; + return EFBxScale; } float Renderer::GetTargetScaleY() { - return EFByScale; + return EFByScale; } @@ -553,20 +553,19 @@ TargetRectangle Renderer::ConvertEFBRectangle(const EFBRectangle& rc) } - void Renderer::ResetAPIState() { // Gets us to a reasonably sane state where it's possible to do things like // image copies with textured quads, etc. VertexShaderCache::DisableShader(); - PixelShaderCache::DisableShader(); + PixelShaderCache::DisableShader(); - glDisable(GL_SCISSOR_TEST); - glDisable(GL_DEPTH_TEST); - glDisable(GL_CULL_FACE); - glDisable(GL_BLEND); - glDepthMask(GL_FALSE); - glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); + glDisable(GL_SCISSOR_TEST); + glDisable(GL_DEPTH_TEST); + glDisable(GL_CULL_FACE); + glDisable(GL_BLEND); + glDepthMask(GL_FALSE); + glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); } void UpdateViewport(); @@ -582,17 +581,17 @@ void Renderer::RestoreAPIState() UpdateViewport(); - if (bpmem.genMode.cullmode > 0) glEnable(GL_CULL_FACE); - if (bpmem.zmode.testenable) glEnable(GL_DEPTH_TEST); - if (bpmem.zmode.updateenable) glDepthMask(GL_TRUE); + if (bpmem.genMode.cullmode > 0) glEnable(GL_CULL_FACE); + if (bpmem.zmode.testenable) glEnable(GL_DEPTH_TEST); + if (bpmem.zmode.updateenable) glDepthMask(GL_TRUE); - glEnable(GL_SCISSOR_TEST); + glEnable(GL_SCISSOR_TEST); SetScissorRect(); - SetColorMask(); + SetColorMask(); SetBlendMode(true); VertexShaderCache::SetCurrentShader(0); - PixelShaderCache::SetCurrentShader(0); + PixelShaderCache::SetCurrentShader(0); } void Renderer::SetColorMask() @@ -612,9 +611,9 @@ void Renderer::SetBlendMode(bool forceUpdate) u32 newval = bpmem.blendmode.subtract << 2; - if (bpmem.blendmode.subtract) { - newval |= 0x0049; // enable blending src 1 dst 1 - } else if (bpmem.blendmode.blendenable) { + if (bpmem.blendmode.subtract) { + newval |= 0x0049; // enable blending src 1 dst 1 + } else if (bpmem.blendmode.blendenable) { newval |= 1; // enable blending newval |= bpmem.blendmode.srcfactor << 3; newval |= bpmem.blendmode.dstfactor << 6; @@ -623,11 +622,11 @@ void Renderer::SetBlendMode(bool forceUpdate) u32 changes = forceUpdate ? 0xFFFFFFFF : newval ^ s_blendMode; if (changes & 1) { - // blend enable change + // blend enable change (newval & 1) ? glEnable(GL_BLEND) : glDisable(GL_BLEND); } - if (changes & 4) { + if (changes & 4) { // subtract enable change glBlendEquation(newval & 4 ? GL_FUNC_REVERSE_SUBTRACT : GL_FUNC_ADD); } @@ -690,7 +689,7 @@ u32 Renderer::AccessEFB(EFBAccessType type, int x, int y) // Although it may sound strange, this really is A8R8G8B8 and not RGBA or 24-bit... // Tested in Killer 7, the first 8bits represent the alpha value which is used to - // determine if we're aiming at an enemy (0x80 / 0x88) or not (0x70) + // determine if we're aiming at an enemy (0x80 / 0x88) or not (0x70) // Wind Waker is also using it for the pictograph to determine the color of each pixel if (s_MSAASamples > 1) @@ -736,20 +735,20 @@ u32 Renderer::AccessEFB(EFBAccessType type, int x, int y) // therefore the width and height are (scissorBR + 1) - scissorTL bool Renderer::SetScissorRect() { - int xoff = bpmem.scissorOffset.x * 2 - 342; - int yoff = bpmem.scissorOffset.y * 2 - 342; - float rc_left = (float)bpmem.scissorTL.x - xoff - 342; // left = 0 - if (rc_left < 0) rc_left = 0; + int xoff = bpmem.scissorOffset.x * 2 - 342; + int yoff = bpmem.scissorOffset.y * 2 - 342; + float rc_left = (float)bpmem.scissorTL.x - xoff - 342; // left = 0 + if (rc_left < 0) rc_left = 0; float rc_top = (float)bpmem.scissorTL.y - yoff - 342; // right = 0 - if (rc_top < 0) rc_top = 0; - + if (rc_top < 0) rc_top = 0; + float rc_right = (float)bpmem.scissorBR.x - xoff - 341; // right = 640 if (rc_right > EFB_WIDTH) rc_right = EFB_WIDTH; float rc_bottom = (float)bpmem.scissorBR.y - yoff - 341; // bottom = 480 - if (rc_bottom > EFB_HEIGHT) rc_bottom = EFB_HEIGHT; + if (rc_bottom > EFB_HEIGHT) rc_bottom = EFB_HEIGHT; if(rc_left > rc_right) { @@ -766,7 +765,7 @@ bool Renderer::SetScissorRect() // Check that the coordinates are good - if (rc_right >= rc_left && rc_bottom >= rc_top) + if (rc_right >= rc_left && rc_bottom >= rc_top) { glScissor( (int)(rc_left * EFBxScale), // x = 0 for example @@ -774,18 +773,18 @@ bool Renderer::SetScissorRect() (int)((rc_right - rc_left)* EFBxScale), // width = 640 for example (int)((rc_bottom - rc_top) * EFByScale) // height = 480 for example ); - return true; - } + return true; + } else { glScissor( 0, 0, Renderer::GetTargetWidth(), - Renderer::GetTargetHeight() - ); + Renderer::GetTargetHeight() + ); } - return false; + return false; } void Renderer::ClearScreen(const EFBRectangle& rc, bool colorEnable, bool alphaEnable, bool zEnable, u32 color, u32 z) @@ -795,10 +794,10 @@ void Renderer::ClearScreen(const EFBRectangle& rc, bool colorEnable, bool alphaE TargetRectangle targetRc = Renderer::ConvertEFBRectangle(rc); - // Always set the scissor in case it was set by the game and has not been reset + // Always set the scissor in case it was set by the game and has not been reset glScissor(targetRc.left, targetRc.bottom, targetRc.GetWidth(), targetRc.GetHeight()); - VertexShaderManager::SetViewportChanged(); + VertexShaderManager::SetViewportChanged(); GLbitfield bits = 0; if (colorEnable) @@ -847,7 +846,7 @@ void Renderer::Swap(u32 xfbAddr, FieldType field, u32 fbWidth, u32 fbHeight) { g_VideoInitialize.pCopiedToXFB(false); return; - } + } if (field == FIELD_LOWER) xfbAddr -= fbWidth * 2; u32 xfbCount = 0; const XFBSource** xfbSourceList = g_framebufferManager.GetXFBSource(xfbAddr, fbWidth, fbHeight, xfbCount); @@ -858,9 +857,9 @@ void Renderer::Swap(u32 xfbAddr, FieldType field, u32 fbWidth, u32 fbHeight) return; } - DVSTARTPROFILE(); + DVSTARTPROFILE(); - ResetAPIState(); + ResetAPIState(); TargetRectangle back_rc; ComputeDrawRectangle(m_CustomWidth, m_CustomHeight, true, &back_rc); @@ -891,7 +890,7 @@ void Renderer::Swap(u32 xfbAddr, FieldType field, u32 fbWidth, u32 fbHeight) glTexParameteri(GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_MAG_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_MIN_FILTER, GL_LINEAR); - // We must call ApplyShader here even if no post proc is selected - it takes + // We must call ApplyShader here even if no post proc is selected - it takes // care of disabling it in that case. It returns false in case of no post processing. bool applyShader = PostProcessing::ApplyShader(); @@ -900,7 +899,7 @@ void Renderer::Swap(u32 xfbAddr, FieldType field, u32 fbWidth, u32 fbHeight) // draw each xfb source for (u32 i = 0; i < xfbCount; ++i) { - xfbSource = xfbSourceList[i]; + xfbSource = xfbSourceList[i]; TargetRectangle sourceRc; @@ -956,7 +955,7 @@ void Renderer::Swap(u32 xfbAddr, FieldType field, u32 fbWidth, u32 fbHeight) // Texture map xfbSource->texture onto the main buffer glBindTexture(GL_TEXTURE_RECTANGLE_ARB, xfbSource->texture); - // We must call ApplyShader here even if no post proc is selected - it takes + // We must call ApplyShader here even if no post proc is selected - it takes // care of disabling it in that case. It returns false in case of no post processing. if (applyShader) { @@ -966,14 +965,14 @@ void Renderer::Swap(u32 xfbAddr, FieldType field, u32 fbWidth, u32 fbHeight) glTexCoord2f(sourceRc.right, sourceRc.top); glMultiTexCoord2fARB(GL_TEXTURE1, 1, 1); glVertex2f(drawRc.right, drawRc.top); glTexCoord2f(sourceRc.right, sourceRc.bottom); glMultiTexCoord2fARB(GL_TEXTURE1, 1, 0); glVertex2f(drawRc.right, drawRc.bottom); glEnd(); - PixelShaderCache::DisableShader();; + PixelShaderCache::DisableShader(); } else { glBegin(GL_QUADS); glTexCoord2f(sourceRc.left, sourceRc.bottom); glVertex2f(drawRc.left, drawRc.bottom); - glTexCoord2f(sourceRc.left, sourceRc.top); glVertex2f(drawRc.left, drawRc.top); - glTexCoord2f(sourceRc.right, sourceRc.top); glVertex2f(drawRc.right, drawRc.top); + glTexCoord2f(sourceRc.left, sourceRc.top); glVertex2f(drawRc.left, drawRc.top); + glTexCoord2f(sourceRc.right, sourceRc.top); glVertex2f(drawRc.right, drawRc.top); glTexCoord2f(sourceRc.right, sourceRc.bottom); glVertex2f(drawRc.right, drawRc.bottom); glEnd(); } @@ -1026,20 +1025,20 @@ void Renderer::Swap(u32 xfbAddr, FieldType field, u32 fbWidth, u32 fbHeight) u8 *data = (u8 *) malloc(3 * w * h); glPixelStorei(GL_PACK_ALIGNMENT, 1); glReadPixels(0, Renderer::GetTargetHeight() - h, w, h, GL_BGR, GL_UNSIGNED_BYTE, data); - if (glGetError() == GL_NO_ERROR && w > 0 && h > 0) + if (glGetError() == GL_NO_ERROR && w > 0 && h > 0) { - if (!s_bLastFrameDumped) + if (!s_bLastFrameDumped) { s_bAVIDumping = AVIDump::Start(EmuWindow::GetParentWnd(), w, h); if (!s_bAVIDumping) OSD::AddMessage("AVIDump Start failed", 2000); - else + else { OSD::AddMessage(StringFromFormat( "Dumping Frames to \"%sframedump0.avi\" (%dx%d RGB24)", File::GetUserPath(D_DUMPFRAMES_IDX), w, h).c_str(), 2000); } } - if (s_bAVIDumping) + if (s_bAVIDumping) AVIDump::AddFrame((char *) data); s_bLastFrameDumped = true; @@ -1053,10 +1052,10 @@ void Renderer::Swap(u32 xfbAddr, FieldType field, u32 fbWidth, u32 fbHeight) glFramebufferTexture2DEXT(GL_READ_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, GL_TEXTURE_RECTANGLE_ARB, 0, 0); glBindFramebufferEXT(GL_READ_FRAMEBUFFER_EXT, g_framebufferManager.GetEFBFramebuffer()); - } - else + } + else { - if(s_bLastFrameDumped && s_bAVIDumping) + if(s_bLastFrameDumped && s_bAVIDumping) { AVIDump::Stop(); s_bAVIDumping = false; @@ -1128,7 +1127,7 @@ void Renderer::Swap(u32 xfbAddr, FieldType field, u32 fbWidth, u32 fbHeight) if( xfbchanged || WindowResized) - { + { TargetRectangle dst_rect; ComputeDrawRectangle(m_CustomWidth, m_CustomHeight, false, &dst_rect); @@ -1172,20 +1171,20 @@ void Renderer::Swap(u32 xfbAddr, FieldType field, u32 fbWidth, u32 fbHeight) // Count FPS. // ------------- static int fpscount = 0; - static unsigned long lasttime; - ++fpscount; - if (Common::Timer::GetTimeMs() - lasttime > 1000) - { - lasttime = Common::Timer::GetTimeMs(); - s_fps = fpscount - 1; - fpscount = 0; - } + static unsigned long lasttime; + ++fpscount; + if (Common::Timer::GetTimeMs() - lasttime > 1000) + { + lasttime = Common::Timer::GetTimeMs(); + s_fps = fpscount - 1; + fpscount = 0; + } // --------------------------------------------------------------------- - GL_REPORT_ERRORD(); + GL_REPORT_ERRORD(); DrawDebugText(); - GL_REPORT_ERRORD(); + GL_REPORT_ERRORD(); // Get the status of the Blend mode GLboolean blend_enabled = glIsEnabled(GL_BLEND); @@ -1193,22 +1192,22 @@ void Renderer::Swap(u32 xfbAddr, FieldType field, u32 fbWidth, u32 fbHeight) OSD::DrawMessages(); if (blend_enabled) glEnable(GL_BLEND); - GL_REPORT_ERRORD(); + GL_REPORT_ERRORD(); #if defined(DVPROFILE) - if (g_bWriteProfile) { - //g_bWriteProfile = 0; - static int framenum = 0; - const int UPDATE_FRAMES = 8; - if (++framenum >= UPDATE_FRAMES) { - DVProfWrite("prof.txt", UPDATE_FRAMES); - DVProfClear(); - framenum = 0; - } - } + if (g_bWriteProfile) { + //g_bWriteProfile = 0; + static int framenum = 0; + const int UPDATE_FRAMES = 8; + if (++framenum >= UPDATE_FRAMES) { + DVProfWrite("prof.txt", UPDATE_FRAMES); + DVProfClear(); + framenum = 0; + } + } #endif - // Copy the rendered frame to the real window + // Copy the rendered frame to the real window OpenGL_SwapBuffers(); - + GL_REPORT_ERRORD(); // Clear framebuffer @@ -1219,22 +1218,22 @@ void Renderer::Swap(u32 xfbAddr, FieldType field, u32 fbWidth, u32 fbHeight) // Clean out old stuff from caches. It's not worth it to clean out the shader caches. DLCache::ProgressiveCleanup(); - TextureMngr::ProgressiveCleanup(); + TextureMngr::ProgressiveCleanup(); - frameCount++; + frameCount++; - // New frame - stats.ResetFrame(); + // New frame + stats.ResetFrame(); // Render to the framebuffer. g_framebufferManager.SetFramebuffer(0); GL_REPORT_ERRORD(); - RestoreAPIState(); + RestoreAPIState(); GL_REPORT_ERRORD(); - g_Config.iSaveTargetId = 0; + g_Config.iSaveTargetId = 0; bool last_copy_efb_to_Texture = g_ActiveConfig.bCopyEFBToTexture; UpdateActiveConfig(); @@ -1242,8 +1241,8 @@ void Renderer::Swap(u32 xfbAddr, FieldType field, u32 fbWidth, u32 fbHeight) TextureMngr::ClearRenderTargets(); // For testing zbuffer targets. - // Renderer::SetZBufferRender(); - // SaveTexture("tex.tga", GL_TEXTURE_RECTANGLE_ARB, s_FakeZTarget, GetTargetWidth(), GetTargetHeight()); + // Renderer::SetZBufferRender(); + // SaveTexture("tex.tga", GL_TEXTURE_RECTANGLE_ARB, s_FakeZTarget, GetTargetWidth(), GetTargetHeight()); XFBWrited = false; g_VideoInitialize.pCopiedToXFB(true); @@ -1265,11 +1264,11 @@ void Renderer::DrawDebugText() if (g_ActiveConfig.bShowEFBCopyRegions) { // Store Line Size - GLfloat lSize; + GLfloat lSize; glGetFloatv(GL_LINE_WIDTH, &lSize); // Set Line Size - glLineWidth(3.0f); + glLineWidth(3.0f); glBegin(GL_LINES); @@ -1277,8 +1276,8 @@ void Renderer::DrawDebugText() for (std::vector::const_iterator it = stats.efb_regions.begin(); it != stats.efb_regions.end(); ++it) { GLfloat halfWidth = EFB_WIDTH / 2.0f; - GLfloat halfHeight = EFB_HEIGHT / 2.0f; - GLfloat x = (GLfloat) -1.0f + ((GLfloat)it->left / halfWidth); + GLfloat halfHeight = EFB_HEIGHT / 2.0f; + GLfloat x = (GLfloat) -1.0f + ((GLfloat)it->left / halfWidth); GLfloat y = (GLfloat) 1.0f - ((GLfloat)it->top / halfHeight); GLfloat x2 = (GLfloat) -1.0f + ((GLfloat)it->right / halfWidth); GLfloat y2 = (GLfloat) 1.0f - ((GLfloat)it->bottom / halfHeight); @@ -1307,10 +1306,10 @@ void Renderer::DrawDebugText() stats.efb_regions.clear(); } - if (g_ActiveConfig.bOverlayStats) + if (g_ActiveConfig.bOverlayStats) { p = Statistics::ToString(p); - } + } if (g_ActiveConfig.bOverlayProjStats) { @@ -1342,7 +1341,7 @@ void Renderer::DrawDebugText() H = OpenGL_GetBackbufferHeight(); std::string OSDM1 = - g_ActiveConfig.bNativeResolution || g_ActiveConfig.b2xResolution ? + g_ActiveConfig.bNativeResolution || g_ActiveConfig.b2xResolution ? (g_ActiveConfig.bNativeResolution ? StringFromFormat("%i x %i (native)", OSDInternalW, OSDInternalH) : StringFromFormat("%i x %i (2x)", OSDInternalW, OSDInternalH)) @@ -1364,7 +1363,7 @@ void Renderer::DrawDebugText() break; } std::string OSDM22 = - g_ActiveConfig.bCrop ? " (crop)" : ""; + g_ActiveConfig.bCrop ? " (crop)" : ""; std::string OSDM3 = g_ActiveConfig.bEFBCopyDisable ? "Disabled" : g_ActiveConfig.bCopyEFBToTexture ? "To Texture" : "To RAM"; @@ -1377,21 +1376,21 @@ void Renderer::DrawDebugText() T0.push_back(StringFromFormat("4: Aspect Ratio: %s%s\n", OSDM21.c_str(), OSDM22.c_str())); T0.push_back(StringFromFormat("5: Copy EFB: %s\n", OSDM3.c_str())); T0.push_back(StringFromFormat("6: Fog: %s\n", g_ActiveConfig.bDisableFog ? "Disabled" : "Enabled")); - T0.push_back(StringFromFormat("7: Material Lighting: %s\n", g_ActiveConfig.bDisableLighting ? "Disabled" : "Enabled")); + T0.push_back(StringFromFormat("7: Material Lighting: %s\n", g_ActiveConfig.bDisableLighting ? "Disabled" : "Enabled")); // The latest changed setting in yellow T1 += (OSDChoice == -1) ? T0.at(0) : "\n"; T1 += (OSDChoice == -2) ? T0.at(1) : "\n"; T1 += (OSDChoice == -3) ? T0.at(2) : "\n"; T1 += (OSDChoice == -4) ? T0.at(3) : "\n"; - T1 += (OSDChoice == -5) ? T0.at(4) : "\n"; + T1 += (OSDChoice == -5) ? T0.at(4) : "\n"; // The other settings in cyan T2 += (OSDChoice != -1) ? T0.at(0) : "\n"; T2 += (OSDChoice != -2) ? T0.at(1) : "\n"; T2 += (OSDChoice != -3) ? T0.at(2) : "\n"; T2 += (OSDChoice != -4) ? T0.at(3) : "\n"; - T2 += (OSDChoice != -5) ? T0.at(4) : "\n"; + T2 += (OSDChoice != -5) ? T0.at(4) : "\n"; // Render a shadow, and then the text Renderer::RenderText(T1.c_str(), 21, 21, 0xDD000000); @@ -1405,11 +1404,11 @@ void Renderer::RenderText(const char* pstr, int left, int top, u32 color) { int nBackbufferWidth = (int)OpenGL_GetBackbufferWidth(); int nBackbufferHeight = (int)OpenGL_GetBackbufferHeight(); - glColor4f(((color>>16) & 0xff)/255.0f, ((color>> 8) & 0xff)/255.0f, - ((color>> 0) & 0xff)/255.0f, ((color>>24) & 0xFF)/255.0f); - s_pfont->printMultilineText(pstr, - left * 2.0f / (float)nBackbufferWidth - 1, - 1 - top * 2.0f / (float)nBackbufferHeight, + glColor4f(((color>>16) & 0xff)/255.0f, ((color>> 8) & 0xff)/255.0f, + ((color>> 0) & 0xff)/255.0f, ((color>>24) & 0xFF)/255.0f); + s_pfont->printMultilineText(pstr, + left * 2.0f / (float)nBackbufferWidth - 1, + 1 - top * 2.0f / (float)nBackbufferHeight, 0, nBackbufferWidth, nBackbufferHeight); GL_REPORT_ERRORD(); } @@ -1442,7 +1441,7 @@ THREAD_RETURN TakeScreenshot(void *pArgs) use16_9 = true; else if (g_ActiveConfig.iAspectRatio == ASPECT_FORCE_4_3) use16_9 = false; - + float Ratio = (FloatW / FloatH) / (!use16_9 ? (4.0f / 3.0f) : (16.0f / 9.0f)); // If ratio > 1 the picture is too wide and we have to limit the width. @@ -1451,7 +1450,7 @@ THREAD_RETURN TakeScreenshot(void *pArgs) // ratio == 1 or the image is too high, we have to limit the height. else FloatH *= Ratio; - + // This is a bit expensive on high resolutions threadStruct->img->Rescale((int)FloatW, (int)FloatH, wxIMAGE_QUALITY_HIGH); } @@ -1473,47 +1472,47 @@ bool Renderer::SaveRenderTarget(const char *filename, int W, int H, int YOffset) { u8 *data = (u8 *)malloc(3 * W * H); glPixelStorei(GL_PACK_ALIGNMENT, 1); - + glReadPixels(0, Renderer::GetTargetHeight() - H + YOffset, W, H, GL_RGB, GL_UNSIGNED_BYTE, data); - + // Show failure message if (glGetError() != GL_NO_ERROR) { OSD::AddMessage("Error capturing or saving screenshot.", 2000); return false; } - + // Turn image upside down FlipImageData(data, W, H); - + #if defined(HAVE_WX) && HAVE_WX // Create wxImage wxImage *a = new wxImage(W, H, data); - + if (scrshotThread) { delete scrshotThread; scrshotThread = NULL; } - + ScrStrct *threadStruct = new ScrStrct; threadStruct->filename = std::string(filename); threadStruct->img = a; threadStruct->H = H; threadStruct->W = W; - + scrshotThread = new Common::Thread(TakeScreenshot, threadStruct); #ifdef _WIN32 scrshotThread->SetPriority(THREAD_PRIORITY_BELOW_NORMAL); #endif bool result = true; - + OSD::AddMessage("Saving Screenshot... ", 2000); - + #else bool result = SaveTGA(filename, W, H, data); free(data); #endif - + return result; } @@ -1536,12 +1535,12 @@ void Renderer::FlipImageData(u8 *data, int w, int h) void UpdateViewport() { // reversed gxsetviewport(xorig, yorig, width, height, nearz, farz) - // [0] = width/2 - // [1] = height/2 - // [2] = 16777215 * (farz - nearz) - // [3] = xorig + width/2 + 342 - // [4] = yorig + height/2 + 342 - // [5] = 16777215 * farz + // [0] = width/2 + // [1] = height/2 + // [2] = 16777215 * (farz - nearz) + // [3] = xorig + width/2 + 342 + // [4] = yorig + height/2 + 342 + // [5] = 16777215 * farz int scissorXOff = bpmem.scissorOffset.x * 2; // 342 int scissorYOff = bpmem.scissorOffset.y * 2; // 342 @@ -1555,7 +1554,7 @@ void UpdateViewport() if(GLWidth < 0) { GLx += GLWidth; - GLWidth*=-1; + GLWidth*=-1; } if(GLHeight < 0) { @@ -1570,47 +1569,47 @@ void UpdateViewport() void Renderer::SetGenerationMode() { // none, ccw, cw, ccw - if (bpmem.genMode.cullmode > 0) + if (bpmem.genMode.cullmode > 0) { - glEnable(GL_CULL_FACE); - glFrontFace(bpmem.genMode.cullmode == 2 ? GL_CCW : GL_CW); - } - else + glEnable(GL_CULL_FACE); + glFrontFace(bpmem.genMode.cullmode == 2 ? GL_CCW : GL_CW); + } + else glDisable(GL_CULL_FACE); } void Renderer::SetDepthMode() { - if (bpmem.zmode.testenable) + if (bpmem.zmode.testenable) { glEnable(GL_DEPTH_TEST); glDepthMask(bpmem.zmode.updateenable ? GL_TRUE : GL_FALSE); glDepthFunc(glCmpFuncs[bpmem.zmode.func]); } - else + else { // if the test is disabled write is disabled too glDisable(GL_DEPTH_TEST); glDepthMask(GL_FALSE); - } + } } void Renderer::SetLogicOpMode() { - if (bpmem.blendmode.logicopenable && bpmem.blendmode.logicmode != 3) + if (bpmem.blendmode.logicopenable && bpmem.blendmode.logicmode != 3) { glEnable(GL_COLOR_LOGIC_OP); glLogicOp(glLogicOpCodes[bpmem.blendmode.logicmode]); } - else + else glDisable(GL_COLOR_LOGIC_OP); } void Renderer::SetDitherMode() { - if (bpmem.blendmode.dither) + if (bpmem.blendmode.dither) glEnable(GL_DITHER); - else + else glDisable(GL_DITHER); } diff --git a/Source/Plugins/Plugin_Wiimote/Src/wiimote_real.cpp b/Source/Plugins/Plugin_Wiimote/Src/wiimote_real.cpp index c0e217ca96..d7272bb280 100644 --- a/Source/Plugins/Plugin_Wiimote/Src/wiimote_real.cpp +++ b/Source/Plugins/Plugin_Wiimote/Src/wiimote_real.cpp @@ -62,7 +62,7 @@ class CWiiMote; wiimote_t** g_WiiMotesFromWiiUse = NULL; Common::Thread* g_pReadThread = NULL; int g_NumberOfWiiMotes; -CWiiMote* g_WiiMotes[MAX_WIIMOTES]; +CWiiMote* g_WiiMotes[MAX_WIIMOTES]; volatile bool g_Shutdown = false; Common::Event g_StartThread; Common::Event g_StopThreadTemporary; @@ -101,16 +101,16 @@ class CWiiMote { public: -CWiiMote(u8 _WiimoteNumber, wiimote_t* _pWiimote) - : m_WiimoteNumber(_WiimoteNumber) - , m_channelID(0) - , m_pWiiMote(_pWiimote) - , m_pCriticalSection(NULL) - , m_LastReportValid(false) +CWiiMote(u8 _WiimoteNumber, wiimote_t* _pWiimote) + : m_WiimoteNumber(_WiimoteNumber) + , m_channelID(0) + , m_pWiiMote(_pWiimote) + , m_pCriticalSection(NULL) + , m_LastReportValid(false) { - m_pCriticalSection = new Common::CriticalSection(); + m_pCriticalSection = new Common::CriticalSection(); - //wiiuse_set_leds(m_pWiiMote, WIIMOTE_LED_4); + //wiiuse_set_leds(m_pWiiMote, WIIMOTE_LED_4); #ifdef _WIN32 // F|RES: i dunno if we really need this @@ -118,34 +118,34 @@ CWiiMote(u8 _WiimoteNumber, wiimote_t* _pWiimote) #endif } -virtual ~CWiiMote() +virtual ~CWiiMote() { - delete m_pCriticalSection; + delete m_pCriticalSection; }; // Queue raw HID data from the core to the wiimote void SendData(u16 _channelID, const u8* _pData, u32 _Size) { - m_channelID = _channelID; + m_channelID = _channelID; - m_pCriticalSection->Enter(); - { - SEvent WriteEvent; + m_pCriticalSection->Enter(); + { + SEvent WriteEvent; memcpy(WriteEvent.m_PayLoad, _pData, _Size); WriteEvent._Size = _Size; - m_EventWriteQueue.push(WriteEvent); + m_EventWriteQueue.push(WriteEvent); // Debugging //std::string Temp = ArrayToString(WriteEvent.m_PayLoad, 28, 0, 30); //DEBUG_LOG(WIIMOTE, "Wiimote Write:\n%s", Temp.c_str()); - } - m_pCriticalSection->Leave(); + } + m_pCriticalSection->Leave(); } /* Read and write data to the Wiimote */ -void ReadData() +void ReadData() { m_pCriticalSection->Enter(); @@ -179,7 +179,7 @@ void ReadData() m_pCriticalSection->Enter(); // Filter out data reports - if (pBuffer[1] >= 0x30) + if (pBuffer[1] >= 0x30) { // Copy Buffer to LastReport memcpy(m_LastReport.m_PayLoad, pBuffer + 1, MAX_PAYLOAD - 1); @@ -207,25 +207,25 @@ void ReadData() // Send queued data to the core -void Update() +void Update() { // Thread function - m_pCriticalSection->Enter(); + m_pCriticalSection->Enter(); - if (m_EventReadQueue.empty()) - { + if (m_EventReadQueue.empty()) + { // Send the data report - if (m_LastReportValid) + if (m_LastReportValid) SendEvent(m_LastReport); - } - else - { + } + else + { // Send a 0x20, 0x21 or 0x22 report - SendEvent(m_EventReadQueue.front()); - m_EventReadQueue.pop(); - } + SendEvent(m_EventReadQueue.front()); + m_EventReadQueue.pop(); + } - m_pCriticalSection->Leave(); + m_pCriticalSection->Leave(); }; @@ -235,62 +235,62 @@ void ClearEvents() while (!m_EventReadQueue.empty()) m_EventReadQueue.pop(); while (!m_EventWriteQueue.empty()) - m_EventWriteQueue.pop(); + m_EventWriteQueue.pop(); } private: - struct SEvent - { - SEvent() - { - memset(m_PayLoad, 0, MAX_PAYLOAD); - } - byte m_PayLoad[MAX_PAYLOAD]; + struct SEvent + { + SEvent() + { + memset(m_PayLoad, 0, MAX_PAYLOAD); + } + byte m_PayLoad[MAX_PAYLOAD]; u32 _Size; - }; - typedef std::queue CEventQueue; + }; + typedef std::queue CEventQueue; - u8 m_WiimoteNumber; // Just for debugging - u16 m_channelID; - CEventQueue m_EventReadQueue; // Read from Wiimote - CEventQueue m_EventWriteQueue; // Write to Wiimote - SEvent m_LastReport; + u8 m_WiimoteNumber; // Just for debugging + u16 m_channelID; + CEventQueue m_EventReadQueue; // Read from Wiimote + CEventQueue m_EventWriteQueue; // Write to Wiimote + SEvent m_LastReport; wiimote_t* m_pWiiMote; // This is g_WiiMotesFromWiiUse[] - Common::CriticalSection* m_pCriticalSection; + Common::CriticalSection* m_pCriticalSection; bool m_LastReportValid; // Send queued data to the core void SendEvent(SEvent& _rEvent) { - // We don't have an answer channel - if (m_channelID == 0) + // We don't have an answer channel + if (m_channelID == 0) return; - // Check event buffer - u8 Buffer[1024]; - u32 Offset = 0; - hid_packet* pHidHeader = (hid_packet*)(Buffer + Offset); - pHidHeader->type = HID_TYPE_DATA; - pHidHeader->param = HID_PARAM_INPUT; + // Check event buffer + u8 Buffer[1024]; + u32 Offset = 0; + hid_packet* pHidHeader = (hid_packet*)(Buffer + Offset); + pHidHeader->type = HID_TYPE_DATA; + pHidHeader->param = HID_PARAM_INPUT; // Create the buffer memcpy(&Buffer[Offset], pHidHeader, sizeof(hid_packet)); Offset += sizeof(hid_packet); - memcpy(&Buffer[Offset], _rEvent.m_PayLoad, sizeof(_rEvent.m_PayLoad)); - Offset += sizeof(_rEvent.m_PayLoad); + memcpy(&Buffer[Offset], _rEvent.m_PayLoad, sizeof(_rEvent.m_PayLoad)); + Offset += sizeof(_rEvent.m_PayLoad); // Send it g_WiimoteInitialize.pWiimoteInput(m_WiimoteNumber, m_channelID, Buffer, Offset); // Debugging - // ReadDebugging(false, Buffer, Offset); + // ReadDebugging(false, Buffer, Offset); } }; -// Function Definitions +// Function Definitions void SendAcc(u8 _ReportID) { @@ -348,7 +348,7 @@ int Initialize() Connected.Init(); // Clear the wiimote classes - memset(g_WiiMotes, 0, sizeof(CWiiMote*) * MAX_WIIMOTES); + memset(g_WiiMotes, 0, sizeof(CWiiMote*) * MAX_WIIMOTES); for (int i = 0; i < MAX_WIIMOTES; i++) g_WiimoteInUse[i] = false; @@ -399,7 +399,7 @@ int Initialize() // If we are connecting from the config window without a game running we set the LEDs if (g_EmulatorState != PLUGIN_EMUSTATE_PLAY && g_RealWiiMotePresent) FlashLights(true); - + /* Allocate memory and copy the Wiimote eeprom accelerometer neutral values to g_Eeprom. Unlike with and extension we have to do this here, because @@ -429,7 +429,7 @@ void Allocate() Initialize(); // Clear the wiimote classes - memset(g_WiiMotes, 0, sizeof(CWiiMote*) * MAX_WIIMOTES); + memset(g_WiiMotes, 0, sizeof(CWiiMote*) * MAX_WIIMOTES); for (int i = 0; i < MAX_WIIMOTES; i++) g_WiimoteInUse[i] = false; @@ -500,7 +500,7 @@ void Allocate() } -void DoState(PointerWrap &p) +void DoState(PointerWrap &p) { //TODO: Implement } @@ -575,7 +575,7 @@ THREAD_RETURN ReadWiimote_ThreadFunc(void* arg) DEBUG_LOG(WIIMOTE, "Connected: %i", Connect); #endif Connected.Set(); - + while (!g_Shutdown) { // There is at least one Real Wiimote in use @@ -587,8 +587,8 @@ THREAD_RETURN ReadWiimote_ThreadFunc(void* arg) g_WiiMotes[i]->ReadData(); } else { - - if (!g_StopThreadTemporary.Wait(0)) + + if (!g_StopThreadTemporary.Wait(0)) { // Event object was signaled, exiting thread to close ConfigRecordingDlg new Common::Thread(SafeCloseReadWiimote_ThreadFunc, NULL); @@ -616,7 +616,7 @@ bool SafeClose() return true; } -// Thread to avoid racing conditions by directly closing of ReadWiimote_ThreadFunc() resp. ReadWiimote() +// Thread to avoid racing conditions by directly closing of ReadWiimote_ThreadFunc() resp. ReadWiimote() // shutting down the Dlg while still beeing @ReadWiimote will result in a crash; THREAD_RETURN SafeCloseReadWiimote_ThreadFunc(void* arg) { @@ -693,7 +693,7 @@ int WiimotePairUp(bool unpair) if (hFind == NULL) { - ERROR_LOG(WIIMOTE, "Pair-Up: Error enumerating devices: %08x", GetLastError()); + ERROR_LOG(WIIMOTE, "Pair-Up: Error enumerating devices: %08x", GetLastError()); return -1; } @@ -702,10 +702,10 @@ int WiimotePairUp(bool unpair) //btdi.szName is sometimes missings it's content - it's a bt feature.. if ((!wcscmp(btdi.szName, L"Nintendo RVL-WBC-01") || !wcscmp(btdi.szName, L"Nintendo RVL-CNT-01")) && !btdi.fConnected && !unpair) { - //TODO: improve the readd of the BT driver, esp. when batteries of the wiimote are removed while beeing fConnected - if (btdi.fRemembered) + //TODO: improve the read of the BT driver, esp. when batteries of the wiimote are removed while being fConnected + if (btdi.fRemembered) { - // Make Windows forget old expired pairing + // Make Windows forget old expired pairing // we can pretty much ignore the return value here. // it either worked (ERROR_SUCCESS), or the device did not exist (ERROR_NOT_FOUND) // in both cases, there is nothing left. @@ -714,21 +714,21 @@ int WiimotePairUp(bool unpair) // Activate service DWORD hr = BluetoothSetServiceState(hRadios[radio], &btdi, &HumanInterfaceDeviceServiceClass_UUID, BLUETOOTH_SERVICE_ENABLE); - if (!hr == ERROR_SUCCESS) + if (!hr == ERROR_SUCCESS) { nPaired++; } - else + else { ERROR_LOG(WIIMOTE, "Pair-Up: BluetoothSetServiceState() returned %08x", hr); } } else if ((!wcscmp(btdi.szName, L"Nintendo RVL-WBC-01") || !wcscmp(btdi.szName, L"Nintendo RVL-CNT-01")) && unpair) { - - BluetoothRemoveDevice(&btdi.Address); - NOTICE_LOG(WIIMOTE, "Pair-Up: Automatically removed BT Device on shutdown: %08x", GetLastError()); - nPaired++; + + BluetoothRemoveDevice(&btdi.Address); + NOTICE_LOG(WIIMOTE, "Pair-Up: Automatically removed BT Device on shutdown: %08x", GetLastError()); + nPaired++; } } while (BluetoothFindNextDevice(hFind, &btdi)); @@ -750,13 +750,13 @@ int WiimotePairUp(bool unpair) #ifdef HAVE_WIIUSE LRESULT CALLBACK CallBackDeviceChange(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { - switch(uMsg) + switch(uMsg) { case WM_DEVICECHANGE: // DBT_DEVNODES_CHANGED 0x007 (devnodes are atm not received); DBT_DEVICEARRIVAL 0x8000 DBT_DEVICEREMOVECOMPLETE 0x8004 // avoiding header file^^ - if ( ( wParam == 0x8000 || wParam == 0x8004 || wParam == 0x0007 ) ) + if ( ( wParam == 0x8000 || wParam == 0x8004 || wParam == 0x0007 ) ) { if (wiiuse_check_system_notification(uMsg, wParam, lParam)) //extern wiiuse function: returns 1 if the event came from a wiimote { @@ -767,7 +767,7 @@ LRESULT CALLBACK CallBackDeviceChange(HWND hWnd, UINT uMsg, WPARAM wParam, LPARA { stoprefresh = 0; - PaiUpRefreshWiimote(); + PaiUpRefreshWiimote(); break; } else stoprefresh = 1; //fake arrival wait for second go @@ -786,7 +786,7 @@ LRESULT CALLBACK CallBackDeviceChange(HWND hWnd, UINT uMsg, WPARAM wParam, LPARA default: return DefWindowProc(hWnd, uMsg, wParam, lParam); - } + } return 0; } @@ -797,14 +797,14 @@ THREAD_RETURN RunInvisibleMessageWindow_ThreadFunc(void* arg) HWND hwnd; WNDCLASSEX WCEx; - ZeroMemory(&WCEx, sizeof(WCEx)); - WCEx.cbSize = sizeof(WCEx); - WCEx.lpfnWndProc = CallBackDeviceChange; - WCEx.hInstance = g_hInstance; - WCEx.lpszClassName = L"MSGWND"; + ZeroMemory(&WCEx, sizeof(WCEx)); + WCEx.cbSize = sizeof(WCEx); + WCEx.lpfnWndProc = CallBackDeviceChange; + WCEx.hInstance = g_hInstance; + WCEx.lpszClassName = L"MSGWND"; if (RegisterClassEx(&WCEx) != 0) - { + { hwnd = CreateWindowEx(0, WCEx.lpszClassName, NULL,0, 0, 0, 0, 0, HWND_MESSAGE, NULL, g_hInstance, NULL); @@ -815,19 +815,19 @@ THREAD_RETURN RunInvisibleMessageWindow_ThreadFunc(void* arg) } wiiuse_register_system_notification(hwnd); //function moved into wiiuse to avoid ddk/wdk dependicies - - while(GetMessage(&Msg, 0, 0, 0) > 0) - { + + while(GetMessage(&Msg, 0, 0, 0) > 0) + { TranslateMessage(&Msg); - DispatchMessage(&Msg); - } + DispatchMessage(&Msg); + } UnregisterClass(WCEx.lpszClassName, g_hInstance); if (g_Config.bUnpairRealWiimote) WiiMoteReal::WiimotePairUp(true); - return (int)Msg.wParam; + return (int)Msg.wParam; }