Merge branch 'master' into wii-usb

This commit is contained in:
Matthew Parlane
2012-12-24 12:58:15 +13:00
218 changed files with 2286 additions and 1354 deletions
@@ -87,6 +87,13 @@ bool CoreAudioSound::Start()
return false;
}
err = AudioUnitSetParameter(audioUnit,
kHALOutputParam_Volume,
kAudioUnitParameterFlag_Output, 0,
m_volume / 100., 0);
if (err != noErr)
ERROR_LOG(AUDIO, "error setting volume");
err = AudioUnitInitialize(audioUnit);
if (err != noErr) {
ERROR_LOG(AUDIO, "error initializing audiounit");
@@ -105,6 +112,7 @@ bool CoreAudioSound::Start()
void CoreAudioSound::SetVolume(int volume)
{
OSStatus err;
m_volume = volume;
err = AudioUnitSetParameter(audioUnit,
kHALOutputParam_Volume,
@@ -47,6 +47,7 @@ public:
private:
AudioUnit audioUnit;
int m_volume;
static OSStatus callback(void *inRefCon,
AudioUnitRenderActionFlags *ioActionFlags,
+1 -2
View File
@@ -123,7 +123,6 @@ void OpenALStream::SoundLoop()
{
Common::SetCurrentThreadName("Audio thread - openal");
ALenum err;
u32 ulFrequency = m_mixer->GetSampleRate();
memset(uiBuffers, 0, OAL_NUM_BUFFERS * sizeof(ALuint));
@@ -144,8 +143,8 @@ void OpenALStream::SoundLoop()
// Set the default sound volume as saved in the config file.
alSourcef(uiSource, AL_GAIN, fVolume);
err = alGetError();
// TODO: Error handling
//ALenum err = alGetError();
ALint iBuffersFilled = 0;
ALint iBuffersProcessed = 0;
-2
View File
@@ -173,9 +173,7 @@ void CPUInfo::Detect()
if (max_ex_fn >= 0x80000001) {
// Check for more features.
__cpuid(cpu_id, 0x80000001);
bool cmp_legacy = false;
if (cpu_id[2] & 1) bLAHFSAHF64 = true;
if (cpu_id[2] & 2) cmp_legacy = true; //wtf is this?
if ((cpu_id[3] >> 29) & 1) bLongMode = true;
}
+1 -1
View File
@@ -31,7 +31,7 @@ const int lut3to8[] = { 0x00,0x24,0x48,0x6D,0x91,0xB6,0xDA,0xFF };
u32 Decode5A3(u16 val)
{
const u32 bg_color = 0xFFFFFFFF;
const u32 bg_color = 0x00000000;
int r, g, b, a;
+1
View File
@@ -128,6 +128,7 @@
#define WII_EUR_SETTING "setting-eur.txt"
#define WII_USA_SETTING "setting-usa.txt"
#define WII_JAP_SETTING "setting-jpn.txt"
#define WII_KOR_SETTING "setting-kor.txt"
#define GECKO_CODE_HANDLER "codehandler.bin"
+1 -1
View File
@@ -30,7 +30,7 @@ public:
virtual void step() {}
virtual void runToBreakpoint() {}
virtual void breakNow() {}
virtual void insertBLR(unsigned int /*address*/, unsigned int) {}
virtual void insertBLR(unsigned int /*address*/, unsigned int /*value*/) {}
virtual void showJitResults(unsigned int /*address*/) {};
virtual int getColor(unsigned int /*address*/){return 0xFFFFFFFF;}
virtual std::string getDescription(unsigned int /*address*/) = 0;
+9 -3
View File
@@ -299,7 +299,7 @@ bool Copy(const std::string &srcFilename, const std::string &destFilename)
ERROR_LOG(COMMON,
"Copy: failed reading from source, %s --> %s: %s",
srcFilename.c_str(), destFilename.c_str(), GetLastErrorMsg());
return false;
goto bail;
}
}
@@ -310,13 +310,19 @@ bool Copy(const std::string &srcFilename, const std::string &destFilename)
ERROR_LOG(COMMON,
"Copy: failed writing to output, %s --> %s: %s",
srcFilename.c_str(), destFilename.c_str(), GetLastErrorMsg());
return false;
goto bail;
}
}
// close flushs
fclose(input);
fclose(output);
return true;
bail:
if (input)
fclose(input);
if (output)
fclose(output);
return false;
#endif
}
@@ -649,7 +655,7 @@ std::string &GetUserPath(const unsigned int DirIDX, const std::string &newPath)
if (File::Exists(ROOT_DIR DIR_SEP USERDATA_DIR))
paths[D_USER_IDX] = ROOT_DIR DIR_SEP USERDATA_DIR DIR_SEP;
else
paths[D_USER_IDX] = std::string(getenv("HOME")) + DIR_SEP DOLPHIN_DATA_DIR DIR_SEP;
paths[D_USER_IDX] = std::string(getenv("HOME") ? getenv("HOME") : getenv("PWD")) + DIR_SEP DOLPHIN_DATA_DIR DIR_SEP;
#endif
INFO_LOG(COMMON, "GetUserPath: Setting user directory to %s:", paths[D_USER_IDX].c_str());
-41
View File
@@ -1,41 +0,0 @@
// Copyright (C) 2003 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#ifndef _SETUP_H_
#define _SETUP_H_
// -----------------------------------------------------------------------------------------------------
// File description:
// Compilation settings. I avoid placing this in Common.h or some place where lots of files needs
// to be rebuilt if any of these settings are changed. I'd rather have it in as few files as possible.
// This file can be kept on the ignore list in your SVN program. It allows local optional settings
// depending on what works on your computer.
// -----------------------------------------------------------------------------------------------------
// -----------------------------------------------------------------------------------------------------
// Settings:
// This may remove sound artifacts in Wario Land Shake It and perhaps other games
//#define SETUP_AVOID_SOUND_ARTIFACTS
// Build with playback rerecording options
//#define RERECORDING
// -----------------------------------------------------------------------------------------------------
#endif // _SETUP_H_
-1
View File
@@ -15,7 +15,6 @@
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#include "Setup.h"
#include "Thread.h"
#include "Common.h"
-6
View File
@@ -97,12 +97,6 @@ void Timer::AddTimeDifference()
m_StartTime += GetTimeDifference();
}
// Wind back the starting time to a custom time
void Timer::WindBackStartingTime(u64 WindBack)
{
m_StartTime += WindBack;
}
// Get the time elapsed since the Start()
u64 Timer::GetTimeElapsed()
{
-1
View File
@@ -35,7 +35,6 @@ public:
// The time difference is always returned in milliseconds, regardless of alternative internal representation
u64 GetTimeDifference();
void AddTimeDifference();
void WindBackStartingTime(u64 WindBack);
static void IncreaseResolution();
static void RestoreResolution();
+1 -1
View File
@@ -41,7 +41,7 @@ static bool IsGteVista()
VER_SET_CONDITION(dwlConditionMask, VER_MAJORVERSION, VER_GREATER_EQUAL);
return VerifyVersionInfo(&osvi, VER_MAJORVERSION, dwlConditionMask);
return VerifyVersionInfo(&osvi, VER_MAJORVERSION, dwlConditionMask) != FALSE;
}
#endif
-6
View File
@@ -31,12 +31,9 @@ bool DisassembleMov(const unsigned char *codePtr, InstructionInfo &info, int acc
info.hasImmediate = false;
info.isMemoryWrite = false;
int addressSize = 8;
u8 modRMbyte = 0;
u8 sibByte = 0;
bool hasModRM = false;
bool hasSIBbyte = false;
bool hasDisplacement = false;
int displacementSize = 0;
@@ -47,7 +44,6 @@ bool DisassembleMov(const unsigned char *codePtr, InstructionInfo &info, int acc
}
else if (*codePtr == 0x67)
{
addressSize = 4;
codePtr++;
}
@@ -113,7 +109,6 @@ bool DisassembleMov(const unsigned char *codePtr, InstructionInfo &info, int acc
info.otherReg = (sibByte & 7);
if (rex & 2) info.scaledReg += 8;
if (rex & 1) info.otherReg += 8;
hasSIBbyte = true;
}
else
{
@@ -122,7 +117,6 @@ bool DisassembleMov(const unsigned char *codePtr, InstructionInfo &info, int acc
}
if (mrm.mod == 1 || mrm.mod == 2)
{
hasDisplacement = true;
if (mrm.mod == 1)
displacementSize = 1;
else
-2
View File
@@ -870,7 +870,6 @@ void XEmitter::BTC(int bits, OpArg dest, OpArg index) {WriteBitTest(bits, dest,
//shift can be either imm8 or cl
void XEmitter::SHRD(int bits, OpArg dest, OpArg src, OpArg shift)
{
bool writeImm = false;
if (dest.IsImm())
{
_assert_msg_(DYNA_REC, 0, "SHRD - can't use imms as destination");
@@ -901,7 +900,6 @@ void XEmitter::SHRD(int bits, OpArg dest, OpArg src, OpArg shift)
void XEmitter::SHLD(int bits, OpArg dest, OpArg src, OpArg shift)
{
bool writeImm = false;
if (dest.IsImm())
{
_assert_msg_(DYNA_REC, 0, "SHLD - can't use imms as destination");
-1
View File
@@ -5,7 +5,6 @@ set(SRCS Src/ActionReplay.cpp
Src/Console.cpp
Src/Core.cpp
Src/CoreParameter.cpp
Src/CoreRerecording.cpp
Src/CoreTiming.cpp
Src/DSPEmulator.cpp
Src/GeckoCodeConfig.cpp
+5 -2
View File
@@ -207,7 +207,6 @@
<ClCompile Include="Src\Console.cpp" />
<ClCompile Include="Src\Core.cpp" />
<ClCompile Include="Src\CoreParameter.cpp" />
<ClCompile Include="Src\CoreRerecording.cpp" />
<ClCompile Include="Src\CoreTiming.cpp" />
<ClCompile Include="Src\Debugger\Debugger_SymbolMap.cpp" />
<ClCompile Include="Src\Debugger\Dump.cpp" />
@@ -386,7 +385,11 @@
<ClCompile Include="Src\PowerPC\PPCTables.cpp" />
<ClCompile Include="Src\PowerPC\Profiler.cpp" />
<ClCompile Include="Src\PowerPC\SignatureDB.cpp" />
<ClCompile Include="Src\State.cpp" />
<ClCompile Include="Src\State.cpp">
<OpenMPSupport Condition="'$(Configuration)|$(Platform)'=='DebugFast|Win32'">false</OpenMPSupport>
<OpenMPSupport Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">false</OpenMPSupport>
<OpenMPSupport Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</OpenMPSupport>
</ClCompile>
<ClCompile Include="Src\stdafx.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</PrecompiledHeader>
-2
View File
@@ -285,7 +285,6 @@ bool RunCode(const ARCode &arcode)
// used for conditional codes
int skip_count = 0;
u32 addr_last = 0;
u32 val_last = 0;
current_code = &arcode;
@@ -394,7 +393,6 @@ bool RunCode(const ARCode &arcode)
{
LogInfo("ZCode: Memory Copy");
doMemoryCopy = true;
addr_last = addr;
val_last = data;
}
else
+3 -1
View File
@@ -187,8 +187,10 @@ bool CBoot::SetupWiiMemory(unsigned int _CountryCode)
switch((DiscIO::IVolume::ECountry)_CountryCode)
{
case DiscIO::IVolume::COUNTRY_KOREA:
region_filename = File::GetSysDirectory() + WII_SYS_DIR + DIR_SEP + WII_KOR_SETTING;
break;
case DiscIO::IVolume::COUNTRY_TAIWAN:
// TODO: Determine if Korea / Taiwan have their own specific settings.
// TODO: Determine if Taiwan has their own specific settings.
case DiscIO::IVolume::COUNTRY_JAPAN:
region_filename = File::GetSysDirectory() + WII_SYS_DIR + DIR_SEP + WII_JAP_SETTING;
break;
+1 -2
View File
@@ -118,13 +118,12 @@ bool BootCore(const std::string& _rFilename)
if (Movie::IsPlayingInput() && Movie::IsConfigSaved())
{
Movie::Init();
StartUp.bCPUThread = Movie::IsDualCore();
StartUp.bSkipIdle = Movie::IsSkipIdle();
StartUp.bDSPHLE = Movie::IsDSPHLE();
StartUp.bProgressive = Movie::IsProgressive();
StartUp.bFastDiscSpeed = Movie::IsFastDiscSpeed();
if (Movie::IsUsingMemcard() && Movie::IsBlankMemcard())
if (Movie::IsUsingMemcard() && Movie::IsStartingFromClearSave() && !StartUp.bWii)
{
if (File::Exists("Movie.raw"))
File::Delete("Movie.raw");
+23 -5
View File
@@ -131,6 +131,7 @@ void SConfig::SaveSettings()
// General
ini.Set("General", "LastFilename", m_LastFilename);
ini.Set("General", "ShowLag", m_ShowLag);
// ISO folders
// clear removed folders
@@ -155,10 +156,12 @@ void SConfig::SaveSettings()
ini.Set("General", "RecursiveGCMPaths", m_RecursiveISOFolder);
ini.Set("General", "NANDRoot", m_NANDPath);
ini.Set("General", "WirelessMac", m_WirelessMac);
// Interface
ini.Set("Interface", "ConfirmStop", m_LocalCoreStartupParameter.bConfirmStop);
ini.Set("Interface", "UsePanicHandlers", m_LocalCoreStartupParameter.bUsePanicHandlers);
ini.Set("Interface", "OnScreenDisplayMessages", m_LocalCoreStartupParameter.bOnScreenDisplayMessages);
ini.Set("Interface", "HideCursor", m_LocalCoreStartupParameter.bHideCursor);
ini.Set("Interface", "AutoHideCursor", m_LocalCoreStartupParameter.bAutoHideCursor);
ini.Set("Interface", "Theme", m_LocalCoreStartupParameter.iTheme);
@@ -208,6 +211,8 @@ void SConfig::SaveSettings()
ini.Set("GameList", "ListKorea", m_ListKorea);
ini.Set("GameList", "ListTaiwan", m_ListTaiwan);
ini.Set("GameList", "ListUnknown", m_ListUnknown);
ini.Set("GameList", "ListSort", m_ListSort);
ini.Set("GameList", "ListSortSecondary", m_ListSort2);
// Core
ini.Set("Core", "HLE_BS2", m_LocalCoreStartupParameter.bHLE_BS2);
@@ -246,6 +251,10 @@ void SConfig::SaveSettings()
// GFX Backend
ini.Set("Core", "GFXBackend", m_LocalCoreStartupParameter.m_strVideoBackend);
// Movie
ini.Set("Movie", "PauseMovie", m_PauseMovie);
ini.Set("Movie", "Author", m_strMovieAuthor);
ini.Save(File::GetUserPath(F_DOLPHINCONFIG_IDX));
m_SYSCONF->Save();
}
@@ -260,6 +269,7 @@ void SConfig::LoadSettings()
// General
{
ini.Get("General", "LastFilename", &m_LastFilename);
ini.Get("General", "ShowLag", &m_ShowLag, false);
m_ISOFolder.clear();
int numGCMPaths;
@@ -282,12 +292,14 @@ void SConfig::LoadSettings()
m_NANDPath = File::GetUserPath(D_WIIROOT_IDX, m_NANDPath);
DiscIO::cUIDsys::AccessInstance().UpdateLocation();
DiscIO::CSharedContent::AccessInstance().UpdateLocation();
ini.Get("General", "WirelessMac", &m_WirelessMac);
}
{
// Interface
ini.Get("Interface", "ConfirmStop", &m_LocalCoreStartupParameter.bConfirmStop, false);
ini.Get("Interface", "UsePanicHandlers", &m_LocalCoreStartupParameter.bUsePanicHandlers, true);
ini.Get("Interface", "OnScreenDisplayMessages", &m_LocalCoreStartupParameter.bOnScreenDisplayMessages, true);
ini.Get("Interface", "HideCursor", &m_LocalCoreStartupParameter.bHideCursor, false);
ini.Get("Interface", "AutoHideCursor", &m_LocalCoreStartupParameter.bAutoHideCursor, false);
ini.Get("Interface", "Theme", &m_LocalCoreStartupParameter.iTheme, 0);
@@ -334,11 +346,13 @@ void SConfig::LoadSettings()
ini.Get("GameList", "ListPal", &m_ListPal, true);
ini.Get("GameList", "ListUsa", &m_ListUsa, true);
ini.Get("GameList", "ListFrance", &m_ListFrance, true);
ini.Get("GameList", "ListItaly", &m_ListItaly, true);
ini.Get("GameList", "ListKorea", &m_ListKorea, true);
ini.Get("GameList", "ListTaiwan", &m_ListTaiwan, true);
ini.Get("GameList", "ListUnknown", &m_ListUnknown, true);
ini.Get("GameList", "ListFrance", &m_ListFrance, true);
ini.Get("GameList", "ListItaly", &m_ListItaly, true);
ini.Get("GameList", "ListKorea", &m_ListKorea, true);
ini.Get("GameList", "ListTaiwan", &m_ListTaiwan, true);
ini.Get("GameList", "ListUnknown", &m_ListUnknown, true);
ini.Get("GameList", "ListSort", &m_ListSort, 3);
ini.Get("GameList", "ListSortSecondary",&m_ListSort2, 0);
// Core
ini.Get("Core", "HLE_BS2", &m_LocalCoreStartupParameter.bHLE_BS2, false);
@@ -384,6 +398,10 @@ void SConfig::LoadSettings()
// GFX Backend
ini.Get("Core", "GFXBackend", &m_LocalCoreStartupParameter.m_strVideoBackend, "");
// Movie
ini.Get("General", "PauseMovie", &m_PauseMovie, false);
ini.Get("Movie", "Author", &m_strMovieAuthor, "");
}
m_SYSCONF = new SysConf();
+7
View File
@@ -75,6 +75,13 @@ struct SConfig : NonCopyable
bool m_ListKorea;
bool m_ListTaiwan;
bool m_ListUnknown;
int m_ListSort;
int m_ListSort2;
std::string m_WirelessMac;
bool m_PauseMovie;
bool m_ShowLag;
std::string m_strMovieAuthor;
SysConf* m_SYSCONF;
+2 -5
View File
@@ -18,9 +18,9 @@
#ifdef _WIN32
#include <windows.h>
#include "EmuWindow.h"
#endif
#include "Setup.h" // Common
#include "Atomic.h"
#include "Thread.h"
#include "Timer.h"
@@ -61,9 +61,6 @@
#include "VideoBackendBase.h"
#include "AudioCommon.h"
#include "OnScreenDisplay.h"
#ifdef _WIN32
#include "EmuWindow.h"
#endif
#include "VolumeHandler.h"
#include "FileMonitor.h"
@@ -293,7 +290,7 @@ void Stop() // - Hammertime!
SConfig::GetInstance().m_SYSCONF->Reload();
INFO_LOG(CONSOLE, "Stop [Main Thread]\t\t---- Shutdown complete ----");
Movie::g_currentInputCount = 0;
Movie::Shutdown();
g_bStopping = false;
}
-15
View File
@@ -95,21 +95,6 @@ void RequestRefreshInfo();
// the return value of the first call should be passed in as the second argument of the second call.
bool PauseAndLock(bool doLock, bool unpauseOnUnlock=true);
#ifdef RERECORDING
void FrameUpdate();
void FrameAdvance();
void FrameStepOnOff();
void WriteStatus();
void RerecordingStart();
void RerecordingStop();
void WindBack(int Counter);
extern int g_FrameCounter,g_InputCounter;
extern bool g_FrameStep;
#endif
} // namespace
#endif
+1 -1
View File
@@ -53,7 +53,7 @@ SCoreStartupParameter::SCoreStartupParameter()
bFastDiscSpeed(false),
SelectedLanguage(0), bWii(false), bDisableWiimoteSpeaker(false),
bConfirmStop(false), bHideCursor(false),
bAutoHideCursor(false), bUsePanicHandlers(true),
bAutoHideCursor(false), bUsePanicHandlers(true), bOnScreenDisplayMessages(true),
iRenderWindowXPos(-1), iRenderWindowYPos(-1),
iRenderWindowWidth(640), iRenderWindowHeight(480),
bRenderWindowAutoSize(false), bKeepWindowOnTop(false),
+1 -1
View File
@@ -122,7 +122,7 @@ struct SCoreStartupParameter
bool bDisableWiimoteSpeaker;
// Interface settings
bool bConfirmStop, bHideCursor, bAutoHideCursor, bUsePanicHandlers;
bool bConfirmStop, bHideCursor, bAutoHideCursor, bUsePanicHandlers, bOnScreenDisplayMessages;
// Hotkeys
int iHotkey[NUM_HOTKEYS];
-248
View File
@@ -1,248 +0,0 @@
// Copyright (C) 2003 Dolphin Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, version 2.0.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
#include "Setup.h"
#ifndef RERECORDING
bool rerecording = false;
#else
// Include
// --------------
#ifdef _WIN32
#include <windows.h>
#endif
#include "Thread.h" // Common
#include "Timer.h"
#include "Common.h"
#include "Console.h"
#include "Core.h"
#include "CPUDetect.h"
#include "CoreTiming.h"
#include "Boot/Boot.h"
#include "PatchEngine.h"
#include "HW/Memmap.h"
#include "HW/ProcessorInterface.h"
#include "HW/GPFifo.h"
#include "HW/CPU.h"
#include "HW/HW.h"
#include "HW/DSP.h"
#include "HW/GPFifo.h"
#include "HW/AudioInterface.h"
#include "HW/VideoInterface.h"
#include "HW/CommandProcessor.h"
#include "HW/PixelEngine.h"
#include "HW/SystemTimers.h"
#include "PowerPC/PowerPC.h"
#include "ConfigManager.h"
#include "MemTools.h"
#include "Host.h"
#include "LogManager.h"
// File description: Rerecording Functions
/* ---------------
How the timer works: We measure the time between drawn frames, not when the game is paused. So time
should be a fairly comparable measure of the time it took to play the game. However the time it takes
to draw a frame will be lower on a fast computer. Therefore we could perhaps measure time as an
internal game time that is adjusted by the average time it takes to draw a frame. Also if it only takes
ten or twenty milliseconds to draw a frame I'm not certain about how accurate the mmsystem timers are for
such short periods.
//////////////////////////////////////*/
namespace Core
{
// Declarations and definitions
// ---------------
int g_FrameCounter = 0;
bool g_FrameStep = false;
Common::Timer ReRecTimer;
// Control Run, Pause, Stop and the Timer.
// ---------------
// Subtract the paused time when we run again
void Run()
{
ReRecTimer.AddTimeDifference();
}
// Update the time
void Pause()
{
ReRecTimer.Update();
}
// Start the timer when a game is booted
void RerecordingStart()
{
g_FrameCounter = 0;
ReRecTimer.Start();
// Logging
//DEBUG_LOG(CONSOLE, "RerecordingStart: %i\n", g_FrameCounter);
}
// Reset the frame counter
void RerecordingStop()
{
// Write the final time and Stop the timer
ReRecTimer.Stop();
// Update status bar
WriteStatus();
}
/* Wind back the frame counter when a save state is loaded. Currently we don't know what that means in
time so we just guess that the time is proportional the the number of frames
Todo: There are many assumptions here: We probably want to replace the time here by the actual time
that we save together with the save state or the input recording for example. And have it adjusted
for full speed playback (whether it's 30 fps or 60 fps or some other speed that the game is natively
capped at). Also the input interrupts do not occur as often as the frame renderings, they occur more
often. So we may want to move the input recording to fram updates, or perhaps sync the input interrupts
to frame updates.
*/
void WindBack(int Counter)
{
/* Counter should be smaller than g_FrameCounter, however it currently updates faster than the
frames so currently it may not be the same. Therefore I use the abs() function. */
int AbsoluteFrameDifference = abs(g_FrameCounter - Counter);
float FractionalFrameDifference = (float) AbsoluteFrameDifference / (float) g_FrameCounter;
// Update the frame counter
g_FrameCounter = Counter;
// Approximate a time to wind back the clock to
// Get the current time
u64 CurrentTimeMs = ReRecTimer.GetTimeElapsed();
// Save the current time in seconds in a new double
double CurrentTimeSeconds = (double) (CurrentTimeMs / 1000);
// Reduce it by the same proportion as the counter was wound back
CurrentTimeSeconds = CurrentTimeSeconds * FractionalFrameDifference;
// Update the clock
ReRecTimer.WindBackStartingTime((u64)CurrentTimeSeconds * 1000);
// Logging
DEBUG_LOG(CONSOLE, "WindBack: %i %u\n", Counter, (u64)CurrentTimeSeconds);
}
// Frame advance
// ---------------
void FrameAdvance()
{
// Update status bar
WriteStatus();
// If a game is not started, return
if (Core::GetState() == Core::CORE_UNINITIALIZED) return;
// Play to the next frame
if (g_FrameStep)
{
Run();
Core::SetState(Core::CORE_RUN);
}
}
// Turn on frame stepping
void FrameStepOnOff()
{
/* Turn frame step on or off. If a game is running and we turn this on it means that the game
will pause after the next frame update */
g_FrameStep = !g_FrameStep;
// Update status bar
WriteStatus();
// If a game is not started, return
if(Core::GetState() == Core::CORE_UNINITIALIZED) return;
// Run the emulation if we turned off framestepping
if (!g_FrameStep)
{
Run();
Core::SetState(Core::CORE_RUN);
}
}
// General functions
// ---------------
// Write to the status bar
void WriteStatus()
{
std::string TmpStr = "Time: " + ReRecTimer.GetTimeElapsedFormatted();
TmpStr += StringFromFormat(" Frame: %s", ThousandSeparate(g_FrameCounter).c_str());
// The FPS is the total average since the game was booted
TmpStr += StringFromFormat(" FPS: %i", (g_FrameCounter * 1000) / ReRecTimer.GetTimeElapsed());
TmpStr += StringFromFormat(" FrameStep: %s", g_FrameStep ? "On" : "Off");
Host_UpdateStatusBar(TmpStr.c_str(), 1);
}
// When a new frame is drawn
void FrameUpdate()
{
// Write to the status bar
WriteStatus();
/* I don't think the frequent update has any material speed inpact at all, but should it
have you can controls the update speed by changing the "% 10" in this line */
//if (g_FrameCounter % 10 == 0) WriteStatus();
// Pause if frame stepping is on
if(g_FrameStep)
{
Pause();
Core::SetState(Core::CORE_PAUSE);
}
// Count one frame
g_FrameCounter++;
}
} // Core
#endif // RERECORDING
+2 -2
View File
@@ -119,7 +119,7 @@ int RegisterEvent(const char *name, TimedCallback callback)
// check for existing type with same name.
// we want event type names to remain unique so that we can use them for serialization.
for (int i = 0; i < event_types.size(); ++i)
for (unsigned int i = 0; i < event_types.size(); ++i)
{
if (!strcmp(name, event_types[i].name))
{
@@ -188,7 +188,7 @@ void EventDoState(PointerWrap &p, BaseEvent* ev)
if (p.GetMode() == PointerWrap::MODE_READ)
{
bool foundMatch = false;
for (int i = 0; i < event_types.size(); ++i)
for (unsigned int i = 0; i < event_types.size(); ++i)
{
if (!strcmp(name.c_str(), event_types[i].name))
{
@@ -220,8 +220,8 @@ void DSPJitRegCache::flushRegs(DSPJitRegCache &cache, bool emit)
for(i = 0; i <= DSP_REG_MAX_MEM_BACKED; i++) {
if (cache.regs[i].loc.GetSimpleReg() !=
regs[i].loc.GetSimpleReg() &&
xregs[cache.regs[i].loc.GetSimpleReg()].guest_reg ==
DSP_REG_NONE) {
xregs[cache.regs[i].loc.GetSimpleReg()].guest_reg == DSP_REG_NONE)
{
movToHostReg(i,
cache.regs[i].loc.GetSimpleReg(),
true);
@@ -34,7 +34,7 @@ public:
virtual void step() {}
virtual void breakNow();
virtual void runToBreakpoint();
virtual void insertBLR(unsigned int address, unsigned int);
virtual void insertBLR(unsigned int address, unsigned int value);
virtual int getColor(unsigned int address);
virtual std::string getDescription(unsigned int address);
virtual void showJitResults(u32 address);
+1 -1
View File
@@ -171,7 +171,7 @@ bool InstallCodeHandler()
Memory::Write_U8(1, 0x80001807);
// Invalidate the icache
for (int i = 0; i < data.length(); i += 32)
for (unsigned int i = 0; i < data.length(); i += 32)
{
PowerPC::ppcState.iCache.Invalidate(0x80001800 + i);
}
-3
View File
@@ -42,8 +42,6 @@ void LoadCodes(const IniFile& inifile, std::vector<GeckoCode>& gcodes)
std::istringstream ss(*lines_iter);
int read_state = 0;
switch ((*lines_iter)[0])
{
@@ -61,7 +59,6 @@ void LoadCodes(const IniFile& inifile, std::vector<GeckoCode>& gcodes)
gcode.name = StripSpaces(gcode.name);
// read the code creator name
std::getline(ss, gcode.creator, ']');
read_state = 0;
break;
// notes
@@ -354,9 +354,6 @@ unsigned int Callback_GetStreaming(short* _pDestBuffer, unsigned int _numSamples
static s16 l1 = 0;
static s16 l2 = 0;
static s16 r1 = 0;
static s16 r2 = 0;
if ( frac >= 0x10000 || frac == 0)
{
@@ -364,9 +361,6 @@ unsigned int Callback_GetStreaming(short* _pDestBuffer, unsigned int _numSamples
l1 = l2; //current
l2 = pcm[pos * 2]; //next
r1 = r2; //current
r2 = pcm[pos * 2 + 1]; //next
}
pcm_l = ((l1 << 16) + (l2 - l1) * (u16)frac) >> 16;
+2
View File
@@ -718,6 +718,8 @@ void Do_ARAM_DMA()
{
while (g_arDMA.Cnt.count)
{
// These are logically seperated in code to show that a memory map has been set up
// See below in the write section for more information
if ((g_ARAM_Info.Hex & 0xf) == 3)
{
Memory::Write_U64_Swap(*(u64*)&g_ARAM.ptr[g_arDMA.ARAddr & g_ARAM.mask], g_arDMA.MMAddr);
@@ -20,7 +20,6 @@
#include "ChunkFile.h"
#include "IniFile.h"
#include "HLEMixer.h"
#include "Setup.h"
#include "StringUtil.h"
#include "LogManager.h"
#include "IniFile.h"
@@ -281,7 +281,7 @@ bool CUCode_AX::AXTask(u32& _uMail)
u32 Addr__AXOutSBuffer_1;
u32 Addr__AXOutSBuffer_2;
u32 Addr__A;
u32 Addr__12;
//u32 Addr__12;
u32 Addr__4_1;
u32 Addr__4_2;
//u32 Addr__4_3;
@@ -429,7 +429,7 @@ bool CUCode_AX::AXTask(u32& _uMail)
break;
case 0x0012:
Addr__12 = HLEMemory_Read_U16(uAddress);
//Addr__12 = HLEMemory_Read_U16(uAddress);
uAddress += 2;
break;
@@ -159,8 +159,8 @@ void CUCode_AXWii::Update(int cycles)
bool CUCode_AXWii::AXTask(u32& _uMail)
{
u32 uAddress = _uMail;
u32 Addr__AXStudio;
u32 Addr__AXOutSBuffer;
//u32 Addr__AXStudio;
//u32 Addr__AXOutSBuffer;
bool bExecuteList = true;
/*
@@ -178,7 +178,7 @@ bool CUCode_AXWii::AXTask(u32& _uMail)
switch (iCommand)
{
case 0x0000:
Addr__AXStudio = HLEMemory_Read_U32(uAddress);
//Addr__AXStudio = HLEMemory_Read_U32(uAddress);
uAddress += 4;
break;
@@ -193,7 +193,8 @@ bool CUCode_AXWii::AXTask(u32& _uMail)
case 0x0004:
// PBs are here now
m_addressPBs = HLEMemory_Read_U32(uAddress);
soundStream->GetMixer()->SetHLEReady(true);
if (soundStream)
soundStream->GetMixer()->SetHLEReady(true);
// soundStream->Update();
uAddress += 4;
break;
@@ -208,7 +209,7 @@ bool CUCode_AXWii::AXTask(u32& _uMail)
break;
case 0x0007: // AXLIST_SBUFFER
Addr__AXOutSBuffer = HLEMemory_Read_U32(uAddress);
//Addr__AXOutSBuffer = HLEMemory_Read_U32(uAddress);
uAddress += 10;
break;
@@ -134,7 +134,7 @@ void DSPDebugInterface::toggleMemCheck(unsigned int address)
PanicAlert("MemCheck functionality not supported in DSP module.");
}
void DSPDebugInterface::insertBLR(unsigned int address)
void DSPDebugInterface::insertBLR(unsigned int address, unsigned int value)
{
PanicAlert("insertBLR functionality not supported in DSP module.");
}
@@ -27,7 +27,7 @@ public:
virtual void setPC(unsigned int address);
virtual void step() {}
virtual void runToBreakpoint();
virtual void insertBLR(unsigned int address);
virtual void insertBLR(unsigned int address, unsigned int value);
virtual int getColor(unsigned int address);
virtual std::string getDescription(unsigned int address);
};
@@ -52,7 +52,7 @@ CEXIMemoryCard::CEXIMemoryCard(const int index)
, m_bDirty(false)
{
m_strFilename = (card_index == 0) ? SConfig::GetInstance().m_strMemoryCardA : SConfig::GetInstance().m_strMemoryCardB;
if (Movie::IsUsingMemcard() && Movie::IsPlayingInput() && Movie::IsConfigSaved() && Movie::IsBlankMemcard())
if (Movie::IsPlayingInput() && Movie::IsConfigSaved() && Movie::IsUsingMemcard() && Movie::IsStartingFromClearSave())
m_strFilename = "Movie.raw";
// we're potentially leaking events here, since there's no UnregisterEvent until emu shutdown, but I guess it's inconsequential
+6 -8
View File
@@ -265,7 +265,7 @@ bool GCMemcard::Save()
mcdFile.WriteBytes(&dir_backup, BLOCK_SIZE);
mcdFile.WriteBytes(&bat, BLOCK_SIZE);
mcdFile.WriteBytes(&bat_backup, BLOCK_SIZE);
for (int i = 0; i < maxBlock - MC_FST_BLOCKS; ++i)
for (unsigned int i = 0; i < maxBlock - MC_FST_BLOCKS; ++i)
{
mcdFile.WriteBytes(mc_data_blocks[i].block, BLOCK_SIZE);
}
@@ -587,7 +587,7 @@ u16 GCMemcard::BlockAlloc::NextFreeBlock(u16 StartingBlock) const
for (u16 i = StartingBlock; i < BAT_SIZE; ++i)
if (Map[i-MC_FST_BLOCKS] == 0)
return i;
for (u16 i = 0; i < StartingBlock; ++i)
for (u16 i = MC_FST_BLOCKS; i < StartingBlock; ++i)
if (Map[i-MC_FST_BLOCKS] == 0)
return i;
}
@@ -609,7 +609,7 @@ bool GCMemcard::BlockAlloc::ClearBlocks(u16 FirstBlock, u16 BlockCount)
{
return false;
}
for (int i = 0; i < length; ++i)
for (unsigned int i = 0; i < length; ++i)
Map[blocks.at(i)-MC_FST_BLOCKS] = 0;
FreeBlocks = BE16(BE16(FreeBlocks) + BlockCount);
@@ -625,7 +625,7 @@ u32 GCMemcard::GetSaveData(u8 index, std::vector<GCMBlock> & Blocks) const
u16 block = DEntry_FirstBlock(index);
u16 BlockCount = DEntry_BlockCount(index);
u16 memcardSize = BE16(hdr.SizeMb) * MBIT_TO_BLOCKS;
//u16 memcardSize = BE16(hdr.SizeMb) * MBIT_TO_BLOCKS;
if ((block == 0xFFFF) || (BlockCount == 0xFFFF))
{
@@ -669,12 +669,10 @@ u32 GCMemcard::ImportFile(DEntry& direntry, std::vector<GCMBlock> &saveBlocks)
Directory UpdatedDir = *CurrentDir;
// find first free dir entry
int index = -1;
for (int i=0; i < DIRLEN; i++)
{
if (BE32(UpdatedDir.Dir[i].Gamecode) == 0xFFFFFFFF)
{
index = i;
UpdatedDir.Dir[i] = direntry;
*(u16*)&UpdatedDir.Dir[i].FirstBlock = BE16(firstBlock);
UpdatedDir.Dir[i].CopyCounter = UpdatedDir.Dir[i].CopyCounter+1;
@@ -887,7 +885,7 @@ u32 GCMemcard::ImportGciInternal(FILE* gcih, const char *inputFile, const std::s
std::vector<GCMBlock> saveData;
saveData.reserve(size);
for (int i = 0; i < size; ++i)
for (unsigned int i = 0; i < size; ++i)
{
GCMBlock b;
gci.ReadBytes(b.block, BLOCK_SIZE);
@@ -1000,7 +998,7 @@ u32 GCMemcard::ExportGci(u8 index, const char *fileName, const std::string &dire
return NOMEMCARD;
}
gci.Seek(DENTRY_SIZE + offset, SEEK_SET);
for (int i = 0; i < size; ++i)
for (unsigned int i = 0; i < size; ++i)
{
gci.WriteBytes(saveData[i].block, BLOCK_SIZE);
}
+2
View File
@@ -656,8 +656,10 @@ u8 *GetPointer(const u32 _Address)
case 0x9:
case 0xd:
if (SConfig::GetInstance().m_LocalCoreStartupParameter.bWii)
{
if ((_Address & 0xfffffff) < EXRAM_SIZE)
return m_pPhysicalEXRAM + (_Address & EXRAM_MASK);
}
else
break;
+1 -1
View File
@@ -273,7 +273,7 @@ void Init()
g_Channel[i].m_InLo.Hex = 0;
if (Movie::IsRecordingInput() || Movie::IsPlayingInput())
AddDevice(Movie::IsUsingPad(i) ? SIDEVICE_GC_CONTROLLER : SIDEVICE_NONE, i);
AddDevice(Movie::IsUsingPad(i) ? (Movie::IsUsingBongo(i) ? SIDEVICE_GC_TARUKONGA : SIDEVICE_GC_CONTROLLER) : SIDEVICE_NONE, i);
else
AddDevice(SConfig::GetInstance().m_SIDevice[i], i);
}
@@ -262,7 +262,6 @@ int CSIDevice_AMBaseboard::RunBuffer(u8* _pBuffer, int _iLength)
{
int cmd = *jvs_io++;
int unknown = 0;
DEBUG_LOG(AMBASEBOARDDEBUG, "JVS IO, node=%d, cmd=%02x", node, cmd);
switch (cmd)
@@ -362,10 +361,7 @@ int CSIDevice_AMBaseboard::RunBuffer(u8* _pBuffer, int _iLength)
}
case 0xf0:
if (*jvs_io++ == 0xD9)
{
ERROR_LOG(AMBASEBOARDDEBUG, "JVS RESET");
} else
unknown = 1;
msg.addData(1);
d10_1 |= 1;
@@ -132,15 +132,17 @@ bool CSIDevice_GCController::GetData(u32& _Hi, u32& _Low)
if(Movie::IsPlayingInput())
{
Movie::PlayController(&PadStatus, ISIDevice::m_iDeviceNumber);
if(!Core::g_CoreStartupParameter.bWii)
if(!Movie::IsUsingWiimote(0))
Movie::InputUpdate();
}
else if(Movie::IsRecordingInput())
{
Movie::RecordInput(&PadStatus, ISIDevice::m_iDeviceNumber);
if(!Core::g_CoreStartupParameter.bWii)
if(!Movie::IsUsingWiimote(0))
Movie::InputUpdate();
}
else
Movie::CheckPadStatus(&PadStatus, ISIDevice::m_iDeviceNumber);
// Thankfully changing mode does not change the high bits ;)
_Hi = (u32)((u8)PadStatus.stickY);
+3 -3
View File
@@ -136,9 +136,9 @@ void DoState(unsigned char **ptr, int mode)
{
// TODO:
//PointerWrap p(ptr, mode);
//for (unsigned int i=0; i<4; ++i)
// ((WiimoteEmu::Wiimote*)g_plugin.controllers[i])->DoState(p);
PointerWrap p(ptr, mode);
for (unsigned int i=0; i<4; ++i)
((WiimoteEmu::Wiimote*)g_plugin.controllers[i])->DoState(p);
}
// ___________________________________________________________________________
@@ -594,13 +594,69 @@ void Wiimote::SendReadDataReply(ReadRequest& _request)
void Wiimote::DoState(PointerWrap& p)
{
// not working :(
//if (p.MODE_READ == p.GetMode())
//{
// // LOAD
// Reset(); // should cause a status report to be sent, then wii should re-setup wiimote
//}
//p.Do(m_reporting_channel);
p.Do(m_extension->active_extension);
p.Do(m_extension->switch_extension);
p.Do(m_accel);
p.Do(m_index);
p.Do(ir_sin);
p.Do(ir_cos);
p.Do(m_rumble_on);
p.Do(m_speaker_mute);
p.Do(m_motion_plus_present);
p.Do(m_motion_plus_active);
p.Do(m_reporting_auto);
p.Do(m_reporting_mode);
p.Do(m_reporting_channel);
p.Do(m_shake_step);
p.Do(m_sensor_bar_on_top);
p.Do(m_status);
p.Do(m_adpcm_state);
p.Do(m_ext_key);
p.DoArray(m_eeprom, sizeof(m_eeprom));
p.Do(m_reg_motion_plus);
p.Do(m_reg_ir);
p.Do(m_reg_ext);
p.Do(m_reg_speaker);
//Do 'm_read_requests' queue
{
u32 size = 0;
if (p.mode == PointerWrap::MODE_READ)
{
//clear
while (m_read_requests.size())
m_read_requests.pop();
p.Do(size);
while (size--)
{
ReadRequest tmp;
p.Do(tmp.address);
p.Do(tmp.position);
p.Do(tmp.size);
tmp.data = new u8[tmp.size];
p.DoArray(tmp.data, tmp.size);
m_read_requests.push(tmp);
}
}
else
{
std::queue<ReadRequest> tmp_queue(m_read_requests);
size = m_read_requests.size();
p.Do(size);
while (!tmp_queue.empty())
{
ReadRequest tmp = tmp_queue.front();
p.Do(tmp.address);
p.Do(tmp.position);
p.Do(tmp.size);
p.DoArray(tmp.data, tmp.size);
tmp_queue.pop();
}
}
}
p.DoMarker("Wiimote");
}
}
@@ -762,9 +762,9 @@ void Wiimote::Update()
}
}
}
if (Movie::IsRecordingInput())
if (!Movie::IsPlayingInput())
{
Movie::RecordWiimote(m_index, data, rptf, m_reg_ir.mode);
Movie::CheckWiimoteStatus(m_index, data, rptf, m_reg_ir.mode);
}
// don't send a data report if auto reporting is off
@@ -185,6 +185,11 @@ bool Wiimote::Connect()
RealDisconnect();
return false;
}
// As of 10.8 these need explicit retaining or writing to the wiimote has a very high
// chance of crashing and burning.
[ichan retain];
[cchan retain];
NOTICE_LOG(WIIMOTE, "Connected to wiimote %i at %s",
index + 1, [[btd getAddressString] UTF8String]);
@@ -215,7 +220,8 @@ void Wiimote::RealDisconnect()
m_wiimote_thread.join();
[btd closeConnection];
[ichan release];
[cchan release];
btd = NULL;
cchan = NULL;
ichan = NULL;
@@ -512,14 +512,14 @@ void StateChange(EMUSTATE_CHANGE newState)
// TODO: disable/enable auto reporting, maybe
}
#define ARRAYSIZE(_arr) (sizeof(_arr)/(sizeof(_arr[0])))
bool IsValidBluetoothName(const char* name) {
static const char* kValidWiiRemoteBluetoothNames[] = {
"Nintendo RVL-CNT-01",
"Nintendo RVL-CNT-01-TR",
"Nintendo RVL-WBC-01",
};
if (name == NULL)
return false;
for (size_t i = 0; i < ARRAYSIZE(kValidWiiRemoteBluetoothNames); i++)
if (strcmp(name, kValidWiiRemoteBluetoothNames[i]) == 0)
return true;
+1 -1
View File
@@ -322,7 +322,7 @@ void ExecuteCommand(u32 _Address)
bool CmdSuccess = false;
ECommandType Command = static_cast<ECommandType>(Memory::Read_U32(_Address));
volatile int DeviceID = Memory::Read_U32(_Address + 8);
volatile s32 DeviceID = Memory::Read_U32(_Address + 8);
IWII_IPC_HLE_Device* pDevice = (DeviceID >= 0 && DeviceID < IPC_MAX_FDS) ? g_FdMap[DeviceID] : NULL;
@@ -21,8 +21,7 @@
#include <queue>
#include "../HW/Memmap.h"
class PointerWrap;
#include "ChunkFile.h"
#define FS_SUCCESS (u32)0 // Success
#define FS_EACCES (u32)-1 // Permission denied
@@ -62,7 +61,11 @@ public:
virtual ~IWII_IPC_HLE_Device() { }
virtual void DoState(PointerWrap& p) { DoStateShared(p); }
virtual void DoState(PointerWrap& p)
{
DoStateShared(p);
p.Do(m_Active);
}
void DoStateShared(PointerWrap& p);
@@ -183,8 +183,8 @@ void CWII_IPC_HLE_Device_FileIO::CloseFile()
bool CWII_IPC_HLE_Device_FileIO::Seek(u32 _CommandAddress)
{
u32 ReturnValue = FS_RESULT_FATAL;
const s32 SeekPosition = Memory::Read_U32(_CommandAddress + 0xC);
const s32 Mode = Memory::Read_U32(_CommandAddress + 0x10);
const u32 SeekPosition = Memory::Read_U32(_CommandAddress + 0xC);
const u32 Mode = Memory::Read_U32(_CommandAddress + 0x10);
if (OpenFile())
@@ -205,7 +205,7 @@ bool CWII_IPC_HLE_Device_FileIO::Seek(u32 _CommandAddress)
}
case 1:
{
s32 wantedPos = SeekPosition+m_SeekPos;
u32 wantedPos = SeekPosition+m_SeekPos;
if (wantedPos >=0 && wantedPos <= fileSize)
{
m_SeekPos = wantedPos;
@@ -215,7 +215,7 @@ bool CWII_IPC_HLE_Device_FileIO::Seek(u32 _CommandAddress)
}
case 2:
{
s32 wantedPos = fileSize+m_SeekPos;
u64 wantedPos = fileSize+m_SeekPos;
if (wantedPos >=0 && wantedPos <= fileSize)
{
m_SeekPos = wantedPos;
@@ -371,6 +371,8 @@ void CWII_IPC_HLE_Device_FileIO::DoState(PointerWrap &p)
p.Do(have_file_handle);
p.Do(m_Mode);
p.Do(seek);
p.Do(m_SeekPos);
p.Do(m_Filename);
if (p.GetMode() == PointerWrap::MODE_READ)
{
@@ -57,7 +57,11 @@
#include "NandPaths.h"
#include "CommonPaths.h"
#include "IPC_HLE/WII_IPC_HLE_Device_usb.h"
#include "../Movie.h"
#ifdef _WIN32
#include <Windows.h>
#endif
std::string CWII_IPC_HLE_Device_es::m_ContentFile;
@@ -783,14 +787,17 @@ bool CWII_IPC_HLE_Device_es::IOCtlV(u32 _CommandAddress)
}
else
{
static CWII_IPC_HLE_Device_usb_oh1_57e_305* s_Usb = GetUsbPointer();
bool* wiiMoteConnected = new bool[s_Usb->m_WiiMotes.size()];
for(unsigned int i = 0; i < s_Usb->m_WiiMotes.size();
i++) wiiMoteConnected[i] = s_Usb->m_WiiMotes[i].IsConnected();
std::string tContentFile(m_ContentFile.c_str());
WII_IPC_HLE_Interface::Reset(true);
WII_IPC_HLE_Interface::Init();
static CWII_IPC_HLE_Device_usb_oh1_57e_305* s_Usb = GetUsbPointer();
for (unsigned int i = 0; i < s_Usb->m_WiiMotes.size(); i++)
{
if (s_Usb->m_WiiMotes[i].IsConnected())
if (wiiMoteConnected[i])
{
s_Usb->m_WiiMotes[i].Activate(false);
s_Usb->m_WiiMotes[i].Activate(true);
@@ -801,6 +808,7 @@ bool CWII_IPC_HLE_Device_es::IOCtlV(u32 _CommandAddress)
}
}
delete[] wiiMoteConnected;
WII_IPC_HLE_Interface::SetDefaultContentFile(tContentFile);
}
// Pass the "#002 check"
@@ -891,6 +899,52 @@ u32 CWII_IPC_HLE_Device_es::ES_DIVerify(u8* _pTMD, u32 _sz)
File::CreateFullPath(tmdPath);
File::CreateFullPath(Common::GetTitleDataPath(tmdTitleID));
Movie::g_titleID = tmdTitleID;
std::string savePath = Common::GetTitleDataPath(tmdTitleID);
if (Movie::IsRecordingInput())
{
// TODO: Check for the actual save data
if (File::Exists((savePath + "banner.bin").c_str()))
Movie::g_bClearSave = false;
else
Movie::g_bClearSave = true;
}
// TODO: Force the game to save to another location, instead of moving the user's save.
if (Movie::IsPlayingInput() && Movie::IsConfigSaved() && Movie::IsStartingFromClearSave())
{
if (File::Exists((savePath + "banner.bin").c_str()))
{
if (File::Exists((savePath + "../backup/").c_str()))
{
// The last run of this game must have been to play back a movie, so their save is already backed up.
File::DeleteDirRecursively(savePath.c_str());
}
else
{
#ifdef _WIN32
MoveFile(savePath.c_str(), (savePath + "../backup/").c_str());
#else
File::CopyDir(savePath.c_str(),(savePath + "../backup/").c_str());
File::DeleteDirRecursively(savePath.c_str());
#endif
}
}
}
else if (File::Exists((savePath + "../backup/").c_str()))
{
// Delete the save made by a previous movie, and copy back the user's save.
if (File::Exists((savePath + "banner.bin").c_str()))
File::DeleteDirRecursively(savePath);
#ifdef _WIN32
MoveFile((savePath + "../backup/").c_str(), savePath.c_str());
#else
File::CopyDir((savePath + "../backup/").c_str(), savePath.c_str());
File::DeleteDirRecursively((savePath + "../backup/").c_str());
#endif
}
if(!File::Exists(tmdPath))
{
File::IOFile _pTMDFile(tmdPath, "wb");
@@ -46,6 +46,7 @@ it failed)
#endif
#include "WII_IPC_HLE_Device_net.h"
#include "../ConfigManager.h"
#include "FileUtil.h"
#include <stdio.h>
#include <string>
@@ -276,11 +277,36 @@ bool CWII_IPC_HLE_Device_net_ncd_manage::IOCtlV(u32 _CommandAddress)
// No idea why the fifth and sixth bytes are left untouched.
{
// hardcoded address as a fallback
// TODO: Make this configurable? Different MAC addresses MIGHT be needed for requesting a user id or encrypting content with NWC24
const u8 default_address[] = { 0x00, 0x19, 0x1e, 0xfd, 0x71, 0x84 };
INFO_LOG(WII_IPC_NET, "NET_NCD_MANAGE: IOCTLV_NCD_GETWIRELESSMACADDRESS");
if (!SConfig::GetInstance().m_WirelessMac.empty())
{
int x = 0;
int tmpaddress[6];
for (unsigned int i = 0; i < SConfig::GetInstance().m_WirelessMac.length() && x < 6; i++)
{
if (SConfig::GetInstance().m_WirelessMac[i] == ':' || SConfig::GetInstance().m_WirelessMac[i] == '-')
continue;
std::stringstream ss;
ss << std::hex << SConfig::GetInstance().m_WirelessMac[i];
if (SConfig::GetInstance().m_WirelessMac[i+1] != ':' && SConfig::GetInstance().m_WirelessMac[i+1] != '-')
{
ss << std::hex << SConfig::GetInstance().m_WirelessMac[i+1];
i++;
}
ss >> tmpaddress[x];
x++;
}
u8 address[6];
for (int i = 0; i < 6;i++)
address[i] = tmpaddress[i];
Memory::WriteBigEData(address, CommandBuffer.PayloadBuffer.at(1).m_Address, 4);
break;
}
#if defined(__linux__)
const char *check_devices[3] = { "wlan0", "ath0", "eth0" };
int fd, ret;
@@ -324,7 +350,6 @@ bool CWII_IPC_HLE_Device_net_ncd_manage::IOCtlV(u32 _CommandAddress)
if (SUCCEEDED(ret)) Memory::WriteBigEData(adapter_info->Address, CommandBuffer.PayloadBuffer.at(1).m_Address, 4);
else Memory::WriteBigEData(default_address, CommandBuffer.PayloadBuffer.at(1).m_Address, 4);
delete[] adapter_info;
#else
Memory::WriteBigEData(default_address, CommandBuffer.PayloadBuffer.at(1).m_Address, 4);
@@ -104,14 +104,8 @@ CWII_IPC_HLE_Device_usb_oh1_57e_305::~CWII_IPC_HLE_Device_usb_oh1_57e_305()
void CWII_IPC_HLE_Device_usb_oh1_57e_305::DoState(PointerWrap &p)
{
/*
//things that do not get saved: (why not?)
std::vector<CWII_IPC_HLE_WiiMote> m_WiiMotes;
std::deque<SQueuedEvent> m_EventQueue;
*/
p.Do(m_Active);
p.Do(m_ControllerBD);
p.Do(m_CtrlSetup);
p.Do(m_ACLSetup);
p.Do(m_HCIEndpoint);
@@ -119,75 +113,30 @@ void CWII_IPC_HLE_Device_usb_oh1_57e_305::DoState(PointerWrap &p)
p.Do(m_last_ticks);
p.DoArray(m_PacketCount,4);
p.Do(m_ScanEnable);
p.Do(m_EventQueue);
m_acl_pool.DoState(p);
bool storeFullData = (Movie::IsRecordingInput() || Movie::IsPlayingInput());
p.Do(storeFullData);
p.DoMarker("storeFullData in CWII_IPC_HLE_Device_usb_oh1_57e_305");
if (!storeFullData)
{
if (p.GetMode() == PointerWrap::MODE_READ)
{
m_EventQueue.clear();
if (SConfig::GetInstance().m_WiimoteReconnectOnLoad)
{
// Reset the connection of all connected wiimotes
for (unsigned int i = 0; i < 4; i++)
{
if (!m_WiiMotes[i].IsInactive())
{
m_WiiMotes[i].Activate(false);
m_WiiMotes[i].Activate(true);
}
else
{
m_WiiMotes[i].Activate(false);
}
}
}
}
for (unsigned int i = 0; i < 4; i++)
m_WiiMotes[i].DoState(p);
// Reset the connection of real and hybrid wiimotes
if (p.GetMode() == PointerWrap::MODE_READ && SConfig::GetInstance().m_WiimoteReconnectOnLoad)
{
for (unsigned int i = 0; i < 4; i++)
{
if (WIIMOTE_SRC_EMU == g_wiimote_sources[i] || WIIMOTE_SRC_NONE == g_wiimote_sources[i])
continue;
// TODO: Selectively clear real wiimote messages if possible. Or create a real wiimote channel and reporting mode pre-setup to vacate the need for m_WiimoteReconnectOnLoad.
m_EventQueue.clear();
if (!m_WiiMotes[i].IsInactive())
{
m_WiiMotes[i].Activate(false);
m_WiiMotes[i].Activate(true);
}
else
m_WiiMotes[i].Activate(false);
}
}
else
{
// I'm not sure why these things aren't normally saved, but I think they can affect the emulation state,
// so if sync matters (e.g. if a movie is active), we really should save them.
// also, it's definitely not safe to do the above auto-reconnect hack either.
// (unless we can do it without changing anything that affects emulation state, which is not currently the case)
p.Do(m_EventQueue);
p.DoMarker("m_EventQueue");
// m_WiiMotes is kind of annoying to save. maybe this could be done in a more general way.
u32 vec_size = (u32)m_WiiMotes.size();
p.Do(vec_size);
for (u32 i = 0; i < vec_size; ++i)
{
if (i < m_WiiMotes.size())
{
CWII_IPC_HLE_WiiMote& wiimote = m_WiiMotes[i];
wiimote.DoState(p);
}
else
{
bdaddr_t tmpBD = BDADDR_ANY;
CWII_IPC_HLE_WiiMote wiimote = CWII_IPC_HLE_WiiMote(this, i, tmpBD, false);
wiimote.DoState(p);
if (p.GetMode() == PointerWrap::MODE_READ)
{
m_WiiMotes.push_back(wiimote);
_dbg_assert_(WII_IPC_WIIMOTE, m_WiiMotes.size() == i);
}
}
}
if (p.GetMode() == PointerWrap::MODE_READ)
while ((u32)m_WiiMotes.size() > vec_size)
m_WiiMotes.pop_back();
p.DoMarker("m_WiiMotes");
}
DoStateShared(p);
}
bool CWII_IPC_HLE_Device_usb_oh1_57e_305::RemoteDisconnect(u16 _connectionHandle)
@@ -1518,9 +1467,9 @@ void CWII_IPC_HLE_Device_usb_oh1_57e_305::CommandWriteLinkPolicy(u8* _Input)
DEBUG_LOG(WII_IPC_WIIMOTE, " ConnectionHandle: 0x%04x", pLinkPolicy->con_handle);
DEBUG_LOG(WII_IPC_WIIMOTE, " Policy: 0x%04x", pLinkPolicy->settings);
hci_write_link_policy_settings_rp Reply;
Reply.status = 0x00;
Reply.con_handle = pLinkPolicy->con_handle;
//hci_write_link_policy_settings_rp Reply;
//Reply.status = 0x00;
//Reply.con_handle = pLinkPolicy->con_handle;
SendEventCommandStatus(HCI_CMD_WRITE_LINK_POLICY_SETTINGS);
@@ -1929,4 +1878,4 @@ void CWII_IPC_HLE_Device_usb_oh1_57e_305::LOG_LinkKey(const u8* _pLinkKey)
, _pLinkKey[0], _pLinkKey[1], _pLinkKey[2], _pLinkKey[3], _pLinkKey[4], _pLinkKey[5], _pLinkKey[6], _pLinkKey[7]
, _pLinkKey[8], _pLinkKey[9], _pLinkKey[10], _pLinkKey[11], _pLinkKey[12], _pLinkKey[13], _pLinkKey[14], _pLinkKey[15]);
}
}
@@ -102,6 +102,7 @@ void CWII_IPC_HLE_WiiMote::DoState(PointerWrap &p)
p.Do(uclass);
p.Do(features);
p.Do(lmp_version);
p.Do(lmp_subversion);
p.Do(m_LinkKey);
p.Do(m_Name);
+192 -110
View File
@@ -27,7 +27,6 @@
#include "HW/WiimoteEmu/WiimoteEmu.h"
#include "HW/WiimoteEmu/WiimoteHid.h"
#include "IPC_HLE/WII_IPC_HLE_Device_usb.h"
#include "VideoBackendBase.h"
#include "State.h"
#include "Timer.h"
#include "VideoConfig.h"
@@ -35,9 +34,11 @@
#include "HW/EXI_Device.h"
#include "HW/EXI_Channel.h"
#include "HW/DVDInterface.h"
#include "../../Common/Src/NandPaths.h"
#include "Crypto/md5.h"
// large enough for just over 24 hours of single-player recording
#define MAX_DTM_LENGTH (40 * 1024 * 1024)
// The chunk to allocate movie data in multiples of.
#define DTM_BASE_LENGTH (1024)
std::mutex cs_frameSkip;
@@ -55,24 +56,22 @@ u8 g_numPads = 0;
ControllerState g_padState;
DTMHeader tmpHeader;
u8* tmpInput = NULL;
size_t tmpInputAllocated = 0;
u64 g_currentByte = 0, g_totalBytes = 0;
u64 g_currentFrame = 0, g_totalFrames = 0; // VI
u64 g_currentLagCount = 0, g_totalLagCount = 0; // just stats
u64 g_currentInputCount = 0, g_totalInputCount = 0; // just stats
u64 g_recordingStartTime; // seconds since 1970 that recording started
bool bSaveConfig = false;
bool bSkipIdle = false;
bool bDualCore = false;
bool bProgressive = false;
bool bDSPHLE = false;
bool bFastDiscSpeed = false;
std::string videoBackend = "opengl";
bool bSaveConfig, bSkipIdle, bDualCore, bProgressive, bDSPHLE, bFastDiscSpeed = false;
bool bMemcard, g_bClearSave = false;
std::string videoBackend = "unknown";
int iCPUCore = 1;
bool bMemcard;
bool bBlankMC = false;
bool g_bDiscChange = false;
std::string g_discChange = "";
std::string author = "";
u64 g_titleID = 0;
unsigned char MD5[16];
u8 bongos;
bool g_bRecordingFromSaveState = false;
bool g_bPolled = false;
@@ -84,9 +83,39 @@ std::string g_InputDisplay[8];
ManipFunction mfunc = NULL;
void EnsureTmpInputSize(size_t bound)
{
if (tmpInputAllocated >= bound)
return;
// The buffer expands in powers of two of DTM_BASE_LENGTH
// (standard exponential buffer growth).
size_t newAlloc = DTM_BASE_LENGTH;
while (newAlloc < bound)
newAlloc *= 2;
u8* newTmpInput = new u8[newAlloc];
tmpInputAllocated = newAlloc;
if (tmpInput != NULL)
{
if (g_totalBytes > 0)
memcpy(newTmpInput, tmpInput, (size_t)g_totalBytes);
delete[] tmpInput;
}
tmpInput = newTmpInput;
}
std::string GetInputDisplay()
{
if (!IsPlayingInput() && !IsRecordingInput())
{
g_numPads = 0;
for (int i = 0; i < 4; i++)
{
if (SConfig::GetInstance().m_SIDevice[i] == SIDEVICE_GC_CONTROLLER || SConfig::GetInstance().m_SIDevice[i] == SIDEVICE_GC_TARUKONGA)
g_numPads |= (1 << i);
if (g_wiimote_sources[i] != WIIMOTE_SRC_NONE)
g_numPads |= (1 << (i + 4));
}
}
std::string inputDisplay = "";
for (int i = 0; i < 8; ++i)
if ((g_numPads & (1 << i)) != 0)
@@ -105,6 +134,10 @@ void FrameUpdate()
g_totalFrames = g_currentFrame;
g_totalLagCount = g_currentLagCount;
}
if (IsPlayingInput() && IsConfigSaved())
{
SetGraphicsConfig();
}
if (g_bFrameStep)
{
@@ -135,11 +168,24 @@ void Init()
if (IsPlayingInput())
{
ReadHeader();
std::thread md5thread(CheckMD5);
if ((strncmp((char *)tmpHeader.gameID, Core::g_CoreStartupParameter.GetUniqueID().c_str(), 6)))
{
PanicAlert("The recorded game (%s) is not the same as the selected game (%s)", tmpHeader.gameID, Core::g_CoreStartupParameter.GetUniqueID().c_str());
EndPlayInput(false);
}
}
if (IsRecordingInput())
{
GetSettings();
std::thread md5thread(GetMD5);
}
g_frameSkipCounter = g_framesToSkip;
memset(&g_padState, 0, sizeof(g_padState));
if (!tmpHeader.bFromSaveState || !IsPlayingInput())
Core::SetStateFileName("");
for (int i = 0; i < 8; ++i)
g_InputDisplay[i].clear();
@@ -147,15 +193,10 @@ void Init()
{
g_bRecordingFromSaveState = false;
g_rerecords = 0;
g_numPads = 0;
g_currentByte = 0;
g_currentFrame = 0;
g_currentLagCount = 0;
g_currentInputCount = 0;
// we don't clear these things because otherwise we can't resume playback if we load a movie state later
//g_totalFrames = g_totalBytes = 0;
//delete tmpInput;
//tmpInput = NULL;
}
}
@@ -164,6 +205,9 @@ void InputUpdate()
g_currentInputCount++;
if (IsRecordingInput())
g_totalInputCount = g_currentInputCount;
if (IsPlayingInput() && g_currentInputCount == (g_totalInputCount -1) && SConfig::GetInstance().m_PauseMovie)
Core::SetState(Core::CORE_PAUSE);
}
void SetFrameSkipping(unsigned int framesToSkip)
@@ -268,6 +312,11 @@ bool IsUsingPad(int controller)
return ((g_numPads & (1 << controller)) != 0);
}
bool IsUsingBongo(int controller)
{
return ((bongos & (1 << controller)) != 0);
}
bool IsUsingWiimote(int wiimote)
{
return ((g_numPads & (1 << (wiimote + 4))) != 0);
@@ -307,9 +356,9 @@ int GetCPUMode()
return iCPUCore;
}
bool IsBlankMemcard()
bool IsStartingFromClearSave()
{
return bBlankMC;
return g_bClearSave;
}
bool IsUsingMemcard()
@@ -325,7 +374,7 @@ void ChangePads(bool instantly)
int controllers = 0;
for (int i = 0; i < 4; i++)
if (SConfig::GetInstance().m_SIDevice[i] == SIDEVICE_GC_CONTROLLER)
if (SConfig::GetInstance().m_SIDevice[i] == SIDEVICE_GC_CONTROLLER || SConfig::GetInstance().m_SIDevice[i] == SIDEVICE_GC_TARUKONGA)
controllers |= (1 << i);
if (instantly && (g_numPads & 0x0F) == controllers)
@@ -333,9 +382,9 @@ void ChangePads(bool instantly)
for (int i = 0; i < 4; i++)
if (instantly) // Changes from savestates need to be instantaneous
SerialInterface::AddDevice(IsUsingPad(i) ? SIDEVICE_GC_CONTROLLER : SIDEVICE_NONE, i);
SerialInterface::AddDevice(IsUsingPad(i) ? (IsUsingBongo(i) ? SIDEVICE_GC_TARUKONGA : SIDEVICE_GC_CONTROLLER) : SIDEVICE_NONE, i);
else
SerialInterface::ChangeDevice(IsUsingPad(i) ? SIDEVICE_GC_CONTROLLER : SIDEVICE_NONE, i);
SerialInterface::ChangeDevice(IsUsingPad(i) ? (IsUsingBongo(i) ? SIDEVICE_GC_TARUKONGA : SIDEVICE_GC_CONTROLLER) : SIDEVICE_NONE, i);
}
void ChangeWiiPads(bool instantly)
@@ -369,6 +418,10 @@ bool BeginRecordingInput(int controllers)
g_recordingStartTime = Common::Timer::GetLocalTimeSinceJan1970();
g_rerecords = 0;
for (int i = 0; i < 4; i++)
if (SConfig::GetInstance().m_SIDevice[i] == SIDEVICE_GC_TARUKONGA)
bongos |= (1 << i);
if (Core::IsRunning())
{
if(File::Exists(tmpStateFilename))
@@ -376,21 +429,23 @@ bool BeginRecordingInput(int controllers)
State::SaveAs(tmpStateFilename.c_str());
g_bRecordingFromSaveState = true;
// This is only done here if starting from save state because otherwise we won't have the titleid. Otherwise it's set in WII_IPC_HLE_Device_es.cpp.
// TODO: find a way to GetTitleDataPath() from Movie::Init()
if (Core::g_CoreStartupParameter.bWii)
{
if (File::Exists((Common::GetTitleDataPath(g_titleID) + "banner.bin").c_str()))
Movie::g_bClearSave = false;
else
Movie::g_bClearSave = true;
}
std::thread md5thread(GetMD5);
}
g_playMode = MODE_RECORDING;
GetSettings();
author = SConfig::GetInstance().m_strMovieAuthor;
EnsureTmpInputSize(1);
bSkipIdle = SConfig::GetInstance().m_LocalCoreStartupParameter.bSkipIdle;
bDualCore = SConfig::GetInstance().m_LocalCoreStartupParameter.bCPUThread;
bProgressive = SConfig::GetInstance().m_LocalCoreStartupParameter.bProgressive;
bDSPHLE = SConfig::GetInstance().m_LocalCoreStartupParameter.bDSPHLE;
bFastDiscSpeed = SConfig::GetInstance().m_LocalCoreStartupParameter.bFastDiscSpeed;
videoBackend = SConfig::GetInstance().m_LocalCoreStartupParameter.m_strVideoBackend;
iCPUCore = SConfig::GetInstance().m_LocalCoreStartupParameter.iCPUCore;
bBlankMC = !File::Exists(SConfig::GetInstance().m_strMemoryCardA);
bMemcard = SConfig::GetInstance().m_EXIDevice[0] == EXIDEVICE_MEMORYCARD;
delete [] tmpInput;
tmpInput = new u8[MAX_DTM_LENGTH];
g_currentByte = g_totalBytes = 0;
Core::DisplayMessage("Starting movie recording", 2000);
@@ -475,15 +530,6 @@ void SetInputDisplayString(ControllerState padState, int controllerID)
if(g_padState.DPadRight)
g_InputDisplay[controllerID].append(" RIGHT");
//if(g_padState.L)
//{
// g_InputDisplay[controllerID].append(" L");
//}
//if(g_padState.R)
//{
// g_InputDisplay[controllerID].append(" R");
//}
Analog1DToString(g_padState.TriggerL, " L", inp);
g_InputDisplay[controllerID].append(inp);
@@ -550,66 +596,76 @@ void SetWiiInputDisplayString(int remoteID, u8* const coreData, u8* const accelD
g_InputDisplay[controllerID].append("\n");
}
void RecordInput(SPADStatus *PadStatus, int controllerID)
void CheckPadStatus(SPADStatus *PadStatus, int controllerID)
{
if(!IsRecordingInput() || !IsUsingPad(controllerID))
return;
g_padState.A = ((PadStatus->button & PAD_BUTTON_A) != 0);
g_padState.B = ((PadStatus->button & PAD_BUTTON_B) != 0);
g_padState.X = ((PadStatus->button & PAD_BUTTON_X) != 0);
g_padState.Y = ((PadStatus->button & PAD_BUTTON_Y) != 0);
g_padState.Z = ((PadStatus->button & PAD_TRIGGER_Z) != 0);
g_padState.Start = ((PadStatus->button & PAD_BUTTON_START) != 0);
g_padState.DPadUp = ((PadStatus->button & PAD_BUTTON_UP) != 0);
g_padState.DPadDown = ((PadStatus->button & PAD_BUTTON_DOWN) != 0);
g_padState.DPadLeft = ((PadStatus->button & PAD_BUTTON_LEFT) != 0);
g_padState.DPadRight = ((PadStatus->button & PAD_BUTTON_RIGHT) != 0);
g_padState.L = ((PadStatus->button & PAD_TRIGGER_L) != 0);
g_padState.R = ((PadStatus->button & PAD_TRIGGER_R) != 0);
g_padState.TriggerL = PadStatus->triggerLeft;
g_padState.TriggerR = PadStatus->triggerRight;
g_padState.disc = g_bDiscChange;
g_padState.AnalogStickX = PadStatus->stickX;
g_padState.AnalogStickY = PadStatus->stickY;
g_padState.CStickX = PadStatus->substickX;
g_padState.CStickY = PadStatus->substickY;
memcpy(&(tmpInput[g_currentByte]), &g_padState, 8);
g_currentByte += 8;
g_totalBytes = g_currentByte;
SetInputDisplayString(g_padState, controllerID);
}
void RecordInput(SPADStatus *PadStatus, int controllerID)
{
if (!IsRecordingInput() || !IsUsingPad(controllerID))
return;
CheckPadStatus(PadStatus, controllerID);
if (g_bDiscChange)
{
g_padState.disc = g_bDiscChange;
g_bDiscChange = false;
}
EnsureTmpInputSize((size_t)(g_currentByte + 8));
memcpy(&(tmpInput[g_currentByte]), &g_padState, 8);
g_currentByte += 8;
g_totalBytes = g_currentByte;
}
void RecordWiimote(int wiimote, u8 *data, const WiimoteEmu::ReportFeatures& rptf, int irMode)
void CheckWiimoteStatus(int wiimote, u8 *data, const WiimoteEmu::ReportFeatures& rptf, int irMode)
{
if(!IsRecordingInput() || !IsUsingWiimote(wiimote))
return;
u8* const coreData = rptf.core?(data+rptf.core):NULL;
u8* const accelData = rptf.accel?(data+rptf.accel):NULL;
u8* const irData = rptf.ir?(data+rptf.ir):NULL;
u8 size = rptf.size;
SetWiiInputDisplayString(wiimote, coreData, accelData, irData);
if (IsRecordingInput())
RecordWiimote(wiimote, data, size);
}
void RecordWiimote(int wiimote, u8 *data, u8 size)
{
if(!IsRecordingInput() || !IsUsingWiimote(wiimote))
return;
InputUpdate();
EnsureTmpInputSize((size_t)(g_currentByte + size + 1));
tmpInput[g_currentByte++] = size;
memcpy(&(tmpInput[g_currentByte]), data, size);
g_currentByte += size;
g_totalBytes = g_currentByte;
SetWiiInputDisplayString(wiimote, coreData, accelData, irData);
}
void ReadHeader()
@@ -628,41 +684,33 @@ void ReadHeader()
bDSPHLE = tmpHeader.bDSPHLE;
bFastDiscSpeed = tmpHeader.bFastDiscSpeed;
iCPUCore = tmpHeader.CPUCore;
bBlankMC = tmpHeader.bBlankMC;
g_bClearSave = tmpHeader.bClearSave;
bMemcard = tmpHeader.bMemcard;
bongos = tmpHeader.bongos;
}
else
{
bSaveConfig = false;
bSkipIdle = SConfig::GetInstance().m_LocalCoreStartupParameter.bSkipIdle;
bDualCore = SConfig::GetInstance().m_LocalCoreStartupParameter.bCPUThread;
bProgressive = SConfig::GetInstance().m_LocalCoreStartupParameter.bProgressive;
bDSPHLE = SConfig::GetInstance().m_LocalCoreStartupParameter.bDSPHLE;
bFastDiscSpeed = SConfig::GetInstance().m_LocalCoreStartupParameter.bFastDiscSpeed;
videoBackend = SConfig::GetInstance().m_LocalCoreStartupParameter.m_strVideoBackend;
bBlankMC = !File::Exists(SConfig::GetInstance().m_strMemoryCardA);
bMemcard = SConfig::GetInstance().m_EXIDevice[0] == EXIDEVICE_MEMORYCARD;
GetSettings();
}
videoBackend.resize(ARRAYSIZE(tmpHeader.videoBackend));
for (int i = 0; i < ARRAYSIZE(tmpHeader.videoBackend);i++)
for (unsigned int i = 0; i < ARRAYSIZE(tmpHeader.videoBackend);i++)
{
videoBackend[i] = tmpHeader.videoBackend[i];
}
g_discChange.resize(ARRAYSIZE(tmpHeader.discChange));
for (int i = 0; i < ARRAYSIZE(tmpHeader.discChange);i++)
for (unsigned int i = 0; i < ARRAYSIZE(tmpHeader.discChange);i++)
{
g_discChange[i] = tmpHeader.discChange[i];
}
author.resize(ARRAYSIZE(tmpHeader.author));
for (int i = 0; i < ARRAYSIZE(tmpHeader.author);i++)
for (unsigned int i = 0; i < ARRAYSIZE(tmpHeader.author);i++)
{
author[i] = tmpHeader.author[i];
}
memcpy(MD5, tmpHeader.md5, 16);
}
bool PlayInput(const char *filename)
@@ -695,19 +743,6 @@ bool PlayInput(const char *filename)
Movie::LoadInput(filename);
}
/* TODO: Put this verification somewhere we have the gameID of the played game
// TODO: Replace with Unique ID
if(tmpHeader.uniqueID != 0) {
PanicAlert("Recording Unique ID Verification Failed");
goto cleanup;
}
if(strncmp((char *)tmpHeader.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;
}
*/
ReadHeader();
g_totalFrames = tmpHeader.frameCount;
g_totalLagCount = tmpHeader.lagCount;
@@ -719,8 +754,7 @@ bool PlayInput(const char *filename)
g_playMode = MODE_PLAYING;
g_totalBytes = g_recordfd.GetSize() - 256;
delete tmpInput;
tmpInput = new u8[MAX_DTM_LENGTH];
EnsureTmpInputSize((size_t)g_totalBytes);
g_recordfd.ReadArray(tmpInput, (size_t)g_totalBytes);
g_currentByte = 0;
g_recordfd.Close();
@@ -762,11 +796,8 @@ void LoadInput(const char *filename)
ReadHeader();
if (!g_bReadOnly)
{
if (g_rerecords > tmpHeader.numRerecords)
{
tmpHeader.numRerecords = g_rerecords;
}
tmpHeader.numRerecords++;
g_rerecords++;
tmpHeader.numRerecords = g_rerecords;
t_record.Seek(0, SEEK_SET);
t_record.WriteArray(&tmpHeader, 1);
}
@@ -790,9 +821,8 @@ void LoadInput(const char *filename)
g_totalLagCount = tmpHeader.lagCount;
g_totalInputCount = tmpHeader.inputCount;
EnsureTmpInputSize((size_t)totalSavedBytes);
g_totalBytes = totalSavedBytes;
delete [] tmpInput;
tmpInput = new u8[MAX_DTM_LENGTH];
t_record.ReadArray(tmpInput, (size_t)g_totalBytes);
}
else if (g_currentByte > 0)
@@ -892,10 +922,6 @@ void PlayController(SPADStatus *PadStatus, int controllerID)
if (!IsPlayingInput() || !IsUsingPad(controllerID) || tmpInput == NULL)
return;
if (IsConfigSaved())
{
SetGraphicsConfig();
}
if (g_currentFrame == 1)
{
if (tmpHeader.bMemcard)
@@ -915,8 +941,7 @@ void PlayController(SPADStatus *PadStatus, int controllerID)
return;
}
// dtm files don't save the mic button or error bit. not sure if they're actually
// used, but better safe than sorry
// dtm files don't save the mic button or error bit. not sure if they're actually used, but better safe than sorry
signed char e = PadStatus->err;
memset(PadStatus, 0, sizeof(SPADStatus));
PadStatus->err = e;
@@ -992,13 +1017,11 @@ void PlayController(SPADStatus *PadStatus, int controllerID)
}
else
{
Core::SetState(Core::CORE_PAUSE);
PanicAlert("Change the disc to %s", g_discChange.c_str());
}
}
SetInputDisplayString(g_padState, controllerID);
CheckInputEnd();
}
@@ -1057,7 +1080,7 @@ void EndPlayInput(bool cont)
}
else if(g_playMode != MODE_NONE)
{
g_numPads = g_rerecords = 0;
g_rerecords = 0;
g_currentByte = 0;
g_playMode = MODE_NONE;
Core::DisplayMessage("Movie End.", 2000);
@@ -1104,9 +1127,11 @@ void SaveRecording(const char *filename)
header.bUseXFB = g_ActiveConfig.bUseXFB;
header.bUseRealXFB = g_ActiveConfig.bUseRealXFB;
header.bMemcard = bMemcard;
header.bBlankMC = bBlankMC;
header.bClearSave = g_bClearSave;
strncpy((char *)header.discChange, g_discChange.c_str(),ARRAYSIZE(header.discChange));
strncpy((char *)header.author, author.c_str(),ARRAYSIZE(header.author));
memcpy(header.md5,MD5,16);
header.bongos = bongos;
// TODO
header.uniqueID = 0;
@@ -1150,4 +1175,61 @@ void SetGraphicsConfig()
g_Config.bUseXFB = tmpHeader.bUseXFB;
g_Config.bUseRealXFB = tmpHeader.bUseRealXFB;
}
void GetSettings()
{
bSaveConfig = true;
bSkipIdle = SConfig::GetInstance().m_LocalCoreStartupParameter.bSkipIdle;
bDualCore = SConfig::GetInstance().m_LocalCoreStartupParameter.bCPUThread;
bProgressive = SConfig::GetInstance().m_LocalCoreStartupParameter.bProgressive;
bDSPHLE = SConfig::GetInstance().m_LocalCoreStartupParameter.bDSPHLE;
bFastDiscSpeed = SConfig::GetInstance().m_LocalCoreStartupParameter.bFastDiscSpeed;
videoBackend = SConfig::GetInstance().m_LocalCoreStartupParameter.m_strVideoBackend;
iCPUCore = SConfig::GetInstance().m_LocalCoreStartupParameter.iCPUCore;
if (!Core::g_CoreStartupParameter.bWii)
g_bClearSave = !File::Exists(SConfig::GetInstance().m_strMemoryCardA);
bMemcard = SConfig::GetInstance().m_EXIDevice[0] == EXIDEVICE_MEMORYCARD;
}
void CheckMD5()
{
for (int i=0, n=0; i<16; i++)
{
if (tmpHeader.md5[i] != 0)
continue;
n++;
if (n == 16)
return;
}
Core::DisplayMessage("Verifying checksum...", 2000);
unsigned char gameMD5[16];
char game[255];
memcpy(game, SConfig::GetInstance().m_LocalCoreStartupParameter.m_strFilename.c_str(), SConfig::GetInstance().m_LocalCoreStartupParameter.m_strFilename.size());
md5_file(game, gameMD5);
if (memcmp(gameMD5,MD5,16) == 0)
Core::DisplayMessage("Checksum of current game matches the recorded game.", 2000);
else
PanicAlert("Checksum of current game does not match the recorded game!");
}
void GetMD5()
{
Core::DisplayMessage("Calculating checksum of game file...", 2000);
for (int i = 0; i < 16; i++)
MD5[i] = 0;
char game[255];
memcpy(game, SConfig::GetInstance().m_LocalCoreStartupParameter.m_strFilename.c_str(),SConfig::GetInstance().m_LocalCoreStartupParameter.m_strFilename.size());
md5_file(game, MD5);
Core::DisplayMessage("Finished calculating checksum.", 2000);
}
void Shutdown()
{
g_currentInputCount = g_totalInputCount = g_totalFrames = g_totalBytes = 0;
delete [] tmpInput;
tmpInput = NULL;
tmpInputAllocated = 0;
}
};
+16 -9
View File
@@ -19,7 +19,6 @@
#define __MOVIE_H
#include "Common.h"
#include "FileUtil.h"
#include "../../InputCommon/Src/GCPadStatus.h"
#include <string>
@@ -61,8 +60,9 @@ static_assert(sizeof(ControllerState) == 8, "ControllerState should be 8 bytes")
#pragma pack(pop)
// Global declarations
extern bool g_bFrameStep, g_bPolled, g_bReadOnly, g_bDiscChange;
extern bool g_bFrameStep, g_bPolled, g_bReadOnly, g_bDiscChange, g_bClearSave;
extern PlayMode g_playMode;
extern u64 g_titleID;
extern u32 g_framesToSkip, g_frameSkipCounter;
@@ -98,7 +98,7 @@ struct DTMHeader {
u8 videoBackend[16]; // UTF-8 representation of the video backend
u8 audioEmulator[16]; // UTF-8 representation of the audio emulator
u8 padBackend[16]; // UTF-8 representation of the input backend
unsigned char md5[16]; // MD5 of game iso
u64 recordingStartTime; // seconds since 1970 that recording started (used for RTC)
@@ -117,8 +117,9 @@ struct DTMHeader {
bool bUseXFB;
bool bUseRealXFB;
bool bMemcard;
bool bBlankMC; // Create a new memory card when playing back a movie if true
u8 reserved[16]; // Padding for any new config options
bool bClearSave; // Create a new memory card when playing back a movie if true
u8 bongos;
u8 reserved[15]; // Padding for any new config options
u8 discChange[40]; // Name of iso file to switch to, for two disc games.
u8 reserved2[47]; // Make heading 256 bytes, just because we can
};
@@ -132,7 +133,6 @@ void Init();
void SetPolledDevice();
bool IsAutoFiring();
bool IsRecordingInput();
bool IsRecordingInputFromSaveState();
bool IsJustStartingRecordingInputFromSaveState();
@@ -148,12 +148,14 @@ bool IsSkipIdle();
bool IsDSPHLE();
bool IsFastDiscSpeed();
int GetCPUMode();
bool IsBlankMemcard();
bool IsStartingFromClearSave();
bool IsUsingMemcard();
void SetGraphicsConfig();
void GetSettings();
bool IsUsingPad(int controller);
bool IsUsingWiimote(int wiimote);
bool IsUsingBongo(int controller);
void ChangePads(bool instantly = false);
void ChangeWiiPads(bool instantly = false);
@@ -166,7 +168,7 @@ void FrameSkipping();
bool BeginRecordingInput(int controllers);
void RecordInput(SPADStatus *PadStatus, int controllerID);
void RecordWiimote(int wiimote, u8* data, const struct WiimoteEmu::ReportFeatures& rptf, int irMode);
void RecordWiimote(int wiimote, u8 *data, u8 size);
bool PlayInput(const char *filename);
void LoadInput(const char *filename);
@@ -176,6 +178,11 @@ bool PlayWiimote(int wiimote, u8* data, const struct WiimoteEmu::ReportFeatures&
void EndPlayInput(bool cont);
void SaveRecording(const char *filename);
void DoState(PointerWrap &p);
void CheckMD5();
void GetMD5();
void Shutdown();
void CheckPadStatus(SPADStatus *PadStatus, int controllerID);
void CheckWiimoteStatus(int wiimote, u8* data, const struct WiimoteEmu::ReportFeatures& rptf, int irMode);
std::string GetInputDisplay();
@@ -186,4 +193,4 @@ void SetInputManip(ManipFunction);
void CallInputManip(SPADStatus *PadStatus, int controllerID);
};
#endif // __FRAME_H
#endif // __MOVIE_H
@@ -295,6 +295,7 @@ static GekkoOPTemplate table31_2[] =
{266, Interpreter::addx, {"addx", OPTYPE_INTEGER, FL_OUT_D | FL_IN_AB | FL_RC_BIT, 0, 0, 0, 0}},
{778, Interpreter::addx, {"addox", OPTYPE_INTEGER, FL_OUT_D | FL_IN_AB | FL_RC_BIT, 0, 0, 0, 0}},
{10, Interpreter::addcx, {"addcx", OPTYPE_INTEGER, FL_OUT_D | FL_IN_AB | FL_SET_CA | FL_RC_BIT, 0, 0, 0, 0}},
{522, Interpreter::addcx, {"addcox", OPTYPE_INTEGER, FL_OUT_D | FL_IN_AB | FL_SET_CA | FL_RC_BIT, 0, 0, 0, 0}},
{138, Interpreter::addex, {"addex", OPTYPE_INTEGER, FL_OUT_D | FL_IN_AB | FL_READ_CA | FL_SET_CA | FL_RC_BIT, 0, 0, 0, 0}},
{234, Interpreter::addmex, {"addmex", OPTYPE_INTEGER, FL_OUT_D | FL_IN_AB | FL_READ_CA | FL_SET_CA | FL_RC_BIT, 0, 0, 0, 0}},
{202, Interpreter::addzex, {"addzex", OPTYPE_INTEGER, FL_OUT_D | FL_IN_AB | FL_READ_CA | FL_SET_CA | FL_RC_BIT, 0, 0, 0, 0}},
@@ -310,6 +311,7 @@ static GekkoOPTemplate table31_2[] =
{40, Interpreter::subfx, {"subfx", OPTYPE_INTEGER, FL_OUT_D | FL_IN_AB | FL_RC_BIT, 0, 0, 0, 0}},
{552, Interpreter::subfx, {"subox", OPTYPE_INTEGER, FL_OUT_D | FL_IN_AB | FL_RC_BIT, 0, 0, 0, 0}},
{8, Interpreter::subfcx, {"subfcx", OPTYPE_INTEGER, FL_OUT_D | FL_IN_AB | FL_SET_CA | FL_RC_BIT, 0, 0, 0, 0}},
{520, Interpreter::subfcx, {"subfcox", OPTYPE_INTEGER, FL_OUT_D | FL_IN_AB | FL_SET_CA | FL_RC_BIT, 0, 0, 0, 0}},
{136, Interpreter::subfex, {"subfex", OPTYPE_INTEGER, FL_OUT_D | FL_IN_AB | FL_READ_CA | FL_SET_CA | FL_RC_BIT, 0, 0, 0, 0}},
{232, Interpreter::subfmex, {"subfmex", OPTYPE_INTEGER, FL_OUT_D | FL_IN_AB | FL_READ_CA | FL_SET_CA | FL_RC_BIT, 0, 0, 0, 0}},
{200, Interpreter::subfzex, {"subfzex", OPTYPE_INTEGER, FL_OUT_D | FL_IN_AB | FL_READ_CA | FL_SET_CA | FL_RC_BIT, 0, 0, 0, 0}},
@@ -308,6 +308,7 @@ static GekkoOPTemplate table31_2[] =
{266, &Jit64::addx}, //"addx", OPTYPE_INTEGER, FL_OUT_D | FL_IN_AB | FL_RC_BIT}},
{778, &Jit64::addx}, //"addx", OPTYPE_INTEGER, FL_OUT_D | FL_IN_AB | FL_RC_BIT}},
{10, &Jit64::addcx}, //"addcx", OPTYPE_INTEGER, FL_OUT_D | FL_IN_AB | FL_SET_CA | FL_RC_BIT}},
{522, &Jit64::addcx}, //"addcox", OPTYPE_INTEGER, FL_OUT_D | FL_IN_AB | FL_SET_CA | FL_RC_BIT}},
{138, &Jit64::addex}, //"addex", OPTYPE_INTEGER, FL_OUT_D | FL_IN_AB | FL_READ_CA | FL_SET_CA | FL_RC_BIT}},
{234, &Jit64::addmex}, //"addmex", OPTYPE_INTEGER, FL_OUT_D | FL_IN_AB | FL_READ_CA | FL_SET_CA | FL_RC_BIT}},
{202, &Jit64::addzex}, //"addzex", OPTYPE_INTEGER, FL_OUT_D | FL_IN_AB | FL_READ_CA | FL_SET_CA | FL_RC_BIT}},
@@ -323,6 +324,7 @@ static GekkoOPTemplate table31_2[] =
{40, &Jit64::subfx}, //"subfx", OPTYPE_INTEGER, FL_OUT_D | FL_IN_AB | FL_RC_BIT}},
{552, &Jit64::subfx}, //"subox", OPTYPE_INTEGER, FL_OUT_D | FL_IN_AB | FL_RC_BIT}},
{8, &Jit64::subfcx}, //"subfcx", OPTYPE_INTEGER, FL_OUT_D | FL_IN_AB | FL_SET_CA | FL_RC_BIT}},
{520, &Jit64::subfcx}, //"subfcox", OPTYPE_INTEGER, FL_OUT_D | FL_IN_AB | FL_SET_CA | FL_RC_BIT}},
{136, &Jit64::subfex}, //"subfex", OPTYPE_INTEGER, FL_OUT_D | FL_IN_AB | FL_READ_CA | FL_SET_CA | FL_RC_BIT}},
{232, &Jit64::subfmex}, //"subfmex", OPTYPE_INTEGER, FL_OUT_D | FL_IN_AB | FL_READ_CA | FL_SET_CA | FL_RC_BIT}},
{200, &Jit64::subfzex}, //"subfzex", OPTYPE_INTEGER, FL_OUT_D | FL_IN_AB | FL_READ_CA | FL_SET_CA | FL_RC_BIT}},
@@ -1097,7 +1097,7 @@ void Jit64::mulli(UGeckoInstruction inst)
gpr.BindToRegister(d, (d == a), true);
if (imm == 0)
XOR(32, gpr.R(d), gpr.R(d));
else if(imm == -1)
else if(imm == (u32)-1)
{
if (d != a)
MOV(32, gpr.R(d), gpr.R(a));
@@ -1147,7 +1147,7 @@ void Jit64::mullwx(UGeckoInstruction inst)
int src = gpr.R(a).IsImm() ? b : a;
if (imm == 0)
XOR(32, gpr.R(d), gpr.R(d));
else if(imm == -1)
else if(imm == (u32)-1)
{
if (d != src)
MOV(32, gpr.R(d), gpr.R(src));
@@ -1263,7 +1263,7 @@ void Jit64::divwux(UGeckoInstruction inst)
while(!(divisor & (1 << shift)))
shift--;
if (divisor == (1 << shift))
if (divisor == (u32)(1 << shift))
{
gpr.Lock(a, b, d);
gpr.BindToRegister(d, d == a, true);
@@ -1387,7 +1387,7 @@ void Jit64::divwx(UGeckoInstruction inst)
if (gpr.R(a).IsImm() && gpr.R(b).IsImm())
{
s32 i = (s32)gpr.R(a).offset, j = (s32)gpr.R(b).offset;
if( j == 0 || i == 0x80000000 && j == -1)
if( j == 0 || (i == (s32)0x80000000 && j == -1))
{
gpr.SetImmediate32(d, (i >> 31) ^ j);
if (inst.OE)
@@ -472,10 +472,10 @@ static OpArg regBuildMemAddress(RegInfo& RI, InstLoc I, InstLoc AI,
#else
// 64-bit
if (Profiled) {
RI.Jit->LEA(32, EAX, M((void*)addr));
RI.Jit->LEA(32, EAX, M((void*)(u64)addr));
return MComplex(RBX, EAX, SCALE_1, 0);
}
return M((void*)addr);
return M((void*)(u64)addr);
#endif
}
}
@@ -309,6 +309,7 @@ static GekkoOPTemplate table31_2[] =
{266, &JitIL::addx}, //"addx", OPTYPE_INTEGER, FL_OUT_D | FL_IN_AB | FL_RC_BIT}},
{778, &JitIL::addx}, //"addx", OPTYPE_INTEGER, FL_OUT_D | FL_IN_AB | FL_RC_BIT}},
{10, &JitIL::Default}, //"addcx", OPTYPE_INTEGER, FL_OUT_D | FL_IN_AB | FL_SET_CA | FL_RC_BIT}},
{522, &JitIL::Default}, //"addcox", OPTYPE_INTEGER, FL_OUT_D | FL_IN_AB | FL_SET_CA | FL_RC_BIT}},
{138, &JitIL::addex}, //"addex", OPTYPE_INTEGER, FL_OUT_D | FL_IN_AB | FL_READ_CA | FL_SET_CA | FL_RC_BIT}},
{234, &JitIL::Default}, //"addmex", OPTYPE_INTEGER, FL_OUT_D | FL_IN_AB | FL_READ_CA | FL_SET_CA | FL_RC_BIT}},
{202, &JitIL::addzex}, //"addzex", OPTYPE_INTEGER, FL_OUT_D | FL_IN_AB | FL_READ_CA | FL_SET_CA | FL_RC_BIT}},
@@ -324,6 +325,7 @@ static GekkoOPTemplate table31_2[] =
{40, &JitIL::subfx}, //"subfx", OPTYPE_INTEGER, FL_OUT_D | FL_IN_AB | FL_RC_BIT}},
{552, &JitIL::subfx}, //"subox", OPTYPE_INTEGER, FL_OUT_D | FL_IN_AB | FL_RC_BIT}},
{8, &JitIL::subfcx}, //"subfcx", OPTYPE_INTEGER, FL_OUT_D | FL_IN_AB | FL_SET_CA | FL_RC_BIT}},
{520, &JitIL::subfcx}, //"subfcox", OPTYPE_INTEGER, FL_OUT_D | FL_IN_AB | FL_SET_CA | FL_RC_BIT}},
{136, &JitIL::subfex}, //"subfex", OPTYPE_INTEGER, FL_OUT_D | FL_IN_AB | FL_READ_CA | FL_SET_CA | FL_RC_BIT}},
{232, &JitIL::Default}, //"subfmex", OPTYPE_INTEGER, FL_OUT_D | FL_IN_AB | FL_READ_CA | FL_SET_CA | FL_RC_BIT}},
{200, &JitIL::Default}, //"subfzex", OPTYPE_INTEGER, FL_OUT_D | FL_IN_AB | FL_READ_CA | FL_SET_CA | FL_RC_BIT}},
+1 -1
View File
@@ -144,7 +144,7 @@ void Init(int cpu_core)
#ifdef _WIN32
_control87(_PC_53, MCW_PC);
#else
unsigned short _mode;
unsigned short _mode = 0;
asm ("fstcw %0" : : "m" (_mode));
_mode = (_mode & ~FPU_PREC_MASK) | FPU_PREC_53;
asm ("fldcw %0" : : "m" (_mode));
+5 -2
View File
@@ -71,7 +71,7 @@ static Common::Event g_compressAndDumpStateSyncEvent;
static std::thread g_save_thread;
// Don't forget to increase this after doing changes on the savestate system
static const int STATE_VERSION = 8;
static const u32 STATE_VERSION = 10;
struct StateHeader
{
@@ -199,8 +199,10 @@ void CompressAndDumpState(CompressAndDumpState_args save_args)
if (File::Exists(File::GetUserPath(D_STATESAVES_IDX) + "lastState.sav.dtm"))
File::Delete((File::GetUserPath(D_STATESAVES_IDX) + "lastState.sav.dtm"));
if (!File::Rename(filename, File::GetUserPath(D_STATESAVES_IDX) + "lastState.sav") || !File::Rename(filename + ".dtm", File::GetUserPath(D_STATESAVES_IDX) + "lastState.sav.dtm"))
if (!File::Rename(filename, File::GetUserPath(D_STATESAVES_IDX) + "lastState.sav"))
Core::DisplayMessage("Failed to move previous state to state undo backup", 1000);
else
File::Rename(filename + ".dtm", File::GetUserPath(D_STATESAVES_IDX) + "lastState.sav.dtm");
}
if ((Movie::IsRecordingInput() || Movie::IsPlayingInput()) && !Movie::IsJustStartingRecordingInputFromSaveState())
Movie::SaveRecording((filename + ".dtm").c_str());
@@ -385,6 +387,7 @@ void LoadAs(const std::string& filename)
g_loadDepth++;
// Save temp buffer for undo load state
if (!Movie::IsJustStartingRecordingInputFromSaveState())
{
std::lock_guard<std::mutex> lk(g_cs_undo_load_buffer);
SaveToBuffer(g_undo_load_buffer);
+1
View File
@@ -153,6 +153,7 @@ if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/postprocess_bundle.cmake "
include(BundleUtilities)
message(\"Fixing up application bundle: ${BUNDLE_PATH}\")
set(BU_CHMOD_BUNDLE_ITEMS ON)
fixup_bundle(\"${BUNDLE_PATH}\" \"\" \"\")
")
add_custom_command(TARGET ${DOLPHIN_EXE} POST_BUILD
+3 -1
View File
@@ -201,6 +201,8 @@ xcopy "$(SolutionDir)..\Externals\SDL\$(PlatformName)\*.dll" "$(TargetDir)" /e /
</Command>
<Message>Copying Data\* to $(TargetDir)</Message>
</PostBuildEvent>
<ResourceCompile>
</ResourceCompile>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='DebugFast|x64'">
<ClCompile>
@@ -387,4 +389,4 @@ xcopy "$(SolutionDir)..\Externals\SDL\$(PlatformName)\*.dll" "$(TargetDir)" /e /
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>
</Project>
+4
View File
@@ -2,3 +2,7 @@
//
#include "resource.h"
IDI_ICON1 ICON "..\\..\\..\\Installer\\Dolphin.ico"
"dolphin" ICON "..\\..\\..\\Installer\\Dolphin.ico"
#define wxUSE_NO_MANIFEST 1
#include <wx/msw/wx.rc>
+2 -1
View File
@@ -36,7 +36,7 @@ extern CFrame* main_frame;
static wxCheatsWindow *g_cheat_window;
wxCheatsWindow::wxCheatsWindow(wxWindow* const parent)
: wxDialog(parent, wxID_ANY, _("Cheats Manager"), wxDefaultPosition, wxDefaultSize)
: wxDialog(parent, wxID_ANY, _("Cheats Manager"), wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER|wxMAXIMIZE_BOX|wxMINIMIZE_BOX|wxDIALOG_NO_PARENT)
{
::g_cheat_window = this;
@@ -57,6 +57,7 @@ wxCheatsWindow::wxCheatsWindow(wxWindow* const parent)
}
}
SetSize(wxSize(-1, 600));
Center();
Show();
}
+10
View File
@@ -125,6 +125,7 @@ EVT_SLIDER(ID_VOLUME, CConfigMain::AudioSettingsChanged)
EVT_CHECKBOX(ID_INTERFACE_CONFIRMSTOP, CConfigMain::DisplaySettingsChanged)
EVT_CHECKBOX(ID_INTERFACE_USEPANICHANDLERS, CConfigMain::DisplaySettingsChanged)
EVT_CHECKBOX(ID_INTERFACE_ONSCREENDISPLAYMESSAGES, CConfigMain::DisplaySettingsChanged)
EVT_RADIOBOX(ID_INTERFACE_THEME, CConfigMain::DisplaySettingsChanged)
EVT_CHOICE(ID_INTERFACE_LANG, CConfigMain::DisplaySettingsChanged)
EVT_BUTTON(ID_HOTKEY_CONFIG, CConfigMain::DisplaySettingsChanged)
@@ -337,6 +338,7 @@ void CConfigMain::InitializeGUIValues()
// Display - Interface
ConfirmStop->SetValue(startup_params.bConfirmStop);
UsePanicHandlers->SetValue(startup_params.bUsePanicHandlers);
OnScreenDisplayMessages->SetValue(startup_params.bOnScreenDisplayMessages);
Theme->SetSelection(startup_params.iTheme);
// need redesign
for (unsigned int i = 0; i < sizeof(langIds) / sizeof(wxLanguage); i++)
@@ -490,6 +492,7 @@ void CConfigMain::InitializeGUITooltips()
// Display - Interface
ConfirmStop->SetToolTip(_("Show a confirmation box before stopping a game."));
UsePanicHandlers->SetToolTip(_("Show a message box when a potentially serious error has occured.\nDisabling this may avoid annoying and non-fatal messages, but it may also mean that Dolphin suddenly crashes without any explanation at all."));
OnScreenDisplayMessages->SetToolTip(_("Show messages on the emulation screen area.\nThese messages include memory card writes, video backend and CPU information, and JIT cache clearing."));
// Display - Themes: Copyright notice
Theme->SetItemToolTip(0, _("Created by Milosz Wlazlo [[email protected], miloszwl.deviantart.com]"));
@@ -579,6 +582,8 @@ void CConfigMain::CreateGUIControls()
wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
UsePanicHandlers = new wxCheckBox(DisplayPage, ID_INTERFACE_USEPANICHANDLERS,
_("Use Panic Handlers"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
OnScreenDisplayMessages = new wxCheckBox(DisplayPage, ID_INTERFACE_ONSCREENDISPLAYMESSAGES,
_("On-Screen Display Messages"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator);
wxBoxSizer* sInterface = new wxBoxSizer(wxHORIZONTAL);
sInterface->Add(TEXT_BOX(DisplayPage, _("Language:")), 0, wxALIGN_CENTER_VERTICAL | wxALL, 5);
@@ -588,6 +593,7 @@ void CConfigMain::CreateGUIControls()
sbInterface = new wxStaticBoxSizer(wxVERTICAL, DisplayPage, _("Interface Settings"));
sbInterface->Add(ConfirmStop, 0, wxALL, 5);
sbInterface->Add(UsePanicHandlers, 0, wxALL, 5);
sbInterface->Add(OnScreenDisplayMessages, 0, wxALL, 5);
sbInterface->Add(Theme, 0, wxEXPAND | wxALL, 5);
sbInterface->Add(sInterface, 0, wxEXPAND | wxALL, 5);
@@ -865,6 +871,10 @@ void CConfigMain::DisplaySettingsChanged(wxCommandEvent& event)
SConfig::GetInstance().m_LocalCoreStartupParameter.bUsePanicHandlers = UsePanicHandlers->IsChecked();
SetEnableAlert(UsePanicHandlers->IsChecked());
break;
case ID_INTERFACE_ONSCREENDISPLAYMESSAGES:
SConfig::GetInstance().m_LocalCoreStartupParameter.bOnScreenDisplayMessages = OnScreenDisplayMessages->IsChecked();
SetEnableAlert(OnScreenDisplayMessages->IsChecked());
break;
case ID_INTERFACE_THEME:
SConfig::GetInstance().m_LocalCoreStartupParameter.iTheme = Theme->GetSelection();
main_frame->InitBitmaps();
+2
View File
@@ -86,6 +86,7 @@ private:
// Interface settings
ID_INTERFACE_CONFIRMSTOP,
ID_INTERFACE_USEPANICHANDLERS,
ID_INTERFACE_ONSCREENDISPLAYMESSAGES,
ID_INTERFACE_THEME,
ID_INTERFACE_LANG,
ID_HOTKEY_CONFIG,
@@ -163,6 +164,7 @@ private:
// Interface
wxCheckBox* ConfirmStop;
wxCheckBox* UsePanicHandlers;
wxCheckBox* OnScreenDisplayMessages;
wxRadioBox* Theme;
wxChoice* InterfaceLang;
wxButton* HotkeyConfig;
@@ -319,7 +319,7 @@ void CCodeWindow::UpdateLists()
{
int idx = callers->Append(wxString::FromAscii(StringFromFormat
("< %s (%08x)", caller_symbol->name.c_str(), caller_addr).c_str()));
callers->SetClientData(idx, (void*)caller_addr);
callers->SetClientData(idx, (void*)(u64)caller_addr);
}
}
@@ -332,7 +332,7 @@ void CCodeWindow::UpdateLists()
{
int idx = calls->Append(wxString::FromAscii(StringFromFormat
("> %s (%08x)", call_symbol->name.c_str(), call_addr).c_str()));
calls->SetClientData(idx, (void*)call_addr);
calls->SetClientData(idx, (void*)(u64)call_addr);
}
}
}
@@ -139,7 +139,7 @@ void DSPDebuggerLLE::OnChangeState(wxCommandEvent& event)
if (DSPCore_GetState() == DSPCORE_STEPPING)
{
DSPCore_Step();
Refresh();
Update();
}
break;
@@ -155,10 +155,10 @@ void DSPDebuggerLLE::OnChangeState(wxCommandEvent& event)
void Host_RefreshDSPDebuggerWindow()
{
if (m_DebuggerFrame)
m_DebuggerFrame->Refresh();
m_DebuggerFrame->Update();
}
void DSPDebuggerLLE::Refresh()
void DSPDebuggerLLE::Update()
{
#if defined __WXGTK__
if (!wxIsMainThread())
@@ -50,7 +50,7 @@ public:
DSPDebuggerLLE(wxWindow *parent, wxWindowID id = wxID_ANY);
virtual ~DSPDebuggerLLE();
void Refresh();
void Update();
private:
DECLARE_EVENT_TABLE();
@@ -624,7 +624,6 @@ void FifoPlayerDlg::OnObjectListSelectionChanged(wxCommandEvent& event)
int cmd = *objectdata++;
int stream_size = Common::swap16(objectdata);
objectdata += 2;
int vertex_size = (objectdata_end - objectdata) / stream_size;
wxString newLabel = wxString::Format(wxT("%08X: %02X %04X "), obj_offset, cmd, stream_size);
if ((objectdata_end - objectdata) % stream_size) newLabel += _("NOTE: Stream size doesn't match actual data length\n");
while (objectdata < objectdata_end)
+8 -52
View File
@@ -26,7 +26,6 @@
#include "Common.h" // Common
#include "FileUtil.h"
#include "Timer.h"
#include "Setup.h"
#include "Globals.h" // Local
#include "Frame.h"
@@ -72,30 +71,7 @@ extern "C" {
};
// Windows functions. Setting the cursor with wxSetCursor() did not work in
// this instance. Probably because it's somehow reset from the WndProc() in
// the child window
#ifdef _WIN32
// Declare a blank icon and one that will be the normal cursor
HCURSOR hCursor = NULL, hCursorBlank = NULL;
// Create the default cursor
void CreateCursor()
{
hCursor = LoadCursor( NULL, IDC_ARROW );
}
void MSWSetCursor(bool Show)
{
if(Show)
SetCursor(hCursor);
else
{
SetCursor(hCursorBlank);
//wxSetCursor(wxCursor(wxNullCursor));
}
}
// I could not use FindItemByHWND() instead of this, it crashed on that occation I used it */
HWND MSWGetParent_(HWND Parent)
{
@@ -134,10 +110,11 @@ CPanel::CPanel(
case WM_USER_SETCURSOR:
if (SConfig::GetInstance().m_LocalCoreStartupParameter.bHideCursor &&
main_frame->RendererHasFocus() && Core::GetState() == Core::CORE_RUN)
MSWSetCursor(!SConfig::GetInstance().m_LocalCoreStartupParameter.bHideCursor);
main_frame->RendererHasFocus() && Core::GetState() == Core::CORE_RUN &&
SConfig::GetInstance().m_LocalCoreStartupParameter.bHideCursor)
SetCursor(wxCURSOR_BLANK);
else
MSWSetCursor(true);
SetCursor(wxNullCursor);
break;
case WIIMOTE_DISCONNECT:
@@ -244,6 +221,8 @@ EVT_MENU(IDM_PLAYRECORD, CFrame::OnPlayRecording)
EVT_MENU(IDM_RECORDEXPORT, CFrame::OnRecordExport)
EVT_MENU(IDM_RECORDREADONLY, CFrame::OnRecordReadOnly)
EVT_MENU(IDM_TASINPUT, CFrame::OnTASInput)
EVT_MENU(IDM_TOGGLE_PAUSEMOVIE, CFrame::OnTogglePauseMovie)
EVT_MENU(IDM_SHOWLAG, CFrame::OnShowLag)
EVT_MENU(IDM_FRAMESTEP, CFrame::OnFrameStep)
EVT_MENU(IDM_SCREENSHOT, CFrame::OnScreenshot)
EVT_MENU(wxID_PREFERENCES, CFrame::OnConfigMain)
@@ -434,9 +413,7 @@ CFrame::CFrame(wxFrame* parent,
// Commit
m_Mgr->Update();
// Create cursors
#ifdef _WIN32
CreateCursor();
SetToolTip(wxT(""));
GetToolTip()->SetAutoPop(25000);
#endif
@@ -456,13 +433,6 @@ CFrame::CFrame(wxFrame* parent,
// Update controls
UpdateGUI();
// If we are rerecording create the status bar now instead of later when a game starts
#ifdef RERECORDING
ModifyStatusBar();
// It's to early for the OnHostMessage(), we will update the status when Ctrl or Space is pressed
//Core::WriteStatus();
#endif
}
// Destructor
CFrame::~CFrame()
@@ -500,20 +470,6 @@ void CFrame::OnActive(wxActivateEvent& event)
{
if (event.GetActive() && event.GetEventObject() == m_RenderFrame)
{
// 32x32, 8bpp b/w image
// We want all transparent, so we can just use the same buffer for
// the "image" as for the transparency mask
static const char cursor_data[32 * 32] = { 0 };
#ifdef __WXGTK__
wxCursor cursor_transparent = wxCursor(cursor_data, 32, 32, 6, 14,
cursor_data, wxWHITE, wxBLACK);
#else
wxBitmap cursor_bitmap(cursor_data, 32, 32);
cursor_bitmap.SetMask(new wxMask(cursor_bitmap));
wxCursor cursor_transparent = wxCursor(cursor_bitmap.ConvertToImage());
#endif
#ifdef __WXMSW__
::SetFocus((HWND)m_RenderParent->GetHandle());
#else
@@ -522,7 +478,7 @@ void CFrame::OnActive(wxActivateEvent& event)
if (SConfig::GetInstance().m_LocalCoreStartupParameter.bHideCursor &&
Core::GetState() == Core::CORE_RUN)
m_RenderParent->SetCursor(cursor_transparent);
m_RenderParent->SetCursor(wxCURSOR_BLANK);
}
else
{
@@ -652,12 +608,12 @@ void CFrame::OnHostMessage(wxCommandEvent& event)
}
break;
#ifdef __WXGTK__
case WM_USER_CREATE:
if (SConfig::GetInstance().m_LocalCoreStartupParameter.bHideCursor)
m_RenderParent->SetCursor(wxCURSOR_BLANK);
break;
#ifdef __WXGTK__
case IDM_PANIC:
{
wxString caption = event.GetString().BeforeFirst(':');
+2
View File
@@ -297,6 +297,8 @@ private:
void OnRecordExport(wxCommandEvent& event);
void OnRecordReadOnly(wxCommandEvent& event);
void OnTASInput(wxCommandEvent& event);
void OnTogglePauseMovie(wxCommandEvent& event);
void OnShowLag(wxCommandEvent& event);
void OnChangeDisc(wxCommandEvent& event);
void OnScreenshot(wxCommandEvent& event);
void OnActive(wxActivateEvent& event);
+22 -23
View File
@@ -27,9 +27,6 @@ window handle that is returned by CreateWindow() can be accessed from
Core::GetWindowHandle().
*/
#include "Setup.h" // Common
#include "NetWindow.h"
#include "Common.h" // Common
#include "FileUtil.h"
@@ -142,9 +139,13 @@ void CFrame::CreateMenu()
emulationMenu->Append(IDM_RECORDEXPORT, GetMenuLabel(HK_EXPORT_RECORDING));
emulationMenu->Append(IDM_RECORDREADONLY, GetMenuLabel(HK_READ_ONLY_MODE), wxEmptyString, wxITEM_CHECK);
emulationMenu->Append(IDM_TASINPUT, _("TAS Input"));
emulationMenu->AppendCheckItem(IDM_TOGGLE_PAUSEMOVIE, _("Pause at end of movie"));
emulationMenu->Check(IDM_TOGGLE_PAUSEMOVIE, SConfig::GetInstance().m_PauseMovie);
emulationMenu->AppendCheckItem(IDM_SHOWLAG, _("Show lag counter"));
emulationMenu->Check(IDM_SHOWLAG, SConfig::GetInstance().m_ShowLag);
emulationMenu->Check(IDM_RECORDREADONLY, true);
emulationMenu->AppendSeparator();
emulationMenu->Append(IDM_FRAMESTEP, GetMenuLabel(HK_FRAME_ADVANCE), wxEmptyString);
wxMenu *skippingMenu = new wxMenu;
@@ -702,6 +703,18 @@ void CFrame::OnTASInput(wxCommandEvent& event)
g_TASInputDlg->Show(true);
}
void CFrame::OnTogglePauseMovie(wxCommandEvent& WXUNUSED (event))
{
SConfig::GetInstance().m_PauseMovie = !SConfig::GetInstance().m_PauseMovie;
SConfig::GetInstance().SaveSettings();
}
void CFrame::OnShowLag(wxCommandEvent& WXUNUSED (event))
{
SConfig::GetInstance().m_ShowLag = !SConfig::GetInstance().m_ShowLag;
SConfig::GetInstance().SaveSettings();
}
void CFrame::OnFrameStep(wxCommandEvent& event)
{
bool wasPaused = (Core::GetState() == Core::CORE_PAUSE);
@@ -732,7 +745,7 @@ void CFrame::OnRecord(wxCommandEvent& WXUNUSED (event))
}
for (int i = 0; i < 4; i++) {
if (SConfig::GetInstance().m_SIDevice[i] == SIDEVICE_GC_CONTROLLER)
if (SConfig::GetInstance().m_SIDevice[i] == SIDEVICE_GC_CONTROLLER || SConfig::GetInstance().m_SIDevice[i] == SIDEVICE_GC_TARUKONGA)
controllers |= (1 << i);
if (g_wiimote_sources[i] != WIIMOTE_SRC_NONE)
@@ -1042,27 +1055,14 @@ void CFrame::DoPause()
{
Core::SetState(Core::CORE_PAUSE);
if (SConfig::GetInstance().m_LocalCoreStartupParameter.bHideCursor)
m_RenderParent->SetCursor(wxCURSOR_ARROW);
m_RenderParent->SetCursor(wxNullCursor);
}
else
{
// 32x32, 8bpp b/w image
// We want all transparent, so we can just use the same buffer for
// the "image" as for the transparency mask
static const char cursor_data[32 * 32] = { 0 };
#ifdef __WXGTK__
wxCursor cursor_transparent = wxCursor(cursor_data, 32, 32, 6, 14,
cursor_data, wxWHITE, wxBLACK);
#else
wxBitmap cursor_bitmap(cursor_data, 32, 32);
cursor_bitmap.SetMask(new wxMask(cursor_bitmap));
wxCursor cursor_transparent = wxCursor(cursor_bitmap.ConvertToImage());
#endif
Core::SetState(Core::CORE_RUN);
if (SConfig::GetInstance().m_LocalCoreStartupParameter.bHideCursor &&
RendererHasFocus())
m_RenderParent->SetCursor(cursor_transparent);
m_RenderParent->SetCursor(wxCURSOR_BLANK);
}
UpdateGUI();
}
@@ -1138,7 +1138,7 @@ void CFrame::DoStop()
wxMouseEventHandler(CFrame::OnMouse),
(wxObject*)0, this);
if (SConfig::GetInstance().m_LocalCoreStartupParameter.bHideCursor)
m_RenderParent->SetCursor(wxCURSOR_ARROW);
m_RenderParent->SetCursor(wxNullCursor);
DoFullscreen(false);
if (!SConfig::GetInstance().m_LocalCoreStartupParameter.bRenderToMain)
m_RenderFrame->Destroy();
@@ -1307,9 +1307,8 @@ void CFrame::StatusBarMessage(const char * Text, ...)
const int MAX_BYTES = 1024*10;
char Str[MAX_BYTES];
va_list ArgPtr;
int Cnt;
va_start(ArgPtr, Text);
Cnt = vsnprintf(Str, MAX_BYTES, Text, ArgPtr);
vsnprintf(Str, MAX_BYTES, Text, ArgPtr);
va_end(ArgPtr);
if (this->GetStatusBar()->IsEnabled()) this->GetStatusBar()->SetStatusText(wxString::FromAscii(Str),0);
+23 -6
View File
@@ -51,6 +51,7 @@
size_t CGameListCtrl::m_currentItem = 0;
size_t CGameListCtrl::m_numberItem = 0;
std::string CGameListCtrl::m_currentFilename;
bool sorted = false;
static int CompareGameListItems(const GameListItem* iso1, const GameListItem* iso2,
long sortData = CGameListCtrl::COLUMN_TITLE)
@@ -284,6 +285,7 @@ void CGameListCtrl::Update()
InitBitmaps();
// add columns
InsertColumn(COLUMN_DUMMY,_T(""));
InsertColumn(COLUMN_PLATFORM, _T(""));
InsertColumn(COLUMN_BANNER, _("Banner"));
InsertColumn(COLUMN_TITLE, _("Title"));
@@ -303,6 +305,7 @@ void CGameListCtrl::Update()
#endif
// set initial sizes for columns
SetColumnWidth(COLUMN_DUMMY,0);
SetColumnWidth(COLUMN_PLATFORM, 35 + platform_padding);
SetColumnWidth(COLUMN_BANNER, 96 + platform_padding);
SetColumnWidth(COLUMN_TITLE, 200 + platform_padding);
@@ -320,9 +323,14 @@ void CGameListCtrl::Update()
// Sort items by Title
wxListEvent event;
event.m_col = COLUMN_TITLE; last_column = 0;
event.m_col = SConfig::GetInstance().m_ListSort2;
last_column = 1;
OnColumnClick(event);
event.m_col = SConfig::GetInstance().m_ListSort;
OnColumnClick(event);
sorted = true;
SetColumnWidth(COLUMN_SIZE, wxLIST_AUTOSIZE);
}
else
@@ -414,9 +422,11 @@ void CGameListCtrl::InsertItemInReportView(long _Index)
GameListItem& rISOFile = *m_ISOFiles[_Index];
m_gamePath.append(rISOFile.GetFileName() + '\n');
// Insert a first row with the platform image, that will be used as the Index
long ItemIndex = InsertItem(_Index, wxEmptyString,
m_PlatformImageIndex[rISOFile.GetPlatform()]);
// Insert a first row with nothing in it, that will be used as the Index
long ItemIndex = InsertItem(_Index, wxEmptyString);
// Insert the platform's image in the first (visible) column
SetItemColumnImage(_Index, COLUMN_PLATFORM, m_PlatformImageIndex[rISOFile.GetPlatform()]);
if (rISOFile.GetImage().IsOk())
ImageIndex = m_imageListSmall->Add(rISOFile.GetImage());
@@ -652,7 +662,11 @@ void CGameListCtrl::ScanForISOs()
for (std::vector<std::string>::const_iterator iter = drives.begin(); iter != drives.end(); ++iter)
{
#ifdef __APPLE__
std::auto_ptr<GameListItem> gli(new GameListItem(*iter));
#else
std::unique_ptr<GameListItem> gli(new GameListItem(*iter));
#endif
if (gli->IsValid())
m_ISOFiles.push_back(gli.release());
@@ -698,16 +712,19 @@ void CGameListCtrl::OnColumnClick(wxListEvent& event)
{
int current_column = event.GetColumn();
if(last_column == current_column)
if (last_column == current_column)
{
last_sort = -last_sort;
}
else
{
if (sorted)
SConfig::GetInstance().m_ListSort2 = last_sort;
last_column = current_column;
last_sort = current_column;
}
if (sorted)
SConfig::GetInstance().m_ListSort = last_sort;
caller = this;
SortItems(wxListCompare, last_sort);
}
+2 -1
View File
@@ -57,7 +57,8 @@ public:
enum
{
COLUMN_PLATFORM = 0,
COLUMN_DUMMY = 0,
COLUMN_PLATFORM,
COLUMN_BANNER,
COLUMN_TITLE,
COLUMN_NOTES,
+2
View File
@@ -80,6 +80,8 @@ enum
IDM_RECORDEXPORT,
IDM_RECORDREADONLY,
IDM_TASINPUT,
IDM_TOGGLE_PAUSEMOVIE,
IDM_SHOWLAG,
IDM_FRAMESTEP,
IDM_SCREENSHOT,
IDM_BROWSE,
+1 -1
View File
@@ -285,7 +285,7 @@ bool GameListItem::GetName(std::wstring& wName, int index) const
index++;
if ((index >=0) && (index < 10))
{
if (m_wNames.size() > index)
if (m_wNames.size() > (size_t)index)
{
wName = m_wNames[index];
return true;
+1 -2
View File
@@ -687,14 +687,13 @@ void CISOProperties::OnExtractFile(wxCommandEvent& WXUNUSED (event))
void CISOProperties::ExportDir(const char* _rFullPath, const char* _rExportFolder, const int partitionNum)
{
char exportName[512];
u32 index[2] = {0, 0}, offsetShift = 0;
u32 index[2] = {0, 0};
std::vector<const DiscIO::SFileInfo *> fst;
DiscIO::IFileSystem *FS = 0;
if (DiscIO::IsVolumeWiiDisc(OpenISO))
{
FS = WiiDisc.at(partitionNum).FileSystem;
offsetShift = 2;
}
else
FS = pFileSystem;
+15 -9
View File
@@ -28,7 +28,6 @@
#include "CPUDetect.h"
#include "IniFile.h"
#include "FileUtil.h"
#include "Setup.h"
#include "Host.h" // Core
#include "HW/Wiimote.h"
@@ -116,37 +115,37 @@ bool DolphinApp::OnInit()
{
{
wxCMD_LINE_SWITCH, "h", "help",
_("Show this help message"),
"Show this help message",
wxCMD_LINE_VAL_NONE, wxCMD_LINE_OPTION_HELP
},
{
wxCMD_LINE_SWITCH, "d", "debugger",
_("Opens the debugger"),
"Opens the debugger",
wxCMD_LINE_VAL_NONE, wxCMD_LINE_PARAM_OPTIONAL
},
{
wxCMD_LINE_SWITCH, "l", "logger",
_("Opens the logger"),
"Opens the logger",
wxCMD_LINE_VAL_NONE, wxCMD_LINE_PARAM_OPTIONAL
},
{
wxCMD_LINE_OPTION, "e", "exec",
_("Loads the specified file (DOL,ELF,GCM,ISO,WAD)"),
"Loads the specified file (DOL,ELF,GCM,ISO,WAD)",
wxCMD_LINE_VAL_STRING, wxCMD_LINE_PARAM_OPTIONAL
},
{
wxCMD_LINE_SWITCH, "b", "batch",
_("Exit Dolphin with emulator"),
"Exit Dolphin with emulator",
wxCMD_LINE_VAL_NONE, wxCMD_LINE_PARAM_OPTIONAL
},
{
wxCMD_LINE_OPTION, "V", "video_backend",
_("Specify a video backend"),
"Specify a video backend",
wxCMD_LINE_VAL_STRING, wxCMD_LINE_PARAM_OPTIONAL
},
{
wxCMD_LINE_OPTION, "A", "audio_emulation",
_("Low level (LLE) or high level (HLE) audio"),
"Low level (LLE) or high level (HLE) audio",
wxCMD_LINE_VAL_STRING, wxCMD_LINE_PARAM_OPTIONAL
},
{
@@ -167,7 +166,6 @@ bool DolphinApp::OnInit()
BatchMode = parser.Found(wxT("batch"));
selectVideoBackend = parser.Found(wxT("video_backend"),
&videoBackendName);
// TODO: This currently has no effect. Implement or delete.
selectAudioEmulation = parser.Found(wxT("audio_emulation"),
&audioEmulationName);
#endif // wxUSE_CMDLINE_PARSER
@@ -237,6 +235,14 @@ bool DolphinApp::OnInit()
SConfig::GetInstance().m_LocalCoreStartupParameter.m_strVideoBackend =
std::string(videoBackendName.mb_str());
if (selectAudioEmulation)
{
if (audioEmulationName == "HLE")
SConfig::GetInstance().m_LocalCoreStartupParameter.bDSPHLE = true;
else if (audioEmulationName == "LLE")
SConfig::GetInstance().m_LocalCoreStartupParameter.bDSPHLE = false;
}
VideoBackend::ActivateBackend(SConfig::GetInstance().m_LocalCoreStartupParameter.m_strVideoBackend);
// Enable the PNG image handler for screenshots
@@ -751,7 +751,6 @@ void TASInputDlg::OnMouseUpR(wxMouseEvent& event)
return;
}
wxPoint ptM(event.GetPosition());
*x = 128;
*y = 128;
+1 -1
View File
@@ -112,7 +112,7 @@ protected:
void Event_ProgressiveScan(wxCommandEvent &ev)
{
SConfig::GetInstance().m_SYSCONF->SetData("IPL.PGS", ev.GetInt());
SConfig::GetInstance().m_LocalCoreStartupParameter.bProgressive = ev.GetInt();
SConfig::GetInstance().m_LocalCoreStartupParameter.bProgressive = ev.IsChecked();
ev.Skip();
}
@@ -61,7 +61,7 @@ public:
}
void OnReconnectOnLoad(wxCommandEvent& event)
{
SConfig::GetInstance().m_WiimoteReconnectOnLoad = event.GetInt();
SConfig::GetInstance().m_WiimoteReconnectOnLoad = event.IsChecked();
event.Skip();
}
+1 -1
View File
@@ -225,7 +225,7 @@ void XRRConfiguration::Update()
}
else
sscanf(SConfig::GetInstance().m_LocalCoreStartupParameter.strFullscreenResolution.c_str(),
"%a[^:]: %ux%u", &output_name, &fullWidth, &fullHeight);
"%m[^:]: %ux%u", &output_name, &fullWidth, &fullHeight);
for (int i = 0; i < screenResources->noutput; i++)
{
@@ -1,5 +1,7 @@
#include "Xlib.h"
#include <X11/XKBlib.h>
namespace ciface
{
namespace Xlib
@@ -93,7 +95,7 @@ KeyboardMouse::Key::Key(Display* const display, KeyCode keycode, const char* key
KeySym keysym = 0;
do
{
keysym = XKeycodeToKeysym(m_display, keycode, i);
keysym = XkbKeycodeToKeysym(m_display, keycode, i, 0);
i++;
}
while (keysym == NoSymbol && i < 8);
+4 -4
View File
@@ -361,9 +361,9 @@ u32 AnalyzeAndRunDisplayList(u32 address, u32 size, CachedDisplayList *dl)
(cmd_byte & GX_PRIMITIVE_MASK) >> GX_PRIMITIVE_SHIFT,
numVertices);
num_draw_call++;
const int tc[12] = {
const u32 tc[12] = {
g_VtxDesc.Position, g_VtxDesc.Normal, g_VtxDesc.Color0, g_VtxDesc.Color1, g_VtxDesc.Tex0Coord, g_VtxDesc.Tex1Coord,
g_VtxDesc.Tex2Coord, g_VtxDesc.Tex3Coord, g_VtxDesc.Tex4Coord, g_VtxDesc.Tex5Coord, g_VtxDesc.Tex6Coord, (const int)((g_VtxDesc.Hex >> 31) & 3)
g_VtxDesc.Tex2Coord, g_VtxDesc.Tex3Coord, g_VtxDesc.Tex4Coord, g_VtxDesc.Tex5Coord, g_VtxDesc.Tex6Coord, (const u32)((g_VtxDesc.Hex >> 31) & 3)
};
for(int i = 0; i < 12; i++)
{
@@ -563,9 +563,9 @@ void CompileAndRunDisplayList(u32 address, u32 size, CachedDisplayList *dl)
dl->InsertRegion(NewRegion);
memcpy(NewRegion->start_address, StartAddress, Vdatasize);
emitter.ABI_CallFunctionCCCP((void *)&VertexLoaderManager::RunCompiledVertices, cmd_byte & GX_VAT_MASK, (cmd_byte & GX_PRIMITIVE_MASK) >> GX_PRIMITIVE_SHIFT, numVertices, NewRegion->start_address);
const int tc[12] = {
const u32 tc[12] = {
g_VtxDesc.Position, g_VtxDesc.Normal, g_VtxDesc.Color0, g_VtxDesc.Color1, g_VtxDesc.Tex0Coord, g_VtxDesc.Tex1Coord,
g_VtxDesc.Tex2Coord, g_VtxDesc.Tex3Coord, g_VtxDesc.Tex4Coord, g_VtxDesc.Tex5Coord, g_VtxDesc.Tex6Coord, (const int)((g_VtxDesc.Hex >> 31) & 3)
g_VtxDesc.Tex2Coord, g_VtxDesc.Tex3Coord, g_VtxDesc.Tex4Coord, g_VtxDesc.Tex5Coord, g_VtxDesc.Tex6Coord, (const u32)((g_VtxDesc.Hex >> 31) & 3)
};
for(int i = 0; i < 12; i++)
{
-12
View File
@@ -72,21 +72,9 @@ void GFXDebuggerCheckAndPause(bool update);
void GFXDebuggerToPause(bool update);
void GFXDebuggerUpdateScreen();
#undef ENABLE_GFX_DEBUGGER
#if defined(_DEBUG) || defined(DEBUGFAST)
#define ENABLE_GFX_DEBUGGER
#endif
#ifdef ENABLE_GFX_DEBUGGER
#define GFX_DEBUGGER_PAUSE_AT(event,update) {if (((GFXDebuggerToPauseAtNext & event) && --GFXDebuggerEventToPauseCount<=0) || GFXDebuggerPauseFlag) GFXDebuggerToPause(update);}
#define GFX_DEBUGGER_PAUSE_LOG_AT(event,update,dumpfunc) {if (((GFXDebuggerToPauseAtNext & event) && --GFXDebuggerEventToPauseCount<=0) || GFXDebuggerPauseFlag) {{dumpfunc};GFXDebuggerToPause(update);}}
#define GFX_DEBUGGER_LOG_AT(event,dumpfunc) {if (( GFXDebuggerToPauseAtNext & event ) ) {{dumpfunc};}}
#else
// Disable debugging calls in Release build
#define GFX_DEBUGGER_PAUSE_AT(event,update)
#define GFX_DEBUGGER_PAUSE_LOG_AT(event,update,dumpfunc)
#define GFX_DEBUGGER_LOG_AT(event,dumpfunc)
#endif // ENABLE_GFX_DEBUGGER
#endif // _GFX_DEBUGGER_H_
-1
View File
@@ -16,7 +16,6 @@
// http://code.google.com/p/dolphin-emu/
#include "VideoConfig.h"
#include "Setup.h"
#include "MemoryUtil.h"
#include "Thread.h"
#include "Atomic.h"
@@ -10,6 +10,9 @@ XFBSourceBase *FramebufferManagerBase::m_realXFBSource; // Only used in Real XFB
FramebufferManagerBase::VirtualXFBListType FramebufferManagerBase::m_virtualXFBList; // Only used in Virtual XFB mode
const XFBSourceBase* FramebufferManagerBase::m_overlappingXFBArray[MAX_VIRTUAL_XFB];
unsigned int FramebufferManagerBase::s_last_xfb_width = 1;
unsigned int FramebufferManagerBase::s_last_xfb_height = 1;
FramebufferManagerBase::FramebufferManagerBase()
{
m_realXFBSource = NULL;
@@ -226,3 +229,31 @@ void FramebufferManagerBase::ReplaceVirtualXFB()
}
}
}
int FramebufferManagerBase::ScaleToVirtualXfbWidth(int x, unsigned int backbuffer_width)
{
if (g_ActiveConfig.RealXFBEnabled())
return x;
if (g_ActiveConfig.b3DVision)
{
// This works, yet the version in the else doesn't. No idea why.
return x * (int)backbuffer_width / (int)FramebufferManagerBase::LastXfbWidth();
}
else
return x * (int)Renderer::GetTargetRectangle().GetWidth() / (int)FramebufferManagerBase::LastXfbWidth();
}
int FramebufferManagerBase::ScaleToVirtualXfbHeight(int y, unsigned int backbuffer_height)
{
if (g_ActiveConfig.RealXFBEnabled())
return y;
if (g_ActiveConfig.b3DVision)
{
// This works, yet the version in the else doesn't. No idea why.
return y * (int)backbuffer_height / (int)FramebufferManagerBase::LastXfbHeight();
}
else
return y * (int)Renderer::GetTargetRectangle().GetHeight() / (int)FramebufferManagerBase::LastXfbHeight();
}
@@ -50,6 +50,14 @@ public:
static void CopyToXFB(u32 xfbAddr, u32 fbWidth, u32 fbHeight, const EFBRectangle& sourceRc,float Gamma);
static const XFBSourceBase* const* GetXFBSource(u32 xfbAddr, u32 fbWidth, u32 fbHeight, u32 &xfbCount);
static void SetLastXfbWidth(unsigned int width) { s_last_xfb_width = width; }
static void SetLastXfbHeight(unsigned int height) { s_last_xfb_height = height; }
static unsigned int LastXfbWidth() { return s_last_xfb_width; }
static unsigned int LastXfbHeight() { return s_last_xfb_height; }
static int ScaleToVirtualXfbWidth(int x, unsigned int backbuffer_width);
static int ScaleToVirtualXfbHeight(int y, unsigned int backbuffer_height);
protected:
struct VirtualXFB
{
@@ -85,6 +93,9 @@ private:
static VirtualXFBListType m_virtualXFBList; // Only used in Virtual XFB mode
static const XFBSourceBase* m_overlappingXFBArray[MAX_VIRTUAL_XFB];
static unsigned int s_last_xfb_width;
static unsigned int s_last_xfb_height;
};
extern FramebufferManagerBase *g_framebuffer_manager;
@@ -19,6 +19,7 @@
#include "Common.h"
#include "ConfigManager.h"
#include "OnScreenDisplay.h"
#include "RenderBase.h"
#include "Timer.h"
@@ -47,6 +48,8 @@ void AddMessage(const char* pstr, u32 ms)
void DrawMessages()
{
if(!SConfig::GetInstance().m_LocalCoreStartupParameter.bOnScreenDisplayMessages) return;
if (s_listMsgs.size() > 0)
{
int left = 25, top = 15;
+7 -12
View File
@@ -129,15 +129,11 @@ void GetPixelShaderId(PIXELSHADERUID *uid, DSTALPHA_MODE dstAlphaMode, u32 compo
return;
}
// numtexgens should be <= 8
for (unsigned int i = 0; i < bpmem.genMode.numtexgens; ++i)
{
if (18+i < 32)
uid->values[0] |= xfregs.texMtxInfo[i].projection << (18+i); // 1
else
uid->values[1] |= xfregs.texMtxInfo[i].projection << (i - 14); // 1
}
uid->values[0] |= xfregs.texMtxInfo[i].projection << (18+i); // 1
uid->values[1] = bpmem.genMode.numindstages << 2; // 3
uid->values[1] = bpmem.genMode.numindstages; // 3
u32 indirectStagesUsed = 0;
for (unsigned int i = 0; i < bpmem.genMode.numindstages; ++i)
if (bpmem.tevind[i].IsActive() && bpmem.tevind[i].bt < bpmem.genMode.numindstages)
@@ -145,20 +141,20 @@ void GetPixelShaderId(PIXELSHADERUID *uid, DSTALPHA_MODE dstAlphaMode, u32 compo
assert(indirectStagesUsed == (indirectStagesUsed & 0xF));
uid->values[1] |= indirectStagesUsed << 5; // 4;
uid->values[1] |= indirectStagesUsed << 3; // 4;
for (unsigned int i = 0; i < bpmem.genMode.numindstages; ++i)
{
if (indirectStagesUsed & (1 << i))
{
uid->values[1] |= (bpmem.tevindref.getTexCoord(i) < bpmem.genMode.numtexgens) << (9 + 3*i); // 1
uid->values[1] |= (bpmem.tevindref.getTexCoord(i) < bpmem.genMode.numtexgens) << (7 + 3*i); // 1
if (bpmem.tevindref.getTexCoord(i) < bpmem.genMode.numtexgens)
uid->values[1] |= bpmem.tevindref.getTexCoord(i) << (10 + 3*i); // 2
uid->values[1] |= bpmem.tevindref.getTexCoord(i) << (8 + 3*i); // 2
}
}
u32* ptr = &uid->values[2];
for (unsigned int i = 0; i < bpmem.genMode.numtevstages+1; ++i)
for (int i = 0; i < bpmem.genMode.numtevstages+1; ++i)
{
StageHash(i, ptr);
ptr += 4; // max: ptr = &uid->values[66]
@@ -626,7 +622,6 @@ const char *GeneratePixelShaderCode(DSTALPHA_MODE dstAlphaMode, API_TYPE ApiType
}
WRITE(p, " ) {\n");
char* pmainstart = p;
int Pretest = AlphaPreTest();
if(Pretest >= 0 && !DepthTextureEnable)
{
@@ -302,6 +302,7 @@ void PixelShaderManager::SetConstants()
float GC_ALIGNED16(material[4]);
float NormalizationCoef = 1 / 255.0f;
// TODO: This code is wrong. i goes out of range for xfregs.ambColor.
for (int i = 0; i < 4; ++i)
{
if (nMaterialsChanged & (1 << i))
+205 -51
View File
@@ -67,12 +67,7 @@ int Renderer::s_target_height;
int Renderer::s_backbuffer_width;
int Renderer::s_backbuffer_height;
// ratio of backbuffer size and render area size
float Renderer::xScale;
float Renderer::yScale;
unsigned int Renderer::s_XFB_width;
unsigned int Renderer::s_XFB_height;
TargetRectangle Renderer::target_rc;
int Renderer::s_LastEFBScale;
@@ -81,6 +76,11 @@ bool Renderer::XFBWrited;
bool Renderer::s_EnableDLCachingAfterRecording;
unsigned int Renderer::prev_efb_format = (unsigned int)-1;
unsigned int Renderer::efb_scale_numeratorX = 1;
unsigned int Renderer::efb_scale_numeratorY = 1;
unsigned int Renderer::efb_scale_denominatorX = 1;
unsigned int Renderer::efb_scale_denominatorY = 1;
unsigned int Renderer::ssaa_multiplier = 1;
Renderer::Renderer() : frame_data(NULL), bLastFrameDumped(false)
@@ -98,6 +98,8 @@ Renderer::~Renderer()
// invalidate previous efb format
prev_efb_format = (unsigned int)-1;
efb_scale_numeratorX = efb_scale_numeratorY = efb_scale_denominatorX = efb_scale_denominatorY = ssaa_multiplier = 1;
#if defined _WIN32 || defined HAVE_LIBAV
if (g_ActiveConfig.bDumpFrames && bLastFrameDumped && bAVIDumping)
AVIDump::Stop();
@@ -121,64 +123,117 @@ void Renderer::RenderToXFB(u32 xfbAddr, u32 fbWidth, u32 fbHeight, const EFBRect
VideoFifo_CheckSwapRequestAt(xfbAddr, fbWidth, fbHeight);
XFBWrited = true;
// XXX: Without the VI, how would we know what kind of field this is? So
// just use progressive.
if (g_ActiveConfig.bUseXFB)
{
FramebufferManagerBase::CopyToXFB(xfbAddr, fbWidth, fbHeight, sourceRc,Gamma);
}
else
{
// XXX: Without the VI, how would we know what kind of field this is? So
// just use progressive.
g_renderer->Swap(xfbAddr, FIELD_PROGRESSIVE, fbWidth, fbHeight,sourceRc,Gamma);
Common::AtomicStoreRelease(s_swapRequested, false);
}
}
void Renderer::CalculateTargetScale(int x, int y, int &scaledX, int &scaledY)
int Renderer::EFBToScaledX(int x)
{
switch (g_ActiveConfig.iEFBScale)
{
case 3: // 1.5x
scaledX = (x / 2) * 3;
scaledY = (y / 2) * 3;
break;
case 4: // 2x
scaledX = x * 2;
scaledY = y * 2;
break;
case 5: // 2.5x
scaledX = (x / 2) * 5;
scaledY = (y / 2) * 5;
break;
case 6: // 3x
scaledX = x * 3;
scaledY = y * 3;
break;
case 7: // 4x
scaledX = x * 4;
scaledY = y * 4;
break;
case 0: // fractional
return (int)ssaa_multiplier * FramebufferManagerBase::ScaleToVirtualXfbWidth(x, s_backbuffer_width);
default:
scaledX = x;
scaledY = y;
break;
return x * (int)ssaa_multiplier * (int)efb_scale_numeratorX / (int)efb_scale_denominatorX;
};
}
int Renderer::EFBToScaledY(int y)
{
switch (g_ActiveConfig.iEFBScale)
{
case 0: // fractional
return (int)ssaa_multiplier * FramebufferManagerBase::ScaleToVirtualXfbHeight(y, s_backbuffer_height);
default:
return y * (int)ssaa_multiplier * (int)efb_scale_numeratorY / (int)efb_scale_denominatorY;
};
}
void Renderer::CalculateTargetScale(int x, int y, int &scaledX, int &scaledY)
{
if (g_ActiveConfig.iEFBScale == 0 || g_ActiveConfig.iEFBScale == 1)
{
scaledX = x;
scaledY = y;
}
else
{
scaledX = x * (int)efb_scale_numeratorX / (int)efb_scale_denominatorX;
scaledY = y * (int)efb_scale_numeratorY / (int)efb_scale_denominatorY;
}
}
// return true if target size changed
bool Renderer::CalculateTargetSize(int multiplier)
bool Renderer::CalculateTargetSize(unsigned int framebuffer_width, unsigned int framebuffer_height, int multiplier)
{
int newEFBWidth, newEFBHeight;
// TODO: Ugly. Clean up
switch (s_LastEFBScale)
{
case 2: // 1x
efb_scale_numeratorX = efb_scale_numeratorY = 1;
efb_scale_denominatorX = efb_scale_denominatorY = 1;
break;
case 3: // 1.5x
efb_scale_numeratorX = efb_scale_numeratorY = 3;
efb_scale_denominatorX = efb_scale_denominatorY = 2;
break;
case 4: // 2x
efb_scale_numeratorX = efb_scale_numeratorY = 2;
efb_scale_denominatorX = efb_scale_denominatorY = 1;
break;
case 5: // 2.5x
efb_scale_numeratorX = efb_scale_numeratorY = 5;
efb_scale_denominatorX = efb_scale_denominatorY = 2;
break;
case 6: // 3x
efb_scale_numeratorX = efb_scale_numeratorY = 3;
efb_scale_denominatorX = efb_scale_denominatorY = 1;
break;
case 7: // 4x
efb_scale_numeratorX = efb_scale_numeratorY = 4;
efb_scale_denominatorX = efb_scale_denominatorY = 1;
break;
default: // fractional & integral handled later
break;
}
switch (s_LastEFBScale)
{
case 0: // fractional
newEFBWidth = (int)(EFB_WIDTH * xScale);
newEFBHeight = (int)(EFB_HEIGHT * yScale);
break;
case 1: // integral
newEFBWidth = EFB_WIDTH * (int)ceilf(xScale);
newEFBHeight = EFB_HEIGHT * (int)ceilf(yScale);
newEFBWidth = FramebufferManagerBase::ScaleToVirtualXfbWidth(EFB_WIDTH, framebuffer_width);
newEFBHeight = FramebufferManagerBase::ScaleToVirtualXfbHeight(EFB_HEIGHT, framebuffer_height);
if (s_LastEFBScale == 1)
{
newEFBWidth = ((newEFBWidth-1) / EFB_WIDTH + 1) * EFB_WIDTH;
newEFBHeight = ((newEFBHeight-1) / EFB_HEIGHT + 1) * EFB_HEIGHT;
}
efb_scale_numeratorX = newEFBWidth;
efb_scale_denominatorX = EFB_WIDTH;
efb_scale_numeratorY = newEFBHeight;
efb_scale_denominatorY = EFB_HEIGHT;
break;
default:
CalculateTargetScale(EFB_WIDTH, EFB_HEIGHT, newEFBWidth, newEFBHeight);
break;
@@ -186,6 +241,7 @@ bool Renderer::CalculateTargetSize(int multiplier)
newEFBWidth *= multiplier;
newEFBHeight *= multiplier;
ssaa_multiplier = multiplier;
if (newEFBWidth != s_target_width || newEFBHeight != s_target_height)
{
@@ -311,27 +367,125 @@ void Renderer::DrawDebugText()
}
}
void Renderer::CalculateXYScale(const TargetRectangle& dst_rect)
// TODO: remove
extern bool g_aspect_wide;
void Renderer::UpdateDrawRectangle(int backbuffer_width, int backbuffer_height)
{
if (g_ActiveConfig.bUseXFB && g_ActiveConfig.bUseRealXFB)
float FloatGLWidth = (float)backbuffer_width;
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_aspect_wide;
// 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
if ( g_ActiveConfig.bWidescreenHack )
{
xScale = 1.0f;
yScale = 1.0f;
}
else
{
if (g_ActiveConfig.b3DVision)
float source_aspect = use16_9 ? (16.0f / 9.0f) : (4.0f / 3.0f);
float target_aspect;
switch ( g_ActiveConfig.iAspectRatio )
{
// This works, yet the version in the else doesn't. No idea why.
xScale = (float)(s_backbuffer_width-1) / (float)(s_XFB_width-1);
yScale = (float)(s_backbuffer_height-1) / (float)(s_XFB_height-1);
case ASPECT_FORCE_16_9 :
target_aspect = 16.0f / 9.0f;
break;
case ASPECT_FORCE_4_3 :
target_aspect = 4.0f / 3.0f;
break;
case ASPECT_STRETCH :
target_aspect = WinWidth / WinHeight;
break;
default :
// ASPECT_AUTO == no hacking
target_aspect = source_aspect;
break;
}
float adjust = source_aspect / target_aspect;
if ( adjust > 1 )
{
// Vert+
g_Config.fAspectRatioHackW = 1;
g_Config.fAspectRatioHackH = 1/adjust;
}
else
{
xScale = (float)(dst_rect.right - dst_rect.left - 1) / (float)(s_XFB_width-1);
yScale = (float)(dst_rect.bottom - dst_rect.top - 1) / (float)(s_XFB_height-1);
// Hor+
g_Config.fAspectRatioHackW = adjust;
g_Config.fAspectRatioHackH = 1;
}
}
else
{
// Hack is disabled
g_Config.fAspectRatioHackW = 1;
g_Config.fAspectRatioHackH = 1;
}
// Check for force-settings and override.
if (g_ActiveConfig.iAspectRatio == ASPECT_FORCE_16_9)
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
float Ratio = (WinWidth / WinHeight) / (!use16_9 ? (4.0f / 3.0f) : (16.0f / 9.0f));
// Check if height or width is the limiting factor. If ratio > 1 the picture is too wide and have to limit the width.
if (Ratio > 1.0f)
{
// Scale down and center in the X direction.
FloatGLWidth /= Ratio;
FloatXOffset = (WinWidth - FloatGLWidth) / 2.0f;
}
// The window is too high, we have to limit the height
else
{
// Scale down and center in the Y direction.
FloatGLHeight *= Ratio;
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
// ------------------
if (g_ActiveConfig.iAspectRatio != ASPECT_STRETCH && g_ActiveConfig.bCrop)
{
float Ratio = !use16_9 ? ((4.0f / 3.0f) / (5.0f / 4.0f)) : (((16.0f / 9.0f) / (16.0f / 10.0f)));
// The width and height we will add (calculate this before FloatGLWidth and FloatGLHeight is adjusted)
float IncreasedWidth = (Ratio - 1.0f) * FloatGLWidth;
float IncreasedHeight = (Ratio - 1.0f) * FloatGLHeight;
// The new width and height
FloatGLWidth = FloatGLWidth * Ratio;
FloatGLHeight = FloatGLHeight * Ratio;
// Adjust the X and Y offset
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);
int iHeight = (int)ceil(FloatGLHeight);
iWhidth -= iWhidth % 4; // ensure divisibility by 4 to make it compatible with all the video encoders
iHeight -= iHeight % 4;
target_rc.left = XOffset;
target_rc.top = YOffset;
target_rc.right = XOffset + iWhidth;
target_rc.bottom = YOffset + iHeight;
}
void Renderer::SetWindowSize(int width, int height)
+13 -14
View File
@@ -74,10 +74,6 @@ public:
static int GetBackbufferWidth() { return s_backbuffer_width; }
static int GetBackbufferHeight() { return s_backbuffer_height; }
// XFB scale - TODO: Remove this and add two XFBToScaled functions instead
static float GetXFBScaleX() { return xScale; }
static float GetXFBScaleY() { return yScale; }
static void SetWindowSize(int width, int height);
// EFB coordinate conversion functions
@@ -85,9 +81,13 @@ public:
// Use this to convert a whole native EFB rect to backbuffer coordinates
virtual TargetRectangle ConvertEFBRectangle(const EFBRectangle& rc) = 0;
static const TargetRectangle& GetTargetRectangle() { return target_rc; }
static void UpdateDrawRectangle(int backbuffer_width, int backbuffer_height);
// Use this to upscale native EFB coordinates to IDEAL internal resolution
static unsigned int EFBToScaledX(int x) { return x * GetTargetWidth() / EFB_WIDTH; }
static unsigned int EFBToScaledY(int y) { return y * GetTargetHeight() / EFB_HEIGHT; }
static int EFBToScaledX(int x);
static int EFBToScaledY(int y);
// Floating point versions of the above - only use them if really necessary
static float EFBToScaledXf(float x) { return x * ((float)GetTargetWidth() / (float)EFB_WIDTH); }
@@ -133,8 +133,7 @@ public:
protected:
static void CalculateTargetScale(int x, int y, int &scaledX, int &scaledY);
static bool CalculateTargetSize(int multiplier = 1);
static void CalculateXYScale(const TargetRectangle& dst_rect);
static bool CalculateTargetSize(unsigned int framebuffer_width, unsigned int framebuffer_height, int multiplier = 1);
static void CheckFifoRecording();
static void RecordVideoMemory();
@@ -159,12 +158,7 @@ protected:
static int s_backbuffer_width;
static int s_backbuffer_height;
// ratio of backbuffer size and render area size - TODO: Remove these!
static float xScale;
static float yScale;
static unsigned int s_XFB_width;
static unsigned int s_XFB_height;
static TargetRectangle target_rc;
// can probably eliminate this static var
static int s_LastEFBScale;
@@ -176,6 +170,11 @@ protected:
private:
static unsigned int prev_efb_format;
static unsigned int efb_scale_numeratorX;
static unsigned int efb_scale_numeratorY;
static unsigned int efb_scale_denominatorX;
static unsigned int efb_scale_denominatorY;
static unsigned int ssaa_multiplier;
};
extern Renderer *g_renderer;

Some files were not shown because too many files have changed in this diff Show More