Merge pull request #82 from lioncash/vertical-alignment

Fix some vertical alignments
This commit is contained in:
Ryan Houdek 2014-02-16 19:12:42 -06:00
commit 6b5f6ddaa1
91 changed files with 1420 additions and 1405 deletions

View File

@ -8,13 +8,13 @@
#include "StdMutex.h" #include "StdMutex.h"
// 16 bit Stereo // 16 bit Stereo
#define MAX_SAMPLES (1024 * 2) // 64ms #define MAX_SAMPLES (1024 * 2) // 64ms
#define INDEX_MASK (MAX_SAMPLES * 2 - 1) #define INDEX_MASK (MAX_SAMPLES * 2 - 1)
#define LOW_WATERMARK 1280 // 40 ms #define LOW_WATERMARK 1280 // 40 ms
#define MAX_FREQ_SHIFT 200 // per 32000 Hz #define MAX_FREQ_SHIFT 200 // per 32000 Hz
#define CONTROL_FACTOR 0.2 // in freq_shift per fifo size offset #define CONTROL_FACTOR 0.2 // in freq_shift per fifo size offset
#define CONTROL_AVG 32 #define CONTROL_AVG 32
class CMixer { class CMixer {

View File

@ -62,16 +62,16 @@ StreamingVoiceContext::StreamingVoiceContext(IXAudio2 *pXAudio2, CMixer *pMixer,
{ {
WAVEFORMATEXTENSIBLE wfx = {}; WAVEFORMATEXTENSIBLE wfx = {};
wfx.Format.wFormatTag = WAVE_FORMAT_EXTENSIBLE; wfx.Format.wFormatTag = WAVE_FORMAT_EXTENSIBLE;
wfx.Format.nSamplesPerSec = m_mixer->GetSampleRate(); wfx.Format.nSamplesPerSec = m_mixer->GetSampleRate();
wfx.Format.nChannels = 2; wfx.Format.nChannels = 2;
wfx.Format.wBitsPerSample = 16; wfx.Format.wBitsPerSample = 16;
wfx.Format.nBlockAlign = wfx.Format.nChannels*wfx.Format.wBitsPerSample / 8; wfx.Format.nBlockAlign = wfx.Format.nChannels*wfx.Format.wBitsPerSample / 8;
wfx.Format.nAvgBytesPerSec = wfx.Format.nSamplesPerSec * wfx.Format.nBlockAlign; wfx.Format.nAvgBytesPerSec = wfx.Format.nSamplesPerSec * wfx.Format.nBlockAlign;
wfx.Format.cbSize = sizeof(WAVEFORMATEXTENSIBLE) - sizeof(WAVEFORMATEX); wfx.Format.cbSize = sizeof(WAVEFORMATEXTENSIBLE) - sizeof(WAVEFORMATEX);
wfx.Samples.wValidBitsPerSample = 16; wfx.Samples.wValidBitsPerSample = 16;
wfx.dwChannelMask = SPEAKER_FRONT_LEFT | SPEAKER_FRONT_RIGHT; wfx.dwChannelMask = SPEAKER_FRONT_LEFT | SPEAKER_FRONT_RIGHT;
wfx.SubFormat = KSDATAFORMAT_SUBTYPE_PCM; wfx.SubFormat = KSDATAFORMAT_SUBTYPE_PCM;
// create source voice // create source voice
HRESULT hr; HRESULT hr;
@ -221,7 +221,7 @@ void XAudio2::Update()
// XAUDIO2_PERFORMANCE_DATA perfData; // XAUDIO2_PERFORMANCE_DATA perfData;
// pXAudio2->GetPerformanceData(&perfData); // pXAudio2->GetPerformanceData(&perfData);
// NOTICE_LOG(DSPHLE, "XAudio2 latency (samples): %i", perfData.CurrentLatencyInSamples); // NOTICE_LOG(DSPHLE, "XAudio2 latency (samples): %i", perfData.CurrentLatencyInSamples);
// NOTICE_LOG(DSPHLE, "XAudio2 total glitches: %i", perfData.GlitchesSinceEngineStarted); // NOTICE_LOG(DSPHLE, "XAudio2 total glitches: %i", perfData.GlitchesSinceEngineStarted);
//} //}
} }

View File

@ -75,16 +75,16 @@ StreamingVoiceContext2_7::StreamingVoiceContext2_7(IXAudio2 *pXAudio2, CMixer *p
{ {
WAVEFORMATEXTENSIBLE wfx = {}; WAVEFORMATEXTENSIBLE wfx = {};
wfx.Format.wFormatTag = WAVE_FORMAT_EXTENSIBLE; wfx.Format.wFormatTag = WAVE_FORMAT_EXTENSIBLE;
wfx.Format.nSamplesPerSec = m_mixer->GetSampleRate(); wfx.Format.nSamplesPerSec = m_mixer->GetSampleRate();
wfx.Format.nChannels = 2; wfx.Format.nChannels = 2;
wfx.Format.wBitsPerSample = 16; wfx.Format.wBitsPerSample = 16;
wfx.Format.nBlockAlign = wfx.Format.nChannels*wfx.Format.wBitsPerSample / 8; wfx.Format.nBlockAlign = wfx.Format.nChannels*wfx.Format.wBitsPerSample / 8;
wfx.Format.nAvgBytesPerSec = wfx.Format.nSamplesPerSec * wfx.Format.nBlockAlign; wfx.Format.nAvgBytesPerSec = wfx.Format.nSamplesPerSec * wfx.Format.nBlockAlign;
wfx.Format.cbSize = sizeof(WAVEFORMATEXTENSIBLE) - sizeof(WAVEFORMATEX); wfx.Format.cbSize = sizeof(WAVEFORMATEXTENSIBLE) - sizeof(WAVEFORMATEX);
wfx.Samples.wValidBitsPerSample = 16; wfx.Samples.wValidBitsPerSample = 16;
wfx.dwChannelMask = SPEAKER_FRONT_LEFT | SPEAKER_FRONT_RIGHT; wfx.dwChannelMask = SPEAKER_FRONT_LEFT | SPEAKER_FRONT_RIGHT;
wfx.SubFormat = KSDATAFORMAT_SUBTYPE_PCM; wfx.SubFormat = KSDATAFORMAT_SUBTYPE_PCM;
// create source voice // create source voice
HRESULT hr; HRESULT hr;
@ -222,7 +222,7 @@ void XAudio2_7::Update()
// XAUDIO2_PERFORMANCE_DATA perfData; // XAUDIO2_PERFORMANCE_DATA perfData;
// pXAudio2->GetPerformanceData(&perfData); // pXAudio2->GetPerformanceData(&perfData);
// NOTICE_LOG(DSPHLE, "XAudio2_7 latency (samples): %i", perfData.CurrentLatencyInSamples); // NOTICE_LOG(DSPHLE, "XAudio2_7 latency (samples): %i", perfData.CurrentLatencyInSamples);
// NOTICE_LOG(DSPHLE, "XAudio2_7 total glitches: %i", perfData.GlitchesSinceEngineStarted); // NOTICE_LOG(DSPHLE, "XAudio2_7 total glitches: %i", perfData.GlitchesSinceEngineStarted);
//} //}
} }

View File

@ -37,37 +37,37 @@ namespace ActionReplay
enum enum
{ {
// Zero Code Types // Zero Code Types
ZCODE_END = 0x00, ZCODE_END = 0x00,
ZCODE_NORM = 0x02, ZCODE_NORM = 0x02,
ZCODE_ROW = 0x03, ZCODE_ROW = 0x03,
ZCODE_04 = 0x04, ZCODE_04 = 0x04,
// Conditional Codes // Conditional Codes
CONDTIONAL_EQUAL = 0x01, CONDTIONAL_EQUAL = 0x01,
CONDTIONAL_NOT_EQUAL = 0x02, CONDTIONAL_NOT_EQUAL = 0x02,
CONDTIONAL_LESS_THAN_SIGNED = 0x03, CONDTIONAL_LESS_THAN_SIGNED = 0x03,
CONDTIONAL_GREATER_THAN_SIGNED = 0x04, CONDTIONAL_GREATER_THAN_SIGNED = 0x04,
CONDTIONAL_LESS_THAN_UNSIGNED = 0x05, CONDTIONAL_LESS_THAN_UNSIGNED = 0x05,
CONDTIONAL_GREATER_THAN_UNSIGNED = 0x06, CONDTIONAL_GREATER_THAN_UNSIGNED = 0x06,
CONDTIONAL_AND = 0x07, // bitwise AND CONDTIONAL_AND = 0x07, // bitwise AND
// Conditional Line Counts // Conditional Line Counts
CONDTIONAL_ONE_LINE = 0x00, CONDTIONAL_ONE_LINE = 0x00,
CONDTIONAL_TWO_LINES = 0x01, CONDTIONAL_TWO_LINES = 0x01,
CONDTIONAL_ALL_LINES_UNTIL = 0x02, CONDTIONAL_ALL_LINES_UNTIL = 0x02,
CONDTIONAL_ALL_LINES = 0x03, CONDTIONAL_ALL_LINES = 0x03,
// Data Types // Data Types
DATATYPE_8BIT = 0x00, DATATYPE_8BIT = 0x00,
DATATYPE_16BIT = 0x01, DATATYPE_16BIT = 0x01,
DATATYPE_32BIT = 0x02, DATATYPE_32BIT = 0x02,
DATATYPE_32BIT_FLOAT = 0x03, DATATYPE_32BIT_FLOAT = 0x03,
// Normal Code 0 Subtypes // Normal Code 0 Subtypes
SUB_RAM_WRITE = 0x00, SUB_RAM_WRITE = 0x00,
SUB_WRITE_POINTER = 0x01, SUB_WRITE_POINTER = 0x01,
SUB_ADD_CODE = 0x02, SUB_ADD_CODE = 0x02,
SUB_MASTER_CODE = 0x03, SUB_MASTER_CODE = 0x03,
}; };
// pointer to the code currently being run, (used by log messages that include the code name) // pointer to the code currently being run, (used by log messages that include the code name)

View File

@ -132,27 +132,27 @@ bool BootCore(const std::string& _rFilename)
config_cache.bSetFramelimit = false; config_cache.bSetFramelimit = false;
// General settings // General settings
game_ini.Get("Core", "CPUThread", &StartUp.bCPUThread, StartUp.bCPUThread); game_ini.Get("Core", "CPUThread", &StartUp.bCPUThread, StartUp.bCPUThread);
game_ini.Get("Core", "SkipIdle", &StartUp.bSkipIdle, StartUp.bSkipIdle); game_ini.Get("Core", "SkipIdle", &StartUp.bSkipIdle, StartUp.bSkipIdle);
game_ini.Get("Core", "EnableFPRF", &StartUp.bEnableFPRF, StartUp.bEnableFPRF); game_ini.Get("Core", "EnableFPRF", &StartUp.bEnableFPRF, StartUp.bEnableFPRF);
game_ini.Get("Core", "MMU", &StartUp.bMMU, StartUp.bMMU); game_ini.Get("Core", "MMU", &StartUp.bMMU, StartUp.bMMU);
game_ini.Get("Core", "TLBHack", &StartUp.bTLBHack, StartUp.bTLBHack); game_ini.Get("Core", "TLBHack", &StartUp.bTLBHack, StartUp.bTLBHack);
game_ini.Get("Core", "DCBZ", &StartUp.bDCBZOFF, StartUp.bDCBZOFF); game_ini.Get("Core", "DCBZ", &StartUp.bDCBZOFF, StartUp.bDCBZOFF);
game_ini.Get("Core", "VBeam", &StartUp.bVBeamSpeedHack, StartUp.bVBeamSpeedHack); game_ini.Get("Core", "VBeam", &StartUp.bVBeamSpeedHack, StartUp.bVBeamSpeedHack);
game_ini.Get("Core", "SyncGPU", &StartUp.bSyncGPU, StartUp.bSyncGPU); game_ini.Get("Core", "SyncGPU", &StartUp.bSyncGPU, StartUp.bSyncGPU);
game_ini.Get("Core", "FastDiscSpeed", &StartUp.bFastDiscSpeed, StartUp.bFastDiscSpeed); game_ini.Get("Core", "FastDiscSpeed", &StartUp.bFastDiscSpeed, StartUp.bFastDiscSpeed);
game_ini.Get("Core", "BlockMerging", &StartUp.bMergeBlocks, StartUp.bMergeBlocks); game_ini.Get("Core", "BlockMerging", &StartUp.bMergeBlocks, StartUp.bMergeBlocks);
game_ini.Get("Core", "DSPHLE", &StartUp.bDSPHLE, StartUp.bDSPHLE); game_ini.Get("Core", "DSPHLE", &StartUp.bDSPHLE, StartUp.bDSPHLE);
game_ini.Get("Core", "DSPThread", &StartUp.bDSPThread, StartUp.bDSPThread); game_ini.Get("Core", "DSPThread", &StartUp.bDSPThread, StartUp.bDSPThread);
game_ini.Get("Core", "GFXBackend", &StartUp.m_strVideoBackend, StartUp.m_strVideoBackend); game_ini.Get("Core", "GFXBackend", &StartUp.m_strVideoBackend, StartUp.m_strVideoBackend);
game_ini.Get("Core", "CPUCore", &StartUp.iCPUCore, StartUp.iCPUCore); game_ini.Get("Core", "CPUCore", &StartUp.iCPUCore, StartUp.iCPUCore);
game_ini.Get("Core", "HLE_BS2", &StartUp.bHLE_BS2, StartUp.bHLE_BS2); game_ini.Get("Core", "HLE_BS2", &StartUp.bHLE_BS2, StartUp.bHLE_BS2);
if (game_ini.Get("Core", "FrameLimit", &SConfig::GetInstance().m_Framelimit, SConfig::GetInstance().m_Framelimit)) if (game_ini.Get("Core", "FrameLimit", &SConfig::GetInstance().m_Framelimit, SConfig::GetInstance().m_Framelimit))
config_cache.bSetFramelimit = true; config_cache.bSetFramelimit = true;
if (game_ini.Get("DSP", "Volume", &SConfig::GetInstance().m_Volume, SConfig::GetInstance().m_Volume)) if (game_ini.Get("DSP", "Volume", &SConfig::GetInstance().m_Volume, SConfig::GetInstance().m_Volume))
config_cache.bSetVolume = true; config_cache.bSetVolume = true;
game_ini.Get("DSP", "EnableJIT", &SConfig::GetInstance().m_EnableJIT, SConfig::GetInstance().m_EnableJIT); game_ini.Get("DSP", "EnableJIT", &SConfig::GetInstance().m_EnableJIT, SConfig::GetInstance().m_EnableJIT);
game_ini.Get("DSP", "Backend", &SConfig::GetInstance().sBackend, SConfig::GetInstance().sBackend); game_ini.Get("DSP", "Backend", &SConfig::GetInstance().sBackend, SConfig::GetInstance().sBackend);
VideoBackend::ActivateBackend(StartUp.m_strVideoBackend); VideoBackend::ActivateBackend(StartUp.m_strVideoBackend);
for (unsigned int i = 0; i < MAX_SI_CHANNELS; ++i) for (unsigned int i = 0; i < MAX_SI_CHANNELS; ++i)

View File

@ -142,7 +142,7 @@ void SConfig::SaveSettings()
ini.Load(File::GetUserPath(F_DOLPHINCONFIG_IDX)); // load first to not kill unknown stuff ini.Load(File::GetUserPath(F_DOLPHINCONFIG_IDX)); // load first to not kill unknown stuff
// General // General
ini.Set("General", "LastFilename", m_LastFilename); ini.Set("General", "LastFilename", m_LastFilename);
ini.Set("General", "ShowLag", m_ShowLag); ini.Set("General", "ShowLag", m_ShowLag);
// ISO folders // ISO folders
@ -163,29 +163,29 @@ void SConfig::SaveSettings()
} }
ini.Set("General", "RecursiveGCMPaths", m_RecursiveISOFolder); ini.Set("General", "RecursiveGCMPaths", m_RecursiveISOFolder);
ini.Set("General", "NANDRootPath", m_NANDPath); ini.Set("General", "NANDRootPath", m_NANDPath);
ini.Set("General", "WirelessMac", m_WirelessMac); ini.Set("General", "WirelessMac", m_WirelessMac);
#ifdef USE_GDBSTUB #ifdef USE_GDBSTUB
ini.Set("General", "GDBPort", m_LocalCoreStartupParameter.iGDBPort); ini.Set("General", "GDBPort", m_LocalCoreStartupParameter.iGDBPort);
#endif #endif
// Interface // Interface
ini.Set("Interface", "ConfirmStop", m_LocalCoreStartupParameter.bConfirmStop); ini.Set("Interface", "ConfirmStop", m_LocalCoreStartupParameter.bConfirmStop);
ini.Set("Interface", "UsePanicHandlers", m_LocalCoreStartupParameter.bUsePanicHandlers); ini.Set("Interface", "UsePanicHandlers", m_LocalCoreStartupParameter.bUsePanicHandlers);
ini.Set("Interface", "OnScreenDisplayMessages", m_LocalCoreStartupParameter.bOnScreenDisplayMessages); ini.Set("Interface", "OnScreenDisplayMessages", m_LocalCoreStartupParameter.bOnScreenDisplayMessages);
ini.Set("Interface", "HideCursor", m_LocalCoreStartupParameter.bHideCursor); ini.Set("Interface", "HideCursor", m_LocalCoreStartupParameter.bHideCursor);
ini.Set("Interface", "AutoHideCursor", m_LocalCoreStartupParameter.bAutoHideCursor); ini.Set("Interface", "AutoHideCursor", m_LocalCoreStartupParameter.bAutoHideCursor);
ini.Set("Interface", "MainWindowPosX", (m_LocalCoreStartupParameter.iPosX == -32000) ? 0 : m_LocalCoreStartupParameter.iPosX); // TODO - HAX ini.Set("Interface", "MainWindowPosX", (m_LocalCoreStartupParameter.iPosX == -32000) ? 0 : m_LocalCoreStartupParameter.iPosX); // TODO - HAX
ini.Set("Interface", "MainWindowPosY", (m_LocalCoreStartupParameter.iPosY == -32000) ? 0 : m_LocalCoreStartupParameter.iPosY); // TODO - HAX ini.Set("Interface", "MainWindowPosY", (m_LocalCoreStartupParameter.iPosY == -32000) ? 0 : m_LocalCoreStartupParameter.iPosY); // TODO - HAX
ini.Set("Interface", "MainWindowWidth", m_LocalCoreStartupParameter.iWidth); ini.Set("Interface", "MainWindowWidth", m_LocalCoreStartupParameter.iWidth);
ini.Set("Interface", "MainWindowHeight", m_LocalCoreStartupParameter.iHeight); ini.Set("Interface", "MainWindowHeight", m_LocalCoreStartupParameter.iHeight);
ini.Set("Interface", "Language", m_InterfaceLanguage); ini.Set("Interface", "Language", m_InterfaceLanguage);
ini.Set("Interface", "ShowToolbar", m_InterfaceToolbar); ini.Set("Interface", "ShowToolbar", m_InterfaceToolbar);
ini.Set("Interface", "ShowStatusbar", m_InterfaceStatusbar); ini.Set("Interface", "ShowStatusbar", m_InterfaceStatusbar);
ini.Set("Interface", "ShowLogWindow", m_InterfaceLogWindow); ini.Set("Interface", "ShowLogWindow", m_InterfaceLogWindow);
ini.Set("Interface", "ShowLogConfigWindow", m_InterfaceLogConfigWindow); ini.Set("Interface", "ShowLogConfigWindow", m_InterfaceLogConfigWindow);
ini.Set("Interface", "ShowConsole", m_InterfaceConsole); ini.Set("Interface", "ShowConsole", m_InterfaceConsole);
ini.Set("Interface", "ThemeName40", m_LocalCoreStartupParameter.theme_name); ini.Set("Interface", "ThemeName40", m_LocalCoreStartupParameter.theme_name);
// Hotkeys // Hotkeys
for (int i = 0; i < NUM_HOTKEYS; i++) for (int i = 0; i < NUM_HOTKEYS; i++)
@ -196,56 +196,56 @@ void SConfig::SaveSettings()
} }
// Display // Display
ini.Set("Display", "FullscreenResolution", m_LocalCoreStartupParameter.strFullscreenResolution); ini.Set("Display", "FullscreenResolution", m_LocalCoreStartupParameter.strFullscreenResolution);
ini.Set("Display", "Fullscreen", m_LocalCoreStartupParameter.bFullscreen); ini.Set("Display", "Fullscreen", m_LocalCoreStartupParameter.bFullscreen);
ini.Set("Display", "RenderToMain", m_LocalCoreStartupParameter.bRenderToMain); ini.Set("Display", "RenderToMain", m_LocalCoreStartupParameter.bRenderToMain);
ini.Set("Display", "RenderWindowXPos", m_LocalCoreStartupParameter.iRenderWindowXPos); ini.Set("Display", "RenderWindowXPos", m_LocalCoreStartupParameter.iRenderWindowXPos);
ini.Set("Display", "RenderWindowYPos", m_LocalCoreStartupParameter.iRenderWindowYPos); ini.Set("Display", "RenderWindowYPos", m_LocalCoreStartupParameter.iRenderWindowYPos);
ini.Set("Display", "RenderWindowWidth", m_LocalCoreStartupParameter.iRenderWindowWidth); ini.Set("Display", "RenderWindowWidth", m_LocalCoreStartupParameter.iRenderWindowWidth);
ini.Set("Display", "RenderWindowHeight", m_LocalCoreStartupParameter.iRenderWindowHeight); ini.Set("Display", "RenderWindowHeight", m_LocalCoreStartupParameter.iRenderWindowHeight);
ini.Set("Display", "RenderWindowAutoSize", m_LocalCoreStartupParameter.bRenderWindowAutoSize); ini.Set("Display", "RenderWindowAutoSize", m_LocalCoreStartupParameter.bRenderWindowAutoSize);
ini.Set("Display", "KeepWindowOnTop", m_LocalCoreStartupParameter.bKeepWindowOnTop); ini.Set("Display", "KeepWindowOnTop", m_LocalCoreStartupParameter.bKeepWindowOnTop);
ini.Set("Display", "ProgressiveScan", m_LocalCoreStartupParameter.bProgressive); ini.Set("Display", "ProgressiveScan", m_LocalCoreStartupParameter.bProgressive);
ini.Set("Display", "DisableScreenSaver", m_LocalCoreStartupParameter.bDisableScreenSaver); ini.Set("Display", "DisableScreenSaver", m_LocalCoreStartupParameter.bDisableScreenSaver);
ini.Set("Display", "ForceNTSCJ", m_LocalCoreStartupParameter.bForceNTSCJ); ini.Set("Display", "ForceNTSCJ", m_LocalCoreStartupParameter.bForceNTSCJ);
// Game List Control // Game List Control
ini.Set("GameList", "ListDrives", m_ListDrives); ini.Set("GameList", "ListDrives", m_ListDrives);
ini.Set("GameList", "ListWad", m_ListWad); ini.Set("GameList", "ListWad", m_ListWad);
ini.Set("GameList", "ListWii", m_ListWii); ini.Set("GameList", "ListWii", m_ListWii);
ini.Set("GameList", "ListGC", m_ListGC); ini.Set("GameList", "ListGC", m_ListGC);
ini.Set("GameList", "ListJap", m_ListJap); ini.Set("GameList", "ListJap", m_ListJap);
ini.Set("GameList", "ListPal", m_ListPal); ini.Set("GameList", "ListPal", m_ListPal);
ini.Set("GameList", "ListUsa", m_ListUsa); ini.Set("GameList", "ListUsa", m_ListUsa);
ini.Set("GameList", "ListFrance", m_ListFrance); ini.Set("GameList", "ListFrance", m_ListFrance);
ini.Set("GameList", "ListItaly", m_ListItaly); ini.Set("GameList", "ListItaly", m_ListItaly);
ini.Set("GameList", "ListKorea", m_ListKorea); ini.Set("GameList", "ListKorea", m_ListKorea);
ini.Set("GameList", "ListTaiwan", m_ListTaiwan); ini.Set("GameList", "ListTaiwan", m_ListTaiwan);
ini.Set("GameList", "ListUnknown", m_ListUnknown); ini.Set("GameList", "ListUnknown", m_ListUnknown);
ini.Set("GameList", "ListSort", m_ListSort); ini.Set("GameList", "ListSort", m_ListSort);
ini.Set("GameList", "ListSortSecondary", m_ListSort2); ini.Set("GameList", "ListSortSecondary", m_ListSort2);
// Core // Core
ini.Set("Core", "HLE_BS2", m_LocalCoreStartupParameter.bHLE_BS2); ini.Set("Core", "HLE_BS2", m_LocalCoreStartupParameter.bHLE_BS2);
ini.Set("Core", "CPUCore", m_LocalCoreStartupParameter.iCPUCore); ini.Set("Core", "CPUCore", m_LocalCoreStartupParameter.iCPUCore);
ini.Set("Core", "Fastmem", m_LocalCoreStartupParameter.bFastmem); ini.Set("Core", "Fastmem", m_LocalCoreStartupParameter.bFastmem);
ini.Set("Core", "CPUThread", m_LocalCoreStartupParameter.bCPUThread); ini.Set("Core", "CPUThread", m_LocalCoreStartupParameter.bCPUThread);
ini.Set("Core", "DSPThread", m_LocalCoreStartupParameter.bDSPThread); ini.Set("Core", "DSPThread", m_LocalCoreStartupParameter.bDSPThread);
ini.Set("Core", "DSPHLE", m_LocalCoreStartupParameter.bDSPHLE); ini.Set("Core", "DSPHLE", m_LocalCoreStartupParameter.bDSPHLE);
ini.Set("Core", "SkipIdle", m_LocalCoreStartupParameter.bSkipIdle); ini.Set("Core", "SkipIdle", m_LocalCoreStartupParameter.bSkipIdle);
ini.Set("Core", "DefaultGCM", m_LocalCoreStartupParameter.m_strDefaultGCM); ini.Set("Core", "DefaultGCM", m_LocalCoreStartupParameter.m_strDefaultGCM);
ini.Set("Core", "DVDRoot", m_LocalCoreStartupParameter.m_strDVDRoot); ini.Set("Core", "DVDRoot", m_LocalCoreStartupParameter.m_strDVDRoot);
ini.Set("Core", "Apploader", m_LocalCoreStartupParameter.m_strApploader); ini.Set("Core", "Apploader", m_LocalCoreStartupParameter.m_strApploader);
ini.Set("Core", "EnableCheats", m_LocalCoreStartupParameter.bEnableCheats); ini.Set("Core", "EnableCheats", m_LocalCoreStartupParameter.bEnableCheats);
ini.Set("Core", "SelectedLanguage", m_LocalCoreStartupParameter.SelectedLanguage); ini.Set("Core", "SelectedLanguage", m_LocalCoreStartupParameter.SelectedLanguage);
ini.Set("Core", "DPL2Decoder", m_LocalCoreStartupParameter.bDPL2Decoder); ini.Set("Core", "DPL2Decoder", m_LocalCoreStartupParameter.bDPL2Decoder);
ini.Set("Core", "Latency", m_LocalCoreStartupParameter.iLatency); ini.Set("Core", "Latency", m_LocalCoreStartupParameter.iLatency);
ini.Set("Core", "MemcardAPath", m_strMemoryCardA); ini.Set("Core", "MemcardAPath", m_strMemoryCardA);
ini.Set("Core", "MemcardBPath", m_strMemoryCardB); ini.Set("Core", "MemcardBPath", m_strMemoryCardB);
ini.Set("Core", "SlotA", m_EXIDevice[0]); ini.Set("Core", "SlotA", m_EXIDevice[0]);
ini.Set("Core", "SlotB", m_EXIDevice[1]); ini.Set("Core", "SlotB", m_EXIDevice[1]);
ini.Set("Core", "SerialPort1", m_EXIDevice[2]); ini.Set("Core", "SerialPort1", m_EXIDevice[2]);
ini.Set("Core", "BBA_MAC", m_bba_mac); ini.Set("Core", "BBA_MAC", m_bba_mac);
for (int i = 0; i < MAX_SI_CHANNELS; ++i) for (int i = 0; i < MAX_SI_CHANNELS; ++i)
{ {
ini.Set("Core", StringFromFormat("SIDevice%i", i), m_SIDevice[i]); ini.Set("Core", StringFromFormat("SIDevice%i", i), m_SIDevice[i]);
@ -254,12 +254,12 @@ void SConfig::SaveSettings()
ini.Set("Core", "WiiKeyboard", m_WiiKeyboard); ini.Set("Core", "WiiKeyboard", m_WiiKeyboard);
ini.Set("Core", "WiimoteContinuousScanning", m_WiimoteContinuousScanning); ini.Set("Core", "WiimoteContinuousScanning", m_WiimoteContinuousScanning);
ini.Set("Core", "WiimoteEnableSpeaker", m_WiimoteEnableSpeaker); ini.Set("Core", "WiimoteEnableSpeaker", m_WiimoteEnableSpeaker);
ini.Set("Core", "RunCompareServer", m_LocalCoreStartupParameter.bRunCompareServer); ini.Set("Core", "RunCompareServer", m_LocalCoreStartupParameter.bRunCompareServer);
ini.Set("Core", "RunCompareClient", m_LocalCoreStartupParameter.bRunCompareClient); ini.Set("Core", "RunCompareClient", m_LocalCoreStartupParameter.bRunCompareClient);
ini.Set("Core", "FrameLimit", m_Framelimit); ini.Set("Core", "FrameLimit", m_Framelimit);
// GFX Backend // GFX Backend
ini.Set("Core", "GFXBackend", m_LocalCoreStartupParameter.m_strVideoBackend); ini.Set("Core", "GFXBackend", m_LocalCoreStartupParameter.m_strVideoBackend);
// Movie // Movie
ini.Set("Movie", "PauseMovie", m_PauseMovie); ini.Set("Movie", "PauseMovie", m_PauseMovie);
@ -287,7 +287,7 @@ void SConfig::LoadSettings()
// General // General
{ {
ini.Get("General", "LastFilename", &m_LastFilename); ini.Get("General", "LastFilename", &m_LastFilename);
ini.Get("General", "ShowLag", &m_ShowLag, false); ini.Get("General", "ShowLag", &m_ShowLag, false);
#ifdef USE_GDBSTUB #ifdef USE_GDBSTUB
ini.Get("General", "GDBPort", &(m_LocalCoreStartupParameter.iGDBPort), -1); ini.Get("General", "GDBPort", &(m_LocalCoreStartupParameter.iGDBPort), -1);
@ -306,119 +306,119 @@ void SConfig::LoadSettings()
} }
} }
ini.Get("General", "RecursiveGCMPaths", &m_RecursiveISOFolder, false); ini.Get("General", "RecursiveGCMPaths", &m_RecursiveISOFolder, false);
ini.Get("General", "NANDRootPath", &m_NANDPath); ini.Get("General", "NANDRootPath", &m_NANDPath);
m_NANDPath = File::GetUserPath(D_WIIROOT_IDX, m_NANDPath); m_NANDPath = File::GetUserPath(D_WIIROOT_IDX, m_NANDPath);
DiscIO::cUIDsys::AccessInstance().UpdateLocation(); DiscIO::cUIDsys::AccessInstance().UpdateLocation();
DiscIO::CSharedContent::AccessInstance().UpdateLocation(); DiscIO::CSharedContent::AccessInstance().UpdateLocation();
ini.Get("General", "WirelessMac", &m_WirelessMac); ini.Get("General", "WirelessMac", &m_WirelessMac);
} }
{ {
// Interface // Interface
ini.Get("Interface", "ConfirmStop", &m_LocalCoreStartupParameter.bConfirmStop, true); ini.Get("Interface", "ConfirmStop", &m_LocalCoreStartupParameter.bConfirmStop, true);
ini.Get("Interface", "UsePanicHandlers", &m_LocalCoreStartupParameter.bUsePanicHandlers, true); ini.Get("Interface", "UsePanicHandlers", &m_LocalCoreStartupParameter.bUsePanicHandlers, true);
ini.Get("Interface", "OnScreenDisplayMessages", &m_LocalCoreStartupParameter.bOnScreenDisplayMessages, true); ini.Get("Interface", "OnScreenDisplayMessages", &m_LocalCoreStartupParameter.bOnScreenDisplayMessages, true);
ini.Get("Interface", "HideCursor", &m_LocalCoreStartupParameter.bHideCursor, false); ini.Get("Interface", "HideCursor", &m_LocalCoreStartupParameter.bHideCursor, false);
ini.Get("Interface", "AutoHideCursor", &m_LocalCoreStartupParameter.bAutoHideCursor, false); ini.Get("Interface", "AutoHideCursor", &m_LocalCoreStartupParameter.bAutoHideCursor, false);
ini.Get("Interface", "MainWindowPosX", &m_LocalCoreStartupParameter.iPosX, 100); ini.Get("Interface", "MainWindowPosX", &m_LocalCoreStartupParameter.iPosX, 100);
ini.Get("Interface", "MainWindowPosY", &m_LocalCoreStartupParameter.iPosY, 100); ini.Get("Interface", "MainWindowPosY", &m_LocalCoreStartupParameter.iPosY, 100);
ini.Get("Interface", "MainWindowWidth", &m_LocalCoreStartupParameter.iWidth, 800); ini.Get("Interface", "MainWindowWidth", &m_LocalCoreStartupParameter.iWidth, 800);
ini.Get("Interface", "MainWindowHeight", &m_LocalCoreStartupParameter.iHeight, 600); ini.Get("Interface", "MainWindowHeight", &m_LocalCoreStartupParameter.iHeight, 600);
ini.Get("Interface", "Language", &m_InterfaceLanguage, 0); ini.Get("Interface", "Language", &m_InterfaceLanguage, 0);
ini.Get("Interface", "ShowToolbar", &m_InterfaceToolbar, true); ini.Get("Interface", "ShowToolbar", &m_InterfaceToolbar, true);
ini.Get("Interface", "ShowStatusbar", &m_InterfaceStatusbar, true); ini.Get("Interface", "ShowStatusbar", &m_InterfaceStatusbar, true);
ini.Get("Interface", "ShowLogWindow", &m_InterfaceLogWindow, false); ini.Get("Interface", "ShowLogWindow", &m_InterfaceLogWindow, false);
ini.Get("Interface", "ShowLogConfigWindow", &m_InterfaceLogConfigWindow, false); ini.Get("Interface", "ShowLogConfigWindow", &m_InterfaceLogConfigWindow, false);
ini.Get("Interface", "ShowConsole", &m_InterfaceConsole, false); ini.Get("Interface", "ShowConsole", &m_InterfaceConsole, false);
ini.Get("Interface", "ThemeName40", &m_LocalCoreStartupParameter.theme_name, "Clean"); ini.Get("Interface", "ThemeName40", &m_LocalCoreStartupParameter.theme_name, "Clean");
// Hotkeys // Hotkeys
for (int i = 0; i < NUM_HOTKEYS; i++) for (int i = 0; i < NUM_HOTKEYS; i++)
{ {
ini.Get("Hotkeys", g_HKData[i].IniText, ini.Get("Hotkeys", g_HKData[i].IniText,
&m_LocalCoreStartupParameter.iHotkey[i], g_HKData[i].DefaultKey); &m_LocalCoreStartupParameter.iHotkey[i], g_HKData[i].DefaultKey);
ini.Get("Hotkeys", std::string(g_HKData[i].IniText) + "Modifier", ini.Get("Hotkeys", std::string(g_HKData[i].IniText) + "Modifier",
&m_LocalCoreStartupParameter.iHotkeyModifier[i], g_HKData[i].DefaultModifier); &m_LocalCoreStartupParameter.iHotkeyModifier[i], g_HKData[i].DefaultModifier);
} }
// Display // Display
ini.Get("Display", "Fullscreen", &m_LocalCoreStartupParameter.bFullscreen, false); ini.Get("Display", "Fullscreen", &m_LocalCoreStartupParameter.bFullscreen, false);
ini.Get("Display", "FullscreenResolution", &m_LocalCoreStartupParameter.strFullscreenResolution, "Auto"); ini.Get("Display", "FullscreenResolution", &m_LocalCoreStartupParameter.strFullscreenResolution, "Auto");
ini.Get("Display", "RenderToMain", &m_LocalCoreStartupParameter.bRenderToMain, false); ini.Get("Display", "RenderToMain", &m_LocalCoreStartupParameter.bRenderToMain, false);
ini.Get("Display", "RenderWindowXPos", &m_LocalCoreStartupParameter.iRenderWindowXPos, -1); ini.Get("Display", "RenderWindowXPos", &m_LocalCoreStartupParameter.iRenderWindowXPos, -1);
ini.Get("Display", "RenderWindowYPos", &m_LocalCoreStartupParameter.iRenderWindowYPos, -1); ini.Get("Display", "RenderWindowYPos", &m_LocalCoreStartupParameter.iRenderWindowYPos, -1);
ini.Get("Display", "RenderWindowWidth", &m_LocalCoreStartupParameter.iRenderWindowWidth, 640); ini.Get("Display", "RenderWindowWidth", &m_LocalCoreStartupParameter.iRenderWindowWidth, 640);
ini.Get("Display", "RenderWindowHeight", &m_LocalCoreStartupParameter.iRenderWindowHeight, 480); ini.Get("Display", "RenderWindowHeight", &m_LocalCoreStartupParameter.iRenderWindowHeight, 480);
ini.Get("Display", "RenderWindowAutoSize", &m_LocalCoreStartupParameter.bRenderWindowAutoSize, false); ini.Get("Display", "RenderWindowAutoSize", &m_LocalCoreStartupParameter.bRenderWindowAutoSize, false);
ini.Get("Display", "KeepWindowOnTop", &m_LocalCoreStartupParameter.bKeepWindowOnTop, false); ini.Get("Display", "KeepWindowOnTop", &m_LocalCoreStartupParameter.bKeepWindowOnTop, false);
ini.Get("Display", "ProgressiveScan", &m_LocalCoreStartupParameter.bProgressive, false); ini.Get("Display", "ProgressiveScan", &m_LocalCoreStartupParameter.bProgressive, false);
ini.Get("Display", "DisableScreenSaver", &m_LocalCoreStartupParameter.bDisableScreenSaver, true); ini.Get("Display", "DisableScreenSaver", &m_LocalCoreStartupParameter.bDisableScreenSaver, true);
ini.Get("Display", "ForceNTSCJ", &m_LocalCoreStartupParameter.bForceNTSCJ, false); ini.Get("Display", "ForceNTSCJ", &m_LocalCoreStartupParameter.bForceNTSCJ, false);
// Game List Control // Game List Control
ini.Get("GameList", "ListDrives", &m_ListDrives, false); ini.Get("GameList", "ListDrives", &m_ListDrives, false);
ini.Get("GameList", "ListWad", &m_ListWad, true); ini.Get("GameList", "ListWad", &m_ListWad, true);
ini.Get("GameList", "ListWii", &m_ListWii, true); ini.Get("GameList", "ListWii", &m_ListWii, true);
ini.Get("GameList", "ListGC", &m_ListGC, true); ini.Get("GameList", "ListGC", &m_ListGC, true);
ini.Get("GameList", "ListJap", &m_ListJap, true); ini.Get("GameList", "ListJap", &m_ListJap, true);
ini.Get("GameList", "ListPal", &m_ListPal, true); ini.Get("GameList", "ListPal", &m_ListPal, true);
ini.Get("GameList", "ListUsa", &m_ListUsa, true); ini.Get("GameList", "ListUsa", &m_ListUsa, true);
ini.Get("GameList", "ListFrance", &m_ListFrance, true); ini.Get("GameList", "ListFrance", &m_ListFrance, true);
ini.Get("GameList", "ListItaly", &m_ListItaly, true); ini.Get("GameList", "ListItaly", &m_ListItaly, true);
ini.Get("GameList", "ListKorea", &m_ListKorea, true); ini.Get("GameList", "ListKorea", &m_ListKorea, true);
ini.Get("GameList", "ListTaiwan", &m_ListTaiwan, true); ini.Get("GameList", "ListTaiwan", &m_ListTaiwan, true);
ini.Get("GameList", "ListUnknown", &m_ListUnknown, true); ini.Get("GameList", "ListUnknown", &m_ListUnknown, true);
ini.Get("GameList", "ListSort", &m_ListSort, 3); ini.Get("GameList", "ListSort", &m_ListSort, 3);
ini.Get("GameList", "ListSortSecondary",&m_ListSort2, 0); ini.Get("GameList", "ListSortSecondary",&m_ListSort2, 0);
// Core // Core
ini.Get("Core", "HLE_BS2", &m_LocalCoreStartupParameter.bHLE_BS2, false); ini.Get("Core", "HLE_BS2", &m_LocalCoreStartupParameter.bHLE_BS2, false);
#ifdef _M_ARM #ifdef _M_ARM
ini.Get("Core", "CPUCore", &m_LocalCoreStartupParameter.iCPUCore, 3); ini.Get("Core", "CPUCore", &m_LocalCoreStartupParameter.iCPUCore, 3);
#else #else
ini.Get("Core", "CPUCore", &m_LocalCoreStartupParameter.iCPUCore, 1); ini.Get("Core", "CPUCore", &m_LocalCoreStartupParameter.iCPUCore, 1);
#endif #endif
ini.Get("Core", "Fastmem", &m_LocalCoreStartupParameter.bFastmem, true); ini.Get("Core", "Fastmem", &m_LocalCoreStartupParameter.bFastmem, true);
ini.Get("Core", "DSPThread", &m_LocalCoreStartupParameter.bDSPThread, false); ini.Get("Core", "DSPThread", &m_LocalCoreStartupParameter.bDSPThread, false);
ini.Get("Core", "DSPHLE", &m_LocalCoreStartupParameter.bDSPHLE, true); ini.Get("Core", "DSPHLE", &m_LocalCoreStartupParameter.bDSPHLE, true);
ini.Get("Core", "CPUThread", &m_LocalCoreStartupParameter.bCPUThread, true); ini.Get("Core", "CPUThread", &m_LocalCoreStartupParameter.bCPUThread, true);
ini.Get("Core", "SkipIdle", &m_LocalCoreStartupParameter.bSkipIdle, true); ini.Get("Core", "SkipIdle", &m_LocalCoreStartupParameter.bSkipIdle, true);
ini.Get("Core", "DefaultGCM", &m_LocalCoreStartupParameter.m_strDefaultGCM); ini.Get("Core", "DefaultGCM", &m_LocalCoreStartupParameter.m_strDefaultGCM);
ini.Get("Core", "DVDRoot", &m_LocalCoreStartupParameter.m_strDVDRoot); ini.Get("Core", "DVDRoot", &m_LocalCoreStartupParameter.m_strDVDRoot);
ini.Get("Core", "Apploader", &m_LocalCoreStartupParameter.m_strApploader); ini.Get("Core", "Apploader", &m_LocalCoreStartupParameter.m_strApploader);
ini.Get("Core", "EnableCheats", &m_LocalCoreStartupParameter.bEnableCheats, false); ini.Get("Core", "EnableCheats", &m_LocalCoreStartupParameter.bEnableCheats, false);
ini.Get("Core", "SelectedLanguage", &m_LocalCoreStartupParameter.SelectedLanguage, 0); ini.Get("Core", "SelectedLanguage", &m_LocalCoreStartupParameter.SelectedLanguage, 0);
ini.Get("Core", "DPL2Decoder", &m_LocalCoreStartupParameter.bDPL2Decoder, false); ini.Get("Core", "DPL2Decoder", &m_LocalCoreStartupParameter.bDPL2Decoder, false);
ini.Get("Core", "Latency", &m_LocalCoreStartupParameter.iLatency, 2); ini.Get("Core", "Latency", &m_LocalCoreStartupParameter.iLatency, 2);
ini.Get("Core", "MemcardAPath", &m_strMemoryCardA); ini.Get("Core", "MemcardAPath", &m_strMemoryCardA);
ini.Get("Core", "MemcardBPath", &m_strMemoryCardB); ini.Get("Core", "MemcardBPath", &m_strMemoryCardB);
ini.Get("Core", "SlotA", (int*)&m_EXIDevice[0], EXIDEVICE_MEMORYCARD); ini.Get("Core", "SlotA", (int*)&m_EXIDevice[0], EXIDEVICE_MEMORYCARD);
ini.Get("Core", "SlotB", (int*)&m_EXIDevice[1], EXIDEVICE_NONE); ini.Get("Core", "SlotB", (int*)&m_EXIDevice[1], EXIDEVICE_NONE);
ini.Get("Core", "SerialPort1", (int*)&m_EXIDevice[2], EXIDEVICE_NONE); ini.Get("Core", "SerialPort1", (int*)&m_EXIDevice[2], EXIDEVICE_NONE);
ini.Get("Core", "BBA_MAC", &m_bba_mac); ini.Get("Core", "BBA_MAC", &m_bba_mac);
ini.Get("Core", "TimeProfiling",&m_LocalCoreStartupParameter.bJITILTimeProfiling, false); ini.Get("Core", "TimeProfiling", &m_LocalCoreStartupParameter.bJITILTimeProfiling, false);
ini.Get("Core", "OutputIR", &m_LocalCoreStartupParameter.bJITILOutputIR, false); ini.Get("Core", "OutputIR", &m_LocalCoreStartupParameter.bJITILOutputIR, false);
for (int i = 0; i < MAX_SI_CHANNELS; ++i) for (int i = 0; i < MAX_SI_CHANNELS; ++i)
{ {
ini.Get("Core", StringFromFormat("SIDevice%i", i), (u32*)&m_SIDevice[i], (i == 0) ? SIDEVICE_GC_CONTROLLER : SIDEVICE_NONE); ini.Get("Core", StringFromFormat("SIDevice%i", i), (u32*)&m_SIDevice[i], (i == 0) ? SIDEVICE_GC_CONTROLLER : SIDEVICE_NONE);
} }
ini.Get("Core", "WiiSDCard", &m_WiiSDCard, false); ini.Get("Core", "WiiSDCard", &m_WiiSDCard, false);
ini.Get("Core", "WiiKeyboard", &m_WiiKeyboard, false); ini.Get("Core", "WiiKeyboard", &m_WiiKeyboard, false);
ini.Get("Core", "WiimoteContinuousScanning", &m_WiimoteContinuousScanning, false); ini.Get("Core", "WiimoteContinuousScanning", &m_WiimoteContinuousScanning, false);
ini.Get("Core", "WiimoteEnableSpeaker", &m_WiimoteEnableSpeaker, true); ini.Get("Core", "WiimoteEnableSpeaker", &m_WiimoteEnableSpeaker, true);
ini.Get("Core", "RunCompareServer", &m_LocalCoreStartupParameter.bRunCompareServer, false); ini.Get("Core", "RunCompareServer", &m_LocalCoreStartupParameter.bRunCompareServer, false);
ini.Get("Core", "RunCompareClient", &m_LocalCoreStartupParameter.bRunCompareClient, false); ini.Get("Core", "RunCompareClient", &m_LocalCoreStartupParameter.bRunCompareClient, false);
ini.Get("Core", "MMU", &m_LocalCoreStartupParameter.bMMU, false); ini.Get("Core", "MMU", &m_LocalCoreStartupParameter.bMMU, false);
ini.Get("Core", "TLBHack", &m_LocalCoreStartupParameter.bTLBHack, false); ini.Get("Core", "TLBHack", &m_LocalCoreStartupParameter.bTLBHack, false);
ini.Get("Core", "BBDumpPort", &m_LocalCoreStartupParameter.iBBDumpPort, -1); ini.Get("Core", "BBDumpPort", &m_LocalCoreStartupParameter.iBBDumpPort, -1);
ini.Get("Core", "VBeam", &m_LocalCoreStartupParameter.bVBeamSpeedHack, false); ini.Get("Core", "VBeam", &m_LocalCoreStartupParameter.bVBeamSpeedHack, false);
ini.Get("Core", "SyncGPU", &m_LocalCoreStartupParameter.bSyncGPU, false); ini.Get("Core", "SyncGPU", &m_LocalCoreStartupParameter.bSyncGPU, false);
ini.Get("Core", "FastDiscSpeed", &m_LocalCoreStartupParameter.bFastDiscSpeed, false); ini.Get("Core", "FastDiscSpeed", &m_LocalCoreStartupParameter.bFastDiscSpeed, false);
ini.Get("Core", "DCBZ", &m_LocalCoreStartupParameter.bDCBZOFF, false); ini.Get("Core", "DCBZ", &m_LocalCoreStartupParameter.bDCBZOFF, false);
ini.Get("Core", "FrameLimit", &m_Framelimit, 1); // auto frame limit by default ini.Get("Core", "FrameLimit", &m_Framelimit, 1); // auto frame limit by default
// GFX Backend // GFX Backend
ini.Get("Core", "GFXBackend", &m_LocalCoreStartupParameter.m_strVideoBackend, ""); ini.Get("Core", "GFXBackend", &m_LocalCoreStartupParameter.m_strVideoBackend, "");

View File

@ -24,39 +24,39 @@ u8 code_flags[ISPACE];
const u16 idle_skip_sigs[NUM_IDLE_SIGS][MAX_IDLE_SIG_SIZE + 1] = const u16 idle_skip_sigs[NUM_IDLE_SIGS][MAX_IDLE_SIG_SIZE + 1] =
{ {
// From AX: // From AX:
{ 0x26fc, // LRS $30, @DMBH { 0x26fc, // LRS $30, @DMBH
0x02c0, 0x8000, // ANDCF $30, #0x8000 0x02c0, 0x8000, // ANDCF $30, #0x8000
0x029d, 0xFFFF, // JLZ 0x027a 0x029d, 0xFFFF, // JLZ 0x027a
0, 0 }, // RET 0, 0 }, // RET
{ 0x27fc, // LRS $31, @DMBH { 0x27fc, // LRS $31, @DMBH
0x03c0, 0x8000, // ANDCF $31, #0x8000 0x03c0, 0x8000, // ANDCF $31, #0x8000
0x029d, 0xFFFF, // JLZ 0x027a 0x029d, 0xFFFF, // JLZ 0x027a
0, 0 }, // RET 0, 0 }, // RET
{ 0x26fe, // LRS $30, @CMBH { 0x26fe, // LRS $30, @CMBH
0x02c0, 0x8000, // ANDCF $30, #0x8000 0x02c0, 0x8000, // ANDCF $30, #0x8000
0x029c, 0xFFFF, // JLNZ 0x0280 0x029c, 0xFFFF, // JLNZ 0x0280
0, 0 }, // RET 0, 0 }, // RET
{ 0x27fe, // LRS $31, @CMBH { 0x27fe, // LRS $31, @CMBH
0x03c0, 0x8000, // ANDCF $31, #0x8000 0x03c0, 0x8000, // ANDCF $31, #0x8000
0x029c, 0xFFFF, // JLNZ 0x0280 0x029c, 0xFFFF, // JLNZ 0x0280
0, 0 }, // RET 0, 0 }, // RET
{ 0x26fc, // lrs $AC0.M, @DMBH { 0x26fc, // LRS $AC0.M, @DMBH
0x02a0, 0x8000, // andf $AC0.M, #0x8000 0x02a0, 0x8000, // ANDF $AC0.M, #0x8000
0x029c, 0xFFFF, // jlnz 0x???? 0x029c, 0xFFFF, // JLNZ 0x????
0, 0 }, 0, 0 },
{ 0x27fc, // lrs $AC1.M, @DMBH { 0x27fc, // LRS $AC1.M, @DMBH
0x03a0, 0x8000, // andf $AC1.M, #0x8000 0x03a0, 0x8000, // ANDF $AC1.M, #0x8000
0x029c, 0xFFFF, // jlnz 0x???? 0x029c, 0xFFFF, // JLNZ 0x????
0, 0 }, 0, 0 },
// From Zelda: // From Zelda:
{ 0x00de, 0xFFFE, // LR $AC0.M, @CMBH { 0x00de, 0xFFFE, // LR $AC0.M, @CMBH
0x02c0, 0x8000, // ANDCF $AC0.M, #0x8000 0x02c0, 0x8000, // ANDCF $AC0.M, #0x8000
0x029c, 0xFFFF, // JLNZ 0x05cf 0x029c, 0xFFFF, // JLNZ 0x05cf
0 }, 0 },
// From Zelda - experimental // From Zelda - experimental
{ 0x00da, 0x0352, // lr $AX0.H, @0x0352 { 0x00da, 0x0352, // LR $AX0.H, @0x0352
0x8600, // tstaxh $AX0.H 0x8600, // TSTAXH $AX0.H
0x0295, 0xFFFF, // jz 0x???? 0x0295, 0xFFFF, // JZ 0x????
0, 0 } 0, 0 }
}; };

View File

@ -30,154 +30,154 @@
#include "DSPBreakpoints.h" #include "DSPBreakpoints.h"
#include "DSPEmitter.h" #include "DSPEmitter.h"
#define DSP_IRAM_BYTE_SIZE 0x2000 #define DSP_IRAM_BYTE_SIZE 0x2000
#define DSP_IRAM_SIZE 0x1000 #define DSP_IRAM_SIZE 0x1000
#define DSP_IRAM_MASK 0x0fff #define DSP_IRAM_MASK 0x0fff
#define DSP_IROM_BYTE_SIZE 0x2000 #define DSP_IROM_BYTE_SIZE 0x2000
#define DSP_IROM_SIZE 0x1000 #define DSP_IROM_SIZE 0x1000
#define DSP_IROM_MASK 0x0fff #define DSP_IROM_MASK 0x0fff
#define DSP_DRAM_BYTE_SIZE 0x2000 #define DSP_DRAM_BYTE_SIZE 0x2000
#define DSP_DRAM_SIZE 0x1000 #define DSP_DRAM_SIZE 0x1000
#define DSP_DRAM_MASK 0x0fff #define DSP_DRAM_MASK 0x0fff
#define DSP_COEF_BYTE_SIZE 0x1000 #define DSP_COEF_BYTE_SIZE 0x1000
#define DSP_COEF_SIZE 0x800 #define DSP_COEF_SIZE 0x800
#define DSP_COEF_MASK 0x7ff #define DSP_COEF_MASK 0x7ff
#define DSP_RESET_VECTOR 0x8000 #define DSP_RESET_VECTOR 0x8000
#define DSP_STACK_DEPTH 0x20 #define DSP_STACK_DEPTH 0x20
#define DSP_STACK_MASK 0x1f #define DSP_STACK_MASK 0x1f
#define DSP_CR_IMEM 2 #define DSP_CR_IMEM 2
#define DSP_CR_DMEM 0 #define DSP_CR_DMEM 0
#define DSP_CR_TO_CPU 1 #define DSP_CR_TO_CPU 1
#define DSP_CR_FROM_CPU 0 #define DSP_CR_FROM_CPU 0
// Register table taken from libasnd // Register table taken from libasnd
#define DSP_REG_AR0 0x00 // address registers #define DSP_REG_AR0 0x00 // address registers
#define DSP_REG_AR1 0x01 #define DSP_REG_AR1 0x01
#define DSP_REG_AR2 0x02 #define DSP_REG_AR2 0x02
#define DSP_REG_AR3 0x03 #define DSP_REG_AR3 0x03
#define DSP_REG_IX0 0x04 // indexing registers (actually, mostly used as increments) #define DSP_REG_IX0 0x04 // indexing registers (actually, mostly used as increments)
#define DSP_REG_IX1 0x05 #define DSP_REG_IX1 0x05
#define DSP_REG_IX2 0x06 #define DSP_REG_IX2 0x06
#define DSP_REG_IX3 0x07 #define DSP_REG_IX3 0x07
#define DSP_REG_WR0 0x08 // address wrapping registers. should be initialized to 0xFFFF if not used. #define DSP_REG_WR0 0x08 // address wrapping registers. should be initialized to 0xFFFF if not used.
#define DSP_REG_WR1 0x09 #define DSP_REG_WR1 0x09
#define DSP_REG_WR2 0x0a #define DSP_REG_WR2 0x0a
#define DSP_REG_WR3 0x0b #define DSP_REG_WR3 0x0b
#define DSP_REG_ST0 0x0c // stacks. #define DSP_REG_ST0 0x0c // stacks.
#define DSP_REG_ST1 0x0d #define DSP_REG_ST1 0x0d
#define DSP_REG_ST2 0x0e #define DSP_REG_ST2 0x0e
#define DSP_REG_ST3 0x0f #define DSP_REG_ST3 0x0f
#define DSP_REG_CR 0x12 // Seems to be the top 8 bits of LRS/SRS. #define DSP_REG_CR 0x12 // Seems to be the top 8 bits of LRS/SRS.
#define DSP_REG_SR 0x13 #define DSP_REG_SR 0x13
#define DSP_REG_PRODL 0x14 // product. #define DSP_REG_PRODL 0x14 // product.
#define DSP_REG_PRODM 0x15 #define DSP_REG_PRODM 0x15
#define DSP_REG_PRODH 0x16 #define DSP_REG_PRODH 0x16
#define DSP_REG_PRODM2 0x17 #define DSP_REG_PRODM2 0x17
#define DSP_REG_AXL0 0x18 #define DSP_REG_AXL0 0x18
#define DSP_REG_AXL1 0x19 #define DSP_REG_AXL1 0x19
#define DSP_REG_AXH0 0x1a #define DSP_REG_AXH0 0x1a
#define DSP_REG_AXH1 0x1b #define DSP_REG_AXH1 0x1b
#define DSP_REG_ACC0 0x1c // accumulator (global) #define DSP_REG_ACC0 0x1c // accumulator (global)
#define DSP_REG_ACC1 0x1d #define DSP_REG_ACC1 0x1d
#define DSP_REG_ACL0 0x1c // Low accumulator #define DSP_REG_ACL0 0x1c // Low accumulator
#define DSP_REG_ACL1 0x1d #define DSP_REG_ACL1 0x1d
#define DSP_REG_ACM0 0x1e // Mid accumulator #define DSP_REG_ACM0 0x1e // Mid accumulator
#define DSP_REG_ACM1 0x1f #define DSP_REG_ACM1 0x1f
#define DSP_REG_ACH0 0x10 // Sign extended 8 bit register 0 #define DSP_REG_ACH0 0x10 // Sign extended 8 bit register 0
#define DSP_REG_ACH1 0x11 // Sign extended 8 bit register 1 #define DSP_REG_ACH1 0x11 // Sign extended 8 bit register 1
// Hardware registers address // Hardware registers address
#define DSP_COEF_A1_0 0xa0 #define DSP_COEF_A1_0 0xa0
#define DSP_DSCR 0xc9 // DSP DMA Control Reg #define DSP_DSCR 0xc9 // DSP DMA Control Reg
#define DSP_DSPA 0xcd // DSP DMA Address (DSP) #define DSP_DSPA 0xcd // DSP DMA Address (DSP)
#define DSP_DSBL 0xcb // DSP DMA Block Length #define DSP_DSBL 0xcb // DSP DMA Block Length
#define DSP_DSMAH 0xce // DSP DMA Address High (External) #define DSP_DSMAH 0xce // DSP DMA Address High (External)
#define DSP_DSMAL 0xcf // DSP DMA Address Low (External) #define DSP_DSMAL 0xcf // DSP DMA Address Low (External)
#define DSP_FORMAT 0xd1 // Sample format #define DSP_FORMAT 0xd1 // Sample format
#define DSP_ACUNK 0xd2 // Set to 3 on my dumps #define DSP_ACUNK 0xd2 // Set to 3 on my dumps
#define DSP_ACDATA1 0xd3 // used only by Zelda ucodes #define DSP_ACDATA1 0xd3 // used only by Zelda ucodes
#define DSP_ACSAH 0xd4 // Start of loop #define DSP_ACSAH 0xd4 // Start of loop
#define DSP_ACSAL 0xd5 #define DSP_ACSAL 0xd5
#define DSP_ACEAH 0xd6 // End of sample (and loop) #define DSP_ACEAH 0xd6 // End of sample (and loop)
#define DSP_ACEAL 0xd7 #define DSP_ACEAL 0xd7
#define DSP_ACCAH 0xd8 // Current playback position #define DSP_ACCAH 0xd8 // Current playback position
#define DSP_ACCAL 0xd9 #define DSP_ACCAL 0xd9
#define DSP_PRED_SCALE 0xda // ADPCM predictor and scale #define DSP_PRED_SCALE 0xda // ADPCM predictor and scale
#define DSP_YN1 0xdb #define DSP_YN1 0xdb
#define DSP_YN2 0xdc #define DSP_YN2 0xdc
#define DSP_ACCELERATOR 0xdd // ADPCM accelerator read. Used by AX. #define DSP_ACCELERATOR 0xdd // ADPCM accelerator read. Used by AX.
#define DSP_GAIN 0xde #define DSP_GAIN 0xde
#define DSP_ACUNK2 0xdf // Set to 0xc on my dumps #define DSP_ACUNK2 0xdf // Set to 0xc on my dumps
#define DSP_AMDM 0xef // ARAM DMA Request Mask 0: DMA with ARAM unmasked 1: masked #define DSP_AMDM 0xef // ARAM DMA Request Mask 0: DMA with ARAM unmasked 1: masked
#define DSP_DIRQ 0xfb // DSP Irq Rest #define DSP_DIRQ 0xfb // DSP Irq Rest
#define DSP_DMBH 0xfc // DSP Mailbox H #define DSP_DMBH 0xfc // DSP Mailbox H
#define DSP_DMBL 0xfd // DSP Mailbox L #define DSP_DMBL 0xfd // DSP Mailbox L
#define DSP_CMBH 0xfe // CPU Mailbox H #define DSP_CMBH 0xfe // CPU Mailbox H
#define DSP_CMBL 0xff // CPU Mailbox L #define DSP_CMBL 0xff // CPU Mailbox L
#define DMA_TO_DSP 0 #define DMA_TO_DSP 0
#define DMA_TO_CPU 1 #define DMA_TO_CPU 1
// Stacks // Stacks
#define DSP_STACK_C 0 #define DSP_STACK_C 0
#define DSP_STACK_D 1 #define DSP_STACK_D 1
// cr (Not g_dsp.r[CR]) bits // cr (Not g_dsp.r[CR]) bits
// See HW/DSP.cpp. // See HW/DSP.cpp.
#define CR_EXTERNAL_INT 0x0002 #define CR_EXTERNAL_INT 0x0002
#define CR_HALT 0x0004 #define CR_HALT 0x0004
#define CR_INIT 0x0400 #define CR_INIT 0x0400
// SR bits // SR bits
#define SR_CARRY 0x0001 #define SR_CARRY 0x0001
#define SR_OVERFLOW 0x0002 #define SR_OVERFLOW 0x0002
#define SR_ARITH_ZERO 0x0004 #define SR_ARITH_ZERO 0x0004
#define SR_SIGN 0x0008 #define SR_SIGN 0x0008
#define SR_OVER_S32 0x0010 // set when there was mod/tst/cmp on accu and result is over s32 #define SR_OVER_S32 0x0010 // set when there was mod/tst/cmp on accu and result is over s32
#define SR_TOP2BITS 0x0020 // if the upper (ac?.m/ax?.h) 2 bits are equal #define SR_TOP2BITS 0x0020 // if the upper (ac?.m/ax?.h) 2 bits are equal
#define SR_LOGIC_ZERO 0x0040 #define SR_LOGIC_ZERO 0x0040
#define SR_OVERFLOW_STICKY 0x0080 // set at the same time as 0x2 (under same conditions) - but not cleared the same #define SR_OVERFLOW_STICKY 0x0080 // set at the same time as 0x2 (under same conditions) - but not cleared the same
#define SR_100 0x0100 // unknown #define SR_100 0x0100 // unknown
#define SR_INT_ENABLE 0x0200 // Not 100% sure but duddie says so. This should replace the hack, if so. #define SR_INT_ENABLE 0x0200 // Not 100% sure but duddie says so. This should replace the hack, if so.
#define SR_400 0x0400 // unknown #define SR_400 0x0400 // unknown
#define SR_EXT_INT_ENABLE 0x0800 // Appears in zelda - seems to disable external interrupts #define SR_EXT_INT_ENABLE 0x0800 // Appears in zelda - seems to disable external interrupts
#define SR_1000 0x1000 // unknown #define SR_1000 0x1000 // unknown
#define SR_MUL_MODIFY 0x2000 // 1 = normal. 0 = x2 (M0, M2) (Free mul by 2) #define SR_MUL_MODIFY 0x2000 // 1 = normal. 0 = x2 (M0, M2) (Free mul by 2)
#define SR_40_MODE_BIT 0x4000 // 0 = "16", 1 = "40" (SET16, SET40) Controls sign extension when loading mid accums and data saturation for stores from mid accums. #define SR_40_MODE_BIT 0x4000 // 0 = "16", 1 = "40" (SET16, SET40) Controls sign extension when loading mid accums and data saturation for stores from mid accums.
#define SR_MUL_UNSIGNED 0x8000 // 0 = normal. 1 = unsigned (CLR15, SET15) If set, treats ax?.l as unsigned (MULX family only). #define SR_MUL_UNSIGNED 0x8000 // 0 = normal. 1 = unsigned (CLR15, SET15) If set, treats ax?.l as unsigned (MULX family only).
// This should be the bits affected by CMP. Does not include logic zero. // This should be the bits affected by CMP. Does not include logic zero.
#define SR_CMP_MASK 0x3f #define SR_CMP_MASK 0x3f
// exceptions vector // exceptions vector
#define EXP_STOVF 1 // 0x0002 stack under/over flow #define EXP_STOVF 1 // 0x0002 stack under/over flow
#define EXP_2 2 // 0x0004 #define EXP_2 2 // 0x0004
#define EXP_3 3 // 0x0006 #define EXP_3 3 // 0x0006
#define EXP_4 4 // 0x0008 #define EXP_4 4 // 0x0008
#define EXP_ACCOV 5 // 0x000a accelerator address overflow #define EXP_ACCOV 5 // 0x000a accelerator address overflow
#define EXP_6 6 // 0x000c #define EXP_6 6 // 0x000c
#define EXP_INT 7 // 0x000e external int (message from cpu) #define EXP_INT 7 // 0x000e external int (message from cpu)
typedef struct { typedef struct {
u16 ar[4]; u16 ar[4];

View File

@ -41,10 +41,8 @@ public:
// CC Util // CC Util
void Update_SR_Register64(Gen::X64Reg val = Gen::EAX); void Update_SR_Register64(Gen::X64Reg val = Gen::EAX);
void Update_SR_Register64_Carry(Gen::X64Reg val, void Update_SR_Register64_Carry(Gen::X64Reg val, Gen::X64Reg carry_ovfl);
Gen::X64Reg carry_ovfl); void Update_SR_Register64_Carry2(Gen::X64Reg val, Gen::X64Reg carry_ovfl);
void Update_SR_Register64_Carry2(Gen::X64Reg val,
Gen::X64Reg carry_ovfl);
void Update_SR_Register16(Gen::X64Reg val = Gen::EAX); void Update_SR_Register16(Gen::X64Reg val = Gen::EAX);
void Update_SR_Register16_OverS32(Gen::X64Reg val = Gen::EAX); void Update_SR_Register16_OverS32(Gen::X64Reg val = Gen::EAX);

View File

@ -310,15 +310,10 @@ static void gdsp_ddma_out(u16 dsp_addr, u32 addr, u32 size)
static void gdsp_do_dma() static void gdsp_do_dma()
{ {
u16 ctl; u32 addr = (g_dsp.ifx_regs[DSP_DSMAH] << 16) | g_dsp.ifx_regs[DSP_DSMAL];
u32 addr; u16 ctl = g_dsp.ifx_regs[DSP_DSCR];
u16 dsp_addr; u16 dsp_addr = g_dsp.ifx_regs[DSP_DSPA] * 2;
u16 len; u16 len = g_dsp.ifx_regs[DSP_DSBL];
addr = (g_dsp.ifx_regs[DSP_DSMAH] << 16) | g_dsp.ifx_regs[DSP_DSMAL];
ctl = g_dsp.ifx_regs[DSP_DSCR];
dsp_addr = g_dsp.ifx_regs[DSP_DSPA] * 2;
len = g_dsp.ifx_regs[DSP_DSBL];
if (len > 0x4000) if (len > 0x4000)
{ {

View File

@ -31,14 +31,12 @@ CDump::~CDump(void)
} }
} }
int int CDump::GetNumberOfSteps(void)
CDump::GetNumberOfSteps(void)
{ {
return (int)(m_size / STRUCTUR_SIZE); return (int)(m_size / STRUCTUR_SIZE);
} }
u32 u32 CDump::GetGPR(int _step, int _gpr)
CDump::GetGPR(int _step, int _gpr)
{ {
u32 offset = _step * STRUCTUR_SIZE; u32 offset = _step * STRUCTUR_SIZE;
@ -48,8 +46,7 @@ CDump::GetGPR(int _step, int _gpr)
return Read32(offset + OFFSET_GPR + (_gpr * 4)); return Read32(offset + OFFSET_GPR + (_gpr * 4));
} }
u32 u32 CDump::GetPC(int _step)
CDump::GetPC(int _step)
{ {
u32 offset = _step * STRUCTUR_SIZE; u32 offset = _step * STRUCTUR_SIZE;
@ -59,13 +56,12 @@ CDump::GetPC(int _step)
return Read32(offset + OFFSET_PC); return Read32(offset + OFFSET_PC);
} }
u32 u32 CDump::Read32(u32 _pos)
CDump::Read32(u32 _pos)
{ {
u32 result = (m_pData[_pos+0] << 24) | u32 result = (m_pData[_pos+0] << 24) |
(m_pData[_pos+1] << 16) | (m_pData[_pos+1] << 16) |
(m_pData[_pos+2] << 8) | (m_pData[_pos+2] << 8) |
(m_pData[_pos+3] << 0); (m_pData[_pos+3] << 0);
return result; return result;
} }

View File

@ -5,43 +5,43 @@
#pragma once #pragma once
// ELF File Types // ELF File Types
#define ET_NONE 0 // No file type #define ET_NONE 0 // No file type
#define ET_REL 1 // Relocatable file #define ET_REL 1 // Relocatable file
#define ET_EXEC 2 // Executable file #define ET_EXEC 2 // Executable file
#define ET_DYN 3 // Shared object file #define ET_DYN 3 // Shared object file
#define ET_CORE 4 // Core file #define ET_CORE 4 // Core file
#define ET_LOPROC 0xFF00 // Processor specific #define ET_LOPROC 0xFF00 // Processor specific
#define ET_HIPROC 0xFFFF // Processor specific #define ET_HIPROC 0xFFFF // Processor specific
// ELF Machine Types // ELF Machine Types
#define EM_NONE 0 // No machine #define EM_NONE 0 // No machine
#define EM_M32 1 // AT&T WE 32100 #define EM_M32 1 // AT&T WE 32100
#define EM_SPARC 2 // SPARC #define EM_SPARC 2 // SPARC
#define EM_386 3 // Intel Architecture #define EM_386 3 // Intel Architecture
#define EM_68K 4 // Motorola 68000 #define EM_68K 4 // Motorola 68000
#define EM_88K 5 // Motorola 88000 #define EM_88K 5 // Motorola 88000
#define EM_860 6 // Intel 80860 #define EM_860 6 // Intel 80860
#define EM_MIPS 7 // MIPS RS3000 Big-Endian #define EM_MIPS 7 // MIPS RS3000 Big-Endian
#define EM_MIPS_RS4_BE 8 // MIPS RS4000 Big-Endian #define EM_MIPS_RS4_BE 8 // MIPS RS4000 Big-Endian
#define EM_ARM 40 // ARM/Thumb Architecture #define EM_ARM 40 // ARM/Thumb Architecture
// ELF Version Types // ELF Version Types
#define EV_NONE 0 // Invalid version #define EV_NONE 0 // Invalid version
#define EV_CURRENT 1 // Current version #define EV_CURRENT 1 // Current version
// ELF Section Header Types // ELF Section Header Types
#define SHT_NULL 0 #define SHT_NULL 0
#define SHT_PROGBITS 1 #define SHT_PROGBITS 1
#define SHT_SYMTAB 2 #define SHT_SYMTAB 2
#define SHT_STRTAB 3 #define SHT_STRTAB 3
#define SHT_RELA 4 #define SHT_RELA 4
#define SHT_HASH 5 #define SHT_HASH 5
#define SHT_DYNAMIC 6 #define SHT_DYNAMIC 6
#define SHT_NOTE 7 #define SHT_NOTE 7
#define SHT_NOBITS 8 #define SHT_NOBITS 8
#define SHT_REL 9 #define SHT_REL 9
#define SHT_SHLIB 10 #define SHT_SHLIB 10
#define SHT_DYNSYM 11 #define SHT_DYNSYM 11
typedef struct typedef struct

View File

@ -75,9 +75,9 @@ unsigned int PPCDebugInterface::readExtraMemory(int memory, unsigned int address
return Memory::ReadUnchecked_U32(address); return Memory::ReadUnchecked_U32(address);
case 1: case 1:
return (DSP::ReadARAM(address) << 24) | return (DSP::ReadARAM(address) << 24) |
(DSP::ReadARAM(address + 1) << 16) | (DSP::ReadARAM(address + 1) << 16) |
(DSP::ReadARAM(address + 2) << 8) | (DSP::ReadARAM(address + 2) << 8) |
(DSP::ReadARAM(address + 3)); (DSP::ReadARAM(address + 3));
default: default:
return 0; return 0;
} }
@ -140,7 +140,6 @@ void PPCDebugInterface::toggleMemCheck(unsigned int address)
MemCheck.Break = true; MemCheck.Break = true;
PowerPC::memchecks.Add(MemCheck); PowerPC::memchecks.Add(MemCheck);
} }
else else
PowerPC::memchecks.Remove(address); PowerPC::memchecks.Remove(address);

View File

@ -460,9 +460,9 @@ void GenerateDSPInterrupt(DSPInterruptType type, bool _bSet)
{ {
switch (type) switch (type)
{ {
case INT_DSP: g_dspState.DSPControl.DSP = _bSet ? 1 : 0; break; case INT_DSP: g_dspState.DSPControl.DSP = _bSet ? 1 : 0; break;
case INT_ARAM: g_dspState.DSPControl.ARAM = _bSet ? 1 : 0; if (_bSet) g_dspState.DSPControl.DMAState = 0; break; case INT_ARAM: g_dspState.DSPControl.ARAM = _bSet ? 1 : 0; if (_bSet) g_dspState.DSPControl.DMAState = 0; break;
case INT_AID: g_dspState.DSPControl.AID = _bSet ? 1 : 0; break; case INT_AID: g_dspState.DSPControl.AID = _bSet ? 1 : 0; break;
} }
UpdateInterrupts(); UpdateInterrupts();

View File

@ -247,23 +247,23 @@ void CUCode_Zelda::HandleMail_SMSVersion(u32 _uMail)
m_numSteps = _uMail; m_numSteps = _uMail;
m_step = 0; m_step = 0;
} }
else if ((_uMail >> 16) == 0xCDD1) // A 0xCDD1000X mail should come right after we send a DSP_SYNCEND mail else if ((_uMail >> 16) == 0xCDD1) // A 0xCDD1000X mail should come right after we send a DSP_SYNCEND mail
{ {
// The low part of the mail tells the operation to perform // The low part of the mail tells the operation to perform
// Seeing as every possible operation number halts the uCode, // Seeing as every possible operation number halts the uCode,
// except 3, that thing seems to be intended for debugging // except 3, that thing seems to be intended for debugging
switch (_uMail & 0xFFFF) switch (_uMail & 0xFFFF)
{ {
case 0x0003: // Do nothing case 0x0003: // Do nothing
return; return;
case 0x0000: // Halt case 0x0000: // Halt
case 0x0001: // Dump memory? and halt case 0x0001: // Dump memory? and halt
case 0x0002: // Do something and halt case 0x0002: // Do something and halt
WARN_LOG(DSPHLE, "Zelda uCode(SMS version): received halting operation %04X", _uMail & 0xFFFF); WARN_LOG(DSPHLE, "Zelda uCode(SMS version): received halting operation %04X", _uMail & 0xFFFF);
return; return;
default: // Invalid (the real ucode would likely crash) default: // Invalid (the real ucode would likely crash)
WARN_LOG(DSPHLE, "Zelda uCode(SMS version): received invalid operation %04X", _uMail & 0xFFFF); WARN_LOG(DSPHLE, "Zelda uCode(SMS version): received invalid operation %04X", _uMail & 0xFFFF);
return; return;
} }
@ -381,31 +381,31 @@ void CUCode_Zelda::HandleMail_NormalVersion(u32 _uMail)
m_numSteps = _uMail; m_numSteps = _uMail;
m_step = 0; m_step = 0;
} }
else if ((_uMail >> 16) == 0xCDD1) // A 0xCDD1000X mail should come right after we send a DSP_FRAME_END mail else if ((_uMail >> 16) == 0xCDD1) // A 0xCDD1000X mail should come right after we send a DSP_FRAME_END mail
{ {
// The low part of the mail tells the operation to perform // The low part of the mail tells the operation to perform
// Seeing as every possible operation number halts the uCode, // Seeing as every possible operation number halts the uCode,
// except 3, that thing seems to be intended for debugging // except 3, that thing seems to be intended for debugging
switch (_uMail & 0xFFFF) switch (_uMail & 0xFFFF)
{ {
case 0x0003: // Do nothing - continue normally case 0x0003: // Do nothing - continue normally
return; return;
case 0x0001: // accepts params to either dma to iram and/or dram (used for hotbooting a new ucode) case 0x0001: // accepts params to either dma to iram and/or dram (used for hotbooting a new ucode)
// TODO find a better way to protect from HLEMixer? // TODO find a better way to protect from HLEMixer?
soundStream->GetMixer()->SetHLEReady(false); soundStream->GetMixer()->SetHLEReady(false);
m_UploadSetupInProgress = true; m_UploadSetupInProgress = true;
return; return;
case 0x0002: // Let IROM play us off case 0x0002: // Let IROM play us off
m_DSPHLE->SetUCode(UCODE_ROM); m_DSPHLE->SetUCode(UCODE_ROM);
return; return;
case 0x0000: // Halt case 0x0000: // Halt
WARN_LOG(DSPHLE, "Zelda uCode: received halting operation %04X", _uMail & 0xFFFF); WARN_LOG(DSPHLE, "Zelda uCode: received halting operation %04X", _uMail & 0xFFFF);
return; return;
default: // Invalid (the real ucode would likely crash) default: // Invalid (the real ucode would likely crash)
WARN_LOG(DSPHLE, "Zelda uCode: received invalid operation %04X", _uMail & 0xFFFF); WARN_LOG(DSPHLE, "Zelda uCode: received invalid operation %04X", _uMail & 0xFFFF);
return; return;
} }

View File

@ -40,11 +40,11 @@ IUCode* UCodeFactory(u32 _CRC, DSPHLE *dsp_hle, bool bWii)
case 0x3ad3b7ac: // Naruto3, Paper Mario - The Thousand Year Door case 0x3ad3b7ac: // Naruto3, Paper Mario - The Thousand Year Door
case 0x3daf59b9: // Alien Hominid case 0x3daf59b9: // Alien Hominid
case 0x4e8a8b21: // spdemo, ctaxi, 18 wheeler, disney, monkeyball 1/2,cubivore,puzzlecollection,wario, case 0x4e8a8b21: // spdemo, ctaxi, 18 wheeler, disney, monkeyball 1/2,cubivore,puzzlecollection,wario,
// capcom vs snk, naruto2, lost kingdoms, star fox, mario party 4, mortal kombat, // capcom vs snk, naruto2, lost kingdoms, star fox, mario party 4, mortal kombat,
// smugglers run warzone, smash brothers, sonic mega collection, ZooCube // smugglers run warzone, smash brothers, sonic mega collection, ZooCube
// nddemo, starfox // nddemo, starfox
case 0x07f88145: // bustamove, ikaruga, fzero, robotech battle cry, star soldier, soul calibur2, case 0x07f88145: // bustamove, ikaruga, fzero, robotech battle cry, star soldier, soul calibur2,
// Zelda:OOT, Tony hawk, viewtiful joe // Zelda:OOT, Tony hawk, viewtiful joe
case 0xe2136399: // billy hatcher, dragonballz, mario party 5, TMNT, ava1080 case 0xe2136399: // billy hatcher, dragonballz, mario party 5, TMNT, ava1080
case 0x3389a79e: // MP1/MP2 Wii (Metroid Prime Trilogy) case 0x3389a79e: // MP1/MP2 Wii (Metroid Prime Trilogy)
INFO_LOG(DSPHLE, "CRC %08x: AX ucode chosen", _CRC); INFO_LOG(DSPHLE, "CRC %08x: AX ucode chosen", _CRC);
@ -116,16 +116,16 @@ void IUCode::PrepareBootUCode(u32 mail)
{ {
switch (m_NextUCode_steps) switch (m_NextUCode_steps)
{ {
case 0: m_NextUCode.mram_dest_addr = mail; break; case 0: m_NextUCode.mram_dest_addr = mail; break;
case 1: m_NextUCode.mram_size = mail & 0xffff; break; case 1: m_NextUCode.mram_size = mail & 0xffff; break;
case 2: m_NextUCode.mram_dram_addr = mail & 0xffff; break; case 2: m_NextUCode.mram_dram_addr = mail & 0xffff; break;
case 3: m_NextUCode.iram_mram_addr = mail; break; case 3: m_NextUCode.iram_mram_addr = mail; break;
case 4: m_NextUCode.iram_size = mail & 0xffff; break; case 4: m_NextUCode.iram_size = mail & 0xffff; break;
case 5: m_NextUCode.iram_dest = mail & 0xffff; break; case 5: m_NextUCode.iram_dest = mail & 0xffff; break;
case 6: m_NextUCode.iram_startpc = mail & 0xffff; break; case 6: m_NextUCode.iram_startpc = mail & 0xffff; break;
case 7: m_NextUCode.dram_mram_addr = mail; break; case 7: m_NextUCode.dram_mram_addr = mail; break;
case 8: m_NextUCode.dram_size = mail & 0xffff; break; case 8: m_NextUCode.dram_size = mail & 0xffff; break;
case 9: m_NextUCode.dram_dest = mail & 0xffff; break; case 9: m_NextUCode.dram_dest = mail & 0xffff; break;
} }
m_NextUCode_steps++; m_NextUCode_steps++;

View File

@ -132,8 +132,8 @@ private:
u16 dram_size; u16 dram_size;
u16 dram_dest; u16 dram_dest;
}; };
SUCode m_NextUCode; SUCode m_NextUCode;
int m_NextUCode_steps; int m_NextUCode_steps;
bool m_NeedsResumeMail; bool m_NeedsResumeMail;
}; };

View File

@ -9,9 +9,9 @@
#include "../Movie.h" #include "../Movie.h"
#include "MMIO.h" #include "MMIO.h"
#define EXI_READ 0 #define EXI_READ 0
#define EXI_WRITE 1 #define EXI_WRITE 1
#define EXI_READWRITE 2 #define EXI_READWRITE 2
#include "ProcessorInterface.h" #include "ProcessorInterface.h"
#include "../PowerPC/PowerPC.h" #include "../PowerPC/PowerPC.h"
@ -197,9 +197,9 @@ bool CEXIChannel::IsCausingInterrupt()
if (GetDevice(m_Status.CHIP_SELECT)->IsInterruptSet()) if (GetDevice(m_Status.CHIP_SELECT)->IsInterruptSet())
m_Status.EXIINT = 1; m_Status.EXIINT = 1;
if ((m_Status.EXIINT & m_Status.EXIINTMASK) || if ((m_Status.EXIINT & m_Status.EXIINTMASK) ||
(m_Status.TCINT & m_Status.TCINTMASK) || (m_Status.TCINT & m_Status.TCINTMASK) ||
(m_Status.EXTINT & m_Status.EXTINTMASK)) (m_Status.EXTINT & m_Status.EXTINTMASK))
{ {
return true; return true;
} }

View File

@ -81,10 +81,10 @@ public:
virtual ~CEXIDummy(){} virtual ~CEXIDummy(){}
void ImmWrite(u32 data, u32 size) override {INFO_LOG(EXPANSIONINTERFACE, "EXI DUMMY %s ImmWrite: %08x", m_strName.c_str(), data);} void ImmWrite(u32 data, u32 size) override {INFO_LOG(EXPANSIONINTERFACE, "EXI DUMMY %s ImmWrite: %08x", m_strName.c_str(), data);}
u32 ImmRead (u32 size) override {INFO_LOG(EXPANSIONINTERFACE, "EXI DUMMY %s ImmRead", m_strName.c_str()); return 0;} u32 ImmRead (u32 size) override {INFO_LOG(EXPANSIONINTERFACE, "EXI DUMMY %s ImmRead", m_strName.c_str()); return 0;}
void DMAWrite(u32 addr, u32 size) override {INFO_LOG(EXPANSIONINTERFACE, "EXI DUMMY %s DMAWrite: %08x bytes, from %08x to device", m_strName.c_str(), size, addr);} void DMAWrite(u32 addr, u32 size) override {INFO_LOG(EXPANSIONINTERFACE, "EXI DUMMY %s DMAWrite: %08x bytes, from %08x to device", m_strName.c_str(), size, addr);}
void DMARead (u32 addr, u32 size) override {INFO_LOG(EXPANSIONINTERFACE, "EXI DUMMY %s DMARead: %08x bytes, from device to %08x", m_strName.c_str(), size, addr);} void DMARead (u32 addr, u32 size) override {INFO_LOG(EXPANSIONINTERFACE, "EXI DUMMY %s DMARead: %08x bytes, from device to %08x", m_strName.c_str(), size, addr);}
}; };

View File

@ -562,9 +562,9 @@ bool CEXIETHERNET::RecvHandlePacket()
page_ptr(BBA_RHBP)); page_ptr(BBA_RHBP));
#endif #endif
write_ptr = ptr_from_page_ptr(BBA_RWP); write_ptr = ptr_from_page_ptr(BBA_RWP);
end_ptr = ptr_from_page_ptr(BBA_RHBP); end_ptr = ptr_from_page_ptr(BBA_RHBP);
read_ptr = ptr_from_page_ptr(BBA_RRP); read_ptr = ptr_from_page_ptr(BBA_RRP);
descriptor = (Descriptor *)write_ptr; descriptor = (Descriptor *)write_ptr;
write_ptr += 4; write_ptr += 4;

View File

@ -8,12 +8,12 @@
#include "EXI_DeviceGecko.h" #include "EXI_DeviceGecko.h"
#include "../Core.h" #include "../Core.h"
u16 GeckoSockServer::server_port; u16 GeckoSockServer::server_port;
int GeckoSockServer::client_count; int GeckoSockServer::client_count;
std::thread GeckoSockServer::connectionThread; std::thread GeckoSockServer::connectionThread;
volatile bool GeckoSockServer::server_running; volatile bool GeckoSockServer::server_running;
std::queue<sf::SocketTCP> GeckoSockServer::waiting_socks; std::queue<sf::SocketTCP> GeckoSockServer::waiting_socks;
std::mutex GeckoSockServer::connection_lock; std::mutex GeckoSockServer::connection_lock;
GeckoSockServer::GeckoSockServer() GeckoSockServer::GeckoSockServer()
: client_running(false) : client_running(false)

View File

@ -28,17 +28,17 @@ public:
std::deque<u8> recv_fifo; std::deque<u8> recv_fifo;
private: private:
static int client_count; static int client_count;
volatile bool client_running; volatile bool client_running;
// Only ever one server thread // Only ever one server thread
static void GeckoConnectionWaiter(); static void GeckoConnectionWaiter();
static u16 server_port; static u16 server_port;
static volatile bool server_running; static volatile bool server_running;
static std::thread connectionThread; static std::thread connectionThread;
static std::queue<sf::SocketTCP> waiting_socks; static std::queue<sf::SocketTCP> waiting_socks;
static std::mutex connection_lock; static std::mutex connection_lock;
}; };
class CEXIGecko class CEXIGecko
@ -53,13 +53,13 @@ public:
private: private:
enum enum
{ {
CMD_LED_OFF = 0x7, CMD_LED_OFF = 0x7,
CMD_LED_ON = 0x8, CMD_LED_ON = 0x8,
CMD_INIT = 0x9, CMD_INIT = 0x9,
CMD_RECV = 0xa, CMD_RECV = 0xa,
CMD_SEND = 0xb, CMD_SEND = 0xb,
CMD_CHK_TX = 0xc, CMD_CHK_TX = 0xc,
CMD_CHK_RX = 0xd, CMD_CHK_RX = 0xd,
}; };
static const u32 ident = 0x04700000; static const u32 ident = 0x04700000;

View File

@ -31,16 +31,16 @@ private:
enum enum
{ {
REGION_RTC = 0x200000, REGION_RTC = 0x200000,
REGION_SRAM = 0x200001, REGION_SRAM = 0x200001,
REGION_UART = 0x200100, REGION_UART = 0x200100,
REGION_UART_UNK = 0x200103, REGION_UART_UNK = 0x200103,
REGION_BARNACLE = 0x200113, REGION_BARNACLE = 0x200113,
REGION_WRTC0 = 0x210000, REGION_WRTC0 = 0x210000,
REGION_WRTC1 = 0x210001, REGION_WRTC1 = 0x210001,
REGION_WRTC2 = 0x210008, REGION_WRTC2 = 0x210008,
REGION_EUART_UNK= 0x300000, REGION_EUART_UNK = 0x300000,
REGION_EUART = 0x300001 REGION_EUART = 0x300001
}; };
// Region // Region

View File

@ -16,12 +16,12 @@
#include "Sram.h" #include "Sram.h"
#include "GCMemcard.h" #include "GCMemcard.h"
#define MC_STATUS_BUSY 0x80 #define MC_STATUS_BUSY 0x80
#define MC_STATUS_UNLOCKED 0x40 #define MC_STATUS_UNLOCKED 0x40
#define MC_STATUS_SLEEP 0x20 #define MC_STATUS_SLEEP 0x20
#define MC_STATUS_ERASEERROR 0x10 #define MC_STATUS_ERASEERROR 0x10
#define MC_STATUS_PROGRAMEERROR 0x08 #define MC_STATUS_PROGRAMEERROR 0x08
#define MC_STATUS_READY 0x01 #define MC_STATUS_READY 0x01
#define SIZE_TO_Mb (1024 * 8 * 16) #define SIZE_TO_Mb (1024 * 8 * 16)
#define MC_HDR_SIZE 0xA000 #define MC_HDR_SIZE 0xA000
@ -63,12 +63,12 @@ CEXIMemoryCard::CEXIMemoryCard(const int index)
formatDelay = 0; formatDelay = 0;
//Nintendo Memory Card EXI IDs //Nintendo Memory Card EXI IDs
//0x00000004 Memory Card 59 4Mbit //0x00000004 Memory Card 59 4Mbit
//0x00000008 Memory Card 123 8Mb //0x00000008 Memory Card 123 8Mb
//0x00000010 Memory Card 251 16Mb //0x00000010 Memory Card 251 16Mb
//0x00000020 Memory Card 507 32Mb //0x00000020 Memory Card 507 32Mb
//0x00000040 Memory Card 1019 64Mb //0x00000040 Memory Card 1019 64Mb
//0x00000080 Memory Card 2043 128Mb //0x00000080 Memory Card 2043 128Mb
//0x00000510 16Mb "bigben" card //0x00000510 16Mb "bigben" card
//card_id = 0xc243; //card_id = 0xc243;

View File

@ -203,8 +203,8 @@ void CEXIMic::TransferByte(u8 &byte)
{ {
if (m_position == 0) if (m_position == 0)
{ {
command = byte; // first byte is command command = byte; // first byte is command
byte = 0xFF; // would be tristate, but we don't care. byte = 0xFF; // would be tristate, but we don't care.
m_position++; m_position++;
return; return;
} }

View File

@ -13,7 +13,7 @@ const u16 button_bitmasks[] =
PAD_BUTTON_Y, PAD_BUTTON_Y,
PAD_TRIGGER_Z, PAD_TRIGGER_Z,
PAD_BUTTON_START, PAD_BUTTON_START,
0 // MIC HAX 0 // MIC HAX
}; };
const u16 trigger_bitmasks[] = const u16 trigger_bitmasks[] =
@ -138,21 +138,21 @@ void GCPad::SetOutput(const u8 on)
void GCPad::LoadDefaults(const ControllerInterface& ciface) void GCPad::LoadDefaults(const ControllerInterface& ciface)
{ {
#define set_control(group, num, str) (group)->controls[num]->control_ref->expression = (str) #define set_control(group, num, str) (group)->controls[num]->control_ref->expression = (str)
ControllerEmu::LoadDefaults(ciface); ControllerEmu::LoadDefaults(ciface);
// Buttons // Buttons
set_control(m_buttons, 0, "X"); // A set_control(m_buttons, 0, "X"); // A
set_control(m_buttons, 1, "Z"); // B set_control(m_buttons, 1, "Z"); // B
set_control(m_buttons, 2, "C"); // X set_control(m_buttons, 2, "C"); // X
set_control(m_buttons, 3, "S"); // Y set_control(m_buttons, 3, "S"); // Y
set_control(m_buttons, 4, "D"); // Z set_control(m_buttons, 4, "D"); // Z
#ifdef _WIN32 #ifdef _WIN32
set_control(m_buttons, 5, "RETURN"); // Start set_control(m_buttons, 5, "RETURN"); // Start
#else #else
// osx/linux // osx/linux
set_control(m_buttons, 5, "Return"); // Start set_control(m_buttons, 5, "Return"); // Start
#endif #endif
// stick modifiers to 50 % // stick modifiers to 50 %
@ -160,51 +160,51 @@ void GCPad::LoadDefaults(const ControllerInterface& ciface)
m_c_stick->controls[4]->control_ref->range = 0.5f; m_c_stick->controls[4]->control_ref->range = 0.5f;
// D-Pad // D-Pad
set_control(m_dpad, 0, "T"); // Up set_control(m_dpad, 0, "T"); // Up
set_control(m_dpad, 1, "G"); // Down set_control(m_dpad, 1, "G"); // Down
set_control(m_dpad, 2, "F"); // Left set_control(m_dpad, 2, "F"); // Left
set_control(m_dpad, 3, "H"); // Right set_control(m_dpad, 3, "H"); // Right
// C-Stick // C-Stick
set_control(m_c_stick, 0, "I"); // Up set_control(m_c_stick, 0, "I"); // Up
set_control(m_c_stick, 1, "K"); // Down set_control(m_c_stick, 1, "K"); // Down
set_control(m_c_stick, 2, "J"); // Left set_control(m_c_stick, 2, "J"); // Left
set_control(m_c_stick, 3, "L"); // Right set_control(m_c_stick, 3, "L"); // Right
#ifdef _WIN32 #ifdef _WIN32
set_control(m_c_stick, 4, "LCONTROL"); // Modifier set_control(m_c_stick, 4, "LCONTROL"); // Modifier
// Main Stick // Main Stick
set_control(m_main_stick, 0, "UP"); // Up set_control(m_main_stick, 0, "UP"); // Up
set_control(m_main_stick, 1, "DOWN"); // Down set_control(m_main_stick, 1, "DOWN"); // Down
set_control(m_main_stick, 2, "LEFT"); // Left set_control(m_main_stick, 2, "LEFT"); // Left
set_control(m_main_stick, 3, "RIGHT"); // Right set_control(m_main_stick, 3, "RIGHT"); // Right
set_control(m_main_stick, 4, "LSHIFT"); // Modifier set_control(m_main_stick, 4, "LSHIFT"); // Modifier
#elif __APPLE__ #elif __APPLE__
set_control(m_c_stick, 4, "Left Control"); // Modifier set_control(m_c_stick, 4, "Left Control"); // Modifier
// Main Stick // Main Stick
set_control(m_main_stick, 0, "Up Arrow"); // Up set_control(m_main_stick, 0, "Up Arrow"); // Up
set_control(m_main_stick, 1, "Down Arrow"); // Down set_control(m_main_stick, 1, "Down Arrow"); // Down
set_control(m_main_stick, 2, "Left Arrow"); // Left set_control(m_main_stick, 2, "Left Arrow"); // Left
set_control(m_main_stick, 3, "Right Arrow"); // Right set_control(m_main_stick, 3, "Right Arrow"); // Right
set_control(m_main_stick, 4, "Left Shift"); // Modifier set_control(m_main_stick, 4, "Left Shift"); // Modifier
#else #else
// not sure if these are right // not sure if these are right
set_control(m_c_stick, 4, "Control_L"); // Modifier set_control(m_c_stick, 4, "Control_L"); // Modifier
// Main Stick // Main Stick
set_control(m_main_stick, 0, "Up"); // Up set_control(m_main_stick, 0, "Up"); // Up
set_control(m_main_stick, 1, "Down"); // Down set_control(m_main_stick, 1, "Down"); // Down
set_control(m_main_stick, 2, "Left"); // Left set_control(m_main_stick, 2, "Left"); // Left
set_control(m_main_stick, 3, "Right"); // Right set_control(m_main_stick, 3, "Right"); // Right
set_control(m_main_stick, 4, "Shift_L"); // Modifier set_control(m_main_stick, 4, "Shift_L"); // Modifier
#endif #endif
// Triggers // Triggers
set_control(m_triggers, 0, "Q"); // L set_control(m_triggers, 0, "Q"); // L
set_control(m_triggers, 1, "W"); // R set_control(m_triggers, 1, "W"); // R
} }
bool GCPad::GetMicButton() const bool GCPad::GetMicButton() const

View File

@ -25,14 +25,14 @@ public:
private: private:
Buttons* m_buttons; Buttons* m_buttons;
AnalogStick* m_main_stick; AnalogStick* m_main_stick;
AnalogStick* m_c_stick; AnalogStick* m_c_stick;
Buttons* m_dpad; Buttons* m_dpad;
MixedTriggers* m_triggers; MixedTriggers* m_triggers;
ControlGroup* m_rumble; ControlGroup* m_rumble;
ControlGroup* m_options; ControlGroup* m_options;
const unsigned int m_index; const unsigned int m_index;
}; };

View File

@ -167,23 +167,23 @@ static const char *Debug_GetInterruptName(u32 _causemask)
{ {
switch (_causemask) switch (_causemask)
{ {
case INT_CAUSE_PI: return "INT_CAUSE_PI"; case INT_CAUSE_PI: return "INT_CAUSE_PI";
case INT_CAUSE_DI: return "INT_CAUSE_DI"; case INT_CAUSE_DI: return "INT_CAUSE_DI";
case INT_CAUSE_RSW: return "INT_CAUSE_RSW"; case INT_CAUSE_RSW: return "INT_CAUSE_RSW";
case INT_CAUSE_SI: return "INT_CAUSE_SI"; case INT_CAUSE_SI: return "INT_CAUSE_SI";
case INT_CAUSE_EXI: return "INT_CAUSE_EXI"; case INT_CAUSE_EXI: return "INT_CAUSE_EXI";
case INT_CAUSE_AI: return "INT_CAUSE_AI"; case INT_CAUSE_AI: return "INT_CAUSE_AI";
case INT_CAUSE_DSP: return "INT_CAUSE_DSP"; case INT_CAUSE_DSP: return "INT_CAUSE_DSP";
case INT_CAUSE_MEMORY: return "INT_CAUSE_MEMORY"; case INT_CAUSE_MEMORY: return "INT_CAUSE_MEMORY";
case INT_CAUSE_VI: return "INT_CAUSE_VI"; case INT_CAUSE_VI: return "INT_CAUSE_VI";
case INT_CAUSE_PE_TOKEN: return "INT_CAUSE_PE_TOKEN"; case INT_CAUSE_PE_TOKEN: return "INT_CAUSE_PE_TOKEN";
case INT_CAUSE_PE_FINISH: return "INT_CAUSE_PE_FINISH"; case INT_CAUSE_PE_FINISH: return "INT_CAUSE_PE_FINISH";
case INT_CAUSE_CP: return "INT_CAUSE_CP"; case INT_CAUSE_CP: return "INT_CAUSE_CP";
case INT_CAUSE_DEBUG: return "INT_CAUSE_DEBUG"; case INT_CAUSE_DEBUG: return "INT_CAUSE_DEBUG";
case INT_CAUSE_WII_IPC: return "INT_CAUSE_WII_IPC"; case INT_CAUSE_WII_IPC: return "INT_CAUSE_WII_IPC";
case INT_CAUSE_HSP: return "INT_CAUSE_HSP"; case INT_CAUSE_HSP: return "INT_CAUSE_HSP";
case INT_CAUSE_RST_BUTTON: return "INT_CAUSE_RST_BUTTON"; case INT_CAUSE_RST_BUTTON: return "INT_CAUSE_RST_BUTTON";
default: return "!!! ERROR-unknown Interrupt !!!"; default: return "!!! ERROR-unknown Interrupt !!!";
} }
} }

View File

@ -16,22 +16,22 @@ namespace ProcessorInterface
enum InterruptCause enum InterruptCause
{ {
INT_CAUSE_PI = 0x1, // YAGCD says: GP runtime error INT_CAUSE_PI = 0x1, // YAGCD says: GP runtime error
INT_CAUSE_RSW = 0x2, // Reset Switch INT_CAUSE_RSW = 0x2, // Reset Switch
INT_CAUSE_DI = 0x4, // DVD interrupt INT_CAUSE_DI = 0x4, // DVD interrupt
INT_CAUSE_SI = 0x8, // Serial interface INT_CAUSE_SI = 0x8, // Serial interface
INT_CAUSE_EXI = 0x10, // Expansion interface INT_CAUSE_EXI = 0x10, // Expansion interface
INT_CAUSE_AI = 0x20, // Audio Interface Streaming INT_CAUSE_AI = 0x20, // Audio Interface Streaming
INT_CAUSE_DSP = 0x40, // DSP interface INT_CAUSE_DSP = 0x40, // DSP interface
INT_CAUSE_MEMORY = 0x80, // Memory interface INT_CAUSE_MEMORY = 0x80, // Memory interface
INT_CAUSE_VI = 0x100, // Video interface INT_CAUSE_VI = 0x100, // Video interface
INT_CAUSE_PE_TOKEN = 0x200, // GP Token INT_CAUSE_PE_TOKEN = 0x200, // GP Token
INT_CAUSE_PE_FINISH = 0x400, // GP Finished INT_CAUSE_PE_FINISH = 0x400, // GP Finished
INT_CAUSE_CP = 0x800, // Command Fifo INT_CAUSE_CP = 0x800, // Command Fifo
INT_CAUSE_DEBUG = 0x1000, // Debugger (from devkit) INT_CAUSE_DEBUG = 0x1000, // Debugger (from devkit)
INT_CAUSE_HSP = 0x2000, // High Speed Port (from sdram controller) INT_CAUSE_HSP = 0x2000, // High Speed Port (from sdram controller)
INT_CAUSE_WII_IPC = 0x4000, // Wii IPC INT_CAUSE_WII_IPC = 0x4000, // Wii IPC
INT_CAUSE_RST_BUTTON = 0x10000 // ResetButtonState (1 = unpressed, 0 = pressed) it's a state, not maskable INT_CAUSE_RST_BUTTON = 0x10000 // ResetButtonState (1 = unpressed, 0 = pressed) it's a state, not maskable
}; };

View File

@ -356,25 +356,25 @@ void RegisterMMIO(MMIO::Mapping* mmio, u32 base)
USIStatusReg tmpStatus(val); USIStatusReg tmpStatus(val);
// clear bits ( if(tmp.bit) SISR.bit=0 ) // clear bits ( if(tmp.bit) SISR.bit=0 )
if (tmpStatus.NOREP0) g_StatusReg.NOREP0 = 0; if (tmpStatus.NOREP0) g_StatusReg.NOREP0 = 0;
if (tmpStatus.COLL0) g_StatusReg.COLL0 = 0; if (tmpStatus.COLL0) g_StatusReg.COLL0 = 0;
if (tmpStatus.OVRUN0) g_StatusReg.OVRUN0 = 0; if (tmpStatus.OVRUN0) g_StatusReg.OVRUN0 = 0;
if (tmpStatus.UNRUN0) g_StatusReg.UNRUN0 = 0; if (tmpStatus.UNRUN0) g_StatusReg.UNRUN0 = 0;
if (tmpStatus.NOREP1) g_StatusReg.NOREP1 = 0; if (tmpStatus.NOREP1) g_StatusReg.NOREP1 = 0;
if (tmpStatus.COLL1) g_StatusReg.COLL1 = 0; if (tmpStatus.COLL1) g_StatusReg.COLL1 = 0;
if (tmpStatus.OVRUN1) g_StatusReg.OVRUN1 = 0; if (tmpStatus.OVRUN1) g_StatusReg.OVRUN1 = 0;
if (tmpStatus.UNRUN1) g_StatusReg.UNRUN1 = 0; if (tmpStatus.UNRUN1) g_StatusReg.UNRUN1 = 0;
if (tmpStatus.NOREP2) g_StatusReg.NOREP2 = 0; if (tmpStatus.NOREP2) g_StatusReg.NOREP2 = 0;
if (tmpStatus.COLL2) g_StatusReg.COLL2 = 0; if (tmpStatus.COLL2) g_StatusReg.COLL2 = 0;
if (tmpStatus.OVRUN2) g_StatusReg.OVRUN2 = 0; if (tmpStatus.OVRUN2) g_StatusReg.OVRUN2 = 0;
if (tmpStatus.UNRUN2) g_StatusReg.UNRUN2 = 0; if (tmpStatus.UNRUN2) g_StatusReg.UNRUN2 = 0;
if (tmpStatus.NOREP3) g_StatusReg.NOREP3 = 0; if (tmpStatus.NOREP3) g_StatusReg.NOREP3 = 0;
if (tmpStatus.COLL3) g_StatusReg.COLL3 = 0; if (tmpStatus.COLL3) g_StatusReg.COLL3 = 0;
if (tmpStatus.OVRUN3) g_StatusReg.OVRUN3 = 0; if (tmpStatus.OVRUN3) g_StatusReg.OVRUN3 = 0;
if (tmpStatus.UNRUN3) g_StatusReg.UNRUN3 = 0; if (tmpStatus.UNRUN3) g_StatusReg.UNRUN3 = 0;
// send command to devices // send command to devices
if (tmpStatus.WR) if (tmpStatus.WR)
@ -409,8 +409,8 @@ void UpdateInterrupts()
g_ComCSR.RDSTINT = 0; g_ComCSR.RDSTINT = 0;
// check if we have to generate an interrupt // check if we have to generate an interrupt
if ((g_ComCSR.RDSTINT & g_ComCSR.RDSTINTMSK) || if ((g_ComCSR.RDSTINT & g_ComCSR.RDSTINTMSK) ||
(g_ComCSR.TCINT & g_ComCSR.TCINTMSK)) (g_ComCSR.TCINT & g_ComCSR.TCINTMSK))
{ {
ProcessorInterface::SetInterrupt(ProcessorInterface::INT_CAUSE_SI, true); ProcessorInterface::SetInterrupt(ProcessorInterface::INT_CAUSE_SI, true);
} }

View File

@ -26,16 +26,16 @@ CSIDevice_DanceMat::CSIDevice_DanceMat(SIDevices device, int _iDeviceNumber)
, m_LastButtonCombo(COMBO_NONE) , m_LastButtonCombo(COMBO_NONE)
{ {
memset(&m_Origin, 0, sizeof(SOrigin)); memset(&m_Origin, 0, sizeof(SOrigin));
m_Origin.uCommand = CMD_ORIGIN; m_Origin.uCommand = CMD_ORIGIN;
m_Origin.uOriginStickX = 0x80; // center m_Origin.uOriginStickX = 0x80; // center
m_Origin.uOriginStickY = 0x80; m_Origin.uOriginStickY = 0x80;
m_Origin.uSubStickStickX = 0x80; m_Origin.uSubStickStickX = 0x80;
m_Origin.uSubStickStickY = 0x80; m_Origin.uSubStickStickY = 0x80;
m_Origin.uTrigger_L = 0x00; m_Origin.uTrigger_L = 0x00;
m_Origin.uTrigger_R = 0x00; m_Origin.uTrigger_R = 0x00;
// Dunno if we need to do this, game/lib should set it? // Dunno if we need to do this, game/lib should set it?
m_Mode = 0x03; m_Mode = 0x03;
} }
int CSIDevice_DanceMat::RunBuffer(u8* _pBuffer, int _iLength) int CSIDevice_DanceMat::RunBuffer(u8* _pBuffer, int _iLength)
@ -60,8 +60,8 @@ int CSIDevice_DanceMat::RunBuffer(u8* _pBuffer, int _iLength)
GetData(high, low); GetData(high, low);
for (int i = 0; i < (_iLength - 1) / 2; i++) for (int i = 0; i < (_iLength - 1) / 2; i++)
{ {
_pBuffer[0 + i] = (high >> (i * 8)) & 0xff; _pBuffer[i + 0] = (high >> (i * 8)) & 0xff;
_pBuffer[4 + i] = (low >> (i * 8)) & 0xff; _pBuffer[i + 4] = (low >> (i * 8)) & 0xff;
} }
} }
break; break;
@ -119,8 +119,8 @@ bool CSIDevice_DanceMat::GetData(u32& _Hi, u32& _Low)
u32 netValues[2]; u32 netValues[2];
if (NetPlay_GetInput(ISIDevice::m_iDeviceNumber, PadStatus, netValues)) if (NetPlay_GetInput(ISIDevice::m_iDeviceNumber, PadStatus, netValues))
{ {
_Hi = netValues[0]; // first 4 bytes _Hi = netValues[0]; // first 4 bytes
_Low = netValues[1]; // last 4 bytes _Low = netValues[1]; // last 4 bytes
return true; return true;
} }
@ -170,21 +170,21 @@ bool CSIDevice_DanceMat::GetData(u32& _Hi, u32& _Low)
// Low bits are packed differently per mode // Low bits are packed differently per mode
if (m_Mode == 0 || m_Mode == 5 || m_Mode == 6 || m_Mode == 7) if (m_Mode == 0 || m_Mode == 5 || m_Mode == 6 || m_Mode == 7)
{ {
_Low = (u8)(PadStatus.analogB >> 4); // Top 4 bits _Low = (u8)(PadStatus.analogB >> 4); // Top 4 bits
_Low |= (u32)((u8)(PadStatus.analogA >> 4) << 4); // Top 4 bits _Low |= (u32)((u8)(PadStatus.analogA >> 4) << 4); // Top 4 bits
_Low |= (u32)((u8)(PadStatus.triggerRight >> 4) << 8); // Top 4 bits _Low |= (u32)((u8)(PadStatus.triggerRight >> 4) << 8); // Top 4 bits
_Low |= (u32)((u8)(PadStatus.triggerLeft >> 4) << 12); // Top 4 bits _Low |= (u32)((u8)(PadStatus.triggerLeft >> 4) << 12); // Top 4 bits
_Low |= (u32)((u8)(PadStatus.substickY) << 16); // All 8 bits _Low |= (u32)((u8)(PadStatus.substickY) << 16); // All 8 bits
_Low |= (u32)((u8)(PadStatus.substickX) << 24); // All 8 bits _Low |= (u32)((u8)(PadStatus.substickX) << 24); // All 8 bits
} }
else if (m_Mode == 1) else if (m_Mode == 1)
{ {
_Low = (u8)(PadStatus.analogB >> 4); // Top 4 bits _Low = (u8)(PadStatus.analogB >> 4); // Top 4 bits
_Low |= (u32)((u8)(PadStatus.analogA >> 4) << 4); // Top 4 bits _Low |= (u32)((u8)(PadStatus.analogA >> 4) << 4); // Top 4 bits
_Low |= (u32)((u8)PadStatus.triggerRight << 8); // All 8 bits _Low |= (u32)((u8)PadStatus.triggerRight << 8); // All 8 bits
_Low |= (u32)((u8)PadStatus.triggerLeft << 16); // All 8 bits _Low |= (u32)((u8)PadStatus.triggerLeft << 16); // All 8 bits
_Low |= (u32)((u8)PadStatus.substickY << 24); // Top 4 bits _Low |= (u32)((u8)PadStatus.substickY << 24); // Top 4 bits
_Low |= (u32)((u8)PadStatus.substickX << 28); // Top 4 bits _Low |= (u32)((u8)PadStatus.substickX << 28); // Top 4 bits
} }
else if (m_Mode == 2) else if (m_Mode == 2)
{ {
@ -194,18 +194,18 @@ bool CSIDevice_DanceMat::GetData(u32& _Hi, u32& _Low)
else if (m_Mode == 3) else if (m_Mode == 3)
{ {
// Analog A/B are always 0 // Analog A/B are always 0
_Low = (u8)PadStatus.triggerRight; // All 8 bits _Low = (u8)PadStatus.triggerRight; // All 8 bits
_Low |= (u32)((u8)PadStatus.triggerLeft << 8); // All 8 bits _Low |= (u32)((u8)PadStatus.triggerLeft << 8); // All 8 bits
_Low |= (u32)((u8)PadStatus.substickY << 16); // All 8 bits _Low |= (u32)((u8)PadStatus.substickY << 16); // All 8 bits
_Low |= (u32)((u8)PadStatus.substickX << 24); // All 8 bits _Low |= (u32)((u8)PadStatus.substickX << 24); // All 8 bits
} }
else if (m_Mode == 4) else if (m_Mode == 4)
{ {
_Low = (u8)(PadStatus.analogB); // All 8 bits _Low = (u8)(PadStatus.analogB); // All 8 bits
_Low |= (u32)((u8)(PadStatus.analogA) << 8); // All 8 bits _Low |= (u32)((u8)(PadStatus.analogA) << 8); // All 8 bits
// triggerLeft/Right are always 0 // triggerLeft/Right are always 0
_Low |= (u32)((u8)PadStatus.substickY << 16); // All 8 bits _Low |= (u32)((u8)PadStatus.substickY << 16); // All 8 bits
_Low |= (u32)((u8)PadStatus.substickX << 24); // All 8 bits _Low |= (u32)((u8)PadStatus.substickX << 24); // All 8 bits
} }
return true; return true;
} }

View File

@ -26,16 +26,16 @@ CSIDevice_GCController::CSIDevice_GCController(SIDevices device, int _iDeviceNum
, m_LastButtonCombo(COMBO_NONE) , m_LastButtonCombo(COMBO_NONE)
{ {
memset(&m_Origin, 0, sizeof(SOrigin)); memset(&m_Origin, 0, sizeof(SOrigin));
m_Origin.uCommand = CMD_ORIGIN; m_Origin.uCommand = CMD_ORIGIN;
m_Origin.uOriginStickX = 0x80; // center m_Origin.uOriginStickX = 0x80; // center
m_Origin.uOriginStickY = 0x80; m_Origin.uOriginStickY = 0x80;
m_Origin.uSubStickStickX = 0x80; m_Origin.uSubStickStickX = 0x80;
m_Origin.uSubStickStickY = 0x80; m_Origin.uSubStickStickY = 0x80;
m_Origin.uTrigger_L = 0x1F; // 0-30 is the lower deadzone m_Origin.uTrigger_L = 0x1F; // 0-30 is the lower deadzone
m_Origin.uTrigger_R = 0x1F; m_Origin.uTrigger_R = 0x1F;
// Dunno if we need to do this, game/lib should set it? // Dunno if we need to do this, game/lib should set it?
m_Mode = 0x03; m_Mode = 0x03;
} }
int CSIDevice_GCController::RunBuffer(u8* _pBuffer, int _iLength) int CSIDevice_GCController::RunBuffer(u8* _pBuffer, int _iLength)
@ -60,8 +60,8 @@ int CSIDevice_GCController::RunBuffer(u8* _pBuffer, int _iLength)
GetData(high, low); GetData(high, low);
for (int i = 0; i < (_iLength - 1) / 2; i++) for (int i = 0; i < (_iLength - 1) / 2; i++)
{ {
_pBuffer[0 + i] = (high >> (i * 8)) & 0xff; _pBuffer[i + 0] = (high >> (i * 8)) & 0xff;
_pBuffer[4 + i] = (low >> (i * 8)) & 0xff; _pBuffer[i + 4] = (low >> (i * 8)) & 0xff;
} }
} }
break; break;
@ -119,8 +119,8 @@ bool CSIDevice_GCController::GetData(u32& _Hi, u32& _Low)
u32 netValues[2]; u32 netValues[2];
if (NetPlay_GetInput(ISIDevice::m_iDeviceNumber, PadStatus, netValues)) if (NetPlay_GetInput(ISIDevice::m_iDeviceNumber, PadStatus, netValues))
{ {
_Hi = netValues[0]; // first 4 bytes _Hi = netValues[0]; // first 4 bytes
_Low = netValues[1]; // last 4 bytes _Low = netValues[1]; // last 4 bytes
return true; return true;
} }
@ -149,46 +149,46 @@ bool CSIDevice_GCController::GetData(u32& _Hi, u32& _Low)
// Low bits are packed differently per mode // Low bits are packed differently per mode
if (m_Mode == 0 || m_Mode == 5 || m_Mode == 6 || m_Mode == 7) if (m_Mode == 0 || m_Mode == 5 || m_Mode == 6 || m_Mode == 7)
{ {
_Low = (u8)(PadStatus.analogB >> 4); // Top 4 bits _Low = (u8)(PadStatus.analogB >> 4); // Top 4 bits
_Low |= (u32)((u8)(PadStatus.analogA >> 4) << 4); // Top 4 bits _Low |= (u32)((u8)(PadStatus.analogA >> 4) << 4); // Top 4 bits
_Low |= (u32)((u8)(PadStatus.triggerRight >> 4) << 8); // Top 4 bits _Low |= (u32)((u8)(PadStatus.triggerRight >> 4) << 8); // Top 4 bits
_Low |= (u32)((u8)(PadStatus.triggerLeft >> 4) << 12); // Top 4 bits _Low |= (u32)((u8)(PadStatus.triggerLeft >> 4) << 12); // Top 4 bits
_Low |= (u32)((u8)(PadStatus.substickY) << 16); // All 8 bits _Low |= (u32)((u8)(PadStatus.substickY) << 16); // All 8 bits
_Low |= (u32)((u8)(PadStatus.substickX) << 24); // All 8 bits _Low |= (u32)((u8)(PadStatus.substickX) << 24); // All 8 bits
} }
else if (m_Mode == 1) else if (m_Mode == 1)
{ {
_Low = (u8)(PadStatus.analogB >> 4); // Top 4 bits _Low = (u8)(PadStatus.analogB >> 4); // Top 4 bits
_Low |= (u32)((u8)(PadStatus.analogA >> 4) << 4); // Top 4 bits _Low |= (u32)((u8)(PadStatus.analogA >> 4) << 4); // Top 4 bits
_Low |= (u32)((u8)PadStatus.triggerRight << 8); // All 8 bits _Low |= (u32)((u8)PadStatus.triggerRight << 8); // All 8 bits
_Low |= (u32)((u8)PadStatus.triggerLeft << 16); // All 8 bits _Low |= (u32)((u8)PadStatus.triggerLeft << 16); // All 8 bits
_Low |= (u32)((u8)PadStatus.substickY << 24); // Top 4 bits _Low |= (u32)((u8)PadStatus.substickY << 24); // Top 4 bits
_Low |= (u32)((u8)PadStatus.substickX << 28); // Top 4 bits _Low |= (u32)((u8)PadStatus.substickX << 28); // Top 4 bits
} }
else if (m_Mode == 2) else if (m_Mode == 2)
{ {
_Low = (u8)(PadStatus.analogB); // All 8 bits _Low = (u8)(PadStatus.analogB); // All 8 bits
_Low |= (u32)((u8)(PadStatus.analogA) << 8); // All 8 bits _Low |= (u32)((u8)(PadStatus.analogA) << 8); // All 8 bits
_Low |= (u32)((u8)(PadStatus.triggerRight >> 4) << 16); // Top 4 bits _Low |= (u32)((u8)(PadStatus.triggerRight >> 4) << 16); // Top 4 bits
_Low |= (u32)((u8)(PadStatus.triggerLeft >> 4) << 20); // Top 4 bits _Low |= (u32)((u8)(PadStatus.triggerLeft >> 4) << 20); // Top 4 bits
_Low |= (u32)((u8)PadStatus.substickY << 24); // Top 4 bits _Low |= (u32)((u8)PadStatus.substickY << 24); // Top 4 bits
_Low |= (u32)((u8)PadStatus.substickX << 28); // Top 4 bits _Low |= (u32)((u8)PadStatus.substickX << 28); // Top 4 bits
} }
else if (m_Mode == 3) else if (m_Mode == 3)
{ {
// Analog A/B are always 0 // Analog A/B are always 0
_Low = (u8)PadStatus.triggerRight; // All 8 bits _Low = (u8)PadStatus.triggerRight; // All 8 bits
_Low |= (u32)((u8)PadStatus.triggerLeft << 8); // All 8 bits _Low |= (u32)((u8)PadStatus.triggerLeft << 8); // All 8 bits
_Low |= (u32)((u8)PadStatus.substickY << 16); // All 8 bits _Low |= (u32)((u8)PadStatus.substickY << 16); // All 8 bits
_Low |= (u32)((u8)PadStatus.substickX << 24); // All 8 bits _Low |= (u32)((u8)PadStatus.substickX << 24); // All 8 bits
} }
else if (m_Mode == 4) else if (m_Mode == 4)
{ {
_Low = (u8)(PadStatus.analogB); // All 8 bits _Low = (u8)(PadStatus.analogB); // All 8 bits
_Low |= (u32)((u8)(PadStatus.analogA) << 8); // All 8 bits _Low |= (u32)((u8)(PadStatus.analogA) << 8); // All 8 bits
// triggerLeft/Right are always 0 // triggerLeft/Right are always 0
_Low |= (u32)((u8)PadStatus.substickY << 16); // All 8 bits _Low |= (u32)((u8)PadStatus.substickY << 16); // All 8 bits
_Low |= (u32)((u8)PadStatus.substickX << 24); // All 8 bits _Low |= (u32)((u8)PadStatus.substickX << 24); // All 8 bits
} }
// Keep track of the special button combos (embedded in controller hardware... :( ) // Keep track of the special button combos (embedded in controller hardware... :( )
@ -214,12 +214,12 @@ bool CSIDevice_GCController::GetData(u32& _Hi, u32& _Low)
ProcessorInterface::ResetButton_Tap(); ProcessorInterface::ResetButton_Tap();
else if (m_LastButtonCombo == COMBO_ORIGIN) else if (m_LastButtonCombo == COMBO_ORIGIN)
{ {
m_Origin.uOriginStickX = PadStatus.stickX; m_Origin.uOriginStickX = PadStatus.stickX;
m_Origin.uOriginStickY = PadStatus.stickY; m_Origin.uOriginStickY = PadStatus.stickY;
m_Origin.uSubStickStickX = PadStatus.substickX; m_Origin.uSubStickStickX = PadStatus.substickX;
m_Origin.uSubStickStickY = PadStatus.substickY; m_Origin.uSubStickStickY = PadStatus.substickY;
m_Origin.uTrigger_L = PadStatus.triggerLeft; m_Origin.uTrigger_L = PadStatus.triggerLeft;
m_Origin.uTrigger_R = PadStatus.triggerRight; m_Origin.uTrigger_R = PadStatus.triggerRight;
} }
m_LastButtonCombo = COMBO_NONE; m_LastButtonCombo = COMBO_NONE;
} }

View File

@ -26,16 +26,16 @@ CSIDevice_GCSteeringWheel::CSIDevice_GCSteeringWheel(SIDevices device, int _iDev
, m_LastButtonCombo(COMBO_NONE) , m_LastButtonCombo(COMBO_NONE)
{ {
memset(&m_Origin, 0, sizeof(SOrigin)); memset(&m_Origin, 0, sizeof(SOrigin));
m_Origin.uCommand = CMD_ORIGIN; m_Origin.uCommand = CMD_ORIGIN;
m_Origin.uOriginStickX = 0x80; // center m_Origin.uOriginStickX = 0x80; // center
m_Origin.uOriginStickY = 0x80; m_Origin.uOriginStickY = 0x80;
m_Origin.uSubStickStickX = 0x80; m_Origin.uSubStickStickX = 0x80;
m_Origin.uSubStickStickY = 0x80; m_Origin.uSubStickStickY = 0x80;
m_Origin.uTrigger_L = 0x1F; // 0-30 is the lower deadzone m_Origin.uTrigger_L = 0x1F; // 0-30 is the lower deadzone
m_Origin.uTrigger_R = 0x1F; m_Origin.uTrigger_R = 0x1F;
// Dunno if we need to do this, game/lib should set it? // Dunno if we need to do this, game/lib should set it?
m_Mode = 0x03; m_Mode = 0x03;
} }
int CSIDevice_GCSteeringWheel::RunBuffer(u8* _pBuffer, int _iLength) int CSIDevice_GCSteeringWheel::RunBuffer(u8* _pBuffer, int _iLength)
@ -109,8 +109,8 @@ bool CSIDevice_GCSteeringWheel::GetData(u32& _Hi, u32& _Low)
u32 netValues[2]; u32 netValues[2];
if (NetPlay_GetInput(ISIDevice::m_iDeviceNumber, PadStatus, netValues)) if (NetPlay_GetInput(ISIDevice::m_iDeviceNumber, PadStatus, netValues))
{ {
_Hi = netValues[0]; // first 4 bytes _Hi = netValues[0]; // first 4 bytes
_Low = netValues[1]; // last 4 bytes _Low = netValues[1]; // last 4 bytes
return true; return true;
} }
@ -139,51 +139,51 @@ bool CSIDevice_GCSteeringWheel::GetData(u32& _Hi, u32& _Low)
// Low bits are packed differently per mode // Low bits are packed differently per mode
if (m_Mode == 0 || m_Mode == 5 || m_Mode == 7) if (m_Mode == 0 || m_Mode == 5 || m_Mode == 7)
{ {
_Low = (u8)(PadStatus.analogB >> 4); // Top 4 bits _Low = (u8)(PadStatus.analogB >> 4); // Top 4 bits
_Low |= (u32)((u8)(PadStatus.analogA >> 4) << 4); // Top 4 bits _Low |= (u32)((u8)(PadStatus.analogA >> 4) << 4); // Top 4 bits
_Low |= (u32)((u8)(PadStatus.triggerRight >> 4) << 8); // Top 4 bits _Low |= (u32)((u8)(PadStatus.triggerRight >> 4) << 8); // Top 4 bits
_Low |= (u32)((u8)(PadStatus.triggerLeft >> 4) << 12); // Top 4 bits _Low |= (u32)((u8)(PadStatus.triggerLeft >> 4) << 12); // Top 4 bits
_Low |= (u32)((u8)(PadStatus.substickY) << 16); // All 8 bits _Low |= (u32)((u8)(PadStatus.substickY) << 16); // All 8 bits
_Low |= (u32)((u8)(PadStatus.substickX) << 24); // All 8 bits _Low |= (u32)((u8)(PadStatus.substickX) << 24); // All 8 bits
} }
else if (m_Mode == 1) else if (m_Mode == 1)
{ {
_Low = (u8)(PadStatus.analogB >> 4); // Top 4 bits _Low = (u8)(PadStatus.analogB >> 4); // Top 4 bits
_Low |= (u32)((u8)(PadStatus.analogA >> 4) << 4); // Top 4 bits _Low |= (u32)((u8)(PadStatus.analogA >> 4) << 4); // Top 4 bits
_Low |= (u32)((u8)PadStatus.triggerRight << 8); // All 8 bits _Low |= (u32)((u8)PadStatus.triggerRight << 8); // All 8 bits
_Low |= (u32)((u8)PadStatus.triggerLeft << 16); // All 8 bits _Low |= (u32)((u8)PadStatus.triggerLeft << 16); // All 8 bits
_Low |= (u32)((u8)PadStatus.substickY << 24); // Top 4 bits _Low |= (u32)((u8)PadStatus.substickY << 24); // Top 4 bits
_Low |= (u32)((u8)PadStatus.substickX << 28); // Top 4 bits _Low |= (u32)((u8)PadStatus.substickX << 28); // Top 4 bits
} }
else if (m_Mode == 2) else if (m_Mode == 2)
{ {
_Low = (u8)(PadStatus.analogB); // All 8 bits _Low = (u8)(PadStatus.analogB); // All 8 bits
_Low |= (u32)((u8)(PadStatus.analogA) << 8); // All 8 bits _Low |= (u32)((u8)(PadStatus.analogA) << 8); // All 8 bits
_Low |= (u32)((u8)(PadStatus.triggerRight >> 4) << 16); // Top 4 bits _Low |= (u32)((u8)(PadStatus.triggerRight >> 4) << 16); // Top 4 bits
_Low |= (u32)((u8)(PadStatus.triggerLeft >> 4) << 20); // Top 4 bits _Low |= (u32)((u8)(PadStatus.triggerLeft >> 4) << 20); // Top 4 bits
_Low |= (u32)((u8)PadStatus.substickY << 24); // Top 4 bits _Low |= (u32)((u8)PadStatus.substickY << 24); // Top 4 bits
_Low |= (u32)((u8)PadStatus.substickX << 28); // Top 4 bits _Low |= (u32)((u8)PadStatus.substickX << 28); // Top 4 bits
} }
else if (m_Mode == 3) else if (m_Mode == 3)
{ {
// Analog A/B are always 0 // Analog A/B are always 0
_Low = (u8)PadStatus.triggerRight; // All 8 bits _Low = (u8)PadStatus.triggerRight; // All 8 bits
_Low |= (u32)((u8)PadStatus.triggerLeft << 8); // All 8 bits _Low |= (u32)((u8)PadStatus.triggerLeft << 8); // All 8 bits
_Low |= (u32)((u8)PadStatus.substickY << 16); // All 8 bits _Low |= (u32)((u8)PadStatus.substickY << 16); // All 8 bits
_Low |= (u32)((u8)PadStatus.substickX << 24); // All 8 bits _Low |= (u32)((u8)PadStatus.substickX << 24); // All 8 bits
} }
else if (m_Mode == 4) else if (m_Mode == 4)
{ {
_Low = (u8)(PadStatus.analogB); // All 8 bits _Low = (u8)(PadStatus.analogB); // All 8 bits
_Low |= (u32)((u8)(PadStatus.analogA) << 8); // All 8 bits _Low |= (u32)((u8)(PadStatus.analogA) << 8); // All 8 bits
// triggerLeft/Right are always 0 // triggerLeft/Right are always 0
_Low |= (u32)((u8)PadStatus.substickY << 16); // All 8 bits _Low |= (u32)((u8)PadStatus.substickY << 16); // All 8 bits
_Low |= (u32)((u8)PadStatus.substickX << 24); // All 8 bits _Low |= (u32)((u8)PadStatus.substickX << 24); // All 8 bits
} }
else if (m_Mode == 6) else if (m_Mode == 6)
{ {
_Low = (u8)PadStatus.triggerRight; // All 8 bits _Low = (u8)PadStatus.triggerRight; // All 8 bits
_Low |= (u32)((u8)PadStatus.triggerLeft << 8); // All 8 bits _Low |= (u32)((u8)PadStatus.triggerLeft << 8); // All 8 bits
// The GC Steering Wheel appears to have combined pedals // The GC Steering Wheel appears to have combined pedals
// (both the Accelerate and Brake pedals are mapped to a single axis) // (both the Accelerate and Brake pedals are mapped to a single axis)
@ -219,12 +219,12 @@ bool CSIDevice_GCSteeringWheel::GetData(u32& _Hi, u32& _Low)
} }
else if (m_LastButtonCombo == COMBO_ORIGIN) else if (m_LastButtonCombo == COMBO_ORIGIN)
{ {
m_Origin.uOriginStickX = PadStatus.stickX; m_Origin.uOriginStickX = PadStatus.stickX;
m_Origin.uOriginStickY = PadStatus.stickY; m_Origin.uOriginStickY = PadStatus.stickY;
m_Origin.uSubStickStickX = PadStatus.substickX; m_Origin.uSubStickStickX = PadStatus.substickX;
m_Origin.uSubStickStickY = PadStatus.substickY; m_Origin.uSubStickStickY = PadStatus.substickY;
m_Origin.uTrigger_L = PadStatus.triggerLeft; m_Origin.uTrigger_L = PadStatus.triggerLeft;
m_Origin.uTrigger_R = PadStatus.triggerRight; m_Origin.uTrigger_R = PadStatus.triggerRight;
} }
m_LastButtonCombo = COMBO_NONE; m_LastButtonCombo = COMBO_NONE;
} }

View File

@ -84,18 +84,18 @@ namespace SystemTimers
u32 CPU_CORE_CLOCK = 486000000u; // 486 mhz (its not 485, stop bugging me!) u32 CPU_CORE_CLOCK = 486000000u; // 486 mhz (its not 485, stop bugging me!)
/* /*
Gamecube MHz Gamecube MHz
flipper <-> ARAM bus: 81 (DSP) flipper <-> ARAM bus: 81 (DSP)
gekko <-> flipper bus: 162 gekko <-> flipper bus: 162
flipper <-> 1T-SRAM bus: 324 flipper <-> 1T-SRAM bus: 324
gekko: 486 gekko: 486
These contain some guesses: These contain some guesses:
Wii MHz Wii MHz
hollywood <-> GDDR3 RAM bus: ??? no idea really hollywood <-> GDDR3 RAM bus: ??? no idea really
broadway <-> hollywood bus: 243 broadway <-> hollywood bus: 243
hollywood <-> 1T-SRAM bus: 486 hollywood <-> 1T-SRAM bus: 486
broadway: 729 broadway: 729
*/ */
// Ratio of TB and Decrementer to clock cycles. // Ratio of TB and Decrementer to clock cycles.
// TB clk is 1/4 of BUS clk. And it seems BUS clk is really 1/3 of CPU clk. // TB clk is 1/4 of BUS clk. And it seems BUS clk is really 1/3 of CPU clk.

View File

@ -23,30 +23,30 @@ namespace VideoInterface
// STATE_TO_SAVE // STATE_TO_SAVE
// Registers listed in order: // Registers listed in order:
static UVIVerticalTimingRegister m_VerticalTimingRegister; static UVIVerticalTimingRegister m_VerticalTimingRegister;
static UVIDisplayControlRegister m_DisplayControlRegister; static UVIDisplayControlRegister m_DisplayControlRegister;
static UVIHorizontalTiming0 m_HTiming0; static UVIHorizontalTiming0 m_HTiming0;
static UVIHorizontalTiming1 m_HTiming1; static UVIHorizontalTiming1 m_HTiming1;
static UVIVBlankTimingRegister m_VBlankTimingOdd; static UVIVBlankTimingRegister m_VBlankTimingOdd;
static UVIVBlankTimingRegister m_VBlankTimingEven; static UVIVBlankTimingRegister m_VBlankTimingEven;
static UVIBurstBlankingRegister m_BurstBlankingOdd; static UVIBurstBlankingRegister m_BurstBlankingOdd;
static UVIBurstBlankingRegister m_BurstBlankingEven; static UVIBurstBlankingRegister m_BurstBlankingEven;
static UVIFBInfoRegister m_XFBInfoTop; static UVIFBInfoRegister m_XFBInfoTop;
static UVIFBInfoRegister m_XFBInfoBottom; static UVIFBInfoRegister m_XFBInfoBottom;
static UVIFBInfoRegister m_3DFBInfoTop; // Start making your stereoscopic demos! :p static UVIFBInfoRegister m_3DFBInfoTop; // Start making your stereoscopic demos! :p
static UVIFBInfoRegister m_3DFBInfoBottom; static UVIFBInfoRegister m_3DFBInfoBottom;
static u16 m_VBeamPos = 0; // 0: Inactive static u16 m_VBeamPos = 0; // 0: Inactive
static u16 m_HBeamPos = 0; // 0: Inactive static u16 m_HBeamPos = 0; // 0: Inactive
static UVIInterruptRegister m_InterruptRegister[4]; static UVIInterruptRegister m_InterruptRegister[4];
static UVILatchRegister m_LatchRegister[2]; static UVILatchRegister m_LatchRegister[2];
static UVIHorizontalStepping m_HorizontalStepping; static UVIHorizontalStepping m_HorizontalStepping;
static UVIHorizontalScaling m_HorizontalScaling; static UVIHorizontalScaling m_HorizontalScaling;
static SVIFilterCoefTables m_FilterCoefTables; static SVIFilterCoefTables m_FilterCoefTables;
static u32 m_UnkAARegister = 0;// ??? 0x00FF0000 static u32 m_UnkAARegister = 0;// ??? 0x00FF0000
static u16 m_Clock = 0; // 0: 27MHz, 1: 54MHz static u16 m_Clock = 0; // 0: 27MHz, 1: 54MHz
static UVIDTVStatus m_DTVStatus; static UVIDTVStatus m_DTVStatus;
static u16 m_FBWidth = 0; // Only correct when scaling is enabled? static u16 m_FBWidth = 0; // Only correct when scaling is enabled?
static UVIBorderBlankRegister m_BorderHBlank; static UVIBorderBlankRegister m_BorderHBlank;
// 0xcc002076 - 0xcc00207f is full of 0x00FF: unknown // 0xcc002076 - 0xcc00207f is full of 0x00FF: unknown
// 0xcc002080 - 0xcc002100 even more unknown // 0xcc002080 - 0xcc002100 even more unknown

View File

@ -16,22 +16,22 @@ namespace VideoInterface
// the field rate from 60 FPS when they added color to the standard. // the field rate from 60 FPS when they added color to the standard.
// This was done to prevent analog interference between the video and // This was done to prevent analog interference between the video and
// audio signals. PAL has no similar reduction; it is exactly 50 FPS. // audio signals. PAL has no similar reduction; it is exactly 50 FPS.
//#define NTSC_FIELD_RATE (60.0f / 1.001f) //#define NTSC_FIELD_RATE (60.0f / 1.001f)
#define NTSC_FIELD_RATE 60 #define NTSC_FIELD_RATE 60
#define NTSC_LINE_COUNT 525 #define NTSC_LINE_COUNT 525
// These line numbers indicate the beginning of the "active video" in a frame. // These line numbers indicate the beginning of the "active video" in a frame.
// An NTSC frame has the lower field first followed by the upper field. // An NTSC frame has the lower field first followed by the upper field.
// TODO: Is this true for PAL-M? Is this true for EURGB60? // TODO: Is this true for PAL-M? Is this true for EURGB60?
#define NTSC_LOWER_BEGIN 21 #define NTSC_LOWER_BEGIN 21
#define NTSC_UPPER_BEGIN 283 #define NTSC_UPPER_BEGIN 283
//#define PAL_FIELD_RATE 50.0f //#define PAL_FIELD_RATE 50.0f
#define PAL_FIELD_RATE 50 #define PAL_FIELD_RATE 50
#define PAL_LINE_COUNT 625 #define PAL_LINE_COUNT 625
// These line numbers indicate the beginning of the "active video" in a frame. // These line numbers indicate the beginning of the "active video" in a frame.
// A PAL frame has the upper field first followed by the lower field. // A PAL frame has the upper field first followed by the lower field.
#define PAL_UPPER_BEGIN 23 #define PAL_UPPER_BEGIN 23
#define PAL_LOWER_BEGIN 336 #define PAL_LOWER_BEGIN 336
// VI Internal Hardware Addresses // VI Internal Hardware Addresses
enum enum

View File

@ -119,13 +119,13 @@ void DoState(PointerWrap &p)
void Init() void Init()
{ {
ctrl = CtrlRegister(); ctrl = CtrlRegister();
ppc_msg = ppc_msg = 0;
arm_msg = arm_msg = 0;
ppc_irq_flags = ppc_irq_flags = 0;
ppc_irq_masks = ppc_irq_masks = 0;
arm_irq_flags = arm_irq_flags = 0;
arm_irq_masks = arm_irq_masks = 0;
sensorbar_power = 0; sensorbar_power = 0;

View File

@ -7,7 +7,7 @@
#include <math.h> #include <math.h>
#ifndef M_PI #ifndef M_PI
#define M_PI 3.14159265358979323846 #define M_PI 3.14159265358979323846
#endif #endif
typedef double Matrix[4][4]; typedef double Matrix[4][4];
@ -26,10 +26,10 @@ inline void MatrixIdentity(Matrix & m)
inline void MatrixFrustum(Matrix &m, double l, double r, double b, double t, double n, double f) inline void MatrixFrustum(Matrix &m, double l, double r, double b, double t, double n, double f)
{ {
m[0][0]=2*n/(r-l); m[0][1]=0; m[0][2]=0; m[0][3]=0; m[0][0]=2*n/(r-l); m[0][1]=0; m[0][2]=0; m[0][3]=0;
m[1][0]=0; m[1][1]=2*n/(t-b); m[1][2]=0; m[1][3]=0; m[1][0]=0; m[1][1]=2*n/(t-b); m[1][2]=0; m[1][3]=0;
m[2][0]=(r+l)/(r-l); m[2][1]=(t+b)/(t-b); m[2][2]=(f+n)/(f-n); m[2][3]=-1; m[2][0]=(r+l)/(r-l); m[2][1]=(t+b)/(t-b); m[2][2]=(f+n)/(f-n); m[2][3]=-1;
m[3][0]=0; m[3][1]=0; m[3][2]=2*f*n/(f-n); m[3][3]=0; m[3][0]=0; m[3][1]=0; m[3][2]=2*f*n/(f-n); m[3][3]=0;
} }
inline void MatrixPerspective(Matrix & m, double fovy, double aspect, double nplane, double fplane) inline void MatrixPerspective(Matrix & m, double fovy, double aspect, double nplane, double fplane)
@ -47,23 +47,24 @@ inline void MatrixPerspective(Matrix & m, double fovy, double aspect, double npl
inline void MatrixRotationByZ(Matrix &m, double sin, double cos) inline void MatrixRotationByZ(Matrix &m, double sin, double cos)
{ {
m[0][0]=cos; m[0][1]=-sin; m[0][2]=0; m[0][3]=0; m[0][0]=cos; m[0][1]=-sin; m[0][2]=0; m[0][3]=0;
m[1][0]=sin; m[1][1]=cos; m[1][2]=0; m[1][3]=0; m[1][0]=sin; m[1][1]=cos; m[1][2]=0; m[1][3]=0;
m[2][0]=0; m[2][1]=0; m[2][2]=1; m[2][3]=0; m[2][0]=0; m[2][1]=0; m[2][2]=1; m[2][3]=0;
m[3][0]=0; m[3][1]=0; m[3][2]=0; m[3][3]=1; m[3][0]=0; m[3][1]=0; m[3][2]=0; m[3][3]=1;
} }
inline void MatrixScale(Matrix &m, double xfact, double yfact, double zfact) inline void MatrixScale(Matrix &m, double xfact, double yfact, double zfact)
{ {
m[0][0]=xfact; m[0][1]=0; m[0][2]=0; m[0][3]=0; m[0][0]=xfact; m[0][1]=0; m[0][2]=0; m[0][3]=0;
m[1][0]=0; m[1][1]=yfact; m[1][2]=0; m[1][3]=0; m[1][0]=0; m[1][1]=yfact; m[1][2]=0; m[1][3]=0;
m[2][0]=0; m[2][1]=0; m[2][2]=zfact; m[2][3]=0; m[2][0]=0; m[2][1]=0; m[2][2]=zfact; m[2][3]=0;
m[3][0]=0; m[3][1]=0; m[3][2]=0; m[3][3]=1; m[3][0]=0; m[3][1]=0; m[3][2]=0; m[3][3]=1;
} }
inline void MatrixMultiply(Matrix &r, const Matrix &a, const Matrix &b) inline void MatrixMultiply(Matrix &r, const Matrix &a, const Matrix &b)
{ {
for (int i=0; i<16; i++) for (int i=0; i<16; i++)
r[i>>2][i&3]=0.0f; r[i>>2][i&3]=0.0f;
for (int i=0; i<4; i++) for (int i=0; i<4; i++)
for (int j=0; j<4; j++) for (int j=0; j<4; j++)
for (int k=0; k<4; k++) for (int k=0; k<4; k++)

View File

@ -899,21 +899,21 @@ void Wiimote::LoadDefaults(const ControllerInterface& ciface)
// Buttons // Buttons
#if defined HAVE_X11 && HAVE_X11 #if defined HAVE_X11 && HAVE_X11
set_control(m_buttons, 0, "Click 1"); // A set_control(m_buttons, 0, "Click 1"); // A
set_control(m_buttons, 1, "Click 3"); // B set_control(m_buttons, 1, "Click 3"); // B
#else #else
set_control(m_buttons, 0, "Click 0"); // A set_control(m_buttons, 0, "Click 0"); // A
set_control(m_buttons, 1, "Click 1"); // B set_control(m_buttons, 1, "Click 1"); // B
#endif #endif
set_control(m_buttons, 2, "1"); // 1 set_control(m_buttons, 2, "1"); // 1
set_control(m_buttons, 3, "2"); // 2 set_control(m_buttons, 3, "2"); // 2
set_control(m_buttons, 4, "Q"); // - set_control(m_buttons, 4, "Q"); // -
set_control(m_buttons, 5, "E"); // + set_control(m_buttons, 5, "E"); // +
#ifdef _WIN32 #ifdef _WIN32
set_control(m_buttons, 6, "RETURN"); // Home set_control(m_buttons, 6, "RETURN"); // Home
#else #else
set_control(m_buttons, 6, "Return"); // Home set_control(m_buttons, 6, "Return"); // Home
#endif #endif
// Shake // Shake
@ -928,20 +928,20 @@ void Wiimote::LoadDefaults(const ControllerInterface& ciface)
// DPad // DPad
#ifdef _WIN32 #ifdef _WIN32
set_control(m_dpad, 0, "UP"); // Up set_control(m_dpad, 0, "UP"); // Up
set_control(m_dpad, 1, "DOWN"); // Down set_control(m_dpad, 1, "DOWN"); // Down
set_control(m_dpad, 2, "LEFT"); // Left set_control(m_dpad, 2, "LEFT"); // Left
set_control(m_dpad, 3, "RIGHT"); // Right set_control(m_dpad, 3, "RIGHT"); // Right
#elif __APPLE__ #elif __APPLE__
set_control(m_dpad, 0, "Up Arrow"); // Up set_control(m_dpad, 0, "Up Arrow"); // Up
set_control(m_dpad, 1, "Down Arrow"); // Down set_control(m_dpad, 1, "Down Arrow"); // Down
set_control(m_dpad, 2, "Left Arrow"); // Left set_control(m_dpad, 2, "Left Arrow"); // Left
set_control(m_dpad, 3, "Right Arrow"); // Right set_control(m_dpad, 3, "Right Arrow"); // Right
#else #else
set_control(m_dpad, 0, "Up"); // Up set_control(m_dpad, 0, "Up"); // Up
set_control(m_dpad, 1, "Down"); // Down set_control(m_dpad, 1, "Down"); // Down
set_control(m_dpad, 2, "Left"); // Left set_control(m_dpad, 2, "Left"); // Left
set_control(m_dpad, 3, "Right"); // Right set_control(m_dpad, 3, "Right"); // Right
#endif #endif
// ugly stuff // ugly stuff

View File

@ -175,10 +175,10 @@ struct wm_report
u8 data[0]; u8 data[0];
struct struct
{ {
u8 rumble : 1; // enable/disable rumble u8 rumble : 1; // enable/disable rumble
// only valid for certain reports // only valid for certain reports
u8 ack : 1; // respond with an ack u8 ack : 1; // respond with an ack
u8 enable : 1; // enable/disable certain features u8 enable : 1; // enable/disable certain features
}; };
}; };
}; };
@ -232,7 +232,7 @@ struct wm_status_report
struct wm_write_data struct wm_write_data
{ {
u8 rumble : 1; u8 rumble : 1;
u8 space : 2; //see WM_SPACE_* u8 space : 2; //see WM_SPACE_*
u8 : 5; u8 : 5;
u8 address[3]; u8 address[3];
u8 size; u8 size;
@ -251,7 +251,7 @@ struct wm_acknowledge
struct wm_read_data struct wm_read_data
{ {
u8 rumble : 1; u8 rumble : 1;
u8 space : 2; //see WM_SPACE_* u8 space : 2; //see WM_SPACE_*
u8 : 5; u8 : 5;
u8 address[3]; u8 address[3];
u16 size; u16 size;
@ -266,7 +266,7 @@ struct wm_read_data
struct wm_read_data_reply struct wm_read_data_reply
{ {
wm_core buttons; wm_core buttons;
u8 error : 4; //see WM_RDERR_* u8 error : 4; //see WM_RDERR_*
u8 size : 4; u8 size : 4;
u16 address; u16 address;
u8 data[16]; u8 data[16];

View File

@ -19,7 +19,7 @@
#include "../WiimoteEmu/WiimoteHid.h" #include "../WiimoteEmu/WiimoteHid.h"
unsigned int g_wiimote_sources[MAX_BBMOTES]; unsigned int g_wiimote_sources[MAX_BBMOTES];
namespace WiimoteReal namespace WiimoteReal
{ {

View File

@ -82,17 +82,17 @@ public:
bool m_connected; bool m_connected;
CFRunLoopRef m_wiimote_thread_run_loop; CFRunLoopRef m_wiimote_thread_run_loop;
#elif defined(__linux__) && HAVE_BLUEZ #elif defined(__linux__) && HAVE_BLUEZ
bdaddr_t bdaddr; // Bluetooth address bdaddr_t bdaddr; // Bluetooth address
int cmd_sock; // Command socket int cmd_sock; // Command socket
int int_sock; // Interrupt socket int int_sock; // Interrupt socket
int wakeup_pipe_w, wakeup_pipe_r; int wakeup_pipe_w, wakeup_pipe_r;
#elif defined(_WIN32) #elif defined(_WIN32)
std::basic_string<TCHAR> devicepath; // Unique wiimote reference std::basic_string<TCHAR> devicepath; // Unique wiimote reference
//ULONGLONG btaddr; // Bluetooth address //ULONGLONG btaddr; // Bluetooth address
HANDLE dev_handle; // HID handle HANDLE dev_handle; // HID handle
OVERLAPPED hid_overlap_read, hid_overlap_write; // Overlap handle OVERLAPPED hid_overlap_read, hid_overlap_write; // Overlap handle
enum win_bt_stack_t stack; // Type of bluetooth stack to use enum win_bt_stack_t stack; // Type of bluetooth stack to use
#endif #endif
protected: protected:

View File

@ -22,33 +22,33 @@
// Wiimote internal codes // Wiimote internal codes
// Communication channels // Communication channels
#define WM_OUTPUT_CHANNEL 0x11 #define WM_OUTPUT_CHANNEL 0x11
#define WM_INPUT_CHANNEL 0x13 #define WM_INPUT_CHANNEL 0x13
// The 4 most significant bits of the first byte of an outgoing command must be // The 4 most significant bits of the first byte of an outgoing command must be
// 0x50 if sending on the command channel and 0xA0 if sending on the interrupt // 0x50 if sending on the command channel and 0xA0 if sending on the interrupt
// channel. On Mac and Linux we use interrupt channel; on Windows, command. // channel. On Mac and Linux we use interrupt channel; on Windows, command.
#ifdef _WIN32 #ifdef _WIN32
#define WM_SET_REPORT 0x50 #define WM_SET_REPORT 0x50
#else #else
#define WM_SET_REPORT 0xA0 #define WM_SET_REPORT 0xA0
#endif #endif
#define WM_BT_INPUT 0x01 #define WM_BT_INPUT 0x01
#define WM_BT_OUTPUT 0x02 #define WM_BT_OUTPUT 0x02
// LED bit masks // LED bit masks
#define WIIMOTE_LED_NONE 0x00 #define WIIMOTE_LED_NONE 0x00
#define WIIMOTE_LED_1 0x10 #define WIIMOTE_LED_1 0x10
#define WIIMOTE_LED_2 0x20 #define WIIMOTE_LED_2 0x20
#define WIIMOTE_LED_3 0x40 #define WIIMOTE_LED_3 0x40
#define WIIMOTE_LED_4 0x80 #define WIIMOTE_LED_4 0x80
// End Wiimote internal codes // End Wiimote internal codes
// It's 23. NOT 32! // It's 23. NOT 32!
#define MAX_PAYLOAD 23 #define MAX_PAYLOAD 23
#define WIIMOTE_DEFAULT_TIMEOUT 1000 #define WIIMOTE_DEFAULT_TIMEOUT 1000
#ifdef _WIN32 #ifdef _WIN32
// Available bluetooth stacks for Windows. // Available bluetooth stacks for Windows.

View File

@ -11,8 +11,8 @@ class IWII_IPC_HLE_Device;
namespace WII_IPC_HLE_Interface namespace WII_IPC_HLE_Interface
{ {
#define IPC_FIRST_ID 0x00 // first IPC device ID #define IPC_FIRST_ID 0x00 // First IPC device ID
#define IPC_MAX_FILES 0x10 // first IPC file ID #define IPC_MAX_FILES 0x10 // First IPC file ID
void EnqueReplyCallback(u64 userdata, int =0); void EnqueReplyCallback(u64 userdata, int =0);
@ -54,13 +54,13 @@ void EnqReply(u32 _Address, int cycles_in_future = 0);
enum ECommandType enum ECommandType
{ {
COMMAND_OPEN_DEVICE = 1, COMMAND_OPEN_DEVICE = 1,
COMMAND_CLOSE_DEVICE = 2, COMMAND_CLOSE_DEVICE = 2,
COMMAND_READ = 3, COMMAND_READ = 3,
COMMAND_WRITE = 4, COMMAND_WRITE = 4,
COMMAND_SEEK = 5, COMMAND_SEEK = 5,
COMMAND_IOCTL = 6, COMMAND_IOCTL = 6,
COMMAND_IOCTLV = 7, COMMAND_IOCTLV = 7,
}; };
} // end of namespace WII_IPC_HLE_Interface } // end of namespace WII_IPC_HLE_Interface

View File

@ -68,23 +68,23 @@ CWII_IPC_HLE_Device_es::CWII_IPC_HLE_Device_es(u32 _DeviceID, const std::string&
{ {
} }
static u8 key_sd [0x10] = {0xab, 0x01, 0xb9, 0xd8, 0xe1, 0x62, 0x2b, 0x08, 0xaf, 0xba, 0xd8, 0x4d, 0xbf, 0xc2, 0xa5, 0x5d}; static u8 key_sd [0x10] = {0xab, 0x01, 0xb9, 0xd8, 0xe1, 0x62, 0x2b, 0x08, 0xaf, 0xba, 0xd8, 0x4d, 0xbf, 0xc2, 0xa5, 0x5d};
static u8 key_ecc [0x1e] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01}; static u8 key_ecc [0x1e] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01};
static u8 key_empty[0x10] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; static u8 key_empty[0x10] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
// default key table // default key table
u8* CWII_IPC_HLE_Device_es::keyTable[11] = { u8* CWII_IPC_HLE_Device_es::keyTable[11] = {
key_ecc, // ECC Private Key key_ecc, // ECC Private Key
key_empty, // Console ID key_empty, // Console ID
key_empty, // NAND AES Key key_empty, // NAND AES Key
key_empty, // NAND HMAC key_empty, // NAND HMAC
key_empty, // Common Key key_empty, // Common Key
key_empty, // PRNG seed key_empty, // PRNG seed
key_sd, // SD Key key_sd, // SD Key
key_empty, // Unknown key_empty, // Unknown
key_empty, // Unknown key_empty, // Unknown
key_empty, // Unknown key_empty, // Unknown
key_empty, // Unknown key_empty, // Unknown
}; };
CWII_IPC_HLE_Device_es::~CWII_IPC_HLE_Device_es() CWII_IPC_HLE_Device_es::~CWII_IPC_HLE_Device_es()
@ -875,12 +875,12 @@ bool CWII_IPC_HLE_Device_es::IOCtlV(u32 _CommandAddress)
case IOCTL_ES_DECRYPT: case IOCTL_ES_DECRYPT:
{ {
u32 keyIndex = Memory::Read_U32(Buffer.InBuffer[0].m_Address); u32 keyIndex = Memory::Read_U32(Buffer.InBuffer[0].m_Address);
u8* IV = Memory::GetPointer(Buffer.InBuffer[1].m_Address); u8* IV = Memory::GetPointer(Buffer.InBuffer[1].m_Address);
u8* source = Memory::GetPointer(Buffer.InBuffer[2].m_Address); u8* source = Memory::GetPointer(Buffer.InBuffer[2].m_Address);
u32 size = Buffer.InBuffer[2].m_Size; u32 size = Buffer.InBuffer[2].m_Size;
u8* newIV = Memory::GetPointer(Buffer.PayloadBuffer[0].m_Address); u8* newIV = Memory::GetPointer(Buffer.PayloadBuffer[0].m_Address);
u8* destination = Memory::GetPointer(Buffer.PayloadBuffer[1].m_Address); u8* destination = Memory::GetPointer(Buffer.PayloadBuffer[1].m_Address);
aes_context AES_ctx; aes_context AES_ctx;
aes_setkey_dec(&AES_ctx, keyTable[keyIndex], 128); aes_setkey_dec(&AES_ctx, keyTable[keyIndex], 128);
@ -898,12 +898,12 @@ bool CWII_IPC_HLE_Device_es::IOCtlV(u32 _CommandAddress)
bool bSuccess = false; bool bSuccess = false;
u16 IOSv = 0xffff; u16 IOSv = 0xffff;
u64 TitleID = Memory::Read_U64(Buffer.InBuffer[0].m_Address); u64 TitleID = Memory::Read_U64(Buffer.InBuffer[0].m_Address);
u32 view = Memory::Read_U32(Buffer.InBuffer[1].m_Address); u32 view = Memory::Read_U32(Buffer.InBuffer[1].m_Address);
u64 ticketid = Memory::Read_U64(Buffer.InBuffer[1].m_Address+4); u64 ticketid = Memory::Read_U64(Buffer.InBuffer[1].m_Address+4);
u32 devicetype = Memory::Read_U32(Buffer.InBuffer[1].m_Address+12); u32 devicetype = Memory::Read_U32(Buffer.InBuffer[1].m_Address+12);
u64 titleid = Memory::Read_U64(Buffer.InBuffer[1].m_Address+16); u64 titleid = Memory::Read_U64(Buffer.InBuffer[1].m_Address+16);
u16 access = Memory::Read_U16(Buffer.InBuffer[1].m_Address+24); u16 access = Memory::Read_U16(Buffer.InBuffer[1].m_Address+24);
if ((u32)(TitleID>>32) != 0x00000001 || TitleID == TITLEID_SYSMENU) if ((u32)(TitleID>>32) != 0x00000001 || TitleID == TITLEID_SYSMENU)

View File

@ -267,13 +267,13 @@ s32 CWII_IPC_HLE_Device_fs::ExecuteCommand(u32 _Parameter, u32 _BufferIn, u32 _B
NANDStat fs; NANDStat fs;
//TODO: scrape the real amounts from somewhere... //TODO: scrape the real amounts from somewhere...
fs.BlockSize = 0x4000; fs.BlockSize = 0x4000;
fs.FreeUserBlocks = 0x5DEC; fs.FreeUserBlocks = 0x5DEC;
fs.UsedUserBlocks = 0x1DD4; fs.UsedUserBlocks = 0x1DD4;
fs.FreeSysBlocks = 0x10; fs.FreeSysBlocks = 0x10;
fs.UsedSysBlocks = 0x02F0; fs.UsedSysBlocks = 0x02F0;
fs.Free_INodes = 0x146B; fs.Free_INodes = 0x146B;
fs.Used_Inodes = 0x0394; fs.Used_Inodes = 0x0394;
*(NANDStat*)Memory::GetPointer(_BufferOut) = fs; *(NANDStat*)Memory::GetPointer(_BufferOut) = fs;
@ -335,10 +335,10 @@ s32 CWII_IPC_HLE_Device_fs::ExecuteCommand(u32 _Parameter, u32 _BufferIn, u32 _B
u32 OwnerID = 0; u32 OwnerID = 0;
u16 GroupID = 0x3031; // this is also known as makercd, 01 (0x3031) for nintendo and 08 (0x3038) for MH3 etc u16 GroupID = 0x3031; // this is also known as makercd, 01 (0x3031) for nintendo and 08 (0x3038) for MH3 etc
std::string Filename = HLE_IPC_BuildFilename((const char*)Memory::GetPointer(_BufferIn), 64); std::string Filename = HLE_IPC_BuildFilename((const char*)Memory::GetPointer(_BufferIn), 64);
u8 OwnerPerm = 0x3; // read/write u8 OwnerPerm = 0x3; // read/write
u8 GroupPerm = 0x3; // read/write u8 GroupPerm = 0x3; // read/write
u8 OtherPerm = 0x3; // read/write u8 OtherPerm = 0x3; // read/write
u8 Attributes = 0x00; // no attributes u8 Attributes = 0x00; // no attributes
if (File::IsDirectory(Filename)) if (File::IsDirectory(Filename))
{ {
INFO_LOG(WII_IPC_FILEIO, "FS: GET_ATTR Directory %s - all permission flags are set", Filename.c_str()); INFO_LOG(WII_IPC_FILEIO, "FS: GET_ATTR Directory %s - all permission flags are set", Filename.c_str());
@ -360,13 +360,13 @@ s32 CWII_IPC_HLE_Device_fs::ExecuteCommand(u32 _Parameter, u32 _BufferIn, u32 _B
if (_BufferOutSize == 76) if (_BufferOutSize == 76)
{ {
u32 Addr = _BufferOut; u32 Addr = _BufferOut;
Memory::Write_U32(OwnerID, Addr); Addr += 4; Memory::Write_U32(OwnerID, Addr); Addr += 4;
Memory::Write_U16(GroupID, Addr); Addr += 2; Memory::Write_U16(GroupID, Addr); Addr += 2;
memcpy(Memory::GetPointer(Addr), Memory::GetPointer(_BufferIn), 64); Addr += 64; memcpy(Memory::GetPointer(Addr), Memory::GetPointer(_BufferIn), 64); Addr += 64;
Memory::Write_U8(OwnerPerm, Addr); Addr += 1; Memory::Write_U8(OwnerPerm, Addr); Addr += 1;
Memory::Write_U8(GroupPerm, Addr); Addr += 1; Memory::Write_U8(GroupPerm, Addr); Addr += 1;
Memory::Write_U8(OtherPerm, Addr); Addr += 1; Memory::Write_U8(OtherPerm, Addr); Addr += 1;
Memory::Write_U8(Attributes, Addr); Addr += 1; Memory::Write_U8(Attributes, Addr); Addr += 1;
} }
return FS_RESULT_OK; return FS_RESULT_OK;

View File

@ -130,11 +130,11 @@ u32 CWII_IPC_HLE_Device_hid::Update()
bool CWII_IPC_HLE_Device_hid::IOCtl(u32 _CommandAddress) bool CWII_IPC_HLE_Device_hid::IOCtl(u32 _CommandAddress)
{ {
u32 Parameter = Memory::Read_U32(_CommandAddress + 0xC); u32 Parameter = Memory::Read_U32(_CommandAddress + 0xC);
u32 BufferIn = Memory::Read_U32(_CommandAddress + 0x10); u32 BufferIn = Memory::Read_U32(_CommandAddress + 0x10);
u32 BufferInSize = Memory::Read_U32(_CommandAddress + 0x14); u32 BufferInSize = Memory::Read_U32(_CommandAddress + 0x14);
u32 BufferOut = Memory::Read_U32(_CommandAddress + 0x18); u32 BufferOut = Memory::Read_U32(_CommandAddress + 0x18);
u32 BufferOutSize = Memory::Read_U32(_CommandAddress + 0x1C); u32 BufferOutSize = Memory::Read_U32(_CommandAddress + 0x1C);
u32 ReturnValue = 0; u32 ReturnValue = 0;
switch (Parameter) switch (Parameter)
@ -536,7 +536,8 @@ libusb_device_handle * CWII_IPC_HLE_Device_hid::GetDeviceByDevNum(u32 devNum)
static bool has_warned_about_drivers = false; static bool has_warned_about_drivers = false;
#endif #endif
for (ssize_t i = 0; i < cnt; i++) { for (ssize_t i = 0; i < cnt; i++)
{
libusb_device *device = list[i]; libusb_device *device = list[i];
struct libusb_device_descriptor desc; struct libusb_device_descriptor desc;
int dRet = libusb_get_device_descriptor (device, &desc); int dRet = libusb_get_device_descriptor (device, &desc);
@ -610,10 +611,10 @@ libusb_device_handle * CWII_IPC_HLE_Device_hid::GetDeviceByDevNum(u32 devNum)
int CWII_IPC_HLE_Device_hid::GetAvaiableDevNum(u16 idVendor, u16 idProduct, u8 bus, u8 port, u16 check) int CWII_IPC_HLE_Device_hid::GetAvaiableDevNum(u16 idVendor, u16 idProduct, u8 bus, u8 port, u16 check)
{ {
int i;
int pos = -1; int pos = -1;
u64 unique_id = ((u64)idVendor << 32) | ((u64)idProduct << 16) | ((u64)bus << 8) | (u64)port; u64 unique_id = ((u64)idVendor << 32) | ((u64)idProduct << 16) | ((u64)bus << 8) | (u64)port;
for (i=0; i<MAX_DEVICE_DEVNUM; i++)
for (int i=0; i<MAX_DEVICE_DEVNUM; i++)
{ {
u64 id = hidDeviceAliases[i] & HID_ID_MASK; u64 id = hidDeviceAliases[i] & HID_ID_MASK;
if(id == 0 && pos == -1) if(id == 0 && pos == -1)
@ -626,10 +627,12 @@ int CWII_IPC_HLE_Device_hid::GetAvaiableDevNum(u16 idVendor, u16 idProduct, u8 b
return i; return i;
} }
} }
if(pos != -1) if(pos != -1)
{ {
hidDeviceAliases[pos] = unique_id | ((u64)check << 48); hidDeviceAliases[pos] = unique_id | ((u64)check << 48);
return pos; return pos;
} }
return -1; return -1;
} }

View File

@ -77,11 +77,11 @@ bool CWII_IPC_HLE_Device_net_kd_request::Close(u32 _CommandAddress, bool _bForce
bool CWII_IPC_HLE_Device_net_kd_request::IOCtl(u32 _CommandAddress) bool CWII_IPC_HLE_Device_net_kd_request::IOCtl(u32 _CommandAddress)
{ {
u32 Parameter = Memory::Read_U32(_CommandAddress + 0xC); u32 Parameter = Memory::Read_U32(_CommandAddress + 0xC);
u32 BufferIn = Memory::Read_U32(_CommandAddress + 0x10); u32 BufferIn = Memory::Read_U32(_CommandAddress + 0x10);
u32 BufferInSize = Memory::Read_U32(_CommandAddress + 0x14); u32 BufferInSize = Memory::Read_U32(_CommandAddress + 0x14);
u32 BufferOut = Memory::Read_U32(_CommandAddress + 0x18); u32 BufferOut = Memory::Read_U32(_CommandAddress + 0x18);
u32 BufferOutSize = Memory::Read_U32(_CommandAddress + 0x1C); u32 BufferOutSize = Memory::Read_U32(_CommandAddress + 0x1C);
u32 ReturnValue = 0; u32 ReturnValue = 0;
switch (Parameter) switch (Parameter)
@ -628,11 +628,11 @@ static unsigned int opt_name_mapping[][2] = {
bool CWII_IPC_HLE_Device_net_ip_top::IOCtl(u32 _CommandAddress) bool CWII_IPC_HLE_Device_net_ip_top::IOCtl(u32 _CommandAddress)
{ {
u32 Command = Memory::Read_U32(_CommandAddress + 0x0C); u32 Command = Memory::Read_U32(_CommandAddress + 0x0C);
u32 BufferIn = Memory::Read_U32(_CommandAddress + 0x10); u32 BufferIn = Memory::Read_U32(_CommandAddress + 0x10);
u32 BufferInSize = Memory::Read_U32(_CommandAddress + 0x14); u32 BufferInSize = Memory::Read_U32(_CommandAddress + 0x14);
u32 BufferOut = Memory::Read_U32(_CommandAddress + 0x18); u32 BufferOut = Memory::Read_U32(_CommandAddress + 0x18);
u32 BufferOutSize = Memory::Read_U32(_CommandAddress + 0x1C); u32 BufferOutSize = Memory::Read_U32(_CommandAddress + 0x1C);
u32 ReturnValue = 0; u32 ReturnValue = 0;
switch (Command) switch (Command)
@ -646,9 +646,9 @@ bool CWII_IPC_HLE_Device_net_ip_top::IOCtl(u32 _CommandAddress)
} }
case IOCTL_SO_SOCKET: case IOCTL_SO_SOCKET:
{ {
u32 af = Memory::Read_U32(BufferIn); u32 af = Memory::Read_U32(BufferIn);
u32 type = Memory::Read_U32(BufferIn + 0x04); u32 type = Memory::Read_U32(BufferIn + 0x04);
u32 prot = Memory::Read_U32(BufferIn + 0x08); u32 prot = Memory::Read_U32(BufferIn + 0x08);
WiiSockMan &sm = WiiSockMan::getInstance(); WiiSockMan &sm = WiiSockMan::getInstance();
ReturnValue = sm.newSocket(af, type, prot); ReturnValue = sm.newSocket(af, type, prot);
@ -912,9 +912,9 @@ bool CWII_IPC_HLE_Device_net_ip_top::IOCtl(u32 _CommandAddress)
for (int i = 0; i < nfds; i++) for (int i = 0; i < nfds; i++)
{ {
ufds[i].fd = Memory::Read_U32(BufferOut + 0xc*i); //fd ufds[i].fd = Memory::Read_U32(BufferOut + 0xc*i); //fd
int events = Memory::Read_U32(BufferOut + 0xc*i + 4); //events int events = Memory::Read_U32(BufferOut + 0xc*i + 4); //events
ufds[i].revents = Memory::Read_U32(BufferOut + 0xc*i + 8); //revents ufds[i].revents = Memory::Read_U32(BufferOut + 0xc*i + 8); //revents
// Translate Wii to native events // Translate Wii to native events
int unhandled_events = events; int unhandled_events = events;
@ -1246,14 +1246,14 @@ bool CWII_IPC_HLE_Device_net_ip_top::IOCtlV(u32 CommandAddress)
if (BufferInSize3) if (BufferInSize3)
{ {
hints.ai_flags = Memory::Read_U32(_BufferIn3); hints.ai_flags = Memory::Read_U32(_BufferIn3);
hints.ai_family = Memory::Read_U32(_BufferIn3 + 0x4); hints.ai_family = Memory::Read_U32(_BufferIn3 + 0x4);
hints.ai_socktype = Memory::Read_U32(_BufferIn3 + 0x8); hints.ai_socktype = Memory::Read_U32(_BufferIn3 + 0x8);
hints.ai_protocol = Memory::Read_U32(_BufferIn3 + 0xC); hints.ai_protocol = Memory::Read_U32(_BufferIn3 + 0xC);
hints.ai_addrlen = Memory::Read_U32(_BufferIn3 + 0x10); hints.ai_addrlen = Memory::Read_U32(_BufferIn3 + 0x10);
hints.ai_canonname = NULL; hints.ai_canonname = NULL;
hints.ai_addr = NULL; hints.ai_addr = NULL;
hints.ai_next = NULL; hints.ai_next = NULL;
} }
char* pNodeName = NULL; char* pNodeName = NULL;
@ -1336,10 +1336,10 @@ bool CWII_IPC_HLE_Device_net_ip_top::IOCtlV(u32 CommandAddress)
INFO_LOG(WII_IPC_NET, "IOCTLV_SO_ICMPPING %i IPs", num_ip); INFO_LOG(WII_IPC_NET, "IOCTLV_SO_ICMPPING %i IPs", num_ip);
} }
ip_info.length = Memory::Read_U8(_BufferIn + 16); ip_info.length = Memory::Read_U8(_BufferIn + 16);
ip_info.addr_family = Memory::Read_U8(_BufferIn + 17); ip_info.addr_family = Memory::Read_U8(_BufferIn + 17);
ip_info.icmp_id = Memory::Read_U16(_BufferIn + 18); ip_info.icmp_id = Memory::Read_U16(_BufferIn + 18);
ip_info.ip = Memory::Read_U32(_BufferIn + 20); ip_info.ip = Memory::Read_U32(_BufferIn + 20);
if (ip_info.length != 8 || ip_info.addr_family != AF_INET) if (ip_info.length != 8 || ip_info.addr_family != AF_INET)
{ {

View File

@ -22,7 +22,7 @@ struct netcfg_proxy_t
u8 padding_1[2]; u8 padding_1[2];
u8 proxy_name[255]; u8 proxy_name[255];
u8 padding_2; u8 padding_2;
u16 proxy_port; // 0-34463 u16 proxy_port; // 0-34463
u8 proxy_username[32]; u8 proxy_username[32];
u8 padding_3; u8 padding_3;
u8 proxy_password[32]; u8 proxy_password[32];
@ -91,8 +91,8 @@ struct netcfg_connection_t
u8 padding_7[3]; u8 padding_7[3];
u8 encryption; u8 encryption;
u8 padding_8[3]; u8 padding_8[3];
u8 key_length; // length of key in bytes. 0x00 for WEP64 and WEP128. u8 key_length; // length of key in bytes. 0x00 for WEP64 and WEP128.
u8 unknown; // 0x00 or 0x01 toggled with a WPA-PSK (TKIP) and with a WEP entered with hex instead of ascii. u8 unknown; // 0x00 or 0x01 toggled with a WPA-PSK (TKIP) and with a WEP entered with hex instead of ascii.
u8 padding_9; u8 padding_9;
u8 key[64]; // encryption key; for WEP, key is stored 4 times (20 bytes for WEP64 and 52 bytes for WEP128) then padded with 0x00 u8 key[64]; // encryption key; for WEP, key is stored 4 times (20 bytes for WEP64 and 52 bytes for WEP128) then padded with 0x00
u8 padding_10[236]; u8 padding_10[236];
@ -143,11 +143,11 @@ struct nwc24_config_t
MAX_PASSWORD_LENGTH = 0x20, MAX_PASSWORD_LENGTH = 0x20,
}; };
u32 magic; /* 'WcCf' 0x57634366 */ u32 magic; /* 'WcCf' 0x57634366 */
u32 _unk_04; /* must be 8 */ u32 _unk_04; /* must be 8 */
u64 nwc24_id; u64 nwc24_id;
u32 id_generation; u32 id_generation;
u32 creation_stage; /* 0==not_generated;1==generated;2==registered; */ u32 creation_stage; /* 0==not_generated;1==generated;2==registered; */
char email[MAX_EMAIL_LENGTH]; char email[MAX_EMAIL_LENGTH];
char paswd[MAX_PASSWORD_LENGTH]; char paswd[MAX_PASSWORD_LENGTH];
char mlchkid[0x24]; char mlchkid[0x24];
@ -472,9 +472,9 @@ public:
virtual bool IOCtl(u32 _CommandAddress) virtual bool IOCtl(u32 _CommandAddress)
{ {
u32 Parameter = Memory::Read_U32(_CommandAddress + 0x0C); u32 Parameter = Memory::Read_U32(_CommandAddress + 0x0C);
u32 BufferIn = Memory::Read_U32(_CommandAddress + 0x10); u32 BufferIn = Memory::Read_U32(_CommandAddress + 0x10);
u32 BufferOut = Memory::Read_U32(_CommandAddress + 0x18); u32 BufferOut = Memory::Read_U32(_CommandAddress + 0x18);
u32 result = 0; u32 result = 0;
u32 common_result = 0; u32 common_result = 0;

View File

@ -72,11 +72,11 @@ bool CWII_IPC_HLE_Device_net_ssl::Close(u32 _CommandAddress, bool _bForce)
bool CWII_IPC_HLE_Device_net_ssl::IOCtl(u32 _CommandAddress) bool CWII_IPC_HLE_Device_net_ssl::IOCtl(u32 _CommandAddress)
{ {
u32 BufferIn = Memory::Read_U32(_CommandAddress + 0x10); u32 BufferIn = Memory::Read_U32(_CommandAddress + 0x10);
u32 BufferInSize = Memory::Read_U32(_CommandAddress + 0x14); u32 BufferInSize = Memory::Read_U32(_CommandAddress + 0x14);
u32 BufferOut = Memory::Read_U32(_CommandAddress + 0x18); u32 BufferOut = Memory::Read_U32(_CommandAddress + 0x18);
u32 BufferOutSize = Memory::Read_U32(_CommandAddress + 0x1C); u32 BufferOutSize = Memory::Read_U32(_CommandAddress + 0x1C);
u32 Command = Memory::Read_U32(_CommandAddress + 0x0C); u32 Command = Memory::Read_U32(_CommandAddress + 0x0C);
INFO_LOG(WII_IPC_SSL, "%s unknown %i " INFO_LOG(WII_IPC_SSL, "%s unknown %i "
"(BufferIn: (%08x, %i), BufferOut: (%08x, %i)", "(BufferIn: (%08x, %i), BufferOut: (%08x, %i)",

View File

@ -97,17 +97,18 @@ bool CWII_IPC_HLE_Device_sdio_slot0::IOCtl(u32 _CommandAddress)
{ {
u32 Cmd = Memory::Read_U32(_CommandAddress + 0xC); u32 Cmd = Memory::Read_U32(_CommandAddress + 0xC);
u32 BufferIn = Memory::Read_U32(_CommandAddress + 0x10); u32 BufferIn = Memory::Read_U32(_CommandAddress + 0x10);
u32 BufferInSize = Memory::Read_U32(_CommandAddress + 0x14); u32 BufferInSize = Memory::Read_U32(_CommandAddress + 0x14);
u32 BufferOut = Memory::Read_U32(_CommandAddress + 0x18); u32 BufferOut = Memory::Read_U32(_CommandAddress + 0x18);
u32 BufferOutSize = Memory::Read_U32(_CommandAddress + 0x1C); u32 BufferOutSize = Memory::Read_U32(_CommandAddress + 0x1C);
// As a safety precaution we fill the out buffer with zeros to avoid // As a safety precaution we fill the out buffer with zeros to avoid
// returning nonsense values // returning nonsense values
Memory::Memset(BufferOut, 0, BufferOutSize); Memory::Memset(BufferOut, 0, BufferOutSize);
u32 ReturnValue = 0; u32 ReturnValue = 0;
switch (Cmd) { switch (Cmd)
{
case IOCTL_WRITEHCR: case IOCTL_WRITEHCR:
{ {
u32 reg = Memory::Read_U32(BufferIn); u32 reg = Memory::Read_U32(BufferIn);
@ -273,8 +274,8 @@ bool CWII_IPC_HLE_Device_sdio_slot0::IOCtlV(u32 _CommandAddress)
} }
u32 CWII_IPC_HLE_Device_sdio_slot0::ExecuteCommand(u32 _BufferIn, u32 _BufferInSize, u32 CWII_IPC_HLE_Device_sdio_slot0::ExecuteCommand(u32 _BufferIn, u32 _BufferInSize,
u32 _rwBuffer, u32 _rwBufferSize, u32 _rwBuffer, u32 _rwBufferSize,
u32 _BufferOut, u32 _BufferOutSize) u32 _BufferOut, u32 _BufferOutSize)
{ {
// The game will send us a SendCMD with this information. To be able to read and write // The game will send us a SendCMD with this information. To be able to read and write
// to a file we need to prepare a 0x10 byte output buffer as response. // to a file we need to prepare a 0x10 byte output buffer as response.
@ -291,14 +292,14 @@ u32 CWII_IPC_HLE_Device_sdio_slot0::ExecuteCommand(u32 _BufferIn, u32 _BufferInS
} req; } req;
req.command = Memory::Read_U32(_BufferIn + 0); req.command = Memory::Read_U32(_BufferIn + 0);
req.type = Memory::Read_U32(_BufferIn + 4); req.type = Memory::Read_U32(_BufferIn + 4);
req.resp = Memory::Read_U32(_BufferIn + 8); req.resp = Memory::Read_U32(_BufferIn + 8);
req.arg = Memory::Read_U32(_BufferIn + 12); req.arg = Memory::Read_U32(_BufferIn + 12);
req.blocks = Memory::Read_U32(_BufferIn + 16); req.blocks = Memory::Read_U32(_BufferIn + 16);
req.bsize = Memory::Read_U32(_BufferIn + 20); req.bsize = Memory::Read_U32(_BufferIn + 20);
req.addr = Memory::Read_U32(_BufferIn + 24); req.addr = Memory::Read_U32(_BufferIn + 24);
req.isDMA = Memory::Read_U32(_BufferIn + 28); req.isDMA = Memory::Read_U32(_BufferIn + 28);
req.pad0 = Memory::Read_U32(_BufferIn + 32); req.pad0 = Memory::Read_U32(_BufferIn + 32);
// Note: req.addr is the virtual address of _rwBuffer // Note: req.addr is the virtual address of _rwBuffer

View File

@ -8,20 +8,20 @@
enum enum
{ {
IOCTL_STM_EVENTHOOK = 0x1000, IOCTL_STM_EVENTHOOK = 0x1000,
IOCTL_STM_GET_IDLEMODE = 0x3001, IOCTL_STM_GET_IDLEMODE = 0x3001,
IOCTL_STM_RELEASE_EH = 0x3002, IOCTL_STM_RELEASE_EH = 0x3002,
IOCTL_STM_HOTRESET = 0x2001, IOCTL_STM_HOTRESET = 0x2001,
IOCTL_STM_HOTRESET_FOR_PD = 0x2002, IOCTL_STM_HOTRESET_FOR_PD = 0x2002,
IOCTL_STM_SHUTDOWN = 0x2003, IOCTL_STM_SHUTDOWN = 0x2003,
IOCTL_STM_IDLE = 0x2004, IOCTL_STM_IDLE = 0x2004,
IOCTL_STM_WAKEUP = 0x2005, IOCTL_STM_WAKEUP = 0x2005,
IOCTL_STM_VIDIMMING = 0x5001, IOCTL_STM_VIDIMMING = 0x5001,
IOCTL_STM_LEDFLASH = 0x6001, IOCTL_STM_LEDFLASH = 0x6001,
IOCTL_STM_LEDMODE = 0x6002, IOCTL_STM_LEDMODE = 0x6002,
IOCTL_STM_READVER = 0x7001, IOCTL_STM_READVER = 0x7001,
IOCTL_STM_READDDRREG = 0x4001, IOCTL_STM_READDDRREG = 0x4001,
IOCTL_STM_READDDRREG2 = 0x4002, IOCTL_STM_READDDRREG2 = 0x4002,
}; };
// The /dev/stm/immediate // The /dev/stm/immediate
@ -55,11 +55,11 @@ public:
virtual bool IOCtl(u32 _CommandAddress) virtual bool IOCtl(u32 _CommandAddress)
{ {
u32 Parameter = Memory::Read_U32(_CommandAddress + 0x0C); u32 Parameter = Memory::Read_U32(_CommandAddress + 0x0C);
u32 BufferIn = Memory::Read_U32(_CommandAddress + 0x10); u32 BufferIn = Memory::Read_U32(_CommandAddress + 0x10);
u32 BufferInSize = Memory::Read_U32(_CommandAddress + 0x14); u32 BufferInSize = Memory::Read_U32(_CommandAddress + 0x14);
u32 BufferOut = Memory::Read_U32(_CommandAddress + 0x18); u32 BufferOut = Memory::Read_U32(_CommandAddress + 0x18);
u32 BufferOutSize = Memory::Read_U32(_CommandAddress + 0x1C); u32 BufferOutSize = Memory::Read_U32(_CommandAddress + 0x1C);
// Prepare the out buffer(s) with zeroes as a safety precaution // Prepare the out buffer(s) with zeroes as a safety precaution
// to avoid returning bad values // to avoid returning bad values
@ -145,11 +145,11 @@ public:
virtual bool IOCtl(u32 _CommandAddress) virtual bool IOCtl(u32 _CommandAddress)
{ {
u32 Parameter = Memory::Read_U32(_CommandAddress + 0x0C); u32 Parameter = Memory::Read_U32(_CommandAddress + 0x0C);
u32 BufferIn = Memory::Read_U32(_CommandAddress + 0x10); u32 BufferIn = Memory::Read_U32(_CommandAddress + 0x10);
u32 BufferInSize = Memory::Read_U32(_CommandAddress + 0x14); u32 BufferInSize = Memory::Read_U32(_CommandAddress + 0x14);
u32 BufferOut = Memory::Read_U32(_CommandAddress + 0x18); u32 BufferOut = Memory::Read_U32(_CommandAddress + 0x18);
u32 BufferOutSize = Memory::Read_U32(_CommandAddress + 0x1C); u32 BufferOutSize = Memory::Read_U32(_CommandAddress + 0x1C);
// Prepare the out buffer(s) with zeros as a safety precaution // Prepare the out buffer(s) with zeros as a safety precaution
// to avoid returning bad values // to avoid returning bad values

View File

@ -177,14 +177,14 @@ bool CWII_IPC_HLE_Device_usb_oh1_57e_305::IOCtlV(u32 _CommandAddress)
case USBV0_IOCTL_CTRLMSG: // HCI command is received from the stack case USBV0_IOCTL_CTRLMSG: // HCI command is received from the stack
{ {
// This is the HCI datapath from CPU to Wiimote, the USB stuff is little endian.. // This is the HCI datapath from CPU to Wiimote, the USB stuff is little endian..
m_CtrlSetup.bRequestType = *( u8*)Memory::GetPointer(CommandBuffer.InBuffer[0].m_Address); m_CtrlSetup.bRequestType = *( u8*)Memory::GetPointer(CommandBuffer.InBuffer[0].m_Address);
m_CtrlSetup.bRequest = *( u8*)Memory::GetPointer(CommandBuffer.InBuffer[1].m_Address); m_CtrlSetup.bRequest = *( u8*)Memory::GetPointer(CommandBuffer.InBuffer[1].m_Address);
m_CtrlSetup.wValue = *(u16*)Memory::GetPointer(CommandBuffer.InBuffer[2].m_Address); m_CtrlSetup.wValue = *(u16*)Memory::GetPointer(CommandBuffer.InBuffer[2].m_Address);
m_CtrlSetup.wIndex = *(u16*)Memory::GetPointer(CommandBuffer.InBuffer[3].m_Address); m_CtrlSetup.wIndex = *(u16*)Memory::GetPointer(CommandBuffer.InBuffer[3].m_Address);
m_CtrlSetup.wLength = *(u16*)Memory::GetPointer(CommandBuffer.InBuffer[4].m_Address); m_CtrlSetup.wLength = *(u16*)Memory::GetPointer(CommandBuffer.InBuffer[4].m_Address);
m_CtrlSetup.m_PayLoadAddr = CommandBuffer.PayloadBuffer[0].m_Address; m_CtrlSetup.m_PayLoadAddr = CommandBuffer.PayloadBuffer[0].m_Address;
m_CtrlSetup.m_PayLoadSize = CommandBuffer.PayloadBuffer[0].m_Size; m_CtrlSetup.m_PayLoadSize = CommandBuffer.PayloadBuffer[0].m_Size;
m_CtrlSetup.m_Address = CommandBuffer.m_Address; m_CtrlSetup.m_Address = CommandBuffer.m_Address;
// check termination // check termination
_dbg_assert_msg_(WII_IPC_WIIMOTE, *(u8*)Memory::GetPointer(CommandBuffer.InBuffer[5].m_Address) == 0, _dbg_assert_msg_(WII_IPC_WIIMOTE, *(u8*)Memory::GetPointer(CommandBuffer.InBuffer[5].m_Address) == 0,
@ -470,7 +470,7 @@ u32 CWII_IPC_HLE_Device_usb_oh1_57e_305::Update()
m_last_ticks = now; m_last_ticks = now;
} }
SendEventNumberOfCompletedPackets(); SendEventNumberOfCompletedPackets();
return packet_transferred; return packet_transferred;
} }
@ -507,8 +507,8 @@ void CWII_IPC_HLE_Device_usb_oh1_57e_305::ACLPool::WriteToEndpoint(CtrlBuffer& e
"queue to %08x", endpoint.m_address); "queue to %08x", endpoint.m_address);
hci_acldata_hdr_t* pHeader = (hci_acldata_hdr_t*)Memory::GetPointer(endpoint.m_buffer); hci_acldata_hdr_t* pHeader = (hci_acldata_hdr_t*)Memory::GetPointer(endpoint.m_buffer);
pHeader->con_handle = HCI_MK_CON_HANDLE(conn_handle, HCI_PACKET_START, HCI_POINT2POINT); pHeader->con_handle = HCI_MK_CON_HANDLE(conn_handle, HCI_PACKET_START, HCI_POINT2POINT);
pHeader->length = size; pHeader->length = size;
// Write the packet to the buffer // Write the packet to the buffer
std::copy(data, data + size, (u8*)pHeader + sizeof(hci_acldata_hdr_t)); std::copy(data, data + size, (u8*)pHeader + sizeof(hci_acldata_hdr_t));
@ -870,12 +870,12 @@ bool CWII_IPC_HLE_Device_usb_oh1_57e_305::SendEventNumberOfCompletedPackets()
INFO_LOG(WII_IPC_WIIMOTE, "Event: SendEventNumberOfCompletedPackets"); INFO_LOG(WII_IPC_WIIMOTE, "Event: SendEventNumberOfCompletedPackets");
hci_event_hdr_t* event_hdr = (hci_event_hdr_t*)Event.m_buffer; hci_event_hdr_t* event_hdr = (hci_event_hdr_t*)Event.m_buffer;
hci_num_compl_pkts_ep* event = (hci_num_compl_pkts_ep*)((u8*)event_hdr + sizeof(hci_event_hdr_t)); hci_num_compl_pkts_ep* event = (hci_num_compl_pkts_ep*)((u8*)event_hdr + sizeof(hci_event_hdr_t));
hci_num_compl_pkts_info* info = (hci_num_compl_pkts_info*)((u8*)event + sizeof(hci_num_compl_pkts_ep)); hci_num_compl_pkts_info* info = (hci_num_compl_pkts_info*)((u8*)event + sizeof(hci_num_compl_pkts_ep));
event_hdr->event = HCI_EVENT_NUM_COMPL_PKTS; event_hdr->event = HCI_EVENT_NUM_COMPL_PKTS;
event_hdr->length = sizeof(hci_num_compl_pkts_ep); event_hdr->length = sizeof(hci_num_compl_pkts_ep);
event->num_con_handles = 0; event->num_con_handles = 0;
u32 acc = 0; u32 acc = 0;
@ -941,10 +941,10 @@ bool CWII_IPC_HLE_Device_usb_oh1_57e_305::SendEventLinkKeyNotification(const u8
INFO_LOG(WII_IPC_WIIMOTE, "Event: SendEventLinkKeyNotification"); INFO_LOG(WII_IPC_WIIMOTE, "Event: SendEventLinkKeyNotification");
// event header // event header
pEventLinkKey->EventType = HCI_EVENT_RETURN_LINK_KEYS; pEventLinkKey->EventType = HCI_EVENT_RETURN_LINK_KEYS;
pEventLinkKey->PayloadLength = payload_length; pEventLinkKey->PayloadLength = payload_length;
// this is really hci_return_link_keys_ep.num_keys // this is really hci_return_link_keys_ep.num_keys
pEventLinkKey->numKeys = num_to_send; pEventLinkKey->numKeys = num_to_send;
// copy infos - this only works correctly if we're meant to start at first device and read all keys // copy infos - this only works correctly if we're meant to start at first device and read all keys
for (int i = 0; i < num_to_send; i++) for (int i = 0; i < num_to_send; i++)

View File

@ -112,8 +112,8 @@ private:
{ {
if (m_address) if (m_address)
{ {
u32 InBufferNum = Memory::Read_U32(m_address + 0x10); u32 InBufferNum = Memory::Read_U32(m_address + 0x10);
u32 BufferVector = Memory::Read_U32(m_address + 0x18); u32 BufferVector = Memory::Read_U32(m_address + 0x18);
m_buffer = Memory::Read_U32( m_buffer = Memory::Read_U32(
BufferVector + InBufferNum * sizeof(SIOCtlVBuffer::SBuffer)); BufferVector + InBufferNum * sizeof(SIOCtlVBuffer::SBuffer));
} }

View File

@ -59,7 +59,7 @@ bool CWII_IPC_HLE_Device_usb_kbd::Write(u32 _CommandAddress)
bool CWII_IPC_HLE_Device_usb_kbd::IOCtl(u32 _CommandAddress) bool CWII_IPC_HLE_Device_usb_kbd::IOCtl(u32 _CommandAddress)
{ {
u32 BufferOut = Memory::Read_U32(_CommandAddress + 0x18); u32 BufferOut = Memory::Read_U32(_CommandAddress + 0x18);
if (SConfig::GetInstance().m_WiiKeyboard && !m_MessageQueue.empty()) if (SConfig::GetInstance().m_WiiKeyboard && !m_MessageQueue.empty())
{ {

View File

@ -591,7 +591,8 @@ void CWII_IPC_HLE_WiiMote::SendConfigurationRequest(u16 scid, u16 MTU, u16 Flush
l2cap_cfg_req_cp* cr = (l2cap_cfg_req_cp*)&Buffer[Offset]; l2cap_cfg_req_cp* cr = (l2cap_cfg_req_cp*)&Buffer[Offset];
cr->dcid = rChannel.DCID; cr->dcid = rChannel.DCID;
cr->flags = 0; Offset += sizeof(l2cap_cfg_req_cp); cr->flags = 0;
Offset += sizeof(l2cap_cfg_req_cp);
INFO_LOG(WII_IPC_WIIMOTE, "[L2CAP] SendConfigurationRequest"); INFO_LOG(WII_IPC_WIIMOTE, "[L2CAP] SendConfigurationRequest");
DEBUG_LOG(WII_IPC_WIIMOTE, " Dcid: 0x%04x", cr->dcid); DEBUG_LOG(WII_IPC_WIIMOTE, " Dcid: 0x%04x", cr->dcid);
@ -607,10 +608,10 @@ void CWII_IPC_HLE_WiiMote::SendConfigurationRequest(u16 scid, u16 MTU, u16 Flush
{ {
if (MTU == 0) if (MTU == 0)
MTU = rChannel.MTU; MTU = rChannel.MTU;
pOptions = (l2cap_cfg_opt_t*)&Buffer[Offset]; Offset += sizeof(l2cap_cfg_opt_t); pOptions = (l2cap_cfg_opt_t*)&Buffer[Offset]; Offset += sizeof(l2cap_cfg_opt_t);
pOptions->type = L2CAP_OPT_MTU; pOptions->type = L2CAP_OPT_MTU;
pOptions->length = L2CAP_OPT_MTU_SIZE; pOptions->length = L2CAP_OPT_MTU_SIZE;
*(u16*)&Buffer[Offset] = MTU; Offset += L2CAP_OPT_MTU_SIZE; *(u16*)&Buffer[Offset] = MTU; Offset += L2CAP_OPT_MTU_SIZE;
DEBUG_LOG(WII_IPC_WIIMOTE, " MTU: 0x%04x", MTU); DEBUG_LOG(WII_IPC_WIIMOTE, " MTU: 0x%04x", MTU);
} }
@ -618,10 +619,10 @@ void CWII_IPC_HLE_WiiMote::SendConfigurationRequest(u16 scid, u16 MTU, u16 Flush
{ {
if (FlushTimeOut == 0) if (FlushTimeOut == 0)
FlushTimeOut = rChannel.FlushTimeOut; FlushTimeOut = rChannel.FlushTimeOut;
pOptions = (l2cap_cfg_opt_t*)&Buffer[Offset]; Offset += sizeof(l2cap_cfg_opt_t); pOptions = (l2cap_cfg_opt_t*)&Buffer[Offset]; Offset += sizeof(l2cap_cfg_opt_t);
pOptions->type = L2CAP_OPT_FLUSH_TIMO; pOptions->type = L2CAP_OPT_FLUSH_TIMO;
pOptions->length = L2CAP_OPT_FLUSH_TIMO_SIZE; pOptions->length = L2CAP_OPT_FLUSH_TIMO_SIZE;
*(u16*)&Buffer[Offset] = FlushTimeOut; Offset += L2CAP_OPT_FLUSH_TIMO_SIZE; *(u16*)&Buffer[Offset] = FlushTimeOut; Offset += L2CAP_OPT_FLUSH_TIMO_SIZE;
DEBUG_LOG(WII_IPC_WIIMOTE, " FlushTimeOut: 0x%04x", FlushTimeOut); DEBUG_LOG(WII_IPC_WIIMOTE, " FlushTimeOut: 0x%04x", FlushTimeOut);
} }
@ -640,11 +641,11 @@ void CWII_IPC_HLE_WiiMote::SendConfigurationRequest(u16 scid, u16 MTU, u16 Flush
// //
// //
#define SDP_UINT8 0x08 #define SDP_UINT8 0x08
#define SDP_UINT16 0x09 #define SDP_UINT16 0x09
#define SDP_UINT32 0x0A #define SDP_UINT32 0x0A
#define SDP_SEQ8 0x35 #define SDP_SEQ8 0x35
#define SDP_SEQ16 0x36 #define SDP_SEQ16 0x36
void CWII_IPC_HLE_WiiMote::SDPSendServiceSearchResponse(u16 cid, u16 TransactionID, u8* pServiceSearchPattern, u16 MaximumServiceRecordCount) void CWII_IPC_HLE_WiiMote::SDPSendServiceSearchResponse(u16 cid, u16 TransactionID, u8* pServiceSearchPattern, u16 MaximumServiceRecordCount)
{ {
@ -666,13 +667,13 @@ void CWII_IPC_HLE_WiiMote::SDPSendServiceSearchResponse(u16 cid, u16 Transaction
l2cap_hdr_t* pHeader = (l2cap_hdr_t*)&DataFrame[Offset]; Offset += sizeof(l2cap_hdr_t); l2cap_hdr_t* pHeader = (l2cap_hdr_t*)&DataFrame[Offset]; Offset += sizeof(l2cap_hdr_t);
pHeader->dcid = cid; pHeader->dcid = cid;
buffer.Write8 (Offset, 0x03); Offset++; buffer.Write8 (Offset, 0x03); Offset++;
buffer.Write16(Offset, TransactionID); Offset += 2; // transaction ID buffer.Write16(Offset, TransactionID); Offset += 2; // Transaction ID
buffer.Write16(Offset, 0x0009); Offset += 2; // param length buffer.Write16(Offset, 0x0009); Offset += 2; // Param length
buffer.Write16(Offset, 0x0001); Offset += 2; // TotalServiceRecordCount buffer.Write16(Offset, 0x0001); Offset += 2; // TotalServiceRecordCount
buffer.Write16(Offset, 0x0001); Offset += 2; // CurrentServiceRecordCount buffer.Write16(Offset, 0x0001); Offset += 2; // CurrentServiceRecordCount
buffer.Write32(Offset, 0x10000); Offset += 4; // ServiceRecordHandleList[4] buffer.Write32(Offset, 0x10000); Offset += 4; // ServiceRecordHandleList[4]
buffer.Write8(Offset, 0x00); Offset++; // no continuation state; buffer.Write8(Offset, 0x00); Offset++; // No continuation state;
pHeader->length = (u16)(Offset - sizeof(l2cap_hdr_t)); pHeader->length = (u16)(Offset - sizeof(l2cap_hdr_t));
@ -683,7 +684,7 @@ static u32 ParseCont(u8* pCont)
{ {
u32 attribOffset = 0; u32 attribOffset = 0;
CBigEndianBuffer attribList(pCont); CBigEndianBuffer attribList(pCont);
u8 typeID = attribList.Read8(attribOffset); attribOffset++; u8 typeID = attribList.Read8(attribOffset); attribOffset++;
if (typeID == 0x02) if (typeID == 0x02)
{ {
@ -704,9 +705,9 @@ int ParseAttribList(u8* pAttribIDList, u16& _startID, u16& _endID)
u32 attribOffset = 0; u32 attribOffset = 0;
CBigEndianBuffer attribList(pAttribIDList); CBigEndianBuffer attribList(pAttribIDList);
u8 sequence = attribList.Read8(attribOffset); attribOffset++; u8 sequence = attribList.Read8(attribOffset); attribOffset++;
u8 seqSize = attribList.Read8(attribOffset); attribOffset++; u8 seqSize = attribList.Read8(attribOffset); attribOffset++;
u8 typeID = attribList.Read8(attribOffset); attribOffset++; u8 typeID = attribList.Read8(attribOffset); attribOffset++;
#if MAX_LOGLEVEL >= DEBUG_LEVEL #if MAX_LOGLEVEL >= DEBUG_LEVEL
_dbg_assert_(WII_IPC_WIIMOTE, sequence == SDP_SEQ8); _dbg_assert_(WII_IPC_WIIMOTE, sequence == SDP_SEQ8);
@ -717,12 +718,12 @@ int ParseAttribList(u8* pAttribIDList, u16& _startID, u16& _endID)
if (typeID == SDP_UINT32) if (typeID == SDP_UINT32)
{ {
_startID = attribList.Read16(attribOffset); attribOffset += 2; _startID = attribList.Read16(attribOffset); attribOffset += 2;
_endID = attribList.Read16(attribOffset); attribOffset += 2; _endID = attribList.Read16(attribOffset); attribOffset += 2;
} }
else else
{ {
_startID = attribList.Read16(attribOffset); attribOffset += 2; _startID = attribList.Read16(attribOffset); attribOffset += 2;
_endID = _startID; _endID = _startID;
DEBUG_LOG(WII_IPC_WIIMOTE, "Read just a single attrib - not tested"); DEBUG_LOG(WII_IPC_WIIMOTE, "Read just a single attrib - not tested");
PanicAlert("Read just a single attrib - not tested"); PanicAlert("Read just a single attrib - not tested");
@ -755,13 +756,13 @@ void CWII_IPC_HLE_WiiMote::SDPSendServiceAttributeResponse(u16 cid, u16 Transact
CBigEndianBuffer buffer(DataFrame); CBigEndianBuffer buffer(DataFrame);
int Offset = 0; int Offset = 0;
l2cap_hdr_t* pHeader = (l2cap_hdr_t*)&DataFrame[Offset]; Offset += sizeof(l2cap_hdr_t); l2cap_hdr_t* pHeader = (l2cap_hdr_t*)&DataFrame[Offset]; Offset += sizeof(l2cap_hdr_t);
pHeader->dcid = cid; pHeader->dcid = cid;
buffer.Write8 (Offset, 0x05); Offset++; buffer.Write8 (Offset, 0x05); Offset++;
buffer.Write16(Offset, TransactionID); Offset += 2; // transaction ID buffer.Write16(Offset, TransactionID); Offset += 2; // Transaction ID
memcpy(buffer.GetPointer(Offset), pPacket, packetSize); Offset += packetSize; memcpy(buffer.GetPointer(Offset), pPacket, packetSize); Offset += packetSize;
pHeader->length = (u16)(Offset - sizeof(l2cap_hdr_t)); pHeader->length = (u16)(Offset - sizeof(l2cap_hdr_t));
m_pHost->SendACLPacket(GetConnectionHandle(), DataFrame, pHeader->length + sizeof(l2cap_hdr_t)); m_pHost->SendACLPacket(GetConnectionHandle(), DataFrame, pHeader->length + sizeof(l2cap_hdr_t));

View File

@ -19,15 +19,15 @@ class CBigEndianBuffer
public: public:
CBigEndianBuffer(u8* pBuffer) : m_pBuffer(pBuffer) {} CBigEndianBuffer(u8* pBuffer) : m_pBuffer(pBuffer) {}
u8 Read8(u32 offset) { return m_pBuffer[offset]; } u8 Read8(u32 offset) { return m_pBuffer[offset]; }
u16 Read16(u32 offset) { return Common::swap16(*(u16*)&m_pBuffer[offset]); } u16 Read16(u32 offset) { return Common::swap16(*(u16*)&m_pBuffer[offset]); }
u32 Read32(u32 offset) { return Common::swap32(*(u32*)&m_pBuffer[offset]); } u32 Read32(u32 offset) { return Common::swap32(*(u32*)&m_pBuffer[offset]); }
void Write8(u32 offset, u8 data) { m_pBuffer[offset] = data; } void Write8(u32 offset, u8 data) { m_pBuffer[offset] = data; }
void Write16(u32 offset, u16 data) { *(u16*)&m_pBuffer[offset] = Common::swap16(data); } void Write16(u32 offset, u16 data) { *(u16*)&m_pBuffer[offset] = Common::swap16(data); }
void Write32(u32 offset, u32 data) { *(u32*)&m_pBuffer[offset] = Common::swap32(data); } void Write32(u32 offset, u32 data) { *(u32*)&m_pBuffer[offset] = Common::swap32(data); }
u8* GetPointer(u32 offset) { return &m_pBuffer[offset]; } u8* GetPointer(u32 offset) { return &m_pBuffer[offset]; }
private: private:
u8* m_pBuffer; u8* m_pBuffer;
@ -73,7 +73,7 @@ public:
private: private:
enum ConnectionState enum ConnectionState
{ {
CONN_INACTIVE = -1, CONN_INACTIVE = -1,
CONN_READY, CONN_READY,
CONN_LINKING, CONN_LINKING,
CONN_COMPLETE CONN_COMPLETE

View File

@ -150,9 +150,9 @@ s32 WiiSocket::closeFd()
s32 WiiSocket::_fcntl(u32 cmd, u32 arg) s32 WiiSocket::_fcntl(u32 cmd, u32 arg)
{ {
#define F_GETFL 3 #define F_GETFL 3
#define F_SETFL 4 #define F_SETFL 4
#define F_NONBLOCK 4 #define F_NONBLOCK 4
s32 ret = 0; s32 ret = 0;
if (cmd == F_GETFL) if (cmd == F_GETFL)
{ {
@ -490,7 +490,6 @@ void WiiSocket::update(bool read, bool write, bool except)
BufferOutSize2 ? &addrlen : 0); BufferOutSize2 ? &addrlen : 0);
ReturnValue = WiiSockMan::getNetErrorCode(ret, BufferOutSize2 ? "SO_RECVFROM" : "SO_RECV", true); ReturnValue = WiiSockMan::getNetErrorCode(ret, BufferOutSize2 ? "SO_RECVFROM" : "SO_RECV", true);
INFO_LOG(WII_IPC_NET, "%s(%d, %p) Socket: %08X, Flags: %08X, " INFO_LOG(WII_IPC_NET, "%s(%d, %p) Socket: %08X, Flags: %08X, "
"BufferIn: (%08x, %i), BufferIn2: (%08x, %i), " "BufferIn: (%08x, %i), BufferIn2: (%08x, %i), "
"BufferOut: (%08x, %i), BufferOut2: (%08x, %i)", "BufferOut: (%08x, %i), BufferOut2: (%08x, %i)",
@ -510,7 +509,6 @@ void WiiSocket::update(bool read, bool write, bool except)
break; break;
} }
} }
} }
if ( nonBlock || forceNonBlock if ( nonBlock || forceNonBlock

View File

@ -9,37 +9,56 @@
#if 0 #if 0
// 0x00 (checked) // 0x00 (checked)
u8 ServiceRecordHandle[] = { 0x0a, 0x00, 0x01, 0x00, 0x00 }; u8 ServiceRecordHandle[] = { 0x0a, 0x00, 0x01, 0x00, 0x00 };
// 0x01 (checked) // 0x01 (checked)
u8 SrvClassIDList[] = { 0x35, 0x03, u8 SrvClassIDList[] = {
0x19, 0x11, 0x24 }; 0x35, 0x03,
0x19, 0x11, 0x24
};
// 0x04 (checked) // 0x04 (checked)
u8 ProtocolDescriptorList[] = { 0x35, 0x0D, u8 ProtocolDescriptorList[] = {
0x35, 0x06, 0x35, 0x0D,
0x19, 0x01, 0x00, // Element 0 0x35, 0x06,
0x09, 0x00, 0x11, // Element 1 0x19, 0x01, 0x00, // Element 0
0x35, 0x03, 0x09, 0x00, 0x11, // Element 1
0x19, 0x00, 0x11}; // Element 0 0x35, 0x03,
0x19, 0x00, 0x11 // Element 0
};
// 0x5 (checked) // 0x5 (checked)
u8 BrowseGroupList[] = { 0x35, 0x03, u8 BrowseGroupList[] = {
0x19, 0x10, 0x02 }; 0x35, 0x03,
0x19, 0x10, 0x02
};
// 0x6 (checked) // 0x6 (checked)
u8 LanguageBaseAttributeIDList[] = { 0x35, 0x09, u8 LanguageBaseAttributeIDList[] = {
0x09, 0x65, 0x6e, 0x35, 0x09,
0x09, 0x00, 0x6a, 0x09, 0x65, 0x6e,
0x09, 0x01, 0x00 }; 0x09, 0x00, 0x6a,
0x09, 0x01, 0x00
};
// 0x09 (checked) // 0x09 (checked)
u8 BluetoothProfileDescriptorList[] = { 0x35, 0x08, u8 BluetoothProfileDescriptorList[] = {
0x35, 0x06, 0x35, 0x08,
0x19, 0x11, 0x24, 0x35, 0x06,
0x09, 0x01, 0x00 }; 0x19, 0x11, 0x24,
0x09, 0x01, 0x00
};
// 0x0D (checked) // 0x0D (checked)
u8 AdditionalProtocolDescriptorLists[] = { 0x35, 0x0F, u8 AdditionalProtocolDescriptorLists[] = {
0x35, 0x0D, 0x35, 0x0F,
0x35, 0x06, 0x35, 0x0D,
0x19, 0x01, 0x00, 0x35, 0x06,
0x09, 0x00, 0x13, 0x19, 0x01, 0x00,
0x35, 0x03, 0x09, 0x00, 0x13,
0x19, 0x00, 0x11 }; 0x35, 0x03,
0x19, 0x00, 0x11
};
// 0x100 // 0x100
u8 ServiceName[] = { 0x25, 0x13, 'N','i','n','t','e','n','d','o',' ','R','V','L','-','C','N','T','-','0','1' }; u8 ServiceName[] = { 0x25, 0x13, 'N','i','n','t','e','n','d','o',' ','R','V','L','-','C','N','T','-','0','1' };
// 0x101 // 0x101
@ -61,47 +80,50 @@ u8 HIDVirtualCable[] = { 0x09, 0x00, 0x00 };
u8 HIDReconnectInitiate[] = { 0x09, 0x00, 0x01 }; u8 HIDReconnectInitiate[] = { 0x09, 0x00, 0x01 };
// 0x206 // 0x206
u8 HIDDescriptorList[] = { 0x35, 0xDF, u8 HIDDescriptorList[] = {
0x35, 0xDD, 0x35, 0xDF,
0x08, 0x22, // Element 0 0x35, 0xDD,
0x25, 0xD9, // hmm... <- 0x25 is a string but there is Data 0x08, 0x22, // Element 0
0x25, 0xD9, // hmm... <- 0x25 is a string but there is Data
// 0xD9 Bytes - Element 1
0x05, 0x01, 0x09, 0x05, 0xa1, 0x01, 0x85, 0x10,
0x15, 0x00, 0x26, 0xff, 0x00, 0x75, 0x08, 0x95,
0x01, 0x06, 0x00, 0xff, 0x09, 0x01, 0x91, 0x00,
0x85, 0x11, 0x95, 0x01, 0x09, 0x01, 0x91, 0x00,
0x85, 0x12, 0x95, 0x02, 0x09, 0x01, 0x91, 0x00,
0x85, 0x13, 0x95, 0x01, 0x09, 0x01, 0x91, 0x00,
0x85, 0x14, 0x95, 0x01, 0x09, 0x01, 0x91, 0x00,
0x85, 0x15, 0x95, 0x01, 0x09, 0x01, 0x91, 0x00,
0x85, 0x16, 0x95, 0x15, 0x09, 0x01, 0x91, 0x00,
0x85, 0x17, 0x95, 0x06, 0x09, 0x01, 0x91, 0x00,
0x85, 0x18, 0x95, 0x15, 0x09, 0x01, 0x91, 0x00,
0x85, 0x19, 0x95, 0x01, 0x09, 0x01, 0x91, 0x00,
0x85, 0x1a, 0x95, 0x01, 0x09, 0x01, 0x91, 0x00,
0x85, 0x20, 0x95, 0x06, 0x09, 0x01, 0x81, 0x00,
0x85, 0x21, 0x95, 0x15, 0x09, 0x01, 0x81, 0x00,
0x85, 0x22, 0x95, 0x04, 0x09, 0x01, 0x81, 0x00,
0x85, 0x30, 0x95, 0x02, 0x09, 0x01, 0x81, 0x00,
0x85, 0x31, 0x95, 0x05, 0x09, 0x01, 0x81, 0x00,
0x85, 0x32, 0x95, 0x0a, 0x09, 0x01, 0x81, 0x00,
0x85, 0x33, 0x95, 0x11, 0x09, 0x01, 0x81, 0x00,
0x85, 0x34, 0x95, 0x15, 0x09, 0x01, 0x81, 0x00,
0x85, 0x35, 0x95, 0x15, 0x09, 0x01, 0x81, 0x00,
0x85, 0x36, 0x95, 0x15, 0x09, 0x01, 0x81, 0x00,
0x85, 0x37, 0x95, 0x15, 0x09, 0x01, 0x81, 0x00,
0x85, 0x3d, 0x95, 0x15, 0x09, 0x01, 0x81, 0x00,
0x85, 0x3e, 0x95, 0x15, 0x09, 0x01, 0x81, 0x00,
0x85, 0x3f, 0x95, 0x15, 0x09, 0x01, 0x81, 0x00,
0xc0 }; // end tag
// 0xD9 Bytes - Element 1
0x05, 0x01, 0x09, 0x05, 0xa1, 0x01, 0x85, 0x10,
0x15, 0x00, 0x26, 0xff, 0x00, 0x75, 0x08, 0x95,
0x01, 0x06, 0x00, 0xff, 0x09, 0x01, 0x91, 0x00,
0x85, 0x11, 0x95, 0x01, 0x09, 0x01, 0x91, 0x00,
0x85, 0x12, 0x95, 0x02, 0x09, 0x01, 0x91, 0x00,
0x85, 0x13, 0x95, 0x01, 0x09, 0x01, 0x91, 0x00,
0x85, 0x14, 0x95, 0x01, 0x09, 0x01, 0x91, 0x00,
0x85, 0x15, 0x95, 0x01, 0x09, 0x01, 0x91, 0x00,
0x85, 0x16, 0x95, 0x15, 0x09, 0x01, 0x91, 0x00,
0x85, 0x17, 0x95, 0x06, 0x09, 0x01, 0x91, 0x00,
0x85, 0x18, 0x95, 0x15, 0x09, 0x01, 0x91, 0x00,
0x85, 0x19, 0x95, 0x01, 0x09, 0x01, 0x91, 0x00,
0x85, 0x1a, 0x95, 0x01, 0x09, 0x01, 0x91, 0x00,
0x85, 0x20, 0x95, 0x06, 0x09, 0x01, 0x81, 0x00,
0x85, 0x21, 0x95, 0x15, 0x09, 0x01, 0x81, 0x00,
0x85, 0x22, 0x95, 0x04, 0x09, 0x01, 0x81, 0x00,
0x85, 0x30, 0x95, 0x02, 0x09, 0x01, 0x81, 0x00,
0x85, 0x31, 0x95, 0x05, 0x09, 0x01, 0x81, 0x00,
0x85, 0x32, 0x95, 0x0a, 0x09, 0x01, 0x81, 0x00,
0x85, 0x33, 0x95, 0x11, 0x09, 0x01, 0x81, 0x00,
0x85, 0x34, 0x95, 0x15, 0x09, 0x01, 0x81, 0x00,
0x85, 0x35, 0x95, 0x15, 0x09, 0x01, 0x81, 0x00,
0x85, 0x36, 0x95, 0x15, 0x09, 0x01, 0x81, 0x00,
0x85, 0x37, 0x95, 0x15, 0x09, 0x01, 0x81, 0x00,
0x85, 0x3d, 0x95, 0x15, 0x09, 0x01, 0x81, 0x00,
0x85, 0x3e, 0x95, 0x15, 0x09, 0x01, 0x81, 0x00,
0x85, 0x3f, 0x95, 0x15, 0x09, 0x01, 0x81, 0x00,
0xc0 // end tag
};
// 0x207 // 0x207
u8 HIDLANGIDBaseList[] = { 0x35, 0x08, u8 HIDLANGIDBaseList[] = {
0x35, 0x06, 0x35, 0x08,
0x09, 0x04, 0x09, 0x35, 0x06,
0x09, 0x01, 0x00 }; 0x09, 0x04, 0x09,
0x09, 0x01, 0x00
};
// 0x208 // 0x208
u8 HIDSDPDisable[] = { 0x28, 0x00 }; u8 HIDSDPDisable[] = { 0x28, 0x00 };
@ -143,7 +165,6 @@ static u8 packet2[] = {
}; };
static u8 packet3[] = { static u8 packet3[] = {
0x00, 0x7b, 0x00, 0x76, 0x85, 0x13, 0x95, 0x01, 0x09, 0x01, 0x91, 0x00, 0x85, 0x00, 0x7b, 0x00, 0x76, 0x85, 0x13, 0x95, 0x01, 0x09, 0x01, 0x91, 0x00, 0x85,
0x14, 0x95, 0x01, 0x09, 0x01, 0x91, 0x00, 0x85, 0x15, 0x95, 0x01, 0x09, 0x01, 0x91, 0x00, 0x85, 0x14, 0x95, 0x01, 0x09, 0x01, 0x91, 0x00, 0x85, 0x15, 0x95, 0x01, 0x09, 0x01, 0x91, 0x00, 0x85,
0x16, 0x95, 0x15, 0x09, 0x01, 0x91, 0x00, 0x85, 0x17, 0x95, 0x06, 0x09, 0x01, 0x91, 0x00, 0x85, 0x16, 0x95, 0x15, 0x09, 0x01, 0x91, 0x00, 0x85, 0x17, 0x95, 0x06, 0x09, 0x01, 0x91, 0x00, 0x85,

View File

@ -605,14 +605,14 @@ void SetWiiInputDisplayString(int remoteID, u8* const coreData, u8* const accelD
void CheckPadStatus(SPADStatus *PadStatus, int controllerID) void CheckPadStatus(SPADStatus *PadStatus, int controllerID)
{ {
g_padState.A = ((PadStatus->button & PAD_BUTTON_A) != 0); g_padState.A = ((PadStatus->button & PAD_BUTTON_A) != 0);
g_padState.B = ((PadStatus->button & PAD_BUTTON_B) != 0); g_padState.B = ((PadStatus->button & PAD_BUTTON_B) != 0);
g_padState.X = ((PadStatus->button & PAD_BUTTON_X) != 0); g_padState.X = ((PadStatus->button & PAD_BUTTON_X) != 0);
g_padState.Y = ((PadStatus->button & PAD_BUTTON_Y) != 0); g_padState.Y = ((PadStatus->button & PAD_BUTTON_Y) != 0);
g_padState.Z = ((PadStatus->button & PAD_TRIGGER_Z) != 0); g_padState.Z = ((PadStatus->button & PAD_TRIGGER_Z) != 0);
g_padState.Start = ((PadStatus->button & PAD_BUTTON_START) != 0); g_padState.Start = ((PadStatus->button & PAD_BUTTON_START) != 0);
g_padState.DPadUp = ((PadStatus->button & PAD_BUTTON_UP) != 0); g_padState.DPadUp = ((PadStatus->button & PAD_BUTTON_UP) != 0);
g_padState.DPadDown = ((PadStatus->button & PAD_BUTTON_DOWN) != 0); g_padState.DPadDown = ((PadStatus->button & PAD_BUTTON_DOWN) != 0);
g_padState.DPadLeft = ((PadStatus->button & PAD_BUTTON_LEFT) != 0); g_padState.DPadLeft = ((PadStatus->button & PAD_BUTTON_LEFT) != 0);
g_padState.DPadRight = ((PadStatus->button & PAD_BUTTON_RIGHT) != 0); g_padState.DPadRight = ((PadStatus->button & PAD_BUTTON_RIGHT) != 0);

View File

@ -25,7 +25,7 @@ std::mutex crit_netplay_client;
static NetPlayClient * netplay_client = NULL; static NetPlayClient * netplay_client = NULL;
NetSettings g_NetPlaySettings; NetSettings g_NetPlaySettings;
#define RPT_SIZE_HACK (1 << 16) #define RPT_SIZE_HACK (1 << 16)
NetPad::NetPad() NetPad::NetPad()
{ {

View File

@ -51,10 +51,10 @@ public:
class Player class Player
{ {
public: public:
PlayerId pid; PlayerId pid;
std::string name; std::string name;
std::string revision; std::string revision;
u32 ping; u32 ping;
}; };
class NetPlayClient class NetPlayClient

View File

@ -51,11 +51,11 @@ private:
class Client class Client
{ {
public: public:
PlayerId pid; PlayerId pid;
std::string name; std::string name;
std::string revision; std::string revision;
sf::SocketTCP socket; sf::SocketTCP socket;
u32 ping; u32 ping;
u32 current_game; u32 current_game;
}; };

View File

@ -36,13 +36,13 @@
#include "Host.h" #include "Host.h"
#define GDB_BFR_MAX 10000 #define GDB_BFR_MAX 10000
#define GDB_MAX_BP 10 #define GDB_MAX_BP 10
#define GDB_STUB_START '$' #define GDB_STUB_START '$'
#define GDB_STUB_END '#' #define GDB_STUB_END '#'
#define GDB_STUB_ACK '+' #define GDB_STUB_ACK '+'
#define GDB_STUB_NAK '-' #define GDB_STUB_NAK '-'
static int tmpsock = -1; static int tmpsock = -1;

View File

@ -14,8 +14,8 @@
#include "../HW/Memmap.h" #include "../HW/Memmap.h"
#ifdef _WIN32 #ifdef _WIN32
#define SIGTRAP 5 #define SIGTRAP 5
#define SIGTERM 15 #define SIGTERM 15
#define MSG_WAITALL 8 #define MSG_WAITALL 8
#endif #endif

View File

@ -121,8 +121,8 @@ bool CFileSystemGCWii::ExportFile(const char* _rFullPath, const char* _rExportFi
bool CFileSystemGCWii::ExportApploader(const char* _rExportFolder) const bool CFileSystemGCWii::ExportApploader(const char* _rExportFolder) const
{ {
u32 AppSize = Read32(0x2440 + 0x14);// apploader size u32 AppSize = Read32(0x2440 + 0x14);// apploader size
AppSize += Read32(0x2440 + 0x18); // + trailer size AppSize += Read32(0x2440 + 0x18); // + trailer size
AppSize += 0x20; // + header size AppSize += 0x20; // + header size
DEBUG_LOG(DISCIO,"AppSize -> %x", AppSize); DEBUG_LOG(DISCIO,"AppSize -> %x", AppSize);
std::vector<u8> buffer(AppSize); std::vector<u8> buffer(AppSize);
@ -150,8 +150,8 @@ u32 CFileSystemGCWii::GetBootDOLSize() const
// Iterate through the 7 code segments // Iterate through the 7 code segments
for (u8 i = 0; i < 7; i++) for (u8 i = 0; i < 7; i++)
{ {
offset = Read32(DolOffset + 0x00 + i * 4); offset = Read32(DolOffset + 0x00 + i * 4);
size = Read32(DolOffset + 0x90 + i * 4); size = Read32(DolOffset + 0x90 + i * 4);
if (offset + size > DolSize) if (offset + size > DolSize)
DolSize = offset + size; DolSize = offset + size;
} }
@ -159,8 +159,8 @@ u32 CFileSystemGCWii::GetBootDOLSize() const
// Iterate through the 11 data segments // Iterate through the 11 data segments
for (u8 i = 0; i < 11; i++) for (u8 i = 0; i < 11; i++)
{ {
offset = Read32(DolOffset + 0x1c + i * 4); offset = Read32(DolOffset + 0x1c + i * 4);
size = Read32(DolOffset + 0xac + i * 4); size = Read32(DolOffset + 0xac + i * 4);
if (offset + size > DolSize) if (offset + size > DolSize)
DolSize = offset + size; DolSize = offset + size;
} }

View File

@ -79,19 +79,19 @@ u8 GetSysMenuRegion(u16 _TitleVersion)
{ {
switch(_TitleVersion) switch(_TitleVersion)
{ {
case 128: case 192: case 224: case 256: case 128: case 192: case 224: case 256:
case 288: case 352: case 384: case 416: case 288: case 352: case 384: case 416:
case 448: case 480: case 512: case 448: case 480: case 512:
return 'J'; return 'J';
case 97: case 193: case 225: case 257: case 97: case 193: case 225: case 257:
case 289: case 353: case 385: case 417: case 289: case 353: case 385: case 417:
case 449: case 481: case 513: case 449: case 481: case 513:
return 'E'; return 'E';
case 130: case 162: case 194: case 226: case 130: case 162: case 194: case 226:
case 258: case 290: case 354: case 386: case 258: case 290: case 354: case 386:
case 418: case 450: case 482: case 514: case 418: case 450: case 482: case 514:
return 'P'; return 'P';
case 326: case 390: case 454: case 486: case 326: case 390: case 454: case 486:
case 518: case 518:
return 'K'; return 'K';
default: default:

View File

@ -356,9 +356,9 @@ void CVolumeDirectory::BuildFST()
m_dataStartAddress = ROUND_UP(FST_ADDRESS + m_fstSize, 0x8000ull); m_dataStartAddress = ROUND_UP(FST_ADDRESS + m_fstSize, 0x8000ull);
u64 curDataAddress = m_dataStartAddress; u64 curDataAddress = m_dataStartAddress;
u32 fstOffset = 0; // offset within FST data u32 fstOffset = 0; // Offset within FST data
u32 nameOffset = 0; // offset within name table u32 nameOffset = 0; // Offset within name table
u32 rootOffset = 0; // offset of root of FST u32 rootOffset = 0; // Offset of root of FST
// write root entry // write root entry
WriteEntryData(fstOffset, DIRECTORY_ENTRY, 0, 0, totalEntries); WriteEntryData(fstOffset, DIRECTORY_ENTRY, 0, 0, totalEntries);

View File

@ -25,8 +25,8 @@ public:
std::string GetUniqueID() const; std::string GetUniqueID() const;
std::string GetMakerID() const; std::string GetMakerID() const;
std::vector<std::string> GetNames() const; std::vector<std::string> GetNames() const;
u32 GetFSTSize() const { return 0; } u32 GetFSTSize() const { return 0; }
std::string GetApploaderDate() const { return "0"; } std::string GetApploaderDate() const { return "0"; }
ECountry GetCountry() const; ECountry GetCountry() const;
u64 GetSize() const; u64 GetSize() const;
u64 GetRawSize() const; u64 GetRawSize() const;

View File

@ -82,7 +82,7 @@ bool CVolumeWiiCrypted::Read(u64 _ReadOffset, u64 _Length, u8* _pBuffer) const
// increase buffers // increase buffers
_Length -= CopySize; _Length -= CopySize;
_pBuffer += CopySize; _pBuffer += CopySize;
_ReadOffset += CopySize; _ReadOffset += CopySize;
} }

View File

@ -187,10 +187,10 @@ bool IsWbfsBlob(const char* filename)
u8 magic[4] = {0, 0, 0, 0}; u8 magic[4] = {0, 0, 0, 0};
f.ReadBytes(&magic, 4); f.ReadBytes(&magic, 4);
return (magic[0] == 'W') && return (magic[0] == 'W') &&
(magic[1] == 'B') && (magic[1] == 'B') &&
(magic[2] == 'F') && (magic[2] == 'F') &&
(magic[3] == 'S'); (magic[3] == 'S');
} }
} // namespace } // namespace

View File

@ -23,10 +23,11 @@ private:
Key(IOHIDElementRef element, IOHIDDeviceRef device); Key(IOHIDElementRef element, IOHIDDeviceRef device);
ControlState GetState() const; ControlState GetState() const;
private: private:
const IOHIDElementRef m_element; const IOHIDElementRef m_element;
const IOHIDDeviceRef m_device; const IOHIDDeviceRef m_device;
std::string m_name; std::string m_name;
}; };
class Cursor : public Input class Cursor : public Input
{ {
public: public:
@ -36,9 +37,10 @@ private:
ControlState GetState() const; ControlState GetState() const;
private: private:
const float& m_axis; const float& m_axis;
const u8 m_index; const u8 m_index;
const bool m_positive; const bool m_positive;
}; };
class Button : public Input class Button : public Input
{ {
public: public:
@ -66,11 +68,11 @@ private:
float x, y; float x, y;
} m_cursor; } m_cursor;
const IOHIDDeviceRef m_device; const IOHIDDeviceRef m_device;
const std::string m_device_name; const std::string m_device_name;
int m_index; int m_index;
uint32_t m_windowid; uint32_t m_windowid;
unsigned char m_mousebuttons[3]; unsigned char m_mousebuttons[3];
}; };
} }

View File

@ -117,8 +117,8 @@ Keyboard::Key::Key(IOHIDElementRef element, IOHIDDeviceRef device)
, m_device(device) , m_device(device)
{ {
static const struct PrettyKeys { static const struct PrettyKeys {
const uint32_t code; const uint32_t code;
const char *const name; const char *const name;
} named_keys[] = { } named_keys[] = {
{ kHIDUsage_KeyboardA, "A" }, { kHIDUsage_KeyboardA, "A" },
{ kHIDUsage_KeyboardB, "B" }, { kHIDUsage_KeyboardB, "B" },

View File

@ -319,29 +319,29 @@ bool Joystick::UpdateOutput()
#ifdef USE_SDL_HAPTIC #ifdef USE_SDL_HAPTIC
for (auto &i : m_state_out) for (auto &i : m_state_out)
{ {
if (i.changed) // if SetState was called on this output if (i.changed) // if SetState was called on this output
{ {
if (-1 == i.id) // effect isn't currently uploaded if (-1 == i.id) // effect isn't currently uploaded
{ {
if (i.effect.type) // if outputstate is >0 this would be true if (i.effect.type) // if outputstate is >0 this would be true
{ {
if ((i.id = SDL_HapticNewEffect(m_haptic, &i.effect)) > -1) // upload the effect if ((i.id = SDL_HapticNewEffect(m_haptic, &i.effect)) > -1) // upload the effect
{ {
SDL_HapticRunEffect(m_haptic, i.id, 1); // run the effect SDL_HapticRunEffect(m_haptic, i.id, 1); // run the effect
} }
} }
} }
else // effect is already uploaded else // effect is already uploaded
{ {
if (i.effect.type) // if ouputstate >0 if (i.effect.type) // if ouputstate >0
{ {
SDL_HapticUpdateEffect(m_haptic, i.id, &i.effect); // update the effect SDL_HapticUpdateEffect(m_haptic, i.id, &i.effect); // update the effect
} }
else else
{ {
SDL_HapticStopEffect(m_haptic, i.id); // else, stop and remove the effect SDL_HapticStopEffect(m_haptic, i.id); // else, stop and remove the effect
SDL_HapticDestroyEffect(m_haptic, i.id); SDL_HapticDestroyEffect(m_haptic, i.id);
i.id = -1; // mark it as not uploaded i.id = -1; // mark it as not uploaded
} }
} }

View File

@ -30,7 +30,7 @@
// Mouse axis control output is simply divided by this number. In practice, // Mouse axis control output is simply divided by this number. In practice,
// that just means you can use a smaller "dead zone" if you bind axis controls // that just means you can use a smaller "dead zone" if you bind axis controls
// to a joystick. No real need to make this customizable. // to a joystick. No real need to make this customizable.
#define MOUSE_AXIS_SENSITIVITY 8.0f #define MOUSE_AXIS_SENSITIVITY 8.0f
// The mouse axis controls use a weighted running average. Each frame, the new // The mouse axis controls use a weighted running average. Each frame, the new
// value is the average of the old value and the amount of relative mouse // value is the average of the old value and the amount of relative mouse
@ -38,7 +38,7 @@
// MOUSE_AXIS_SMOOTHING:1 compared to the new value. Increasing // MOUSE_AXIS_SMOOTHING:1 compared to the new value. Increasing
// MOUSE_AXIS_SMOOTHING makes the controls smoother, decreasing it makes them // MOUSE_AXIS_SMOOTHING makes the controls smoother, decreasing it makes them
// more responsive. This might be useful as a user-customizable option. // more responsive. This might be useful as a user-customizable option.
#define MOUSE_AXIS_SMOOTHING 1.5f #define MOUSE_AXIS_SMOOTHING 1.5f
namespace ciface namespace ciface
{ {
@ -48,9 +48,7 @@ namespace XInput2
// This function will add zero or more KeyboardMouse objects to devices. // This function will add zero or more KeyboardMouse objects to devices.
void Init(std::vector<Core::Device*>& devices, void* const hwnd) void Init(std::vector<Core::Device*>& devices, void* const hwnd)
{ {
Display* dpy; Display* dpy = XOpenDisplay(NULL);
dpy = XOpenDisplay(NULL);
// xi_opcode is important; it will be used to identify XInput events by // xi_opcode is important; it will be used to identify XInput events by
// the polling loop in UpdateInput. // the polling loop in UpdateInput.
@ -68,9 +66,9 @@ void Init(std::vector<Core::Device*>& devices, void* const hwnd)
// register all master devices with Dolphin // register all master devices with Dolphin
XIDeviceInfo* all_masters; XIDeviceInfo* all_masters;
XIDeviceInfo* current_master; XIDeviceInfo* current_master;
int num_masters; int num_masters;
all_masters = XIQueryDevice(dpy, XIAllMasterDevices, &num_masters); all_masters = XIQueryDevice(dpy, XIAllMasterDevices, &num_masters);
@ -94,7 +92,6 @@ void Init(std::vector<Core::Device*>& devices, void* const hwnd)
void KeyboardMouse::SelectEventsForDevice(Window window, XIEventMask *mask, int deviceid) void KeyboardMouse::SelectEventsForDevice(Window window, XIEventMask *mask, int deviceid)
{ {
// Set the event mask for the master device. // Set the event mask for the master device.
mask->deviceid = deviceid; mask->deviceid = deviceid;
XISelectEvents(m_display, window, mask, 1); XISelectEvents(m_display, window, mask, 1);
@ -104,9 +101,9 @@ void KeyboardMouse::SelectEventsForDevice(Window window, XIEventMask *mask, int
// devices) emit those. For keyboard devices, selecting slaves avoids // devices) emit those. For keyboard devices, selecting slaves avoids
// dealing with key focus. // dealing with key focus.
XIDeviceInfo* all_slaves; XIDeviceInfo* all_slaves;
XIDeviceInfo* current_slave; XIDeviceInfo* current_slave;
int num_slaves; int num_slaves;
all_slaves = XIQueryDevice(m_display, XIAllDevices, &num_slaves); all_slaves = XIQueryDevice(m_display, XIAllDevices, &num_slaves);
@ -142,8 +139,8 @@ KeyboardMouse::KeyboardMouse(Window window, int opcode, int pointer, int keyboar
name = std::string(pointer_device->name); name = std::string(pointer_device->name);
XIFreeDeviceInfo(pointer_device); XIFreeDeviceInfo(pointer_device);
XIEventMask mask; XIEventMask mask;
unsigned char mask_buf[(XI_LASTEVENT + 7)/8]; unsigned char mask_buf[(XI_LASTEVENT + 7)/8];
mask.mask_len = sizeof(mask_buf); mask.mask_len = sizeof(mask_buf);
mask.mask = mask_buf; mask.mask = mask_buf;

View File

@ -44,10 +44,10 @@ private:
ControlState GetState() const; ControlState GetState() const;
private: private:
std::string m_keyname; std::string m_keyname;
Display* const m_display; Display* const m_display;
const char* const m_keyboard; const char* const m_keyboard;
const KeyCode m_keycode; const KeyCode m_keycode;
}; };
class Button : public Input class Button : public Input
@ -73,9 +73,9 @@ private:
private: private:
const float& m_cursor; const float& m_cursor;
const u8 m_index; const u8 m_index;
const bool m_positive; const bool m_positive;
std::string name; std::string name;
}; };
class Axis : public Input class Axis : public Input
@ -88,9 +88,9 @@ private:
private: private:
const float& m_axis; const float& m_axis;
const u8 m_index; const u8 m_index;
const bool m_positive; const bool m_positive;
std::string name; std::string name;
}; };
private: private:
@ -109,12 +109,12 @@ public:
int GetId() const; int GetId() const;
private: private:
Window m_window; Window m_window;
Display* m_display; Display* m_display;
State m_state; State m_state;
int xi_opcode; int xi_opcode;
const int pointer_deviceid, keyboard_deviceid; const int pointer_deviceid, keyboard_deviceid;
std::string name; std::string name;
}; };
} }

View File

@ -35,10 +35,10 @@ private:
ControlState GetState() const; ControlState GetState() const;
private: private:
std::string m_keyname; std::string m_keyname;
Display* const m_display; Display* const m_display;
const char* const m_keyboard; const char* const m_keyboard;
const KeyCode m_keycode; const KeyCode m_keycode;
}; };
class Button : public Input class Button : public Input
@ -65,8 +65,8 @@ private:
private: private:
const float& m_cursor; const float& m_cursor;
const u8 m_index; const u8 m_index;
const bool m_positive; const bool m_positive;
}; };
public: public:
@ -81,9 +81,9 @@ public:
int GetId() const; int GetId() const;
private: private:
Window m_window; Window m_window;
Display* m_display; Display* m_display;
State m_state; State m_state;
}; };
} }

View File

@ -210,7 +210,7 @@ int CD3DFont::Init()
// Create a new texture for the font // Create a new texture for the font
// possible optimization: store the converted data in a buffer and fill the texture on creation. // possible optimization: store the converted data in a buffer and fill the texture on creation.
// That way, we can use a static texture // That way, we can use a static texture
ID3D11Texture2D* buftex; ID3D11Texture2D* buftex;
D3D11_TEXTURE2D_DESC texdesc = CD3D11_TEXTURE2D_DESC(DXGI_FORMAT_R8G8B8A8_UNORM, m_dwTexWidth, m_dwTexHeight, D3D11_TEXTURE2D_DESC texdesc = CD3D11_TEXTURE2D_DESC(DXGI_FORMAT_R8G8B8A8_UNORM, m_dwTexWidth, m_dwTexHeight,
1, 1, D3D11_BIND_SHADER_RESOURCE, D3D11_USAGE_DYNAMIC, 1, 1, D3D11_BIND_SHADER_RESOURCE, D3D11_USAGE_DYNAMIC,

View File

@ -80,16 +80,16 @@ void SetupDeviceObjects()
D3D::SetDebugObjectName((ID3D11DeviceChild*)access_efb_cbuf, "constant buffer for Renderer::AccessEFB"); D3D::SetDebugObjectName((ID3D11DeviceChild*)access_efb_cbuf, "constant buffer for Renderer::AccessEFB");
D3D11_DEPTH_STENCIL_DESC ddesc; D3D11_DEPTH_STENCIL_DESC ddesc;
ddesc.DepthEnable = FALSE; ddesc.DepthEnable = FALSE;
ddesc.DepthWriteMask = D3D11_DEPTH_WRITE_MASK_ZERO; ddesc.DepthWriteMask = D3D11_DEPTH_WRITE_MASK_ZERO;
ddesc.DepthFunc = D3D11_COMPARISON_ALWAYS; ddesc.DepthFunc = D3D11_COMPARISON_ALWAYS;
ddesc.StencilEnable = FALSE; ddesc.StencilEnable = FALSE;
ddesc.StencilReadMask = D3D11_DEFAULT_STENCIL_READ_MASK; ddesc.StencilReadMask = D3D11_DEFAULT_STENCIL_READ_MASK;
ddesc.StencilWriteMask = D3D11_DEFAULT_STENCIL_WRITE_MASK; ddesc.StencilWriteMask = D3D11_DEFAULT_STENCIL_WRITE_MASK;
hr = D3D::device->CreateDepthStencilState(&ddesc, &cleardepthstates[0]); hr = D3D::device->CreateDepthStencilState(&ddesc, &cleardepthstates[0]);
CHECK(hr==S_OK, "Create depth state for Renderer::ClearScreen"); CHECK(hr==S_OK, "Create depth state for Renderer::ClearScreen");
ddesc.DepthWriteMask = D3D11_DEPTH_WRITE_MASK_ALL; ddesc.DepthWriteMask = D3D11_DEPTH_WRITE_MASK_ALL;
ddesc.DepthEnable = TRUE; ddesc.DepthEnable = TRUE;
hr = D3D::device->CreateDepthStencilState(&ddesc, &cleardepthstates[1]); hr = D3D::device->CreateDepthStencilState(&ddesc, &cleardepthstates[1]);
CHECK(hr==S_OK, "Create depth state for Renderer::ClearScreen"); CHECK(hr==S_OK, "Create depth state for Renderer::ClearScreen");
ddesc.DepthWriteMask = D3D11_DEPTH_WRITE_MASK_ZERO; ddesc.DepthWriteMask = D3D11_DEPTH_WRITE_MASK_ZERO;
@ -129,12 +129,12 @@ void SetupDeviceObjects()
hr = D3D::device->CreateBlendState(&blenddesc, &clearblendstates[3]); hr = D3D::device->CreateBlendState(&blenddesc, &clearblendstates[3]);
CHECK(hr==S_OK, "Create blend state for Renderer::ClearScreen"); CHECK(hr==S_OK, "Create blend state for Renderer::ClearScreen");
ddesc.DepthEnable = FALSE; ddesc.DepthEnable = FALSE;
ddesc.DepthWriteMask = D3D11_DEPTH_WRITE_MASK_ZERO; ddesc.DepthWriteMask = D3D11_DEPTH_WRITE_MASK_ZERO;
ddesc.DepthFunc = D3D11_COMPARISON_LESS; ddesc.DepthFunc = D3D11_COMPARISON_LESS;
ddesc.StencilEnable = FALSE; ddesc.StencilEnable = FALSE;
ddesc.StencilReadMask = D3D11_DEFAULT_STENCIL_READ_MASK; ddesc.StencilReadMask = D3D11_DEFAULT_STENCIL_READ_MASK;
ddesc.StencilWriteMask = D3D11_DEFAULT_STENCIL_WRITE_MASK; ddesc.StencilWriteMask = D3D11_DEFAULT_STENCIL_WRITE_MASK;
hr = D3D::device->CreateDepthStencilState(&ddesc, &resetdepthstate); hr = D3D::device->CreateDepthStencilState(&ddesc, &resetdepthstate);
CHECK(hr==S_OK, "Create depth state for Renderer::ResetAPIState"); CHECK(hr==S_OK, "Create depth state for Renderer::ResetAPIState");
D3D::SetDebugObjectName((ID3D11DeviceChild*)resetdepthstate, "depth stencil state for Renderer::ResetAPIState"); D3D::SetDebugObjectName((ID3D11DeviceChild*)resetdepthstate, "depth stencil state for Renderer::ResetAPIState");
@ -215,12 +215,12 @@ Renderer::Renderer()
gx_state.blenddc.RenderTarget[0].BlendOpAlpha = D3D11_BLEND_OP_ADD; gx_state.blenddc.RenderTarget[0].BlendOpAlpha = D3D11_BLEND_OP_ADD;
memset(&gx_state.depthdc, 0, sizeof(gx_state.depthdc)); memset(&gx_state.depthdc, 0, sizeof(gx_state.depthdc));
gx_state.depthdc.DepthEnable = TRUE; gx_state.depthdc.DepthEnable = TRUE;
gx_state.depthdc.DepthWriteMask = D3D11_DEPTH_WRITE_MASK_ALL; gx_state.depthdc.DepthWriteMask = D3D11_DEPTH_WRITE_MASK_ALL;
gx_state.depthdc.DepthFunc = D3D11_COMPARISON_LESS; gx_state.depthdc.DepthFunc = D3D11_COMPARISON_LESS;
gx_state.depthdc.StencilEnable = FALSE; gx_state.depthdc.StencilEnable = FALSE;
gx_state.depthdc.StencilReadMask = D3D11_DEFAULT_STENCIL_READ_MASK; gx_state.depthdc.StencilReadMask = D3D11_DEFAULT_STENCIL_READ_MASK;
gx_state.depthdc.StencilWriteMask = D3D11_DEFAULT_STENCIL_WRITE_MASK; gx_state.depthdc.StencilWriteMask = D3D11_DEFAULT_STENCIL_WRITE_MASK;
// TODO: Do we need to enable multisampling here? // TODO: Do we need to enable multisampling here?
gx_state.rastdc = CD3D11_RASTERIZER_DESC(D3D11_FILL_SOLID, D3D11_CULL_NONE, false, 0, 0.f, 0, false, true, false, false); gx_state.rastdc = CD3D11_RASTERIZER_DESC(D3D11_FILL_SOLID, D3D11_CULL_NONE, false, 0, 0.f, 0, false, true, false, false);
@ -327,15 +327,15 @@ void Renderer::SetColorMask()
// and EFB pokes (which will change the color or depth of a pixel). // and EFB pokes (which will change the color or depth of a pixel).
// //
// The behavior of EFB peeks can only be modified by: // The behavior of EFB peeks can only be modified by:
// - GX_PokeAlphaRead // - GX_PokeAlphaRead
// The behavior of EFB pokes can be modified by: // The behavior of EFB pokes can be modified by:
// - GX_PokeAlphaMode (TODO) // - GX_PokeAlphaMode (TODO)
// - GX_PokeAlphaUpdate (TODO) // - GX_PokeAlphaUpdate (TODO)
// - GX_PokeBlendMode (TODO) // - GX_PokeBlendMode (TODO)
// - GX_PokeColorUpdate (TODO) // - GX_PokeColorUpdate (TODO)
// - GX_PokeDither (TODO) // - GX_PokeDither (TODO)
// - GX_PokeDstAlpha (TODO) // - GX_PokeDstAlpha (TODO)
// - GX_PokeZMode (TODO) // - GX_PokeZMode (TODO)
u32 Renderer::AccessEFB(EFBAccessType type, u32 x, u32 y, u32 poke_data) u32 Renderer::AccessEFB(EFBAccessType type, u32 x, u32 y, u32 poke_data)
{ {
// TODO: This function currently is broken if anti-aliasing is enabled // TODO: This function currently is broken if anti-aliasing is enabled
@ -1190,22 +1190,22 @@ void Renderer::SetLogicOpMode()
// D3D11 doesn't support logic blending, so this is a huge hack // D3D11 doesn't support logic blending, so this is a huge hack
// TODO: Make use of D3D11.1's logic blending support // TODO: Make use of D3D11.1's logic blending support
// 0 0x00 // 0 0x00
// 1 Source & destination // 1 Source & destination
// 2 Source & ~destination // 2 Source & ~destination
// 3 Source // 3 Source
// 4 ~Source & destination // 4 ~Source & destination
// 5 Destination // 5 Destination
// 6 Source ^ destination = Source & ~destination | ~Source & destination // 6 Source ^ destination = Source & ~destination | ~Source & destination
// 7 Source | destination // 7 Source | destination
// 8 ~(Source | destination) // 8 ~(Source | destination)
// 9 ~(Source ^ destination) = ~Source & ~destination | Source & destination // 9 ~(Source ^ destination) = ~Source & ~destination | Source & destination
// 10 ~Destination // 10 ~Destination
// 11 Source | ~destination // 11 Source | ~destination
// 12 ~Source // 12 ~Source
// 13 ~Source | destination // 13 ~Source | destination
// 14 ~(Source & destination) // 14 ~(Source & destination)
// 15 0xff // 15 0xff
const D3D11_BLEND_OP d3dLogicOps[16] = const D3D11_BLEND_OP d3dLogicOps[16] =
{ {
D3D11_BLEND_OP_ADD,//0 D3D11_BLEND_OP_ADD,//0
@ -1313,7 +1313,8 @@ void Renderer::SetSamplerState(int stage, int texindex)
unsigned int mip = d3dMipFilters[tm0.min_filter & 3]; unsigned int mip = d3dMipFilters[tm0.min_filter & 3];
if (texindex) stage += 4; if (texindex)
stage += 4;
if (g_ActiveConfig.bForceFiltering) if (g_ActiveConfig.bForceFiltering)
{ {

View File

@ -182,12 +182,12 @@ void SWVertexLoader::SetFormat(u8 attributeIndex, u8 primitiveType)
case DIRECT: case DIRECT:
switch (colComp[i]) switch (colComp[i])
{ {
case FORMAT_16B_565: m_VertexSize += 2; m_colorLoader[i] = (Color_ReadDirect_16b_565); break; case FORMAT_16B_565: m_VertexSize += 2; m_colorLoader[i] = (Color_ReadDirect_16b_565); break;
case FORMAT_24B_888: m_VertexSize += 3; m_colorLoader[i] = (Color_ReadDirect_24b_888); break; case FORMAT_24B_888: m_VertexSize += 3; m_colorLoader[i] = (Color_ReadDirect_24b_888); break;
case FORMAT_32B_888x: m_VertexSize += 4; m_colorLoader[i] = (Color_ReadDirect_32b_888x); break; case FORMAT_32B_888x: m_VertexSize += 4; m_colorLoader[i] = (Color_ReadDirect_32b_888x); break;
case FORMAT_16B_4444: m_VertexSize += 2; m_colorLoader[i] = (Color_ReadDirect_16b_4444); break; case FORMAT_16B_4444: m_VertexSize += 2; m_colorLoader[i] = (Color_ReadDirect_16b_4444); break;
case FORMAT_24B_6666: m_VertexSize += 3; m_colorLoader[i] = (Color_ReadDirect_24b_6666); break; case FORMAT_24B_6666: m_VertexSize += 3; m_colorLoader[i] = (Color_ReadDirect_24b_6666); break;
case FORMAT_32B_8888: m_VertexSize += 4; m_colorLoader[i] = (Color_ReadDirect_32b_8888); break; case FORMAT_32B_8888: m_VertexSize += 4; m_colorLoader[i] = (Color_ReadDirect_32b_8888); break;
default: _assert_(0); break; default: _assert_(0); break;
} }
AddAttributeLoader(LoadColor, i); AddAttributeLoader(LoadColor, i);
@ -196,12 +196,12 @@ void SWVertexLoader::SetFormat(u8 attributeIndex, u8 primitiveType)
m_VertexSize += 1; m_VertexSize += 1;
switch (colComp[i]) switch (colComp[i])
{ {
case FORMAT_16B_565: m_colorLoader[i] = (Color_ReadIndex8_16b_565); break; case FORMAT_16B_565: m_colorLoader[i] = (Color_ReadIndex8_16b_565); break;
case FORMAT_24B_888: m_colorLoader[i] = (Color_ReadIndex8_24b_888); break; case FORMAT_24B_888: m_colorLoader[i] = (Color_ReadIndex8_24b_888); break;
case FORMAT_32B_888x: m_colorLoader[i] = (Color_ReadIndex8_32b_888x); break; case FORMAT_32B_888x: m_colorLoader[i] = (Color_ReadIndex8_32b_888x); break;
case FORMAT_16B_4444: m_colorLoader[i] = (Color_ReadIndex8_16b_4444); break; case FORMAT_16B_4444: m_colorLoader[i] = (Color_ReadIndex8_16b_4444); break;
case FORMAT_24B_6666: m_colorLoader[i] = (Color_ReadIndex8_24b_6666); break; case FORMAT_24B_6666: m_colorLoader[i] = (Color_ReadIndex8_24b_6666); break;
case FORMAT_32B_8888: m_colorLoader[i] = (Color_ReadIndex8_32b_8888); break; case FORMAT_32B_8888: m_colorLoader[i] = (Color_ReadIndex8_32b_8888); break;
default: _assert_(0); break; default: _assert_(0); break;
} }
AddAttributeLoader(LoadColor, i); AddAttributeLoader(LoadColor, i);
@ -210,12 +210,12 @@ void SWVertexLoader::SetFormat(u8 attributeIndex, u8 primitiveType)
m_VertexSize += 2; m_VertexSize += 2;
switch (colComp[i]) switch (colComp[i])
{ {
case FORMAT_16B_565: m_colorLoader[i] = (Color_ReadIndex16_16b_565); break; case FORMAT_16B_565: m_colorLoader[i] = (Color_ReadIndex16_16b_565); break;
case FORMAT_24B_888: m_colorLoader[i] = (Color_ReadIndex16_24b_888); break; case FORMAT_24B_888: m_colorLoader[i] = (Color_ReadIndex16_24b_888); break;
case FORMAT_32B_888x: m_colorLoader[i] = (Color_ReadIndex16_32b_888x); break; case FORMAT_32B_888x: m_colorLoader[i] = (Color_ReadIndex16_32b_888x); break;
case FORMAT_16B_4444: m_colorLoader[i] = (Color_ReadIndex16_16b_4444); break; case FORMAT_16B_4444: m_colorLoader[i] = (Color_ReadIndex16_16b_4444); break;
case FORMAT_24B_6666: m_colorLoader[i] = (Color_ReadIndex16_24b_6666); break; case FORMAT_24B_6666: m_colorLoader[i] = (Color_ReadIndex16_24b_6666); break;
case FORMAT_32B_8888: m_colorLoader[i] = (Color_ReadIndex16_32b_8888); break; case FORMAT_32B_8888: m_colorLoader[i] = (Color_ReadIndex16_32b_8888); break;
default: _assert_(0); break; default: _assert_(0); break;
} }
AddAttributeLoader(LoadColor, i); AddAttributeLoader(LoadColor, i);

View File

@ -119,7 +119,7 @@ inline s16 Clamp255(s16 in)
inline s16 Clamp1024(s16 in) inline s16 Clamp1024(s16 in)
{ {
return in>1023?1023:(in<-1024?-1024:in); return in>1023?1023:(in<-1024?-1024:in);
} }
void Tev::SetRasColor(int colorChan, int swaptable) void Tev::SetRasColor(int colorChan, int swaptable)
@ -595,10 +595,12 @@ void Tev::Draw()
#if ALLOW_TEV_DUMPS #if ALLOW_TEV_DUMPS
if (g_SWVideoConfig.bDumpTevStages) if (g_SWVideoConfig.bDumpTevStages)
{ {
u8 stage[4] = { IndirectTex[stageNum][TextureSampler::ALP_SMP], u8 stage[4] = {
IndirectTex[stageNum][TextureSampler::BLU_SMP], IndirectTex[stageNum][TextureSampler::ALP_SMP],
IndirectTex[stageNum][TextureSampler::GRN_SMP], IndirectTex[stageNum][TextureSampler::BLU_SMP],
255}; IndirectTex[stageNum][TextureSampler::GRN_SMP],
255
};
DebugUtil::DrawTempBuffer(stage, INDIRECT + stageNum); DebugUtil::DrawTempBuffer(stage, INDIRECT + stageNum);
} }
#endif #endif

View File

@ -337,9 +337,9 @@ void STACKALIGN GatherPipeBursted()
"FIFO is overflowed by GatherPipe !\nCPU thread is too fast!"); "FIFO is overflowed by GatherPipe !\nCPU thread is too fast!");
// check if we are in sync // check if we are in sync
_assert_msg_(COMMANDPROCESSOR, fifo.CPWritePointer == ProcessorInterface::Fifo_CPUWritePointer, "FIFOs linked but out of sync"); _assert_msg_(COMMANDPROCESSOR, fifo.CPWritePointer == ProcessorInterface::Fifo_CPUWritePointer, "FIFOs linked but out of sync");
_assert_msg_(COMMANDPROCESSOR, fifo.CPBase == ProcessorInterface::Fifo_CPUBase, "FIFOs linked but out of sync"); _assert_msg_(COMMANDPROCESSOR, fifo.CPBase == ProcessorInterface::Fifo_CPUBase, "FIFOs linked but out of sync");
_assert_msg_(COMMANDPROCESSOR, fifo.CPEnd == ProcessorInterface::Fifo_CPUEnd, "FIFOs linked but out of sync"); _assert_msg_(COMMANDPROCESSOR, fifo.CPEnd == ProcessorInterface::Fifo_CPUEnd, "FIFOs linked but out of sync");
} }
void UpdateInterrupts(u64 userdata) void UpdateInterrupts(u64 userdata)
@ -486,11 +486,11 @@ void SetCpStatusRegister()
INFO_LOG(COMMANDPROCESSOR,"\t Read from STATUS_REGISTER : %04x", m_CPStatusReg.Hex); INFO_LOG(COMMANDPROCESSOR,"\t Read from STATUS_REGISTER : %04x", m_CPStatusReg.Hex);
DEBUG_LOG(COMMANDPROCESSOR, "(r) status: iBP %s | fReadIdle %s | fCmdIdle %s | iOvF %s | iUndF %s" DEBUG_LOG(COMMANDPROCESSOR, "(r) status: iBP %s | fReadIdle %s | fCmdIdle %s | iOvF %s | iUndF %s"
, m_CPStatusReg.Breakpoint ? "ON" : "OFF" , m_CPStatusReg.Breakpoint ? "ON" : "OFF"
, m_CPStatusReg.ReadIdle ? "ON" : "OFF" , m_CPStatusReg.ReadIdle ? "ON" : "OFF"
, m_CPStatusReg.CommandIdle ? "ON" : "OFF" , m_CPStatusReg.CommandIdle ? "ON" : "OFF"
, m_CPStatusReg.OverflowHiWatermark ? "ON" : "OFF" , m_CPStatusReg.OverflowHiWatermark ? "ON" : "OFF"
, m_CPStatusReg.UnderflowLoWatermark ? "ON" : "OFF" , m_CPStatusReg.UnderflowLoWatermark ? "ON" : "OFF"
); );
} }
@ -527,12 +527,12 @@ void SetCpControlRegister()
} }
DEBUG_LOG(COMMANDPROCESSOR, "\t GPREAD %s | BP %s | Int %s | OvF %s | UndF %s | LINK %s" DEBUG_LOG(COMMANDPROCESSOR, "\t GPREAD %s | BP %s | Int %s | OvF %s | UndF %s | LINK %s"
, fifo.bFF_GPReadEnable ? "ON" : "OFF" , fifo.bFF_GPReadEnable ? "ON" : "OFF"
, fifo.bFF_BPEnable ? "ON" : "OFF" , fifo.bFF_BPEnable ? "ON" : "OFF"
, fifo.bFF_BPInt ? "ON" : "OFF" , fifo.bFF_BPInt ? "ON" : "OFF"
, m_CPCtrlReg.FifoOverflowIntEnable ? "ON" : "OFF" , m_CPCtrlReg.FifoOverflowIntEnable ? "ON" : "OFF"
, m_CPCtrlReg.FifoUnderflowIntEnable ? "ON" : "OFF" , m_CPCtrlReg.FifoUnderflowIntEnable ? "ON" : "OFF"
, m_CPCtrlReg.GPLinkEnable ? "ON" : "OFF" , m_CPCtrlReg.GPLinkEnable ? "ON" : "OFF"
); );
} }

View File

@ -74,21 +74,21 @@ namespace DriverDetails
case VENDOR_NVIDIA: case VENDOR_NVIDIA:
case VENDOR_TEGRA: case VENDOR_TEGRA:
m_driver = DRIVER_NVIDIA; m_driver = DRIVER_NVIDIA;
break; break;
case VENDOR_ATI: case VENDOR_ATI:
m_driver = DRIVER_ATI; m_driver = DRIVER_ATI;
break; break;
case VENDOR_INTEL: case VENDOR_INTEL:
m_driver = DRIVER_INTEL; m_driver = DRIVER_INTEL;
break; break;
case VENDOR_IMGTEC: case VENDOR_IMGTEC:
m_driver = DRIVER_IMGTEC; m_driver = DRIVER_IMGTEC;
break; break;
case VENDOR_VIVANTE: case VENDOR_VIVANTE:
m_driver = DRIVER_VIVANTE; m_driver = DRIVER_VIVANTE;
break; break;
default: default:
break; break;
} }
for(auto& bug : m_known_bugs) for(auto& bug : m_known_bugs)

View File

@ -48,8 +48,8 @@ union UPEAlphaReadReg
u16 Hex; u16 Hex;
struct struct
{ {
u16 ReadMode : 2; u16 ReadMode : 2;
u16 : 14; u16 : 14;
}; };
}; };

View File

@ -1046,14 +1046,14 @@ void SampleTexture(T& out, const char *texcoords, const char *texswap, int texma
static const char *tevAlphaFuncsTable[] = static const char *tevAlphaFuncsTable[] =
{ {
"(false)", // NEVER "(false)", // NEVER
"(prev.a <= %s - (0.25/255.0))", // LESS "(prev.a <= %s - (0.25/255.0))", // LESS
"(abs( prev.a - %s ) < (0.5/255.0))", // EQUAL "(abs( prev.a - %s ) < (0.5/255.0))", // EQUAL
"(prev.a < %s + (0.25/255.0))", // LEQUAL "(prev.a < %s + (0.25/255.0))", // LEQUAL
"(prev.a >= %s + (0.25/255.0))", // GREATER "(prev.a >= %s + (0.25/255.0))", // GREATER
"(abs( prev.a - %s ) >= (0.5/255.0))", // NEQUAL "(abs( prev.a - %s ) >= (0.5/255.0))", // NEQUAL
"(prev.a > %s - (0.25/255.0))", // GEQUAL "(prev.a > %s - (0.25/255.0))", // GEQUAL
"(true)" // ALWAYS "(true)" // ALWAYS
}; };
static const char *tevAlphaFunclogicTable[] = static const char *tevAlphaFunclogicTable[] =
@ -1124,14 +1124,14 @@ static inline void WriteAlphaTest(T& out, pixel_shader_uid_data& uid_data, API_T
static const char *tevFogFuncsTable[] = static const char *tevFogFuncsTable[] =
{ {
"", // No Fog "", // No Fog
"", // ? "", // ?
"", // Linear "", // Linear
"", // ? "", // ?
"\tfog = 1.0 - exp2(-8.0 * fog);\n", // exp "\tfog = 1.0 - exp2(-8.0 * fog);\n", // exp
"\tfog = 1.0 - exp2(-8.0 * fog * fog);\n", // exp2 "\tfog = 1.0 - exp2(-8.0 * fog * fog);\n", // exp2
"\tfog = exp2(-8.0 * (1.0 - fog));\n", // backward exp "\tfog = exp2(-8.0 * (1.0 - fog));\n", // backward exp
"\tfog = 1.0 - fog;\n fog = exp2(-8.0 * fog * fog);\n" // backward exp2 "\tfog = 1.0 - fog;\n fog = exp2(-8.0 * fog * fog);\n" // backward exp2
}; };
template<class T> template<class T>
@ -1153,7 +1153,7 @@ static inline void WriteFog(T& out, pixel_shader_uid_data& uid_data)
else else
{ {
// orthographic // orthographic
// ze = a*Zs (here, no B_SHF) // ze = a*Zs (here, no B_SHF)
out.Write("\tfloat ze = " I_FOG"[1].x * zCoord;\n"); out.Write("\tfloat ze = " I_FOG"[1].x * zCoord;\n");
} }

View File

@ -2447,25 +2447,25 @@ PC_TexFormat TexDecoder_DecodeRGBA8FromTmem(u8* dst, const u8 *src_ar, const u8
const char* texfmt[] = { const char* texfmt[] = {
// pixel // pixel
"I4", "I8", "IA4", "IA8", "I4", "I8", "IA4", "IA8",
"RGB565", "RGB5A3", "RGBA8", "0x07", "RGB565", "RGB5A3", "RGBA8", "0x07",
"C4", "C8", "C14X2", "0x0B", "C4", "C8", "C14X2", "0x0B",
"0x0C", "0x0D", "CMPR", "0x0F", "0x0C", "0x0D", "CMPR", "0x0F",
// Z-buffer // Z-buffer
"0x10", "Z8", "0x12", "Z16", "0x10", "Z8", "0x12", "Z16",
"0x14", "0x15", "Z24X8", "0x17", "0x14", "0x15", "Z24X8", "0x17",
"0x18", "0x19", "0x1A", "0x1B", "0x18", "0x19", "0x1A", "0x1B",
"0x1C", "0x1D", "0x1E", "0x1F", "0x1C", "0x1D", "0x1E", "0x1F",
// pixel + copy // pixel + copy
"CR4", "0x21", "CRA4", "CRA8", "CR4", "0x21", "CRA4", "CRA8",
"0x24", "0x25", "CYUVA8", "CA8", "0x24", "0x25", "CYUVA8", "CA8",
"CR8", "CG8", "CB8", "CRG8", "CR8", "CG8", "CB8", "CRG8",
"CGB8", "0x2D", "0x2E", "0x2F", "CGB8", "0x2D", "0x2E", "0x2F",
// Z + copy // Z + copy
"CZ4", "0x31", "0x32", "0x33", "CZ4", "0x31", "0x32", "0x33",
"0x34", "0x35", "0x36", "0x37", "0x34", "0x35", "0x36", "0x37",
"0x38", "CZ8M", "CZ8L", "0x3B", "0x38", "CZ8M", "CZ8L", "0x3B",
"CZ16L", "0x3D", "0x3E", "0x3F", "CZ16L", "0x3D", "0x3E", "0x3F",
}; };
const unsigned char sfont_map[] = { const unsigned char sfont_map[] = {

View File

@ -844,15 +844,15 @@ void VertexLoader::SetupRunVertices(int vtx_attr_group, int primitive, int const
g_nativeVertexFmt = m_NativeFmt; g_nativeVertexFmt = m_NativeFmt;
// Load position and texcoord scale factors. // Load position and texcoord scale factors.
m_VtxAttr.PosFrac = g_VtxAttr[vtx_attr_group].g0.PosFrac; m_VtxAttr.PosFrac = g_VtxAttr[vtx_attr_group].g0.PosFrac;
m_VtxAttr.texCoord[0].Frac = g_VtxAttr[vtx_attr_group].g0.Tex0Frac; m_VtxAttr.texCoord[0].Frac = g_VtxAttr[vtx_attr_group].g0.Tex0Frac;
m_VtxAttr.texCoord[1].Frac = g_VtxAttr[vtx_attr_group].g1.Tex1Frac; m_VtxAttr.texCoord[1].Frac = g_VtxAttr[vtx_attr_group].g1.Tex1Frac;
m_VtxAttr.texCoord[2].Frac = g_VtxAttr[vtx_attr_group].g1.Tex2Frac; m_VtxAttr.texCoord[2].Frac = g_VtxAttr[vtx_attr_group].g1.Tex2Frac;
m_VtxAttr.texCoord[3].Frac = g_VtxAttr[vtx_attr_group].g1.Tex3Frac; m_VtxAttr.texCoord[3].Frac = g_VtxAttr[vtx_attr_group].g1.Tex3Frac;
m_VtxAttr.texCoord[4].Frac = g_VtxAttr[vtx_attr_group].g2.Tex4Frac; m_VtxAttr.texCoord[4].Frac = g_VtxAttr[vtx_attr_group].g2.Tex4Frac;
m_VtxAttr.texCoord[5].Frac = g_VtxAttr[vtx_attr_group].g2.Tex5Frac; m_VtxAttr.texCoord[5].Frac = g_VtxAttr[vtx_attr_group].g2.Tex5Frac;
m_VtxAttr.texCoord[6].Frac = g_VtxAttr[vtx_attr_group].g2.Tex6Frac; m_VtxAttr.texCoord[6].Frac = g_VtxAttr[vtx_attr_group].g2.Tex6Frac;
m_VtxAttr.texCoord[7].Frac = g_VtxAttr[vtx_attr_group].g2.Tex7Frac; m_VtxAttr.texCoord[7].Frac = g_VtxAttr[vtx_attr_group].g2.Tex7Frac;
pVtxAttr = &m_VtxAttr; pVtxAttr = &m_VtxAttr;
posScale = fractionTable[m_VtxAttr.PosFrac]; posScale = fractionTable[m_VtxAttr.PosFrac];
@ -913,43 +913,43 @@ void VertexLoader::SetVAT(u32 _group0, u32 _group1, u32 _group2)
vat.g1.Hex = _group1; vat.g1.Hex = _group1;
vat.g2.Hex = _group2; vat.g2.Hex = _group2;
m_VtxAttr.PosElements = vat.g0.PosElements; m_VtxAttr.PosElements = vat.g0.PosElements;
m_VtxAttr.PosFormat = vat.g0.PosFormat; m_VtxAttr.PosFormat = vat.g0.PosFormat;
m_VtxAttr.PosFrac = vat.g0.PosFrac; m_VtxAttr.PosFrac = vat.g0.PosFrac;
m_VtxAttr.NormalElements = vat.g0.NormalElements; m_VtxAttr.NormalElements = vat.g0.NormalElements;
m_VtxAttr.NormalFormat = vat.g0.NormalFormat; m_VtxAttr.NormalFormat = vat.g0.NormalFormat;
m_VtxAttr.color[0].Elements = vat.g0.Color0Elements; m_VtxAttr.color[0].Elements = vat.g0.Color0Elements;
m_VtxAttr.color[0].Comp = vat.g0.Color0Comp; m_VtxAttr.color[0].Comp = vat.g0.Color0Comp;
m_VtxAttr.color[1].Elements = vat.g0.Color1Elements; m_VtxAttr.color[1].Elements = vat.g0.Color1Elements;
m_VtxAttr.color[1].Comp = vat.g0.Color1Comp; m_VtxAttr.color[1].Comp = vat.g0.Color1Comp;
m_VtxAttr.texCoord[0].Elements = vat.g0.Tex0CoordElements; m_VtxAttr.texCoord[0].Elements = vat.g0.Tex0CoordElements;
m_VtxAttr.texCoord[0].Format = vat.g0.Tex0CoordFormat; m_VtxAttr.texCoord[0].Format = vat.g0.Tex0CoordFormat;
m_VtxAttr.texCoord[0].Frac = vat.g0.Tex0Frac; m_VtxAttr.texCoord[0].Frac = vat.g0.Tex0Frac;
m_VtxAttr.ByteDequant = vat.g0.ByteDequant; m_VtxAttr.ByteDequant = vat.g0.ByteDequant;
m_VtxAttr.NormalIndex3 = vat.g0.NormalIndex3; m_VtxAttr.NormalIndex3 = vat.g0.NormalIndex3;
m_VtxAttr.texCoord[1].Elements = vat.g1.Tex1CoordElements; m_VtxAttr.texCoord[1].Elements = vat.g1.Tex1CoordElements;
m_VtxAttr.texCoord[1].Format = vat.g1.Tex1CoordFormat; m_VtxAttr.texCoord[1].Format = vat.g1.Tex1CoordFormat;
m_VtxAttr.texCoord[1].Frac = vat.g1.Tex1Frac; m_VtxAttr.texCoord[1].Frac = vat.g1.Tex1Frac;
m_VtxAttr.texCoord[2].Elements = vat.g1.Tex2CoordElements; m_VtxAttr.texCoord[2].Elements = vat.g1.Tex2CoordElements;
m_VtxAttr.texCoord[2].Format = vat.g1.Tex2CoordFormat; m_VtxAttr.texCoord[2].Format = vat.g1.Tex2CoordFormat;
m_VtxAttr.texCoord[2].Frac = vat.g1.Tex2Frac; m_VtxAttr.texCoord[2].Frac = vat.g1.Tex2Frac;
m_VtxAttr.texCoord[3].Elements = vat.g1.Tex3CoordElements; m_VtxAttr.texCoord[3].Elements = vat.g1.Tex3CoordElements;
m_VtxAttr.texCoord[3].Format = vat.g1.Tex3CoordFormat; m_VtxAttr.texCoord[3].Format = vat.g1.Tex3CoordFormat;
m_VtxAttr.texCoord[3].Frac = vat.g1.Tex3Frac; m_VtxAttr.texCoord[3].Frac = vat.g1.Tex3Frac;
m_VtxAttr.texCoord[4].Elements = vat.g1.Tex4CoordElements; m_VtxAttr.texCoord[4].Elements = vat.g1.Tex4CoordElements;
m_VtxAttr.texCoord[4].Format = vat.g1.Tex4CoordFormat; m_VtxAttr.texCoord[4].Format = vat.g1.Tex4CoordFormat;
m_VtxAttr.texCoord[4].Frac = vat.g2.Tex4Frac; m_VtxAttr.texCoord[4].Frac = vat.g2.Tex4Frac;
m_VtxAttr.texCoord[5].Elements = vat.g2.Tex5CoordElements; m_VtxAttr.texCoord[5].Elements = vat.g2.Tex5CoordElements;
m_VtxAttr.texCoord[5].Format = vat.g2.Tex5CoordFormat; m_VtxAttr.texCoord[5].Format = vat.g2.Tex5CoordFormat;
m_VtxAttr.texCoord[5].Frac = vat.g2.Tex5Frac; m_VtxAttr.texCoord[5].Frac = vat.g2.Tex5Frac;
m_VtxAttr.texCoord[6].Elements = vat.g2.Tex6CoordElements; m_VtxAttr.texCoord[6].Elements = vat.g2.Tex6CoordElements;
m_VtxAttr.texCoord[6].Format = vat.g2.Tex6CoordFormat; m_VtxAttr.texCoord[6].Format = vat.g2.Tex6CoordFormat;
m_VtxAttr.texCoord[6].Frac = vat.g2.Tex6Frac; m_VtxAttr.texCoord[6].Frac = vat.g2.Tex6Frac;
m_VtxAttr.texCoord[7].Elements = vat.g2.Tex7CoordElements; m_VtxAttr.texCoord[7].Elements = vat.g2.Tex7CoordElements;
m_VtxAttr.texCoord[7].Format = vat.g2.Tex7CoordFormat; m_VtxAttr.texCoord[7].Format = vat.g2.Tex7CoordFormat;
m_VtxAttr.texCoord[7].Frac = vat.g2.Tex7Frac; m_VtxAttr.texCoord[7].Frac = vat.g2.Tex7Frac;
if(!m_VtxAttr.ByteDequant) { if(!m_VtxAttr.ByteDequant) {
ERROR_LOG(VIDEO, "ByteDequant is set to zero"); ERROR_LOG(VIDEO, "ByteDequant is set to zero");

View File

@ -29,11 +29,11 @@ __forceinline void _SetCol(u32 val)
//BARG -> AABBGGRR //BARG -> AABBGGRR
__forceinline void _SetCol4444(u16 val) __forceinline void _SetCol4444(u16 val)
{ {
u32 col = (val & 0xF0); // col = 000000R0; u32 col = (val & 0xF0); // col = 000000R0;
col |= (val & 0xF ) << 12; // col |= 0000G000; col |= (val & 0xF ) << 12; // col |= 0000G000;
col |= (((u32)val) & 0xF000) << 8; // col |= 00B00000; col |= (((u32)val) & 0xF000) << 8; // col |= 00B00000;
col |= (((u32)val) & 0x0F00) << 20; // col |= A0000000; col |= (((u32)val) & 0x0F00) << 20; // col |= A0000000;
col |= col >> 4; // col = A0B0G0R0 | 0A0B0G0R; col |= col >> 4; // col = A0B0G0R0 | 0A0B0G0R;
_SetCol(col); _SetCol(col);
} }

View File

@ -25,34 +25,34 @@ public:
private: private:
enum ENormalType enum ENormalType
{ {
NRM_NOT_PRESENT = 0, NRM_NOT_PRESENT = 0,
NRM_DIRECT = 1, NRM_DIRECT = 1,
NRM_INDEX8 = 2, NRM_INDEX8 = 2,
NRM_INDEX16 = 3, NRM_INDEX16 = 3,
NUM_NRM_TYPE NUM_NRM_TYPE
}; };
enum ENormalFormat enum ENormalFormat
{ {
FORMAT_UBYTE = 0, FORMAT_UBYTE = 0,
FORMAT_BYTE = 1, FORMAT_BYTE = 1,
FORMAT_USHORT = 2, FORMAT_USHORT = 2,
FORMAT_SHORT = 3, FORMAT_SHORT = 3,
FORMAT_FLOAT = 4, FORMAT_FLOAT = 4,
NUM_NRM_FORMAT NUM_NRM_FORMAT
}; };
enum ENormalElements enum ENormalElements
{ {
NRM_NBT = 0, NRM_NBT = 0,
NRM_NBT3 = 1, NRM_NBT3 = 1,
NUM_NRM_ELEMENTS NUM_NRM_ELEMENTS
}; };
enum ENormalIndices enum ENormalIndices
{ {
NRM_INDICES1 = 0, NRM_INDICES1 = 0,
NRM_INDICES3 = 1, NRM_INDICES3 = 1,
NUM_NRM_INDICES NUM_NRM_INDICES
}; };

View File

@ -147,22 +147,22 @@ static void ViewportCorrectionMatrix(Matrix44& result)
float intendedWd = 2.0f * xfregs.viewport.wd; float intendedWd = 2.0f * xfregs.viewport.wd;
float intendedHt = -2.0f * xfregs.viewport.ht; float intendedHt = -2.0f * xfregs.viewport.ht;
if (intendedWd < 0.f) if (intendedWd < 0.f)
{ {
intendedX += intendedWd; intendedX += intendedWd;
intendedWd = -intendedWd; intendedWd = -intendedWd;
} }
if (intendedHt < 0.f) if (intendedHt < 0.f)
{ {
intendedY += intendedHt; intendedY += intendedHt;
intendedHt = -intendedHt; intendedHt = -intendedHt;
} }
// fit to EFB size // fit to EFB size
float X = (intendedX >= 0.f) ? intendedX : 0.f; float X = (intendedX >= 0.f) ? intendedX : 0.f;
float Y = (intendedY >= 0.f) ? intendedY : 0.f; float Y = (intendedY >= 0.f) ? intendedY : 0.f;
float Wd = (X + intendedWd <= EFB_WIDTH) ? intendedWd : (EFB_WIDTH - X); float Wd = (X + intendedWd <= EFB_WIDTH) ? intendedWd : (EFB_WIDTH - X);
float Ht = (Y + intendedHt <= EFB_HEIGHT) ? intendedHt : (EFB_HEIGHT - Y); float Ht = (Y + intendedHt <= EFB_HEIGHT) ? intendedHt : (EFB_HEIGHT - Y);
Matrix44::LoadIdentity(result); Matrix44::LoadIdentity(result);
if (Wd == 0 || Ht == 0) if (Wd == 0 || Ht == 0)

View File

@ -18,10 +18,10 @@
#include <string> #include <string>
// Log in two categories, and save three other options in the same byte // Log in two categories, and save three other options in the same byte
#define CONF_LOG 1 #define CONF_LOG 1
#define CONF_PRIMLOG 2 #define CONF_PRIMLOG 2
#define CONF_SAVETARGETS 8 #define CONF_SAVETARGETS 8
#define CONF_SAVESHADERS 16 #define CONF_SAVESHADERS 16
enum AspectMode enum AspectMode
{ {