summaryrefslogtreecommitdiff
path: root/Source/Core
diff options
context:
space:
mode:
authorMatthew Parlane <parlane@gmail.com>2013-01-28 22:00:47 +1300
committerMatthew Parlane <parlane@gmail.com>2013-01-28 22:00:47 +1300
commit2dd077028fdaa296827864e70252b4e992b26c65 (patch)
tree6a65b5dc0c1566239f603bf1590a2eace73b46e6 /Source/Core
parented9ef874e581aa2ff5c47ec58e7b741e160b026e (diff)
parenta8d4c78cec87e864cfa5410f14687d13308e38d7 (diff)
Merge branch 'master' into wii-network
Diffstat (limited to 'Source/Core')
-rw-r--r--Source/Core/AudioCommon/Src/aldlist.cpp2
-rw-r--r--Source/Core/Common/Src/FileUtil.cpp12
-rw-r--r--Source/Core/Core/Src/BootManager.cpp8
-rw-r--r--Source/Core/Core/Src/ConfigManager.cpp2
-rw-r--r--Source/Core/Core/Src/Core.cpp11
-rw-r--r--Source/Core/Core/Src/CoreParameter.cpp10
-rw-r--r--Source/Core/Core/Src/CoreParameter.h2
-rw-r--r--Source/Core/Core/Src/DSP/DSPAccelerator.cpp5
-rw-r--r--Source/Core/Core/Src/FifoPlayer/FifoPlayer.cpp42
-rw-r--r--Source/Core/Core/Src/FifoPlayer/FifoPlayer.h1
-rw-r--r--Source/Core/Core/Src/HW/DSPHLE/UCodes/UCode_AX_Voice.h8
-rw-r--r--Source/Core/Core/Src/HW/DSPLLE/DSPLLE.cpp20
-rw-r--r--Source/Core/Core/Src/HW/EXI.cpp8
-rw-r--r--Source/Core/Core/Src/HW/MemmapFunctions.cpp2
-rw-r--r--Source/Core/Core/Src/HW/VideoInterface.cpp4
-rw-r--r--Source/Core/Core/Src/HW/WiimoteEmu/Attachment/Turntable.cpp5
-rw-r--r--Source/Core/Core/Src/HW/WiimoteEmu/WiimoteEmu.cpp16
-rw-r--r--Source/Core/Core/Src/HW/WiimoteEmu/WiimoteEmu.h7
-rw-r--r--Source/Core/Core/Src/Movie.cpp52
-rw-r--r--Source/Core/Core/Src/PowerPC/Interpreter/Interpreter_LoadStore.cpp2
-rw-r--r--Source/Core/Core/Src/PowerPC/JitCommon/JitBackpatch.cpp12
-rw-r--r--Source/Core/Core/Src/PowerPC/JitCommon/Jit_Util.cpp11
-rw-r--r--Source/Core/DiscIO/Src/Volume.h1
-rw-r--r--Source/Core/DiscIO/Src/VolumeGC.cpp7
-rw-r--r--Source/Core/DiscIO/Src/VolumeGC.h1
-rw-r--r--Source/Core/DolphinWX/Src/ConfigMain.cpp7
-rw-r--r--Source/Core/DolphinWX/Src/GLInterface/AGL.cpp9
-rw-r--r--Source/Core/DolphinWX/Src/GLInterface/EGL.cpp143
-rw-r--r--Source/Core/DolphinWX/Src/GLInterface/EGL.h1
-rw-r--r--Source/Core/DolphinWX/Src/GLInterface/GLX.cpp9
-rw-r--r--Source/Core/DolphinWX/Src/GLInterface/GLX.h1
-rw-r--r--Source/Core/DolphinWX/Src/GLInterface/InterfaceBase.h1
-rw-r--r--Source/Core/DolphinWX/Src/GLInterface/WGL.cpp7
-rw-r--r--Source/Core/DolphinWX/Src/GLInterface/WGL.h1
-rw-r--r--Source/Core/DolphinWX/Src/GLInterface/WX.cpp13
-rw-r--r--Source/Core/DolphinWX/Src/GLInterface/WX.h1
-rw-r--r--Source/Core/DolphinWX/Src/GameListCtrl.cpp7
-rw-r--r--Source/Core/DolphinWX/Src/ISOFile.cpp4
-rw-r--r--Source/Core/DolphinWX/Src/ISOFile.h2
-rw-r--r--Source/Core/DolphinWX/Src/ISOProperties.cpp32
-rw-r--r--Source/Core/DolphinWX/Src/ISOProperties.h4
-rw-r--r--Source/Core/DolphinWX/Src/X11Utils.cpp4
-rw-r--r--Source/Core/InputCommon/Src/ControllerEmu.cpp1
-rw-r--r--Source/Core/InputCommon/Src/ControllerEmu.h5
-rw-r--r--Source/Core/VideoCommon/Src/BPStructs.cpp2
-rw-r--r--Source/Core/VideoCommon/Src/PixelShaderGen.cpp5
-rw-r--r--Source/Core/VideoCommon/Src/Statistics.h2
-rw-r--r--Source/Core/VideoCommon/Src/VertexShaderManager.cpp61
-rw-r--r--Source/Core/VideoCommon/Src/XFMemory.h15
49 files changed, 307 insertions, 281 deletions
diff --git a/Source/Core/AudioCommon/Src/aldlist.cpp b/Source/Core/AudioCommon/Src/aldlist.cpp
index 5e2e072f7b..fa11fe3282 100644
--- a/Source/Core/AudioCommon/Src/aldlist.cpp
+++ b/Source/Core/AudioCommon/Src/aldlist.cpp
@@ -146,7 +146,7 @@ ALDeviceList::~ALDeviceList()
{
for (u32 i = 0; i < vDeviceInfo.size(); i++) {
if (vDeviceInfo[i].pvstrExtensions) {
- vDeviceInfo[i].pvstrExtensions->empty();
+ vDeviceInfo[i].pvstrExtensions->clear();
delete vDeviceInfo[i].pvstrExtensions;
}
}
diff --git a/Source/Core/Common/Src/FileUtil.cpp b/Source/Core/Common/Src/FileUtil.cpp
index 4120162e5c..edb2d9d484 100644
--- a/Source/Core/Common/Src/FileUtil.cpp
+++ b/Source/Core/Common/Src/FileUtil.cpp
@@ -512,12 +512,24 @@ bool DeleteDirRecursively(const std::string &directory)
if (IsDirectory(newPath))
{
if (!DeleteDirRecursively(newPath))
+ {
+ #ifndef _WIN32
+ closedir(dirp);
+ #endif
+
return false;
+ }
}
else
{
if (!File::Delete(newPath))
+ {
+ #ifndef _WIN32
+ closedir(dirp);
+ #endif
+
return false;
+ }
}
#ifdef _WIN32
diff --git a/Source/Core/Core/Src/BootManager.cpp b/Source/Core/Core/Src/BootManager.cpp
index 50c5756178..b867052381 100644
--- a/Source/Core/Core/Src/BootManager.cpp
+++ b/Source/Core/Core/Src/BootManager.cpp
@@ -54,7 +54,7 @@ namespace BootManager
// Apply fire liberally
struct ConfigCache
{
- bool valid, bCPUThread, bSkipIdle, bEnableFPRF, bMMU, bMMUBAT,
+ bool valid, bCPUThread, bSkipIdle, bEnableFPRF, bMMU, bDCBZOFF,
bVBeam, bFastDiscSpeed, bMergeBlocks, bDSPHLE, bDisableWiimoteSpeaker, bHLE_BS2;
int iTLBHack, iCPUCore;
std::string strBackend;
@@ -92,7 +92,7 @@ bool BootCore(const std::string& _rFilename)
config_cache.iCPUCore = StartUp.iCPUCore;
config_cache.bEnableFPRF = StartUp.bEnableFPRF;
config_cache.bMMU = StartUp.bMMU;
- config_cache.bMMUBAT = StartUp.bMMUBAT;
+ config_cache.bDCBZOFF = StartUp.bDCBZOFF;
config_cache.iTLBHack = StartUp.iTLBHack;
config_cache.bVBeam = StartUp.bVBeam;
config_cache.bFastDiscSpeed = StartUp.bFastDiscSpeed;
@@ -107,8 +107,8 @@ bool BootCore(const std::string& _rFilename)
game_ini.Get("Core", "SkipIdle", &StartUp.bSkipIdle, StartUp.bSkipIdle);
game_ini.Get("Core", "EnableFPRF", &StartUp.bEnableFPRF, StartUp.bEnableFPRF);
game_ini.Get("Core", "MMU", &StartUp.bMMU, StartUp.bMMU);
- game_ini.Get("Core", "BAT", &StartUp.bMMUBAT, StartUp.bMMUBAT);
game_ini.Get("Core", "TLBHack", &StartUp.iTLBHack, StartUp.iTLBHack);
+ game_ini.Get("Core", "DCBZ", &StartUp.bDCBZOFF, StartUp.bDCBZOFF);
game_ini.Get("Core", "VBeam", &StartUp.bVBeam, StartUp.bVBeam);
game_ini.Get("Core", "FastDiscSpeed", &StartUp.bFastDiscSpeed, StartUp.bFastDiscSpeed);
game_ini.Get("Core", "BlockMerging", &StartUp.bMergeBlocks, StartUp.bMergeBlocks);
@@ -167,7 +167,7 @@ void Stop()
StartUp.iCPUCore = config_cache.iCPUCore;
StartUp.bEnableFPRF = config_cache.bEnableFPRF;
StartUp.bMMU = config_cache.bMMU;
- StartUp.bMMUBAT = config_cache.bMMUBAT;
+ StartUp.bDCBZOFF = config_cache.bDCBZOFF;
StartUp.iTLBHack = config_cache.iTLBHack;
StartUp.bVBeam = config_cache.bVBeam;
StartUp.bFastDiscSpeed = config_cache.bFastDiscSpeed;
diff --git a/Source/Core/Core/Src/ConfigManager.cpp b/Source/Core/Core/Src/ConfigManager.cpp
index 6874c1c114..a9f92c62e5 100644
--- a/Source/Core/Core/Src/ConfigManager.cpp
+++ b/Source/Core/Core/Src/ConfigManager.cpp
@@ -408,7 +408,7 @@ void SConfig::LoadSettings()
ini.Get("Core", "TLBHack", &m_LocalCoreStartupParameter.iTLBHack, 0);
ini.Get("Core", "VBeam", &m_LocalCoreStartupParameter.bVBeam, false);
ini.Get("Core", "FastDiscSpeed", &m_LocalCoreStartupParameter.bFastDiscSpeed, false);
- ini.Get("Core", "BAT", &m_LocalCoreStartupParameter.bMMUBAT, false);
+ ini.Get("Core", "DCBZ", &m_LocalCoreStartupParameter.bDCBZOFF, false);
ini.Get("Core", "FrameLimit", &m_Framelimit, 1); // auto frame limit by default
ini.Get("Core", "UseFPS", &b_UseFPS, false); // use vps as default
diff --git a/Source/Core/Core/Src/Core.cpp b/Source/Core/Core/Src/Core.cpp
index 2d3d6bd72b..a9e6c87329 100644
--- a/Source/Core/Core/Src/Core.cpp
+++ b/Source/Core/Core/Src/Core.cpp
@@ -313,8 +313,6 @@ void CpuThread()
g_video_backend->Video_Prepare();
}
- Common::SetCurrentThreadAffinity(1); // Force to first core
-
#if defined(_M_X64)
EMM::InstallExceptionHandler(); // Let's run under memory watch
#endif
@@ -356,8 +354,6 @@ void FifoPlayerThread()
Common::SetCurrentThreadName("FIFO-GPU thread");
}
- Common::SetCurrentThreadAffinity(1); // Force to first core
-
g_bStarted = true;
// Enter CPU run loop. When we leave it - we are done.
@@ -382,13 +378,6 @@ void EmuThread()
Common::SetCurrentThreadName("Emuthread - Starting");
- {
- if (cpu_info.num_cores > 3) // Force to third, non-HT core
- Common::SetCurrentThreadAffinity(4);
- else // Force to second core
- Common::SetCurrentThreadAffinity(2);
- }
-
DisplayMessage(cpu_info.brand_string, 8000);
DisplayMessage(cpu_info.Summarize(), 8000);
DisplayMessage(_CoreParameter.m_strFilename, 3000);
diff --git a/Source/Core/Core/Src/CoreParameter.cpp b/Source/Core/Core/Src/CoreParameter.cpp
index 8092f868e8..994501ff0c 100644
--- a/Source/Core/Core/Src/CoreParameter.cpp
+++ b/Source/Core/Core/Src/CoreParameter.cpp
@@ -49,7 +49,7 @@ SCoreStartupParameter::SCoreStartupParameter()
bMergeBlocks(false),
bDPL2Decoder(false), iLatency(14),
bRunCompareServer(false), bRunCompareClient(false),
- bMMU(false), bMMUBAT(false), iTLBHack(0), bVBeam(false),
+ bMMU(false), bDCBZOFF(false), iTLBHack(0), bVBeam(false),
bFastDiscSpeed(false),
SelectedLanguage(0), bWii(false), bDisableWiimoteSpeaker(false),
bConfirmStop(false), bHideCursor(false),
@@ -78,7 +78,7 @@ void SCoreStartupParameter::LoadDefaults()
bDSPThread = true;
bEnableFPRF = false;
bMMU = false;
- bMMUBAT = false;
+ bDCBZOFF = false;
iTLBHack = 0;
bVBeam = false;
bFastDiscSpeed = false;
@@ -351,7 +351,11 @@ void SCoreStartupParameter::CheckMemcardPath(std::string& memcardPath, std::stri
{
// Use default memcard path if there is no user defined name
std::string defaultFilename = isSlotA ? GC_MEMCARDA : GC_MEMCARDB;
- memcardPath = File::GetUserPath(D_GCUSER_IDX) + defaultFilename + ext;
+ #ifdef _WIN32
+ memcardPath = "." + File::GetUserPath(D_GCUSER_IDX).substr(File::GetExeDirectory().size()) + defaultFilename + ext;
+ #else
+ memcardPath = File::GetUserPath(D_GCUSER_IDX) + defaultFilename + ext;
+ #endif
}
else
{
diff --git a/Source/Core/Core/Src/CoreParameter.h b/Source/Core/Core/Src/CoreParameter.h
index 776e22e724..8c52ba9521 100644
--- a/Source/Core/Core/Src/CoreParameter.h
+++ b/Source/Core/Core/Src/CoreParameter.h
@@ -116,7 +116,7 @@ struct SCoreStartupParameter
bool bRunCompareClient;
bool bMMU;
- bool bMMUBAT;
+ bool bDCBZOFF;
int iTLBHack;
bool bVBeam;
bool bFastDiscSpeed;
diff --git a/Source/Core/Core/Src/DSP/DSPAccelerator.cpp b/Source/Core/Core/Src/DSP/DSPAccelerator.cpp
index 2058a92f9d..dcb79b7ac5 100644
--- a/Source/Core/Core/Src/DSP/DSPAccelerator.cpp
+++ b/Source/Core/Core/Src/DSP/DSPAccelerator.cpp
@@ -165,10 +165,11 @@ u16 dsp_read_accelerator()
// Somehow, YN1 and YN2 must be initialized with their "loop" values,
// so yeah, it seems likely that we should raise an exception to let
// the DSP program do that, at least if DSP_FORMAT == 0x0A.
- if ((Address & ~0x1f) == (EndAddress & ~0x1f))
+ if (Address >= EndAddress)
{
// Set address back to start address.
- Address = (g_dsp.ifx_regs[DSP_ACSAH] << 16) | g_dsp.ifx_regs[DSP_ACSAL];
+ if ((Address & ~0x1f) == (EndAddress & ~0x1f))
+ Address = (g_dsp.ifx_regs[DSP_ACSAH] << 16) | g_dsp.ifx_regs[DSP_ACSAL];
DSPCore_SetException(EXP_ACCOV);
}
diff --git a/Source/Core/Core/Src/FifoPlayer/FifoPlayer.cpp b/Source/Core/Core/Src/FifoPlayer/FifoPlayer.cpp
index 1873a91574..ff90736fec 100644
--- a/Source/Core/Core/Src/FifoPlayer/FifoPlayer.cpp
+++ b/Source/Core/Core/Src/FifoPlayer/FifoPlayer.cpp
@@ -20,7 +20,6 @@
#include "Common.h"
#include "CoreTiming.h"
-#include "Thread.h"
#include "HW/GPFifo.h"
#include "HW/Memmap.h"
@@ -28,7 +27,6 @@
#include "PowerPC/PowerPC.h"
#include "BPMemory.h"
-#include "CommandProcessor.h"
FifoPlayer::~FifoPlayer()
{
@@ -96,40 +94,7 @@ bool FifoPlayer::Play()
if (m_EarlyMemoryUpdates && m_CurrentFrame == m_FrameRangeStart)
WriteAllMemoryUpdates();
- // Stop Fifo processing until we've written the new frame
- WriteCP(CommandProcessor::CTRL_REGISTER, 0x10); // disable read & breakpoints, enable GP link
-
- // Write frame data
- WriteFrame(m_File->GetFrame(m_CurrentFrame), m_FrameInfo[m_CurrentFrame]);
-
- // Enable frame processing and break when done
- u16 write_ptr_lo = ReadCP(CommandProcessor::FIFO_WRITE_POINTER_LO);
- u16 write_ptr_hi = ReadCP(CommandProcessor::FIFO_WRITE_POINTER_HI);
- WriteCP(CommandProcessor::FIFO_BP_LO, write_ptr_lo);
- WriteCP(CommandProcessor::FIFO_BP_HI, write_ptr_hi);
- WriteCP(CommandProcessor::CTRL_REGISTER, 0x13); // enable read, breakpoints & GP link
-
- // If necessary, wait until GP has reached the breakpoint to prevent fifo overflows
- // TODO: Can this be done any better? Dual core mode is slower than single core mode even with these conditions..
- if (m_CurrentFrame < m_FrameRangeEnd)
- {
- // Check if FIFO would be overflown when writing the next frame
- u32 CPRWDistance = (ReadCP(CommandProcessor::FIFO_RW_DISTANCE_HI)<<16) | ReadCP(CommandProcessor::FIFO_RW_DISTANCE_LO);
- CPRWDistance += m_File->GetFrame(m_CurrentFrame+1).fifoDataSize + CommandProcessor::GATHER_PIPE_SIZE;
- u32 CPFifoBase = (ReadCP(CommandProcessor::FIFO_BASE_HI)<<16) | ReadCP(CommandProcessor::FIFO_BASE_LO);
- u32 CPFifoEnd = (ReadCP(CommandProcessor::FIFO_END_HI)<<16) | ReadCP(CommandProcessor::FIFO_END_LO);
-
- bool bWait = (CPRWDistance > CPFifoEnd - CPFifoBase);
- while (bWait && (ReadCP(CommandProcessor::FIFO_READ_POINTER_LO) != write_ptr_lo ||
- ReadCP(CommandProcessor::FIFO_READ_POINTER_HI) != write_ptr_hi))
- {
- Common::YieldCPU();
- CoreTiming::Advance(); // Process scheduled events (esp. PixelEngine::SetFinish!)
-
- if (PowerPC::GetState() == PowerPC::CPU_POWERDOWN)
- break;
- }
- }
+ WriteFrame(m_File->GetFrame(m_CurrentFrame), m_FrameInfo[m_CurrentFrame]);
++m_CurrentFrame;
}
@@ -422,11 +387,6 @@ void FifoPlayer::LoadMemory()
FlushWGP();
}
-u16 FifoPlayer::ReadCP(u32 address)
-{
- return Memory::Read_U16(0xCC000000 | address);
-}
-
void FifoPlayer::WriteCP(u32 address, u16 value)
{
Memory::Write_U16(value, 0xCC000000 | address);
diff --git a/Source/Core/Core/Src/FifoPlayer/FifoPlayer.h b/Source/Core/Core/Src/FifoPlayer/FifoPlayer.h
index 838ac13f18..9db6c0d980 100644
--- a/Source/Core/Core/Src/FifoPlayer/FifoPlayer.h
+++ b/Source/Core/Core/Src/FifoPlayer/FifoPlayer.h
@@ -87,7 +87,6 @@ private:
void LoadMemory();
- u16 ReadCP(u32 address);
void WriteCP(u32 address, u16 value);
void WritePI(u32 address, u32 value);
diff --git a/Source/Core/Core/Src/HW/DSPHLE/UCodes/UCode_AX_Voice.h b/Source/Core/Core/Src/HW/DSPHLE/UCodes/UCode_AX_Voice.h
index e39b38b100..349dc7e03b 100644
--- a/Source/Core/Core/Src/HW/DSPHLE/UCodes/UCode_AX_Voice.h
+++ b/Source/Core/Core/Src/HW/DSPHLE/UCodes/UCode_AX_Voice.h
@@ -203,10 +203,12 @@ u16 AcceleratorGetSample()
//
// On real hardware, this would raise an interrupt that is handled by the
// UCode. We simulate what this interrupt does here.
- if ((*acc_cur_addr & ~0x1F) == (acc_end_addr & ~0x1F))
+ if (*acc_cur_addr >= acc_end_addr)
{
- // If we are really at the end, loop back to loop_addr.
- *acc_cur_addr = acc_loop_addr;
+ // If we are really at the end (and we don't simply have cur_addr >
+ // end_addr all the time), loop back to loop_addr.
+ if ((*acc_cur_addr & ~0x1F) == (acc_end_addr & ~0x1F))
+ *acc_cur_addr = acc_loop_addr;
if (acc_pb->audio_addr.looping)
{
diff --git a/Source/Core/Core/Src/HW/DSPLLE/DSPLLE.cpp b/Source/Core/Core/Src/HW/DSPLLE/DSPLLE.cpp
index 0d2b375268..92053053de 100644
--- a/Source/Core/Core/Src/HW/DSPLLE/DSPLLE.cpp
+++ b/Source/Core/Core/Src/HW/DSPLLE/DSPLLE.cpp
@@ -104,26 +104,6 @@ void DSPLLE::dsp_thread(DSPLLE *dsp_lle)
{
Common::SetCurrentThreadName("DSP thread");
- {
- if (cpu_info.num_cores > 3)
- {
- // HACK (delroth): there is no way to know where hyperthreads are in
- // the current Dolphin version.
- bool windows = false;
-#ifdef _WIN32
- windows = true;
-#endif
-
- u8 core_id;
- if (windows && cpu_info.num_cores > 4) // Probably HT
- core_id = 5; // 3rd non HT core
- else
- core_id = 3; // 3rd core
-
- Common::SetCurrentThreadAffinity(1 << (core_id - 1));
- }
- }
-
while (dsp_lle->m_bIsRunning)
{
int cycles = (int)dsp_lle->m_cycle_count;
diff --git a/Source/Core/Core/Src/HW/EXI.cpp b/Source/Core/Core/Src/HW/EXI.cpp
index 8800ea6095..1e86bd1b90 100644
--- a/Source/Core/Core/Src/HW/EXI.cpp
+++ b/Source/Core/Core/Src/HW/EXI.cpp
@@ -25,6 +25,7 @@
#include "EXI.h"
#include "Sram.h"
+#include "../Movie.h"
SRAM g_SRAM;
namespace ExpansionInterface
@@ -44,7 +45,12 @@ void Init()
for (u32 i = 0; i < NUM_CHANNELS; i++)
g_Channels[i] = new CEXIChannel(i);
- g_Channels[0]->AddDevice(SConfig::GetInstance().m_EXIDevice[0], 0); // SlotA
+ if (Movie::IsPlayingInput() && Movie::IsUsingMemcard() && Movie::IsConfigSaved())
+ g_Channels[0]->AddDevice(EXIDEVICE_MEMORYCARD, 0); // SlotA
+ else if(Movie::IsPlayingInput() && !Movie::IsUsingMemcard() && Movie::IsConfigSaved())
+ g_Channels[0]->AddDevice(EXIDEVICE_NONE, 0); // SlotA
+ else
+ g_Channels[0]->AddDevice(SConfig::GetInstance().m_EXIDevice[0], 0); // SlotA
g_Channels[0]->AddDevice(EXIDEVICE_MASKROM, 1);
g_Channels[0]->AddDevice(SConfig::GetInstance().m_EXIDevice[2], 2); // Serial Port 1
g_Channels[1]->AddDevice(SConfig::GetInstance().m_EXIDevice[1], 0); // SlotB
diff --git a/Source/Core/Core/Src/HW/MemmapFunctions.cpp b/Source/Core/Core/Src/HW/MemmapFunctions.cpp
index 1b3a44f5d6..81f2700bdb 100644
--- a/Source/Core/Core/Src/HW/MemmapFunctions.cpp
+++ b/Source/Core/Core/Src/HW/MemmapFunctions.cpp
@@ -960,7 +960,7 @@ u32 TranslateAddress(const u32 _Address, const XCheckTLBFlag _Flag)
// Check MSR[DR] bit before translating data addresses
//if (((_Flag == FLAG_READ) || (_Flag == FLAG_WRITE)) && !(MSR & (1 << (31 - 27)))) return _Address;
- u32 tlb_addr = Core::g_CoreStartupParameter.bMMUBAT?TranslateBlockAddress(_Address, _Flag):0;
+ u32 tlb_addr = TranslateBlockAddress(_Address, _Flag);
if (tlb_addr == 0)
{
tlb_addr = TranslatePageAddress(_Address, _Flag);
diff --git a/Source/Core/Core/Src/HW/VideoInterface.cpp b/Source/Core/Core/Src/HW/VideoInterface.cpp
index cc2ce18ce0..95c06d1f88 100644
--- a/Source/Core/Core/Src/HW/VideoInterface.cpp
+++ b/Source/Core/Core/Src/HW/VideoInterface.cpp
@@ -144,8 +144,8 @@ void Preset(bool _bNTSC)
m_HorizontalStepping.FbSteps = 40;
m_HorizontalStepping.FieldSteps = 40;
- m_HBeamPos = 1;
- m_VBeamPos = 1;
+ m_HBeamPos = 0;
+ m_VBeamPos = 0;
// 54MHz, capable of progressive scan
m_Clock = Core::g_CoreStartupParameter.bProgressive;
diff --git a/Source/Core/Core/Src/HW/WiimoteEmu/Attachment/Turntable.cpp b/Source/Core/Core/Src/HW/WiimoteEmu/Attachment/Turntable.cpp
index 292d9c5a86..182170f501 100644
--- a/Source/Core/Core/Src/HW/WiimoteEmu/Attachment/Turntable.cpp
+++ b/Source/Core/Core/Src/HW/WiimoteEmu/Attachment/Turntable.cpp
@@ -97,8 +97,9 @@ void Turntable::GetState(u8* const data, const bool focus)
// crossfade slider
{
- u8 cfs = 0;
- m_crossfade->GetState(&cfs, 8, 7);
+ s8 cfs = 0;
+ m_crossfade->GetState(&cfs, focus ? 7 : 0);
+ cfs += 8;
ttdata->slider = cfs;
}
diff --git a/Source/Core/Core/Src/HW/WiimoteEmu/WiimoteEmu.cpp b/Source/Core/Core/Src/HW/WiimoteEmu/WiimoteEmu.cpp
index 61996d8e7c..6fe6b81613 100644
--- a/Source/Core/Core/Src/HW/WiimoteEmu/WiimoteEmu.cpp
+++ b/Source/Core/Core/Src/HW/WiimoteEmu/WiimoteEmu.cpp
@@ -41,6 +41,13 @@ inline double round(double x) { return (x-floor(x))>0.5 ? ceil(x) : floor(x); }
#include "../../Movie.h"
+namespace
+{
+// :)
+auto const TAU = 6.28318530717958647692;
+auto const PI = TAU / 2.0;
+}
+
namespace WiimoteEmu
{
@@ -124,7 +131,8 @@ void EmulateTilt(AccelData* const accel
, const bool focus, const bool sideways, const bool upright)
{
float roll, pitch;
- tilt_group->GetState( &roll, &pitch, 0, focus ? (PI / 2) : 0 ); // 90 degrees
+ // 180 degrees
+ tilt_group->GetState(&roll, &pitch, 0, focus ? PI : 0);
unsigned int ud = 0, lr = 0, fb = 0;
@@ -267,6 +275,9 @@ Wiimote::Wiimote( const unsigned int index )
for (unsigned int i=0; i < sizeof(named_buttons)/sizeof(*named_buttons); ++i)
m_buttons->controls.push_back(new ControlGroup::Input( named_buttons[i]));
+ // udp
+ groups.push_back(m_udp = new UDPWrapper(m_index, _trans("UDP Wiimote")));
+
// ir
groups.push_back(m_ir = new Cursor(_trans("IR")));
@@ -276,9 +287,6 @@ Wiimote::Wiimote( const unsigned int index )
// tilt
groups.push_back(m_tilt = new Tilt(_trans("Tilt")));
- // udp
- groups.push_back(m_udp = new UDPWrapper(m_index, _trans("UDP Wiimote")));
-
// shake
groups.push_back(m_shake = new Buttons(_trans("Shake")));
m_shake->controls.push_back(new ControlGroup::Input("X"));
diff --git a/Source/Core/Core/Src/HW/WiimoteEmu/WiimoteEmu.h b/Source/Core/Core/Src/HW/WiimoteEmu/WiimoteEmu.h
index 2a773d8978..36f0da406b 100644
--- a/Source/Core/Core/Src/HW/WiimoteEmu/WiimoteEmu.h
+++ b/Source/Core/Core/Src/HW/WiimoteEmu/WiimoteEmu.h
@@ -30,13 +30,6 @@
#include <vector>
#include <queue>
-namespace
-{
-// :)
-auto const TAU = 6.28318530717958647692;
-auto const PI = TAU / 2.0;
-}
-
// Registry sizes
#define WIIMOTE_EEPROM_SIZE (16*1024)
#define WIIMOTE_EEPROM_FREE_SIZE 0x1700
diff --git a/Source/Core/Core/Src/Movie.cpp b/Source/Core/Core/Src/Movie.cpp
index 316181d449..6c646f6870 100644
--- a/Source/Core/Core/Src/Movie.cpp
+++ b/Source/Core/Core/Src/Movie.cpp
@@ -736,16 +736,6 @@ bool PlayInput(const char *filename)
goto cleanup;
}
- // Load savestate (and skip to frame data)
- if(tmpHeader.bFromSaveState)
- {
- const std::string stateFilename = std::string(filename) + ".sav";
- if(File::Exists(stateFilename))
- Core::SetStateFileName(stateFilename);
- g_bRecordingFromSaveState = true;
- Movie::LoadInput(filename);
- }
-
ReadHeader();
g_totalFrames = tmpHeader.frameCount;
g_totalLagCount = tmpHeader.lagCount;
@@ -762,6 +752,16 @@ bool PlayInput(const char *filename)
g_currentByte = 0;
g_recordfd.Close();
+ // Load savestate (and skip to frame data)
+ if(tmpHeader.bFromSaveState)
+ {
+ const std::string stateFilename = std::string(filename) + ".sav";
+ if(File::Exists(stateFilename))
+ Core::SetStateFileName(stateFilename);
+ g_bRecordingFromSaveState = true;
+ Movie::LoadInput(filename);
+ }
+
return true;
cleanup:
@@ -786,7 +786,13 @@ void DoState(PointerWrap &p)
void LoadInput(const char *filename)
{
- File::IOFile t_record(filename, "r+b");
+ File::IOFile t_record;
+ if (!t_record.Open(filename, "r+b"))
+ {
+ PanicAlertT("Failed to read %s", filename);
+ EndPlayInput(false);
+ return;
+ }
t_record.ReadArray(&tmpHeader, 1);
@@ -849,7 +855,7 @@ void LoadInput(const char *filename)
{
// this is a "you did something wrong" alert for the user's benefit.
// we'll try to say what's going on in excruciating detail, otherwise the user might not believe us.
- if(Core::g_CoreStartupParameter.bWii)
+ if(IsUsingWiimote(0))
{
// TODO: more detail
PanicAlertT("Warning: You loaded a save whose movie mismatches on byte %d (0x%X). You should load another save before continuing, or load this state with read-only mode off. Otherwise you'll probably get a desync.", i+256, i+256);
@@ -925,18 +931,6 @@ void PlayController(SPADStatus *PadStatus, int controllerID)
if (!IsPlayingInput() || !IsUsingPad(controllerID) || tmpInput == NULL)
return;
- if (g_currentFrame == 1)
- {
- if (tmpHeader.bMemcard)
- {
- ExpansionInterface::ChangeDevice(0, EXIDEVICE_MEMORYCARD, 0);
- }
- else if (!tmpHeader.bMemcard)
- {
- ExpansionInterface::ChangeDevice(0, EXIDEVICE_NONE, 0);
- }
- }
-
if (g_currentByte + 8 > g_totalBytes)
{
PanicAlertT("Premature movie end in PlayController. %u + 8 > %u", (u32)g_currentByte, (u32)g_totalBytes);
@@ -1194,9 +1188,13 @@ void GetSettings()
g_bClearSave = !File::Exists(SConfig::GetInstance().m_strMemoryCardA);
bMemcard = SConfig::GetInstance().m_EXIDevice[0] == EXIDEVICE_MEMORYCARD;
- std::stringstream ss;
- ss << std::hex << SCM_REV_STR;
- ss >> revision;
+ int temp;
+
+ for(int i = 0; i < 4; ++i )
+ {
+ sscanf(SCM_REV_STR + 2 * i, "%2x", &temp );
+ revision[i] = temp;
+ }
}
void CheckMD5()
diff --git a/Source/Core/Core/Src/PowerPC/Interpreter/Interpreter_LoadStore.cpp b/Source/Core/Core/Src/PowerPC/Interpreter/Interpreter_LoadStore.cpp
index bc5cfc10e6..5e665eb38e 100644
--- a/Source/Core/Core/Src/PowerPC/Interpreter/Interpreter_LoadStore.cpp
+++ b/Source/Core/Core/Src/PowerPC/Interpreter/Interpreter_LoadStore.cpp
@@ -407,7 +407,7 @@ void Interpreter::dcbtst(UGeckoInstruction _inst)
void Interpreter::dcbz(UGeckoInstruction _inst)
{
// HACK but works... we think
- if (HID2.WPE || !HID0.DCFA)
+ if (!Core::g_CoreStartupParameter.bDCBZOFF)
Memory::Memset(Helper_Get_EA_X(_inst) & (~31), 0, 32);
if (!jit)
PowerPC::CheckExceptions();
diff --git a/Source/Core/Core/Src/PowerPC/JitCommon/JitBackpatch.cpp b/Source/Core/Core/Src/PowerPC/JitCommon/JitBackpatch.cpp
index 9337f87b77..3042cfedba 100644
--- a/Source/Core/Core/Src/PowerPC/JitCommon/JitBackpatch.cpp
+++ b/Source/Core/Core/Src/PowerPC/JitCommon/JitBackpatch.cpp
@@ -90,6 +90,13 @@ const u8 *TrampolineCache::GetReadTrampoline(const InstructionInfo &info)
case 4:
CALL(thunks.ProtectFunction((void *)&Memory::Read_U32, 1));
break;
+ case 2:
+ CALL(thunks.ProtectFunction((void *)&Memory::Read_U16, 1));
+ SHL(32, R(EAX), Imm8(16));
+ break;
+ case 1:
+ CALL(thunks.ProtectFunction((void *)&Memory::Read_U8, 1));
+ break;
}
ABI_PopAllCallerSavedRegsAndAdjustStack();
if (dataReg != EAX) {
@@ -176,10 +183,6 @@ const u8 *JitBase::BackPatch(u8 *codePtr, int accessType, u32 emAddress, void *c
codePtr, emAddress);
}*/
- if (info.operandSize != 4) {
- BackPatchError(StringFromFormat("BackPatch - no support for operand size %i", info.operandSize), codePtr, emAddress);
- }
-
if (info.otherReg != RBX)
PanicAlert("BackPatch : Base reg not RBX."
"\n\nAttempted to access %08x.", emAddress);
@@ -188,7 +191,6 @@ const u8 *JitBase::BackPatch(u8 *codePtr, int accessType, u32 emAddress, void *c
PanicAlert("BackPatch : Currently only supporting reads."
"\n\nAttempted to write to %08x.", emAddress);
- // In the first iteration, we assume that all accesses are 32-bit. We also only deal with reads.
if (accessType == 0)
{
XEmitter emitter(codePtr);
diff --git a/Source/Core/Core/Src/PowerPC/JitCommon/Jit_Util.cpp b/Source/Core/Core/Src/PowerPC/JitCommon/Jit_Util.cpp
index 4cfc3ab934..cc1327c695 100644
--- a/Source/Core/Core/Src/PowerPC/JitCommon/Jit_Util.cpp
+++ b/Source/Core/Core/Src/PowerPC/JitCommon/Jit_Util.cpp
@@ -96,7 +96,11 @@ void EmuCodeBlock::UnsafeLoadToEAX(const Gen::OpArg & opAddress, int accessSize,
MOVZX(32, accessSize, EAX, MDisp(EAX, (u32)Memory::base + offset));
}
#endif
-
+
+ // Add a 2 bytes NOP to have some space for the backpatching
+ if (accessSize == 8)
+ NOP(2);
+
if (accessSize == 32)
{
BSWAP(32, EAX);
@@ -120,12 +124,11 @@ void EmuCodeBlock::SafeLoadToEAX(const Gen::OpArg & opAddress, int accessSize, s
{
#if defined(_M_X64)
#ifdef ENABLE_MEM_CHECK
- if (accessSize == 32 && !Core::g_CoreStartupParameter.bMMU && !Core::g_CoreStartupParameter.bEnableDebugging)
+ if (!Core::g_CoreStartupParameter.bMMU && !Core::g_CoreStartupParameter.bEnableDebugging)
#else
- if (accessSize == 32 && !Core::g_CoreStartupParameter.bMMU)
+ if (!Core::g_CoreStartupParameter.bMMU)
#endif
{
- // BackPatch only supports 32-bits accesses
UnsafeLoadToEAX(opAddress, accessSize, offset, signExtend);
}
else
diff --git a/Source/Core/DiscIO/Src/Volume.h b/Source/Core/DiscIO/Src/Volume.h
index c90ee4a381..557c71c31f 100644
--- a/Source/Core/DiscIO/Src/Volume.h
+++ b/Source/Core/DiscIO/Src/Volume.h
@@ -43,6 +43,7 @@ public:
virtual std::string GetApploaderDate() const = 0;
virtual bool SupportsIntegrityCheck() const { return false; }
virtual bool CheckIntegrity() const { return false; }
+ virtual bool IsDiscTwo() const { return false; }
enum ECountry
{
diff --git a/Source/Core/DiscIO/Src/VolumeGC.cpp b/Source/Core/DiscIO/Src/VolumeGC.cpp
index 51fac285fc..09e2c5eaa9 100644
--- a/Source/Core/DiscIO/Src/VolumeGC.cpp
+++ b/Source/Core/DiscIO/Src/VolumeGC.cpp
@@ -137,4 +137,11 @@ u64 CVolumeGC::GetSize() const
return 0;
}
+bool CVolumeGC::IsDiscTwo() const
+{
+ bool discTwo;
+ Read(6,1, (u8*) &discTwo);
+ return discTwo;
+}
+
} // namespace
diff --git a/Source/Core/DiscIO/Src/VolumeGC.h b/Source/Core/DiscIO/Src/VolumeGC.h
index 5fd18ea96a..4221df9493 100644
--- a/Source/Core/DiscIO/Src/VolumeGC.h
+++ b/Source/Core/DiscIO/Src/VolumeGC.h
@@ -39,6 +39,7 @@ public:
std::string GetApploaderDate() const;
ECountry GetCountry() const;
u64 GetSize() const;
+ bool IsDiscTwo() const;
private:
IBlobReader* m_pReader;
diff --git a/Source/Core/DolphinWX/Src/ConfigMain.cpp b/Source/Core/DolphinWX/Src/ConfigMain.cpp
index 423885e0f2..4daf263b63 100644
--- a/Source/Core/DolphinWX/Src/ConfigMain.cpp
+++ b/Source/Core/DolphinWX/Src/ConfigMain.cpp
@@ -1064,6 +1064,13 @@ void CConfigMain::ChooseMemcardPath(std::string& strMemcard, bool isSlotA)
return;
}
}
+ #ifdef _WIN32
+ if (!strncmp(File::GetExeDirectory().c_str(), filename.c_str(), File::GetExeDirectory().size()))
+ {
+ filename.erase(0, File::GetExeDirectory().size() +1);
+ filename = "./" + filename;
+ }
+ #endif
// also check that the path isn't used for the other memcard...
if (filename.compare(isSlotA ? SConfig::GetInstance().m_strMemoryCardB
diff --git a/Source/Core/DolphinWX/Src/GLInterface/AGL.cpp b/Source/Core/DolphinWX/Src/GLInterface/AGL.cpp
index 30ff4a31cf..cf68c0baa4 100644
--- a/Source/Core/DolphinWX/Src/GLInterface/AGL.cpp
+++ b/Source/Core/DolphinWX/Src/GLInterface/AGL.cpp
@@ -18,6 +18,7 @@
#include "VideoConfig.h"
#include "Host.h"
#include "RenderBase.h"
+#include "ConfigManager.h"
#include "VertexShaderManager.h"
#include "../GLInterface.h"
@@ -91,13 +92,6 @@ bool cInterfaceAGL::Create(void *&window_handle)
bool cInterfaceAGL::MakeCurrent()
{
- [GLWin.cocoaCtx makeCurrentContext];
- return true;
-}
-
-// Update window width, size and etc. Called from Render.cpp
-void cInterfaceAGL::Update()
-{
int width, height;
width = [[GLWin.cocoaWin contentView] frame].size.width;
@@ -110,6 +104,7 @@ void cInterfaceAGL::Update()
[GLWin.cocoaCtx makeCurrentContext];
s_backbuffer_width = width;
s_backbuffer_height = height;
+ return true;
}
// Close backend
diff --git a/Source/Core/DolphinWX/Src/GLInterface/EGL.cpp b/Source/Core/DolphinWX/Src/GLInterface/EGL.cpp
index b8716ab467..304eb92059 100644
--- a/Source/Core/DolphinWX/Src/GLInterface/EGL.cpp
+++ b/Source/Core/DolphinWX/Src/GLInterface/EGL.cpp
@@ -26,6 +26,12 @@ void cInterfaceEGL::UpdateFPSDisplay(const char *text)
{
XStoreName(GLWin.dpy, GLWin.win, text);
}
+
+void cInterfaceEGL::SwapInterval(int Interval)
+{
+ eglSwapInterval(GLWin.egl_dpy, Interval);
+}
+
void cInterfaceEGL::Swap()
{
eglSwapBuffers(GLWin.egl_dpy, GLWin.egl_surf);
@@ -42,38 +48,30 @@ bool cInterfaceEGL::Create(void *&window_handle)
s_backbuffer_width = _twidth;
s_backbuffer_height = _theight;
- const char *s;
- EGLint egl_major, egl_minor;
-
- GLWin.dpy = XOpenDisplay(NULL);
-
- if (!GLWin.dpy) {
- printf("Error: couldn't open display\n");
- return false;
- }
+ EGLint egl_major, egl_minor;
- GLWin.egl_dpy = eglGetDisplay(GLWin.dpy);
- if (!GLWin.egl_dpy) {
- printf("Error: eglGetDisplay() failed\n");
- return false;
- }
+ GLWin.dpy = XOpenDisplay(NULL);
- if (!eglInitialize(GLWin.egl_dpy, &egl_major, &egl_minor)) {
- printf("Error: eglInitialize() failed\n");
- return false;
- }
-
- s = eglQueryString(GLWin.egl_dpy, EGL_VERSION);
- printf("EGL_VERSION = %s\n", s);
+ if (!GLWin.dpy) {
+ ERROR_LOG(VIDEO, "Error: couldn't open display\n");
+ return false;
+ }
- s = eglQueryString(GLWin.egl_dpy, EGL_VENDOR);
- printf("EGL_VENDOR = %s\n", s);
+ GLWin.egl_dpy = eglGetDisplay(GLWin.dpy);
+ if (!GLWin.egl_dpy) {
+ ERROR_LOG(VIDEO, "Error: eglGetDisplay() failed\n");
+ return false;
+ }
- s = eglQueryString(GLWin.egl_dpy, EGL_EXTENSIONS);
- printf("EGL_EXTENSIONS = %s\n", s);
+ if (!eglInitialize(GLWin.egl_dpy, &egl_major, &egl_minor)) {
+ ERROR_LOG(VIDEO, "Error: eglInitialize() failed\n");
+ return false;
+ }
- s = eglQueryString(GLWin.egl_dpy, EGL_CLIENT_APIS);
- printf("EGL_CLIENT_APIS = %s\n", s);
+ INFO_LOG(VIDEO, "EGL_VERSION = %s\n", eglQueryString(GLWin.egl_dpy, EGL_VERSION));
+ INFO_LOG(VIDEO, "EGL_VENDOR = %s\n", eglQueryString(GLWin.egl_dpy, EGL_VENDOR));
+ INFO_LOG(VIDEO, "EGL_EXTENSIONS = %s\n", eglQueryString(GLWin.egl_dpy, EGL_EXTENSIONS));
+ INFO_LOG(VIDEO, "EGL_CLIENT_APIS = %s\n", eglQueryString(GLWin.egl_dpy, EGL_CLIENT_APIS));
// attributes for a visual in RGBA format with at least
// 8 bits per color and a 24 bit depth buffer
@@ -102,29 +100,29 @@ bool cInterfaceEGL::Create(void *&window_handle)
if (GLWin.parent == 0)
GLWin.parent = RootWindow(GLWin.dpy, GLWin.screen);
- XVisualInfo visTemplate;
- int num_visuals;
- EGLConfig config;
- EGLint num_configs;
- EGLint vid;
-
- if (!eglChooseConfig( GLWin.egl_dpy, attribs, &config, 1, &num_configs)) {
- printf("Error: couldn't get an EGL visual config\n");
- exit(1);
- }
-
- if (!eglGetConfigAttrib(GLWin.egl_dpy, config, EGL_NATIVE_VISUAL_ID, &vid)) {
- printf("Error: eglGetConfigAttrib() failed\n");
- exit(1);
- }
-
- /* The X window visual must match the EGL config */
- visTemplate.visualid = vid;
- GLWin.vi = XGetVisualInfo(GLWin.dpy, VisualIDMask, &visTemplate, &num_visuals);
- if (!GLWin.vi) {
- printf("Error: couldn't get X visual\n");
- exit(1);
- }
+ XVisualInfo visTemplate;
+ int num_visuals;
+ EGLConfig config;
+ EGLint num_configs;
+ EGLint vid;
+
+ if (!eglChooseConfig( GLWin.egl_dpy, attribs, &config, 1, &num_configs)) {
+ ERROR_LOG(VIDEO, "Error: couldn't get an EGL visual config\n");
+ return false;
+ }
+
+ if (!eglGetConfigAttrib(GLWin.egl_dpy, config, EGL_NATIVE_VISUAL_ID, &vid)) {
+ ERROR_LOG(VIDEO, "Error: eglGetConfigAttrib() failed\n");
+ return false;
+ }
+
+ /* The X window visual must match the EGL config */
+ visTemplate.visualid = vid;
+ GLWin.vi = XGetVisualInfo(GLWin.dpy, VisualIDMask, &visTemplate, &num_visuals);
+ if (!GLWin.vi) {
+ ERROR_LOG(VIDEO, "Error: couldn't get X visual\n");
+ return false;
+ }
GLWin.x = _tx;
GLWin.y = _ty;
@@ -138,33 +136,26 @@ bool cInterfaceEGL::Create(void *&window_handle)
eglBindAPI(EGL_OPENGL_API);
#endif
GLWin.egl_ctx = eglCreateContext(GLWin.egl_dpy, config, EGL_NO_CONTEXT, ctx_attribs );
- if (!GLWin.egl_ctx) {
- printf("Error: eglCreateContext failed\n");
- exit(1);
- }
-
- GLWin.egl_surf = eglCreateWindowSurface(GLWin.egl_dpy, config, GLWin.win, NULL);
- if (!GLWin.egl_surf) {
- printf("Error: eglCreateWindowSurface failed\n");
- exit(1);
- }
-
- if (!eglMakeCurrent(GLWin.egl_dpy, GLWin.egl_surf, GLWin.egl_surf, GLWin.egl_ctx)) {
-
- printf("Error: eglMakeCurrent() failed\n");
- return false;
- }
-
+ if (!GLWin.egl_ctx) {
+ ERROR_LOG(VIDEO, "Error: eglCreateContext failed\n");
+ return false;
+ }
+
+ GLWin.egl_surf = eglCreateWindowSurface(GLWin.egl_dpy, config, GLWin.win, NULL);
+ if (!GLWin.egl_surf) {
+ ERROR_LOG(VIDEO, "Error: eglCreateWindowSurface failed\n");
+ return false;
+ }
- printf("GL_VENDOR: %s\n", glGetString(GL_VENDOR));
- printf("GL_RENDERER: %s\n", glGetString(GL_RENDERER));
- printf("GL_VERSION: %s\n", glGetString(GL_VERSION));
- printf("GL_EXTENSIONS: %s\n", glGetString(GL_EXTENSIONS));
- /* Set initial projection/viewing transformation.
- * We can't be sure we'll get a ConfigureNotify event when the window
- * first appears.
- */
- glViewport(0, 0, (GLint) _twidth, (GLint) _theight);
+ if (!eglMakeCurrent(GLWin.egl_dpy, GLWin.egl_surf, GLWin.egl_surf, GLWin.egl_ctx)) {
+ ERROR_LOG(VIDEO, "Error: eglMakeCurrent() failed\n");
+ return false;
+ }
+
+ INFO_LOG(VIDEO, "GL_VENDOR: %s\n", glGetString(GL_VENDOR));
+ INFO_LOG(VIDEO, "GL_RENDERER: %s\n", glGetString(GL_RENDERER));
+ INFO_LOG(VIDEO, "GL_VERSION: %s\n", glGetString(GL_VERSION));
+ INFO_LOG(VIDEO, "GL_EXTENSIONS: %s\n", glGetString(GL_EXTENSIONS));
window_handle = (void *)GLWin.win;
return true;
}
diff --git a/Source/Core/DolphinWX/Src/GLInterface/EGL.h b/Source/Core/DolphinWX/Src/GLInterface/EGL.h
index c4b6a00b6c..fe127fe0ba 100644
--- a/Source/Core/DolphinWX/Src/GLInterface/EGL.h
+++ b/Source/Core/DolphinWX/Src/GLInterface/EGL.h
@@ -34,6 +34,7 @@ private:
cX11Window XWindow;
public:
friend class cX11Window;
+ void SwapInterval(int Interval);
void Swap();
void UpdateFPSDisplay(const char *Text);
bool Create(void *&window_handle);
diff --git a/Source/Core/DolphinWX/Src/GLInterface/GLX.cpp b/Source/Core/DolphinWX/Src/GLInterface/GLX.cpp
index ef60873531..5745823cbf 100644
--- a/Source/Core/DolphinWX/Src/GLInterface/GLX.cpp
+++ b/Source/Core/DolphinWX/Src/GLInterface/GLX.cpp
@@ -27,6 +27,15 @@ void cInterfaceGLX::UpdateFPSDisplay(const char *text)
{
XStoreName(GLWin.dpy, GLWin.win, text);
}
+
+void cInterfaceGLX::SwapInterval(int Interval)
+{
+ if (glXSwapIntervalSGI)
+ glXSwapIntervalSGI(Interval);
+ else
+ ERROR_LOG(VIDEO, "No support for SwapInterval (framerate clamped to monitor refresh rate).");
+}
+
void cInterfaceGLX::Swap()
{
glXSwapBuffers(GLWin.dpy, GLWin.win);
diff --git a/Source/Core/DolphinWX/Src/GLInterface/GLX.h b/Source/Core/DolphinWX/Src/GLInterface/GLX.h
index 73a6690ec5..83bb14a507 100644
--- a/Source/Core/DolphinWX/Src/GLInterface/GLX.h
+++ b/Source/Core/DolphinWX/Src/GLInterface/GLX.h
@@ -31,6 +31,7 @@ private:
cX11Window XWindow;
public:
friend class cX11Window;
+ void SwapInterval(int Interval);
void Swap();
void UpdateFPSDisplay(const char *Text);
bool Create(void *&window_handle);
diff --git a/Source/Core/DolphinWX/Src/GLInterface/InterfaceBase.h b/Source/Core/DolphinWX/Src/GLInterface/InterfaceBase.h
index 3e4f10fcd4..c2d1ffc54b 100644
--- a/Source/Core/DolphinWX/Src/GLInterface/InterfaceBase.h
+++ b/Source/Core/DolphinWX/Src/GLInterface/InterfaceBase.h
@@ -29,6 +29,7 @@ public:
virtual bool MakeCurrent() = 0;
virtual void Shutdown() = 0;
+ virtual void SwapInterval(int Interval) { }
virtual u32 GetBackBufferWidth() { return s_backbuffer_width; }
virtual u32 GetBackBufferHeight() { return s_backbuffer_height; }
virtual void SetBackBufferDimensions(u32 W, u32 H) {s_backbuffer_width = W; s_backbuffer_height = H; }
diff --git a/Source/Core/DolphinWX/Src/GLInterface/WGL.cpp b/Source/Core/DolphinWX/Src/GLInterface/WGL.cpp
index c97cb48bdf..ce1bb3d946 100644
--- a/Source/Core/DolphinWX/Src/GLInterface/WGL.cpp
+++ b/Source/Core/DolphinWX/Src/GLInterface/WGL.cpp
@@ -27,6 +27,13 @@
static HDC hDC = NULL; // Private GDI Device Context
static HGLRC hRC = NULL; // Permanent Rendering Context
+void cInterfaceWGL::SwapInterval(int Interval)
+{
+ if (WGLEW_EXT_swap_control)
+ wglSwapIntervalEXT(Interval);
+ else
+ ERROR_LOG(VIDEO, "No support for SwapInterval (framerate clamped to monitor refresh rate).");
+}
void cInterfaceWGL::Swap()
{
SwapBuffers(hDC);
diff --git a/Source/Core/DolphinWX/Src/GLInterface/WGL.h b/Source/Core/DolphinWX/Src/GLInterface/WGL.h
index 184ddd475f..18b8b2afb0 100644
--- a/Source/Core/DolphinWX/Src/GLInterface/WGL.h
+++ b/Source/Core/DolphinWX/Src/GLInterface/WGL.h
@@ -28,6 +28,7 @@
class cInterfaceWGL : public cInterfaceBase
{
public:
+ void SwapInterval(int Interval);
void Swap();
void UpdateFPSDisplay(const char *Text);
bool Create(void *&window_handle);
diff --git a/Source/Core/DolphinWX/Src/GLInterface/WX.cpp b/Source/Core/DolphinWX/Src/GLInterface/WX.cpp
index d5415c8ed9..16de6369a7 100644
--- a/Source/Core/DolphinWX/Src/GLInterface/WX.cpp
+++ b/Source/Core/DolphinWX/Src/GLInterface/WX.cpp
@@ -23,6 +23,19 @@
#include "../GLInterface.h"
#include "WX.h"
+void cInterfaceWX::SwapInterval(int Interval)
+{
+ // WX interface only used on Apple
+#ifdef __APPLE__
+#if defined USE_WX && USE_WX
+ NSOpenGLContext *ctx = GLWin.glCtxt->GetWXGLContext();
+#else
+ NSOpenGLContext *ctx = GLWin.cocoaCtx;
+#endif
+ [ctx setValues: &Interval forParameter: NSOpenGLCPSwapInterval];
+#endif
+}
+
void cInterfaceWX::Swap()
{
GLWin.glCanvas->SwapBuffers();
diff --git a/Source/Core/DolphinWX/Src/GLInterface/WX.h b/Source/Core/DolphinWX/Src/GLInterface/WX.h
index 7772f864e5..82304942ea 100644
--- a/Source/Core/DolphinWX/Src/GLInterface/WX.h
+++ b/Source/Core/DolphinWX/Src/GLInterface/WX.h
@@ -35,6 +35,7 @@
class cInterfaceWX : public cInterfaceBase
{
public:
+ void SwapInterval(int Interval);
void Swap();
void UpdateFPSDisplay(const char *Text);
bool Create(void *&window_handle);
diff --git a/Source/Core/DolphinWX/Src/GameListCtrl.cpp b/Source/Core/DolphinWX/Src/GameListCtrl.cpp
index 2312d6afa3..51b5bb2554 100644
--- a/Source/Core/DolphinWX/Src/GameListCtrl.cpp
+++ b/Source/Core/DolphinWX/Src/GameListCtrl.cpp
@@ -94,6 +94,13 @@ static int CompareGameListItems(const GameListItem* iso1, const GameListItem* is
switch(sortData)
{
case CGameListCtrl::COLUMN_TITLE:
+ if (!strcasecmp(iso1->GetName(indexOne).c_str(),iso2->GetName(indexOther).c_str()))
+ {
+ if (iso1->IsDiscTwo())
+ return 1 * t;
+ else if (iso2->IsDiscTwo())
+ return -1 * t;
+ }
return strcasecmp(iso1->GetName(indexOne).c_str(),
iso2->GetName(indexOther).c_str()) * t;
case CGameListCtrl::COLUMN_NOTES:
diff --git a/Source/Core/DolphinWX/Src/ISOFile.cpp b/Source/Core/DolphinWX/Src/ISOFile.cpp
index 2d4b202272..1e4164b7aa 100644
--- a/Source/Core/DolphinWX/Src/ISOFile.cpp
+++ b/Source/Core/DolphinWX/Src/ISOFile.cpp
@@ -36,7 +36,7 @@
#include "ChunkFile.h"
#include "../resources/no_banner.cpp"
-#define CACHE_REVISION 0x10E
+#define CACHE_REVISION 0x10F
#define DVD_BANNER_WIDTH 96
#define DVD_BANNER_HEIGHT 32
@@ -91,6 +91,7 @@ GameListItem::GameListItem(const std::string& _rFileName)
m_UniqueID = pVolume->GetUniqueID();
m_BlobCompressed = DiscIO::IsCompressedBlob(_rFileName.c_str());
+ m_IsDiscTwo = pVolume->IsDiscTwo();
// check if we can get some infos from the banner file too
DiscIO::IFileSystem* pFileSystem = DiscIO::CreateFileSystem(pVolume);
@@ -235,6 +236,7 @@ void GameListItem::DoState(PointerWrap &p)
p.Do(m_BlobCompressed);
p.Do(m_pImage);
p.Do(m_Platform);
+ p.Do(m_IsDiscTwo);
}
std::string GameListItem::CreateCacheFilename()
diff --git a/Source/Core/DolphinWX/Src/ISOFile.h b/Source/Core/DolphinWX/Src/ISOFile.h
index fe7d3d6c6c..e58dcf7713 100644
--- a/Source/Core/DolphinWX/Src/ISOFile.h
+++ b/Source/Core/DolphinWX/Src/ISOFile.h
@@ -48,6 +48,7 @@ public:
bool IsCompressed() const {return m_BlobCompressed;}
u64 GetFileSize() const {return m_FileSize;}
u64 GetVolumeSize() const {return m_VolumeSize;}
+ bool IsDiscTwo() const {return m_IsDiscTwo;}
#if defined(HAVE_WX) && HAVE_WX
const wxImage& GetImage() const {return m_Image;}
#endif
@@ -87,6 +88,7 @@ private:
bool m_BlobCompressed;
std::vector<u8> m_pImage;
u32 m_ImageSize;
+ bool m_IsDiscTwo;
bool LoadFromCache();
void SaveToCache();
diff --git a/Source/Core/DolphinWX/Src/ISOProperties.cpp b/Source/Core/DolphinWX/Src/ISOProperties.cpp
index f06b3daa8a..6a673b95d1 100644
--- a/Source/Core/DolphinWX/Src/ISOProperties.cpp
+++ b/Source/Core/DolphinWX/Src/ISOProperties.cpp
@@ -315,10 +315,10 @@ void CISOProperties::CreateGUIControls(bool IsWad)
SkipIdle = new wxCheckBox(m_GameConfig, ID_IDLESKIP, _("Enable Idle Skipping"), wxDefaultPosition, wxDefaultSize, wxCHK_3STATE|wxCHK_ALLOW_3RD_STATE_FOR_USER, wxDefaultValidator);
MMU = new wxCheckBox(m_GameConfig, ID_MMU, _("Enable MMU"), wxDefaultPosition, wxDefaultSize, wxCHK_3STATE|wxCHK_ALLOW_3RD_STATE_FOR_USER, wxDefaultValidator);
MMU->SetToolTip(_("Enables the Memory Management Unit, needed for some games. (ON = Compatible, OFF = Fast)"));
- MMUBAT = new wxCheckBox(m_GameConfig, ID_MMUBAT, _("Enable BAT"), wxDefaultPosition, wxDefaultSize, wxCHK_3STATE|wxCHK_ALLOW_3RD_STATE_FOR_USER, wxDefaultValidator);
- MMUBAT->SetToolTip(_("Enables Block Address Translation (BAT); a function of the Memory Management Unit. Accurate to the hardware, but slow to emulate. (ON = Compatible, OFF = Fast)"));
TLBHack = new wxCheckBox(m_GameConfig, ID_TLBHACK, _("MMU Speed Hack"), wxDefaultPosition, wxDefaultSize, wxCHK_3STATE|wxCHK_ALLOW_3RD_STATE_FOR_USER, wxDefaultValidator);
TLBHack->SetToolTip(_("Fast version of the MMU. Does not work for every game."));
+ DCBZOFF = new wxCheckBox(m_GameConfig, ID_DCBZOFF, _("Skip DCBZ clearing"), wxDefaultPosition, wxDefaultSize, wxCHK_3STATE|wxCHK_ALLOW_3RD_STATE_FOR_USER, wxDefaultValidator);
+ DCBZOFF->SetToolTip(_("Bypass the clearing of the data cache by the DCBZ instruction. Usually leave this option disabled."));
VBeam = new wxCheckBox(m_GameConfig, ID_VBEAM, _("Accurate VBeam emulation"), wxDefaultPosition, wxDefaultSize, wxCHK_3STATE|wxCHK_ALLOW_3RD_STATE_FOR_USER, wxDefaultValidator);
VBeam->SetToolTip(_("If the FPS is erratic, this option may help. (ON = Compatible, OFF = Fast)"));
FastDiscSpeed = new wxCheckBox(m_GameConfig, ID_DISCSPEED, _("Speed up Disc Transfer Rate"), wxDefaultPosition, wxDefaultSize, wxCHK_3STATE|wxCHK_ALLOW_3RD_STATE_FOR_USER, wxDefaultValidator);
@@ -364,7 +364,7 @@ void CISOProperties::CreateGUIControls(bool IsWad)
sbCoreOverrides->Add(CPUThread, 0, wxLEFT, 5);
sbCoreOverrides->Add(SkipIdle, 0, wxLEFT, 5);
sbCoreOverrides->Add(MMU, 0, wxLEFT, 5);
- sbCoreOverrides->Add(MMUBAT, 0, wxLEFT, 5);
+ sbCoreOverrides->Add(DCBZOFF, 0, wxLEFT, 5);
sbCoreOverrides->Add(TLBHack, 0, wxLEFT, 5);
sbCoreOverrides->Add(VBeam, 0, wxLEFT, 5);
sbCoreOverrides->Add(FastDiscSpeed, 0, wxLEFT, 5);
@@ -930,16 +930,16 @@ void CISOProperties::LoadGameConfig()
else
MMU->Set3StateValue(wxCHK_UNDETERMINED);
- if (GameIni.Get("Core", "BAT", &bTemp))
- MMUBAT->Set3StateValue((wxCheckBoxState)bTemp);
- else
- MMUBAT->Set3StateValue(wxCHK_UNDETERMINED);
-
if (GameIni.Get("Core", "TLBHack", &bTemp))
TLBHack->Set3StateValue((wxCheckBoxState)bTemp);
else
TLBHack->Set3StateValue(wxCHK_UNDETERMINED);
+ if (GameIni.Get("Core", "DCBZ", &bTemp))
+ DCBZOFF->Set3StateValue((wxCheckBoxState)bTemp);
+ else
+ DCBZOFF->Set3StateValue(wxCHK_UNDETERMINED);
+
if (GameIni.Get("Core", "VBeam", &bTemp))
VBeam->Set3StateValue((wxCheckBoxState)bTemp);
else
@@ -999,7 +999,6 @@ void CISOProperties::LoadGameConfig()
if (!sTemp.empty())
{
EmuIssues->SetValue(wxString(sTemp.c_str(), *wxConvCurrent));
- bRefreshList = true;
}
EmuIssues->Enable(EmuState->GetSelection() != 0);
@@ -1025,16 +1024,16 @@ bool CISOProperties::SaveGameConfig()
else
GameIni.Set("Core", "MMU", MMU->Get3StateValue());
- if (MMUBAT->Get3StateValue() == wxCHK_UNDETERMINED)
- GameIni.DeleteKey("Core", "BAT");
- else
- GameIni.Set("Core", "BAT", MMUBAT->Get3StateValue());
-
if (TLBHack->Get3StateValue() == wxCHK_UNDETERMINED)
GameIni.DeleteKey("Core", "TLBHack");
else
GameIni.Set("Core", "TLBHack", TLBHack->Get3StateValue());
+ if (DCBZOFF->Get3StateValue() == wxCHK_UNDETERMINED)
+ GameIni.DeleteKey("Core", "DCBZ");
+ else
+ GameIni.Set("Core", "DCBZ", DCBZOFF->Get3StateValue());
+
if (VBeam->Get3StateValue() == wxCHK_UNDETERMINED)
GameIni.DeleteKey("Core", "VBeam");
else
@@ -1085,6 +1084,11 @@ bool CISOProperties::SaveGameConfig()
GameIni.Set("Video", "PH_ZFar", PHack_Data.PHZFar);
GameIni.Set("EmuState", "EmulationStateId", EmuState->GetSelection());
+
+ std::string sTemp;
+ GameIni.Get("EmuState","EmulationIssues", &sTemp);
+ if (EmuIssues->GetValue() != sTemp)
+ bRefreshList = true;
GameIni.Set("EmuState", "EmulationIssues", (const char*)EmuIssues->GetValue().mb_str(*wxConvCurrent));
PatchList_Save();
diff --git a/Source/Core/DolphinWX/Src/ISOProperties.h b/Source/Core/DolphinWX/Src/ISOProperties.h
index 9d71e675e2..4f03130ba7 100644
--- a/Source/Core/DolphinWX/Src/ISOProperties.h
+++ b/Source/Core/DolphinWX/Src/ISOProperties.h
@@ -69,7 +69,7 @@ private:
DECLARE_EVENT_TABLE();
// Core
- wxCheckBox *CPUThread, *SkipIdle, *MMU, *MMUBAT, *TLBHack;
+ wxCheckBox *CPUThread, *SkipIdle, *MMU, *DCBZOFF, *TLBHack;
wxCheckBox *VBeam, *FastDiscSpeed, *BlockMerging, *DSPHLE;
// Wii
wxCheckBox *EnableWideScreen, *DisableWiimoteSpeaker;
@@ -127,7 +127,7 @@ private:
ID_USEDUALCORE,
ID_IDLESKIP,
ID_MMU,
- ID_MMUBAT,
+ ID_DCBZOFF,
ID_TLBHACK,
ID_VBEAM,
ID_DISCSPEED,
diff --git a/Source/Core/DolphinWX/Src/X11Utils.cpp b/Source/Core/DolphinWX/Src/X11Utils.cpp
index da21c41cb2..f032f81e96 100644
--- a/Source/Core/DolphinWX/Src/X11Utils.cpp
+++ b/Source/Core/DolphinWX/Src/X11Utils.cpp
@@ -124,12 +124,12 @@ void EWMH_Fullscreen(Display *dpy, int action)
#if defined(HAVE_WX) && HAVE_WX
Window XWindowFromHandle(void *Handle)
{
- return GDK_WINDOW_XID(GTK_WIDGET(Handle)->window);
+ return GDK_WINDOW_XID(gtk_widget_get_window(GTK_WIDGET(Handle)));
}
Display *XDisplayFromHandle(void *Handle)
{
- return GDK_WINDOW_XDISPLAY(GTK_WIDGET(Handle)->window);
+ return GDK_WINDOW_XDISPLAY(gtk_widget_get_window(GTK_WIDGET(Handle)));
}
#endif
diff --git a/Source/Core/InputCommon/Src/ControllerEmu.cpp b/Source/Core/InputCommon/Src/ControllerEmu.cpp
index 9065888d7d..2e6ad10617 100644
--- a/Source/Core/InputCommon/Src/ControllerEmu.cpp
+++ b/Source/Core/InputCommon/Src/ControllerEmu.cpp
@@ -295,6 +295,7 @@ ControllerEmu::Tilt::Tilt(const char* const _name)
settings.push_back(new Setting(_trans("Dead Zone"), 0, 0, 50));
settings.push_back(new Setting(_trans("Circle Stick"), 0));
+ settings.push_back(new Setting(_trans("Angle"), 0.9f, 0, 180));
}
ControllerEmu::Cursor::Cursor(const char* const _name)
diff --git a/Source/Core/InputCommon/Src/ControllerEmu.h b/Source/Core/InputCommon/Src/ControllerEmu.h
index 888e0c7fa9..6084a610a1 100644
--- a/Source/Core/InputCommon/Src/ControllerEmu.h
+++ b/Source/Core/InputCommon/Src/ControllerEmu.h
@@ -307,6 +307,7 @@ public:
ControlState deadzone = settings[0]->value;
ControlState circle = settings[1]->value;
+ auto const angle = settings[2]->value / 1.8f;
ControlState m = controls[4]->control_ref->State();
// modifier code
@@ -363,8 +364,8 @@ public:
m_tilt[1] = std::max(m_tilt[1] - 0.1f, yy);
}
- *y = C(m_tilt[1] * range + base);
- *x = C(m_tilt[0] * range + base);
+ *y = C(m_tilt[1] * angle * range + base);
+ *x = C(m_tilt[0] * angle * range + base);
}
private:
float m_tilt[2];
diff --git a/Source/Core/VideoCommon/Src/BPStructs.cpp b/Source/Core/VideoCommon/Src/BPStructs.cpp
index 9ba2afbbd1..af263235cd 100644
--- a/Source/Core/VideoCommon/Src/BPStructs.cpp
+++ b/Source/Core/VideoCommon/Src/BPStructs.cpp
@@ -520,7 +520,7 @@ void BPWritten(const BPCmd& bp)
for (u32 i = 0; i < tmem_cfg.preload_tile_info.count; ++i)
{
if (tmem_addr_even + TMEM_LINE_SIZE > TMEM_SIZE ||
- tmem_addr_even + TMEM_LINE_SIZE > TMEM_SIZE)
+ tmem_addr_odd + TMEM_LINE_SIZE > TMEM_SIZE)
break;
memcpy(texMem + tmem_addr_even, src_ptr, TMEM_LINE_SIZE);
diff --git a/Source/Core/VideoCommon/Src/PixelShaderGen.cpp b/Source/Core/VideoCommon/Src/PixelShaderGen.cpp
index c1ebdbcc89..448501aad0 100644
--- a/Source/Core/VideoCommon/Src/PixelShaderGen.cpp
+++ b/Source/Core/VideoCommon/Src/PixelShaderGen.cpp
@@ -158,10 +158,11 @@ void GetPixelShaderId(PIXELSHADERUID *uid, DSTALPHA_MODE dstAlphaMode, u32 compo
if (dstAlphaMode != DSTALPHA_ALPHA_PASS)
{
+ ptr[0] |= bpmem.fog.c_proj_fsel.fsel << 13; // 3
if (bpmem.fog.c_proj_fsel.fsel != 0)
{
- ptr[0] |= bpmem.fog.c_proj_fsel.proj << 13; // 1
- ptr[0] |= bpmem.fogRange.Base.Enabled << 14; // 1
+ ptr[0] |= bpmem.fog.c_proj_fsel.proj << 16; // 1
+ ptr[0] |= bpmem.fogRange.Base.Enabled << 17; // 1
}
}
diff --git a/Source/Core/VideoCommon/Src/Statistics.h b/Source/Core/VideoCommon/Src/Statistics.h
index 7238398b42..e173bfc682 100644
--- a/Source/Core/VideoCommon/Src/Statistics.h
+++ b/Source/Core/VideoCommon/Src/Statistics.h
@@ -43,7 +43,7 @@ struct Statistics
int numUniquePixelShaders;
- float proj_0, proj_1, proj_2, proj_3, proj_4, proj_5, proj_6;
+ float proj_0, proj_1, proj_2, proj_3, proj_4, proj_5;
float gproj_0, gproj_1, gproj_2, gproj_3, gproj_4, gproj_5;
float gproj_6, gproj_7, gproj_8, gproj_9, gproj_10, gproj_11, gproj_12, gproj_13, gproj_14, gproj_15;
diff --git a/Source/Core/VideoCommon/Src/VertexShaderManager.cpp b/Source/Core/VideoCommon/Src/VertexShaderManager.cpp
index 84340c6b98..1dce567b0d 100644
--- a/Source/Core/VideoCommon/Src/VertexShaderManager.cpp
+++ b/Source/Core/VideoCommon/Src/VertexShaderManager.cpp
@@ -350,26 +350,28 @@ void VertexShaderManager::SetConstants()
if (bProjectionChanged)
{
bProjectionChanged = false;
+
+ float *rawProjection = xfregs.projection.rawProjection;
- if (xfregs.rawProjection[6] == 0)
+ switch(xfregs.projection.type)
{
- // Perspective
+ case GX_PERSPECTIVE:
- g_fProjectionMatrix[0] = xfregs.rawProjection[0] * g_ActiveConfig.fAspectRatioHackW;
+ g_fProjectionMatrix[0] = rawProjection[0] * g_ActiveConfig.fAspectRatioHackW;
g_fProjectionMatrix[1] = 0.0f;
- g_fProjectionMatrix[2] = xfregs.rawProjection[1];
+ g_fProjectionMatrix[2] = 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[5] = rawProjection[2] * g_ActiveConfig.fAspectRatioHackH;
+ g_fProjectionMatrix[6] = 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[10] = rawProjection[4];
- g_fProjectionMatrix[11] = xfregs.rawProjection[5];
+ g_fProjectionMatrix[11] = rawProjection[5];
g_fProjectionMatrix[12] = 0.0f;
g_fProjectionMatrix[13] = 0.0f;
@@ -394,24 +396,24 @@ 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
- {
- // Orthographic Projection
- g_fProjectionMatrix[0] = xfregs.rawProjection[0];
+ break;
+
+ case GX_ORTHOGRAPHIC:
+
+ g_fProjectionMatrix[0] = rawProjection[0];
g_fProjectionMatrix[1] = 0.0f;
g_fProjectionMatrix[2] = 0.0f;
- g_fProjectionMatrix[3] = xfregs.rawProjection[1];
+ g_fProjectionMatrix[3] = rawProjection[1];
g_fProjectionMatrix[4] = 0.0f;
- g_fProjectionMatrix[5] = xfregs.rawProjection[2];
+ g_fProjectionMatrix[5] = rawProjection[2];
g_fProjectionMatrix[6] = 0.0f;
- g_fProjectionMatrix[7] = xfregs.rawProjection[3];
+ g_fProjectionMatrix[7] = rawProjection[3];
g_fProjectionMatrix[8] = 0.0f;
g_fProjectionMatrix[9] = 0.0f;
- g_fProjectionMatrix[10] = (g_ProjHack1.value + xfregs.rawProjection[4]) * ((g_ProjHack1.sign == 0) ? 1.0f : g_ProjHack1.sign);
- g_fProjectionMatrix[11] = (g_ProjHack2.value + xfregs.rawProjection[5]) * ((g_ProjHack2.sign == 0) ? 1.0f : g_ProjHack2.sign);
+ g_fProjectionMatrix[10] = (g_ProjHack1.value + rawProjection[4]) * ((g_ProjHack1.sign == 0) ? 1.0f : g_ProjHack1.sign);
+ g_fProjectionMatrix[11] = (g_ProjHack2.value + rawProjection[5]) * ((g_ProjHack2.sign == 0) ? 1.0f : g_ProjHack2.sign);
g_fProjectionMatrix[12] = 0.0f;
g_fProjectionMatrix[13] = 0.0f;
@@ -424,7 +426,7 @@ void VertexShaderManager::SetConstants()
*/
g_fProjectionMatrix[14] = 0.0f;
- g_fProjectionMatrix[15] = (g_ProjHack3 && xfregs.rawProjection[0] == 2.0f ? 0.0f : 1.0f); //causes either the efb copy or bloom layer not to show if proj hack enabled
+ g_fProjectionMatrix[15] = (g_ProjHack3 && rawProjection[0] == 2.0f ? 0.0f : 1.0f); //causes either the efb copy or bloom layer not to show if proj hack enabled
SETSTAT_FT(stats.g2proj_0, g_fProjectionMatrix[0]);
SETSTAT_FT(stats.g2proj_1, g_fProjectionMatrix[1]);
@@ -442,18 +444,21 @@ void VertexShaderManager::SetConstants()
SETSTAT_FT(stats.g2proj_13, g_fProjectionMatrix[13]);
SETSTAT_FT(stats.g2proj_14, g_fProjectionMatrix[14]);
SETSTAT_FT(stats.g2proj_15, g_fProjectionMatrix[15]);
- SETSTAT_FT(stats.proj_0, xfregs.rawProjection[0]);
- SETSTAT_FT(stats.proj_1, xfregs.rawProjection[1]);
- SETSTAT_FT(stats.proj_2, xfregs.rawProjection[2]);
- SETSTAT_FT(stats.proj_3, xfregs.rawProjection[3]);
- SETSTAT_FT(stats.proj_4, xfregs.rawProjection[4]);
- SETSTAT_FT(stats.proj_5, xfregs.rawProjection[5]);
- SETSTAT_FT(stats.proj_6, xfregs.rawProjection[6]);
+ SETSTAT_FT(stats.proj_0, rawProjection[0]);
+ SETSTAT_FT(stats.proj_1, rawProjection[1]);
+ SETSTAT_FT(stats.proj_2, rawProjection[2]);
+ SETSTAT_FT(stats.proj_3, rawProjection[3]);
+ SETSTAT_FT(stats.proj_4, rawProjection[4]);
+ SETSTAT_FT(stats.proj_5, rawProjection[5]);
+ break;
+
+ default:
+ ERROR_LOG(VIDEO, "unknown projection type: %d", xfregs.projection.type);
}
- 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", rawProjection[0], rawProjection[1], rawProjection[2], rawProjection[3], rawProjection[4], rawProjection[5]);
- if ((g_ActiveConfig.bFreeLook || g_ActiveConfig.bAnaglyphStereo ) && xfregs.rawProjection[6] == 0)
+ if ((g_ActiveConfig.bFreeLook || g_ActiveConfig.bAnaglyphStereo ) && xfregs.projection.type == GX_PERSPECTIVE)
{
Matrix44 mtxA;
Matrix44 mtxB;
diff --git a/Source/Core/VideoCommon/Src/XFMemory.h b/Source/Core/VideoCommon/Src/XFMemory.h
index ee3c3b0fdc..fc199b8c32 100644
--- a/Source/Core/VideoCommon/Src/XFMemory.h
+++ b/Source/Core/VideoCommon/Src/XFMemory.h
@@ -61,6 +61,9 @@
#define LIGHTATTN_NONE 2
#define LIGHTATTN_DIR 3
+#define GX_PERSPECTIVE 0
+#define GX_ORTHOGRAPHIC 1
+
#define XFMEM_SIZE 0x8000
#define XFMEM_POSMATRICES 0x000
#define XFMEM_POSMATRICES_END 0x100
@@ -235,6 +238,12 @@ struct Viewport
float farZ;
};
+struct Projection
+{
+ float rawProjection[6];
+ u32 type; // only GX_PERSPECTIVE or GX_ORTHOGRAPHIC are allowed
+};
+
struct XFRegisters
{
u32 error; // 0x1000
@@ -257,10 +266,10 @@ struct XFRegisters
u32 unk5; // 0x1015
u32 unk6; // 0x1016
u32 unk7; // 0x1017
- u32 MatrixIndexA; // 0x1018
- u32 MatrixIndexB; // 0x1019
+ u32 MatrixIndexA; // 0x1018
+ u32 MatrixIndexB; // 0x1019
Viewport viewport; // 0x101a - 0x101f
- float rawProjection[7]; // 0x1020 - 0x1026
+ Projection projection; // 0x1020 - 0x1026
u32 unk8[24]; // 0x1027 - 0x103e
NumTexGen numTexGen; // 0x103f
TexMtxInfo texMtxInfo[8]; // 0x1040 - 0x1047