From b2acae44b780ecf86ffb88cd32861edb25642e20 Mon Sep 17 00:00:00 2001 From: Jordan Woyak Date: Tue, 15 Jan 2013 21:15:54 -0600 Subject: [PATCH 01/49] Real wiimote continuous scanning working on Linux. Windows and OS X totally broken from various refactoring. --- Source/Core/Core/Src/HW/Wiimote.h | 2 +- .../Core/Src/HW/WiimoteEmu/EmuSubroutines.cpp | 2 +- .../Core/Src/HW/WiimoteEmu/WiimoteEmu.cpp | 2 +- Source/Core/Core/Src/HW/WiimoteReal/IONix.cpp | 229 ++++++------- .../Core/Src/HW/WiimoteReal/WiimoteReal.cpp | 312 ++++++++++++------ .../Core/Src/HW/WiimoteReal/WiimoteReal.h | 73 +++- .../Core/DolphinWX/Src/WiimoteConfigDiag.cpp | 16 +- 7 files changed, 370 insertions(+), 266 deletions(-) diff --git a/Source/Core/Core/Src/HW/Wiimote.h b/Source/Core/Core/Src/HW/Wiimote.h index 5e0ab8d05e..d514cf9909 100644 --- a/Source/Core/Core/Src/HW/Wiimote.h +++ b/Source/Core/Core/Src/HW/Wiimote.h @@ -38,7 +38,7 @@ void Update(int _number); namespace WiimoteReal { -unsigned int Initialize(); +void Initialize(); void Shutdown(); void Refresh(); diff --git a/Source/Core/Core/Src/HW/WiimoteEmu/EmuSubroutines.cpp b/Source/Core/Core/Src/HW/WiimoteEmu/EmuSubroutines.cpp index 5c34fff9ac..cfb81bb768 100644 --- a/Source/Core/Core/Src/HW/WiimoteEmu/EmuSubroutines.cpp +++ b/Source/Core/Core/Src/HW/WiimoteEmu/EmuSubroutines.cpp @@ -248,7 +248,7 @@ void Wiimote::RequestStatus(const wm_request_status* const rs) { using namespace WiimoteReal; - std::lock_guard lk(g_refresh_lock); + std::lock_guard lk(g_refresh_lock); if (g_wiimotes[m_index]) { diff --git a/Source/Core/Core/Src/HW/WiimoteEmu/WiimoteEmu.cpp b/Source/Core/Core/Src/HW/WiimoteEmu/WiimoteEmu.cpp index b7652e973a..30fad4b458 100644 --- a/Source/Core/Core/Src/HW/WiimoteEmu/WiimoteEmu.cpp +++ b/Source/Core/Core/Src/HW/WiimoteEmu/WiimoteEmu.cpp @@ -685,7 +685,7 @@ void Wiimote::Update() { using namespace WiimoteReal; - std::lock_guard lk(g_refresh_lock); + std::lock_guard lk(g_refresh_lock); if (g_wiimotes[m_index]) { Report rpt = g_wiimotes[m_index]->ProcessReadQueue(); diff --git a/Source/Core/Core/Src/HW/WiimoteReal/IONix.cpp b/Source/Core/Core/Src/HW/WiimoteReal/IONix.cpp index ec838d9313..82630aaebb 100644 --- a/Source/Core/Core/Src/HW/WiimoteReal/IONix.cpp +++ b/Source/Core/Core/Src/HW/WiimoteReal/IONix.cpp @@ -15,16 +15,6 @@ // Official SVN repository and contact information can be found at // http://code.google.com/p/dolphin-emu/ -#include -#include - -#include -#include -#include -#include -#include -#include - #include #include #include @@ -32,114 +22,117 @@ #include "Common.h" #include "WiimoteReal.h" -#include "Host.h" namespace WiimoteReal { +WiimoteScanner::WiimoteScanner() + : run_thread() + , want_wiimotes() + , device_id(-1) + , device_sock(-1) +{ + // Get the id of the first bluetooth device. + device_id = hci_get_route(NULL); + if (device_id < 0) + { + NOTICE_LOG(WIIMOTE, "Bluetooth not found."); + return; + } + + // Create a socket to the device + device_sock = hci_open_dev(device_id); + if (device_sock < 0) + { + ERROR_LOG(WIIMOTE, "Unable to open bluetooth."); + return; + } +} + +bool WiimoteScanner::IsReady() const +{ + return device_sock > 0; +} + +WiimoteScanner::~WiimoteScanner() +{ + if (IsReady()) + close(device_sock); +} + // Find wiimotes. // Does not replace already found wiimotes even if they are disconnected. // wm is an array of max_wiimotes wiimotes // Returns the total number of found wiimotes. -int FindWiimotes(Wiimote** wm, int max_wiimotes) +std::vector WiimoteScanner::FindWiimotes(size_t max_wiimotes) { - int device_id; - int device_sock; - int found_devices; - int found_wiimotes = 0; - int i; + std::vector found_wiimotes; - // Count the number of already found wiimotes - for (i = 0; i < MAX_WIIMOTES; ++i) - { - if (wm[i]) - found_wiimotes++; - } + // supposedly 1.28 seconds + int const wait_len = 1; - // Get the id of the first bluetooth device. - if ((device_id = hci_get_route(NULL)) < 0) + int const max_infos = 255; + inquiry_info scan_infos[max_infos] = {}; + auto* scan_infos_ptr = scan_infos; + + // Scan for bluetooth devices + int const found_devices = hci_inquiry(device_id, wait_len, max_infos, NULL, &scan_infos_ptr, IREQ_CACHE_FLUSH); + if (found_devices < 0) { - NOTICE_LOG(WIIMOTE, "Bluetooth not found."); + ERROR_LOG(WIIMOTE, "Error searching for bluetooth devices."); return found_wiimotes; } - // Create a socket to the device - if ((device_sock = hci_open_dev(device_id)) < 0) - { - ERROR_LOG(WIIMOTE, "Unable to open bluetooth."); - return found_wiimotes; - } + DEBUG_LOG(WIIMOTE, "Found %i bluetooth device(s).", found_devices); - int try_num = 0; - while ((try_num < 5) && (found_wiimotes < max_wiimotes)) + // Display discovered devices + for (int i = 0; (i < found_devices) && (found_wiimotes.size() < max_wiimotes); ++i) { - inquiry_info scan_info_arr[128]; - inquiry_info* scan_info = scan_info_arr; - memset(&scan_info_arr, 0, sizeof(scan_info_arr)); - - // Scan for bluetooth devices for approximately one second - found_devices = hci_inquiry(device_id, 1, 128, NULL, &scan_info, IREQ_CACHE_FLUSH); - if (found_devices < 0) + ERROR_LOG(WIIMOTE, "found a device..."); + + // BT names are a maximum of 248 bytes apparently + char name[255] = {}; + if (hci_read_remote_name(device_sock, &scan_infos[i].bdaddr, sizeof(name), name, 0) < 0) { - ERROR_LOG(WIIMOTE, "Error searching for bluetooth devices."); - return found_wiimotes; + ERROR_LOG(WIIMOTE, "name request failed"); + continue; } - DEBUG_LOG(WIIMOTE, "Found %i bluetooth device(s).", found_devices); - - // Display discovered devices - for (i = 0; (i < found_devices) && (found_wiimotes < max_wiimotes); ++i) + ERROR_LOG(WIIMOTE, "device name %s", name); + if (IsValidBluetoothName(name)) { - char name[1000]; - memset(name, 0, sizeof(name)); - ERROR_LOG(WIIMOTE, "found a device..."); - if (hci_read_remote_name(device_sock, &scan_info[i].bdaddr, sizeof(name), name, 0) < 0) { - ERROR_LOG(WIIMOTE, "name request failed"); - continue; - } - ERROR_LOG(WIIMOTE, "device name %s", name); - if (IsValidBluetoothName(name)) + bool new_wiimote = true; + + // TODO: do this + + // Determine if this wiimote has already been found. + //for (int j = 0; j < MAX_WIIMOTES && new_wiimote; ++j) + //{ + // if (wm[j] && bacmp(&scan_infos[i].bdaddr,&wm[j]->bdaddr) == 0) + // new_wiimote = false; + //} + + if (new_wiimote) { - bool new_wiimote = true; - // Determine if this wiimote has already been found. - for (int j = 0; j < MAX_WIIMOTES && new_wiimote; ++j) - { - if (wm[j] && bacmp(&scan_info[i].bdaddr,&wm[j]->bdaddr) == 0) - new_wiimote = false; - } + // Found a new device + char bdaddr_str[18] = {}; + ba2str(&scan_infos[i].bdaddr, bdaddr_str); - if (new_wiimote) - { - // Find an unused slot - unsigned int k = 0; - for (; k < MAX_WIIMOTES && !(WIIMOTE_SRC_REAL & g_wiimote_sources[k] && !wm[k]); ++k); - wm[k] = new Wiimote(k); - - // Found a new device - char bdaddr_str[18]; - ba2str(&scan_info[i].bdaddr, bdaddr_str); - - NOTICE_LOG(WIIMOTE, "Found wiimote %i, (%s).", - wm[k]->index + 1, bdaddr_str); - - wm[k]->bdaddr = scan_info[i].bdaddr; - ++found_wiimotes; - } + auto* const wm = new Wiimote; + wm->bdaddr = scan_infos[i].bdaddr; + found_wiimotes.push_back(wm); + + NOTICE_LOG(WIIMOTE, "Found wiimote (%s).", bdaddr_str); } } - try_num++; } - close(device_sock); return found_wiimotes; } // Connect to a wiimote with a known address. -bool Wiimote::Connect() +bool Wiimote::Open() { - if (IsConnected()) - return false; - sockaddr_l2 addr; addr.l2_family = AF_BLUETOOTH; addr.l2_bdaddr = bdaddr; @@ -148,7 +141,7 @@ bool Wiimote::Connect() // Output channel addr.l2_psm = htobs(WM_OUTPUT_CHANNEL); if ((cmd_sock = socket(AF_BLUETOOTH, SOCK_SEQPACKET, BTPROTO_L2CAP)) == -1 || - connect(cmd_sock, (struct sockaddr*)&addr, sizeof(addr)) < 0) + connect(cmd_sock, (sockaddr*)&addr, sizeof(addr)) < 0) { DEBUG_LOG(WIIMOTE, "Unable to open output socket to wiimote."); close(cmd_sock); @@ -159,7 +152,7 @@ bool Wiimote::Connect() // Input channel addr.l2_psm = htobs(WM_INPUT_CHANNEL); if ((int_sock = socket(AF_BLUETOOTH, SOCK_SEQPACKET, BTPROTO_L2CAP)) == -1 || - connect(int_sock, (struct sockaddr*)&addr, sizeof(addr)) < 0) + connect(int_sock, (sockaddr*)&addr, sizeof(addr)) < 0) { DEBUG_LOG(WIIMOTE, "Unable to open input socket from wiimote."); close(int_sock); @@ -168,57 +161,37 @@ bool Wiimote::Connect() return false; } - NOTICE_LOG(WIIMOTE, "Connected to wiimote %i.", index + 1); - - m_connected = true; - - // Do the handshake - Handshake(); - - // Set LEDs - SetLEDs(WIIMOTE_LED_1 << index); - - m_wiimote_thread = std::thread(std::mem_fun(&Wiimote::ThreadFunc), this); - return true; } -// Disconnect a wiimote. -void Wiimote::RealDisconnect() +void Wiimote::StartThread() { - if (!IsConnected()) - return; - - NOTICE_LOG(WIIMOTE, "Disconnecting wiimote %i.", index + 1); - - m_connected = false; + m_run_thread = true; + m_wiimote_thread = std::thread(std::mem_fun(&Wiimote::ThreadFunc), this); +} +void Wiimote::StopThread() +{ + m_run_thread = false; if (m_wiimote_thread.joinable()) m_wiimote_thread.join(); - - Close(); } void Wiimote::Close() { - if (IsOpen()) - { - Host_ConnectWiimote(index, false); + close(cmd_sock); + close(int_sock); - close(cmd_sock); - close(int_sock); - - cmd_sock = -1; - int_sock = -1; - } + cmd_sock = -1; + int_sock = -1; } bool Wiimote::IsOpen() const { - return IsConnected() && cmd_sock != -1 && int_sock != -1; + return cmd_sock != -1;// && int_sock != -1; } -int Wiimote::IORead(unsigned char *buf) +int Wiimote::IORead(u8* buf) { // Block select for 1/2000th of a second timeval tv; @@ -232,11 +205,11 @@ int Wiimote::IORead(unsigned char *buf) if (select(int_sock + 1, &fds, NULL, NULL, &tv) == -1) { ERROR_LOG(WIIMOTE, "Unable to select wiimote %i input socket.", index + 1); - return 0; + return -1; } if (!FD_ISSET(int_sock, &fds)) - return 0; + return -1; // Read the pending message into the buffer int r = read(int_sock, buf, MAX_PAYLOAD); @@ -250,21 +223,15 @@ int Wiimote::IORead(unsigned char *buf) // This can happen if the bluetooth dongle is disconnected ERROR_LOG(WIIMOTE, "Bluetooth appears to be disconnected. " "Wiimote %i will be disconnected.", index + 1); - Close(); } - return 0; - } - else if (!r) - { - // Disconnect - Close(); + r = 0; } return r; } -int Wiimote::IOWrite(unsigned char* buf, int len) +int Wiimote::IOWrite(u8 const* buf, int len) { return write(int_sock, buf, len); } diff --git a/Source/Core/Core/Src/HW/WiimoteReal/WiimoteReal.cpp b/Source/Core/Core/Src/HW/WiimoteReal/WiimoteReal.cpp index 2381793f30..2735c1a312 100644 --- a/Source/Core/Core/Src/HW/WiimoteReal/WiimoteReal.cpp +++ b/Source/Core/Core/Src/HW/WiimoteReal/WiimoteReal.cpp @@ -23,6 +23,7 @@ #include "IniFile.h" #include "StringUtil.h" #include "Timer.h" +#include "Host.h" #include "WiimoteReal.h" @@ -33,15 +34,20 @@ unsigned int g_wiimote_sources[MAX_WIIMOTES]; namespace WiimoteReal { +void HandleFoundWiimotes(const std::vector&); +void HandleWiimoteConnect(Wiimote*); +void HandleWiimoteDisconnect(int index); + bool g_real_wiimotes_initialized = false; -unsigned int g_wiimotes_found = 0; -std::mutex g_refresh_lock; +std::recursive_mutex g_refresh_lock; -Wiimote *g_wiimotes[MAX_WIIMOTES]; +Wiimote* g_wiimotes[MAX_WIIMOTES]; -Wiimote::Wiimote(const unsigned int _index) - : index(_index) +WiimoteScanner g_wiimote_scanner; + +Wiimote::Wiimote() + : index() #ifdef __APPLE__ , inputlen(0) #elif defined(__linux__) && HAVE_BLUEZ @@ -49,8 +55,8 @@ Wiimote::Wiimote(const unsigned int _index) #elif defined(_WIN32) , dev_handle(0), stack(MSBT_STACK_UNKNOWN) #endif - , leds(0), m_last_data_report(Report((u8 *)NULL, 0)) - , m_channel(0), m_connected(false) + , m_last_data_report(Report((u8 *)NULL, 0)) + , m_channel(0), m_run_thread(false) { #if defined(__linux__) && HAVE_BLUEZ bdaddr = (bdaddr_t){{0, 0, 0, 0, 0, 0}}; @@ -61,8 +67,11 @@ Wiimote::Wiimote(const unsigned int _index) Wiimote::~Wiimote() { - RealDisconnect(); + StopThread(); + if (IsOpen()) + Close(); + ClearReadQueue(); // clear write queue @@ -111,7 +120,7 @@ void Wiimote::ControlChannel(const u16 channel, const void* const data, const u3 { // Check for custom communication if (99 == channel) - Disconnect(); + EmuStop(); else { InterruptChannel(channel, data, size); @@ -168,6 +177,9 @@ bool Wiimote::Read() rpt.first = new unsigned char[MAX_PAYLOAD]; rpt.second = IORead(rpt.first); + if (0 == rpt.second) + Close(); + if (rpt.second > 0 && m_channel > 0) { // Add it to queue m_read_reports.Push(rpt); @@ -234,24 +246,18 @@ void Wiimote::Update() delete[] rpt.first; } -void Wiimote::Disconnect() +void Wiimote::EmuStop() { m_channel = 0; DisableDataReporting(); -} -bool Wiimote::IsConnected() const -{ - return m_connected; + NOTICE_LOG(WIIMOTE, "Stopping wiimote data reporting"); } // Rumble briefly void Wiimote::Rumble() { - if (!IsConnected()) - return; - unsigned char buffer = 0x01; DEBUG_LOG(WIIMOTE, "Starting rumble..."); SendRequest(WM_CMD_RUMBLE, &buffer, 1); @@ -264,37 +270,29 @@ void Wiimote::Rumble() } // Set the active LEDs. -// leds is a bitwise or of WIIMOTE_LED_1 through WIIMOTE_LED_4. +// leds is a bitwise OR of WIIMOTE_LED_1 through WIIMOTE_LED_4. void Wiimote::SetLEDs(int new_leds) { - unsigned char buffer; - - if (!IsConnected()) - return; - // Remove the lower 4 bits because they control rumble - buffer = leds = (new_leds & 0xF0); - + u8 const buffer = (new_leds & 0xF0); SendRequest(WM_CMD_LED, &buffer, 1); } -// Send a handshake -bool Wiimote::Handshake() +bool Wiimote::EmuStart() { + // Send a handshake + // Set buffer[0] to 0x04 for continuous reporting - unsigned char buffer[2] = {0x04, 0x30}; + u8 const buffer[2] = {0x04, 0x30}; - if (!IsConnected()) - return 0; - - DEBUG_LOG(WIIMOTE, "Sending handshake to wiimote"); + NOTICE_LOG(WIIMOTE, "Sending handshake to wiimote"); return SendRequest(WM_CMD_REPORT_TYPE, buffer, 2); } // Send a packet to the wiimote. // report_type should be one of WIIMOTE_CMD_LED, WIIMOTE_CMD_RUMBLE, etc. -bool Wiimote::SendRequest(unsigned char report_type, unsigned char* data, int length) +bool Wiimote::SendRequest(u8 report_type, u8 const* data, int length) { unsigned char buffer[32] = {WM_SET_REPORT | WM_BT_OUTPUT, report_type}; @@ -303,59 +301,99 @@ bool Wiimote::SendRequest(unsigned char report_type, unsigned char* data, int le return (IOWrite(buffer, length + 2) != 0); } +unsigned int CalculateWantedWiimotes() +{ + // Figure out how many real wiimotes are required + unsigned int wanted_wiimotes = 0; + for (unsigned int i = 0; i < MAX_WIIMOTES; ++i) + if (WIIMOTE_SRC_REAL & g_wiimote_sources[i] && !g_wiimotes[i]) + ++wanted_wiimotes; + + return wanted_wiimotes; +} + +void WiimoteScanner::WantWiimotes(size_t count) +{ + want_wiimotes = count; +} + +void WiimoteScanner::StartScanning() +{ + run_thread = true; + scan_thread = std::thread(std::mem_fun(&WiimoteScanner::ThreadFunc), this); +} + +void WiimoteScanner::StopScanning() +{ + run_thread = false; + if (scan_thread.joinable()) + { + scan_thread.join(); + NOTICE_LOG(WIIMOTE, "Wiimote scanning has stopped"); + } +} + +void WiimoteScanner::ThreadFunc() +{ + Common::SetCurrentThreadName("Wiimote Scanning Thread"); + + NOTICE_LOG(WIIMOTE, "Wiimote scanning has started"); + + while (run_thread) + { + auto const found_wiimotes = FindWiimotes(want_wiimotes); + HandleFoundWiimotes(found_wiimotes); +#if 1 + { + // TODO: this code here is ugly + std::lock_guard lk(g_refresh_lock); + for (unsigned int i = 0; i != MAX_WIIMOTES; ++i) + if (g_wiimotes[i] && !g_wiimotes[i]->IsOpen()) + HandleWiimoteDisconnect(i); + } +#endif + //std::this_thread::yield(); + Common::SleepCurrentThread(500); + } +} + void Wiimote::ThreadFunc() { - char thname[] = "Wiimote # Thread"; - thname[8] = (char)('1' + index); - Common::SetCurrentThreadName(thname); + Common::SetCurrentThreadName("Wiimote Device Thread"); // rumble briefly Rumble(); // main loop - while (IsOpen()) + while (m_run_thread && IsOpen()) { #ifdef __APPLE__ while (Write()) {} Common::SleepCurrentThread(1); #else - bool read = false; - while (Write() || (read = true, IsOpen() && Read())) + // TODO: this is all a mess + while (m_run_thread && IsOpen()) { - if (m_audio_reports.Size() && !read) - Read(); - Common::SleepCurrentThread(m_audio_reports.Size() ? 5 : 2); - read = false; + bool const did_write = Write(); + + if (did_write) + break; + else + if (!Read()) + break; + + // TODO: what is this doing? + //if (m_audio_reports.Size() && did_write) + // Read(); + + // TODO: make work well + //Common::SleepCurrentThread(m_audio_reports.Size() ? 5 : 2); + Common::SleepCurrentThread(2); } #endif } } -#ifndef _WIN32 -// Connect all discovered wiimotes -// Return the number of wiimotes that successfully connected. -static int ConnectWiimotes(Wiimote** wm) -{ - int connected = 0; - - for (int i = 0; i < MAX_WIIMOTES; ++i) - { - if (!wm[i] || wm[i]->IsConnected()) - continue; - - if (wm[i]->Connect()) - ++connected; - else - { - delete wm[i]; - wm[i] = NULL; - } - } - - return connected; -} -#endif - void LoadSettings() { std::string ini_filename = File::GetUserPath(D_CONFIG_IDX) + WIIMOTE_INI_NAME ".ini"; @@ -373,71 +411,124 @@ void LoadSettings() } } -unsigned int Initialize() +void Initialize() { - // Return if already initialized + NOTICE_LOG(WIIMOTE, "WiimoteReal::Initialize"); + + std::lock_guard lk(g_refresh_lock); + if (g_real_wiimotes_initialized) - return g_wiimotes_found; + return; - memset(g_wiimotes, 0, sizeof(g_wiimotes)); + auto const wanted_wiimotes = CalculateWantedWiimotes(); + g_wiimote_scanner.WantWiimotes(wanted_wiimotes); - // Only call FindWiimotes with the number of slots configured for real wiimotes - unsigned int wanted_wiimotes = 0; - for (unsigned int i = 0; i < MAX_WIIMOTES; ++i) - if (WIIMOTE_SRC_REAL & g_wiimote_sources[i]) - ++wanted_wiimotes; + //if (wanted_wiimotes > 0) + g_wiimote_scanner.StartScanning(); - // Don't bother initializing if we don't want any real wiimotes - if (0 == wanted_wiimotes) - { - g_wiimotes_found = 0; - return 0; - } - - // Initialized g_real_wiimotes_initialized = true; - - g_wiimotes_found = FindWiimotes(g_wiimotes, wanted_wiimotes); - - DEBUG_LOG(WIIMOTE, "Found %i Real Wiimotes, %i wanted", - g_wiimotes_found, wanted_wiimotes); - -#ifndef _WIN32 - atexit(WiimoteReal::Shutdown); - g_wiimotes_found = ConnectWiimotes(g_wiimotes); -#endif - - DEBUG_LOG(WIIMOTE, "Connected to %i Real Wiimotes", g_wiimotes_found); - - return g_wiimotes_found; } void Shutdown(void) { - if (false == g_real_wiimotes_initialized) + NOTICE_LOG(WIIMOTE, "WiimoteReal::Shutdown"); + + g_wiimote_scanner.StopScanning(); + + std::lock_guard lk(g_refresh_lock); + + if (!g_real_wiimotes_initialized) return; - // Uninitialized g_real_wiimotes_initialized = false; - // Delete wiimotes for (unsigned int i = 0; i < MAX_WIIMOTES; ++i) - if (g_wiimotes[i]) + HandleWiimoteDisconnect(i); +} + +void ChangeWiimoteSource(unsigned int index, int source) +{ + std::lock_guard lk(g_refresh_lock); + + g_wiimote_sources[index] = source; + + // source is emulated, kill any real connection + if (!(WIIMOTE_SRC_REAL & g_wiimote_sources[index])) + HandleWiimoteDisconnect(index); + + auto const wanted_wiimotes = CalculateWantedWiimotes(); + g_wiimote_scanner.WantWiimotes(wanted_wiimotes); +} + +void HandleWiimoteConnect(Wiimote* wm) +{ + std::lock_guard lk(g_refresh_lock); + + for (unsigned int i = 0; i != MAX_WIIMOTES; ++i) + { + if (WIIMOTE_SRC_REAL & g_wiimote_sources[i] && !g_wiimotes[i]) { - delete g_wiimotes[i]; - g_wiimotes[i] = NULL; + g_wiimotes[i] = wm; + + wm->index = i; + wm->StartThread(); + wm->SetLEDs(WIIMOTE_LED_1 << i); + + Host_ConnectWiimote(i, true); + + NOTICE_LOG(WIIMOTE, "Connected to wiimote %i.", i + 1); + + wm = NULL; + break; } + } + + delete wm; + + auto const want_wiimotes = CalculateWantedWiimotes(); + g_wiimote_scanner.WantWiimotes(want_wiimotes); +} + +void HandleWiimoteDisconnect(int index) +{ + // locked above + //std::lock_guard lk(g_refresh_lock); + + Host_ConnectWiimote(index, false); + + if (g_wiimotes[index]) + { + delete g_wiimotes[index]; + g_wiimotes[index] = NULL; + + NOTICE_LOG(WIIMOTE, "Disconnected wiimote %i.", index + 1); + } + + auto const want_wiimotes = CalculateWantedWiimotes(); + g_wiimote_scanner.WantWiimotes(want_wiimotes); +} + +void HandleFoundWiimotes(const std::vector& wiimotes) +{ + std::for_each(wiimotes.begin(), wiimotes.end(), [](Wiimote* const wm) + { + if (wm->Open()) + HandleWiimoteConnect(wm); + else + delete wm; + }); } // This is called from the GUI thread void Refresh() { - std::lock_guard lk(g_refresh_lock); + std::lock_guard lk(g_refresh_lock); #ifdef _WIN32 Shutdown(); Initialize(); #else +/* // Make sure real wiimotes have been initialized if (!g_real_wiimotes_initialized) { @@ -477,12 +568,13 @@ void Refresh() g_wiimotes_found = num_wiimotes; } +*/ #endif } void InterruptChannel(int _WiimoteNumber, u16 _channelID, const void* _pData, u32 _Size) { - std::lock_guard lk(g_refresh_lock); + std::lock_guard lk(g_refresh_lock); if (g_wiimotes[_WiimoteNumber]) g_wiimotes[_WiimoteNumber]->InterruptChannel(_channelID, _pData, _Size); @@ -490,7 +582,7 @@ void InterruptChannel(int _WiimoteNumber, u16 _channelID, const void* _pData, u3 void ControlChannel(int _WiimoteNumber, u16 _channelID, const void* _pData, u32 _Size) { - std::lock_guard lk(g_refresh_lock); + std::lock_guard lk(g_refresh_lock); if (g_wiimotes[_WiimoteNumber]) g_wiimotes[_WiimoteNumber]->ControlChannel(_channelID, _pData, _Size); @@ -500,7 +592,7 @@ void ControlChannel(int _WiimoteNumber, u16 _channelID, const void* _pData, u32 // Read the Wiimote once void Update(int _WiimoteNumber) { - std::lock_guard lk(g_refresh_lock); + std::lock_guard lk(g_refresh_lock); if (g_wiimotes[_WiimoteNumber]) g_wiimotes[_WiimoteNumber]->Update(); @@ -508,7 +600,7 @@ void Update(int _WiimoteNumber) void StateChange(EMUSTATE_CHANGE newState) { - //std::lock_guard lk(g_refresh_lock); + //std::lock_guard lk(g_refresh_lock); // TODO: disable/enable auto reporting, maybe } diff --git a/Source/Core/Core/Src/HW/WiimoteReal/WiimoteReal.h b/Source/Core/Core/Src/HW/WiimoteReal/WiimoteReal.h index 9fdb305a56..5f8206bf14 100644 --- a/Source/Core/Core/Src/HW/WiimoteReal/WiimoteReal.h +++ b/Source/Core/Core/Src/HW/WiimoteReal/WiimoteReal.h @@ -20,6 +20,7 @@ #define WIIMOTE_REAL_H #include +#include #include "WiimoteRealBase.h" #include "ChunkFile.h" @@ -41,7 +42,7 @@ class Wiimote : NonCopyable { friend class WiimoteEmu::Wiimote; public: - Wiimote(const unsigned int _index); + Wiimote(); ~Wiimote(); void ControlChannel(const u16 channel, const void* const data, const u32 size); @@ -52,16 +53,28 @@ public: bool Read(); bool Write(); - bool Connect(); - bool IsConnected() const; + + void StartThread(); + void StopThread(); + + // "handshake" / stop packets + bool EmuStart(); + void EmuStop(); + + // connecting and disconnecting from physical devices + bool Open(); + void Close(); + + // TODO: change to something like IsRelevant bool IsOpen() const; - void Disconnect(); + + void SetLEDs(int leds); + void DisableDataReporting(); void Rumble(); void SendPacket(const u8 rpt_id, const void* const data, const unsigned int size); - void RealDisconnect(); - const unsigned int index; + int index; #if defined(__APPLE__) IOBluetoothDevice *btd; @@ -74,8 +87,6 @@ public: int cmd_sock; // Command socket int int_sock; // Interrupt socket - void Close(); - #elif defined(_WIN32) char devicepath[255]; // Unique wiimote reference //ULONGLONG btaddr; // Bluetooth address @@ -83,7 +94,6 @@ public: OVERLAPPED hid_overlap; // Overlap handle enum win_bt_stack_t stack; // Type of bluetooth stack to use #endif - unsigned char leds; // Currently lit leds protected: Report m_last_data_report; @@ -91,21 +101,51 @@ protected: private: void ClearReadQueue(); - bool SendRequest(unsigned char report_type, unsigned char* data, int length); - bool Handshake(); - void SetLEDs(int leds); - int IORead(unsigned char* buf); - int IOWrite(unsigned char* buf, int len); + bool SendRequest(u8 report_type, u8 const* data, int length); + + int IORead(u8* buf); + int IOWrite(u8 const* buf, int len); + void ThreadFunc(); - bool m_connected; + bool m_run_thread; std::thread m_wiimote_thread; + Common::FifoQueue m_read_reports; Common::FifoQueue m_write_reports; Common::FifoQueue m_audio_reports; }; -extern std::mutex g_refresh_lock; +class WiimoteScanner +{ +public: + WiimoteScanner(); + ~WiimoteScanner(); + + bool IsReady() const; + + void WantWiimotes(size_t count); + + void StartScanning(); + void StopScanning(); + + std::vector FindWiimotes(size_t max_wiimotes); + +private: + void ThreadFunc(); + + std::thread scan_thread; + + volatile bool run_thread; + + // TODO: this should probably be atomic + volatile size_t want_wiimotes; + + int device_id; + int device_sock; +}; + +extern std::recursive_mutex g_refresh_lock; extern Wiimote *g_wiimotes[4]; void InterruptChannel(int _WiimoteNumber, u16 _channelID, const void* _pData, u32 _Size); @@ -116,6 +156,7 @@ void DoState(PointerWrap &p); void StateChange(EMUSTATE_CHANGE newState); int FindWiimotes(Wiimote** wm, int max_wiimotes); +void ChangeWiimoteSource(unsigned int index, int source); bool IsValidBluetoothName(const std::string& name); diff --git a/Source/Core/DolphinWX/Src/WiimoteConfigDiag.cpp b/Source/Core/DolphinWX/Src/WiimoteConfigDiag.cpp index ea23e532e7..ba2186d17a 100644 --- a/Source/Core/DolphinWX/Src/WiimoteConfigDiag.cpp +++ b/Source/Core/DolphinWX/Src/WiimoteConfigDiag.cpp @@ -4,11 +4,12 @@ #include "HW/WiimoteReal/WiimoteReal.h" #include "Frame.h" -const wxString& ConnectedWiimotesString() +wxString ConnectedWiimotesString() { - static wxString str; - str.Printf(_("%i connected"), WiimoteReal::Initialize()); - return str; + //static wxString str; + //str.Printf(_("%i connected"), WiimoteReal::Initialize()); + //return str; + return "TODO: this text"; } WiimoteConfigDiag::WiimoteConfigDiag(wxWindow* const parent, InputPlugin& plugin) @@ -222,13 +223,16 @@ void WiimoteConfigDiag::SelectSource(wxCommandEvent& event) // This needs to be changed now in order for refresh to work right. // Revert if the dialog is canceled. int index = m_wiimote_index_from_ctrl_id[event.GetId()]; - g_wiimote_sources[index] = event.GetInt(); + + WiimoteReal::ChangeWiimoteSource(index, event.GetInt()); + if (g_wiimote_sources[index] != WIIMOTE_SRC_EMU && g_wiimote_sources[index] != WIIMOTE_SRC_HYBRID) wiimote_configure_bt[index]->Disable(); else wiimote_configure_bt[index]->Enable(); } +// TODO: race conditiions void WiimoteConfigDiag::UpdateWiimoteStatus() { for (int index = 0; index < 4; ++index) @@ -241,7 +245,7 @@ void WiimoteConfigDiag::UpdateWiimoteStatus() if (WIIMOTE_SRC_EMU & g_wiimote_sources[index]) CFrame::ConnectWiimote(index, true); else if (WIIMOTE_SRC_REAL & g_wiimote_sources[index] && WiimoteReal::g_wiimotes[index]) - CFrame::ConnectWiimote(index, WiimoteReal::g_wiimotes[index]->IsConnected()); + CFrame::ConnectWiimote(index, WiimoteReal::g_wiimotes[index]->IsOpen()); } } } From 54497be653dfdf2de558426cf460a8b8a96bd524 Mon Sep 17 00:00:00 2001 From: Jordan Woyak Date: Tue, 15 Jan 2013 22:57:25 -0600 Subject: [PATCH 02/49] Untested Windows buildfix attempt. --- .../Core/Core/Src/HW/WiimoteReal/IODummy.cpp | 16 +- Source/Core/Core/Src/HW/WiimoteReal/IONix.cpp | 6 +- Source/Core/Core/Src/HW/WiimoteReal/IOWin.cpp | 213 ++++++++---------- .../Core/Core/Src/HW/WiimoteReal/IOdarwin.mm | 19 +- .../Core/Src/HW/WiimoteReal/WiimoteReal.cpp | 14 +- .../Core/Src/HW/WiimoteReal/WiimoteReal.h | 13 +- .../Core/DolphinWX/Src/WiimoteConfigDiag.cpp | 2 +- 7 files changed, 139 insertions(+), 144 deletions(-) diff --git a/Source/Core/Core/Src/HW/WiimoteReal/IODummy.cpp b/Source/Core/Core/Src/HW/WiimoteReal/IODummy.cpp index 49afee8ad1..b22f1c7795 100644 --- a/Source/Core/Core/Src/HW/WiimoteReal/IODummy.cpp +++ b/Source/Core/Core/Src/HW/WiimoteReal/IODummy.cpp @@ -21,9 +21,19 @@ namespace WiimoteReal { -int FindWiimotes(Wiimote **wm, int max_wiimotes) +WiimoteScanner::WiimoteScanner() { - return 0; + return; +} + +std::vector WiimoteScanner::FindWiimotes(size_t max_wiimotes) +{ + return std::vector() +} + +bool WiimoteScanner::IsReady() const +{ + return false; } bool Wiimote::Connect() @@ -31,7 +41,7 @@ bool Wiimote::Connect() return 0; } -void Wiimote::RealDisconnect() +void Wiimote::Disconnect() { return; } diff --git a/Source/Core/Core/Src/HW/WiimoteReal/IONix.cpp b/Source/Core/Core/Src/HW/WiimoteReal/IONix.cpp index 82630aaebb..24e25e9a2b 100644 --- a/Source/Core/Core/Src/HW/WiimoteReal/IONix.cpp +++ b/Source/Core/Core/Src/HW/WiimoteReal/IONix.cpp @@ -131,7 +131,7 @@ std::vector WiimoteScanner::FindWiimotes(size_t max_wiimotes) } // Connect to a wiimote with a known address. -bool Wiimote::Open() +bool Wiimote::Connect() { sockaddr_l2 addr; addr.l2_family = AF_BLUETOOTH; @@ -177,7 +177,7 @@ void Wiimote::StopThread() m_wiimote_thread.join(); } -void Wiimote::Close() +void Wiimote::Disconnect() { close(cmd_sock); close(int_sock); @@ -186,7 +186,7 @@ void Wiimote::Close() int_sock = -1; } -bool Wiimote::IsOpen() const +bool Wiimote::IsConnected() const { return cmd_sock != -1;// && int_sock != -1; } diff --git a/Source/Core/Core/Src/HW/WiimoteReal/IOWin.cpp b/Source/Core/Core/Src/HW/WiimoteReal/IOWin.cpp index cc05bc10e1..f862193ff9 100644 --- a/Source/Core/Core/Src/HW/WiimoteReal/IOWin.cpp +++ b/Source/Core/Core/Src/HW/WiimoteReal/IOWin.cpp @@ -127,12 +127,21 @@ inline void init_lib() namespace WiimoteReal { +WiimoteScanner::WiimoteScanner() +{ + init_lib(); +} + // Find and connect wiimotes. // Does not replace already found wiimotes even if they are disconnected. // wm is an array of max_wiimotes wiimotes // Returns the total number of found and connected wiimotes. -int FindWiimotes(Wiimote** wm, int max_wiimotes) +std::vector WiimoteScanner::FindWiimotes(size_t max_wiimotes) { + PairUp(); + + std::vector wiimotes; + GUID device_id; HANDLE dev; HDEVINFO device_info; @@ -142,8 +151,6 @@ int FindWiimotes(Wiimote** wm, int max_wiimotes) PSP_DEVICE_INTERFACE_DETAIL_DATA detail_data = NULL; HIDD_ATTRIBUTES attr; - init_lib(); - // Count the number of already found wiimotes for (int i = 0; i < MAX_WIIMOTES; ++i) { @@ -207,22 +214,11 @@ int FindWiimotes(Wiimote** wm, int max_wiimotes) // Find an unused slot unsigned int k = 0; - for (; k < MAX_WIIMOTES && !(WIIMOTE_SRC_REAL & g_wiimote_sources[k] && !wm[k]); ++k); - wm[k] = new Wiimote(k); - wm[k]->dev_handle = dev; - memcpy(wm[k]->devicepath, detail_data->DevicePath, 197); + auto const wm = new Wiimote; + wm->dev_handle = dev; + memcpy(wm->devicepath, detail_data->DevicePath, 197); - if (!wm[k]->Connect()) - { - ERROR_LOG(WIIMOTE, "Unable to connect to wiimote %i.", wm[k]->index + 1); - delete wm[k]; - wm[k] = NULL; - CloseHandle(dev); - } - else - { - ++found_wiimotes; - } + found_wiimotes.push_back(wm); } if (detail_data) @@ -233,87 +229,64 @@ int FindWiimotes(Wiimote** wm, int max_wiimotes) return found_wiimotes; } +bool WiimoteScanner::IsReady() const +{ + // TODO: impl + return true; +} + // Connect to a wiimote with a known device path. bool Wiimote::Connect() { - if (IsConnected()) return false; + dev_handle = CreateFile(devicepath, + (GENERIC_READ | GENERIC_WRITE), + (FILE_SHARE_READ | FILE_SHARE_WRITE), + NULL, OPEN_EXISTING, FILE_FLAG_OVERLAPPED, NULL); - if (!dev_handle) + if (dev_handle == INVALID_HANDLE_VALUE) { - dev_handle = CreateFile(devicepath, - (GENERIC_READ | GENERIC_WRITE), - (FILE_SHARE_READ | FILE_SHARE_WRITE), - NULL, OPEN_EXISTING, FILE_FLAG_OVERLAPPED, NULL); - if (dev_handle == INVALID_HANDLE_VALUE) - return false; + dev_handle = 0; + return false; } hid_overlap.hEvent = CreateEvent(NULL, 1, 1, _T("")); hid_overlap.Offset = 0; hid_overlap.OffsetHigh = 0; - m_connected = true; - - // Try a handshake to see if the device is actually connected - if (!Handshake()) - { - m_connected = false; - return false; - } - - // Set LEDs - SetLEDs(WIIMOTE_LED_1 << index); - - m_wiimote_thread = std::thread(std::mem_fun(&Wiimote::ThreadFunc), this); - + // TODO: do this elsewhere // This isn't as drastic as it sounds, since the process in which the threads // reside is normal priority. Needed for keeping audio reports at a decent rate +/* if (!SetThreadPriority(m_wiimote_thread.native_handle(), THREAD_PRIORITY_TIME_CRITICAL)) { ERROR_LOG(WIIMOTE, "Failed to set wiimote thread priority"); } - - NOTICE_LOG(WIIMOTE, "Connected to wiimote %i.", index + 1); +*/ return true; } -void Wiimote::RealDisconnect() +void Wiimote::Disconnect() { - if (!IsConnected()) - return; - - m_connected = false; - - if (m_wiimote_thread.joinable()) - m_wiimote_thread.join(); - CloseHandle(dev_handle); dev_handle = 0; - ResetEvent(&hid_overlap); + //ResetEvent(&hid_overlap); + CloseHandle(hid_overlap.hEvent); } -bool Wiimote::IsOpen() const +bool Wiimote::IsConnected() const { - return IsConnected(); + return dev_handle != 0; } int Wiimote::IORead(unsigned char* buf) { - DWORD b, r; - - init_lib(); - - if (!IsConnected()) - return 0; - - *buf = 0; + //*buf = 0; if (!ReadFile(dev_handle, buf, MAX_PAYLOAD, &b, &hid_overlap)) { // Partial read - b = GetLastError(); - + auto const b = GetLastError(); if ((b == ERROR_HANDLE_EOF) || (b == ERROR_DEVICE_NOT_CONNECTED)) { // Remote disconnect @@ -321,7 +294,7 @@ int Wiimote::IORead(unsigned char* buf) return 0; } - r = WaitForSingleObject(hid_overlap.hEvent, WIIMOTE_DEFAULT_TIMEOUT); + auto const r = WaitForSingleObject(hid_overlap.hEvent, WIIMOTE_DEFAULT_TIMEOUT); if (r == WAIT_TIMEOUT) { // Timeout - cancel and continue @@ -357,77 +330,71 @@ int Wiimote::IORead(unsigned char* buf) int Wiimote::IOWrite(unsigned char* buf, int len) { - DWORD bytes, dw; - int i; - - init_lib(); - - if (!IsConnected()) - return 0; - switch (stack) { - case MSBT_STACK_UNKNOWN: - { - // Try to auto-detect the stack type - if (i = WriteFile(dev_handle, buf + 1, 22, &bytes, &hid_overlap)) - { - // Bluesoleil will always return 1 here, even if it's not connected - stack = MSBT_STACK_BLUESOLEIL; - return i; - } - - if (i = HidD_SetOutputReport(dev_handle, buf + 1, len - 1)) - { - stack = MSBT_STACK_MS; - return i; - } - - dw = GetLastError(); - // Checking for 121 = timeout on semaphore/device off/disconnected to - // avoid trouble with other stacks toshiba/widcomm - if (dw == 121) - { - NOTICE_LOG(WIIMOTE, "IOWrite[MSBT_STACK_UNKNOWN]: Timeout"); - RealDisconnect(); - } - else ERROR_LOG(WIIMOTE, - "IOWrite[MSBT_STACK_UNKNOWN]: ERROR: %08x", dw); - return 0; - } - - case MSBT_STACK_MS: - i = HidD_SetOutputReport(dev_handle, buf + 1, len - 1); - dw = GetLastError(); - - if (dw == 121) - { - // Semaphore timeout - NOTICE_LOG(WIIMOTE, "WiimoteIOWrite[MSBT_STACK_MS]: Unable to send data to wiimote"); - RealDisconnect(); - return 0; - } + case MSBT_STACK_UNKNOWN: + { + // Try to auto-detect the stack type + DWORD bytes = 0; + auto i = WriteFile(dev_handle, buf + 1, 22, &bytes, &hid_overlap); + if (i) + { + // Bluesoleil will always return 1 here, even if it's not connected + stack = MSBT_STACK_BLUESOLEIL; return i; + } - case MSBT_STACK_BLUESOLEIL: - return WriteFile(dev_handle, buf + 1, 22, &bytes, &hid_overlap); + i = HidD_SetOutputReport(dev_handle, buf + 1, len - 1); + if (i) + { + stack = MSBT_STACK_MS; + return i; + } + + auto const dw = GetLastError(); + // Checking for 121 = timeout on semaphore/device off/disconnected to + // avoid trouble with other stacks toshiba/widcomm + if (dw == 121) + { + NOTICE_LOG(WIIMOTE, "IOWrite[MSBT_STACK_UNKNOWN]: Timeout"); + return 0; + } + else + { + ERROR_LOG(WIIMOTE, "IOWrite[MSBT_STACK_UNKNOWN]: ERROR: %08x", dw); + // Correct? + return -1 + } + break; + } + case MSBT_STACK_MS: + { + i = HidD_SetOutputReport(dev_handle, buf + 1, len - 1); + dw = GetLastError(); + + if (dw == 121) + { + // Semaphore timeout + NOTICE_LOG(WIIMOTE, "WiimoteIOWrite[MSBT_STACK_MS]: Unable to send data to wiimote"); + RealDisconnect(); + return 0; + } + + return i; + break; + } + case MSBT_STACK_BLUESOLEIL: + return WriteFile(dev_handle, buf + 1, 22, &bytes, &hid_overlap); + break; } return 0; } -int UnPair() -{ - // TODO: - return 0; -} - // WiiMote Pair-Up, function will return amount of either new paired or unpaired devices // negative number on failure int PairUp(bool unpair) { - init_lib(); - // match strings like "Nintendo RVL-WBC-01", "Nintendo RVL-CNT-01", "Nintendo RVL-CNT-01-TR" const std::wregex wiimote_device_name(L"Nintendo RVL-\\w{3}-\\d{2}(-\\w{2})?"); diff --git a/Source/Core/Core/Src/HW/WiimoteReal/IOdarwin.mm b/Source/Core/Core/Src/HW/WiimoteReal/IOdarwin.mm index 64de880180..95068fe650 100644 --- a/Source/Core/Core/Src/HW/WiimoteReal/IOdarwin.mm +++ b/Source/Core/Core/Src/HW/WiimoteReal/IOdarwin.mm @@ -10,6 +10,19 @@ } @end +WiimoteScanner::WiimoteScanner() +{} + +std::vector WiimoteScanner::FindWiimotes(size_t max_wiimotes) +{ + return std::vector(); +} + +bool WiimoteScanner::IsReady() const +{ + return false; +} + @implementation SearchBT - (void) deviceInquiryComplete: (IOBluetoothDeviceInquiry *) sender error: (IOReturn) error @@ -92,7 +105,7 @@ WARN_LOG(WIIMOTE, "Lost channel to wiimote %i", wm->index + 1); - wm->RealDisconnect(); + wm->Disconnect(); } @end @@ -182,7 +195,7 @@ bool Wiimote::Connect() if (ichan == NULL || cchan == NULL) { ERROR_LOG(WIIMOTE, "Unable to open L2CAP channels " "for wiimote %i", index + 1); - RealDisconnect(); + Disconnect(); return false; } @@ -207,7 +220,7 @@ bool Wiimote::Connect() } // Disconnect a wiimote. -void Wiimote::RealDisconnect() +void Wiimote::Disconnect() { if (!IsConnected()) return; diff --git a/Source/Core/Core/Src/HW/WiimoteReal/WiimoteReal.cpp b/Source/Core/Core/Src/HW/WiimoteReal/WiimoteReal.cpp index 2735c1a312..d25a78490d 100644 --- a/Source/Core/Core/Src/HW/WiimoteReal/WiimoteReal.cpp +++ b/Source/Core/Core/Src/HW/WiimoteReal/WiimoteReal.cpp @@ -69,8 +69,8 @@ Wiimote::~Wiimote() { StopThread(); - if (IsOpen()) - Close(); + if (IsConnected()) + Disconnect(); ClearReadQueue(); @@ -178,7 +178,7 @@ bool Wiimote::Read() rpt.second = IORead(rpt.first); if (0 == rpt.second) - Close(); + Disconnect(); if (rpt.second > 0 && m_channel > 0) { // Add it to queue @@ -348,7 +348,7 @@ void WiimoteScanner::ThreadFunc() // TODO: this code here is ugly std::lock_guard lk(g_refresh_lock); for (unsigned int i = 0; i != MAX_WIIMOTES; ++i) - if (g_wiimotes[i] && !g_wiimotes[i]->IsOpen()) + if (g_wiimotes[i] && !g_wiimotes[i]->IsConnected()) HandleWiimoteDisconnect(i); } #endif @@ -365,14 +365,14 @@ void Wiimote::ThreadFunc() Rumble(); // main loop - while (m_run_thread && IsOpen()) + while (m_run_thread && IsConnected()) { #ifdef __APPLE__ while (Write()) {} Common::SleepCurrentThread(1); #else // TODO: this is all a mess - while (m_run_thread && IsOpen()) + while (m_run_thread && IsConnected()) { bool const did_write = Write(); @@ -512,7 +512,7 @@ void HandleFoundWiimotes(const std::vector& wiimotes) { std::for_each(wiimotes.begin(), wiimotes.end(), [](Wiimote* const wm) { - if (wm->Open()) + if (wm->Connect()) HandleWiimoteConnect(wm); else delete wm; diff --git a/Source/Core/Core/Src/HW/WiimoteReal/WiimoteReal.h b/Source/Core/Core/Src/HW/WiimoteReal/WiimoteReal.h index 5f8206bf14..4c65768666 100644 --- a/Source/Core/Core/Src/HW/WiimoteReal/WiimoteReal.h +++ b/Source/Core/Core/Src/HW/WiimoteReal/WiimoteReal.h @@ -62,11 +62,11 @@ public: void EmuStop(); // connecting and disconnecting from physical devices - bool Open(); - void Close(); + bool Connect(); + void Disconnect(); // TODO: change to something like IsRelevant - bool IsOpen() const; + bool IsConnected() const; void SetLEDs(int leds); @@ -141,8 +141,13 @@ private: // TODO: this should probably be atomic volatile size_t want_wiimotes; +#if defined(_WIN32) + + +#elif defined(__linux__) && HAVE_BLUEZ int device_id; - int device_sock; + int device_sock; +#endif }; extern std::recursive_mutex g_refresh_lock; diff --git a/Source/Core/DolphinWX/Src/WiimoteConfigDiag.cpp b/Source/Core/DolphinWX/Src/WiimoteConfigDiag.cpp index ba2186d17a..b259cde2b9 100644 --- a/Source/Core/DolphinWX/Src/WiimoteConfigDiag.cpp +++ b/Source/Core/DolphinWX/Src/WiimoteConfigDiag.cpp @@ -245,7 +245,7 @@ void WiimoteConfigDiag::UpdateWiimoteStatus() if (WIIMOTE_SRC_EMU & g_wiimote_sources[index]) CFrame::ConnectWiimote(index, true); else if (WIIMOTE_SRC_REAL & g_wiimote_sources[index] && WiimoteReal::g_wiimotes[index]) - CFrame::ConnectWiimote(index, WiimoteReal::g_wiimotes[index]->IsOpen()); + CFrame::ConnectWiimote(index, WiimoteReal::g_wiimotes[index]->IsConnected()); } } } From 62f56eb731fa66f8613438777d13941626be3fa5 Mon Sep 17 00:00:00 2001 From: Jordan Woyak Date: Tue, 15 Jan 2013 23:05:30 -0600 Subject: [PATCH 03/49] Sloppily fix wiimotes not being connected after boot. --- Source/Core/Core/Src/HW/WiimoteReal/WiimoteReal.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Source/Core/Core/Src/HW/WiimoteReal/WiimoteReal.cpp b/Source/Core/Core/Src/HW/WiimoteReal/WiimoteReal.cpp index d25a78490d..516fa3a51e 100644 --- a/Source/Core/Core/Src/HW/WiimoteReal/WiimoteReal.cpp +++ b/Source/Core/Core/Src/HW/WiimoteReal/WiimoteReal.cpp @@ -596,6 +596,8 @@ void Update(int _WiimoteNumber) if (g_wiimotes[_WiimoteNumber]) g_wiimotes[_WiimoteNumber]->Update(); + else + Host_ConnectWiimote(_WiimoteNumber, false); } void StateChange(EMUSTATE_CHANGE newState) From 246b11791bb415060eba52ee415c116ea64322ff Mon Sep 17 00:00:00 2001 From: Jordan Woyak Date: Wed, 16 Jan 2013 16:14:23 -0600 Subject: [PATCH 04/49] More attempts at a Windows buildfix. --- Source/Core/Core/Src/HW/WiimoteReal/IOWin.cpp | 43 ++++++++++--------- .../Core/DolphinWX/Src/WiimoteConfigDiag.cpp | 24 ++--------- Source/Core/DolphinWX/Src/WiimoteConfigDiag.h | 3 -- 3 files changed, 25 insertions(+), 45 deletions(-) diff --git a/Source/Core/Core/Src/HW/WiimoteReal/IOWin.cpp b/Source/Core/Core/Src/HW/WiimoteReal/IOWin.cpp index f862193ff9..e285a33729 100644 --- a/Source/Core/Core/Src/HW/WiimoteReal/IOWin.cpp +++ b/Source/Core/Core/Src/HW/WiimoteReal/IOWin.cpp @@ -151,13 +151,6 @@ std::vector WiimoteScanner::FindWiimotes(size_t max_wiimotes) PSP_DEVICE_INTERFACE_DETAIL_DATA detail_data = NULL; HIDD_ATTRIBUTES attr; - // Count the number of already found wiimotes - for (int i = 0; i < MAX_WIIMOTES; ++i) - { - if (wm[i]) - found_wiimotes++; - } - device_data.cbSize = sizeof(device_data); // Get the device id @@ -187,19 +180,6 @@ std::vector WiimoteScanner::FindWiimotes(size_t max_wiimotes) if (!SetupDiGetDeviceInterfaceDetail(device_info, &device_data, detail_data, len, NULL, NULL)) continue; - // Determine if this wiimote has already been found. - bool found = false; - for(int i = 0; i < MAX_WIIMOTES; i++) - { - if(wm[i] && strcmp(wm[i]->devicepath, detail_data->DevicePath) == 0) - { - found = true; - break; - } - } - if (found) - continue; - // Open new device dev = CreateFile(detail_data->DevicePath, (GENERIC_READ | GENERIC_WRITE), @@ -391,6 +371,26 @@ int Wiimote::IOWrite(unsigned char* buf, int len) return 0; } +// return true if a device using MS BT stack is available +bool CanPairUp() +{ + BLUETOOTH_FIND_RADIO_PARAMS radioParam; + radioParam.dwSize = sizeof(radioParam); + + HANDLE hRadio; + HBLUETOOTH_RADIO_FIND hFindRadio = Bth_BluetoothFindFirstRadio(&radioParam, &hRadio); + + if (NULL != hFindRadio) + { + Bth_BluetoothFindRadioClose(hFindRadio); + return true; + } + else + { + return false; + } +} + // WiiMote Pair-Up, function will return amount of either new paired or unpaired devices // negative number on failure int PairUp(bool unpair) @@ -409,7 +409,8 @@ int PairUp(bool unpair) srch.fReturnConnected = true; srch.fReturnUnknown = true; srch.fIssueInquiry = true; - srch.cTimeoutMultiplier = 2; // == (2 * 1.28) seconds + // multiple of 1.28 seconds + srch.cTimeoutMultiplier = 1; BLUETOOTH_FIND_RADIO_PARAMS radioParam; radioParam.dwSize = sizeof(radioParam); diff --git a/Source/Core/DolphinWX/Src/WiimoteConfigDiag.cpp b/Source/Core/DolphinWX/Src/WiimoteConfigDiag.cpp index b259cde2b9..d38eadb0e1 100644 --- a/Source/Core/DolphinWX/Src/WiimoteConfigDiag.cpp +++ b/Source/Core/DolphinWX/Src/WiimoteConfigDiag.cpp @@ -71,11 +71,11 @@ WiimoteConfigDiag::WiimoteConfigDiag(wxWindow* const parent, InputPlugin& plugin refresh_btn->Bind(wxEVT_COMMAND_BUTTON_CLICKED, &WiimoteConfigDiag::RefreshRealWiimotes, this); #ifdef _WIN32 - wxButton* const pairup_btn = new wxButton(this, -1, _("Pair Up"), wxDefaultPosition); - pairup_btn->Bind(wxEVT_COMMAND_BUTTON_CLICKED, &WiimoteConfigDiag::PairUpRealWiimotes, this); + //wxButton* const pairup_btn = new wxButton(this, -1, _("Pair Up"), wxDefaultPosition); + //pairup_btn->Bind(wxEVT_COMMAND_BUTTON_CLICKED, &WiimoteConfigDiag::PairUpRealWiimotes, this); + // TODO: text if can't Pair #endif - // "Real wiimotes" layout wxStaticBoxSizer* const real_wiimotes_group = new wxStaticBoxSizer(wxHORIZONTAL, this, _("Real Wiimotes")); wxFlexGridSizer* const real_wiimotes_sizer = new wxFlexGridSizer(3, 5, 5); @@ -194,24 +194,6 @@ void WiimoteConfigDiag::UpdateGUI() connected_wiimotes_txt->SetLabel(ConnectedWiimotesString()); } -#ifdef _WIN32 -void WiimoteConfigDiag::PairUpRealWiimotes(wxCommandEvent&) -{ - const int paired = WiimoteReal::PairUp(); - - if (paired > 0) - { - // TODO: Maybe add a label of newly paired up wiimotes? - WiimoteReal::Refresh(); - UpdateGUI(); - } - else if (paired < 0) - PanicAlertT("A supported bluetooth device could not be found!\n" - "If you are not using Microsoft's bluetooth stack " - "you must manually pair your wiimotes and use only the \"Refresh\" button."); -} -#endif - void WiimoteConfigDiag::RefreshRealWiimotes(wxCommandEvent&) { WiimoteReal::Refresh(); diff --git a/Source/Core/DolphinWX/Src/WiimoteConfigDiag.h b/Source/Core/DolphinWX/Src/WiimoteConfigDiag.h index 2b2e60de4a..fbd715bd40 100644 --- a/Source/Core/DolphinWX/Src/WiimoteConfigDiag.h +++ b/Source/Core/DolphinWX/Src/WiimoteConfigDiag.h @@ -24,9 +24,6 @@ class WiimoteConfigDiag : public wxDialog public: WiimoteConfigDiag(wxWindow* const parent, InputPlugin& plugin); -#ifdef _WIN32 - void PairUpRealWiimotes(wxCommandEvent& event); -#endif void RefreshRealWiimotes(wxCommandEvent& event); From 8f5fb7e6f98b3283b5f3688e15cdab30fe842eef Mon Sep 17 00:00:00 2001 From: Jordan Woyak Date: Thu, 7 Feb 2013 14:15:47 -0600 Subject: [PATCH 05/49] Hopefully buildfix Windows. (thanks for the patch, RachelB) --- Source/Core/Core/Src/HW/Wiimote.h | 5 ---- Source/Core/Core/Src/HW/WiimoteReal/IONix.cpp | 13 -------- Source/Core/Core/Src/HW/WiimoteReal/IOWin.cpp | 30 +++++++++++-------- .../Core/Src/HW/WiimoteReal/WiimoteReal.cpp | 13 ++++++++ Source/Core/DolphinWX/Src/Main.cpp | 4 --- .../Core/DolphinWX/Src/WiimoteConfigDiag.cpp | 2 +- 6 files changed, 32 insertions(+), 35 deletions(-) diff --git a/Source/Core/Core/Src/HW/Wiimote.h b/Source/Core/Core/Src/HW/Wiimote.h index d514cf9909..dd0e6df389 100644 --- a/Source/Core/Core/Src/HW/Wiimote.h +++ b/Source/Core/Core/Src/HW/Wiimote.h @@ -44,11 +44,6 @@ void Refresh(); void LoadSettings(); -#ifdef _WIN32 -int PairUp(bool unpair = false); -int UnPair(); -#endif - } #endif diff --git a/Source/Core/Core/Src/HW/WiimoteReal/IONix.cpp b/Source/Core/Core/Src/HW/WiimoteReal/IONix.cpp index 24e25e9a2b..2d3ed01e6d 100644 --- a/Source/Core/Core/Src/HW/WiimoteReal/IONix.cpp +++ b/Source/Core/Core/Src/HW/WiimoteReal/IONix.cpp @@ -164,19 +164,6 @@ bool Wiimote::Connect() return true; } -void Wiimote::StartThread() -{ - m_run_thread = true; - m_wiimote_thread = std::thread(std::mem_fun(&Wiimote::ThreadFunc), this); -} - -void Wiimote::StopThread() -{ - m_run_thread = false; - if (m_wiimote_thread.joinable()) - m_wiimote_thread.join(); -} - void Wiimote::Disconnect() { close(cmd_sock); diff --git a/Source/Core/Core/Src/HW/WiimoteReal/IOWin.cpp b/Source/Core/Core/Src/HW/WiimoteReal/IOWin.cpp index e285a33729..77555bae86 100644 --- a/Source/Core/Core/Src/HW/WiimoteReal/IOWin.cpp +++ b/Source/Core/Core/Src/HW/WiimoteReal/IOWin.cpp @@ -73,6 +73,8 @@ HINSTANCE bthprops_lib = NULL; static int initialized = 0; +int PairUp(bool unpair); + inline void init_lib() { if (!initialized) @@ -132,6 +134,9 @@ WiimoteScanner::WiimoteScanner() init_lib(); } +WiimoteScanner::~WiimoteScanner() +{} + // Find and connect wiimotes. // Does not replace already found wiimotes even if they are disconnected. // wm is an array of max_wiimotes wiimotes @@ -198,7 +203,7 @@ std::vector WiimoteScanner::FindWiimotes(size_t max_wiimotes) wm->dev_handle = dev; memcpy(wm->devicepath, detail_data->DevicePath, 197); - found_wiimotes.push_back(wm); + wiimotes.push_back(wm); } if (detail_data) @@ -206,7 +211,7 @@ std::vector WiimoteScanner::FindWiimotes(size_t max_wiimotes) SetupDiDestroyDeviceInfoList(device_info); - return found_wiimotes; + return wiimotes; } bool WiimoteScanner::IsReady() const @@ -262,15 +267,15 @@ bool Wiimote::IsConnected() const int Wiimote::IORead(unsigned char* buf) { - //*buf = 0; + DWORD b; if (!ReadFile(dev_handle, buf, MAX_PAYLOAD, &b, &hid_overlap)) { // Partial read - auto const b = GetLastError(); + b = GetLastError(); if ((b == ERROR_HANDLE_EOF) || (b == ERROR_DEVICE_NOT_CONNECTED)) { // Remote disconnect - RealDisconnect(); + Disconnect(); return 0; } @@ -308,14 +313,15 @@ int Wiimote::IORead(unsigned char* buf) return MAX_PAYLOAD; // XXX } -int Wiimote::IOWrite(unsigned char* buf, int len) +int Wiimote::IOWrite(const u8* buf, int len) { + DWORD bytes = 0; switch (stack) { case MSBT_STACK_UNKNOWN: { // Try to auto-detect the stack type - DWORD bytes = 0; + auto i = WriteFile(dev_handle, buf + 1, 22, &bytes, &hid_overlap); if (i) { @@ -324,7 +330,7 @@ int Wiimote::IOWrite(unsigned char* buf, int len) return i; } - i = HidD_SetOutputReport(dev_handle, buf + 1, len - 1); + i = HidD_SetOutputReport(dev_handle, (unsigned char*) buf + 1, len - 1); if (i) { stack = MSBT_STACK_MS; @@ -343,20 +349,20 @@ int Wiimote::IOWrite(unsigned char* buf, int len) { ERROR_LOG(WIIMOTE, "IOWrite[MSBT_STACK_UNKNOWN]: ERROR: %08x", dw); // Correct? - return -1 + return -1; } break; } case MSBT_STACK_MS: { - i = HidD_SetOutputReport(dev_handle, buf + 1, len - 1); - dw = GetLastError(); + auto i = HidD_SetOutputReport(dev_handle, (unsigned char*) buf + 1, len - 1); + auto dw = GetLastError(); if (dw == 121) { // Semaphore timeout NOTICE_LOG(WIIMOTE, "WiimoteIOWrite[MSBT_STACK_MS]: Unable to send data to wiimote"); - RealDisconnect(); + Disconnect(); return 0; } diff --git a/Source/Core/Core/Src/HW/WiimoteReal/WiimoteReal.cpp b/Source/Core/Core/Src/HW/WiimoteReal/WiimoteReal.cpp index 516fa3a51e..eb4856d2f9 100644 --- a/Source/Core/Core/Src/HW/WiimoteReal/WiimoteReal.cpp +++ b/Source/Core/Core/Src/HW/WiimoteReal/WiimoteReal.cpp @@ -357,6 +357,19 @@ void WiimoteScanner::ThreadFunc() } } +void Wiimote::StartThread() +{ + m_run_thread = true; + m_wiimote_thread = std::thread(std::mem_fun(&Wiimote::ThreadFunc), this); +} + +void Wiimote::StopThread() +{ + m_run_thread = false; + if (m_wiimote_thread.joinable()) + m_wiimote_thread.join(); +} + void Wiimote::ThreadFunc() { Common::SetCurrentThreadName("Wiimote Device Thread"); diff --git a/Source/Core/DolphinWX/Src/Main.cpp b/Source/Core/DolphinWX/Src/Main.cpp index 338ed59547..d9d1908de3 100644 --- a/Source/Core/DolphinWX/Src/Main.cpp +++ b/Source/Core/DolphinWX/Src/Main.cpp @@ -390,10 +390,6 @@ void DolphinApp::InitLanguageSupport() int DolphinApp::OnExit() { WiimoteReal::Shutdown(); -#ifdef _WIN32 - if (SConfig::GetInstance().m_WiiAutoUnpair) - WiimoteReal::UnPair(); -#endif VideoBackend::ClearList(); SConfig::Shutdown(); LogManager::Shutdown(); diff --git a/Source/Core/DolphinWX/Src/WiimoteConfigDiag.cpp b/Source/Core/DolphinWX/Src/WiimoteConfigDiag.cpp index d38eadb0e1..b50ec9bc5d 100644 --- a/Source/Core/DolphinWX/Src/WiimoteConfigDiag.cpp +++ b/Source/Core/DolphinWX/Src/WiimoteConfigDiag.cpp @@ -81,7 +81,7 @@ WiimoteConfigDiag::WiimoteConfigDiag(wxWindow* const parent, InputPlugin& plugin wxFlexGridSizer* const real_wiimotes_sizer = new wxFlexGridSizer(3, 5, 5); real_wiimotes_sizer->Add(connected_wiimotes_txt, 0, wxALIGN_CENTER_VERTICAL); #ifdef _WIN32 - real_wiimotes_sizer->Add(pairup_btn); + //real_wiimotes_sizer->Add(pairup_btn); #endif real_wiimotes_sizer->Add(refresh_btn); real_wiimotes_group->Add(real_wiimotes_sizer, 1, wxALL, 5); From 85f25ded4c210b633411fd373a775de5f1792a1f Mon Sep 17 00:00:00 2001 From: Jordan Woyak Date: Thu, 7 Feb 2013 14:22:21 -0600 Subject: [PATCH 06/49] Buildfix! Programming for Windows on Linux is hard, OK? --- Source/Core/Core/Src/HW/WiimoteReal/IOWin.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/Core/Core/Src/HW/WiimoteReal/IOWin.cpp b/Source/Core/Core/Src/HW/WiimoteReal/IOWin.cpp index 77555bae86..1d82a19e1a 100644 --- a/Source/Core/Core/Src/HW/WiimoteReal/IOWin.cpp +++ b/Source/Core/Core/Src/HW/WiimoteReal/IOWin.cpp @@ -73,7 +73,7 @@ HINSTANCE bthprops_lib = NULL; static int initialized = 0; -int PairUp(bool unpair); +int PairUp(bool unpair = false); inline void init_lib() { From 9ecfb5e75d5f636a1c29c38bf67700dba6090d53 Mon Sep 17 00:00:00 2001 From: Jordan Woyak Date: Thu, 7 Feb 2013 14:42:50 -0600 Subject: [PATCH 07/49] Buildfix for real! --- Source/Core/Core/Src/HW/WiimoteReal/IODummy.cpp | 13 ++++++++----- Source/Core/Core/Src/HW/WiimoteReal/IOWin.cpp | 4 ++-- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/Source/Core/Core/Src/HW/WiimoteReal/IODummy.cpp b/Source/Core/Core/Src/HW/WiimoteReal/IODummy.cpp index b22f1c7795..114feebeb7 100644 --- a/Source/Core/Core/Src/HW/WiimoteReal/IODummy.cpp +++ b/Source/Core/Core/Src/HW/WiimoteReal/IODummy.cpp @@ -26,9 +26,12 @@ WiimoteScanner::WiimoteScanner() return; } +WiimoteScanner::~WiimoteScanner() +{} + std::vector WiimoteScanner::FindWiimotes(size_t max_wiimotes) { - return std::vector() + return std::vector(); } bool WiimoteScanner::IsReady() const @@ -46,17 +49,17 @@ void Wiimote::Disconnect() return; } -bool Wiimote::IsOpen() const +bool Wiimote::IsConnected() const { - return IsConnected(); + return false; } -int Wiimote::IORead(unsigned char* buf) +int Wiimote::Read(const u8* buf) { return 0; } -int Wiimote::IOWrite(unsigned char* buf, int len) +int Wiimote::Write(const u8* buf, int len) { return 0; } diff --git a/Source/Core/Core/Src/HW/WiimoteReal/IOWin.cpp b/Source/Core/Core/Src/HW/WiimoteReal/IOWin.cpp index 1d82a19e1a..407e3b6f4f 100644 --- a/Source/Core/Core/Src/HW/WiimoteReal/IOWin.cpp +++ b/Source/Core/Core/Src/HW/WiimoteReal/IOWin.cpp @@ -73,8 +73,6 @@ HINSTANCE bthprops_lib = NULL; static int initialized = 0; -int PairUp(bool unpair = false); - inline void init_lib() { if (!initialized) @@ -129,6 +127,8 @@ inline void init_lib() namespace WiimoteReal { +int PairUp(bool unpair = false); + WiimoteScanner::WiimoteScanner() { init_lib(); From 57ea09dcc2b2d51193e7f3c07cbd38ea9a7f85bd Mon Sep 17 00:00:00 2001 From: Jordan Woyak Date: Thu, 7 Feb 2013 14:46:01 -0600 Subject: [PATCH 08/49] Fix BT-less! --- Source/Core/Core/Src/HW/WiimoteReal/IODummy.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Source/Core/Core/Src/HW/WiimoteReal/IODummy.cpp b/Source/Core/Core/Src/HW/WiimoteReal/IODummy.cpp index 114feebeb7..c696cc8012 100644 --- a/Source/Core/Core/Src/HW/WiimoteReal/IODummy.cpp +++ b/Source/Core/Core/Src/HW/WiimoteReal/IODummy.cpp @@ -54,12 +54,12 @@ bool Wiimote::IsConnected() const return false; } -int Wiimote::Read(const u8* buf) +int Wiimote::IORead(const u8* buf) { return 0; } -int Wiimote::Write(const u8* buf, int len) +int Wiimote::IOWrite(const u8* buf, int len) { return 0; } From a2ca76ebd9c3300735c438b5ddc7bc726001b41a Mon Sep 17 00:00:00 2001 From: Jordan Woyak Date: Thu, 7 Feb 2013 15:16:41 -0600 Subject: [PATCH 09/49] Buildfix. --- Source/Core/Core/Src/HW/WiimoteReal/IODummy.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/Core/Core/Src/HW/WiimoteReal/IODummy.cpp b/Source/Core/Core/Src/HW/WiimoteReal/IODummy.cpp index c696cc8012..6af169f5ee 100644 --- a/Source/Core/Core/Src/HW/WiimoteReal/IODummy.cpp +++ b/Source/Core/Core/Src/HW/WiimoteReal/IODummy.cpp @@ -54,7 +54,7 @@ bool Wiimote::IsConnected() const return false; } -int Wiimote::IORead(const u8* buf) +int Wiimote::IORead(u8* buf) { return 0; } From 3063942dd05d432fe0b750770e5159252b4ae199 Mon Sep 17 00:00:00 2001 From: Jordan Woyak Date: Thu, 7 Feb 2013 21:53:09 -0600 Subject: [PATCH 10/49] some cleanup --- .../Core/Src/HW/WiimoteEmu/EmuSubroutines.cpp | 5 +- .../Core/Core/Src/HW/WiimoteEmu/WiimoteHid.h | 4 +- .../Core/Src/HW/WiimoteReal/WiimoteReal.cpp | 128 +++++------------- .../Core/Src/HW/WiimoteReal/WiimoteReal.h | 6 +- 4 files changed, 41 insertions(+), 102 deletions(-) diff --git a/Source/Core/Core/Src/HW/WiimoteEmu/EmuSubroutines.cpp b/Source/Core/Core/Src/HW/WiimoteEmu/EmuSubroutines.cpp index cfb81bb768..5c2a28b57a 100644 --- a/Source/Core/Core/Src/HW/WiimoteEmu/EmuSubroutines.cpp +++ b/Source/Core/Core/Src/HW/WiimoteEmu/EmuSubroutines.cpp @@ -252,9 +252,8 @@ void Wiimote::RequestStatus(const wm_request_status* const rs) if (g_wiimotes[m_index]) { - wm_request_status rpt; - rpt.rumble = 0; - g_wiimotes[m_index]->SendPacket(WM_REQUEST_STATUS, &rpt, sizeof(rpt)); + wm_request_status rpt = {}; + g_wiimotes[m_index]->QueueReport(WM_REQUEST_STATUS, &rpt, sizeof(rpt)); } return; diff --git a/Source/Core/Core/Src/HW/WiimoteEmu/WiimoteHid.h b/Source/Core/Core/Src/HW/WiimoteEmu/WiimoteHid.h index fd7c549e8d..9d1a2092a0 100644 --- a/Source/Core/Core/Src/HW/WiimoteEmu/WiimoteHid.h +++ b/Source/Core/Core/Src/HW/WiimoteEmu/WiimoteHid.h @@ -201,6 +201,7 @@ struct wm_report #define WM_LEDS 0x11 struct wm_leds { u8 rumble : 1; + // real wii also sets bit 0x2 (unknown purpose) u8 : 3; u8 leds : 4; }; @@ -208,8 +209,9 @@ struct wm_leds { #define WM_REPORT_MODE 0x12 struct wm_report_mode { u8 rumble : 1; - u8 continuous : 1; // these 2 seem to be named wrong + // unsure what "all_the_time" actually is, the real wii does set it (bit 0x2) u8 all_the_time : 1; + u8 continuous : 1; u8 : 5; u8 mode; }; diff --git a/Source/Core/Core/Src/HW/WiimoteReal/WiimoteReal.cpp b/Source/Core/Core/Src/HW/WiimoteReal/WiimoteReal.cpp index a7963ec4e0..dda9e32b5f 100644 --- a/Source/Core/Core/Src/HW/WiimoteReal/WiimoteReal.cpp +++ b/Source/Core/Core/Src/HW/WiimoteReal/WiimoteReal.cpp @@ -61,13 +61,11 @@ Wiimote::Wiimote() #if defined(__linux__) && HAVE_BLUEZ bdaddr = (bdaddr_t){{0, 0, 0, 0, 0, 0}}; #endif - - DisableDataReporting(); } Wiimote::~Wiimote() { - StopThread(); + StopThread(); if (IsConnected()) Disconnect(); @@ -80,26 +78,28 @@ Wiimote::~Wiimote() delete[] rpt.first; } -// Silly, copying data n stuff, o well, don't use this too often -void Wiimote::SendPacket(const u8 rpt_id, const void* const data, const unsigned int size) +// to be called from CPU thread +void Wiimote::QueueReport(u8 rpt_id, const void* _data, unsigned int size) { + auto const data = static_cast(_data); + Report rpt; rpt.second = size + 2; rpt.first = new u8[rpt.second]; - rpt.first[0] = 0xA1; + rpt.first[0] = WM_SET_REPORT | WM_BT_OUTPUT; rpt.first[1] = rpt_id; - memcpy(rpt.first + 2, data, size); + std::copy(data, data + size, rpt.first + 2); m_write_reports.Push(rpt); } void Wiimote::DisableDataReporting() { - wm_report_mode rpt; + wm_report_mode rpt = {}; rpt.mode = WM_REPORT_CORE; rpt.all_the_time = 0; rpt.continuous = 0; rpt.rumble = 0; - SendPacket(WM_REPORT_MODE, &rpt, sizeof(rpt)); + QueueReport(WM_REPORT_MODE, &rpt, sizeof(rpt)); } void Wiimote::ClearReadQueue() @@ -133,24 +133,24 @@ void Wiimote::ControlChannel(const u16 channel, const void* const data, const u3 } } -void Wiimote::InterruptChannel(const u16 channel, const void* const data, const u32 size) +void Wiimote::InterruptChannel(const u16 channel, const void* const _data, const u32 size) { - if (0 == m_channel) // first interrupt/control channel sent + // first interrupt/control channel sent + if (channel != m_channel) { + m_channel = channel; + ClearReadQueue(); - // request status - wm_request_status rpt; - rpt.rumble = 0; - SendPacket(WM_REQUEST_STATUS, &rpt, sizeof(rpt)); + EmuStart(); } - - m_channel = channel; // this right? + + auto const data = static_cast(_data); Report rpt; rpt.first = new u8[size]; rpt.second = (u8)size; - memcpy(rpt.first, (u8*)data, size); + std::copy(data, data + size, rpt.first); // Convert output DATA packets to SET_REPORT packets. // Nintendo Wiimotes work without this translation, but 3rd @@ -173,7 +173,8 @@ bool Wiimote::Read() if (0 == rpt.second) Disconnect(); - if (rpt.second > 0 && m_channel > 0) { + if (rpt.second > 0 && m_channel > 0) + { // Add it to queue m_read_reports.Push(rpt); return true; @@ -241,27 +242,18 @@ void Wiimote::Update() delete[] rpt.first; } -void Wiimote::EmuStop() -{ - m_channel = 0; - - DisableDataReporting(); - - NOTICE_LOG(WIIMOTE, "Stopping wiimote data reporting"); -} - // Rumble briefly -void Wiimote::Rumble() +void Wiimote::RumbleBriefly() { unsigned char buffer = 0x01; DEBUG_LOG(WIIMOTE, "Starting rumble..."); - SendRequest(WM_CMD_RUMBLE, &buffer, 1); + QueueReport(WM_CMD_RUMBLE, &buffer, sizeof(buffer)); SLEEP(200); DEBUG_LOG(WIIMOTE, "Stopping rumble..."); buffer = 0x00; - SendRequest(WM_CMD_RUMBLE, &buffer, 1); + QueueReport(WM_CMD_RUMBLE, &buffer, sizeof(buffer)); } // Set the active LEDs. @@ -270,30 +262,21 @@ void Wiimote::SetLEDs(int new_leds) { // Remove the lower 4 bits because they control rumble u8 const buffer = (new_leds & 0xF0); - SendRequest(WM_CMD_LED, &buffer, 1); + QueueReport(WM_CMD_LED, &buffer, sizeof(buffer)); } bool Wiimote::EmuStart() { - // Send a handshake - - // Set buffer[0] to 0x04 for continuous reporting - u8 const buffer[2] = {0x04, 0x30}; - - NOTICE_LOG(WIIMOTE, "Sending handshake to wiimote"); - - return SendRequest(WM_CMD_REPORT_TYPE, buffer, 2); + DisableDataReporting(); } -// Send a packet to the wiimote. -// report_type should be one of WIIMOTE_CMD_LED, WIIMOTE_CMD_RUMBLE, etc. -bool Wiimote::SendRequest(u8 report_type, u8 const* data, int length) +void Wiimote::EmuStop() { - unsigned char buffer[32] = {WM_SET_REPORT | WM_BT_OUTPUT, report_type}; + m_channel = 0; - memcpy(buffer + 2, data, length); + DisableDataReporting(); - return (IOWrite(buffer, length + 2) != 0); + NOTICE_LOG(WIIMOTE, "Stopping wiimote data reporting"); } unsigned int CalculateWantedWiimotes() @@ -369,9 +352,6 @@ void Wiimote::ThreadFunc() { Common::SetCurrentThreadName("Wiimote Device Thread"); - // rumble briefly - Rumble(); - // main loop while (m_run_thread && IsConnected()) { @@ -464,7 +444,10 @@ void HandleWiimoteConnect(Wiimote* wm) wm->index = i; wm->StartThread(); + + wm->DisableDataReporting(); wm->SetLEDs(WIIMOTE_LED_1 << i); + wm->RumbleBriefly(); Host_ConnectWiimote(i, true); @@ -516,52 +499,7 @@ void Refresh() { std::lock_guard lk(g_refresh_lock); -#ifdef _WIN32 - Shutdown(); - Initialize(); -#else -/* - // Make sure real wiimotes have been initialized - if (!g_real_wiimotes_initialized) - { - Initialize(); - return; - } - - // Find the number of slots configured for real wiimotes - unsigned int wanted_wiimotes = 0; - for (unsigned int i = 0; i < MAX_WIIMOTES; ++i) - if (WIIMOTE_SRC_REAL & g_wiimote_sources[i]) - ++wanted_wiimotes; - - // Remove wiimotes that are paired with slots no longer configured for a - // real wiimote or that are disconnected - for (unsigned int i = 0; i < MAX_WIIMOTES; ++i) - if (g_wiimotes[i] && (!(WIIMOTE_SRC_REAL & g_wiimote_sources[i]) || - !g_wiimotes[i]->IsConnected())) - { - delete g_wiimotes[i]; - g_wiimotes[i] = NULL; - --g_wiimotes_found; - } - - // Scan for wiimotes if we want more - if (wanted_wiimotes > g_wiimotes_found) - { - // Scan for wiimotes - unsigned int num_wiimotes = FindWiimotes(g_wiimotes, wanted_wiimotes); - - DEBUG_LOG(WIIMOTE, "Found %i Real Wiimotes, %i wanted", num_wiimotes, wanted_wiimotes); - - // Connect newly found wiimotes. - int num_new_wiimotes = ConnectWiimotes(g_wiimotes); - - DEBUG_LOG(WIIMOTE, "Connected to %i additional Real Wiimotes", num_new_wiimotes); - - g_wiimotes_found = num_wiimotes; - } -*/ -#endif + // TODO: stuff, maybe } void InterruptChannel(int _WiimoteNumber, u16 _channelID, const void* _pData, u32 _Size) diff --git a/Source/Core/Core/Src/HW/WiimoteReal/WiimoteReal.h b/Source/Core/Core/Src/HW/WiimoteReal/WiimoteReal.h index d61967b4f1..0dee443597 100644 --- a/Source/Core/Core/Src/HW/WiimoteReal/WiimoteReal.h +++ b/Source/Core/Core/Src/HW/WiimoteReal/WiimoteReal.h @@ -70,10 +70,11 @@ public: bool IsConnected() const; void SetLEDs(int leds); + void RumbleBriefly(); void DisableDataReporting(); - void Rumble(); - void SendPacket(const u8 rpt_id, const void* const data, const unsigned int size); + + void QueueReport(u8 rpt_id, const void* data, unsigned int size); int index; @@ -102,7 +103,6 @@ protected: private: void ClearReadQueue(); - bool SendRequest(u8 report_type, u8 const* data, int length); int IORead(u8* buf); int IOWrite(u8 const* buf, int len); From 026793fa4abfd7e2d1b6f443022e621b81bddac9 Mon Sep 17 00:00:00 2001 From: Jordan Woyak Date: Thu, 7 Feb 2013 23:17:51 -0600 Subject: [PATCH 11/49] Fixup real wiimote GUI. --- Source/Core/Core/Src/HW/WiimoteReal/IOWin.cpp | 42 +++++++------- .../Core/Src/HW/WiimoteReal/WiimoteReal.cpp | 29 +++++++--- .../Core/Src/HW/WiimoteReal/WiimoteReal.h | 3 +- .../Core/DolphinWX/Src/WiimoteConfigDiag.cpp | 57 +++---------------- Source/Core/DolphinWX/Src/WiimoteConfigDiag.h | 6 -- 5 files changed, 50 insertions(+), 87 deletions(-) diff --git a/Source/Core/Core/Src/HW/WiimoteReal/IOWin.cpp b/Source/Core/Core/Src/HW/WiimoteReal/IOWin.cpp index 1ac7ed03f4..25a83531dc 100644 --- a/Source/Core/Core/Src/HW/WiimoteReal/IOWin.cpp +++ b/Source/Core/Core/Src/HW/WiimoteReal/IOWin.cpp @@ -135,7 +135,10 @@ WiimoteScanner::WiimoteScanner() } WiimoteScanner::~WiimoteScanner() -{} +{ + // TODO: what do we want here? + //PairUp(true); +} // Find and connect wiimotes. // Does not replace already found wiimotes even if they are disconnected. @@ -216,8 +219,21 @@ std::vector WiimoteScanner::FindWiimotes(size_t max_wiimotes) bool WiimoteScanner::IsReady() const { - // TODO: impl - return true; + BLUETOOTH_FIND_RADIO_PARAMS radioParam; + radioParam.dwSize = sizeof(radioParam); + + HANDLE hRadio; + HBLUETOOTH_RADIO_FIND hFindRadio = Bth_BluetoothFindFirstRadio(&radioParam, &hRadio); + + if (NULL != hFindRadio) + { + Bth_BluetoothFindRadioClose(hFindRadio); + return true; + } + else + { + return false; + } } // Connect to a wiimote with a known device path. @@ -377,26 +393,6 @@ int Wiimote::IOWrite(const u8* buf, int len) return 0; } -// return true if a device using MS BT stack is available -bool CanPairUp() -{ - BLUETOOTH_FIND_RADIO_PARAMS radioParam; - radioParam.dwSize = sizeof(radioParam); - - HANDLE hRadio; - HBLUETOOTH_RADIO_FIND hFindRadio = Bth_BluetoothFindFirstRadio(&radioParam, &hRadio); - - if (NULL != hFindRadio) - { - Bth_BluetoothFindRadioClose(hFindRadio); - return true; - } - else - { - return false; - } -} - // WiiMote Pair-Up, function will return amount of either new paired or unpaired devices // negative number on failure int PairUp(bool unpair) diff --git a/Source/Core/Core/Src/HW/WiimoteReal/WiimoteReal.cpp b/Source/Core/Core/Src/HW/WiimoteReal/WiimoteReal.cpp index dda9e32b5f..5b8ee72f16 100644 --- a/Source/Core/Core/Src/HW/WiimoteReal/WiimoteReal.cpp +++ b/Source/Core/Core/Src/HW/WiimoteReal/WiimoteReal.cpp @@ -265,7 +265,7 @@ void Wiimote::SetLEDs(int new_leds) QueueReport(WM_CMD_LED, &buffer, sizeof(buffer)); } -bool Wiimote::EmuStart() +void Wiimote::EmuStart() { DisableDataReporting(); } @@ -298,7 +298,10 @@ void WiimoteScanner::WantWiimotes(size_t count) void WiimoteScanner::StartScanning() { run_thread = true; - scan_thread = std::thread(std::mem_fun(&WiimoteScanner::ThreadFunc), this); + if (IsReady()) + { + scan_thread = std::thread(std::mem_fun(&WiimoteScanner::ThreadFunc), this); + } } void WiimoteScanner::StopScanning() @@ -307,7 +310,6 @@ void WiimoteScanner::StopScanning() if (scan_thread.joinable()) { scan_thread.join(); - NOTICE_LOG(WIIMOTE, "Wiimote scanning has stopped"); } } @@ -333,6 +335,8 @@ void WiimoteScanner::ThreadFunc() //std::this_thread::yield(); Common::SleepCurrentThread(500); } + + NOTICE_LOG(WIIMOTE, "Wiimote scanning has stopped"); } void Wiimote::StartThread() @@ -395,8 +399,7 @@ void Initialize() auto const wanted_wiimotes = CalculateWantedWiimotes(); g_wiimote_scanner.WantWiimotes(wanted_wiimotes); - //if (wanted_wiimotes > 0) - g_wiimote_scanner.StartScanning(); + g_wiimote_scanner.StartScanning(); g_real_wiimotes_initialized = true; } @@ -497,9 +500,21 @@ void HandleFoundWiimotes(const std::vector& wiimotes) // This is called from the GUI thread void Refresh() { + g_wiimote_scanner.StopScanning(); + + { std::lock_guard lk(g_refresh_lock); - - // TODO: stuff, maybe + + auto wanted_wiimotes = CalculateWantedWiimotes(); + auto const found_wiimotes = g_wiimote_scanner.FindWiimotes(wanted_wiimotes); + + HandleFoundWiimotes(found_wiimotes); + + wanted_wiimotes = CalculateWantedWiimotes(); + g_wiimote_scanner.WantWiimotes(wanted_wiimotes); + } + + g_wiimote_scanner.StartScanning(); } void InterruptChannel(int _WiimoteNumber, u16 _channelID, const void* _pData, u32 _Size) diff --git a/Source/Core/Core/Src/HW/WiimoteReal/WiimoteReal.h b/Source/Core/Core/Src/HW/WiimoteReal/WiimoteReal.h index 0dee443597..23631765ed 100644 --- a/Source/Core/Core/Src/HW/WiimoteReal/WiimoteReal.h +++ b/Source/Core/Core/Src/HW/WiimoteReal/WiimoteReal.h @@ -59,7 +59,7 @@ public: void StopThread(); // "handshake" / stop packets - bool EmuStart(); + void EmuStart(); void EmuStop(); // connecting and disconnecting from physical devices @@ -153,6 +153,7 @@ private: }; extern std::recursive_mutex g_refresh_lock; +extern WiimoteScanner g_wiimote_scanner; extern Wiimote *g_wiimotes[4]; void InterruptChannel(int _WiimoteNumber, u16 _channelID, const void* _pData, u32 _Size); diff --git a/Source/Core/DolphinWX/Src/WiimoteConfigDiag.cpp b/Source/Core/DolphinWX/Src/WiimoteConfigDiag.cpp index b50ec9bc5d..a4af2d5d9a 100644 --- a/Source/Core/DolphinWX/Src/WiimoteConfigDiag.cpp +++ b/Source/Core/DolphinWX/Src/WiimoteConfigDiag.cpp @@ -4,14 +4,6 @@ #include "HW/WiimoteReal/WiimoteReal.h" #include "Frame.h" -wxString ConnectedWiimotesString() -{ - //static wxString str; - //str.Printf(_("%i connected"), WiimoteReal::Initialize()); - //return str; - return "TODO: this text"; -} - WiimoteConfigDiag::WiimoteConfigDiag(wxWindow* const parent, InputPlugin& plugin) : wxDialog(parent, -1, _("Dolphin Wiimote Configuration"), wxDefaultPosition, wxDefaultSize) , m_plugin(plugin) @@ -65,27 +57,17 @@ WiimoteConfigDiag::WiimoteConfigDiag(wxWindow* const parent, InputPlugin& plugin // "Real wiimotes" controls - connected_wiimotes_txt = new wxStaticText(this, -1, ConnectedWiimotesString()); - wxButton* const refresh_btn = new wxButton(this, -1, _("Refresh"), wxDefaultPosition); refresh_btn->Bind(wxEVT_COMMAND_BUTTON_CLICKED, &WiimoteConfigDiag::RefreshRealWiimotes, this); -#ifdef _WIN32 - //wxButton* const pairup_btn = new wxButton(this, -1, _("Pair Up"), wxDefaultPosition); - //pairup_btn->Bind(wxEVT_COMMAND_BUTTON_CLICKED, &WiimoteConfigDiag::PairUpRealWiimotes, this); - // TODO: text if can't Pair -#endif - // "Real wiimotes" layout - wxStaticBoxSizer* const real_wiimotes_group = new wxStaticBoxSizer(wxHORIZONTAL, this, _("Real Wiimotes")); - wxFlexGridSizer* const real_wiimotes_sizer = new wxFlexGridSizer(3, 5, 5); - real_wiimotes_sizer->Add(connected_wiimotes_txt, 0, wxALIGN_CENTER_VERTICAL); -#ifdef _WIN32 - //real_wiimotes_sizer->Add(pairup_btn); -#endif - real_wiimotes_sizer->Add(refresh_btn); - real_wiimotes_group->Add(real_wiimotes_sizer, 1, wxALL, 5); - + wxStaticBoxSizer* const real_wiimotes_group = new wxStaticBoxSizer(wxVERTICAL, this, _("Real Wiimotes")); + + if (!WiimoteReal::g_wiimote_scanner.IsReady()) + real_wiimotes_group->Add(new wxStaticText(this, -1, _("A supported bluetooth device could not be found.\n" + "You must manually pair your wiimotes.")), 0, wxALIGN_CENTER | wxALL, 5); + + real_wiimotes_group->Add(refresh_btn, 0, wxALIGN_CENTER); // "General Settings" controls const wxString str[] = { _("Bottom"), _("Top") }; @@ -189,15 +171,9 @@ void WiimoteConfigDiag::ConfigEmulatedWiimote(wxCommandEvent& ev) m_emu_config_diag->Destroy(); } -void WiimoteConfigDiag::UpdateGUI() -{ - connected_wiimotes_txt->SetLabel(ConnectedWiimotesString()); -} - void WiimoteConfigDiag::RefreshRealWiimotes(wxCommandEvent&) { WiimoteReal::Refresh(); - UpdateGUI(); } void WiimoteConfigDiag::SelectSource(wxCommandEvent& event) @@ -214,24 +190,6 @@ void WiimoteConfigDiag::SelectSource(wxCommandEvent& event) wiimote_configure_bt[index]->Enable(); } -// TODO: race conditiions -void WiimoteConfigDiag::UpdateWiimoteStatus() -{ - for (int index = 0; index < 4; ++index) - { - if (m_orig_wiimote_sources[index] != g_wiimote_sources[index]) - { - // Disconnect first, otherwise the new source doesn't seem to work - CFrame::ConnectWiimote(index, false); - // Connect wiimotes - if (WIIMOTE_SRC_EMU & g_wiimote_sources[index]) - CFrame::ConnectWiimote(index, true); - else if (WIIMOTE_SRC_REAL & g_wiimote_sources[index] && WiimoteReal::g_wiimotes[index]) - CFrame::ConnectWiimote(index, WiimoteReal::g_wiimotes[index]->IsConnected()); - } - } -} - void WiimoteConfigDiag::RevertSource() { for (int i = 0; i < 4; ++i) @@ -253,7 +211,6 @@ void WiimoteConfigDiag::Save(wxCommandEvent& event) sec.Set("Source", (int)g_wiimote_sources[i]); } - UpdateWiimoteStatus(); inifile.Save(ini_filename); diff --git a/Source/Core/DolphinWX/Src/WiimoteConfigDiag.h b/Source/Core/DolphinWX/Src/WiimoteConfigDiag.h index fbd715bd40..316d0d48bf 100644 --- a/Source/Core/DolphinWX/Src/WiimoteConfigDiag.h +++ b/Source/Core/DolphinWX/Src/WiimoteConfigDiag.h @@ -26,15 +26,11 @@ public: void RefreshRealWiimotes(wxCommandEvent& event); - void SelectSource(wxCommandEvent& event); - void UpdateWiimoteStatus(); void RevertSource(); - void ConfigEmulatedWiimote(wxCommandEvent& event); void Save(wxCommandEvent& event); - void UpdateGUI(); void OnSensorBarPos(wxCommandEvent& event) { @@ -73,8 +69,6 @@ private: wxButton* wiimote_configure_bt[4]; std::map m_wiimote_index_from_conf_bt_id; - - wxStaticText* connected_wiimotes_txt; }; From 87bbdbf5428b94520b44a97df53a5f7ee1e9945d Mon Sep 17 00:00:00 2001 From: Jordan Woyak Date: Thu, 7 Feb 2013 23:23:32 -0600 Subject: [PATCH 12/49] Remove settings stuff that was not actually used anywhere. --- Source/Core/Core/Src/ConfigManager.cpp | 20 +------------------- Source/Core/Core/Src/ConfigManager.h | 5 ----- 2 files changed, 1 insertion(+), 24 deletions(-) diff --git a/Source/Core/Core/Src/ConfigManager.cpp b/Source/Core/Core/Src/ConfigManager.cpp index f6194c1bb7..978eadace1 100644 --- a/Source/Core/Core/Src/ConfigManager.cpp +++ b/Source/Core/Core/Src/ConfigManager.cpp @@ -100,9 +100,6 @@ SConfig::SConfig() { // Make sure we have log manager LoadSettings(); - //Make sure we load any extra settings - LoadSettingsWii(); - } void SConfig::Init() @@ -427,19 +424,4 @@ void SConfig::LoadSettings() } m_SYSCONF = new SysConf(); -} -void SConfig::LoadSettingsWii() -{ - IniFile ini; - //Wiimote configs - ini.Load((File::GetUserPath(D_CONFIG_IDX) + "Dolphin.ini")); - for (int i = 0; i < 4; i++) - { - char SectionName[32]; - sprintf(SectionName, "Wiimote%i", i + 1); - ini.Get(SectionName, "AutoReconnectRealWiimote", &m_WiiAutoReconnect[i], false); - } - ini.Load((File::GetUserPath(D_CONFIG_IDX) + "wiimote.ini")); - ini.Get("Real", "Unpair", &m_WiiAutoUnpair, false); - -} +} \ No newline at end of file diff --git a/Source/Core/Core/Src/ConfigManager.h b/Source/Core/Core/Src/ConfigManager.h index e92d29ee65..e3ad7b42a9 100644 --- a/Source/Core/Core/Src/ConfigManager.h +++ b/Source/Core/Core/Src/ConfigManager.h @@ -41,8 +41,6 @@ struct SConfig : NonCopyable // Wii Devices bool m_WiiSDCard; bool m_WiiKeyboard; - bool m_WiiAutoReconnect[4]; - bool m_WiiAutoUnpair; bool m_WiimoteReconnectOnLoad; // name of the last used filename @@ -107,9 +105,6 @@ struct SConfig : NonCopyable // load settings void LoadSettings(); - //Special load settings - void LoadSettingsWii(); - // Return the permanent and somewhat globally used instance of this struct static SConfig& GetInstance() {return(*m_Instance);} From 8ce58759e33202342b79a611f4ebdd0a5b1a2bf5 Mon Sep 17 00:00:00 2001 From: Jordan Woyak Date: Thu, 7 Feb 2013 23:52:50 -0600 Subject: [PATCH 13/49] Remove some old nonsense. --- Source/Core/Common/Src/Common.h | 1 - .../Core/Src/IPC_HLE/WII_IPC_HLE_WiiMote.cpp | 3 +- Source/Core/DolphinWX/Src/Frame.cpp | 31 ------------------- Source/Core/VideoCommon/Src/EmuWindow.cpp | 4 --- 4 files changed, 1 insertion(+), 38 deletions(-) diff --git a/Source/Core/Common/Src/Common.h b/Source/Core/Common/Src/Common.h index c3cab37dd8..0132915a5c 100644 --- a/Source/Core/Common/Src/Common.h +++ b/Source/Core/Common/Src/Common.h @@ -155,7 +155,6 @@ enum HOST_COMM WM_USER_CREATE, WM_USER_SETCURSOR, WM_USER_KEYDOWN, - WIIMOTE_DISCONNECT // Disconnect Wiimote }; // Used for notification on emulation state diff --git a/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_WiiMote.cpp b/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_WiiMote.cpp index 6e06f60dd6..b3449ec059 100644 --- a/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_WiiMote.cpp +++ b/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE_WiiMote.cpp @@ -211,8 +211,7 @@ void CWII_IPC_HLE_WiiMote::EventConnectionAccepted() void CWII_IPC_HLE_WiiMote::EventDisconnect() { // Send disconnect message to plugin - u8 Message = WIIMOTE_DISCONNECT; - Wiimote::ControlChannel(m_ConnectionHandle & 0xFF, 99, &Message, 0); + Wiimote::ControlChannel(m_ConnectionHandle & 0xFF, 99, NULL, 0); m_ConnectionState = CONN_INACTIVE; // Clear channel flags diff --git a/Source/Core/DolphinWX/Src/Frame.cpp b/Source/Core/DolphinWX/Src/Frame.cpp index d390b8afcd..46b3a1e8e5 100644 --- a/Source/Core/DolphinWX/Src/Frame.cpp +++ b/Source/Core/DolphinWX/Src/Frame.cpp @@ -100,37 +100,6 @@ CPanel::CPanel( else SetCursor(wxNullCursor); break; - - case WIIMOTE_DISCONNECT: - if (SConfig::GetInstance().m_LocalCoreStartupParameter.bWii) - { - const int wiimote_idx = lParam; - const int wiimote_num = wiimote_idx + 1; - - //Auto reconnect if option is turned on. - //TODO: Make this only auto reconnect wiimotes that have the option activated. - SConfig::GetInstance().LoadSettingsWii();//Make sure we are using the newest settings. - if (SConfig::GetInstance().m_WiiAutoReconnect[wiimote_idx]) - { - GetUsbPointer()->AccessWiiMote(wiimote_idx | 0x100)->Activate(true); - NOTICE_LOG(WIIMOTE, "Wiimote %i has been auto-reconnected...", wiimote_num); - } - else - { - // The Wiimote has been disconnected, we offer reconnect here. - wxMessageDialog *dlg = new wxMessageDialog( - this, - wxString::Format(_("Wiimote %i has been disconnected by system.\nMaybe this game doesn't support multi-wiimote,\nor maybe it is due to idle time out or other reason.\nDo you want to reconnect immediately?"), wiimote_num), - _("Reconnect Wiimote Confirm"), - wxYES_NO | wxSTAY_ON_TOP | wxICON_INFORMATION, //wxICON_QUESTION, - wxDefaultPosition); - - if (dlg->ShowModal() == wxID_YES) - GetUsbPointer()->AccessWiiMote(wiimote_idx | 0x100)->Activate(true); - - dlg->Destroy(); - } - } } break; diff --git a/Source/Core/VideoCommon/Src/EmuWindow.cpp b/Source/Core/VideoCommon/Src/EmuWindow.cpp index cbb0bc31ac..81227ba0ca 100644 --- a/Source/Core/VideoCommon/Src/EmuWindow.cpp +++ b/Source/Core/VideoCommon/Src/EmuWindow.cpp @@ -205,10 +205,6 @@ LRESULT CALLBACK WndProc( HWND hWnd, UINT iMsg, WPARAM wParam, LPARAM lParam ) OnKeyDown(lParam); FreeLookInput((u32)wParam, lParam); } - else if (wParam == WIIMOTE_DISCONNECT) - { - PostMessage(m_hParent, WM_USER, wParam, lParam); - } break; // Called when a screensaver wants to show up while this window is active From 1998da867b57a7f6cee3320059e9c259abee64bd Mon Sep 17 00:00:00 2001 From: Jordan Woyak Date: Fri, 8 Feb 2013 12:14:45 -0600 Subject: [PATCH 14/49] OSX fix maybe. (based on jchadwick's patch) --- .../Core/Core/Src/HW/WiimoteReal/IOdarwin.mm | 87 ++++++++----------- .../Core/Src/HW/WiimoteReal/WiimoteReal.h | 1 + 2 files changed, 38 insertions(+), 50 deletions(-) diff --git a/Source/Core/Core/Src/HW/WiimoteReal/IOdarwin.mm b/Source/Core/Core/Src/HW/WiimoteReal/IOdarwin.mm index 95068fe650..2e53daca36 100644 --- a/Source/Core/Core/Src/HW/WiimoteReal/IOdarwin.mm +++ b/Source/Core/Core/Src/HW/WiimoteReal/IOdarwin.mm @@ -10,19 +10,6 @@ } @end -WiimoteScanner::WiimoteScanner() -{} - -std::vector WiimoteScanner::FindWiimotes(size_t max_wiimotes) -{ - return std::vector(); -} - -bool WiimoteScanner::IsReady() const -{ - return false; -} - @implementation SearchBT - (void) deviceInquiryComplete: (IOBluetoothDeviceInquiry *) sender error: (IOReturn) error @@ -112,34 +99,35 @@ bool WiimoteScanner::IsReady() const namespace WiimoteReal { -// Find wiimotes. -// wm is an array of max_wiimotes wiimotes -// Returns the total number of found wiimotes. -int FindWiimotes(Wiimote **wm, int max_wiimotes) +WiimoteScanner::WiimoteScanner() +{} + +WiimoteScanner::~WiimoteScanner() +{} + +std::vector WiimoteScanner::FindWiimotes(size_t max_wiimotes) { + // TODO: find the device in the constructor and save it for later + + std::vector wiimotes; IOBluetoothHostController *bth; IOBluetoothDeviceInquiry *bti; SearchBT *sbt; NSEnumerator *en; - int found_devices = 0, found_wiimotes = 0; - - // Count the number of already found wiimotes - for (int i = 0; i < MAX_WIIMOTES; ++i) - if (wm[i]) - found_wiimotes++; bth = [[IOBluetoothHostController alloc] init]; - if ([bth addressAsString] == nil) { + if ([bth addressAsString] == nil) + { WARN_LOG(WIIMOTE, "No bluetooth host controller"); [bth release]; - return found_wiimotes; + return wiimotes; } sbt = [[SearchBT alloc] init]; - sbt->maxDevices = max_wiimotes - found_wiimotes; + sbt->maxDevices = max_wiimotes; bti = [[IOBluetoothDeviceInquiry alloc] init]; [bti setDelegate: sbt]; - [bti setInquiryLength: 5]; + [bti setInquiryLength: 2]; if ([bti start] == kIOReturnSuccess) [bti retain]; @@ -149,10 +137,9 @@ int FindWiimotes(Wiimote **wm, int max_wiimotes) CFRunLoopRun(); [bti stop]; - found_devices = [[bti foundDevices] count]; + int found_devices = [[bti foundDevices] count]; - NOTICE_LOG(WIIMOTE, "Found %i bluetooth device%c", found_devices, - found_devices == 1 ? '\0' : 's'); + NOTICE_LOG(WIIMOTE, "Found %i bluetooth devices", found_devices); en = [[bti foundDevices] objectEnumerator]; for (int i = 0; i < found_devices; i++) @@ -160,24 +147,26 @@ int FindWiimotes(Wiimote **wm, int max_wiimotes) IOBluetoothDevice *dev = [en nextObject]; if (!IsValidBluetoothName([[dev name] UTF8String])) continue; - // Find an unused slot - for (int k = 0; k < MAX_WIIMOTES; k++) { - if (wm[k] != NULL || - !(g_wiimote_sources[k] & WIIMOTE_SRC_REAL)) - continue; - wm[k] = new Wiimote(k); - wm[k]->btd = dev; - found_wiimotes++; + Wiimote *wm = new Wiimote(); + wm->btd = dev; + wiimotes.push_back(wm); + + if(wiimotes.size() >= max_wiimotes) break; - } } [bth release]; [bti release]; [sbt release]; - return found_wiimotes; + return wiimotes; +} + +bool WiimoteScanner::IsReady() const +{ + // TODO: only return true when a BT device is present + return true; } // Connect to a wiimote with a known address. @@ -192,7 +181,8 @@ bool Wiimote::Connect() withPSM: kBluetoothL2CAPPSMHIDControl delegate: cbt]; [btd openL2CAPChannelSync: &ichan withPSM: kBluetoothL2CAPPSMHIDInterrupt delegate: cbt]; - if (ichan == NULL || cchan == NULL) { + if (ichan == NULL || cchan == NULL) + { ERROR_LOG(WIIMOTE, "Unable to open L2CAP channels " "for wiimote %i", index + 1); Disconnect(); @@ -209,11 +199,6 @@ bool Wiimote::Connect() m_connected = true; - Handshake(); - SetLEDs(WIIMOTE_LED_1 << index); - - m_wiimote_thread = std::thread(std::mem_fun(&Wiimote::ThreadFunc), this); - [cbt release]; return true; @@ -240,9 +225,9 @@ void Wiimote::Disconnect() ichan = NULL; } -bool Wiimote::IsOpen() const +bool Wiimote::IsConnected() const { - return IsConnected(); + return m_connected; } int Wiimote::IORead(unsigned char *buf) @@ -251,6 +236,8 @@ int Wiimote::IORead(unsigned char *buf) if (!IsConnected()) return 0; + + // TODO: race conditions here, yo bytes = inputlen; memcpy(buf, input, bytes); @@ -259,14 +246,14 @@ int Wiimote::IORead(unsigned char *buf) return bytes; } -int Wiimote::IOWrite(unsigned char *buf, int len) +int Wiimote::IOWrite(const unsigned char *buf, int len) { IOReturn ret; if (!IsConnected()) return 0; - ret = [ichan writeAsync: buf length: len refcon: nil]; + ret = [ichan writeAsync: const_cast((void *)buf) length: len refcon: nil]; if (ret == kIOReturnSuccess) return len; diff --git a/Source/Core/Core/Src/HW/WiimoteReal/WiimoteReal.h b/Source/Core/Core/Src/HW/WiimoteReal/WiimoteReal.h index 23631765ed..139d59ce99 100644 --- a/Source/Core/Core/Src/HW/WiimoteReal/WiimoteReal.h +++ b/Source/Core/Core/Src/HW/WiimoteReal/WiimoteReal.h @@ -84,6 +84,7 @@ public: IOBluetoothL2CAPChannel *cchan; char input[MAX_PAYLOAD]; int inputlen; + bool m_connected; #elif defined(__linux__) && HAVE_BLUEZ bdaddr_t bdaddr; // Bluetooth address int cmd_sock; // Command socket From 1f1b4a6992553d132de3fc8b097fdfbba78ff556 Mon Sep 17 00:00:00 2001 From: Jordan Woyak Date: Fri, 8 Feb 2013 16:54:48 -0600 Subject: [PATCH 15/49] Hopefully make real wiimotes on OSX less crashy. --- Source/Core/Core/Src/HW/WiimoteReal/IOdarwin.mm | 12 ++++++++---- Source/Core/Core/Src/HW/WiimoteReal/WiimoteReal.cpp | 6 +++--- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/Source/Core/Core/Src/HW/WiimoteReal/IOdarwin.mm b/Source/Core/Core/Src/HW/WiimoteReal/IOdarwin.mm index 2e53daca36..030daa0973 100644 --- a/Source/Core/Core/Src/HW/WiimoteReal/IOdarwin.mm +++ b/Source/Core/Core/Src/HW/WiimoteReal/IOdarwin.mm @@ -40,8 +40,11 @@ { IOBluetoothDevice *device = [l2capChannel getDevice]; WiimoteReal::Wiimote *wm = NULL; + + std::lock_guard lk(g_refresh_lock); - for (int i = 0; i < MAX_WIIMOTES; i++) { + for (int i = 0; i < MAX_WIIMOTES; i++) + { if (WiimoteReal::g_wiimotes[i] == NULL) continue; if ([device isEqual: WiimoteReal::g_wiimotes[i]->btd] == TRUE) @@ -77,8 +80,11 @@ { IOBluetoothDevice *device = [l2capChannel getDevice]; WiimoteReal::Wiimote *wm = NULL; + + std::lock_guard lk(g_refresh_lock); - for (int i = 0; i < MAX_WIIMOTES; i++) { + for (int i = 0; i < MAX_WIIMOTES; i++) + { if (WiimoteReal::g_wiimotes[i] == NULL) continue; if ([device isEqual: WiimoteReal::g_wiimotes[i]->btd] == TRUE) @@ -236,8 +242,6 @@ int Wiimote::IORead(unsigned char *buf) if (!IsConnected()) return 0; - - // TODO: race conditions here, yo bytes = inputlen; memcpy(buf, input, bytes); diff --git a/Source/Core/Core/Src/HW/WiimoteReal/WiimoteReal.cpp b/Source/Core/Core/Src/HW/WiimoteReal/WiimoteReal.cpp index 5b8ee72f16..7ae1a9a961 100644 --- a/Source/Core/Core/Src/HW/WiimoteReal/WiimoteReal.cpp +++ b/Source/Core/Core/Src/HW/WiimoteReal/WiimoteReal.cpp @@ -360,13 +360,13 @@ void Wiimote::ThreadFunc() while (m_run_thread && IsConnected()) { #ifdef __APPLE__ - while (Write()) {} - Common::SleepCurrentThread(1); + // Reading happens elsewhere on OSX + bool const did_something = Write(); #else bool const did_something = Write() || Read(); +#endif if (!did_something) Common::SleepCurrentThread(1); -#endif } } From 9bb9286cd3b1dca212d9e5ebd95960f102ea79bc Mon Sep 17 00:00:00 2001 From: Jordan Woyak Date: Fri, 8 Feb 2013 16:59:59 -0600 Subject: [PATCH 16/49] OSX buildfix! --- Source/Core/Core/Src/HW/WiimoteReal/IOdarwin.mm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Source/Core/Core/Src/HW/WiimoteReal/IOdarwin.mm b/Source/Core/Core/Src/HW/WiimoteReal/IOdarwin.mm index 030daa0973..02f3941fc8 100644 --- a/Source/Core/Core/Src/HW/WiimoteReal/IOdarwin.mm +++ b/Source/Core/Core/Src/HW/WiimoteReal/IOdarwin.mm @@ -41,7 +41,7 @@ IOBluetoothDevice *device = [l2capChannel getDevice]; WiimoteReal::Wiimote *wm = NULL; - std::lock_guard lk(g_refresh_lock); + std::lock_guard lk(WiimoteReal::g_refresh_lock); for (int i = 0; i < MAX_WIIMOTES; i++) { @@ -81,7 +81,7 @@ IOBluetoothDevice *device = [l2capChannel getDevice]; WiimoteReal::Wiimote *wm = NULL; - std::lock_guard lk(g_refresh_lock); + std::lock_guard lk(WiimoteReal::g_refresh_lock); for (int i = 0; i < MAX_WIIMOTES; i++) { From 50c83d614cba54f2720b889be3dd3bd8fea4840c Mon Sep 17 00:00:00 2001 From: Jordan Woyak Date: Fri, 8 Feb 2013 21:20:54 -0600 Subject: [PATCH 17/49] More attempts at fixing Windows and OS X. --- Source/Core/Core/Src/HW/WiimoteReal/IONix.cpp | 3 ++ Source/Core/Core/Src/HW/WiimoteReal/IOWin.cpp | 45 ++++++++++--------- .../Core/Core/Src/HW/WiimoteReal/IOdarwin.mm | 6 --- 3 files changed, 26 insertions(+), 28 deletions(-) diff --git a/Source/Core/Core/Src/HW/WiimoteReal/IONix.cpp b/Source/Core/Core/Src/HW/WiimoteReal/IONix.cpp index 2d3ed01e6d..e926d44ec0 100644 --- a/Source/Core/Core/Src/HW/WiimoteReal/IONix.cpp +++ b/Source/Core/Core/Src/HW/WiimoteReal/IONix.cpp @@ -178,6 +178,9 @@ bool Wiimote::IsConnected() const return cmd_sock != -1;// && int_sock != -1; } +// positive = read packet +// negative = didn't read packet +// zero = error int Wiimote::IORead(u8* buf) { // Block select for 1/2000th of a second diff --git a/Source/Core/Core/Src/HW/WiimoteReal/IOWin.cpp b/Source/Core/Core/Src/HW/WiimoteReal/IOWin.cpp index 25a83531dc..8226c784e8 100644 --- a/Source/Core/Core/Src/HW/WiimoteReal/IOWin.cpp +++ b/Source/Core/Core/Src/HW/WiimoteReal/IOWin.cpp @@ -148,12 +148,9 @@ std::vector WiimoteScanner::FindWiimotes(size_t max_wiimotes) { PairUp(); - std::vector wiimotes; - GUID device_id; HANDLE dev; HDEVINFO device_info; - int found_wiimotes = 0; DWORD len; SP_DEVICE_INTERFACE_DATA device_data; PSP_DEVICE_INTERFACE_DETAIL_DATA detail_data = NULL; @@ -167,13 +164,11 @@ std::vector WiimoteScanner::FindWiimotes(size_t max_wiimotes) // Get all hid devices connected device_info = SetupDiGetClassDevs(&device_id, NULL, NULL, (DIGCF_DEVICEINTERFACE | DIGCF_PRESENT)); - for (int index = 0; found_wiimotes < max_wiimotes; ++index) + std::vector wiimotes; + for (int index = 0; wiimotes.size() < max_wiimotes; ++index) { - if (detail_data) - { - free(detail_data); - detail_data = NULL; - } + free(detail_data); + detail_data = NULL; // Query the next hid device info if (!SetupDiEnumDeviceInterfaces(device_info, NULL, &device_id, index, &device_data)) @@ -188,7 +183,10 @@ std::vector WiimoteScanner::FindWiimotes(size_t max_wiimotes) if (!SetupDiGetDeviceInterfaceDetail(device_info, &device_data, detail_data, len, NULL, NULL)) continue; + auto const wm = new Wiimote; + // Open new device +#if 0 dev = CreateFile(detail_data->DevicePath, (GENERIC_READ | GENERIC_WRITE), (FILE_SHARE_READ | FILE_SHARE_WRITE), @@ -199,18 +197,15 @@ std::vector WiimoteScanner::FindWiimotes(size_t max_wiimotes) // Get device attributes attr.Size = sizeof(attr); HidD_GetAttributes(dev, &attr); - - // Find an unused slot - unsigned int k = 0; - auto const wm = new Wiimote; + wm->dev_handle = dev; +#endif wm->devicepath = detail_data->DevicePath; wiimotes.push_back(wm); } - if (detail_data) - free(detail_data); + free(detail_data); SetupDiDestroyDeviceInfoList(device_info); @@ -219,6 +214,8 @@ std::vector WiimoteScanner::FindWiimotes(size_t max_wiimotes) bool WiimoteScanner::IsReady() const { + // TODO: don't search for a radio each time + BLUETOOTH_FIND_RADIO_PARAMS radioParam; radioParam.dwSize = sizeof(radioParam); @@ -241,7 +238,7 @@ bool Wiimote::Connect() { dev_handle = CreateFile(devicepath.c_str(), (GENERIC_READ | GENERIC_WRITE), - (FILE_SHARE_READ | FILE_SHARE_WRITE), + /*(FILE_SHARE_READ | FILE_SHARE_WRITE)*/ 0, NULL, OPEN_EXISTING, FILE_FLAG_OVERLAPPED, NULL); if (dev_handle == INVALID_HANDLE_VALUE) @@ -281,8 +278,13 @@ bool Wiimote::IsConnected() const return dev_handle != 0; } +// positive = read packet +// negative = didn't read packet +// zero = error int Wiimote::IORead(unsigned char* buf) { + *buf = 0; + DWORD b; if (!ReadFile(dev_handle, buf, MAX_PAYLOAD, &b, &hid_overlap)) { @@ -291,7 +293,6 @@ int Wiimote::IORead(unsigned char* buf) if ((b == ERROR_HANDLE_EOF) || (b == ERROR_DEVICE_NOT_CONNECTED)) { // Remote disconnect - Disconnect(); return 0; } @@ -299,24 +300,23 @@ int Wiimote::IORead(unsigned char* buf) if (r == WAIT_TIMEOUT) { // Timeout - cancel and continue - if (*buf) WARN_LOG(WIIMOTE, "Packet ignored. This may indicate a problem (timeout is %i ms).", WIIMOTE_DEFAULT_TIMEOUT); CancelIo(dev_handle); ResetEvent(hid_overlap.hEvent); - return 0; + return -1; } else if (r == WAIT_FAILED) { WARN_LOG(WIIMOTE, "A wait error occured on reading from wiimote %i.", index + 1); - return 0; + return -1; } if (!GetOverlappedResult(dev_handle, &hid_overlap, &b, 0)) { - return 0; + return -1; } } @@ -378,7 +378,6 @@ int Wiimote::IOWrite(const u8* buf, int len) { // Semaphore timeout NOTICE_LOG(WIIMOTE, "WiimoteIOWrite[MSBT_STACK_MS]: Unable to send data to wiimote"); - Disconnect(); return 0; } @@ -418,6 +417,8 @@ int PairUp(bool unpair) radioParam.dwSize = sizeof(radioParam); HANDLE hRadio; + + // TODO: save radio(s) in the WiimoteScanner constructor // Enumerate BT radios HBLUETOOTH_RADIO_FIND hFindRadio = Bth_BluetoothFindFirstRadio(&radioParam, &hRadio); diff --git a/Source/Core/Core/Src/HW/WiimoteReal/IOdarwin.mm b/Source/Core/Core/Src/HW/WiimoteReal/IOdarwin.mm index 02f3941fc8..f3c90d810d 100644 --- a/Source/Core/Core/Src/HW/WiimoteReal/IOdarwin.mm +++ b/Source/Core/Core/Src/HW/WiimoteReal/IOdarwin.mm @@ -213,16 +213,10 @@ bool Wiimote::Connect() // Disconnect a wiimote. void Wiimote::Disconnect() { - if (!IsConnected()) - return; - NOTICE_LOG(WIIMOTE, "Disconnecting wiimote %i", index + 1); m_connected = false; - if (m_wiimote_thread.joinable()) - m_wiimote_thread.join(); - [btd closeConnection]; [ichan release]; [cchan release]; From 05ec90488b3951d5af29e41bec47955dc36baaec Mon Sep 17 00:00:00 2001 From: Jordan Woyak Date: Mon, 11 Feb 2013 03:39:09 -0600 Subject: [PATCH 18/49] Make real wiimotes not so crappy on Windows hopefully. --- .../Core/Core/Src/HW/WiimoteReal/IODummy.cpp | 5 +- Source/Core/Core/Src/HW/WiimoteReal/IONix.cpp | 11 +- Source/Core/Core/Src/HW/WiimoteReal/IOWin.cpp | 262 +++++++++++------- .../Core/Core/Src/HW/WiimoteReal/IOdarwin.mm | 10 +- .../Core/Src/HW/WiimoteReal/WiimoteReal.cpp | 140 +++++----- .../Core/Src/HW/WiimoteReal/WiimoteReal.h | 23 +- .../Core/Src/HW/WiimoteReal/WiimoteRealBase.h | 5 +- 7 files changed, 259 insertions(+), 197 deletions(-) diff --git a/Source/Core/Core/Src/HW/WiimoteReal/IODummy.cpp b/Source/Core/Core/Src/HW/WiimoteReal/IODummy.cpp index 6af169f5ee..3a017354eb 100644 --- a/Source/Core/Core/Src/HW/WiimoteReal/IODummy.cpp +++ b/Source/Core/Core/Src/HW/WiimoteReal/IODummy.cpp @@ -29,7 +29,10 @@ WiimoteScanner::WiimoteScanner() WiimoteScanner::~WiimoteScanner() {} -std::vector WiimoteScanner::FindWiimotes(size_t max_wiimotes) +void WiimoteScanner::Update() +{} + +std::vector WiimoteScanner::FindWiimotes() { return std::vector(); } diff --git a/Source/Core/Core/Src/HW/WiimoteReal/IONix.cpp b/Source/Core/Core/Src/HW/WiimoteReal/IONix.cpp index e926d44ec0..62fd2e4ac5 100644 --- a/Source/Core/Core/Src/HW/WiimoteReal/IONix.cpp +++ b/Source/Core/Core/Src/HW/WiimoteReal/IONix.cpp @@ -60,11 +60,10 @@ WiimoteScanner::~WiimoteScanner() close(device_sock); } -// Find wiimotes. -// Does not replace already found wiimotes even if they are disconnected. -// wm is an array of max_wiimotes wiimotes -// Returns the total number of found wiimotes. -std::vector WiimoteScanner::FindWiimotes(size_t max_wiimotes) +void WiimoteScanner::Update() +{} + +std::vector WiimoteScanner::FindWiimotes() { std::vector found_wiimotes; @@ -86,7 +85,7 @@ std::vector WiimoteScanner::FindWiimotes(size_t max_wiimotes) DEBUG_LOG(WIIMOTE, "Found %i bluetooth device(s).", found_devices); // Display discovered devices - for (int i = 0; (i < found_devices) && (found_wiimotes.size() < max_wiimotes); ++i) + for (int i = 0; i < found_devices; ++i) { ERROR_LOG(WIIMOTE, "found a device..."); diff --git a/Source/Core/Core/Src/HW/WiimoteReal/IOWin.cpp b/Source/Core/Core/Src/HW/WiimoteReal/IOWin.cpp index 8226c784e8..c88cdebdbc 100644 --- a/Source/Core/Core/Src/HW/WiimoteReal/IOWin.cpp +++ b/Source/Core/Core/Src/HW/WiimoteReal/IOWin.cpp @@ -18,6 +18,7 @@ #include #include #include +#include #include #include @@ -73,6 +74,8 @@ HINSTANCE bthprops_lib = NULL; static int initialized = 0; +static std::unordered_set g_connected_devices; + inline void init_lib() { if (!initialized) @@ -127,7 +130,12 @@ inline void init_lib() namespace WiimoteReal { -int PairUp(bool unpair = false); +template +void ProcessWiimotes(bool new_scan, T& callback); + +bool AttachWiimote(HANDLE hRadio, BLUETOOTH_DEVICE_INFO_STRUCT& btdi); +void RemoveWiimote(HANDLE hRadio, BLUETOOTH_DEVICE_INFO_STRUCT& btdi); +bool ForgetWiimote(HANDLE hRadio, BLUETOOTH_DEVICE_INFO_STRUCT& btdi); WiimoteScanner::WiimoteScanner() { @@ -137,24 +145,47 @@ WiimoteScanner::WiimoteScanner() WiimoteScanner::~WiimoteScanner() { // TODO: what do we want here? - //PairUp(true); + ProcessWiimotes(false, RemoveWiimote); +} + +void WiimoteScanner::Update() +{ + bool forgot_some = false; + + ProcessWiimotes(false, [&](HANDLE hRadio, BLUETOOTH_DEVICE_INFO_STRUCT& btdi) + { + forgot_some |= ForgetWiimote(hRadio, btdi); + }); + + // Some hacks that allows disconnects to be detected before connections are handled + // workaround for wiimote 1 moving to slot 2 on temporary disconnect + if (forgot_some) + SLEEP(100); } // Find and connect wiimotes. // Does not replace already found wiimotes even if they are disconnected. // wm is an array of max_wiimotes wiimotes // Returns the total number of found and connected wiimotes. -std::vector WiimoteScanner::FindWiimotes(size_t max_wiimotes) +std::vector WiimoteScanner::FindWiimotes() { - PairUp(); + bool attached_some; + + ProcessWiimotes(true, [&](HANDLE hRadio, BLUETOOTH_DEVICE_INFO_STRUCT& btdi) + { + ForgetWiimote(hRadio, btdi); + attached_some |= AttachWiimote(hRadio, btdi); + }); + + // Hacks... + if (attached_some) + SLEEP(1000); GUID device_id; - HANDLE dev; HDEVINFO device_info; DWORD len; SP_DEVICE_INTERFACE_DATA device_data; PSP_DEVICE_INTERFACE_DETAIL_DATA detail_data = NULL; - HIDD_ATTRIBUTES attr; device_data.cbSize = sizeof(device_data); @@ -165,7 +196,7 @@ std::vector WiimoteScanner::FindWiimotes(size_t max_wiimotes) device_info = SetupDiGetClassDevs(&device_id, NULL, NULL, (DIGCF_DEVICEINTERFACE | DIGCF_PRESENT)); std::vector wiimotes; - for (int index = 0; wiimotes.size() < max_wiimotes; ++index) + for (int index = 0; true; ++index) { free(detail_data); detail_data = NULL; @@ -184,24 +215,7 @@ std::vector WiimoteScanner::FindWiimotes(size_t max_wiimotes) continue; auto const wm = new Wiimote; - - // Open new device -#if 0 - dev = CreateFile(detail_data->DevicePath, - (GENERIC_READ | GENERIC_WRITE), - (FILE_SHARE_READ | FILE_SHARE_WRITE), - NULL, OPEN_EXISTING, FILE_FLAG_OVERLAPPED, NULL); - if (dev == INVALID_HANDLE_VALUE) - continue; - - // Get device attributes - attr.Size = sizeof(attr); - HidD_GetAttributes(dev, &attr); - - wm->dev_handle = dev; -#endif wm->devicepath = detail_data->DevicePath; - wiimotes.push_back(wm); } @@ -236,9 +250,15 @@ bool WiimoteScanner::IsReady() const // Connect to a wiimote with a known device path. bool Wiimote::Connect() { + // This is where we disallow connecting to the same device twice + if (g_connected_devices.count(devicepath)) + return false; + dev_handle = CreateFile(devicepath.c_str(), (GENERIC_READ | GENERIC_WRITE), - /*(FILE_SHARE_READ | FILE_SHARE_WRITE)*/ 0, + // TODO: Just do FILE_SHARE_READ and remove "g_connected_devices"? + // That is what "WiiYourself" does. + (FILE_SHARE_READ | FILE_SHARE_WRITE), NULL, OPEN_EXISTING, FILE_FLAG_OVERLAPPED, NULL); if (dev_handle == INVALID_HANDLE_VALUE) @@ -247,11 +267,12 @@ bool Wiimote::Connect() return false; } + hid_overlap = OVERLAPPED(); hid_overlap.hEvent = CreateEvent(NULL, 1, 1, _T("")); hid_overlap.Offset = 0; hid_overlap.OffsetHigh = 0; - // TODO: do this elsewhere + // TODO: thread isn't started here now, do this elsewhere // This isn't as drastic as it sounds, since the process in which the threads // reside is normal priority. Needed for keeping audio reports at a decent rate /* @@ -261,15 +282,17 @@ bool Wiimote::Connect() } */ + g_connected_devices.insert(devicepath); return true; } void Wiimote::Disconnect() { + g_connected_devices.erase(devicepath); + CloseHandle(dev_handle); dev_handle = 0; - //ResetEvent(&hid_overlap); CloseHandle(hid_overlap.hEvent); } @@ -283,50 +306,73 @@ bool Wiimote::IsConnected() const // zero = error int Wiimote::IORead(unsigned char* buf) { + // used below for a warning *buf = 0; - DWORD b; - if (!ReadFile(dev_handle, buf, MAX_PAYLOAD, &b, &hid_overlap)) + DWORD bytes; + ResetEvent(hid_overlap.hEvent); + if (!ReadFile(dev_handle, buf, MAX_PAYLOAD - 1, &bytes, &hid_overlap)) { - // Partial read - b = GetLastError(); - if ((b == ERROR_HANDLE_EOF) || (b == ERROR_DEVICE_NOT_CONNECTED)) + auto const err = GetLastError(); + + if (ERROR_IO_PENDING == err) + { + auto const r = WaitForSingleObject(hid_overlap.hEvent, WIIMOTE_DEFAULT_TIMEOUT); + if (WAIT_TIMEOUT == r) + { + // Timeout - cancel and continue + if (*buf) + WARN_LOG(WIIMOTE, "Packet ignored. This may indicate a problem (timeout is %i ms).", + WIIMOTE_DEFAULT_TIMEOUT); + + CancelIo(dev_handle); + bytes = -1; + } + else if (WAIT_FAILED == r) + { + WARN_LOG(WIIMOTE, "A wait error occured on reading from wiimote %i.", index + 1); + bytes = 0; + } + else if (WAIT_OBJECT_0 == r) + { + if (!GetOverlappedResult(dev_handle, &hid_overlap, &bytes, TRUE)) + { + WARN_LOG(WIIMOTE, "GetOverlappedResult failed on wiimote %i.", index + 1); + bytes = 0; + } + } + else + { + bytes = 0; + } + } + else if (ERROR_HANDLE_EOF == err) { // Remote disconnect - return 0; + bytes = 0; } - - auto const r = WaitForSingleObject(hid_overlap.hEvent, WIIMOTE_DEFAULT_TIMEOUT); - if (r == WAIT_TIMEOUT) + else if (ERROR_DEVICE_NOT_CONNECTED == err) { - // Timeout - cancel and continue - if (*buf) - WARN_LOG(WIIMOTE, "Packet ignored. This may indicate a problem (timeout is %i ms).", - WIIMOTE_DEFAULT_TIMEOUT); - - CancelIo(dev_handle); - ResetEvent(hid_overlap.hEvent); - return -1; + // Remote disconnect + bytes = 0; } - else if (r == WAIT_FAILED) + else { - WARN_LOG(WIIMOTE, "A wait error occured on reading from wiimote %i.", index + 1); - return -1; - } - - if (!GetOverlappedResult(dev_handle, &hid_overlap, &b, 0)) - { - return -1; + bytes = 0; } } - // This needs to be done even if ReadFile fails, essential during init - // Move the data over one, so we can add back in data report indicator byte (here, 0xa1) - memmove(buf + 1, buf, MAX_PAYLOAD - 1); - buf[0] = 0xa1; + if (bytes > 0) + { + // Move the data over one, so we can add back in data report indicator byte (here, 0xa1) + memmove(buf + 1, buf, MAX_PAYLOAD - 1); + buf[0] = 0xa1; - ResetEvent(hid_overlap.hEvent); - return MAX_PAYLOAD; // XXX + // TODO: is this really needed? + bytes = MAX_PAYLOAD; + } + + return bytes; } int Wiimote::IOWrite(const u8* buf, int len) @@ -392,14 +438,12 @@ int Wiimote::IOWrite(const u8* buf, int len) return 0; } -// WiiMote Pair-Up, function will return amount of either new paired or unpaired devices -// negative number on failure -int PairUp(bool unpair) +// invokes callback for each found wiimote bluetooth device +template +void ProcessWiimotes(bool new_scan, T& callback) { // match strings like "Nintendo RVL-WBC-01", "Nintendo RVL-CNT-01", "Nintendo RVL-CNT-01-TR" - const std::wregex wiimote_device_name(L"Nintendo RVL-\\w{3}-\\d{2}(-\\w{2})?"); - - int nPaired = 0; + const std::wregex wiimote_device_name(L"Nintendo RVL-.*"); BLUETOOTH_DEVICE_SEARCH_PARAMS srch; srch.dwSize = sizeof(srch); @@ -409,7 +453,7 @@ int PairUp(bool unpair) // fConnected BT Devices srch.fReturnConnected = true; srch.fReturnUnknown = true; - srch.fIssueInquiry = true; + srch.fIssueInquiry = new_scan; // multiple of 1.28 seconds srch.cTimeoutMultiplier = 1; @@ -418,14 +462,10 @@ int PairUp(bool unpair) HANDLE hRadio; - // TODO: save radio(s) in the WiimoteScanner constructor + // TODO: save radio(s) in the WiimoteScanner constructor? // Enumerate BT radios HBLUETOOTH_RADIO_FIND hFindRadio = Bth_BluetoothFindFirstRadio(&radioParam, &hRadio); - - if (NULL == hFindRadio) - return -1; - while (hFindRadio) { BLUETOOTH_RADIO_INFO radioInfo; @@ -449,40 +489,7 @@ int PairUp(bool unpair) if (std::regex_match(btdi.szName, wiimote_device_name)) { - if (unpair) - { - if (SUCCEEDED(Bth_BluetoothRemoveDevice(&btdi.Address))) - { - NOTICE_LOG(WIIMOTE, - "Pair-Up: Automatically removed BT Device on shutdown: %08x", - GetLastError()); - ++nPaired; - } - } - else - { - if (false == btdi.fConnected) - { - // TODO: improve the read of the BT driver, esp. when batteries - // of the wiimote are removed while being fConnected - if (btdi.fRemembered) - { - // Make Windows forget old expired pairing. We can pretty - // much ignore the return value here. It either worked - // (ERROR_SUCCESS), or the device did not exist - // (ERROR_NOT_FOUND). In both cases, there is nothing left. - Bth_BluetoothRemoveDevice(&btdi.Address); - } - - // Activate service - const DWORD hr = Bth_BluetoothSetServiceState(hRadio, &btdi, - &HumanInterfaceDeviceServiceClass_UUID, BLUETOOTH_SERVICE_ENABLE); - if (SUCCEEDED(hr)) - ++nPaired; - else - ERROR_LOG(WIIMOTE, "Pair-Up: BluetoothSetServiceState() returned %08x", hr); - } - } + callback(hRadio, btdi); } if (false == Bth_BluetoothFindNextDevice(hFindDevice, &btdi)) @@ -498,8 +505,53 @@ int PairUp(bool unpair) hFindRadio = NULL; } } +} - return nPaired; +void RemoveWiimote(HANDLE, BLUETOOTH_DEVICE_INFO_STRUCT& btdi) +{ + //if (btdi.fConnected) + { + if (SUCCEEDED(Bth_BluetoothRemoveDevice(&btdi.Address))) + { + NOTICE_LOG(WIIMOTE, "Removed BT Device", GetLastError()); + } + } +} + +bool AttachWiimote(HANDLE hRadio, BLUETOOTH_DEVICE_INFO_STRUCT& btdi) +{ + if (!btdi.fConnected && !btdi.fRemembered) + { + NOTICE_LOG(WIIMOTE, "Found wiimote. Enabling HID service."); + + // Activate service + const DWORD hr = Bth_BluetoothSetServiceState(hRadio, &btdi, + &HumanInterfaceDeviceServiceClass_UUID, BLUETOOTH_SERVICE_ENABLE); + + if (FAILED(hr)) + ERROR_LOG(WIIMOTE, "Pair-Up: BluetoothSetServiceState() returned %08x", hr); + else + return true; + } + + return false; +} + +// Removes remembered non-connected devices +bool ForgetWiimote(HANDLE, BLUETOOTH_DEVICE_INFO_STRUCT& btdi) +{ + if (!btdi.fConnected && btdi.fRemembered) + { + // We don't want "remembered" devices. + // SetServiceState seems to just fail with them. + // Make Windows forget about them. + NOTICE_LOG(WIIMOTE, "Removing remembered wiimote."); + Bth_BluetoothRemoveDevice(&btdi.Address); + + return true; + } + + return false; } }; diff --git a/Source/Core/Core/Src/HW/WiimoteReal/IOdarwin.mm b/Source/Core/Core/Src/HW/WiimoteReal/IOdarwin.mm index f3c90d810d..9ed78800cc 100644 --- a/Source/Core/Core/Src/HW/WiimoteReal/IOdarwin.mm +++ b/Source/Core/Core/Src/HW/WiimoteReal/IOdarwin.mm @@ -111,7 +111,10 @@ WiimoteScanner::WiimoteScanner() WiimoteScanner::~WiimoteScanner() {} -std::vector WiimoteScanner::FindWiimotes(size_t max_wiimotes) +void WiimoteScanner::Update() +{} + +std::vector WiimoteScanner::FindWiimotes() { // TODO: find the device in the constructor and save it for later @@ -130,7 +133,7 @@ std::vector WiimoteScanner::FindWiimotes(size_t max_wiimotes) } sbt = [[SearchBT alloc] init]; - sbt->maxDevices = max_wiimotes; + sbt->maxDevices = 32; bti = [[IOBluetoothDeviceInquiry alloc] init]; [bti setDelegate: sbt]; [bti setInquiryLength: 2]; @@ -157,9 +160,6 @@ std::vector WiimoteScanner::FindWiimotes(size_t max_wiimotes) Wiimote *wm = new Wiimote(); wm->btd = dev; wiimotes.push_back(wm); - - if(wiimotes.size() >= max_wiimotes) - break; } [bth release]; diff --git a/Source/Core/Core/Src/HW/WiimoteReal/WiimoteReal.cpp b/Source/Core/Core/Src/HW/WiimoteReal/WiimoteReal.cpp index 7ae1a9a961..6a5d91fa00 100644 --- a/Source/Core/Core/Src/HW/WiimoteReal/WiimoteReal.cpp +++ b/Source/Core/Core/Src/HW/WiimoteReal/WiimoteReal.cpp @@ -35,7 +35,7 @@ namespace WiimoteReal { void HandleFoundWiimotes(const std::vector&); -void HandleWiimoteConnect(Wiimote*); +void TryToConnectWiimote(Wiimote*); void HandleWiimoteDisconnect(int index); bool g_real_wiimotes_initialized = false; @@ -171,7 +171,10 @@ bool Wiimote::Read() rpt.second = IORead(rpt.first); if (0 == rpt.second) + { + WARN_LOG(WIIMOTE, "Wiimote::IORead failed. Disconnecting wiimote %d.", index + 1); Disconnect(); + } if (rpt.second > 0 && m_channel > 0) { @@ -192,12 +195,12 @@ bool Wiimote::Write() bool const is_speaker_data = rpt.first[1] == WM_WRITE_SPEAKER_DATA; - if (!is_speaker_data || last_audio_report.GetTimeDifference() > 5) + if (!is_speaker_data || m_last_audio_report.GetTimeDifference() > 5) { IOWrite(rpt.first, rpt.second); if (is_speaker_data) - last_audio_report.Update(); + m_last_audio_report.Update(); delete[] rpt.first; m_write_reports.Pop(); @@ -242,27 +245,24 @@ void Wiimote::Update() delete[] rpt.first; } -// Rumble briefly -void Wiimote::RumbleBriefly() +bool Wiimote::Prepare(int _index) { - unsigned char buffer = 0x01; - DEBUG_LOG(WIIMOTE, "Starting rumble..."); - QueueReport(WM_CMD_RUMBLE, &buffer, sizeof(buffer)); + index = _index; - SLEEP(200); + // Set the active LEDs. + u8 const led_report[] = {HID_TYPE_SET_REPORT, WM_CMD_LED, WIIMOTE_LED_1 << index}; - DEBUG_LOG(WIIMOTE, "Stopping rumble..."); - buffer = 0x00; - QueueReport(WM_CMD_RUMBLE, &buffer, sizeof(buffer)); -} + // Rumble briefly + u8 rumble_report[] = {HID_TYPE_SET_REPORT, WM_CMD_RUMBLE, 1}; -// Set the active LEDs. -// leds is a bitwise OR of WIIMOTE_LED_1 through WIIMOTE_LED_4. -void Wiimote::SetLEDs(int new_leds) -{ - // Remove the lower 4 bits because they control rumble - u8 const buffer = (new_leds & 0xF0); - QueueReport(WM_CMD_LED, &buffer, sizeof(buffer)); + // don't really care what is read, just that reading works + u8 input_buf[MAX_PAYLOAD]; + + // TODO: request status and check for sane response? + + return (IOWrite(led_report, sizeof(led_report)) + && IOWrite(rumble_report, sizeof(rumble_report)) + && (rumble_report[2] = 0, SLEEP(200), IOWrite(rumble_report, sizeof(rumble_report)))); } void Wiimote::EmuStart() @@ -290,48 +290,66 @@ unsigned int CalculateWantedWiimotes() return wanted_wiimotes; } -void WiimoteScanner::WantWiimotes(size_t count) +void WiimoteScanner::WantWiimotes(bool do_want) { - want_wiimotes = count; + m_want_wiimotes = do_want; } void WiimoteScanner::StartScanning() { - run_thread = true; + m_run_thread = true; if (IsReady()) { - scan_thread = std::thread(std::mem_fun(&WiimoteScanner::ThreadFunc), this); + m_scan_thread = std::thread(std::mem_fun(&WiimoteScanner::ThreadFunc), this); } } void WiimoteScanner::StopScanning() { - run_thread = false; - if (scan_thread.joinable()) + m_run_thread = false; + if (m_scan_thread.joinable()) { - scan_thread.join(); + m_scan_thread.join(); } } + +void CheckForDisconnectedWiimotes() +{ + std::lock_guard lk(g_refresh_lock); + + for (unsigned int i = 0; i != MAX_WIIMOTES; ++i) + if (g_wiimotes[i] && !g_wiimotes[i]->IsConnected()) + HandleWiimoteDisconnect(i); +} + void WiimoteScanner::ThreadFunc() { Common::SetCurrentThreadName("Wiimote Scanning Thread"); NOTICE_LOG(WIIMOTE, "Wiimote scanning has started"); - while (run_thread) + while (m_run_thread) { - auto const found_wiimotes = FindWiimotes(want_wiimotes); - HandleFoundWiimotes(found_wiimotes); -#if 1 + std::vector found_wiimotes; + + //NOTICE_LOG(WIIMOTE, "in loop"); + + if (m_want_wiimotes) + found_wiimotes = FindWiimotes(); + else { - // TODO: this code here is ugly - std::lock_guard lk(g_refresh_lock); - for (unsigned int i = 0; i != MAX_WIIMOTES; ++i) - if (g_wiimotes[i] && !g_wiimotes[i]->IsConnected()) - HandleWiimoteDisconnect(i); + // Does stuff needed to detect disconnects on Windows + Update(); } -#endif + + //NOTICE_LOG(WIIMOTE, "after update"); + + // TODO: this is a fairly lame place for this + CheckForDisconnectedWiimotes(); + + HandleFoundWiimotes(found_wiimotes); + //std::this_thread::yield(); Common::SleepCurrentThread(500); } @@ -396,8 +414,7 @@ void Initialize() if (g_real_wiimotes_initialized) return; - auto const wanted_wiimotes = CalculateWantedWiimotes(); - g_wiimote_scanner.WantWiimotes(wanted_wiimotes); + g_wiimote_scanner.WantWiimotes(0 != CalculateWantedWiimotes()); g_wiimote_scanner.StartScanning(); @@ -431,26 +448,23 @@ void ChangeWiimoteSource(unsigned int index, int source) if (!(WIIMOTE_SRC_REAL & g_wiimote_sources[index])) HandleWiimoteDisconnect(index); - auto const wanted_wiimotes = CalculateWantedWiimotes(); - g_wiimote_scanner.WantWiimotes(wanted_wiimotes); + g_wiimote_scanner.WantWiimotes(0 != CalculateWantedWiimotes()); } -void HandleWiimoteConnect(Wiimote* wm) +void TryToConnectWiimote(Wiimote* wm) { std::lock_guard lk(g_refresh_lock); for (unsigned int i = 0; i != MAX_WIIMOTES; ++i) { - if (WIIMOTE_SRC_REAL & g_wiimote_sources[i] && !g_wiimotes[i]) + if (WIIMOTE_SRC_REAL & g_wiimote_sources[i] + && !g_wiimotes[i] + && wm->Connect() + && wm->Prepare(i)) { g_wiimotes[i] = wm; - wm->index = i; wm->StartThread(); - - wm->DisableDataReporting(); - wm->SetLEDs(WIIMOTE_LED_1 << i); - wm->RumbleBriefly(); Host_ConnectWiimote(i, true); @@ -463,14 +477,12 @@ void HandleWiimoteConnect(Wiimote* wm) delete wm; - auto const want_wiimotes = CalculateWantedWiimotes(); - g_wiimote_scanner.WantWiimotes(want_wiimotes); + g_wiimote_scanner.WantWiimotes(0 != CalculateWantedWiimotes()); } void HandleWiimoteDisconnect(int index) { - // locked above - //std::lock_guard lk(g_refresh_lock); + std::lock_guard lk(g_refresh_lock); Host_ConnectWiimote(index, false); @@ -482,19 +494,12 @@ void HandleWiimoteDisconnect(int index) NOTICE_LOG(WIIMOTE, "Disconnected wiimote %i.", index + 1); } - auto const want_wiimotes = CalculateWantedWiimotes(); - g_wiimote_scanner.WantWiimotes(want_wiimotes); + g_wiimote_scanner.WantWiimotes(0 != CalculateWantedWiimotes()); } void HandleFoundWiimotes(const std::vector& wiimotes) { - std::for_each(wiimotes.begin(), wiimotes.end(), [](Wiimote* const wm) - { - if (wm->Connect()) - HandleWiimoteConnect(wm); - else - delete wm; - }); + std::for_each(wiimotes.begin(), wiimotes.end(), TryToConnectWiimote); } // This is called from the GUI thread @@ -504,14 +509,13 @@ void Refresh() { std::lock_guard lk(g_refresh_lock); + + CheckForDisconnectedWiimotes(); - auto wanted_wiimotes = CalculateWantedWiimotes(); - auto const found_wiimotes = g_wiimote_scanner.FindWiimotes(wanted_wiimotes); - - HandleFoundWiimotes(found_wiimotes); - - wanted_wiimotes = CalculateWantedWiimotes(); - g_wiimote_scanner.WantWiimotes(wanted_wiimotes); + if (0 != CalculateWantedWiimotes()) + { + HandleFoundWiimotes(g_wiimote_scanner.FindWiimotes()); + } } g_wiimote_scanner.StartScanning(); diff --git a/Source/Core/Core/Src/HW/WiimoteReal/WiimoteReal.h b/Source/Core/Core/Src/HW/WiimoteReal/WiimoteReal.h index 139d59ce99..4b8f4365d3 100644 --- a/Source/Core/Core/Src/HW/WiimoteReal/WiimoteReal.h +++ b/Source/Core/Core/Src/HW/WiimoteReal/WiimoteReal.h @@ -63,14 +63,16 @@ public: void EmuStop(); // connecting and disconnecting from physical devices + // (using address inserted by FindWiimotes) + + // FYI, Connect/Disconnect are not thread safe even between unique objects (on windows) bool Connect(); void Disconnect(); // TODO: change to something like IsRelevant bool IsConnected() const; - void SetLEDs(int leds); - void RumbleBriefly(); + bool Prepare(int index); void DisableDataReporting(); @@ -116,7 +118,7 @@ private: Common::FifoQueue m_read_reports; Common::FifoQueue m_write_reports; - Common::Timer last_audio_report; + Common::Timer m_last_audio_report; }; class WiimoteScanner @@ -127,22 +129,23 @@ public: bool IsReady() const; - void WantWiimotes(size_t count); + void WantWiimotes(bool do_want); void StartScanning(); void StopScanning(); - std::vector FindWiimotes(size_t max_wiimotes); + std::vector FindWiimotes(); + + // function called when not looking for more wiimotes + void Update(); private: void ThreadFunc(); - std::thread scan_thread; + std::thread m_scan_thread; - volatile bool run_thread; - - // TODO: this should probably be atomic - volatile size_t want_wiimotes; + volatile bool m_run_thread; + volatile bool m_want_wiimotes; #if defined(_WIN32) diff --git a/Source/Core/Core/Src/HW/WiimoteReal/WiimoteRealBase.h b/Source/Core/Core/Src/HW/WiimoteReal/WiimoteRealBase.h index 75a6d3e6a3..15bbc2917f 100644 --- a/Source/Core/Core/Src/HW/WiimoteReal/WiimoteRealBase.h +++ b/Source/Core/Core/Src/HW/WiimoteReal/WiimoteRealBase.h @@ -66,8 +66,9 @@ // End Wiimote internal codes -#define MAX_PAYLOAD 32 -#define WIIMOTE_DEFAULT_TIMEOUT 30 +// It's 23. NOT 32! +#define MAX_PAYLOAD 23 +#define WIIMOTE_DEFAULT_TIMEOUT 1000 #ifdef _WIN32 // Available bluetooth stacks for Windows. From 7a053d0f0715a5308300a9ee05928433a8250953 Mon Sep 17 00:00:00 2001 From: Jordan Woyak Date: Mon, 11 Feb 2013 03:50:54 -0600 Subject: [PATCH 19/49] buildfix! --- Source/Core/Core/Src/HW/WiimoteReal/IONix.cpp | 4 ++-- Source/Core/Core/Src/HW/WiimoteReal/IOWin.cpp | 2 ++ Source/Core/Core/Src/HW/WiimoteReal/IOdarwin.mm | 2 ++ Source/Core/Core/Src/HW/WiimoteReal/WiimoteReal.cpp | 5 +---- 4 files changed, 7 insertions(+), 6 deletions(-) diff --git a/Source/Core/Core/Src/HW/WiimoteReal/IONix.cpp b/Source/Core/Core/Src/HW/WiimoteReal/IONix.cpp index 62fd2e4ac5..87ddc5086b 100644 --- a/Source/Core/Core/Src/HW/WiimoteReal/IONix.cpp +++ b/Source/Core/Core/Src/HW/WiimoteReal/IONix.cpp @@ -27,8 +27,8 @@ namespace WiimoteReal { WiimoteScanner::WiimoteScanner() - : run_thread() - , want_wiimotes() + : m_run_thread() + , m_want_wiimotes() , device_id(-1) , device_sock(-1) { diff --git a/Source/Core/Core/Src/HW/WiimoteReal/IOWin.cpp b/Source/Core/Core/Src/HW/WiimoteReal/IOWin.cpp index c88cdebdbc..1920577de4 100644 --- a/Source/Core/Core/Src/HW/WiimoteReal/IOWin.cpp +++ b/Source/Core/Core/Src/HW/WiimoteReal/IOWin.cpp @@ -138,6 +138,8 @@ void RemoveWiimote(HANDLE hRadio, BLUETOOTH_DEVICE_INFO_STRUCT& btdi); bool ForgetWiimote(HANDLE hRadio, BLUETOOTH_DEVICE_INFO_STRUCT& btdi); WiimoteScanner::WiimoteScanner() + : m_run_thread() + , m_want_wiimotes() { init_lib(); } diff --git a/Source/Core/Core/Src/HW/WiimoteReal/IOdarwin.mm b/Source/Core/Core/Src/HW/WiimoteReal/IOdarwin.mm index 9ed78800cc..51dcd17785 100644 --- a/Source/Core/Core/Src/HW/WiimoteReal/IOdarwin.mm +++ b/Source/Core/Core/Src/HW/WiimoteReal/IOdarwin.mm @@ -106,6 +106,8 @@ namespace WiimoteReal { WiimoteScanner::WiimoteScanner() + : m_run_thread() + , m_want_wiimotes() {} WiimoteScanner::~WiimoteScanner() diff --git a/Source/Core/Core/Src/HW/WiimoteReal/WiimoteReal.cpp b/Source/Core/Core/Src/HW/WiimoteReal/WiimoteReal.cpp index 6a5d91fa00..821eccea0c 100644 --- a/Source/Core/Core/Src/HW/WiimoteReal/WiimoteReal.cpp +++ b/Source/Core/Core/Src/HW/WiimoteReal/WiimoteReal.cpp @@ -250,14 +250,11 @@ bool Wiimote::Prepare(int _index) index = _index; // Set the active LEDs. - u8 const led_report[] = {HID_TYPE_SET_REPORT, WM_CMD_LED, WIIMOTE_LED_1 << index}; + u8 const led_report[] = {HID_TYPE_SET_REPORT, WM_CMD_LED, u8(WIIMOTE_LED_1 << index)}; // Rumble briefly u8 rumble_report[] = {HID_TYPE_SET_REPORT, WM_CMD_RUMBLE, 1}; - // don't really care what is read, just that reading works - u8 input_buf[MAX_PAYLOAD]; - // TODO: request status and check for sane response? return (IOWrite(led_report, sizeof(led_report)) From c267be2682cd6d6fbcf163893a1361aa49511c8f Mon Sep 17 00:00:00 2001 From: Jordan Woyak Date: Mon, 11 Feb 2013 05:30:51 -0600 Subject: [PATCH 20/49] Hopefully fix windows! --- Source/Core/Core/Src/HW/WiimoteReal/IOWin.cpp | 13 +++++++++++-- Source/Core/Core/Src/HW/WiimoteReal/WiimoteReal.cpp | 10 +++++++--- 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/Source/Core/Core/Src/HW/WiimoteReal/IOWin.cpp b/Source/Core/Core/Src/HW/WiimoteReal/IOWin.cpp index 1920577de4..7c6f6f20d0 100644 --- a/Source/Core/Core/Src/HW/WiimoteReal/IOWin.cpp +++ b/Source/Core/Core/Src/HW/WiimoteReal/IOWin.cpp @@ -18,6 +18,7 @@ #include #include #include +#include #include #include @@ -379,6 +380,14 @@ int Wiimote::IORead(unsigned char* buf) int Wiimote::IOWrite(const u8* buf, int len) { + u8 big_buf[MAX_PAYLOAD]; + if (len < MAX_PAYLOAD) + { + std::copy(buf, buf + len, big_buf); + std::fill(big_buf + len, big_buf + MAX_PAYLOAD, 0); + buf = big_buf; + } + DWORD bytes = 0; switch (stack) { @@ -386,7 +395,7 @@ int Wiimote::IOWrite(const u8* buf, int len) { // Try to auto-detect the stack type - auto i = WriteFile(dev_handle, buf + 1, 22, &bytes, &hid_overlap); + auto i = WriteFile(dev_handle, buf + 1, MAX_PAYLOAD - 1, &bytes, &hid_overlap); if (i) { // Bluesoleil will always return 1 here, even if it's not connected @@ -433,7 +442,7 @@ int Wiimote::IOWrite(const u8* buf, int len) break; } case MSBT_STACK_BLUESOLEIL: - return WriteFile(dev_handle, buf + 1, 22, &bytes, &hid_overlap); + return WriteFile(dev_handle, buf + 1, MAX_PAYLOAD - 1, &bytes, &hid_overlap); break; } diff --git a/Source/Core/Core/Src/HW/WiimoteReal/WiimoteReal.cpp b/Source/Core/Core/Src/HW/WiimoteReal/WiimoteReal.cpp index 821eccea0c..e006ec1f69 100644 --- a/Source/Core/Core/Src/HW/WiimoteReal/WiimoteReal.cpp +++ b/Source/Core/Core/Src/HW/WiimoteReal/WiimoteReal.cpp @@ -249,15 +249,19 @@ bool Wiimote::Prepare(int _index) { index = _index; + // core buttons, no continuous reporting + u8 const mode_report[] = {WM_SET_REPORT | WM_BT_OUTPUT, WM_CMD_REPORT_TYPE, 0, 0x30}; + // Set the active LEDs. - u8 const led_report[] = {HID_TYPE_SET_REPORT, WM_CMD_LED, u8(WIIMOTE_LED_1 << index)}; + u8 const led_report[] = {WM_SET_REPORT | WM_BT_OUTPUT, WM_CMD_LED, u8(WIIMOTE_LED_1 << index)}; // Rumble briefly - u8 rumble_report[] = {HID_TYPE_SET_REPORT, WM_CMD_RUMBLE, 1}; + u8 rumble_report[] = {WM_SET_REPORT | WM_BT_OUTPUT, WM_CMD_RUMBLE, 1}; // TODO: request status and check for sane response? - return (IOWrite(led_report, sizeof(led_report)) + return (IOWrite(mode_report, sizeof(mode_report)) + && IOWrite(led_report, sizeof(led_report)) && IOWrite(rumble_report, sizeof(rumble_report)) && (rumble_report[2] = 0, SLEEP(200), IOWrite(rumble_report, sizeof(rumble_report)))); } From b8fd5c0c307aa45f846b4ec412e05608d0e93e41 Mon Sep 17 00:00:00 2001 From: Jordan Woyak Date: Mon, 11 Feb 2013 05:57:55 -0600 Subject: [PATCH 21/49] Fix Windows for real! --- Source/Core/Core/Src/HW/WiimoteReal/IOWin.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Source/Core/Core/Src/HW/WiimoteReal/IOWin.cpp b/Source/Core/Core/Src/HW/WiimoteReal/IOWin.cpp index 7c6f6f20d0..d9b6a665ef 100644 --- a/Source/Core/Core/Src/HW/WiimoteReal/IOWin.cpp +++ b/Source/Core/Core/Src/HW/WiimoteReal/IOWin.cpp @@ -421,8 +421,7 @@ int Wiimote::IOWrite(const u8* buf, int len) else { ERROR_LOG(WIIMOTE, "IOWrite[MSBT_STACK_UNKNOWN]: ERROR: %08x", dw); - // Correct? - return -1; + return 0; } break; } From c2d2fb8c7c84ab2abf439f1ccdafd44d71b41b64 Mon Sep 17 00:00:00 2001 From: Jordan Woyak Date: Mon, 11 Feb 2013 15:21:58 -0600 Subject: [PATCH 22/49] Try to improve real wiimotes on Windows. --- Source/Core/Core/Src/HW/WiimoteReal/IOWin.cpp | 126 ++++++++++-------- .../Core/Src/HW/WiimoteReal/WiimoteReal.cpp | 56 +++++--- .../Core/Src/HW/WiimoteReal/WiimoteReal.h | 2 +- 3 files changed, 112 insertions(+), 72 deletions(-) diff --git a/Source/Core/Core/Src/HW/WiimoteReal/IOWin.cpp b/Source/Core/Core/Src/HW/WiimoteReal/IOWin.cpp index d9b6a665ef..d6bc5dd28b 100644 --- a/Source/Core/Core/Src/HW/WiimoteReal/IOWin.cpp +++ b/Source/Core/Core/Src/HW/WiimoteReal/IOWin.cpp @@ -270,10 +270,22 @@ bool Wiimote::Connect() return false; } - hid_overlap = OVERLAPPED(); - hid_overlap.hEvent = CreateEvent(NULL, 1, 1, _T("")); - hid_overlap.Offset = 0; - hid_overlap.OffsetHigh = 0; +#if 0 + HIDD_ATTRIBUTES attr; + attr.Size = sizeof(attr); + if (!HidD_GetAttributes(dev_handle, &attr)) + { + CloseHandle(dev_handle); + dev_handle = 0; + return false; + } +#endif + + hid_overlap_read = OVERLAPPED(); + hid_overlap_read.hEvent = CreateEvent(NULL, true, false, NULL); + + hid_overlap_write = OVERLAPPED(); + hid_overlap_write.hEvent = CreateEvent(NULL, true, false, NULL); // TODO: thread isn't started here now, do this elsewhere // This isn't as drastic as it sounds, since the process in which the threads @@ -296,7 +308,8 @@ void Wiimote::Disconnect() CloseHandle(dev_handle); dev_handle = 0; - CloseHandle(hid_overlap.hEvent); + CloseHandle(hid_overlap_read.hEvent); + CloseHandle(hid_overlap_write.hEvent); } bool Wiimote::IsConnected() const @@ -307,20 +320,20 @@ bool Wiimote::IsConnected() const // positive = read packet // negative = didn't read packet // zero = error -int Wiimote::IORead(unsigned char* buf) +int Wiimote::IORead(u8* buf) { // used below for a warning *buf = 0; DWORD bytes; - ResetEvent(hid_overlap.hEvent); - if (!ReadFile(dev_handle, buf, MAX_PAYLOAD - 1, &bytes, &hid_overlap)) + ResetEvent(hid_overlap_read.hEvent); + if (!ReadFile(dev_handle, buf, MAX_PAYLOAD - 1, &bytes, &hid_overlap_read)) { auto const err = GetLastError(); if (ERROR_IO_PENDING == err) { - auto const r = WaitForSingleObject(hid_overlap.hEvent, WIIMOTE_DEFAULT_TIMEOUT); + auto const r = WaitForSingleObject(hid_overlap_read.hEvent, WIIMOTE_DEFAULT_TIMEOUT); if (WAIT_TIMEOUT == r) { // Timeout - cancel and continue @@ -338,7 +351,7 @@ int Wiimote::IORead(unsigned char* buf) } else if (WAIT_OBJECT_0 == r) { - if (!GetOverlappedResult(dev_handle, &hid_overlap, &bytes, TRUE)) + if (!GetOverlappedResult(dev_handle, &hid_overlap_read, &bytes, TRUE)) { WARN_LOG(WIIMOTE, "GetOverlappedResult failed on wiimote %i.", index + 1); bytes = 0; @@ -380,70 +393,76 @@ int Wiimote::IORead(unsigned char* buf) int Wiimote::IOWrite(const u8* buf, int len) { - u8 big_buf[MAX_PAYLOAD]; - if (len < MAX_PAYLOAD) - { - std::copy(buf, buf + len, big_buf); - std::fill(big_buf + len, big_buf + MAX_PAYLOAD, 0); - buf = big_buf; - } - - DWORD bytes = 0; switch (stack) { case MSBT_STACK_UNKNOWN: { // Try to auto-detect the stack type - - auto i = WriteFile(dev_handle, buf + 1, MAX_PAYLOAD - 1, &bytes, &hid_overlap); - if (i) + stack = MSBT_STACK_BLUESOLEIL; + if (IOWrite(buf, len)) + return 1; + + stack = MSBT_STACK_MS; + if (IOWrite(buf, len)) { - // Bluesoleil will always return 1 here, even if it's not connected - stack = MSBT_STACK_BLUESOLEIL; - return i; + // Don't mind me, just a random sleep to fix stuff on Windows + SLEEP(1000); + return 1; } - i = HidD_SetOutputReport(dev_handle, (unsigned char*) buf + 1, len - 1); - if (i) - { - stack = MSBT_STACK_MS; - return i; - } - - auto const dw = GetLastError(); - // Checking for 121 = timeout on semaphore/device off/disconnected to - // avoid trouble with other stacks toshiba/widcomm - if (dw == 121) - { - NOTICE_LOG(WIIMOTE, "IOWrite[MSBT_STACK_UNKNOWN]: Timeout"); - return 0; - } - else - { - ERROR_LOG(WIIMOTE, "IOWrite[MSBT_STACK_UNKNOWN]: ERROR: %08x", dw); - return 0; - } + stack = MSBT_STACK_UNKNOWN; break; } case MSBT_STACK_MS: { - auto i = HidD_SetOutputReport(dev_handle, (unsigned char*) buf + 1, len - 1); - auto dw = GetLastError(); + auto result = HidD_SetOutputReport(dev_handle, const_cast(buf) + 1, len - 1); + //FlushFileBuffers(dev_handle); - if (dw == 121) + if (!result) { - // Semaphore timeout - NOTICE_LOG(WIIMOTE, "WiimoteIOWrite[MSBT_STACK_MS]: Unable to send data to wiimote"); - return 0; + auto err = GetLastError(); + if (err == 121) + { + // Semaphore timeout + NOTICE_LOG(WIIMOTE, "WiimoteIOWrite[MSBT_STACK_MS]: Unable to send data to wiimote"); + } + else + { + ERROR_LOG(WIIMOTE, "IOWrite[MSBT_STACK_MS]: ERROR: %08x", err); + } } - return i; + return result; break; } case MSBT_STACK_BLUESOLEIL: - return WriteFile(dev_handle, buf + 1, MAX_PAYLOAD - 1, &bytes, &hid_overlap); + { + u8 big_buf[MAX_PAYLOAD]; + if (len < MAX_PAYLOAD) + { + std::copy(buf, buf + len, big_buf); + std::fill(big_buf + len, big_buf + MAX_PAYLOAD, 0); + buf = big_buf; + } + + ResetEvent(hid_overlap_write.hEvent); + DWORD bytes = 0; + if (WriteFile(dev_handle, buf + 1, MAX_PAYLOAD - 1, &bytes, &hid_overlap_write)) + { + // WriteFile always returns true with bluesoleil. + return 1; + } + else + { + auto const err = GetLastError(); + if (ERROR_IO_PENDING == err) + { + CancelIo(dev_handle); + } + } break; } + } return 0; } @@ -555,6 +574,7 @@ bool ForgetWiimote(HANDLE, BLUETOOTH_DEVICE_INFO_STRUCT& btdi) // We don't want "remembered" devices. // SetServiceState seems to just fail with them. // Make Windows forget about them. + // This is also required to detect a disconnect for some reason.. NOTICE_LOG(WIIMOTE, "Removing remembered wiimote."); Bth_BluetoothRemoveDevice(&btdi.Address); diff --git a/Source/Core/Core/Src/HW/WiimoteReal/WiimoteReal.cpp b/Source/Core/Core/Src/HW/WiimoteReal/WiimoteReal.cpp index e006ec1f69..6e9a72eb00 100644 --- a/Source/Core/Core/Src/HW/WiimoteReal/WiimoteReal.cpp +++ b/Source/Core/Core/Src/HW/WiimoteReal/WiimoteReal.cpp @@ -232,6 +232,12 @@ Report Wiimote::ProcessReadQueue() void Wiimote::Update() { + if (!IsConnected()) + { + HandleWiimoteDisconnect(index); + return; + } + // Pop through the queued reports Report const rpt = ProcessReadQueue(); @@ -252,18 +258,17 @@ bool Wiimote::Prepare(int _index) // core buttons, no continuous reporting u8 const mode_report[] = {WM_SET_REPORT | WM_BT_OUTPUT, WM_CMD_REPORT_TYPE, 0, 0x30}; - // Set the active LEDs. - u8 const led_report[] = {WM_SET_REPORT | WM_BT_OUTPUT, WM_CMD_LED, u8(WIIMOTE_LED_1 << index)}; + // Set the active LEDs and turn on rumble. + u8 const led_report[] = {WM_SET_REPORT | WM_BT_OUTPUT, WM_CMD_LED, u8(WIIMOTE_LED_1 << index) | 0x1}; - // Rumble briefly - u8 rumble_report[] = {WM_SET_REPORT | WM_BT_OUTPUT, WM_CMD_RUMBLE, 1}; + // Turn off rumble + u8 rumble_report[] = {WM_SET_REPORT | WM_BT_OUTPUT, WM_CMD_RUMBLE, 0}; // TODO: request status and check for sane response? return (IOWrite(mode_report, sizeof(mode_report)) && IOWrite(led_report, sizeof(led_report)) - && IOWrite(rumble_report, sizeof(rumble_report)) - && (rumble_report[2] = 0, SLEEP(200), IOWrite(rumble_report, sizeof(rumble_report)))); + && (SLEEP(200), IOWrite(rumble_report, sizeof(rumble_report)))); } void Wiimote::EmuStart() @@ -375,6 +380,8 @@ void Wiimote::ThreadFunc() { Common::SetCurrentThreadName("Wiimote Device Thread"); + Host_ConnectWiimote(index, true); + // main loop while (m_run_thread && IsConnected()) { @@ -408,13 +415,13 @@ void LoadSettings() void Initialize() { - NOTICE_LOG(WIIMOTE, "WiimoteReal::Initialize"); - std::lock_guard lk(g_refresh_lock); if (g_real_wiimotes_initialized) return; + NOTICE_LOG(WIIMOTE, "WiimoteReal::Initialize"); + g_wiimote_scanner.WantWiimotes(0 != CalculateWantedWiimotes()); g_wiimote_scanner.StartScanning(); @@ -423,9 +430,7 @@ void Initialize() } void Shutdown(void) -{ - NOTICE_LOG(WIIMOTE, "WiimoteReal::Shutdown"); - +{ g_wiimote_scanner.StopScanning(); std::lock_guard lk(g_refresh_lock); @@ -433,6 +438,8 @@ void Shutdown(void) if (!g_real_wiimotes_initialized) return; + NOTICE_LOG(WIIMOTE, "WiimoteReal::Shutdown"); + g_real_wiimotes_initialized = false; for (unsigned int i = 0; i < MAX_WIIMOTES; ++i) @@ -466,8 +473,6 @@ void TryToConnectWiimote(Wiimote* wm) g_wiimotes[i] = wm; wm->StartThread(); - - Host_ConnectWiimote(i, true); NOTICE_LOG(WIIMOTE, "Connected to wiimote %i.", i + 1); @@ -485,8 +490,6 @@ void HandleWiimoteDisconnect(int index) { std::lock_guard lk(g_refresh_lock); - Host_ConnectWiimote(index, false); - if (g_wiimotes[index]) { delete g_wiimotes[index]; @@ -511,12 +514,24 @@ void Refresh() { std::lock_guard lk(g_refresh_lock); - CheckForDisconnectedWiimotes(); + std::vector found_wiimotes; if (0 != CalculateWantedWiimotes()) { - HandleFoundWiimotes(g_wiimote_scanner.FindWiimotes()); + found_wiimotes = g_wiimote_scanner.FindWiimotes(); } + + CheckForDisconnectedWiimotes(); + + // Brief rumble for already connected wiimotes. + for (int i = 0; i != MAX_WIIMOTES; ++i) + { + // kinda sloppy + if (g_wiimotes[i]) + g_wiimotes[i]->Prepare(i); + } + + HandleFoundWiimotes(found_wiimotes); } g_wiimote_scanner.StartScanning(); @@ -546,8 +561,13 @@ void Update(int _WiimoteNumber) if (g_wiimotes[_WiimoteNumber]) g_wiimotes[_WiimoteNumber]->Update(); - else + + // Wiimote::Update() may remove the wiimote if it was disconnected. + if (!g_wiimotes[_WiimoteNumber]) + { + NOTICE_LOG(WIIMOTE, "Emulating disconnect of wiimote %d.", _WiimoteNumber + 1); Host_ConnectWiimote(_WiimoteNumber, false); + } } void StateChange(EMUSTATE_CHANGE newState) diff --git a/Source/Core/Core/Src/HW/WiimoteReal/WiimoteReal.h b/Source/Core/Core/Src/HW/WiimoteReal/WiimoteReal.h index 4b8f4365d3..55fc552abd 100644 --- a/Source/Core/Core/Src/HW/WiimoteReal/WiimoteReal.h +++ b/Source/Core/Core/Src/HW/WiimoteReal/WiimoteReal.h @@ -96,7 +96,7 @@ public: std::string devicepath; // Unique wiimote reference //ULONGLONG btaddr; // Bluetooth address HANDLE dev_handle; // HID handle - OVERLAPPED hid_overlap; // Overlap handle + OVERLAPPED hid_overlap_read, hid_overlap_write; // Overlap handle enum win_bt_stack_t stack; // Type of bluetooth stack to use #endif From 0fb7f65e04f966f9eef1b8dfcb7d8d8ebec834ae Mon Sep 17 00:00:00 2001 From: Jordan Woyak Date: Mon, 11 Feb 2013 15:58:23 -0600 Subject: [PATCH 23/49] Problems on Windows? Just SLEEP twice as long! --- Source/Core/Core/Src/HW/WiimoteReal/IOWin.cpp | 6 +++++- Source/Core/Core/Src/HW/WiimoteReal/WiimoteReal.h | 2 -- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/Source/Core/Core/Src/HW/WiimoteReal/IOWin.cpp b/Source/Core/Core/Src/HW/WiimoteReal/IOWin.cpp index d6bc5dd28b..3052f4b737 100644 --- a/Source/Core/Core/Src/HW/WiimoteReal/IOWin.cpp +++ b/Source/Core/Core/Src/HW/WiimoteReal/IOWin.cpp @@ -75,6 +75,7 @@ HINSTANCE bthprops_lib = NULL; static int initialized = 0; +std::mutex g_connected_devices_lock; static std::unordered_set g_connected_devices; inline void init_lib() @@ -182,7 +183,7 @@ std::vector WiimoteScanner::FindWiimotes() // Hacks... if (attached_some) - SLEEP(1000); + SLEEP(2000); GUID device_id; HDEVINFO device_info; @@ -253,6 +254,8 @@ bool WiimoteScanner::IsReady() const // Connect to a wiimote with a known device path. bool Wiimote::Connect() { + std::lock_guard lk(g_connected_devices_lock); + // This is where we disallow connecting to the same device twice if (g_connected_devices.count(devicepath)) return false; @@ -303,6 +306,7 @@ bool Wiimote::Connect() void Wiimote::Disconnect() { + std::lock_guard lk(g_connected_devices_lock); g_connected_devices.erase(devicepath); CloseHandle(dev_handle); diff --git a/Source/Core/Core/Src/HW/WiimoteReal/WiimoteReal.h b/Source/Core/Core/Src/HW/WiimoteReal/WiimoteReal.h index 55fc552abd..793a13ceb0 100644 --- a/Source/Core/Core/Src/HW/WiimoteReal/WiimoteReal.h +++ b/Source/Core/Core/Src/HW/WiimoteReal/WiimoteReal.h @@ -64,8 +64,6 @@ public: // connecting and disconnecting from physical devices // (using address inserted by FindWiimotes) - - // FYI, Connect/Disconnect are not thread safe even between unique objects (on windows) bool Connect(); void Disconnect(); From f3d25f2cb04002b0ede883f0c482acfd5de978a9 Mon Sep 17 00:00:00 2001 From: Jordan Woyak Date: Mon, 11 Feb 2013 16:07:01 -0600 Subject: [PATCH 24/49] OSX buildfix! --- Source/Core/Core/Src/HW/WiimoteReal/WiimoteReal.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/Core/Core/Src/HW/WiimoteReal/WiimoteReal.cpp b/Source/Core/Core/Src/HW/WiimoteReal/WiimoteReal.cpp index 6e9a72eb00..7647698c63 100644 --- a/Source/Core/Core/Src/HW/WiimoteReal/WiimoteReal.cpp +++ b/Source/Core/Core/Src/HW/WiimoteReal/WiimoteReal.cpp @@ -259,7 +259,7 @@ bool Wiimote::Prepare(int _index) u8 const mode_report[] = {WM_SET_REPORT | WM_BT_OUTPUT, WM_CMD_REPORT_TYPE, 0, 0x30}; // Set the active LEDs and turn on rumble. - u8 const led_report[] = {WM_SET_REPORT | WM_BT_OUTPUT, WM_CMD_LED, u8(WIIMOTE_LED_1 << index) | 0x1}; + u8 const led_report[] = {WM_SET_REPORT | WM_BT_OUTPUT, WM_CMD_LED, u8(WIIMOTE_LED_1 << index | 0x1)}; // Turn off rumble u8 rumble_report[] = {WM_SET_REPORT | WM_BT_OUTPUT, WM_CMD_RUMBLE, 0}; From fa10335c55520ec674e26835e1e0d0fc9d5dfb37 Mon Sep 17 00:00:00 2001 From: Jordan Woyak Date: Mon, 11 Feb 2013 17:58:56 -0600 Subject: [PATCH 25/49] Make continuous scanning optional. --- Source/Core/Core/Src/ConfigManager.cpp | 4 +++- Source/Core/Core/Src/ConfigManager.h | 1 + .../Core/Src/HW/WiimoteReal/WiimoteReal.cpp | 19 ++++++++++++------- .../Core/DolphinWX/Src/WiimoteConfigDiag.cpp | 12 ++++++++++-- Source/Core/DolphinWX/Src/WiimoteConfigDiag.h | 6 ++++++ 5 files changed, 32 insertions(+), 10 deletions(-) diff --git a/Source/Core/Core/Src/ConfigManager.cpp b/Source/Core/Core/Src/ConfigManager.cpp index 978eadace1..282c369161 100644 --- a/Source/Core/Core/Src/ConfigManager.cpp +++ b/Source/Core/Core/Src/ConfigManager.cpp @@ -241,6 +241,7 @@ void SConfig::SaveSettings() ini.Set("Core", "WiiSDCard", m_WiiSDCard); ini.Set("Core", "WiiKeyboard", m_WiiKeyboard); ini.Set("Core", "WiimoteReconnectOnLoad", m_WiimoteReconnectOnLoad); + ini.Set("Core", "WiimoteContinuousScanning", m_WiimoteContinuousScanning); ini.Set("Core", "RunCompareServer", m_LocalCoreStartupParameter.bRunCompareServer); ini.Set("Core", "RunCompareClient", m_LocalCoreStartupParameter.bRunCompareClient); ini.Set("Core", "FrameLimit", m_Framelimit); @@ -390,7 +391,8 @@ void SConfig::LoadSettings() ini.Get("Core", "WiiSDCard", &m_WiiSDCard, false); ini.Get("Core", "WiiKeyboard", &m_WiiKeyboard, false); - ini.Get("Core", "WiimoteReconnectOnLoad", &m_WiimoteReconnectOnLoad, true); + ini.Get("Core", "WiimoteReconnectOnLoad", &m_WiimoteReconnectOnLoad, true); + ini.Get("Core", "WiimoteContinuousScanning", &m_WiimoteContinuousScanning, true); ini.Get("Core", "RunCompareServer", &m_LocalCoreStartupParameter.bRunCompareServer, false); ini.Get("Core", "RunCompareClient", &m_LocalCoreStartupParameter.bRunCompareClient, false); ini.Get("Core", "MMU", &m_LocalCoreStartupParameter.bMMU, false); diff --git a/Source/Core/Core/Src/ConfigManager.h b/Source/Core/Core/Src/ConfigManager.h index e3ad7b42a9..a633bded5c 100644 --- a/Source/Core/Core/Src/ConfigManager.h +++ b/Source/Core/Core/Src/ConfigManager.h @@ -42,6 +42,7 @@ struct SConfig : NonCopyable bool m_WiiSDCard; bool m_WiiKeyboard; bool m_WiimoteReconnectOnLoad; + bool m_WiimoteContinuousScanning; // name of the last used filename std::string m_LastFilename; diff --git a/Source/Core/Core/Src/HW/WiimoteReal/WiimoteReal.cpp b/Source/Core/Core/Src/HW/WiimoteReal/WiimoteReal.cpp index 7647698c63..4b3b737d36 100644 --- a/Source/Core/Core/Src/HW/WiimoteReal/WiimoteReal.cpp +++ b/Source/Core/Core/Src/HW/WiimoteReal/WiimoteReal.cpp @@ -24,6 +24,7 @@ #include "StringUtil.h" #include "Timer.h" #include "Host.h" +#include "ConfigManager.h" #include "WiimoteReal.h" @@ -303,9 +304,9 @@ void WiimoteScanner::WantWiimotes(bool do_want) void WiimoteScanner::StartScanning() { - m_run_thread = true; - if (IsReady()) + if (!m_run_thread && IsReady()) { + m_run_thread = true; m_scan_thread = std::thread(std::mem_fun(&WiimoteScanner::ThreadFunc), this); } } @@ -413,19 +414,23 @@ void LoadSettings() } } +// config dialog calls this when some settings change void Initialize() { + if (SConfig::GetInstance().m_WiimoteContinuousScanning) + g_wiimote_scanner.StartScanning(); + else + g_wiimote_scanner.StopScanning(); + std::lock_guard lk(g_refresh_lock); + g_wiimote_scanner.WantWiimotes(0 != CalculateWantedWiimotes()); + if (g_real_wiimotes_initialized) return; NOTICE_LOG(WIIMOTE, "WiimoteReal::Initialize"); - g_wiimote_scanner.WantWiimotes(0 != CalculateWantedWiimotes()); - - g_wiimote_scanner.StartScanning(); - g_real_wiimotes_initialized = true; } @@ -534,7 +539,7 @@ void Refresh() HandleFoundWiimotes(found_wiimotes); } - g_wiimote_scanner.StartScanning(); + Initialize(); } void InterruptChannel(int _WiimoteNumber, u16 _channelID, const void* _pData, u32 _Size) diff --git a/Source/Core/DolphinWX/Src/WiimoteConfigDiag.cpp b/Source/Core/DolphinWX/Src/WiimoteConfigDiag.cpp index a4af2d5d9a..56b75531cf 100644 --- a/Source/Core/DolphinWX/Src/WiimoteConfigDiag.cpp +++ b/Source/Core/DolphinWX/Src/WiimoteConfigDiag.cpp @@ -60,14 +60,22 @@ WiimoteConfigDiag::WiimoteConfigDiag(wxWindow* const parent, InputPlugin& plugin wxButton* const refresh_btn = new wxButton(this, -1, _("Refresh"), wxDefaultPosition); refresh_btn->Bind(wxEVT_COMMAND_BUTTON_CLICKED, &WiimoteConfigDiag::RefreshRealWiimotes, this); - // "Real wiimotes" layout wxStaticBoxSizer* const real_wiimotes_group = new wxStaticBoxSizer(wxVERTICAL, this, _("Real Wiimotes")); + wxBoxSizer* const real_wiimotes_sizer = new wxBoxSizer(wxHORIZONTAL); + if (!WiimoteReal::g_wiimote_scanner.IsReady()) real_wiimotes_group->Add(new wxStaticText(this, -1, _("A supported bluetooth device could not be found.\n" "You must manually pair your wiimotes.")), 0, wxALIGN_CENTER | wxALL, 5); + + wxCheckBox* const continuous_scanning = new wxCheckBox(this, wxID_ANY, _("Continuous Scanning")); + continuous_scanning->Bind(wxEVT_COMMAND_CHECKBOX_CLICKED, &WiimoteConfigDiag::OnContinuousScanning, this); + continuous_scanning->SetValue(SConfig::GetInstance().m_WiimoteContinuousScanning); - real_wiimotes_group->Add(refresh_btn, 0, wxALIGN_CENTER); + real_wiimotes_sizer->Add(continuous_scanning, 0, wxALIGN_CENTER_VERTICAL); + real_wiimotes_sizer->AddStretchSpacer(1); + real_wiimotes_sizer->Add(refresh_btn, 0, wxALL | wxALIGN_CENTER, 5); + real_wiimotes_group->Add(real_wiimotes_sizer, 1, wxEXPAND); // "General Settings" controls const wxString str[] = { _("Bottom"), _("Top") }; diff --git a/Source/Core/DolphinWX/Src/WiimoteConfigDiag.h b/Source/Core/DolphinWX/Src/WiimoteConfigDiag.h index 316d0d48bf..26d6660ee2 100644 --- a/Source/Core/DolphinWX/Src/WiimoteConfigDiag.h +++ b/Source/Core/DolphinWX/Src/WiimoteConfigDiag.h @@ -57,6 +57,12 @@ public: SConfig::GetInstance().m_WiimoteReconnectOnLoad = event.IsChecked(); event.Skip(); } + void OnContinuousScanning(wxCommandEvent& event) + { + SConfig::GetInstance().m_WiimoteContinuousScanning = event.IsChecked(); + WiimoteReal::Initialize(); + event.Skip(); + } private: void Cancel(wxCommandEvent& event); From a6461ca186c67592c1bd6bb4f6cd175c03ddcde3 Mon Sep 17 00:00:00 2001 From: Jordan Woyak Date: Mon, 11 Feb 2013 20:50:09 -0600 Subject: [PATCH 26/49] Improve wiimote reconnection on changing wiimote sources. --- .../Core/Src/HW/WiimoteReal/WiimoteReal.cpp | 48 +++++++++++++++---- .../Core/DolphinWX/Src/WiimoteConfigDiag.cpp | 2 +- 2 files changed, 40 insertions(+), 10 deletions(-) diff --git a/Source/Core/Core/Src/HW/WiimoteReal/WiimoteReal.cpp b/Source/Core/Core/Src/HW/WiimoteReal/WiimoteReal.cpp index 4b3b737d36..34fc7e92f5 100644 --- a/Source/Core/Core/Src/HW/WiimoteReal/WiimoteReal.cpp +++ b/Source/Core/Core/Src/HW/WiimoteReal/WiimoteReal.cpp @@ -38,6 +38,7 @@ namespace WiimoteReal void HandleFoundWiimotes(const std::vector&); void TryToConnectWiimote(Wiimote*); void HandleWiimoteDisconnect(int index); +void DoneWithWiimote(int index); bool g_real_wiimotes_initialized = false; @@ -382,6 +383,7 @@ void Wiimote::ThreadFunc() Common::SetCurrentThreadName("Wiimote Device Thread"); Host_ConnectWiimote(index, true); + NOTICE_LOG(WIIMOTE, "Connected to wiimote %i.", index + 1); // main loop while (m_run_thread && IsConnected()) @@ -453,15 +455,20 @@ void Shutdown(void) void ChangeWiimoteSource(unsigned int index, int source) { + { std::lock_guard lk(g_refresh_lock); - + g_wiimote_sources[index] = source; - - // source is emulated, kill any real connection - if (!(WIIMOTE_SRC_REAL & g_wiimote_sources[index])) - HandleWiimoteDisconnect(index); - g_wiimote_scanner.WantWiimotes(0 != CalculateWantedWiimotes()); + + // kill real connection (or swap to different slot) + DoneWithWiimote(index); + } + + // reconnect to emu + Host_ConnectWiimote(index, false); + if (WIIMOTE_SRC_EMU & source) + Host_ConnectWiimote(index, true); } void TryToConnectWiimote(Wiimote* wm) @@ -478,8 +485,6 @@ void TryToConnectWiimote(Wiimote* wm) g_wiimotes[i] = wm; wm->StartThread(); - - NOTICE_LOG(WIIMOTE, "Connected to wiimote %i.", i + 1); wm = NULL; break; @@ -491,6 +496,32 @@ void TryToConnectWiimote(Wiimote* wm) g_wiimote_scanner.WantWiimotes(0 != CalculateWantedWiimotes()); } +void DoneWithWiimote(int index) +{ + std::lock_guard lk(g_refresh_lock); + + if (g_wiimotes[index]) + { + g_wiimotes[index]->StopThread(); + + // First see if we can use this real wiimote in another slot. + for (unsigned int i = 0; i != MAX_WIIMOTES; ++i) + { + if (WIIMOTE_SRC_REAL & g_wiimote_sources[i] + && !g_wiimotes[i] + && g_wiimotes[index]->Prepare(i)) + { + std::swap(g_wiimotes[i], g_wiimotes[index]); + g_wiimotes[i]->StartThread(); + break; + } + } + } + + // else, just disconnect the wiimote + HandleWiimoteDisconnect(index); +} + void HandleWiimoteDisconnect(int index) { std::lock_guard lk(g_refresh_lock); @@ -570,7 +601,6 @@ void Update(int _WiimoteNumber) // Wiimote::Update() may remove the wiimote if it was disconnected. if (!g_wiimotes[_WiimoteNumber]) { - NOTICE_LOG(WIIMOTE, "Emulating disconnect of wiimote %d.", _WiimoteNumber + 1); Host_ConnectWiimote(_WiimoteNumber, false); } } diff --git a/Source/Core/DolphinWX/Src/WiimoteConfigDiag.cpp b/Source/Core/DolphinWX/Src/WiimoteConfigDiag.cpp index 56b75531cf..3cd050a293 100644 --- a/Source/Core/DolphinWX/Src/WiimoteConfigDiag.cpp +++ b/Source/Core/DolphinWX/Src/WiimoteConfigDiag.cpp @@ -66,7 +66,7 @@ WiimoteConfigDiag::WiimoteConfigDiag(wxWindow* const parent, InputPlugin& plugin if (!WiimoteReal::g_wiimote_scanner.IsReady()) real_wiimotes_group->Add(new wxStaticText(this, -1, _("A supported bluetooth device could not be found.\n" - "You must manually pair your wiimotes.")), 0, wxALIGN_CENTER | wxALL, 5); + "You must manually connect your wiimotes.")), 0, wxALIGN_CENTER | wxALL, 5); wxCheckBox* const continuous_scanning = new wxCheckBox(this, wxID_ANY, _("Continuous Scanning")); continuous_scanning->Bind(wxEVT_COMMAND_CHECKBOX_CLICKED, &WiimoteConfigDiag::OnContinuousScanning, this); From da53ca8ee3127ff898f557212523b43d09207564 Mon Sep 17 00:00:00 2001 From: Jordan Woyak Date: Tue, 12 Feb 2013 00:19:27 -0600 Subject: [PATCH 27/49] "Wait for the wiimote to connect"? I think that's a horrible idea. --- Source/Core/DolphinWX/Src/FrameTools.cpp | 4 ---- 1 file changed, 4 deletions(-) diff --git a/Source/Core/DolphinWX/Src/FrameTools.cpp b/Source/Core/DolphinWX/Src/FrameTools.cpp index 56dde8e2ce..cb2750ade4 100644 --- a/Source/Core/DolphinWX/Src/FrameTools.cpp +++ b/Source/Core/DolphinWX/Src/FrameTools.cpp @@ -1355,10 +1355,6 @@ void CFrame::ConnectWiimote(int wm_idx, bool connect) wxString msg(wxString::Format(wxT("Wiimote %i %s"), wm_idx + 1, connect ? wxT("Connected") : wxT("Disconnected"))); Core::DisplayMessage(msg.ToAscii(), 3000); - - // Wait for the wiimote to connect - while (GetUsbPointer()->AccessWiiMote(wm_idx | 0x100)->IsConnected() != connect) - {} Host_UpdateMainFrame(); } } From 12674b3164f809814c6059b4bfdf9e800819da0c Mon Sep 17 00:00:00 2001 From: Jordan Woyak Date: Tue, 12 Feb 2013 17:01:51 -0600 Subject: [PATCH 28/49] Possibly improve real wiimotes on Windows. --- Source/Core/Core/Src/HW/WiimoteReal/IOWin.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Source/Core/Core/Src/HW/WiimoteReal/IOWin.cpp b/Source/Core/Core/Src/HW/WiimoteReal/IOWin.cpp index 3052f4b737..0f00d3fa5f 100644 --- a/Source/Core/Core/Src/HW/WiimoteReal/IOWin.cpp +++ b/Source/Core/Core/Src/HW/WiimoteReal/IOWin.cpp @@ -432,7 +432,7 @@ int Wiimote::IOWrite(const u8* buf, int len) } else { - ERROR_LOG(WIIMOTE, "IOWrite[MSBT_STACK_MS]: ERROR: %08x", err); + WARN_LOG(WIIMOTE, "IOWrite[MSBT_STACK_MS]: ERROR: %08x", err); } } @@ -488,7 +488,7 @@ void ProcessWiimotes(bool new_scan, T& callback) srch.fReturnUnknown = true; srch.fIssueInquiry = new_scan; // multiple of 1.28 seconds - srch.cTimeoutMultiplier = 1; + srch.cTimeoutMultiplier = 2; BLUETOOTH_FIND_RADIO_PARAMS radioParam; radioParam.dwSize = sizeof(radioParam); From 7f305ba82288fa86fbe200036b26fd2cb219a293 Mon Sep 17 00:00:00 2001 From: Jordan Woyak Date: Tue, 12 Feb 2013 18:56:36 -0600 Subject: [PATCH 29/49] Fix sloppy connection logic. --- .../Core/Src/HW/WiimoteReal/WiimoteReal.cpp | 25 ++++++++++--------- 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/Source/Core/Core/Src/HW/WiimoteReal/WiimoteReal.cpp b/Source/Core/Core/Src/HW/WiimoteReal/WiimoteReal.cpp index 34fc7e92f5..ee685aae9b 100644 --- a/Source/Core/Core/Src/HW/WiimoteReal/WiimoteReal.cpp +++ b/Source/Core/Core/Src/HW/WiimoteReal/WiimoteReal.cpp @@ -478,15 +478,14 @@ void TryToConnectWiimote(Wiimote* wm) for (unsigned int i = 0; i != MAX_WIIMOTES; ++i) { if (WIIMOTE_SRC_REAL & g_wiimote_sources[i] - && !g_wiimotes[i] - && wm->Connect() - && wm->Prepare(i)) + && !g_wiimotes[i]) { - g_wiimotes[i] = wm; - - wm->StartThread(); - - wm = NULL; + if (wm->Connect() && wm->Prepare(i)) + { + g_wiimotes[i] = wm; + wm->StartThread(); + wm = NULL; + } break; } } @@ -508,11 +507,13 @@ void DoneWithWiimote(int index) for (unsigned int i = 0; i != MAX_WIIMOTES; ++i) { if (WIIMOTE_SRC_REAL & g_wiimote_sources[i] - && !g_wiimotes[i] - && g_wiimotes[index]->Prepare(i)) + && !g_wiimotes[i]) { - std::swap(g_wiimotes[i], g_wiimotes[index]); - g_wiimotes[i]->StartThread(); + if (g_wiimotes[index]->Prepare(i)) + { + std::swap(g_wiimotes[i], g_wiimotes[index]); + g_wiimotes[i]->StartThread(); + } break; } } From 77381a1af2d59b799afeb326bba122fbefff7287 Mon Sep 17 00:00:00 2001 From: Jordan Woyak Date: Tue, 12 Feb 2013 21:37:47 -0600 Subject: [PATCH 30/49] Futile attempts at fixing OS X. --- Source/Core/Core/Src/HW/WiimoteReal/IOdarwin.mm | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/Source/Core/Core/Src/HW/WiimoteReal/IOdarwin.mm b/Source/Core/Core/Src/HW/WiimoteReal/IOdarwin.mm index 51dcd17785..8c3a0f10b2 100644 --- a/Source/Core/Core/Src/HW/WiimoteReal/IOdarwin.mm +++ b/Source/Core/Core/Src/HW/WiimoteReal/IOdarwin.mm @@ -150,7 +150,8 @@ std::vector WiimoteScanner::FindWiimotes() [bti stop]; int found_devices = [[bti foundDevices] count]; - NOTICE_LOG(WIIMOTE, "Found %i bluetooth devices", found_devices); + if (found_devices) + NOTICE_LOG(WIIMOTE, "Found %i bluetooth devices", found_devices); en = [[bti foundDevices] objectEnumerator]; for (int i = 0; i < found_devices; i++) @@ -180,11 +181,11 @@ bool WiimoteScanner::IsReady() const // Connect to a wiimote with a known address. bool Wiimote::Connect() { - ConnectBT *cbt = [[ConnectBT alloc] init]; - if (IsConnected()) return false; + ConnectBT *cbt = [[ConnectBT alloc] init]; + [btd openL2CAPChannelSync: &cchan withPSM: kBluetoothL2CAPPSMHIDControl delegate: cbt]; [btd openL2CAPChannelSync: &ichan @@ -215,6 +216,9 @@ bool Wiimote::Connect() // Disconnect a wiimote. void Wiimote::Disconnect() { + if (!IsConnected()) + return; + NOTICE_LOG(WIIMOTE, "Disconnecting wiimote %i", index + 1); m_connected = false; From e57ff0613082c47a936ffef1c40a12780c489995 Mon Sep 17 00:00:00 2001 From: Jordan Woyak Date: Wed, 13 Feb 2013 14:00:15 -0600 Subject: [PATCH 31/49] Futile attempts at fixing Windows. --- Source/Core/Core/Src/HW/WiimoteReal/IOWin.cpp | 109 ++++++++---------- 1 file changed, 50 insertions(+), 59 deletions(-) diff --git a/Source/Core/Core/Src/HW/WiimoteReal/IOWin.cpp b/Source/Core/Core/Src/HW/WiimoteReal/IOWin.cpp index 0f00d3fa5f..61abeffa2d 100644 --- a/Source/Core/Core/Src/HW/WiimoteReal/IOWin.cpp +++ b/Source/Core/Core/Src/HW/WiimoteReal/IOWin.cpp @@ -19,7 +19,8 @@ #include #include #include -#include +#include +#include #include #include @@ -75,8 +76,7 @@ HINSTANCE bthprops_lib = NULL; static int initialized = 0; -std::mutex g_connected_devices_lock; -static std::unordered_set g_connected_devices; +std::unordered_map g_connect_times; inline void init_lib() { @@ -173,60 +173,50 @@ void WiimoteScanner::Update() // Returns the total number of found and connected wiimotes. std::vector WiimoteScanner::FindWiimotes() { - bool attached_some; - - ProcessWiimotes(true, [&](HANDLE hRadio, BLUETOOTH_DEVICE_INFO_STRUCT& btdi) + ProcessWiimotes(true, [](HANDLE hRadio, BLUETOOTH_DEVICE_INFO_STRUCT& btdi) { ForgetWiimote(hRadio, btdi); - attached_some |= AttachWiimote(hRadio, btdi); + AttachWiimote(hRadio, btdi); }); - // Hacks... - if (attached_some) - SLEEP(2000); - - GUID device_id; - HDEVINFO device_info; - DWORD len; - SP_DEVICE_INTERFACE_DATA device_data; - PSP_DEVICE_INTERFACE_DETAIL_DATA detail_data = NULL; - - device_data.cbSize = sizeof(device_data); - // Get the device id + GUID device_id; HidD_GetHidGuid(&device_id); // Get all hid devices connected - device_info = SetupDiGetClassDevs(&device_id, NULL, NULL, (DIGCF_DEVICEINTERFACE | DIGCF_PRESENT)); + HDEVINFO const device_info = SetupDiGetClassDevs(&device_id, NULL, NULL, (DIGCF_DEVICEINTERFACE | DIGCF_PRESENT)); std::vector wiimotes; - for (int index = 0; true; ++index) + + SP_DEVICE_INTERFACE_DATA device_data; + device_data.cbSize = sizeof(device_data); + PSP_DEVICE_INTERFACE_DETAIL_DATA detail_data = NULL; + + for (int index = 0; SetupDiEnumDeviceInterfaces(device_info, NULL, &device_id, index, &device_data); ++index) { - free(detail_data); - detail_data = NULL; - - // Query the next hid device info - if (!SetupDiEnumDeviceInterfaces(device_info, NULL, &device_id, index, &device_data)) - break; - // Get the size of the data block required + DWORD len; SetupDiGetDeviceInterfaceDetail(device_info, &device_data, NULL, 0, &len, NULL); detail_data = (PSP_DEVICE_INTERFACE_DETAIL_DATA)malloc(len); detail_data->cbSize = sizeof(SP_DEVICE_INTERFACE_DETAIL_DATA); // Query the data for this device - if (!SetupDiGetDeviceInterfaceDetail(device_info, &device_data, detail_data, len, NULL, NULL)) - continue; + if (SetupDiGetDeviceInterfaceDetail(device_info, &device_data, detail_data, len, NULL, NULL)) + { + auto const wm = new Wiimote; + wm->devicepath = detail_data->DevicePath; + wiimotes.push_back(wm); + } - auto const wm = new Wiimote; - wm->devicepath = detail_data->DevicePath; - wiimotes.push_back(wm); + free(detail_data); } - free(detail_data); - SetupDiDestroyDeviceInfoList(device_info); + // Don't mind me, just a random sleep to fix stuff on Windows + //if (!wiimotes.empty()) + // SLEEP(2000); + return wiimotes; } @@ -254,17 +244,14 @@ bool WiimoteScanner::IsReady() const // Connect to a wiimote with a known device path. bool Wiimote::Connect() { - std::lock_guard lk(g_connected_devices_lock); - - // This is where we disallow connecting to the same device twice - if (g_connected_devices.count(devicepath)) + if (IsConnected()) return false; dev_handle = CreateFile(devicepath.c_str(), - (GENERIC_READ | GENERIC_WRITE), - // TODO: Just do FILE_SHARE_READ and remove "g_connected_devices"? - // That is what "WiiYourself" does. - (FILE_SHARE_READ | FILE_SHARE_WRITE), + GENERIC_READ | GENERIC_WRITE, + // Having no FILE_SHARE_WRITE disallows us from connecting to the same wiimote twice. + // This is what "WiiYourself" does. + FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_FLAG_OVERLAPPED, NULL); if (dev_handle == INVALID_HANDLE_VALUE) @@ -299,15 +286,13 @@ bool Wiimote::Connect() ERROR_LOG(WIIMOTE, "Failed to set wiimote thread priority"); } */ - - g_connected_devices.insert(devicepath); return true; } void Wiimote::Disconnect() { - std::lock_guard lk(g_connected_devices_lock); - g_connected_devices.erase(devicepath); + if (!IsConnected()) + return; CloseHandle(dev_handle); dev_handle = 0; @@ -385,7 +370,7 @@ int Wiimote::IORead(u8* buf) if (bytes > 0) { // Move the data over one, so we can add back in data report indicator byte (here, 0xa1) - memmove(buf + 1, buf, MAX_PAYLOAD - 1); + std::copy_n(buf, MAX_PAYLOAD - 1, buf + 1); buf[0] = 0xa1; // TODO: is this really needed? @@ -408,11 +393,7 @@ int Wiimote::IOWrite(const u8* buf, int len) stack = MSBT_STACK_MS; if (IOWrite(buf, len)) - { - // Don't mind me, just a random sleep to fix stuff on Windows - SLEEP(1000); return 1; - } stack = MSBT_STACK_UNKNOWN; break; @@ -553,6 +534,8 @@ void RemoveWiimote(HANDLE, BLUETOOTH_DEVICE_INFO_STRUCT& btdi) bool AttachWiimote(HANDLE hRadio, BLUETOOTH_DEVICE_INFO_STRUCT& btdi) { + // We don't want "remembered" devices. + // SetServiceState will just fail with them.. if (!btdi.fConnected && !btdi.fRemembered) { NOTICE_LOG(WIIMOTE, "Found wiimote. Enabling HID service."); @@ -561,6 +544,8 @@ bool AttachWiimote(HANDLE hRadio, BLUETOOTH_DEVICE_INFO_STRUCT& btdi) const DWORD hr = Bth_BluetoothSetServiceState(hRadio, &btdi, &HumanInterfaceDeviceServiceClass_UUID, BLUETOOTH_SERVICE_ENABLE); + g_connect_times[btdi.Address.ullLong] = std::time(nullptr); + if (FAILED(hr)) ERROR_LOG(WIIMOTE, "Pair-Up: BluetoothSetServiceState() returned %08x", hr); else @@ -575,14 +560,20 @@ bool ForgetWiimote(HANDLE, BLUETOOTH_DEVICE_INFO_STRUCT& btdi) { if (!btdi.fConnected && btdi.fRemembered) { - // We don't want "remembered" devices. - // SetServiceState seems to just fail with them. - // Make Windows forget about them. - // This is also required to detect a disconnect for some reason.. - NOTICE_LOG(WIIMOTE, "Removing remembered wiimote."); - Bth_BluetoothRemoveDevice(&btdi.Address); + // Time to avoid RemoveDevice after SetServiceState. + // Sometimes SetServiceState takes a while.. + auto const avoid_forget_seconds = 5.0; - return true; + auto pair_time = g_connect_times.find(btdi.Address.ullLong); + if (pair_time == g_connect_times.end() + || std::difftime(time(nullptr), pair_time->second) >= avoid_forget_seconds) + { + // Make Windows forget about device so it will re-find it if visible. + // This is also required to detect a disconnect for some reason.. + NOTICE_LOG(WIIMOTE, "Removing remembered wiimote."); + Bth_BluetoothRemoveDevice(&btdi.Address); + return true; + } } return false; From 306e6b1d80c0426092001bb4653f93f217af152d Mon Sep 17 00:00:00 2001 From: Jordan Woyak Date: Thu, 14 Feb 2013 14:02:51 -0600 Subject: [PATCH 32/49] Turn off continuous scanning by default. --- Source/Core/Core/Src/ConfigManager.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Source/Core/Core/Src/ConfigManager.cpp b/Source/Core/Core/Src/ConfigManager.cpp index 282c369161..44a7591577 100644 --- a/Source/Core/Core/Src/ConfigManager.cpp +++ b/Source/Core/Core/Src/ConfigManager.cpp @@ -392,7 +392,7 @@ void SConfig::LoadSettings() ini.Get("Core", "WiiSDCard", &m_WiiSDCard, false); ini.Get("Core", "WiiKeyboard", &m_WiiKeyboard, false); ini.Get("Core", "WiimoteReconnectOnLoad", &m_WiimoteReconnectOnLoad, true); - ini.Get("Core", "WiimoteContinuousScanning", &m_WiimoteContinuousScanning, true); + ini.Get("Core", "WiimoteContinuousScanning", &m_WiimoteContinuousScanning, false); ini.Get("Core", "RunCompareServer", &m_LocalCoreStartupParameter.bRunCompareServer, false); ini.Get("Core", "RunCompareClient", &m_LocalCoreStartupParameter.bRunCompareClient, false); ini.Get("Core", "MMU", &m_LocalCoreStartupParameter.bMMU, false); @@ -426,4 +426,4 @@ void SConfig::LoadSettings() } m_SYSCONF = new SysConf(); -} \ No newline at end of file +} From cda88a8c1ee3ac1b407b09e8e392262fd606f6ab Mon Sep 17 00:00:00 2001 From: Jordan Woyak Date: Thu, 14 Feb 2013 18:41:31 -0600 Subject: [PATCH 33/49] Random improvements. --- .../Core/Core/Src/HW/WiimoteReal/IOdarwin.mm | 20 +++++++---- .../Core/Src/HW/WiimoteReal/WiimoteReal.cpp | 33 +++++++++++++++---- .../Core/Src/HW/WiimoteReal/WiimoteRealBase.h | 1 + 3 files changed, 40 insertions(+), 14 deletions(-) diff --git a/Source/Core/Core/Src/HW/WiimoteReal/IOdarwin.mm b/Source/Core/Core/Src/HW/WiimoteReal/IOdarwin.mm index 8c3a0f10b2..fda1d99462 100644 --- a/Source/Core/Core/Src/HW/WiimoteReal/IOdarwin.mm +++ b/Source/Core/Core/Src/HW/WiimoteReal/IOdarwin.mm @@ -216,19 +216,25 @@ bool Wiimote::Connect() // Disconnect a wiimote. void Wiimote::Disconnect() { + if (btd != NULL) + [btd closeConnection]; + + if (ichan != NULL) + [ichan release]; + + if (cchan != NULL) + [cchan release]; + + btd = NULL; + cchan = NULL; + ichan = NULL; + if (!IsConnected()) return; NOTICE_LOG(WIIMOTE, "Disconnecting wiimote %i", index + 1); m_connected = false; - - [btd closeConnection]; - [ichan release]; - [cchan release]; - btd = NULL; - cchan = NULL; - ichan = NULL; } bool Wiimote::IsConnected() const diff --git a/Source/Core/Core/Src/HW/WiimoteReal/WiimoteReal.cpp b/Source/Core/Core/Src/HW/WiimoteReal/WiimoteReal.cpp index ee685aae9b..311bf11de2 100644 --- a/Source/Core/Core/Src/HW/WiimoteReal/WiimoteReal.cpp +++ b/Source/Core/Core/Src/HW/WiimoteReal/WiimoteReal.cpp @@ -161,6 +161,18 @@ void Wiimote::InterruptChannel(const u16 channel, const void* const _data, const { rpt.first[0] = WM_SET_REPORT | WM_BT_OUTPUT; } + + // Disallow games from turning off all of the LEDs. + // It makes wiimote connection status confusing. + if (rpt.first[1] == WM_LEDS) + { + auto& leds_rpt = *reinterpret_cast(&rpt.first[2]); + if (0 == leds_rpt.leds) + { + // Turn on ALL of the LEDs. + leds_rpt.leds = 0xf; + } + } m_write_reports.Push(rpt); } @@ -265,12 +277,15 @@ bool Wiimote::Prepare(int _index) // Turn off rumble u8 rumble_report[] = {WM_SET_REPORT | WM_BT_OUTPUT, WM_CMD_RUMBLE, 0}; - - // TODO: request status and check for sane response? + + // Request status report + u8 const req_status_report[] = {WM_SET_REPORT | WM_BT_OUTPUT, WM_REQUEST_STATUS, 0}; + // TODO: check for sane response? return (IOWrite(mode_report, sizeof(mode_report)) && IOWrite(led_report, sizeof(led_report)) - && (SLEEP(200), IOWrite(rumble_report, sizeof(rumble_report)))); + && (SLEEP(200), IOWrite(rumble_report, sizeof(rumble_report))) + && IOWrite(req_status_report, sizeof(req_status_report))); } void Wiimote::EmuStart() @@ -382,9 +397,6 @@ void Wiimote::ThreadFunc() { Common::SetCurrentThreadName("Wiimote Device Thread"); - Host_ConnectWiimote(index, true); - NOTICE_LOG(WIIMOTE, "Connected to wiimote %i.", index + 1); - // main loop while (m_run_thread && IsConnected()) { @@ -485,6 +497,8 @@ void TryToConnectWiimote(Wiimote* wm) g_wiimotes[i] = wm; wm->StartThread(); wm = NULL; + + Host_ConnectWiimote(i, true); } break; } @@ -513,6 +527,8 @@ void DoneWithWiimote(int index) { std::swap(g_wiimotes[i], g_wiimotes[index]); g_wiimotes[i]->StartThread(); + + Host_ConnectWiimote(i, true); } break; } @@ -563,9 +579,12 @@ void Refresh() // Brief rumble for already connected wiimotes. for (int i = 0; i != MAX_WIIMOTES; ++i) { - // kinda sloppy if (g_wiimotes[i]) + { + g_wiimotes[i]->StopThread(); g_wiimotes[i]->Prepare(i); + g_wiimotes[i]->StartThread(); + } } HandleFoundWiimotes(found_wiimotes); diff --git a/Source/Core/Core/Src/HW/WiimoteReal/WiimoteRealBase.h b/Source/Core/Core/Src/HW/WiimoteReal/WiimoteRealBase.h index 15bbc2917f..1a1f6676cf 100644 --- a/Source/Core/Core/Src/HW/WiimoteReal/WiimoteRealBase.h +++ b/Source/Core/Core/Src/HW/WiimoteReal/WiimoteRealBase.h @@ -41,6 +41,7 @@ #define WM_SET_REPORT 0xA0 #endif +// TODO: duplicated in WiimoteHid.h // Commands #define WM_CMD_RUMBLE 0x10 #define WM_CMD_LED 0x11 From 891de527690a24a4e5c48ce04e85547905a694b9 Mon Sep 17 00:00:00 2001 From: Jordan Woyak Date: Thu, 14 Feb 2013 19:04:34 -0600 Subject: [PATCH 34/49] Don't need to hang dolphin when searching for wiimote with the refresh button. This code is getting pretty ugly. :/ --- Source/Core/Core/Src/HW/WiimoteReal/WiimoteReal.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Source/Core/Core/Src/HW/WiimoteReal/WiimoteReal.cpp b/Source/Core/Core/Src/HW/WiimoteReal/WiimoteReal.cpp index 311bf11de2..b628cf61fc 100644 --- a/Source/Core/Core/Src/HW/WiimoteReal/WiimoteReal.cpp +++ b/Source/Core/Core/Src/HW/WiimoteReal/WiimoteReal.cpp @@ -565,13 +565,15 @@ void Refresh() g_wiimote_scanner.StopScanning(); { - std::lock_guard lk(g_refresh_lock); - + std::unique_lock lk(g_refresh_lock); std::vector found_wiimotes; if (0 != CalculateWantedWiimotes()) { + // Don't hang dolphin when searching + lk.unlock(); found_wiimotes = g_wiimote_scanner.FindWiimotes(); + lk.lock(); } CheckForDisconnectedWiimotes(); From 1f20a24a04558d06f8584f0fcb35368c2a9c0f60 Mon Sep 17 00:00:00 2001 From: Jordan Woyak Date: Thu, 14 Feb 2013 21:02:41 -0600 Subject: [PATCH 35/49] Minor changes. --- .../Core/Src/HW/WiimoteReal/WiimoteReal.cpp | 34 +++++++++++-------- 1 file changed, 19 insertions(+), 15 deletions(-) diff --git a/Source/Core/Core/Src/HW/WiimoteReal/WiimoteReal.cpp b/Source/Core/Core/Src/HW/WiimoteReal/WiimoteReal.cpp index b628cf61fc..751b24ac38 100644 --- a/Source/Core/Core/Src/HW/WiimoteReal/WiimoteReal.cpp +++ b/Source/Core/Core/Src/HW/WiimoteReal/WiimoteReal.cpp @@ -336,7 +336,6 @@ void WiimoteScanner::StopScanning() } } - void CheckForDisconnectedWiimotes() { std::lock_guard lk(g_refresh_lock); @@ -485,7 +484,7 @@ void ChangeWiimoteSource(unsigned int index, int source) void TryToConnectWiimote(Wiimote* wm) { - std::lock_guard lk(g_refresh_lock); + std::unique_lock lk(g_refresh_lock); for (unsigned int i = 0; i != MAX_WIIMOTES; ++i) { @@ -494,9 +493,10 @@ void TryToConnectWiimote(Wiimote* wm) { if (wm->Connect() && wm->Prepare(i)) { - g_wiimotes[i] = wm; - wm->StartThread(); - wm = NULL; + NOTICE_LOG(WIIMOTE, "Connected to wiimote %i.", i + 1); + + std::swap(g_wiimotes[i], wm); + g_wiimotes[i]->StartThread(); Host_ConnectWiimote(i, true); } @@ -504,9 +504,11 @@ void TryToConnectWiimote(Wiimote* wm) } } - delete wm; - g_wiimote_scanner.WantWiimotes(0 != CalculateWantedWiimotes()); + + lk.unlock(); + + delete wm; } void DoneWithWiimote(int index) @@ -541,17 +543,19 @@ void DoneWithWiimote(int index) void HandleWiimoteDisconnect(int index) { - std::lock_guard lk(g_refresh_lock); - - if (g_wiimotes[index]) - { - delete g_wiimotes[index]; - g_wiimotes[index] = NULL; + Wiimote* wm = NULL; - NOTICE_LOG(WIIMOTE, "Disconnected wiimote %i.", index + 1); + { + std::lock_guard lk(g_refresh_lock); + std::swap(wm, g_wiimotes[index]); + g_wiimote_scanner.WantWiimotes(0 != CalculateWantedWiimotes()); } - g_wiimote_scanner.WantWiimotes(0 != CalculateWantedWiimotes()); + if (wm) + { + delete wm; + NOTICE_LOG(WIIMOTE, "Disconnected wiimote %i.", index + 1); + } } void HandleFoundWiimotes(const std::vector& wiimotes) From ef90b15f3ed032acd6b32b67b0a55e7a0df6a5b7 Mon Sep 17 00:00:00 2001 From: Jordan Woyak Date: Fri, 15 Feb 2013 03:00:31 -0600 Subject: [PATCH 36/49] Provide an option to not send speaker data. It can cause rumble lag even when the speaker is muted. --- Source/Core/Core/Src/ConfigManager.cpp | 2 ++ Source/Core/Core/Src/ConfigManager.h | 1 + Source/Core/Core/Src/HW/WiimoteReal/WiimoteReal.cpp | 9 +++++++++ Source/Core/DolphinWX/Src/WiimoteConfigDiag.cpp | 8 +++++++- Source/Core/DolphinWX/Src/WiimoteConfigDiag.h | 5 +++++ 5 files changed, 24 insertions(+), 1 deletion(-) diff --git a/Source/Core/Core/Src/ConfigManager.cpp b/Source/Core/Core/Src/ConfigManager.cpp index 44a7591577..85ecc7143f 100644 --- a/Source/Core/Core/Src/ConfigManager.cpp +++ b/Source/Core/Core/Src/ConfigManager.cpp @@ -242,6 +242,7 @@ void SConfig::SaveSettings() ini.Set("Core", "WiiKeyboard", m_WiiKeyboard); ini.Set("Core", "WiimoteReconnectOnLoad", m_WiimoteReconnectOnLoad); ini.Set("Core", "WiimoteContinuousScanning", m_WiimoteContinuousScanning); + ini.Set("Core", "WiimoteEnableSpeaker", m_WiimoteEnableSpeaker); ini.Set("Core", "RunCompareServer", m_LocalCoreStartupParameter.bRunCompareServer); ini.Set("Core", "RunCompareClient", m_LocalCoreStartupParameter.bRunCompareClient); ini.Set("Core", "FrameLimit", m_Framelimit); @@ -393,6 +394,7 @@ void SConfig::LoadSettings() ini.Get("Core", "WiiKeyboard", &m_WiiKeyboard, false); ini.Get("Core", "WiimoteReconnectOnLoad", &m_WiimoteReconnectOnLoad, true); ini.Get("Core", "WiimoteContinuousScanning", &m_WiimoteContinuousScanning, false); + ini.Get("Core", "WiimoteEnableSpeaker", &m_WiimoteEnableSpeaker, true); ini.Get("Core", "RunCompareServer", &m_LocalCoreStartupParameter.bRunCompareServer, false); ini.Get("Core", "RunCompareClient", &m_LocalCoreStartupParameter.bRunCompareClient, false); ini.Get("Core", "MMU", &m_LocalCoreStartupParameter.bMMU, false); diff --git a/Source/Core/Core/Src/ConfigManager.h b/Source/Core/Core/Src/ConfigManager.h index a633bded5c..0c4ceffa9f 100644 --- a/Source/Core/Core/Src/ConfigManager.h +++ b/Source/Core/Core/Src/ConfigManager.h @@ -43,6 +43,7 @@ struct SConfig : NonCopyable bool m_WiiKeyboard; bool m_WiimoteReconnectOnLoad; bool m_WiimoteContinuousScanning; + bool m_WiimoteEnableSpeaker; // name of the last used filename std::string m_LastFilename; diff --git a/Source/Core/Core/Src/HW/WiimoteReal/WiimoteReal.cpp b/Source/Core/Core/Src/HW/WiimoteReal/WiimoteReal.cpp index 751b24ac38..b5a1703527 100644 --- a/Source/Core/Core/Src/HW/WiimoteReal/WiimoteReal.cpp +++ b/Source/Core/Core/Src/HW/WiimoteReal/WiimoteReal.cpp @@ -173,6 +173,15 @@ void Wiimote::InterruptChannel(const u16 channel, const void* const _data, const leds_rpt.leds = 0xf; } } + else if (rpt.first[1] == WM_WRITE_SPEAKER_DATA + && !SConfig::GetInstance().m_WiimoteEnableSpeaker) + { + // Translate speaker data reports into rumble reports. + rpt.first[1] = WM_CMD_RUMBLE; + // Keep only the rumble bit. + rpt.first[2] &= 0x1; + rpt.second = 3; + } m_write_reports.Push(rpt); } diff --git a/Source/Core/DolphinWX/Src/WiimoteConfigDiag.cpp b/Source/Core/DolphinWX/Src/WiimoteConfigDiag.cpp index 3cd050a293..475718ed2e 100644 --- a/Source/Core/DolphinWX/Src/WiimoteConfigDiag.cpp +++ b/Source/Core/DolphinWX/Src/WiimoteConfigDiag.cpp @@ -71,11 +71,17 @@ WiimoteConfigDiag::WiimoteConfigDiag(wxWindow* const parent, InputPlugin& plugin wxCheckBox* const continuous_scanning = new wxCheckBox(this, wxID_ANY, _("Continuous Scanning")); continuous_scanning->Bind(wxEVT_COMMAND_CHECKBOX_CLICKED, &WiimoteConfigDiag::OnContinuousScanning, this); continuous_scanning->SetValue(SConfig::GetInstance().m_WiimoteContinuousScanning); + + auto wiimote_speaker = new wxCheckBox(this, wxID_ANY, _("Enable Speaker Data")); + wiimote_speaker->Bind(wxEVT_COMMAND_CHECKBOX_CLICKED, &WiimoteConfigDiag::OnEnableSpeaker, this); + wiimote_speaker->SetValue(SConfig::GetInstance().m_WiimoteEnableSpeaker); real_wiimotes_sizer->Add(continuous_scanning, 0, wxALIGN_CENTER_VERTICAL); real_wiimotes_sizer->AddStretchSpacer(1); real_wiimotes_sizer->Add(refresh_btn, 0, wxALL | wxALIGN_CENTER, 5); - real_wiimotes_group->Add(real_wiimotes_sizer, 1, wxEXPAND); + + real_wiimotes_group->Add(wiimote_speaker, 0); + real_wiimotes_group->Add(real_wiimotes_sizer, 0, wxEXPAND); // "General Settings" controls const wxString str[] = { _("Bottom"), _("Top") }; diff --git a/Source/Core/DolphinWX/Src/WiimoteConfigDiag.h b/Source/Core/DolphinWX/Src/WiimoteConfigDiag.h index 26d6660ee2..4c33661ca2 100644 --- a/Source/Core/DolphinWX/Src/WiimoteConfigDiag.h +++ b/Source/Core/DolphinWX/Src/WiimoteConfigDiag.h @@ -63,6 +63,11 @@ public: WiimoteReal::Initialize(); event.Skip(); } + void OnEnableSpeaker(wxCommandEvent& event) + { + SConfig::GetInstance().m_WiimoteEnableSpeaker = event.IsChecked(); + event.Skip(); + } private: void Cancel(wxCommandEvent& event); From 29d43ef897275bd200cee0ec4492b1c2052902f3 Mon Sep 17 00:00:00 2001 From: "kostamarino@hotmail.com" Date: Thu, 21 Feb 2013 20:34:45 +0200 Subject: [PATCH 37/49] Gameini database update. Update/additions of Fifa Street and Open Season (fixes issue 5438). Cleanup of DisableWiimoteSpeaker = 1 (aka Alternate wiimote timing) from the database since it is no longer used. Edit the tales of symphonia projection hack. --- Data/User/GameConfig/GF8E69.ini | 8 +- Data/User/GameConfig/GF8P69.ini | 16 ++++ Data/User/GameConfig/GOSE41.ini | 8 +- Data/User/GameConfig/GOSP41.ini | 8 +- Data/User/GameConfig/GOSX41.ini | 8 +- Data/User/GameConfig/PH_PRESETS.ini | 2 +- Data/User/GameConfig/R22E01.ini | 3 +- Data/User/GameConfig/R22J01.ini | 3 +- Data/User/GameConfig/R22P01.ini | 3 +- Data/User/GameConfig/R3ME01.ini | 39 ++++---- Data/User/GameConfig/R3MP01.ini | 39 ++++---- Data/User/GameConfig/R4QE01.ini | 39 ++++---- Data/User/GameConfig/R4QJ01.ini | 39 ++++---- Data/User/GameConfig/R4QK01.ini | 39 ++++---- Data/User/GameConfig/R4QP01.ini | 39 ++++---- Data/User/GameConfig/R5WEA4.ini | 3 +- Data/User/GameConfig/R5WJA4.ini | 3 +- Data/User/GameConfig/R7PE01.ini | 37 ++++---- Data/User/GameConfig/R7PP01.ini | 25 +++-- Data/User/GameConfig/RBWE01.ini | 35 ++++--- Data/User/GameConfig/RBWJ01.ini | 35 ++++--- Data/User/GameConfig/RBWP01.ini | 35 ++++--- Data/User/GameConfig/RCJE8P.ini | 1 - Data/User/GameConfig/RCJP8P.ini | 1 - Data/User/GameConfig/RD2E41.ini | 33 ++++--- Data/User/GameConfig/RD2J41.ini | 33 ++++--- Data/User/GameConfig/RD2K41.ini | 33 ++++--- Data/User/GameConfig/RD2P41.ini | 33 ++++--- Data/User/GameConfig/RD2X41.ini | 33 ++++--- Data/User/GameConfig/RHDE8P.ini | 39 ++++---- Data/User/GameConfig/RHDJ8P.ini | 39 ++++---- Data/User/GameConfig/RHDP8P.ini | 39 ++++---- Data/User/GameConfig/RHOE8P.ini | 77 ++++++++------- Data/User/GameConfig/RHOJ8P.ini | 23 +++-- Data/User/GameConfig/RHOP8P.ini | 23 +++-- Data/User/GameConfig/RLGE64.ini | 1 - Data/User/GameConfig/RLGJ52.ini | 1 - Data/User/GameConfig/RLGP64.ini | 1 - Data/User/GameConfig/RM3E01.ini | 1 - Data/User/GameConfig/RM3J01.ini | 1 - Data/User/GameConfig/RM3P01.ini | 1 - Data/User/GameConfig/RQREXJ.ini | 3 +- Data/User/GameConfig/RQRJAF.ini | 3 +- Data/User/GameConfig/RQRPAF.ini | 3 +- Data/User/GameConfig/RRKE70.ini | 3 +- Data/User/GameConfig/RRKP70.ini | 3 +- Data/User/GameConfig/RTZE08.ini | 39 ++++---- Data/User/GameConfig/RTZJ08.ini | 39 ++++---- Data/User/GameConfig/RTZK08.ini | 39 ++++---- Data/User/GameConfig/RTZP08.ini | 39 ++++---- Data/User/GameConfig/RZJD69.ini | 3 +- Data/User/GameConfig/RZJE69.ini | 3 +- Data/User/GameConfig/RZJJ13.ini | 3 +- Data/User/GameConfig/RZJP69.ini | 3 +- Data/User/GameConfig/RZZE8P.ini | 33 ++++--- Data/User/GameConfig/RZZJEL.ini | 33 ++++--- Data/User/GameConfig/RZZP8P.ini | 33 ++++--- Data/User/GameConfig/SC2E8P.ini | 41 ++++---- Data/User/GameConfig/SC2P8P.ini | 139 ++++++++++++++-------------- Data/User/GameConfig/SD2E41.ini | 3 +- Data/User/GameConfig/SD2J01.ini | 3 +- Data/User/GameConfig/SD2P41.ini | 3 +- Data/User/GameConfig/SD2Y41.ini | 3 +- Data/User/GameConfig/SEME4Q.ini | 3 +- Data/User/GameConfig/SEMJ01.ini | 3 +- Data/User/GameConfig/SEMP4Q.ini | 3 +- Data/User/GameConfig/SEMX4Q.ini | 3 +- Data/User/GameConfig/SEMY4Q.ini | 3 +- Data/User/GameConfig/SEMZ4Q.ini | 3 +- Data/User/GameConfig/SERE4Q.ini | 3 +- Data/User/GameConfig/SERF4Q.ini | 3 +- Data/User/GameConfig/SERP4Q.ini | 3 +- Data/User/GameConfig/SF8E01.ini | 3 +- Data/User/GameConfig/SF8J01.ini | 3 +- Data/User/GameConfig/SF8P01.ini | 3 +- Data/User/GameConfig/SFIE01.ini | 1 - Data/User/GameConfig/SFIP01.ini | 1 - Data/User/GameConfig/SHLPA4.ini | 3 +- Data/User/GameConfig/SJDE41.ini | 1 - Data/User/GameConfig/SJDP41.ini | 1 - Data/User/GameConfig/SJDY41.ini | 1 - Data/User/GameConfig/SJDZ41.ini | 1 - Data/User/GameConfig/SMOE41.ini | 41 ++++---- Data/User/GameConfig/SMOP41.ini | 41 ++++---- Data/User/GameConfig/SMOX41.ini | 41 ++++---- Data/User/GameConfig/SO3EE9.ini | 1 - Data/User/GameConfig/SO3J99.ini | 1 - Data/User/GameConfig/SOJE41.ini | 33 ++++--- Data/User/GameConfig/SOJP41.ini | 33 ++++--- Data/User/GameConfig/SOUE01.ini | 1 - Data/User/GameConfig/SOUJ01.ini | 1 - Data/User/GameConfig/SOUK01.ini | 1 - Data/User/GameConfig/SOUP01.ini | 1 - Data/User/GameConfig/SRQE41.ini | 1 - Data/User/GameConfig/SRQP41.ini | 1 - Data/User/GameConfig/SX3J01.ini | 3 +- Data/User/GameConfig/SX3P01.ini | 3 +- 97 files changed, 769 insertions(+), 832 deletions(-) create mode 100644 Data/User/GameConfig/GF8P69.ini diff --git a/Data/User/GameConfig/GF8E69.ini b/Data/User/GameConfig/GF8E69.ini index 858a62d3d8..5fa4328270 100644 --- a/Data/User/GameConfig/GF8E69.ini +++ b/Data/User/GameConfig/GF8E69.ini @@ -3,7 +3,7 @@ TLBHack = 1 [EmuState] The Emulation State. 1 is worst, 5 is best, 0 is not set. EmulationStateId = 4 -EmulationIssues = +EmulationIssues = The videos are messed up, skip them. [OnFrame] Add memory patches to be applied every frame here. [ActionReplay] Add action replay cheats here. $Master Code @@ -40,3 +40,9 @@ $Away Team Never Scores 00416F8C 00000000 [Video] ProjectionHack = 0 +PH_SZNear = 0 +PH_SZFar = 0 +PH_ExtraParam = 0 +PH_ZNear = +PH_ZFar = +[Gecko] diff --git a/Data/User/GameConfig/GF8P69.ini b/Data/User/GameConfig/GF8P69.ini new file mode 100644 index 0000000000..3d6f730434 --- /dev/null +++ b/Data/User/GameConfig/GF8P69.ini @@ -0,0 +1,16 @@ +# GF8P69 - FIFA Street +[Core] Values set here will override the main dolphin settings. +TLBHack = 1 +[EmuState] The Emulation State. 1 is worst, 5 is best, 0 is not set. +EmulationStateId = 4 +EmulationIssues = The videos are messed up, skip them. +[OnFrame] Add memory patches to be applied every frame here. +[ActionReplay] Add action replay cheats here. +[Video] +ProjectionHack = 0 +PH_SZNear = 0 +PH_SZFar = 0 +PH_ExtraParam = 0 +PH_ZNear = +PH_ZFar = +[Gecko] diff --git a/Data/User/GameConfig/GOSE41.ini b/Data/User/GameConfig/GOSE41.ini index 4682f2275c..adc124119f 100644 --- a/Data/User/GameConfig/GOSE41.ini +++ b/Data/User/GameConfig/GOSE41.ini @@ -1,9 +1,11 @@ # GOSE41 - Open Season [Core] Values set here will override the main dolphin settings. -TLBHack = 1 +MMU = 1 +FastDiscSpeed = 1 +BlockMerging = 1 [EmuState] The Emulation State. 1 is worst, 5 is best, 0 is not set. -EmulationStateId = 2 -EmulationIssues = Severe graphic issues. +EmulationStateId = 4 +EmulationIssues = Needs MMU (Slow). [OnFrame] Add memory patches to be applied every frame here. [ActionReplay] Add action replay cheats here. [Video] diff --git a/Data/User/GameConfig/GOSP41.ini b/Data/User/GameConfig/GOSP41.ini index 40fc6ad1f1..cb12055384 100644 --- a/Data/User/GameConfig/GOSP41.ini +++ b/Data/User/GameConfig/GOSP41.ini @@ -1,9 +1,11 @@ # GOSP41 - Open Season [Core] Values set here will override the main dolphin settings. -TLBHack = 1 +MMU = 1 +FastDiscSpeed = 1 +BlockMerging = 1 [EmuState] The Emulation State. 1 is worst, 5 is best, 0 is not set. -EmulationStateId = 2 -EmulationIssues = Severe graphic issues. +EmulationStateId = 4 +EmulationIssues = Needs MMU (Slow). [OnFrame] Add memory patches to be applied every frame here. [ActionReplay] Add action replay cheats here. [Video] diff --git a/Data/User/GameConfig/GOSX41.ini b/Data/User/GameConfig/GOSX41.ini index 92662f0a4c..8790cdfd8c 100644 --- a/Data/User/GameConfig/GOSX41.ini +++ b/Data/User/GameConfig/GOSX41.ini @@ -1,9 +1,11 @@ # GOSX41 - Open Season [Core] Values set here will override the main dolphin settings. -TLBHack = 1 +MMU = 1 +FastDiscSpeed = 1 +BlockMerging = 1 [EmuState] The Emulation State. 1 is worst, 5 is best, 0 is not set. -EmulationStateId = 2 -EmulationIssues = Severe graphic issues. +EmulationStateId = 4 +EmulationIssues = Needs MMU (Slow). [OnFrame] Add memory patches to be applied every frame here. [ActionReplay] Add action replay cheats here. [Video] diff --git a/Data/User/GameConfig/PH_PRESETS.ini b/Data/User/GameConfig/PH_PRESETS.ini index 8d82d00790..f5e7a4aacf 100644 --- a/Data/User/GameConfig/PH_PRESETS.ini +++ b/Data/User/GameConfig/PH_PRESETS.ini @@ -33,7 +33,7 @@ PH_ExtraParam = 1 [5] Title = Tales of Symphonia GC -PH_ZNear = 0.0002 +PH_ZNear = 0.00026 # --------------------------------------------------- diff --git a/Data/User/GameConfig/R22E01.ini b/Data/User/GameConfig/R22E01.ini index dfe3542671..c494ee5e12 100644 --- a/Data/User/GameConfig/R22E01.ini +++ b/Data/User/GameConfig/R22E01.ini @@ -17,5 +17,4 @@ PH_ZFar = SafeTextureCacheColorSamples = 512 [Video_Hacks] EFBEmulateFormatChanges = True -[Wii] -DisableWiimoteSpeaker = 1 +[Wii] diff --git a/Data/User/GameConfig/R22J01.ini b/Data/User/GameConfig/R22J01.ini index c38ff20966..94aeac02f3 100644 --- a/Data/User/GameConfig/R22J01.ini +++ b/Data/User/GameConfig/R22J01.ini @@ -17,5 +17,4 @@ PH_ZFar = SafeTextureCacheColorSamples = 512 [Video_Hacks] EFBEmulateFormatChanges = True -[Wii] -DisableWiimoteSpeaker = 1 +[Wii] diff --git a/Data/User/GameConfig/R22P01.ini b/Data/User/GameConfig/R22P01.ini index 6153cb0d06..8fb637216f 100644 --- a/Data/User/GameConfig/R22P01.ini +++ b/Data/User/GameConfig/R22P01.ini @@ -17,5 +17,4 @@ PH_ZFar = SafeTextureCacheColorSamples = 512 [Video_Hacks] EFBEmulateFormatChanges = True -[Wii] -DisableWiimoteSpeaker = 1 +[Wii] diff --git a/Data/User/GameConfig/R3ME01.ini b/Data/User/GameConfig/R3ME01.ini index 312d6a15f1..4c891c14b1 100644 --- a/Data/User/GameConfig/R3ME01.ini +++ b/Data/User/GameConfig/R3ME01.ini @@ -1,20 +1,19 @@ -# R3ME01 - Metroid Prime Trilogy -[Core] Values set here will override the main dolphin settings. -[EmuState] The Emulation State. 1 is worst, 5 is best, 0 is not set. -EmulationStateId = 4 -EmulationIssues = Disable EuRGB60(PAL60) to avoid a black bar appearing. -[OnFrame] Add memory patches to be applied every frame here. -[ActionReplay] Add action replay cheats here. -[Video] -ProjectionHack = 0 -PH_SZNear = 0 -PH_SZFar = 0 -PH_ExtraParam = 0 -PH_ZNear = -PH_ZFar = -[Gecko] -[Video_Hacks] -EFBToTextureEnable = False -EFBCopyEnable = True -[Wii] -DisableWiimoteSpeaker = 1 +# R3ME01 - Metroid Prime Trilogy +[Core] Values set here will override the main dolphin settings. +[EmuState] The Emulation State. 1 is worst, 5 is best, 0 is not set. +EmulationStateId = 4 +EmulationIssues = Disable EuRGB60(PAL60) to avoid a black bar appearing. +[OnFrame] Add memory patches to be applied every frame here. +[ActionReplay] Add action replay cheats here. +[Video] +ProjectionHack = 0 +PH_SZNear = 0 +PH_SZFar = 0 +PH_ExtraParam = 0 +PH_ZNear = +PH_ZFar = +[Gecko] +[Video_Hacks] +EFBToTextureEnable = False +EFBCopyEnable = True +[Wii] diff --git a/Data/User/GameConfig/R3MP01.ini b/Data/User/GameConfig/R3MP01.ini index 291ac8df38..71938b821a 100644 --- a/Data/User/GameConfig/R3MP01.ini +++ b/Data/User/GameConfig/R3MP01.ini @@ -1,20 +1,19 @@ -# R3MP01 - Metroid Prime Trilogy -[Core] Values set here will override the main dolphin settings. -[EmuState] The Emulation State. 1 is worst, 5 is best, 0 is not set. -EmulationStateId = 4 -EmulationIssues = Disable EuRGB60(PAL60) to avoid a black bar appearing. -[OnFrame] Add memory patches to be applied every frame here. -[ActionReplay] Add action replay cheats here. -[Video] -ProjectionHack = 0 -PH_SZNear = 0 -PH_SZFar = 0 -PH_ExtraParam = 0 -PH_ZNear = -PH_ZFar = -[Gecko] -[Video_Hacks] -EFBToTextureEnable = False -EFBCopyEnable = True -[Wii] -DisableWiimoteSpeaker = 1 +# R3MP01 - Metroid Prime Trilogy +[Core] Values set here will override the main dolphin settings. +[EmuState] The Emulation State. 1 is worst, 5 is best, 0 is not set. +EmulationStateId = 4 +EmulationIssues = Disable EuRGB60(PAL60) to avoid a black bar appearing. +[OnFrame] Add memory patches to be applied every frame here. +[ActionReplay] Add action replay cheats here. +[Video] +ProjectionHack = 0 +PH_SZNear = 0 +PH_SZFar = 0 +PH_ExtraParam = 0 +PH_ZNear = +PH_ZFar = +[Gecko] +[Video_Hacks] +EFBToTextureEnable = False +EFBCopyEnable = True +[Wii] diff --git a/Data/User/GameConfig/R4QE01.ini b/Data/User/GameConfig/R4QE01.ini index 3ae6cb283a..e822d53161 100644 --- a/Data/User/GameConfig/R4QE01.ini +++ b/Data/User/GameConfig/R4QE01.ini @@ -1,20 +1,19 @@ -# R4QE01 - Mario Strikers Charged -[Core] Values set here will override the main dolphin settings. -[EmuState] The Emulation State. 1 is worst, 5 is best, 0 is not set. -EmulationStateId = 5 -EmulationIssues = -[OnFrame] Add memory patches to be applied every frame here. -[ActionReplay] Add action replay cheats here. -[Video] -ProjectionHack = 0 -PH_SZNear = 0 -PH_SZFar = 0 -PH_ExtraParam = 0 -PH_ZNear = -PH_ZFar = -[Gecko] -[Video_Enhancements] -[Video_Hacks] -DlistCachingEnable = False -[Wii] -DisableWiimoteSpeaker = 1 +# R4QE01 - Mario Strikers Charged +[Core] Values set here will override the main dolphin settings. +[EmuState] The Emulation State. 1 is worst, 5 is best, 0 is not set. +EmulationStateId = 5 +EmulationIssues = +[OnFrame] Add memory patches to be applied every frame here. +[ActionReplay] Add action replay cheats here. +[Video] +ProjectionHack = 0 +PH_SZNear = 0 +PH_SZFar = 0 +PH_ExtraParam = 0 +PH_ZNear = +PH_ZFar = +[Gecko] +[Video_Enhancements] +[Video_Hacks] +DlistCachingEnable = False +[Wii] diff --git a/Data/User/GameConfig/R4QJ01.ini b/Data/User/GameConfig/R4QJ01.ini index d97cc37c84..14bef2a3e5 100644 --- a/Data/User/GameConfig/R4QJ01.ini +++ b/Data/User/GameConfig/R4QJ01.ini @@ -1,20 +1,19 @@ -# R4QJ01 - Mario Strikers Charged -[Core] Values set here will override the main dolphin settings. -[EmuState] The Emulation State. 1 is worst, 5 is best, 0 is not set. -EmulationStateId = 5 -EmulationIssues = -[OnFrame] Add memory patches to be applied every frame here. -[ActionReplay] Add action replay cheats here. -[Video] -ProjectionHack = 0 -PH_SZNear = 0 -PH_SZFar = 0 -PH_ExtraParam = 0 -PH_ZNear = -PH_ZFar = -[Gecko] -[Video_Enhancements] -[Video_Hacks] -DlistCachingEnable = False -[Wii] -DisableWiimoteSpeaker = 1 +# R4QJ01 - Mario Strikers Charged +[Core] Values set here will override the main dolphin settings. +[EmuState] The Emulation State. 1 is worst, 5 is best, 0 is not set. +EmulationStateId = 5 +EmulationIssues = +[OnFrame] Add memory patches to be applied every frame here. +[ActionReplay] Add action replay cheats here. +[Video] +ProjectionHack = 0 +PH_SZNear = 0 +PH_SZFar = 0 +PH_ExtraParam = 0 +PH_ZNear = +PH_ZFar = +[Gecko] +[Video_Enhancements] +[Video_Hacks] +DlistCachingEnable = False +[Wii] diff --git a/Data/User/GameConfig/R4QK01.ini b/Data/User/GameConfig/R4QK01.ini index 2c45a961a0..2fb7675fd4 100644 --- a/Data/User/GameConfig/R4QK01.ini +++ b/Data/User/GameConfig/R4QK01.ini @@ -1,20 +1,19 @@ -# R4QK01 - Mario Power Soccer -[Core] Values set here will override the main dolphin settings. -[EmuState] The Emulation State. 1 is worst, 5 is best, 0 is not set. -EmulationStateId = 5 -EmulationIssues = -[OnFrame] Add memory patches to be applied every frame here. -[ActionReplay] Add action replay cheats here. -[Video] -ProjectionHack = 0 -PH_SZNear = 0 -PH_SZFar = 0 -PH_ExtraParam = 0 -PH_ZNear = -PH_ZFar = -[Gecko] -[Video_Enhancements] -[Video_Hacks] -DlistCachingEnable = False -[Wii] -DisableWiimoteSpeaker = 1 +# R4QK01 - Mario Power Soccer +[Core] Values set here will override the main dolphin settings. +[EmuState] The Emulation State. 1 is worst, 5 is best, 0 is not set. +EmulationStateId = 5 +EmulationIssues = +[OnFrame] Add memory patches to be applied every frame here. +[ActionReplay] Add action replay cheats here. +[Video] +ProjectionHack = 0 +PH_SZNear = 0 +PH_SZFar = 0 +PH_ExtraParam = 0 +PH_ZNear = +PH_ZFar = +[Gecko] +[Video_Enhancements] +[Video_Hacks] +DlistCachingEnable = False +[Wii] diff --git a/Data/User/GameConfig/R4QP01.ini b/Data/User/GameConfig/R4QP01.ini index 8ec96e8cf3..54fa2ec234 100644 --- a/Data/User/GameConfig/R4QP01.ini +++ b/Data/User/GameConfig/R4QP01.ini @@ -1,20 +1,19 @@ -# R4QP01 - Mario Strikers Charged -[Core] Values set here will override the main dolphin settings. -[EmuState] The Emulation State. 1 is worst, 5 is best, 0 is not set. -EmulationStateId = 5 -EmulationIssues = -[OnFrame] Add memory patches to be applied every frame here. -[ActionReplay] Add action replay cheats here. -[Video] -ProjectionHack = 0 -PH_SZNear = 0 -PH_SZFar = 0 -PH_ExtraParam = 0 -PH_ZNear = -PH_ZFar = -[Gecko] -[Video_Enhancements] -[Video_Hacks] -DlistCachingEnable = False -[Wii] -DisableWiimoteSpeaker = 1 +# R4QP01 - Mario Strikers Charged +[Core] Values set here will override the main dolphin settings. +[EmuState] The Emulation State. 1 is worst, 5 is best, 0 is not set. +EmulationStateId = 5 +EmulationIssues = +[OnFrame] Add memory patches to be applied every frame here. +[ActionReplay] Add action replay cheats here. +[Video] +ProjectionHack = 0 +PH_SZNear = 0 +PH_SZFar = 0 +PH_ExtraParam = 0 +PH_ZNear = +PH_ZFar = +[Gecko] +[Video_Enhancements] +[Video_Hacks] +DlistCachingEnable = False +[Wii] diff --git a/Data/User/GameConfig/R5WEA4.ini b/Data/User/GameConfig/R5WEA4.ini index 315f7f340a..48b1c5cd12 100644 --- a/Data/User/GameConfig/R5WEA4.ini +++ b/Data/User/GameConfig/R5WEA4.ini @@ -15,5 +15,4 @@ PH_ZFar = [Gecko] [Video_Settings] SafeTextureCacheColorSamples = 512 -[Wii] -DisableWiimoteSpeaker = 1 +[Wii] diff --git a/Data/User/GameConfig/R5WJA4.ini b/Data/User/GameConfig/R5WJA4.ini index 30a983b648..25d6076a05 100644 --- a/Data/User/GameConfig/R5WJA4.ini +++ b/Data/User/GameConfig/R5WJA4.ini @@ -15,5 +15,4 @@ PH_ZFar = [Gecko] [Video_Settings] SafeTextureCacheColorSamples = 512 -[Wii] -DisableWiimoteSpeaker = 1 +[Wii] diff --git a/Data/User/GameConfig/R7PE01.ini b/Data/User/GameConfig/R7PE01.ini index 1a052239ae..244ccc1db3 100644 --- a/Data/User/GameConfig/R7PE01.ini +++ b/Data/User/GameConfig/R7PE01.ini @@ -1,19 +1,18 @@ -# R7PE01 - Punch Out -[Core] Values set here will override the main dolphin settings. -[EmuState] The Emulation State. 1 is worst, 5 is best, 0 is not set. -EmulationStateId = 4 -EmulationIssues = Disable "Use EuRGB60 (PAL60) mode" in the wii configuration tab for the game to run -[OnFrame] Add memory patches to be applied every frame here. -+$Patch -0x8011E0F8:dword:0x4E800020 -[ActionReplay] Add action replay cheats here. -[Video] -ProjectionHack = 0 -PH_SZNear = 0 -PH_SZFar = 0 -PH_ExtraParam = 0 -PH_ZNear = -PH_ZFar = -[Gecko] -[Wii] -DisableWiimoteSpeaker = 1 +# R7PE01 - Punch Out +[Core] Values set here will override the main dolphin settings. +[EmuState] The Emulation State. 1 is worst, 5 is best, 0 is not set. +EmulationStateId = 4 +EmulationIssues = Disable "Use EuRGB60 (PAL60) mode" in the wii configuration tab for the game to run +[OnFrame] Add memory patches to be applied every frame here. ++$Patch +0x8011E0F8:dword:0x4E800020 +[ActionReplay] Add action replay cheats here. +[Video] +ProjectionHack = 0 +PH_SZNear = 0 +PH_SZFar = 0 +PH_ExtraParam = 0 +PH_ZNear = +PH_ZFar = +[Gecko] +[Wii] diff --git a/Data/User/GameConfig/R7PP01.ini b/Data/User/GameConfig/R7PP01.ini index 302bd1e965..a0113b7415 100644 --- a/Data/User/GameConfig/R7PP01.ini +++ b/Data/User/GameConfig/R7PP01.ini @@ -1,13 +1,12 @@ -# R7PP01 - Punch Out -[Core] Values set here will override the main dolphin settings. -[EmuState] The Emulation State. 1 is worst, 5 is best, 0 is not set. -EmulationIssues = -EmulationStateId = 5 -[OnFrame] Add memory patches to be applied every frame here. -+$Patch -0x8011F1CC:dword:0x4E800020 -[ActionReplay] Add action replay cheats here. -[Video] -ProjectionHack = 0 -[Wii] -DisableWiimoteSpeaker = 1 +# R7PP01 - Punch Out +[Core] Values set here will override the main dolphin settings. +[EmuState] The Emulation State. 1 is worst, 5 is best, 0 is not set. +EmulationIssues = +EmulationStateId = 5 +[OnFrame] Add memory patches to be applied every frame here. ++$Patch +0x8011F1CC:dword:0x4E800020 +[ActionReplay] Add action replay cheats here. +[Video] +ProjectionHack = 0 +[Wii] diff --git a/Data/User/GameConfig/RBWE01.ini b/Data/User/GameConfig/RBWE01.ini index 9e8d586cf4..a2cad6ff7d 100644 --- a/Data/User/GameConfig/RBWE01.ini +++ b/Data/User/GameConfig/RBWE01.ini @@ -1,18 +1,17 @@ -# RBWE01 - Battalion Wars 2 -[Core] Values set here will override the main dolphin settings. -[EmuState] The Emulation State. 1 is worst, 5 is best, 0 is not set. -EmulationStateId = 4 -EmulationIssues = Needs LLE audio for proper sound. -[OnFrame] Add memory patches to be applied every frame here. -[ActionReplay] Add action replay cheats here. -[Video] -ProjectionHack = 0 -PH_SZNear = 0 -PH_SZFar = 0 -PH_ExtraParam = 0 -PH_ZNear = -PH_ZFar = -[Gecko] -[Video_Enhancements] -[Wii] -DisableWiimoteSpeaker = 1 +# RBWE01 - Battalion Wars 2 +[Core] Values set here will override the main dolphin settings. +[EmuState] The Emulation State. 1 is worst, 5 is best, 0 is not set. +EmulationStateId = 4 +EmulationIssues = Needs LLE audio for proper sound. +[OnFrame] Add memory patches to be applied every frame here. +[ActionReplay] Add action replay cheats here. +[Video] +ProjectionHack = 0 +PH_SZNear = 0 +PH_SZFar = 0 +PH_ExtraParam = 0 +PH_ZNear = +PH_ZFar = +[Gecko] +[Video_Enhancements] +[Wii] diff --git a/Data/User/GameConfig/RBWJ01.ini b/Data/User/GameConfig/RBWJ01.ini index bf95ff65c8..0d799c74fa 100644 --- a/Data/User/GameConfig/RBWJ01.ini +++ b/Data/User/GameConfig/RBWJ01.ini @@ -1,18 +1,17 @@ -# RBWJ01 - Totsugeki Famicom Wars vs. -[Core] Values set here will override the main dolphin settings. -[EmuState] The Emulation State. 1 is worst, 5 is best, 0 is not set. -EmulationStateId = 4 -EmulationIssues = Needs LLE audio for proper sound. -[OnFrame] Add memory patches to be applied every frame here. -[ActionReplay] Add action replay cheats here. -[Video] -ProjectionHack = 0 -PH_SZNear = 0 -PH_SZFar = 0 -PH_ExtraParam = 0 -PH_ZNear = -PH_ZFar = -[Gecko] -[Video_Enhancements] -[Wii] -DisableWiimoteSpeaker = 1 +# RBWJ01 - Totsugeki Famicom Wars vs. +[Core] Values set here will override the main dolphin settings. +[EmuState] The Emulation State. 1 is worst, 5 is best, 0 is not set. +EmulationStateId = 4 +EmulationIssues = Needs LLE audio for proper sound. +[OnFrame] Add memory patches to be applied every frame here. +[ActionReplay] Add action replay cheats here. +[Video] +ProjectionHack = 0 +PH_SZNear = 0 +PH_SZFar = 0 +PH_ExtraParam = 0 +PH_ZNear = +PH_ZFar = +[Gecko] +[Video_Enhancements] +[Wii] diff --git a/Data/User/GameConfig/RBWP01.ini b/Data/User/GameConfig/RBWP01.ini index f6282130a5..5422388866 100644 --- a/Data/User/GameConfig/RBWP01.ini +++ b/Data/User/GameConfig/RBWP01.ini @@ -1,18 +1,17 @@ -# RBWP01 - Battalion Wars 2 -[Core] Values set here will override the main dolphin settings. -[EmuState] The Emulation State. 1 is worst, 5 is best, 0 is not set. -EmulationStateId = 4 -EmulationIssues = Needs LLE audio for proper sound. -[OnFrame] Add memory patches to be applied every frame here. -[ActionReplay] Add action replay cheats here. -[Video] -ProjectionHack = 0 -PH_SZNear = 0 -PH_SZFar = 0 -PH_ExtraParam = 0 -PH_ZNear = -PH_ZFar = -[Gecko] -[Video_Enhancements] -[Wii] -DisableWiimoteSpeaker = 1 +# RBWP01 - Battalion Wars 2 +[Core] Values set here will override the main dolphin settings. +[EmuState] The Emulation State. 1 is worst, 5 is best, 0 is not set. +EmulationStateId = 4 +EmulationIssues = Needs LLE audio for proper sound. +[OnFrame] Add memory patches to be applied every frame here. +[ActionReplay] Add action replay cheats here. +[Video] +ProjectionHack = 0 +PH_SZNear = 0 +PH_SZFar = 0 +PH_ExtraParam = 0 +PH_ZNear = +PH_ZFar = +[Gecko] +[Video_Enhancements] +[Wii] diff --git a/Data/User/GameConfig/RCJE8P.ini b/Data/User/GameConfig/RCJE8P.ini index 845f08de77..79280a5609 100644 --- a/Data/User/GameConfig/RCJE8P.ini +++ b/Data/User/GameConfig/RCJE8P.ini @@ -24,6 +24,5 @@ PH_ZFar = [Video_Enhancements] ForceFiltering = False [Wii] -DisableWiimoteSpeaker = 1 [Video_Hacks] DlistCachingEnable = False diff --git a/Data/User/GameConfig/RCJP8P.ini b/Data/User/GameConfig/RCJP8P.ini index 6d82c897e5..5a242b5e4e 100644 --- a/Data/User/GameConfig/RCJP8P.ini +++ b/Data/User/GameConfig/RCJP8P.ini @@ -18,6 +18,5 @@ PH_ZFar = [Video_Enhancements] ForceFiltering = False [Wii] -DisableWiimoteSpeaker = 1 [Video_Hacks] DlistCachingEnable = False diff --git a/Data/User/GameConfig/RD2E41.ini b/Data/User/GameConfig/RD2E41.ini index a93f6359e6..92ca3f53b5 100644 --- a/Data/User/GameConfig/RD2E41.ini +++ b/Data/User/GameConfig/RD2E41.ini @@ -1,17 +1,16 @@ -# RD2E41 - Red Steel 2 -[Core] Values set here will override the main dolphin settings. -[EmuState] The Emulation State. 1 is worst, 5 is best, 0 is not set. -EmulationStateId = 4 -EmulationIssues = Needs real wiimote and motion plus. -[OnFrame] Add memory patches to be applied every frame here. -[ActionReplay] Add action replay cheats here. -[Video] -ProjectionHack = 0 -PH_SZNear = 0 -PH_SZFar = 0 -PH_ExtraParam = 0 -PH_ZNear = -PH_ZFar = -[Gecko] -[Wii] -DisableWiimoteSpeaker = 1 +# RD2E41 - Red Steel 2 +[Core] Values set here will override the main dolphin settings. +[EmuState] The Emulation State. 1 is worst, 5 is best, 0 is not set. +EmulationStateId = 4 +EmulationIssues = Needs real wiimote and motion plus. +[OnFrame] Add memory patches to be applied every frame here. +[ActionReplay] Add action replay cheats here. +[Video] +ProjectionHack = 0 +PH_SZNear = 0 +PH_SZFar = 0 +PH_ExtraParam = 0 +PH_ZNear = +PH_ZFar = +[Gecko] +[Wii] diff --git a/Data/User/GameConfig/RD2J41.ini b/Data/User/GameConfig/RD2J41.ini index 8fccc41c35..2042a71430 100644 --- a/Data/User/GameConfig/RD2J41.ini +++ b/Data/User/GameConfig/RD2J41.ini @@ -1,17 +1,16 @@ -# RD2J41 - Red Steel 2 -[Core] Values set here will override the main dolphin settings. -[EmuState] The Emulation State. 1 is worst, 5 is best, 0 is not set. -EmulationStateId = 4 -EmulationIssues = Needs real wiimote and motion plus. -[OnFrame] Add memory patches to be applied every frame here. -[ActionReplay] Add action replay cheats here. -[Video] -ProjectionHack = 0 -PH_SZNear = 0 -PH_SZFar = 0 -PH_ExtraParam = 0 -PH_ZNear = -PH_ZFar = -[Gecko] -[Wii] -DisableWiimoteSpeaker = 1 +# RD2J41 - Red Steel 2 +[Core] Values set here will override the main dolphin settings. +[EmuState] The Emulation State. 1 is worst, 5 is best, 0 is not set. +EmulationStateId = 4 +EmulationIssues = Needs real wiimote and motion plus. +[OnFrame] Add memory patches to be applied every frame here. +[ActionReplay] Add action replay cheats here. +[Video] +ProjectionHack = 0 +PH_SZNear = 0 +PH_SZFar = 0 +PH_ExtraParam = 0 +PH_ZNear = +PH_ZFar = +[Gecko] +[Wii] diff --git a/Data/User/GameConfig/RD2K41.ini b/Data/User/GameConfig/RD2K41.ini index aa0e90f2b2..93123fa871 100644 --- a/Data/User/GameConfig/RD2K41.ini +++ b/Data/User/GameConfig/RD2K41.ini @@ -1,17 +1,16 @@ -# RD2K41 - Red Steel 2 -[Core] Values set here will override the main dolphin settings. -[EmuState] The Emulation State. 1 is worst, 5 is best, 0 is not set. -EmulationStateId = 4 -EmulationIssues = Needs real wiimote and motion plus. -[OnFrame] Add memory patches to be applied every frame here. -[ActionReplay] Add action replay cheats here. -[Video] -ProjectionHack = 0 -PH_SZNear = 0 -PH_SZFar = 0 -PH_ExtraParam = 0 -PH_ZNear = -PH_ZFar = -[Gecko] -[Wii] -DisableWiimoteSpeaker = 1 +# RD2K41 - Red Steel 2 +[Core] Values set here will override the main dolphin settings. +[EmuState] The Emulation State. 1 is worst, 5 is best, 0 is not set. +EmulationStateId = 4 +EmulationIssues = Needs real wiimote and motion plus. +[OnFrame] Add memory patches to be applied every frame here. +[ActionReplay] Add action replay cheats here. +[Video] +ProjectionHack = 0 +PH_SZNear = 0 +PH_SZFar = 0 +PH_ExtraParam = 0 +PH_ZNear = +PH_ZFar = +[Gecko] +[Wii] diff --git a/Data/User/GameConfig/RD2P41.ini b/Data/User/GameConfig/RD2P41.ini index 7cbf91b22d..8a7e5f7541 100644 --- a/Data/User/GameConfig/RD2P41.ini +++ b/Data/User/GameConfig/RD2P41.ini @@ -1,17 +1,16 @@ -# RD2P41 - Red Steel 2 -[Core] Values set here will override the main dolphin settings. -[EmuState] The Emulation State. 1 is worst, 5 is best, 0 is not set. -EmulationStateId = 4 -EmulationIssues = Needs real wiimote and motion plus. -[OnFrame] Add memory patches to be applied every frame here. -[ActionReplay] Add action replay cheats here. -[Video] -ProjectionHack = 0 -PH_SZNear = 0 -PH_SZFar = 0 -PH_ExtraParam = 0 -PH_ZNear = -PH_ZFar = -[Gecko] -[Wii] -DisableWiimoteSpeaker = 1 +# RD2P41 - Red Steel 2 +[Core] Values set here will override the main dolphin settings. +[EmuState] The Emulation State. 1 is worst, 5 is best, 0 is not set. +EmulationStateId = 4 +EmulationIssues = Needs real wiimote and motion plus. +[OnFrame] Add memory patches to be applied every frame here. +[ActionReplay] Add action replay cheats here. +[Video] +ProjectionHack = 0 +PH_SZNear = 0 +PH_SZFar = 0 +PH_ExtraParam = 0 +PH_ZNear = +PH_ZFar = +[Gecko] +[Wii] diff --git a/Data/User/GameConfig/RD2X41.ini b/Data/User/GameConfig/RD2X41.ini index 6748136cad..53f0716869 100644 --- a/Data/User/GameConfig/RD2X41.ini +++ b/Data/User/GameConfig/RD2X41.ini @@ -1,17 +1,16 @@ -# RD2X41 - Red Steel 2 -[Core] Values set here will override the main dolphin settings. -[EmuState] The Emulation State. 1 is worst, 5 is best, 0 is not set. -EmulationStateId = 4 -EmulationIssues = Needs real wiimote and motion plus. -[OnFrame] Add memory patches to be applied every frame here. -[ActionReplay] Add action replay cheats here. -[Video] -ProjectionHack = 0 -PH_SZNear = 0 -PH_SZFar = 0 -PH_ExtraParam = 0 -PH_ZNear = -PH_ZFar = -[Gecko] -[Wii] -DisableWiimoteSpeaker = 1 +# RD2X41 - Red Steel 2 +[Core] Values set here will override the main dolphin settings. +[EmuState] The Emulation State. 1 is worst, 5 is best, 0 is not set. +EmulationStateId = 4 +EmulationIssues = Needs real wiimote and motion plus. +[OnFrame] Add memory patches to be applied every frame here. +[ActionReplay] Add action replay cheats here. +[Video] +ProjectionHack = 0 +PH_SZNear = 0 +PH_SZFar = 0 +PH_ExtraParam = 0 +PH_ZNear = +PH_ZFar = +[Gecko] +[Wii] diff --git a/Data/User/GameConfig/RHDE8P.ini b/Data/User/GameConfig/RHDE8P.ini index b49ec93cb8..31d7a2f620 100644 --- a/Data/User/GameConfig/RHDE8P.ini +++ b/Data/User/GameConfig/RHDE8P.ini @@ -1,20 +1,19 @@ -# RHDE8P - THE HOUSE OF THE DEAD 2 AND 3 RETURN -[Core] Values set here will override the main dolphin settings. -[EmuState] The Emulation State. 1 is worst, 5 is best, 0 is not set. -EmulationStateId = 4 -EmulationIssues = -[OnFrame] Add memory patches to be applied every frame here. -[ActionReplay] Add action replay cheats here. -[Video] -ProjectionHack = 0 -PH_SZNear = 0 -PH_SZFar = 0 -PH_ExtraParam = 0 -PH_ZNear = -PH_ZFar = -[Gecko] -[Video_Settings] -UseXFB = True -UseRealXFB = False -[Wii] -DisableWiimoteSpeaker = 1 +# RHDE8P - THE HOUSE OF THE DEAD 2 AND 3 RETURN +[Core] Values set here will override the main dolphin settings. +[EmuState] The Emulation State. 1 is worst, 5 is best, 0 is not set. +EmulationStateId = 4 +EmulationIssues = +[OnFrame] Add memory patches to be applied every frame here. +[ActionReplay] Add action replay cheats here. +[Video] +ProjectionHack = 0 +PH_SZNear = 0 +PH_SZFar = 0 +PH_ExtraParam = 0 +PH_ZNear = +PH_ZFar = +[Gecko] +[Video_Settings] +UseXFB = True +UseRealXFB = False +[Wii] diff --git a/Data/User/GameConfig/RHDJ8P.ini b/Data/User/GameConfig/RHDJ8P.ini index 63e818f737..014c94aaba 100644 --- a/Data/User/GameConfig/RHDJ8P.ini +++ b/Data/User/GameConfig/RHDJ8P.ini @@ -1,20 +1,19 @@ -# RHDJ8P - THE HOUSE OF THE DEAD 2 AND 3 RETURN -[Core] Values set here will override the main dolphin settings. -[EmuState] The Emulation State. 1 is worst, 5 is best, 0 is not set. -EmulationStateId = 4 -EmulationIssues = -[OnFrame] Add memory patches to be applied every frame here. -[ActionReplay] Add action replay cheats here. -[Video] -ProjectionHack = 0 -PH_SZNear = 0 -PH_SZFar = 0 -PH_ExtraParam = 0 -PH_ZNear = -PH_ZFar = -[Gecko] -[Video_Settings] -UseXFB = True -UseRealXFB = False -[Wii] -DisableWiimoteSpeaker = 1 +# RHDJ8P - THE HOUSE OF THE DEAD 2 AND 3 RETURN +[Core] Values set here will override the main dolphin settings. +[EmuState] The Emulation State. 1 is worst, 5 is best, 0 is not set. +EmulationStateId = 4 +EmulationIssues = +[OnFrame] Add memory patches to be applied every frame here. +[ActionReplay] Add action replay cheats here. +[Video] +ProjectionHack = 0 +PH_SZNear = 0 +PH_SZFar = 0 +PH_ExtraParam = 0 +PH_ZNear = +PH_ZFar = +[Gecko] +[Video_Settings] +UseXFB = True +UseRealXFB = False +[Wii] diff --git a/Data/User/GameConfig/RHDP8P.ini b/Data/User/GameConfig/RHDP8P.ini index e932c173fb..6183ad8422 100644 --- a/Data/User/GameConfig/RHDP8P.ini +++ b/Data/User/GameConfig/RHDP8P.ini @@ -1,20 +1,19 @@ -# RHDP8P - THE HOUSE OF THE DEAD 2 AND 3 RETURN -[Core] Values set here will override the main dolphin settings. -[EmuState] The Emulation State. 1 is worst, 5 is best, 0 is not set. -EmulationStateId = 4 -EmulationIssues = -[OnFrame] Add memory patches to be applied every frame here. -[ActionReplay] Add action replay cheats here. -[Video] -ProjectionHack = 0 -PH_SZNear = 0 -PH_SZFar = 0 -PH_ExtraParam = 0 -PH_ZNear = -PH_ZFar = -[Gecko] -[Video_Settings] -UseXFB = True -UseRealXFB = False -[Wii] -DisableWiimoteSpeaker = 1 +# RHDP8P - THE HOUSE OF THE DEAD 2 AND 3 RETURN +[Core] Values set here will override the main dolphin settings. +[EmuState] The Emulation State. 1 is worst, 5 is best, 0 is not set. +EmulationStateId = 4 +EmulationIssues = +[OnFrame] Add memory patches to be applied every frame here. +[ActionReplay] Add action replay cheats here. +[Video] +ProjectionHack = 0 +PH_SZNear = 0 +PH_SZFar = 0 +PH_ExtraParam = 0 +PH_ZNear = +PH_ZFar = +[Gecko] +[Video_Settings] +UseXFB = True +UseRealXFB = False +[Wii] diff --git a/Data/User/GameConfig/RHOE8P.ini b/Data/User/GameConfig/RHOE8P.ini index c28f341fb6..55d697ca52 100644 --- a/Data/User/GameConfig/RHOE8P.ini +++ b/Data/User/GameConfig/RHOE8P.ini @@ -1,39 +1,38 @@ -# RHOE8P - House Of The Dead: OVERKILL -[Core] Values set here will override the main dolphin settings. -[EmuState] The Emulation State. 1 is worst, 5 is best, 0 is not set. -EmulationStateId = 4 -EmulationIssues = Use dx11 plugin (r6945) -[OnFrame] Add memory patches to be applied every frame here. -[ActionReplay] Add action replay cheats here. -[Video] -ProjectionHack = 0 -PH_SZNear = 0 -PH_SZFar = 0 -PH_ExtraParam = 0 -PH_ZNear = -PH_ZFar = -[Gecko] -$Infinte Bomb Usage after Getting 1 [g6flavor] -04159D1C 60000000 -$If Score Increase, MAX [ZiT] -C2142134 00000002 -3CA03B9B 38A5C9FF -90A60178 00000000 -$Infinite LIFE [ZiT] -04130ED4 60000000 -$Infinite Bullet [ZiT] -04159FAC 907D0720 -$CASH MAX [ZiT] -C214B118 00000002 -3CA03B9B 38A5C9FF -90A300D8 00000000 -$CASH MAX [ZiT] -C214B110 00000002 -3CA03B9B 38A5C9FF -90A300DC 00000000 -$If Score Increase, MAX [ZiT] -C2152674 00000002 -3CA03B9B 38A5C9FF -90B60178 00000000 -[Wii] -DisableWiimoteSpeaker = 1 +# RHOE8P - House Of The Dead: OVERKILL +[Core] Values set here will override the main dolphin settings. +[EmuState] The Emulation State. 1 is worst, 5 is best, 0 is not set. +EmulationStateId = 4 +EmulationIssues = Use dx11 plugin (r6945) +[OnFrame] Add memory patches to be applied every frame here. +[ActionReplay] Add action replay cheats here. +[Video] +ProjectionHack = 0 +PH_SZNear = 0 +PH_SZFar = 0 +PH_ExtraParam = 0 +PH_ZNear = +PH_ZFar = +[Gecko] +$Infinte Bomb Usage after Getting 1 [g6flavor] +04159D1C 60000000 +$If Score Increase, MAX [ZiT] +C2142134 00000002 +3CA03B9B 38A5C9FF +90A60178 00000000 +$Infinite LIFE [ZiT] +04130ED4 60000000 +$Infinite Bullet [ZiT] +04159FAC 907D0720 +$CASH MAX [ZiT] +C214B118 00000002 +3CA03B9B 38A5C9FF +90A300D8 00000000 +$CASH MAX [ZiT] +C214B110 00000002 +3CA03B9B 38A5C9FF +90A300DC 00000000 +$If Score Increase, MAX [ZiT] +C2152674 00000002 +3CA03B9B 38A5C9FF +90B60178 00000000 +[Wii] diff --git a/Data/User/GameConfig/RHOJ8P.ini b/Data/User/GameConfig/RHOJ8P.ini index 3e23f6605c..2eb65c9fc9 100644 --- a/Data/User/GameConfig/RHOJ8P.ini +++ b/Data/User/GameConfig/RHOJ8P.ini @@ -1,12 +1,11 @@ -# RHOJ8P - House Of The Dead: OVERKILL -[Core] Values set here will override the main dolphin settings. -[EmuState] The Emulation State. 1 is worst, 5 is best, 0 is not set. -EmulationStateId = 4 -EmulationIssues = Use dx11 plugin (r6945) -[OnFrame] Add memory patches to be applied every frame here. -[ActionReplay] Add action replay cheats here. -[Video] -ProjectionHack = 0 -[Gecko] -[Wii] -DisableWiimoteSpeaker = 1 +# RHOJ8P - House Of The Dead: OVERKILL +[Core] Values set here will override the main dolphin settings. +[EmuState] The Emulation State. 1 is worst, 5 is best, 0 is not set. +EmulationStateId = 4 +EmulationIssues = Use dx11 plugin (r6945) +[OnFrame] Add memory patches to be applied every frame here. +[ActionReplay] Add action replay cheats here. +[Video] +ProjectionHack = 0 +[Gecko] +[Wii] diff --git a/Data/User/GameConfig/RHOP8P.ini b/Data/User/GameConfig/RHOP8P.ini index 8e9d0e879d..85a8e2770a 100644 --- a/Data/User/GameConfig/RHOP8P.ini +++ b/Data/User/GameConfig/RHOP8P.ini @@ -1,12 +1,11 @@ -# RHOP8P - House Of The Dead: OVERKILL -[Core] Values set here will override the main dolphin settings. -[EmuState] The Emulation State. 1 is worst, 5 is best, 0 is not set. -EmulationStateId = 4 -EmulationIssues = Use dx11 plugin (r6945) -[OnFrame] Add memory patches to be applied every frame here. -[ActionReplay] Add action replay cheats here. -[Video] -ProjectionHack = 0 -[Gecko] -[Wii] -DisableWiimoteSpeaker = 1 +# RHOP8P - House Of The Dead: OVERKILL +[Core] Values set here will override the main dolphin settings. +[EmuState] The Emulation State. 1 is worst, 5 is best, 0 is not set. +EmulationStateId = 4 +EmulationIssues = Use dx11 plugin (r6945) +[OnFrame] Add memory patches to be applied every frame here. +[ActionReplay] Add action replay cheats here. +[Video] +ProjectionHack = 0 +[Gecko] +[Wii] diff --git a/Data/User/GameConfig/RLGE64.ini b/Data/User/GameConfig/RLGE64.ini index 505df3c17d..5e66cda379 100644 --- a/Data/User/GameConfig/RLGE64.ini +++ b/Data/User/GameConfig/RLGE64.ini @@ -6,7 +6,6 @@ EmulationIssues = [OnFrame] Add memory patches to be applied every frame here. [ActionReplay] Add action replay cheats here. [Wii] -DisableWiimoteSpeaker = 1 [Video] ProjectionHack = 0 PH_SZNear = 0 diff --git a/Data/User/GameConfig/RLGJ52.ini b/Data/User/GameConfig/RLGJ52.ini index 52b8648072..37b4f728d1 100644 --- a/Data/User/GameConfig/RLGJ52.ini +++ b/Data/User/GameConfig/RLGJ52.ini @@ -6,7 +6,6 @@ EmulationIssues = [OnFrame] Add memory patches to be applied every frame here. [ActionReplay] Add action replay cheats here. [Wii] -DisableWiimoteSpeaker = 1 [Video] ProjectionHack = 0 PH_SZNear = 0 diff --git a/Data/User/GameConfig/RLGP64.ini b/Data/User/GameConfig/RLGP64.ini index f82d202584..6404bf0a77 100644 --- a/Data/User/GameConfig/RLGP64.ini +++ b/Data/User/GameConfig/RLGP64.ini @@ -6,7 +6,6 @@ EmulationIssues = [OnFrame] Add memory patches to be applied every frame here. [ActionReplay] Add action replay cheats here. [Wii] -DisableWiimoteSpeaker = 1 [Video] ProjectionHack = 0 PH_SZNear = 0 diff --git a/Data/User/GameConfig/RM3E01.ini b/Data/User/GameConfig/RM3E01.ini index cb87db9070..182660bd97 100644 --- a/Data/User/GameConfig/RM3E01.ini +++ b/Data/User/GameConfig/RM3E01.ini @@ -21,6 +21,5 @@ SafeTextureCacheColorSamples = 512 EFBToTextureEnable = False EFBCopyEnable = True [Wii] -DisableWiimoteSpeaker = 1 [Video_Hacks] EFBEmulateFormatChanges = True diff --git a/Data/User/GameConfig/RM3J01.ini b/Data/User/GameConfig/RM3J01.ini index 97a88c4c69..50c84d87a9 100644 --- a/Data/User/GameConfig/RM3J01.ini +++ b/Data/User/GameConfig/RM3J01.ini @@ -21,6 +21,5 @@ SafeTextureCacheColorSamples = 512 EFBToTextureEnable = False EFBCopyEnable = True [Wii] -DisableWiimoteSpeaker = 1 [Video_Hacks] EFBEmulateFormatChanges = True diff --git a/Data/User/GameConfig/RM3P01.ini b/Data/User/GameConfig/RM3P01.ini index 093afc15db..0832325938 100644 --- a/Data/User/GameConfig/RM3P01.ini +++ b/Data/User/GameConfig/RM3P01.ini @@ -23,6 +23,5 @@ SafeTextureCacheColorSamples = 512 EFBToTextureEnable = False EFBCopyEnable = True [Wii] -DisableWiimoteSpeaker = 1 [Video_Hacks] EFBEmulateFormatChanges = True diff --git a/Data/User/GameConfig/RQREXJ.ini b/Data/User/GameConfig/RQREXJ.ini index 91a35e540d..48d52b4320 100644 --- a/Data/User/GameConfig/RQREXJ.ini +++ b/Data/User/GameConfig/RQREXJ.ini @@ -16,5 +16,4 @@ EmulationIssues = Needs single core to run properly(r7436). [OnFrame] [ActionReplay] [Gecko] -[Wii] -DisableWiimoteSpeaker = 1 +[Wii] diff --git a/Data/User/GameConfig/RQRJAF.ini b/Data/User/GameConfig/RQRJAF.ini index c647c4acee..7ae768c3b4 100644 --- a/Data/User/GameConfig/RQRJAF.ini +++ b/Data/User/GameConfig/RQRJAF.ini @@ -16,5 +16,4 @@ EmulationIssues = Needs single core to run properly(r7436). [OnFrame] [ActionReplay] [Gecko] -[Wii] -DisableWiimoteSpeaker = 1 +[Wii] diff --git a/Data/User/GameConfig/RQRPAF.ini b/Data/User/GameConfig/RQRPAF.ini index 8052e6084b..752c0fa2bd 100644 --- a/Data/User/GameConfig/RQRPAF.ini +++ b/Data/User/GameConfig/RQRPAF.ini @@ -16,5 +16,4 @@ EmulationIssues = Needs single core to run properly(r7436). [OnFrame] [ActionReplay] [Gecko] -[Wii] -DisableWiimoteSpeaker = 1 +[Wii] diff --git a/Data/User/GameConfig/RRKE70.ini b/Data/User/GameConfig/RRKE70.ini index 621b0dfd09..ebb3188d0b 100644 --- a/Data/User/GameConfig/RRKE70.ini +++ b/Data/User/GameConfig/RRKE70.ini @@ -16,5 +16,4 @@ EmulationIssues = [Gecko] [Video_Hacks] EFBEmulateFormatChanges = True -[Wii] -DisableWiimoteSpeaker = 1 +[Wii] diff --git a/Data/User/GameConfig/RRKP70.ini b/Data/User/GameConfig/RRKP70.ini index c5fc07ede3..e69e07f92e 100644 --- a/Data/User/GameConfig/RRKP70.ini +++ b/Data/User/GameConfig/RRKP70.ini @@ -16,5 +16,4 @@ EmulationIssues = [Gecko] [Video_Hacks] EFBEmulateFormatChanges = True -[Wii] -DisableWiimoteSpeaker = 1 +[Wii] diff --git a/Data/User/GameConfig/RTZE08.ini b/Data/User/GameConfig/RTZE08.ini index ff41b71a06..27524e8236 100644 --- a/Data/User/GameConfig/RTZE08.ini +++ b/Data/User/GameConfig/RTZE08.ini @@ -1,20 +1,19 @@ -# RTZE08 - Zack and Wiki: Quest for Barbaros' Treasure -[Core] Values set here will override the main dolphin settings. -[EmuState] The Emulation State. 1 is worst, 5 is best, 0 is not set. -EmulationIssues = -EmulationStateId = 4 -[OnFrame] Add memory patches to be applied every frame here. -[ActionReplay] Add action replay cheats here. -[Video] -ProjectionHack = 0 -PH_SZNear = 0 -PH_SZFar = 0 -PH_ExtraParam = 0 -PH_ZNear = -PH_ZFar = -[Gecko] -[Video_Settings] -UseXFB = True -UseRealXFB = False -[Wii] -DisableWiimoteSpeaker = 1 +# RTZE08 - Zack and Wiki: Quest for Barbaros' Treasure +[Core] Values set here will override the main dolphin settings. +[EmuState] The Emulation State. 1 is worst, 5 is best, 0 is not set. +EmulationIssues = +EmulationStateId = 4 +[OnFrame] Add memory patches to be applied every frame here. +[ActionReplay] Add action replay cheats here. +[Video] +ProjectionHack = 0 +PH_SZNear = 0 +PH_SZFar = 0 +PH_ExtraParam = 0 +PH_ZNear = +PH_ZFar = +[Gecko] +[Video_Settings] +UseXFB = True +UseRealXFB = False +[Wii] diff --git a/Data/User/GameConfig/RTZJ08.ini b/Data/User/GameConfig/RTZJ08.ini index 5a62e2c8ca..6a5aa8d6ee 100644 --- a/Data/User/GameConfig/RTZJ08.ini +++ b/Data/User/GameConfig/RTZJ08.ini @@ -1,20 +1,19 @@ -# RTZJ08 - Zack and Wiki: Quest for Barbaros' Treasure -[Core] Values set here will override the main dolphin settings. -[EmuState] The Emulation State. 1 is worst, 5 is best, 0 is not set. -EmulationIssues = -EmulationStateId = 4 -[OnFrame] Add memory patches to be applied every frame here. -[ActionReplay] Add action replay cheats here. -[Video] -ProjectionHack = 0 -PH_SZNear = 0 -PH_SZFar = 0 -PH_ExtraParam = 0 -PH_ZNear = -PH_ZFar = -[Gecko] -[Video_Settings] -UseXFB = True -UseRealXFB = False -[Wii] -DisableWiimoteSpeaker = 1 +# RTZJ08 - Zack and Wiki: Quest for Barbaros' Treasure +[Core] Values set here will override the main dolphin settings. +[EmuState] The Emulation State. 1 is worst, 5 is best, 0 is not set. +EmulationIssues = +EmulationStateId = 4 +[OnFrame] Add memory patches to be applied every frame here. +[ActionReplay] Add action replay cheats here. +[Video] +ProjectionHack = 0 +PH_SZNear = 0 +PH_SZFar = 0 +PH_ExtraParam = 0 +PH_ZNear = +PH_ZFar = +[Gecko] +[Video_Settings] +UseXFB = True +UseRealXFB = False +[Wii] diff --git a/Data/User/GameConfig/RTZK08.ini b/Data/User/GameConfig/RTZK08.ini index 6a7d00e753..ec333d6bce 100644 --- a/Data/User/GameConfig/RTZK08.ini +++ b/Data/User/GameConfig/RTZK08.ini @@ -1,20 +1,19 @@ -# RTZK08 - Zack and Wiki: Quest for Barbaros' Treasure -[Core] Values set here will override the main dolphin settings. -[EmuState] The Emulation State. 1 is worst, 5 is best, 0 is not set. -EmulationIssues = -EmulationStateId = 4 -[OnFrame] Add memory patches to be applied every frame here. -[ActionReplay] Add action replay cheats here. -[Video] -ProjectionHack = 0 -PH_SZNear = 0 -PH_SZFar = 0 -PH_ExtraParam = 0 -PH_ZNear = -PH_ZFar = -[Gecko] -[Video_Settings] -UseXFB = True -UseRealXFB = False -[Wii] -DisableWiimoteSpeaker = 1 +# RTZK08 - Zack and Wiki: Quest for Barbaros' Treasure +[Core] Values set here will override the main dolphin settings. +[EmuState] The Emulation State. 1 is worst, 5 is best, 0 is not set. +EmulationIssues = +EmulationStateId = 4 +[OnFrame] Add memory patches to be applied every frame here. +[ActionReplay] Add action replay cheats here. +[Video] +ProjectionHack = 0 +PH_SZNear = 0 +PH_SZFar = 0 +PH_ExtraParam = 0 +PH_ZNear = +PH_ZFar = +[Gecko] +[Video_Settings] +UseXFB = True +UseRealXFB = False +[Wii] diff --git a/Data/User/GameConfig/RTZP08.ini b/Data/User/GameConfig/RTZP08.ini index 8add9d2869..f3b0834049 100644 --- a/Data/User/GameConfig/RTZP08.ini +++ b/Data/User/GameConfig/RTZP08.ini @@ -1,20 +1,19 @@ -# RTZP08 - Zack and Wiki: Quest for Barbaros' Treasure -[Core] Values set here will override the main dolphin settings. -[EmuState] The Emulation State. 1 is worst, 5 is best, 0 is not set. -EmulationIssues = -EmulationStateId = 4 -[OnFrame] Add memory patches to be applied every frame here. -[ActionReplay] Add action replay cheats here. -[Video] -ProjectionHack = 0 -PH_SZNear = 0 -PH_SZFar = 0 -PH_ExtraParam = 0 -PH_ZNear = -PH_ZFar = -[Gecko] -[Video_Settings] -UseXFB = True -UseRealXFB = False -[Wii] -DisableWiimoteSpeaker = 1 +# RTZP08 - Zack and Wiki: Quest for Barbaros' Treasure +[Core] Values set here will override the main dolphin settings. +[EmuState] The Emulation State. 1 is worst, 5 is best, 0 is not set. +EmulationIssues = +EmulationStateId = 4 +[OnFrame] Add memory patches to be applied every frame here. +[ActionReplay] Add action replay cheats here. +[Video] +ProjectionHack = 0 +PH_SZNear = 0 +PH_SZFar = 0 +PH_ExtraParam = 0 +PH_ZNear = +PH_ZFar = +[Gecko] +[Video_Settings] +UseXFB = True +UseRealXFB = False +[Wii] diff --git a/Data/User/GameConfig/RZJD69.ini b/Data/User/GameConfig/RZJD69.ini index 671318fd38..848dcba860 100644 --- a/Data/User/GameConfig/RZJD69.ini +++ b/Data/User/GameConfig/RZJD69.ini @@ -17,5 +17,4 @@ PH_ZFar = [Video_Settings] SafeTextureCacheColorSamples = 512 [Video_Enhancements] -[Wii] -DisableWiimoteSpeaker = 1 +[Wii] diff --git a/Data/User/GameConfig/RZJE69.ini b/Data/User/GameConfig/RZJE69.ini index a37d3f9223..c48c837a27 100644 --- a/Data/User/GameConfig/RZJE69.ini +++ b/Data/User/GameConfig/RZJE69.ini @@ -17,5 +17,4 @@ PH_ZFar = [Video_Settings] SafeTextureCacheColorSamples = 512 [Video_Enhancements] -[Wii] -DisableWiimoteSpeaker = 1 +[Wii] diff --git a/Data/User/GameConfig/RZJJ13.ini b/Data/User/GameConfig/RZJJ13.ini index d109d22a98..24aa98035b 100644 --- a/Data/User/GameConfig/RZJJ13.ini +++ b/Data/User/GameConfig/RZJJ13.ini @@ -17,5 +17,4 @@ PH_ZFar = [Video_Settings] SafeTextureCacheColorSamples = 512 [Video_Enhancements] -[Wii] -DisableWiimoteSpeaker = 1 +[Wii] diff --git a/Data/User/GameConfig/RZJP69.ini b/Data/User/GameConfig/RZJP69.ini index 63b230b1da..9fa88eb843 100644 --- a/Data/User/GameConfig/RZJP69.ini +++ b/Data/User/GameConfig/RZJP69.ini @@ -31,6 +31,5 @@ $Rapid Fire [TNTkryzt] [Video_Settings] SafeTextureCacheColorSamples = 512 [Video_Enhancements] -[Wii] -DisableWiimoteSpeaker = 1 +[Wii] diff --git a/Data/User/GameConfig/RZZE8P.ini b/Data/User/GameConfig/RZZE8P.ini index 31859ef891..9c74320a0b 100644 --- a/Data/User/GameConfig/RZZE8P.ini +++ b/Data/User/GameConfig/RZZE8P.ini @@ -1,17 +1,16 @@ -# RZZE8P - MADWORLD -[Core] Values set here will override the main dolphin settings. -[EmuState] The Emulation State. 1 is worst, 5 is best, 0 is not set. -EmulationStateId = 5 -EmulationIssues = -[OnFrame] Add memory patches to be applied every frame here. -[ActionReplay] Add action replay cheats here. -[Video] -ProjectionHack = 0 -PH_SZNear = 0 -PH_SZFar = 0 -PH_ExtraParam = 0 -PH_ZNear = -PH_ZFar = -[Gecko] -[Wii] -DisableWiimoteSpeaker = 1 +# RZZE8P - MADWORLD +[Core] Values set here will override the main dolphin settings. +[EmuState] The Emulation State. 1 is worst, 5 is best, 0 is not set. +EmulationStateId = 5 +EmulationIssues = +[OnFrame] Add memory patches to be applied every frame here. +[ActionReplay] Add action replay cheats here. +[Video] +ProjectionHack = 0 +PH_SZNear = 0 +PH_SZFar = 0 +PH_ExtraParam = 0 +PH_ZNear = +PH_ZFar = +[Gecko] +[Wii] diff --git a/Data/User/GameConfig/RZZJEL.ini b/Data/User/GameConfig/RZZJEL.ini index 0e6a08334a..6ace0cb90c 100644 --- a/Data/User/GameConfig/RZZJEL.ini +++ b/Data/User/GameConfig/RZZJEL.ini @@ -1,17 +1,16 @@ -# RZZJEL - MADWORLD -[Core] Values set here will override the main dolphin settings. -[EmuState] The Emulation State. 1 is worst, 5 is best, 0 is not set. -EmulationStateId = 5 -EmulationIssues = -[OnFrame] Add memory patches to be applied every frame here. -[ActionReplay] Add action replay cheats here. -[Video] -ProjectionHack = 0 -PH_SZNear = 0 -PH_SZFar = 0 -PH_ExtraParam = 0 -PH_ZNear = -PH_ZFar = -[Gecko] -[Wii] -DisableWiimoteSpeaker = 1 +# RZZJEL - MADWORLD +[Core] Values set here will override the main dolphin settings. +[EmuState] The Emulation State. 1 is worst, 5 is best, 0 is not set. +EmulationStateId = 5 +EmulationIssues = +[OnFrame] Add memory patches to be applied every frame here. +[ActionReplay] Add action replay cheats here. +[Video] +ProjectionHack = 0 +PH_SZNear = 0 +PH_SZFar = 0 +PH_ExtraParam = 0 +PH_ZNear = +PH_ZFar = +[Gecko] +[Wii] diff --git a/Data/User/GameConfig/RZZP8P.ini b/Data/User/GameConfig/RZZP8P.ini index 6dc117c26f..ac5bed9812 100644 --- a/Data/User/GameConfig/RZZP8P.ini +++ b/Data/User/GameConfig/RZZP8P.ini @@ -1,17 +1,16 @@ -# RZZP8P - MADWORLD -[Core] Values set here will override the main dolphin settings. -[EmuState] The Emulation State. 1 is worst, 5 is best, 0 is not set. -EmulationStateId = 5 -EmulationIssues = -[OnFrame] Add memory patches to be applied every frame here. -[ActionReplay] Add action replay cheats here. -[Video] -ProjectionHack = 0 -PH_SZNear = 0 -PH_SZFar = 0 -PH_ExtraParam = 0 -PH_ZNear = -PH_ZFar = -[Gecko] -[Wii] -DisableWiimoteSpeaker = 1 +# RZZP8P - MADWORLD +[Core] Values set here will override the main dolphin settings. +[EmuState] The Emulation State. 1 is worst, 5 is best, 0 is not set. +EmulationStateId = 5 +EmulationIssues = +[OnFrame] Add memory patches to be applied every frame here. +[ActionReplay] Add action replay cheats here. +[Video] +ProjectionHack = 0 +PH_SZNear = 0 +PH_SZFar = 0 +PH_ExtraParam = 0 +PH_ZNear = +PH_ZFar = +[Gecko] +[Wii] diff --git a/Data/User/GameConfig/SC2E8P.ini b/Data/User/GameConfig/SC2E8P.ini index ff46b91be8..998d51859d 100644 --- a/Data/User/GameConfig/SC2E8P.ini +++ b/Data/User/GameConfig/SC2E8P.ini @@ -1,21 +1,20 @@ -# SC2E8P - Conduit 2 -[Core] -BlockMerging = 1 -[Video] -ProjectionHack = 0 -PH_SZNear = 0 -PH_SZFar = 0 -PH_ExtraParam = 0 -PH_ZNear = -PH_ZFar = -[EmuState] -EmulationStateId = 4 -EmulationIssues = -[OnFrame] -[ActionReplay] -[Gecko] -[Video_Hacks] -DlistCachingEnable = False -[Video_Settings] -[Wii] -DisableWiimoteSpeaker = 1 +# SC2E8P - Conduit 2 +[Core] +BlockMerging = 1 +[Video] +ProjectionHack = 0 +PH_SZNear = 0 +PH_SZFar = 0 +PH_ExtraParam = 0 +PH_ZNear = +PH_ZFar = +[EmuState] +EmulationStateId = 4 +EmulationIssues = +[OnFrame] +[ActionReplay] +[Gecko] +[Video_Hacks] +DlistCachingEnable = False +[Video_Settings] +[Wii] diff --git a/Data/User/GameConfig/SC2P8P.ini b/Data/User/GameConfig/SC2P8P.ini index a065f8a096..b9f5c5989c 100644 --- a/Data/User/GameConfig/SC2P8P.ini +++ b/Data/User/GameConfig/SC2P8P.ini @@ -1,70 +1,69 @@ -# SC2P8P - Conduit 2 -[Core] -BlockMerging = 1 -[Video] -ProjectionHack = 0 -PH_SZNear = 0 -PH_SZFar = 0 -PH_ExtraParam = 0 -PH_ZNear = -PH_ZFar = -[EmuState] -EmulationStateId = 4 -EmulationIssues = -[OnFrame] -[ActionReplay] -[Gecko] -$Undead Invincibility Mode [Bully@Wiiplaza] -F6000001 80008100 -8001002C 90180000 -D200000C 00000006 -2C110035 40820020 -2C0800F4 40820018 -2C0300A0 40820010 -3C007FFF 6000FFFF -90040000 80040000 -60000000 00000000 -E0000000 80008000 -**Offline Only* -**You are completely untouchable* -*Picture -> http://imageshack.us/photo/my-images/684/sc2p8p008.png/ -$Inf. Ammo [Bully@Wiiplaza] -F6000001 80008100 -80640000 80050000 -D2000008 00000003 -2C110021 4082000C -38600000 7C030050 -60000000 00000000 -E0000000 80008000 -**Offline Only* -$No Flashwhite [Bully@Wiiplaza] -F6000001 80008100 -EC210032 93C10008 -14000114 60000000 -E0000000 80008000 -$Inf. Money [Bully@Wiiplaza] -F6000001 80008100 -7C003A14 38E70001 -D2000010 00000004 -2C11002F 40820014 -2C0401A8 4082000C -3D807FFF 7D84012E -7C04002E 00000000 -E0000000 80008000 -$Profile One Name Changer Jedi Hack & [Mitch] -0487E2D4 XXXXXXXX -0487E2D8 XXXXXXXX -0487E2DC XXXXXXXX -$Profile Two Name Changer Jedi Hack & [Mitch] -0487E320 0000XXXX -0487E324 XXXXXXXX -0487E328 XXXXXXXX -0487E32C XXXX0000 -$Profile Three Name Changer Jedi Hack & [Mitch] -0487E370 XXXXXXXX -0487E374 XXXXXXXX -[Video_Hacks] -DlistCachingEnable = False -[Video_Settings] -[Wii] -DisableWiimoteSpeaker = 1 +# SC2P8P - Conduit 2 +[Core] +BlockMerging = 1 +[Video] +ProjectionHack = 0 +PH_SZNear = 0 +PH_SZFar = 0 +PH_ExtraParam = 0 +PH_ZNear = +PH_ZFar = +[EmuState] +EmulationStateId = 4 +EmulationIssues = +[OnFrame] +[ActionReplay] +[Gecko] +$Undead Invincibility Mode [Bully@Wiiplaza] +F6000001 80008100 +8001002C 90180000 +D200000C 00000006 +2C110035 40820020 +2C0800F4 40820018 +2C0300A0 40820010 +3C007FFF 6000FFFF +90040000 80040000 +60000000 00000000 +E0000000 80008000 +**Offline Only* +**You are completely untouchable* +*Picture -> http://imageshack.us/photo/my-images/684/sc2p8p008.png/ +$Inf. Ammo [Bully@Wiiplaza] +F6000001 80008100 +80640000 80050000 +D2000008 00000003 +2C110021 4082000C +38600000 7C030050 +60000000 00000000 +E0000000 80008000 +**Offline Only* +$No Flashwhite [Bully@Wiiplaza] +F6000001 80008100 +EC210032 93C10008 +14000114 60000000 +E0000000 80008000 +$Inf. Money [Bully@Wiiplaza] +F6000001 80008100 +7C003A14 38E70001 +D2000010 00000004 +2C11002F 40820014 +2C0401A8 4082000C +3D807FFF 7D84012E +7C04002E 00000000 +E0000000 80008000 +$Profile One Name Changer Jedi Hack & [Mitch] +0487E2D4 XXXXXXXX +0487E2D8 XXXXXXXX +0487E2DC XXXXXXXX +$Profile Two Name Changer Jedi Hack & [Mitch] +0487E320 0000XXXX +0487E324 XXXXXXXX +0487E328 XXXXXXXX +0487E32C XXXX0000 +$Profile Three Name Changer Jedi Hack & [Mitch] +0487E370 XXXXXXXX +0487E374 XXXXXXXX +[Video_Hacks] +DlistCachingEnable = False +[Video_Settings] +[Wii] diff --git a/Data/User/GameConfig/SD2E41.ini b/Data/User/GameConfig/SD2E41.ini index 179c13afb9..ae90ff5196 100644 --- a/Data/User/GameConfig/SD2E41.ini +++ b/Data/User/GameConfig/SD2E41.ini @@ -16,5 +16,4 @@ EmulationIssues = [OnFrame] [ActionReplay] [Gecko] -[Wii] -DisableWiimoteSpeaker = 1 +[Wii] diff --git a/Data/User/GameConfig/SD2J01.ini b/Data/User/GameConfig/SD2J01.ini index f29168a46c..3285e7c75a 100644 --- a/Data/User/GameConfig/SD2J01.ini +++ b/Data/User/GameConfig/SD2J01.ini @@ -16,5 +16,4 @@ EmulationIssues = [OnFrame] [ActionReplay] [Gecko] -[Wii] -DisableWiimoteSpeaker = 1 +[Wii] diff --git a/Data/User/GameConfig/SD2P41.ini b/Data/User/GameConfig/SD2P41.ini index 744a354aaf..2111a3c298 100644 --- a/Data/User/GameConfig/SD2P41.ini +++ b/Data/User/GameConfig/SD2P41.ini @@ -16,5 +16,4 @@ EmulationIssues = [OnFrame] [ActionReplay] [Gecko] -[Wii] -DisableWiimoteSpeaker = 1 +[Wii] diff --git a/Data/User/GameConfig/SD2Y41.ini b/Data/User/GameConfig/SD2Y41.ini index 9daa079aac..59c9fb666b 100644 --- a/Data/User/GameConfig/SD2Y41.ini +++ b/Data/User/GameConfig/SD2Y41.ini @@ -16,5 +16,4 @@ EmulationIssues = [OnFrame] [ActionReplay] [Gecko] -[Wii] -DisableWiimoteSpeaker = 1 +[Wii] diff --git a/Data/User/GameConfig/SEME4Q.ini b/Data/User/GameConfig/SEME4Q.ini index 7e340985b3..48056894b9 100644 --- a/Data/User/GameConfig/SEME4Q.ini +++ b/Data/User/GameConfig/SEME4Q.ini @@ -20,5 +20,4 @@ SafeTextureCacheColorSamples = 0 ForceFiltering = False [Video_Hacks] DlistCachingEnable = False -[Wii] -DisableWiimoteSpeaker = 1 +[Wii] diff --git a/Data/User/GameConfig/SEMJ01.ini b/Data/User/GameConfig/SEMJ01.ini index 7dc481ea34..f0740ca7a3 100644 --- a/Data/User/GameConfig/SEMJ01.ini +++ b/Data/User/GameConfig/SEMJ01.ini @@ -20,5 +20,4 @@ SafeTextureCacheColorSamples = 0 ForceFiltering = False [Video_Hacks] DlistCachingEnable = False -[Wii] -DisableWiimoteSpeaker = 1 +[Wii] diff --git a/Data/User/GameConfig/SEMP4Q.ini b/Data/User/GameConfig/SEMP4Q.ini index fa1afc01c2..f425547cf4 100644 --- a/Data/User/GameConfig/SEMP4Q.ini +++ b/Data/User/GameConfig/SEMP4Q.ini @@ -20,5 +20,4 @@ SafeTextureCacheColorSamples = 0 ForceFiltering = False [Video_Hacks] DlistCachingEnable = False -[Wii] -DisableWiimoteSpeaker = 1 +[Wii] diff --git a/Data/User/GameConfig/SEMX4Q.ini b/Data/User/GameConfig/SEMX4Q.ini index b4c56197ea..43232806a2 100644 --- a/Data/User/GameConfig/SEMX4Q.ini +++ b/Data/User/GameConfig/SEMX4Q.ini @@ -20,5 +20,4 @@ SafeTextureCacheColorSamples = 0 ForceFiltering = False [Video_Hacks] DlistCachingEnable = False -[Wii] -DisableWiimoteSpeaker = 1 +[Wii] diff --git a/Data/User/GameConfig/SEMY4Q.ini b/Data/User/GameConfig/SEMY4Q.ini index 5d8798227d..817f8387e0 100644 --- a/Data/User/GameConfig/SEMY4Q.ini +++ b/Data/User/GameConfig/SEMY4Q.ini @@ -20,5 +20,4 @@ SafeTextureCacheColorSamples = 0 ForceFiltering = False [Video_Hacks] DlistCachingEnable = False -[Wii] -DisableWiimoteSpeaker = 1 +[Wii] diff --git a/Data/User/GameConfig/SEMZ4Q.ini b/Data/User/GameConfig/SEMZ4Q.ini index eecaa23166..515a1bd029 100644 --- a/Data/User/GameConfig/SEMZ4Q.ini +++ b/Data/User/GameConfig/SEMZ4Q.ini @@ -20,5 +20,4 @@ SafeTextureCacheColorSamples = 0 ForceFiltering = False [Video_Hacks] DlistCachingEnable = False -[Wii] -DisableWiimoteSpeaker = 1 +[Wii] diff --git a/Data/User/GameConfig/SERE4Q.ini b/Data/User/GameConfig/SERE4Q.ini index ef5f4edfb2..fbc9fa9d3c 100644 --- a/Data/User/GameConfig/SERE4Q.ini +++ b/Data/User/GameConfig/SERE4Q.ini @@ -16,5 +16,4 @@ PH_ZFar = [Video_Settings] EFBScale = 1 SafeTextureCacheColorSamples = 0 -[Wii] -DisableWiimoteSpeaker = 1 +[Wii] diff --git a/Data/User/GameConfig/SERF4Q.ini b/Data/User/GameConfig/SERF4Q.ini index b03abcf0e9..cd2fca395e 100644 --- a/Data/User/GameConfig/SERF4Q.ini +++ b/Data/User/GameConfig/SERF4Q.ini @@ -16,5 +16,4 @@ PH_ZFar = [Video_Settings] EFBScale = 1 SafeTextureCacheColorSamples = 0 -[Wii] -DisableWiimoteSpeaker = 1 +[Wii] diff --git a/Data/User/GameConfig/SERP4Q.ini b/Data/User/GameConfig/SERP4Q.ini index e57bb14704..7e332b8bcd 100644 --- a/Data/User/GameConfig/SERP4Q.ini +++ b/Data/User/GameConfig/SERP4Q.ini @@ -16,5 +16,4 @@ PH_ZFar = [Video_Settings] EFBScale = 1 SafeTextureCacheColorSamples = 0 -[Wii] -DisableWiimoteSpeaker = 1 +[Wii] diff --git a/Data/User/GameConfig/SF8E01.ini b/Data/User/GameConfig/SF8E01.ini index e8e185cda9..bb2bce7406 100644 --- a/Data/User/GameConfig/SF8E01.ini +++ b/Data/User/GameConfig/SF8E01.ini @@ -16,5 +16,4 @@ PH_ZFar = [Gecko] [Video_Settings] SafeTextureCacheColorSamples = 512 -[Wii] -DisableWiimoteSpeaker = 1 +[Wii] diff --git a/Data/User/GameConfig/SF8J01.ini b/Data/User/GameConfig/SF8J01.ini index bc0b0c2ba5..1f3ef9bb85 100644 --- a/Data/User/GameConfig/SF8J01.ini +++ b/Data/User/GameConfig/SF8J01.ini @@ -16,5 +16,4 @@ PH_ZFar = [Gecko] [Video_Settings] SafeTextureCacheColorSamples = 512 -[Wii] -DisableWiimoteSpeaker = 1 +[Wii] diff --git a/Data/User/GameConfig/SF8P01.ini b/Data/User/GameConfig/SF8P01.ini index 41a5957888..e17f5f4247 100644 --- a/Data/User/GameConfig/SF8P01.ini +++ b/Data/User/GameConfig/SF8P01.ini @@ -16,5 +16,4 @@ PH_ZFar = [Gecko] [Video_Settings] SafeTextureCacheColorSamples = 512 -[Wii] -DisableWiimoteSpeaker = 1 +[Wii] diff --git a/Data/User/GameConfig/SFIE01.ini b/Data/User/GameConfig/SFIE01.ini index 867859d8c4..7475f94fca 100644 --- a/Data/User/GameConfig/SFIE01.ini +++ b/Data/User/GameConfig/SFIE01.ini @@ -6,7 +6,6 @@ EmulationIssues = Needs real xfb for videos to show up. [OnFrame] Add memory patches to be applied every frame here. [ActionReplay] Add action replay cheats here. [Wii] -DisableWiimoteSpeaker = 1 [Video] ProjectionHack = 0 PH_SZNear = 0 diff --git a/Data/User/GameConfig/SFIP01.ini b/Data/User/GameConfig/SFIP01.ini index 8a198d4fe8..114906aac3 100644 --- a/Data/User/GameConfig/SFIP01.ini +++ b/Data/User/GameConfig/SFIP01.ini @@ -6,7 +6,6 @@ EmulationIssues = Needs real xfb for videos to show up. [OnFrame] Add memory patches to be applied every frame here. [ActionReplay] Add action replay cheats here. [Wii] -DisableWiimoteSpeaker = 1 [Video] ProjectionHack = 0 PH_SZNear = 0 diff --git a/Data/User/GameConfig/SHLPA4.ini b/Data/User/GameConfig/SHLPA4.ini index ce64ff21e1..b9eebf93c5 100644 --- a/Data/User/GameConfig/SHLPA4.ini +++ b/Data/User/GameConfig/SHLPA4.ini @@ -15,5 +15,4 @@ PH_ZFar = [Gecko] [Video_Settings] SafeTextureCacheColorSamples = 512 -[Wii] -DisableWiimoteSpeaker = 1 +[Wii] diff --git a/Data/User/GameConfig/SJDE41.ini b/Data/User/GameConfig/SJDE41.ini index 1e16ddd21f..64b712f81d 100644 --- a/Data/User/GameConfig/SJDE41.ini +++ b/Data/User/GameConfig/SJDE41.ini @@ -6,7 +6,6 @@ EmulationIssues = Suffers from random ingame lock ups. [OnFrame] Add memory patches to be applied every frame here. [ActionReplay] Add action replay cheats here. [Wii] -DisableWiimoteSpeaker = 1 [Video] ProjectionHack = 0 PH_SZNear = 0 diff --git a/Data/User/GameConfig/SJDP41.ini b/Data/User/GameConfig/SJDP41.ini index 53f65d5704..450a81c4f8 100644 --- a/Data/User/GameConfig/SJDP41.ini +++ b/Data/User/GameConfig/SJDP41.ini @@ -6,7 +6,6 @@ EmulationIssues = Suffers from random ingame lock ups. [OnFrame] Add memory patches to be applied every frame here. [ActionReplay] Add action replay cheats here. [Wii] -DisableWiimoteSpeaker = 1 [Video] ProjectionHack = 0 PH_SZNear = 0 diff --git a/Data/User/GameConfig/SJDY41.ini b/Data/User/GameConfig/SJDY41.ini index 107abedfd2..74584766c3 100644 --- a/Data/User/GameConfig/SJDY41.ini +++ b/Data/User/GameConfig/SJDY41.ini @@ -6,7 +6,6 @@ EmulationIssues = Suffers from random ingame lock ups. [OnFrame] Add memory patches to be applied every frame here. [ActionReplay] Add action replay cheats here. [Wii] -DisableWiimoteSpeaker = 1 [Video] ProjectionHack = 0 PH_SZNear = 0 diff --git a/Data/User/GameConfig/SJDZ41.ini b/Data/User/GameConfig/SJDZ41.ini index 53f65d5704..450a81c4f8 100644 --- a/Data/User/GameConfig/SJDZ41.ini +++ b/Data/User/GameConfig/SJDZ41.ini @@ -6,7 +6,6 @@ EmulationIssues = Suffers from random ingame lock ups. [OnFrame] Add memory patches to be applied every frame here. [ActionReplay] Add action replay cheats here. [Wii] -DisableWiimoteSpeaker = 1 [Video] ProjectionHack = 0 PH_SZNear = 0 diff --git a/Data/User/GameConfig/SMOE41.ini b/Data/User/GameConfig/SMOE41.ini index 15dc5a693e..3c61475544 100644 --- a/Data/User/GameConfig/SMOE41.ini +++ b/Data/User/GameConfig/SMOE41.ini @@ -1,21 +1,20 @@ -# SMOE41 - MICHAEL JACKSON THE EXPERIENCE SPECIAL EDITION -[Core] Values set here will override the main dolphin settings. -[EmuState] The Emulation State. 1 is worst, 5 is best, 0 is not set. -EmulationStateId = 4 -EmulationIssues = Sound noise eliminated using LLE audio. With hle disable idleskip for normal dance school speed. -[OnFrame] Add memory patches to be applied every frame here. -[ActionReplay] Add action replay cheats here. -[Video] -ProjectionHack = 0 -PH_SZNear = 0 -PH_SZFar = 0 -PH_ExtraParam = 0 -PH_ZNear = -PH_ZFar = -[Gecko] -[Video_Hacks] -EFBEmulateFormatChanges = True -[Video_Enhancements] -MaxAnisotropy = 0 -[Wii] -DisableWiimoteSpeaker = 1 +# SMOE41 - MICHAEL JACKSON THE EXPERIENCE SPECIAL EDITION +[Core] Values set here will override the main dolphin settings. +[EmuState] The Emulation State. 1 is worst, 5 is best, 0 is not set. +EmulationStateId = 4 +EmulationIssues = Sound noise eliminated using LLE audio. With hle disable idleskip for normal dance school speed. +[OnFrame] Add memory patches to be applied every frame here. +[ActionReplay] Add action replay cheats here. +[Video] +ProjectionHack = 0 +PH_SZNear = 0 +PH_SZFar = 0 +PH_ExtraParam = 0 +PH_ZNear = +PH_ZFar = +[Gecko] +[Video_Hacks] +EFBEmulateFormatChanges = True +[Video_Enhancements] +MaxAnisotropy = 0 +[Wii] diff --git a/Data/User/GameConfig/SMOP41.ini b/Data/User/GameConfig/SMOP41.ini index 6095cd9174..b9f913a639 100644 --- a/Data/User/GameConfig/SMOP41.ini +++ b/Data/User/GameConfig/SMOP41.ini @@ -1,21 +1,20 @@ -# SMOP41 - MICHAEL JACKSON THE EXPERIENCE SPECIAL EDITION -[Core] Values set here will override the main dolphin settings. -[EmuState] The Emulation State. 1 is worst, 5 is best, 0 is not set. -EmulationStateId = 4 -EmulationIssues = Sound noise eliminated using LLE audio. With hle disable idleskip for normal dance school speed. -[OnFrame] Add memory patches to be applied every frame here. -[ActionReplay] Add action replay cheats here. -[Video] -ProjectionHack = 0 -PH_SZNear = 0 -PH_SZFar = 0 -PH_ExtraParam = 0 -PH_ZNear = -PH_ZFar = -[Gecko] -[Video_Hacks] -EFBEmulateFormatChanges = True -[Video_Enhancements] -MaxAnisotropy = 0 -[Wii] -DisableWiimoteSpeaker = 1 +# SMOP41 - MICHAEL JACKSON THE EXPERIENCE SPECIAL EDITION +[Core] Values set here will override the main dolphin settings. +[EmuState] The Emulation State. 1 is worst, 5 is best, 0 is not set. +EmulationStateId = 4 +EmulationIssues = Sound noise eliminated using LLE audio. With hle disable idleskip for normal dance school speed. +[OnFrame] Add memory patches to be applied every frame here. +[ActionReplay] Add action replay cheats here. +[Video] +ProjectionHack = 0 +PH_SZNear = 0 +PH_SZFar = 0 +PH_ExtraParam = 0 +PH_ZNear = +PH_ZFar = +[Gecko] +[Video_Hacks] +EFBEmulateFormatChanges = True +[Video_Enhancements] +MaxAnisotropy = 0 +[Wii] diff --git a/Data/User/GameConfig/SMOX41.ini b/Data/User/GameConfig/SMOX41.ini index 88ba03da1c..929a58f076 100644 --- a/Data/User/GameConfig/SMOX41.ini +++ b/Data/User/GameConfig/SMOX41.ini @@ -1,21 +1,20 @@ -# SMOX41 - Michael Jackson The Experience: Walmart Edition -[Core] Values set here will override the main dolphin settings. -[EmuState] The Emulation State. 1 is worst, 5 is best, 0 is not set. -EmulationStateId = 4 -EmulationIssues = Sound noise eliminated using LLE audio. With hle disable idleskip for normal dance school speed. -[OnFrame] Add memory patches to be applied every frame here. -[ActionReplay] Add action replay cheats here. -[Video] -ProjectionHack = 0 -PH_SZNear = 0 -PH_SZFar = 0 -PH_ExtraParam = 0 -PH_ZNear = -PH_ZFar = -[Gecko] -[Video_Hacks] -EFBEmulateFormatChanges = True -[Video_Enhancements] -MaxAnisotropy = 0 -[Wii] -DisableWiimoteSpeaker = 1 +# SMOX41 - Michael Jackson The Experience: Walmart Edition +[Core] Values set here will override the main dolphin settings. +[EmuState] The Emulation State. 1 is worst, 5 is best, 0 is not set. +EmulationStateId = 4 +EmulationIssues = Sound noise eliminated using LLE audio. With hle disable idleskip for normal dance school speed. +[OnFrame] Add memory patches to be applied every frame here. +[ActionReplay] Add action replay cheats here. +[Video] +ProjectionHack = 0 +PH_SZNear = 0 +PH_SZFar = 0 +PH_ExtraParam = 0 +PH_ZNear = +PH_ZFar = +[Gecko] +[Video_Hacks] +EFBEmulateFormatChanges = True +[Video_Enhancements] +MaxAnisotropy = 0 +[Wii] diff --git a/Data/User/GameConfig/SO3EE9.ini b/Data/User/GameConfig/SO3EE9.ini index f8da896a23..c359fede43 100644 --- a/Data/User/GameConfig/SO3EE9.ini +++ b/Data/User/GameConfig/SO3EE9.ini @@ -6,7 +6,6 @@ EmulationIssues = Direct 3d 11 fixes some texture glitches. [OnFrame] Add memory patches to be applied every frame here. [ActionReplay] Add action replay cheats here. [Wii] -DisableWiimoteSpeaker = 1 [Video] ProjectionHack = 0 PH_SZNear = 0 diff --git a/Data/User/GameConfig/SO3J99.ini b/Data/User/GameConfig/SO3J99.ini index 2ad57e3af2..e29dca5b96 100644 --- a/Data/User/GameConfig/SO3J99.ini +++ b/Data/User/GameConfig/SO3J99.ini @@ -6,7 +6,6 @@ EmulationIssues = Direct 3d 11 fixes some texture glitches. [OnFrame] Add memory patches to be applied every frame here. [ActionReplay] Add action replay cheats here. [Wii] -DisableWiimoteSpeaker = 1 [Video] ProjectionHack = 0 PH_SZNear = 0 diff --git a/Data/User/GameConfig/SOJE41.ini b/Data/User/GameConfig/SOJE41.ini index 183a8823ca..af6d49b785 100644 --- a/Data/User/GameConfig/SOJE41.ini +++ b/Data/User/GameConfig/SOJE41.ini @@ -1,17 +1,16 @@ -# SOJE41 - Rayman Origins -[Core] Values set here will override the main dolphin settings. -[EmuState] The Emulation State. 1 is worst, 5 is best, 0 is not set. -EmulationStateId = 4 -EmulationIssues = -[OnFrame] Add memory patches to be applied every frame here. -[ActionReplay] Add action replay cheats here. -[Video] -ProjectionHack = 1 -PH_SZNear = 1 -PH_SZFar = 0 -PH_ExtraParam = 0 -PH_ZNear = -PH_ZFar = -[Gecko] -[Wii] -DisableWiimoteSpeaker = 1 +# SOJE41 - Rayman Origins +[Core] Values set here will override the main dolphin settings. +[EmuState] The Emulation State. 1 is worst, 5 is best, 0 is not set. +EmulationStateId = 4 +EmulationIssues = +[OnFrame] Add memory patches to be applied every frame here. +[ActionReplay] Add action replay cheats here. +[Video] +ProjectionHack = 1 +PH_SZNear = 1 +PH_SZFar = 0 +PH_ExtraParam = 0 +PH_ZNear = +PH_ZFar = +[Gecko] +[Wii] diff --git a/Data/User/GameConfig/SOJP41.ini b/Data/User/GameConfig/SOJP41.ini index 2c835fe6e2..fca55f9117 100644 --- a/Data/User/GameConfig/SOJP41.ini +++ b/Data/User/GameConfig/SOJP41.ini @@ -1,17 +1,16 @@ -# SOJP41 - Rayman Origins -[Core] Values set here will override the main dolphin settings. -[EmuState] The Emulation State. 1 is worst, 5 is best, 0 is not set. -EmulationStateId = 4 -EmulationIssues = -[OnFrame] Add memory patches to be applied every frame here. -[ActionReplay] Add action replay cheats here. -[Video] -ProjectionHack = 1 -PH_SZNear = 1 -PH_SZFar = 0 -PH_ExtraParam = 0 -PH_ZNear = -PH_ZFar = -[Gecko] -[Wii] -DisableWiimoteSpeaker = 1 +# SOJP41 - Rayman Origins +[Core] Values set here will override the main dolphin settings. +[EmuState] The Emulation State. 1 is worst, 5 is best, 0 is not set. +EmulationStateId = 4 +EmulationIssues = +[OnFrame] Add memory patches to be applied every frame here. +[ActionReplay] Add action replay cheats here. +[Video] +ProjectionHack = 1 +PH_SZNear = 1 +PH_SZFar = 0 +PH_ExtraParam = 0 +PH_ZNear = +PH_ZFar = +[Gecko] +[Wii] diff --git a/Data/User/GameConfig/SOUE01.ini b/Data/User/GameConfig/SOUE01.ini index 8461821933..7e37e04936 100644 --- a/Data/User/GameConfig/SOUE01.ini +++ b/Data/User/GameConfig/SOUE01.ini @@ -17,5 +17,4 @@ PH_ZFar = EFBAccessEnable = True DlistCachingEnable = False [Wii] -DisableWiimoteSpeaker = 1 [Video_Settings] diff --git a/Data/User/GameConfig/SOUJ01.ini b/Data/User/GameConfig/SOUJ01.ini index ede7d81148..b02302e15c 100644 --- a/Data/User/GameConfig/SOUJ01.ini +++ b/Data/User/GameConfig/SOUJ01.ini @@ -17,5 +17,4 @@ PH_ZFar = EFBAccessEnable = True DlistCachingEnable = False [Wii] -DisableWiimoteSpeaker = 1 [Video_Settings] diff --git a/Data/User/GameConfig/SOUK01.ini b/Data/User/GameConfig/SOUK01.ini index 512bd21408..201ec99315 100644 --- a/Data/User/GameConfig/SOUK01.ini +++ b/Data/User/GameConfig/SOUK01.ini @@ -17,5 +17,4 @@ PH_ZFar = EFBAccessEnable = True DlistCachingEnable = False [Wii] -DisableWiimoteSpeaker = 1 [Video_Settings] diff --git a/Data/User/GameConfig/SOUP01.ini b/Data/User/GameConfig/SOUP01.ini index 1b6e47096f..eab4d6b442 100644 --- a/Data/User/GameConfig/SOUP01.ini +++ b/Data/User/GameConfig/SOUP01.ini @@ -17,5 +17,4 @@ PH_ZFar = EFBAccessEnable = True DlistCachingEnable = False [Wii] -DisableWiimoteSpeaker = 1 [Video_Settings] diff --git a/Data/User/GameConfig/SRQE41.ini b/Data/User/GameConfig/SRQE41.ini index 5060189327..e923433ee8 100644 --- a/Data/User/GameConfig/SRQE41.ini +++ b/Data/User/GameConfig/SRQE41.ini @@ -14,6 +14,5 @@ PH_ZNear = PH_ZFar = [Gecko] [Wii] -DisableWiimoteSpeaker = 1 [Video_Hacks] DlistCachingEnable = False diff --git a/Data/User/GameConfig/SRQP41.ini b/Data/User/GameConfig/SRQP41.ini index f360aef050..c1001990b1 100644 --- a/Data/User/GameConfig/SRQP41.ini +++ b/Data/User/GameConfig/SRQP41.ini @@ -14,6 +14,5 @@ PH_ZNear = PH_ZFar = [Gecko] [Wii] -DisableWiimoteSpeaker = 1 [Video_Hacks] DlistCachingEnable = False diff --git a/Data/User/GameConfig/SX3J01.ini b/Data/User/GameConfig/SX3J01.ini index 276118af1a..3aef192f00 100644 --- a/Data/User/GameConfig/SX3J01.ini +++ b/Data/User/GameConfig/SX3J01.ini @@ -15,5 +15,4 @@ PH_ZFar = [Gecko] [Video_Settings] SafeTextureCacheColorSamples = 0 -[Wii] -DisableWiimoteSpeaker = 1 +[Wii] diff --git a/Data/User/GameConfig/SX3P01.ini b/Data/User/GameConfig/SX3P01.ini index 94b5c6ef16..a753975414 100644 --- a/Data/User/GameConfig/SX3P01.ini +++ b/Data/User/GameConfig/SX3P01.ini @@ -15,5 +15,4 @@ PH_ZFar = [Gecko] [Video_Settings] SafeTextureCacheColorSamples = 0 -[Wii] -DisableWiimoteSpeaker = 1 +[Wii] From d76ca5783743d654f3fa6ad8b69c239f93c9493e Mon Sep 17 00:00:00 2001 From: skidau Date: Fri, 22 Feb 2013 15:13:49 +1100 Subject: [PATCH 38/49] Fixed a JIT timing bug that prevented Eternal Darkness from booting in Single Core mode. --- Source/Core/Core/Src/PowerPC/Jit64/Jit.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/Core/Core/Src/PowerPC/Jit64/Jit.cpp b/Source/Core/Core/Src/PowerPC/Jit64/Jit.cpp index 31caca0a43..900a8475f7 100644 --- a/Source/Core/Core/Src/PowerPC/Jit64/Jit.cpp +++ b/Source/Core/Core/Src/PowerPC/Jit64/Jit.cpp @@ -338,7 +338,7 @@ void Jit64::WriteRfiExitDestInEAX() Cleanup(); ABI_CallFunction(reinterpret_cast(&PowerPC::CheckExceptions)); SUB(32, M(&CoreTiming::downcount), js.downcountAmount > 127 ? Imm32(js.downcountAmount) : Imm8(js.downcountAmount)); - JMP(asm_routines.dispatcher, true); + JMP(asm_routines.outerLoop, true); } void Jit64::WriteExceptionExit() From ba979582e2d0b4961f1087b76eef659856eb23bb Mon Sep 17 00:00:00 2001 From: Jonathan Jones Date: Fri, 22 Feb 2013 15:27:28 -0500 Subject: [PATCH 39/49] Makes the "No banner" banner image theme-able. Current "sexy X" banner included as part of "Boomy" theme. Fixes issue 6023. --- Data/User/Themes/Boomy/nobanner.png | Bin 0 -> 2484 bytes Source/Core/DolphinWX/Src/ConfigMain.cpp | 1 + Source/Core/DolphinWX/Src/ISOFile.cpp | 14 ++++++--- Source/Core/DolphinWX/resources/no_banner.cpp | 28 ------------------ 4 files changed, 11 insertions(+), 32 deletions(-) create mode 100644 Data/User/Themes/Boomy/nobanner.png delete mode 100644 Source/Core/DolphinWX/resources/no_banner.cpp diff --git a/Data/User/Themes/Boomy/nobanner.png b/Data/User/Themes/Boomy/nobanner.png new file mode 100644 index 0000000000000000000000000000000000000000..4d34be77626c7f9d77659f8766109b9017baa619 GIT binary patch literal 2484 zcmV;l2}|~gP)WFU8GbZ8()Nlj2>E@cM*00|gLL_t(&-p!hAbKloBF>s^;&fX(Gmm_Z|S}9000{tr#Q2F!1#Bg!i6d7^td>VHoh*_Jsw#kde_Q2wMC9VVa}E(<7zR$K6VK1jytjmejt5-uBv~^m z_)zok@Ico#)OAf7C!FZ~r)hpR^+Y@=DKKLa$B9t6jHQoIF6_)(=_3|XPTz`fF`u6s_@?DhfgVGkVFLM93cc&s}<8U&4-LJgY3P> zdr#l@d9Q)C+wC|Wj~QHBc7MA^`I&)l0Q7y&uV25owW_+oxqy(UgX5uD@zAdERUpO@ zClRj`#A#L(h2#M52&;;^5`=-ON=(Cv@pOa~nWiZ#u$}XCI#I7y48wo}Sg+T4L#g>8 z1gfga!ZASWx@H&#LI^nLvY<-sv}ODM{`+s*w!Juz32hul+O{Ren1xfOYEK;;>pB!l5fJgH3U$3E#yI0QP174GnHH;RKD=3hs%9D~KR1&% z?KAo*ule)mPk#LP!8ne2k6F<$44H~dpeB&R;lSy1Vw$E4z^_?@Da+w-;N|6oVHmQt zeIx)SoN1?H+qBe`N2dreQHKhTBFq*ZH4#xD5m1~YDj)Ebojo$9$fPNs(-hU%Vi*RH zM5wAN1MZy54^#5Fh-C2XyK5A%|WbvtPe{vDs{J z&gF+N;TqjkRYi=EmzS4|>z5q7v>ZFzMB;JN@z^y4fi!>H;E)W40E5 z_6G?iB|%(30dbBgD&hkPK-27FjA^R**+Pu*f?vOCnT44UM1;QYGx#Es0|0wpg5{j! z_wV0`2;1#8Tc-J@x~@5$PV{}x;c&R#KuRPa zoh>He07sGurwNs_vYcN5L~r8~?g4&j1tLOS*IE0FqpvyI^1THJyWI{Ep=p||-Of3t zX`=6YUS3`A~1wVoj5tj)^09Ts&S1$v>9DLVxG)xMnk0~v~3GO z-}gC;y%zHuaONM3j@Iinec!X+@AEzr%F?3j{-px6Z99j?Q$k4~uhytcI2A-CLz@)* z95;a`km(hCEijbxbKDYuap=8hsN{AF#kSimBEo*Z&$)u-3+6YLp`_8#;c$3!ezS}+ zDk`nYdp{>xU6-v&oQHhAgq|q^=Wu7>-GW9SA!jG77uugnvv@;IZ!EwPuY37`^1Veh z79ExQmyt^u(HL;2(pHN0N z=4g$^-b>2L`=pfk@#9AhflGf9qt02XF^4!1(_3Y}l(O)+7u1tr&KcCbBdBW>lyFVc z%vsqtFA?E*JW^E^fBp3rP1C$_s<(t`b)}TjMa-|NY`5EUobTSDIamDs56UE$ueZT3 ze1KImzgqxhvbNoBFQTJcLa->Qq^&a4G>5zN57#2DdoFjcO!zYzY$a){HEp+Bnx^?w zh`cOCo8_!lD;^&ob19|t70YbUXa2o&0xA0AgKJ`y=f);LGy2 zm8UJ|Skl>d`#*P2fIsSHSz{)p#PjnryWKATrp#__zm+N8)7~YpPft&|Sa+?TT(&fC zUF(lpz-vWOzno&0pqJWutDavL(=0Q#1kE)6RzJZks_VLotl7GH*BVP-Z6QJRK4EC- zV6O?}Rz3e(NqgC7xz$fl)ofW^*X5+G>?dEdsIT-7?w$>qQY)8^@K!y))Ku#mTVtji zt9h@VVEjK#6T97xzVCCR-*SX&{pGI~Kv}1sE~Ah#G1~2R02hrG1E{Rmmm`snkB@X+ckz805m^Bb$QiWFqb`NI zoO`mlBb)ZSRx$k(VR%V#&N+fjYyI2KSUCZ9O>+#0ID8V?tbh0M22PF_ZxQsYvHq7HP4!&4n&GHiU37p=}3jnuhImd(m`XCQRjP88NkOi>h)w y9&c)})u7BVmzGdAd;ZsD5!q_B$^*zLCH@1LNII_TaD>hP0000GetStringSelection(); main_frame->InitBitmaps(); + main_frame->UpdateGameList(); })); auto const scInterface = new wxBoxSizer(wxHORIZONTAL); diff --git a/Source/Core/DolphinWX/Src/ISOFile.cpp b/Source/Core/DolphinWX/Src/ISOFile.cpp index 1e4164b7aa..833268ad63 100644 --- a/Source/Core/DolphinWX/Src/ISOFile.cpp +++ b/Source/Core/DolphinWX/Src/ISOFile.cpp @@ -34,7 +34,7 @@ #include "FileSearch.h" #include "CompressedBlob.h" #include "ChunkFile.h" -#include "../resources/no_banner.cpp" +#include "ConfigManager.h" #define CACHE_REVISION 0x10F @@ -174,10 +174,16 @@ GameListItem::GameListItem(const std::string& _rFileName) } else { + std::string theme = SConfig::GetInstance().m_LocalCoreStartupParameter.theme_name + "/"; + std::string dir = File::GetUserPath(D_THEMES_IDX) + theme; + +#if !defined(_WIN32) + // If theme does not exist in user's dir load from shared directory + if (!File::Exists(dir)) + dir = SHARED_USER_DIR THEMES_DIR "/" + theme; +#endif // default banner - wxMemoryInputStream istream(no_banner_png, sizeof no_banner_png); - wxImage iNoBanner(istream, wxBITMAP_TYPE_PNG); - m_Image = iNoBanner; + m_Image = wxImage(dir + "nobanner.png", wxBITMAP_TYPE_PNG); } } diff --git a/Source/Core/DolphinWX/resources/no_banner.cpp b/Source/Core/DolphinWX/resources/no_banner.cpp deleted file mode 100644 index df8d51d737..0000000000 --- a/Source/Core/DolphinWX/resources/no_banner.cpp +++ /dev/null @@ -1,28 +0,0 @@ -static const unsigned char no_banner_png[] = { - 0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, 0x00, 0x00, 0x00, 0x0d, 0x49, - 0x48, 0x44, 0x52, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x20, 0x04, 0x03, - 0x00, 0x00, 0x00, 0x1f, 0xee, 0x60, 0x67, 0x00, 0x00, 0x00, 0x09, 0x70, 0x48, - 0x59, 0x73, 0x00, 0x00, 0x0b, 0x13, 0x00, 0x00, 0x0b, 0x13, 0x01, 0x00, 0x9a, - 0x9c, 0x18, 0x00, 0x00, 0x00, 0x07, 0x74, 0x49, 0x4d, 0x45, 0x07, 0xdd, 0x02, - 0x09, 0x16, 0x39, 0x17, 0xf0, 0x40, 0x6e, 0x04, 0x00, 0x00, 0x00, 0x15, 0x50, - 0x4c, 0x54, 0x45, 0x66, 0x66, 0x66, 0x6a, 0x6a, 0x6a, 0x6b, 0x6b, 0x6b, 0x6d, - 0x6d, 0x6d, 0x70, 0x70, 0x70, 0x73, 0x73, 0x73, 0x80, 0x80, 0x80, 0xd1, 0x7d, - 0x40, 0x35, 0x00, 0x00, 0x00, 0xc6, 0x49, 0x44, 0x41, 0x54, 0x38, 0xcb, 0x8d, - 0xd4, 0x31, 0x0e, 0xc3, 0x20, 0x10, 0x44, 0xd1, 0x51, 0x64, 0xfa, 0x1c, 0x25, - 0x47, 0x48, 0x45, 0xed, 0xca, 0x07, 0xb0, 0x80, 0xfb, 0x1f, 0x21, 0x05, 0x60, - 0xd6, 0x30, 0xe3, 0xac, 0xbb, 0x95, 0xf8, 0x7a, 0xb2, 0x01, 0xa3, 0x98, 0x27, - 0x01, 0x00, 0x10, 0xfa, 0x9c, 0xeb, 0xbc, 0xd9, 0x35, 0xb0, 0x43, 0xf9, 0xd6, - 0x15, 0x47, 0x1b, 0xf7, 0x3a, 0x46, 0x1d, 0xdc, 0x09, 0x06, 0x4c, 0xc1, 0x9d, - 0x60, 0xc0, 0x1c, 0x58, 0x82, 0x02, 0x73, 0x60, 0x09, 0x0a, 0x2c, 0xc1, 0x20, - 0x38, 0xb0, 0x04, 0x83, 0xe0, 0xc0, 0x1a, 0x74, 0x42, 0x00, 0x6b, 0xd0, 0x89, - 0x0f, 0x07, 0x48, 0xd0, 0x08, 0x01, 0x90, 0xa0, 0x13, 0x1c, 0x60, 0x41, 0x7a, - 0x02, 0x58, 0x60, 0x88, 0xe8, 0x0b, 0xd2, 0x03, 0x40, 0x83, 0x8b, 0x88, 0xde, - 0xe0, 0xac, 0xeb, 0x5f, 0xc5, 0x1b, 0xb4, 0x4d, 0xbe, 0xee, 0xc5, 0xbf, 0x20, - 0xf7, 0x77, 0x08, 0xce, 0x60, 0xbf, 0xbe, 0xd2, 0xe1, 0x0a, 0xf2, 0xd8, 0x87, - 0xe0, 0x0a, 0x76, 0xb3, 0xd3, 0x87, 0x23, 0xc8, 0xf6, 0x2c, 0x05, 0x47, 0xd0, - 0x80, 0xb7, 0x20, 0x20, 0x80, 0x2d, 0x09, 0x02, 0x02, 0x88, 0xf3, 0x3f, 0x4a, - 0x05, 0xe3, 0xa2, 0x09, 0x02, 0x0a, 0x28, 0x82, 0x80, 0x02, 0x14, 0x01, 0x09, - 0x08, 0x02, 0x12, 0x10, 0x04, 0x34, 0xc0, 0x89, 0x1f, 0xe2, 0x9a, 0xca, 0x1c, - 0x5f, 0x12, 0x62, 0x57, 0x00, 0x00, 0x00, 0x00, 0x49, 0x45, 0x4e, 0x44, 0xae, - 0x42, 0x60, 0x82 -}; From 4aeaf3477e7bf2e4b8a6dc692ca7d43f26c63855 Mon Sep 17 00:00:00 2001 From: Jordan Woyak Date: Fri, 22 Feb 2013 22:17:32 -0600 Subject: [PATCH 40/49] Eliminate artifacts in nobanner.png. --- Data/User/Themes/Boomy/nobanner.png | Bin 2484 -> 321 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/Data/User/Themes/Boomy/nobanner.png b/Data/User/Themes/Boomy/nobanner.png index 4d34be77626c7f9d77659f8766109b9017baa619..08a30884310ecba0d240432e197700b8db560f68 100644 GIT binary patch delta 306 zcmV-20nPrj6Tt$I7=Hu<0000V?qFvC000?uMObuGZ)S9NVRB^vL1b@YWgtmyVP|Dh zWnpA_ami&o0000LP)t-sW@ct;YHDk1Yi(_9aBy&Qb8~=zfYE(GH2?qr!bwCyR5;6x z)H@EtAP|J%QDpiYB}Yg_?aBwRfcqaI1+O*C5ZtY_zdqRrBY&AE007|X9P@nG9oQj# z^Tt)iGml;ePl5qM@FW;829}_}7+8V=Q_u+xOhG3&Fb9(so{0m}z2e%oV?JHedLG0(?wt@~Y0xN(KP{3Od z5Wo=x0Ri~&A1kGTe$fO01tdX00g8YG1OW*M0vh1N58|529GnDB{Qv*}07*qoM6N<$ Ef@VQ+I{*Lx literal 2484 zcmV;l2}|~gP)WFU8GbZ8()Nlj2>E@cM*00|gLL_t(&-p!hAbKloBF>s^;&fX(Gmm_Z|S}9000{tr#Q2F!1#Bg!i6d7^td>VHoh*_Jsw#kde_Q2wMC9VVa}E(<7zR$K6VK1jytjmejt5-uBv~^m z_)zok@Ico#)OAf7C!FZ~r)hpR^+Y@=DKKLa$B9t6jHQoIF6_)(=_3|XPTz`fF`u6s_@?DhfgVGkVFLM93cc&s}<8U&4-LJgY3P> zdr#l@d9Q)C+wC|Wj~QHBc7MA^`I&)l0Q7y&uV25owW_+oxqy(UgX5uD@zAdERUpO@ zClRj`#A#L(h2#M52&;;^5`=-ON=(Cv@pOa~nWiZ#u$}XCI#I7y48wo}Sg+T4L#g>8 z1gfga!ZASWx@H&#LI^nLvY<-sv}ODM{`+s*w!Juz32hul+O{Ren1xfOYEK;;>pB!l5fJgH3U$3E#yI0QP174GnHH;RKD=3hs%9D~KR1&% z?KAo*ule)mPk#LP!8ne2k6F<$44H~dpeB&R;lSy1Vw$E4z^_?@Da+w-;N|6oVHmQt zeIx)SoN1?H+qBe`N2dreQHKhTBFq*ZH4#xD5m1~YDj)Ebojo$9$fPNs(-hU%Vi*RH zM5wAN1MZy54^#5Fh-C2XyK5A%|WbvtPe{vDs{J z&gF+N;TqjkRYi=EmzS4|>z5q7v>ZFzMB;JN@z^y4fi!>H;E)W40E5 z_6G?iB|%(30dbBgD&hkPK-27FjA^R**+Pu*f?vOCnT44UM1;QYGx#Es0|0wpg5{j! z_wV0`2;1#8Tc-J@x~@5$PV{}x;c&R#KuRPa zoh>He07sGurwNs_vYcN5L~r8~?g4&j1tLOS*IE0FqpvyI^1THJyWI{Ep=p||-Of3t zX`=6YUS3`A~1wVoj5tj)^09Ts&S1$v>9DLVxG)xMnk0~v~3GO z-}gC;y%zHuaONM3j@Iinec!X+@AEzr%F?3j{-px6Z99j?Q$k4~uhytcI2A-CLz@)* z95;a`km(hCEijbxbKDYuap=8hsN{AF#kSimBEo*Z&$)u-3+6YLp`_8#;c$3!ezS}+ zDk`nYdp{>xU6-v&oQHhAgq|q^=Wu7>-GW9SA!jG77uugnvv@;IZ!EwPuY37`^1Veh z79ExQmyt^u(HL;2(pHN0N z=4g$^-b>2L`=pfk@#9AhflGf9qt02XF^4!1(_3Y}l(O)+7u1tr&KcCbBdBW>lyFVc z%vsqtFA?E*JW^E^fBp3rP1C$_s<(t`b)}TjMa-|NY`5EUobTSDIamDs56UE$ueZT3 ze1KImzgqxhvbNoBFQTJcLa->Qq^&a4G>5zN57#2DdoFjcO!zYzY$a){HEp+Bnx^?w zh`cOCo8_!lD;^&ob19|t70YbUXa2o&0xA0AgKJ`y=f);LGy2 zm8UJ|Skl>d`#*P2fIsSHSz{)p#PjnryWKATrp#__zm+N8)7~YpPft&|Sa+?TT(&fC zUF(lpz-vWOzno&0pqJWutDavL(=0Q#1kE)6RzJZks_VLotl7GH*BVP-Z6QJRK4EC- zV6O?}Rz3e(NqgC7xz$fl)ofW^*X5+G>?dEdsIT-7?w$>qQY)8^@K!y))Ku#mTVtji zt9h@VVEjK#6T97xzVCCR-*SX&{pGI~Kv}1sE~Ah#G1~2R02hrG1E{Rmmm`snkB@X+ckz805m^Bb$QiWFqb`NI zoO`mlBb)ZSRx$k(VR%V#&N+fjYyI2KSUCZ9O>+#0ID8V?tbh0M22PF_ZxQsYvHq7HP4!&4n&GHiU37p=}3jnuhImd(m`XCQRjP88NkOi>h)w y9&c)})u7BVmzGdAd;ZsD5!q_B$^*zLCH@1LNII_TaD>hP0000 Date: Sat, 23 Feb 2013 01:47:37 -0500 Subject: [PATCH 41/49] Update CLRun to have OCL 1.2 --- Externals/CLRun/CMakeLists.txt | 5 +- Externals/CLRun/clrun/Makefile | 5 + Externals/CLRun/clrun/gencl.c | 343 +++++++++---- Externals/CLRun/clrun/genclext.c | 28 ++ Externals/CLRun/clrun/genclgl.c | 42 +- Externals/CLRun/clrun/genclglext.c | 11 + Externals/CLRun/clrun/generateClRun.pl | 0 Externals/CLRun/include/CL/cl.h | 454 +++++++++++++++--- Externals/CLRun/include/CL/cl_d3d10.h | 126 +++++ Externals/CLRun/include/CL/cl_d3d11.h | 126 +++++ .../CLRun/include/CL/cl_dx9_media_sharing.h | 127 +++++ Externals/CLRun/include/CL/cl_ext.h | 251 ++++++++++ Externals/CLRun/include/CL/cl_gl.h | 95 ++-- Externals/CLRun/include/CL/cl_gl_ext.h | 69 +++ Externals/CLRun/include/CL/cl_platform.h | 203 +++++++- 15 files changed, 1649 insertions(+), 236 deletions(-) create mode 100644 Externals/CLRun/clrun/genclext.c create mode 100644 Externals/CLRun/clrun/genclglext.c mode change 100644 => 100755 Externals/CLRun/clrun/generateClRun.pl create mode 100644 Externals/CLRun/include/CL/cl_d3d10.h create mode 100644 Externals/CLRun/include/CL/cl_d3d11.h create mode 100644 Externals/CLRun/include/CL/cl_dx9_media_sharing.h create mode 100644 Externals/CLRun/include/CL/cl_ext.h create mode 100644 Externals/CLRun/include/CL/cl_gl_ext.h diff --git a/Externals/CLRun/CMakeLists.txt b/Externals/CLRun/CMakeLists.txt index 7810173a81..3a57ae4563 100644 --- a/Externals/CLRun/CMakeLists.txt +++ b/Externals/CLRun/CMakeLists.txt @@ -1,7 +1,10 @@ set(SRCS clrun/clrun.c clrun/dynamiclib.c clrun/gencl.c - clrun/genclgl.c) + clrun/genclgl.c + clrun/genclext.c + clrun/genclglext.c + ) add_library(clrun STATIC ${SRCS}) target_link_libraries(clrun ${CMAKE_DL_LIBS}) diff --git a/Externals/CLRun/clrun/Makefile b/Externals/CLRun/clrun/Makefile index 9f637269e0..f4186ff741 100644 --- a/Externals/CLRun/clrun/Makefile +++ b/Externals/CLRun/clrun/Makefile @@ -10,6 +10,11 @@ compile: genclrun gencl.c genclgl.c genclrun: ../include/CL/cl.h ../include/CL/cl_gl.h ./generateClRun.pl ../include/CL/cl.h > gencl.c ./generateClRun.pl ../include/CL/cl_gl.h > genclgl.c + ./generateClRun.pl ../include/CL/cl_ext.h > genclext.c + ./generateClRun.pl ../include/CL/cl_gl_ext.h > genclglext.c + ./generateClRun.pl ../include/CL/cl_d3d10.h > gencld3d10.c + ./generateClRun.pl ../include/CL/cl_d3d11.h > gencld3d11.c + ./generateClRun.pl ../include/CL/cl_dx9_media_sharing.h > gencldx9.c clean: diff --git a/Externals/CLRun/clrun/gencl.c b/Externals/CLRun/clrun/gencl.c index 9d55b70232..649e3c67b7 100644 --- a/Externals/CLRun/clrun/gencl.c +++ b/Externals/CLRun/clrun/gencl.c @@ -3,398 +3,543 @@ #include "../include/CL/cl.h" -static cl_int (CL_API_CALL *clGetPlatformIDs_ptr)(cl_uint, cl_platform_id *, cl_uint *) = NULL; +static cl_int (*clGetPlatformIDs_ptr)(cl_uint, cl_platform_id *, cl_uint *) = NULL; cl_int CL_API_CALL clGetPlatformIDs (cl_uint num_entries,cl_platform_id * platforms,cl_uint * num_platforms) { if(!clGetPlatformIDs_ptr) clGetPlatformIDs_ptr = getFunction("clGetPlatformIDs"); return (*clGetPlatformIDs_ptr)(num_entries, platforms, num_platforms); } -static cl_int (CL_API_CALL *clGetPlatformInfo_ptr)(cl_platform_id, cl_platform_info, size_t, void *, size_t *) = NULL; +static cl_int (*clGetPlatformInfo_ptr)(cl_platform_id, cl_platform_info, size_t, void *, size_t *) = NULL; cl_int CL_API_CALL clGetPlatformInfo (cl_platform_id platform,cl_platform_info param_name,size_t param_value_size,void * param_value,size_t * param_value_size_ret) { if(!clGetPlatformInfo_ptr) clGetPlatformInfo_ptr = getFunction("clGetPlatformInfo"); return (*clGetPlatformInfo_ptr)(platform, param_name, param_value_size, param_value, param_value_size_ret); } -static cl_int (CL_API_CALL *clGetDeviceIDs_ptr)(cl_platform_id, cl_device_type, cl_uint, cl_device_id *, cl_uint *) = NULL; +static cl_int (*clGetDeviceIDs_ptr)(cl_platform_id, cl_device_type, cl_uint, cl_device_id *, cl_uint *) = NULL; cl_int CL_API_CALL clGetDeviceIDs (cl_platform_id platform,cl_device_type device_type,cl_uint num_entries,cl_device_id * devices,cl_uint * num_devices) { if(!clGetDeviceIDs_ptr) clGetDeviceIDs_ptr = getFunction("clGetDeviceIDs"); return (*clGetDeviceIDs_ptr)(platform, device_type, num_entries, devices, num_devices); } -static cl_int (CL_API_CALL *clGetDeviceInfo_ptr)(cl_device_id, cl_device_info, size_t, void *, size_t *) = NULL; +static cl_int (*clGetDeviceInfo_ptr)(cl_device_id, cl_device_info, size_t, void *, size_t *) = NULL; cl_int CL_API_CALL clGetDeviceInfo (cl_device_id device,cl_device_info param_name,size_t param_value_size,void * param_value,size_t * param_value_size_ret) { if(!clGetDeviceInfo_ptr) clGetDeviceInfo_ptr = getFunction("clGetDeviceInfo"); return (*clGetDeviceInfo_ptr)(device, param_name, param_value_size, param_value, param_value_size_ret); } -static cl_context (CL_API_CALL *clCreateContext_ptr)(const cl_context_properties *, cl_uint, const cl_device_id *, void (CL_CALLBACK *)(const char *, const void *, size_t, void *), void *, cl_int *) = NULL; -cl_context CL_API_CALL clCreateContext (const cl_context_properties * properties,cl_uint num_devices,const cl_device_id * devices,void (CL_CALLBACK * pfn_notify)(const char *, const void *, size_t, void *),void * user_data,cl_int * errcode_ret) { +static cl_int (*clCreateSubDevices_ptr)(cl_device_id, const cl_device_partition_property *, cl_uint, cl_device_id *, cl_uint *) = NULL; +cl_int CL_API_CALL clCreateSubDevices (cl_device_id in_device,const cl_device_partition_property * properties,cl_uint num_devices,cl_device_id * out_devices,cl_uint * num_devices_ret) { + if(!clCreateSubDevices_ptr) clCreateSubDevices_ptr = getFunction("clCreateSubDevices"); + return (*clCreateSubDevices_ptr)(in_device, properties, num_devices, out_devices, num_devices_ret); +} + +static cl_int (*clRetainDevice_ptr)(cl_device_id) = NULL; +cl_int CL_API_CALL clRetainDevice (cl_device_id device) { + if(!clRetainDevice_ptr) clRetainDevice_ptr = getFunction("clRetainDevice"); + return (*clRetainDevice_ptr)(device); +} + +static cl_int (*clReleaseDevice_ptr)(cl_device_id) = NULL; +cl_int CL_API_CALL clReleaseDevice (cl_device_id device) { + if(!clReleaseDevice_ptr) clReleaseDevice_ptr = getFunction("clReleaseDevice"); + return (*clReleaseDevice_ptr)(device); +} + +static cl_context (*clCreateContext_ptr)(const cl_context_properties *, cl_uint, const cl_device_id *, void (CL_CALLBACK *pfn_notify)(const char *, const void *, size_t, void *), void*, cl_int*) = NULL; +cl_context CL_API_CALL clCreateContext(const cl_context_properties * properties, + cl_uint num_devices, + const cl_device_id * devices, + void (CL_CALLBACK *pfn_notify)(const char *, const void *, size_t, void *), + void * user_data, + cl_int * errcode_ret) { if(!clCreateContext_ptr) clCreateContext_ptr = getFunction("clCreateContext"); return (*clCreateContext_ptr)(properties, num_devices, devices, pfn_notify, user_data, errcode_ret); } -static cl_context (CL_API_CALL *clCreateContextFromType_ptr)(const cl_context_properties *, cl_device_type, void (CL_CALLBACK *)(const char *, const void *, size_t, void *), void *, cl_int *) = NULL; -cl_context CL_API_CALL clCreateContextFromType (const cl_context_properties * properties,cl_device_type device_type,void (CL_CALLBACK * pfn_notify)(const char *, const void *, size_t, void *),void * user_data,cl_int * errcode_ret) { +static cl_context (*clCreateContextFromType_ptr)(const cl_context_properties *, cl_device_type, void (CL_CALLBACK * /* pfn_notify */)(const char *, const void *, size_t, void *), void*, cl_int*) = NULL; +cl_context CL_API_CALL clCreateContextFromType(const cl_context_properties * properties, + cl_device_type device_type, + void (CL_CALLBACK * pfn_notify)(const char *, const void *, size_t, void *), + void * user_data, + cl_int * errcode_ret) { if(!clCreateContextFromType_ptr) clCreateContextFromType_ptr = getFunction("clCreateContextFromType"); return (*clCreateContextFromType_ptr)(properties, device_type, pfn_notify, user_data, errcode_ret); } -static cl_int (CL_API_CALL *clRetainContext_ptr)(cl_context) = NULL; +static cl_int (*clRetainContext_ptr)(cl_context) = NULL; cl_int CL_API_CALL clRetainContext (cl_context context) { if(!clRetainContext_ptr) clRetainContext_ptr = getFunction("clRetainContext"); return (*clRetainContext_ptr)(context); } -static cl_int (CL_API_CALL *clReleaseContext_ptr)(cl_context) = NULL; +static cl_int (*clReleaseContext_ptr)(cl_context) = NULL; cl_int CL_API_CALL clReleaseContext (cl_context context) { if(!clReleaseContext_ptr) clReleaseContext_ptr = getFunction("clReleaseContext"); return (*clReleaseContext_ptr)(context); } -static cl_int (CL_API_CALL *clGetContextInfo_ptr)(cl_context, cl_context_info, size_t, void *, size_t *) = NULL; +static cl_int (*clGetContextInfo_ptr)(cl_context, cl_context_info, size_t, void *, size_t *) = NULL; cl_int CL_API_CALL clGetContextInfo (cl_context context,cl_context_info param_name,size_t param_value_size,void * param_value,size_t * param_value_size_ret) { if(!clGetContextInfo_ptr) clGetContextInfo_ptr = getFunction("clGetContextInfo"); return (*clGetContextInfo_ptr)(context, param_name, param_value_size, param_value, param_value_size_ret); } -static cl_command_queue (CL_API_CALL *clCreateCommandQueue_ptr)(cl_context, cl_device_id, cl_command_queue_properties, cl_int *) = NULL; +static cl_command_queue (*clCreateCommandQueue_ptr)(cl_context, cl_device_id, cl_command_queue_properties, cl_int *) = NULL; cl_command_queue CL_API_CALL clCreateCommandQueue (cl_context context,cl_device_id device,cl_command_queue_properties properties,cl_int * errcode_ret) { if(!clCreateCommandQueue_ptr) clCreateCommandQueue_ptr = getFunction("clCreateCommandQueue"); return (*clCreateCommandQueue_ptr)(context, device, properties, errcode_ret); } -static cl_int (CL_API_CALL *clRetainCommandQueue_ptr)(cl_command_queue) = NULL; +static cl_int (*clRetainCommandQueue_ptr)(cl_command_queue) = NULL; cl_int CL_API_CALL clRetainCommandQueue (cl_command_queue command_queue) { if(!clRetainCommandQueue_ptr) clRetainCommandQueue_ptr = getFunction("clRetainCommandQueue"); return (*clRetainCommandQueue_ptr)(command_queue); } -static cl_int (CL_API_CALL *clReleaseCommandQueue_ptr)(cl_command_queue) = NULL; +static cl_int (*clReleaseCommandQueue_ptr)(cl_command_queue) = NULL; cl_int CL_API_CALL clReleaseCommandQueue (cl_command_queue command_queue) { if(!clReleaseCommandQueue_ptr) clReleaseCommandQueue_ptr = getFunction("clReleaseCommandQueue"); return (*clReleaseCommandQueue_ptr)(command_queue); } -static cl_int (CL_API_CALL *clGetCommandQueueInfo_ptr)(cl_command_queue, cl_command_queue_info, size_t, void *, size_t *) = NULL; +static cl_int (*clGetCommandQueueInfo_ptr)(cl_command_queue, cl_command_queue_info, size_t, void *, size_t *) = NULL; cl_int CL_API_CALL clGetCommandQueueInfo (cl_command_queue command_queue,cl_command_queue_info param_name,size_t param_value_size,void * param_value,size_t * param_value_size_ret) { if(!clGetCommandQueueInfo_ptr) clGetCommandQueueInfo_ptr = getFunction("clGetCommandQueueInfo"); return (*clGetCommandQueueInfo_ptr)(command_queue, param_name, param_value_size, param_value, param_value_size_ret); } -static cl_int (CL_API_CALL *clSetCommandQueueProperty_ptr)(cl_command_queue, cl_command_queue_properties, cl_bool, cl_command_queue_properties *) = NULL; -cl_int CL_API_CALL clSetCommandQueueProperty (cl_command_queue command_queue,cl_command_queue_properties properties,cl_bool enable,cl_command_queue_properties * old_properties) { - if(!clSetCommandQueueProperty_ptr) clSetCommandQueueProperty_ptr = getFunction("clSetCommandQueueProperty"); - return (*clSetCommandQueueProperty_ptr)(command_queue, properties, enable, old_properties); -} - -static cl_mem (CL_API_CALL *clCreateBuffer_ptr)(cl_context, cl_mem_flags, size_t, void *, cl_int *) = NULL; +static cl_mem (*clCreateBuffer_ptr)(cl_context, cl_mem_flags, size_t, void *, cl_int *) = NULL; cl_mem CL_API_CALL clCreateBuffer (cl_context context,cl_mem_flags flags,size_t size,void * host_ptr,cl_int * errcode_ret) { if(!clCreateBuffer_ptr) clCreateBuffer_ptr = getFunction("clCreateBuffer"); return (*clCreateBuffer_ptr)(context, flags, size, host_ptr, errcode_ret); } -static cl_mem (CL_API_CALL *clCreateImage2D_ptr)(cl_context, cl_mem_flags, const cl_image_format *, size_t, size_t, size_t, void *, cl_int *) = NULL; -cl_mem CL_API_CALL clCreateImage2D (cl_context context,cl_mem_flags flags,const cl_image_format * image_format,size_t image_width,size_t image_height,size_t image_row_pitch,void * host_ptr,cl_int * errcode_ret) { - if(!clCreateImage2D_ptr) clCreateImage2D_ptr = getFunction("clCreateImage2D"); - return (*clCreateImage2D_ptr)(context, flags, image_format, image_width, image_height, image_row_pitch, host_ptr, errcode_ret); +static cl_mem (*clCreateSubBuffer_ptr)(cl_mem, cl_mem_flags, cl_buffer_create_type, const void *, cl_int *) = NULL; +cl_mem CL_API_CALL clCreateSubBuffer (cl_mem buffer,cl_mem_flags flags,cl_buffer_create_type buffer_create_type,const void * buffer_create_info,cl_int * errcode_ret) { + if(!clCreateSubBuffer_ptr) clCreateSubBuffer_ptr = getFunction("clCreateSubBuffer"); + return (*clCreateSubBuffer_ptr)(buffer, flags, buffer_create_type, buffer_create_info, errcode_ret); } -static cl_mem (CL_API_CALL *clCreateImage3D_ptr)(cl_context, cl_mem_flags, const cl_image_format *, size_t, size_t, size_t, size_t, size_t, void *, cl_int *) = NULL; -cl_mem CL_API_CALL clCreateImage3D (cl_context context,cl_mem_flags flags,const cl_image_format * image_format,size_t image_width,size_t image_height,size_t image_depth,size_t image_row_pitch,size_t image_slice_pitch,void * host_ptr,cl_int * errcode_ret) { - if(!clCreateImage3D_ptr) clCreateImage3D_ptr = getFunction("clCreateImage3D"); - return (*clCreateImage3D_ptr)(context, flags, image_format, image_width, image_height, image_depth, image_row_pitch, image_slice_pitch, host_ptr, errcode_ret); +static cl_mem (*clCreateImage_ptr)(cl_context, cl_mem_flags, const cl_image_format *, const cl_image_desc *, void *, cl_int *) = NULL; +cl_mem CL_API_CALL clCreateImage (cl_context context,cl_mem_flags flags,const cl_image_format * image_format,const cl_image_desc * image_desc,void * host_ptr,cl_int * errcode_ret) { + if(!clCreateImage_ptr) clCreateImage_ptr = getFunction("clCreateImage"); + return (*clCreateImage_ptr)(context, flags, image_format, image_desc, host_ptr, errcode_ret); } -static cl_int (CL_API_CALL *clRetainMemObject_ptr)(cl_mem) = NULL; +static cl_int (*clRetainMemObject_ptr)(cl_mem) = NULL; cl_int CL_API_CALL clRetainMemObject (cl_mem memobj) { if(!clRetainMemObject_ptr) clRetainMemObject_ptr = getFunction("clRetainMemObject"); return (*clRetainMemObject_ptr)(memobj); } -static cl_int (CL_API_CALL *clReleaseMemObject_ptr)(cl_mem) = NULL; +static cl_int (*clReleaseMemObject_ptr)(cl_mem) = NULL; cl_int CL_API_CALL clReleaseMemObject (cl_mem memobj) { if(!clReleaseMemObject_ptr) clReleaseMemObject_ptr = getFunction("clReleaseMemObject"); return (*clReleaseMemObject_ptr)(memobj); } -static cl_int (CL_API_CALL *clGetSupportedImageFormats_ptr)(cl_context, cl_mem_flags, cl_mem_object_type, cl_uint, cl_image_format *, cl_uint *) = NULL; +static cl_int (*clGetSupportedImageFormats_ptr)(cl_context, cl_mem_flags, cl_mem_object_type, cl_uint, cl_image_format *, cl_uint *) = NULL; cl_int CL_API_CALL clGetSupportedImageFormats (cl_context context,cl_mem_flags flags,cl_mem_object_type image_type,cl_uint num_entries,cl_image_format * image_formats,cl_uint * num_image_formats) { if(!clGetSupportedImageFormats_ptr) clGetSupportedImageFormats_ptr = getFunction("clGetSupportedImageFormats"); return (*clGetSupportedImageFormats_ptr)(context, flags, image_type, num_entries, image_formats, num_image_formats); } -static cl_int (CL_API_CALL *clGetMemObjectInfo_ptr)(cl_mem, cl_mem_info, size_t, void *, size_t *) = NULL; +static cl_int (*clGetMemObjectInfo_ptr)(cl_mem, cl_mem_info, size_t, void *, size_t *) = NULL; cl_int CL_API_CALL clGetMemObjectInfo (cl_mem memobj,cl_mem_info param_name,size_t param_value_size,void * param_value,size_t * param_value_size_ret) { if(!clGetMemObjectInfo_ptr) clGetMemObjectInfo_ptr = getFunction("clGetMemObjectInfo"); return (*clGetMemObjectInfo_ptr)(memobj, param_name, param_value_size, param_value, param_value_size_ret); } -static cl_int (CL_API_CALL *clGetImageInfo_ptr)(cl_mem, cl_image_info, size_t, void *, size_t *) = NULL; +static cl_int (*clGetImageInfo_ptr)(cl_mem, cl_image_info, size_t, void *, size_t *) = NULL; cl_int CL_API_CALL clGetImageInfo (cl_mem image,cl_image_info param_name,size_t param_value_size,void * param_value,size_t * param_value_size_ret) { if(!clGetImageInfo_ptr) clGetImageInfo_ptr = getFunction("clGetImageInfo"); return (*clGetImageInfo_ptr)(image, param_name, param_value_size, param_value, param_value_size_ret); } -static cl_sampler (CL_API_CALL *clCreateSampler_ptr)(cl_context, cl_bool, cl_addressing_mode, cl_filter_mode, cl_int *) = NULL; -cl_sampler CL_API_CALL clCreateSampler (cl_context context,cl_bool normalized_coords,cl_addressing_mode addressing_mode,cl_filter_mode filter_mode,cl_int * errcode_ret) { +/* Sampler APIs */ +static cl_int (*clSetMemObjectDestructorCallback_ptr)(cl_mem memobj,void (CL_CALLBACK *pfn_notify)( cl_mem memobj, void*) ,void *user_data ) = NULL; +cl_int CL_API_CALL clSetMemObjectDestructorCallback (cl_mem memobj,void (CL_CALLBACK *pfn_notify)( cl_mem memobj, void*) ,void *user_data ) +{ + if(!clSetMemObjectDestructorCallback_ptr) clSetMemObjectDestructorCallback_ptr = getFunction("clSetMemObjectDestructorCallback"); + return (*clSetMemObjectDestructorCallback_ptr)(memobj, pfn_notify, user_data); +} + +/* Sampler APIs */ +static cl_sampler (*clCreateSampler_ptr)(cl_context, cl_bool, cl_addressing_mode, cl_filter_mode, cl_int *) = NULL; +cl_sampler CL_API_CALL clCreateSampler(cl_context context,cl_bool normalized_coords,cl_addressing_mode addressing_mode,cl_filter_mode filter_mode,cl_int * errcode_ret) { if(!clCreateSampler_ptr) clCreateSampler_ptr = getFunction("clCreateSampler"); return (*clCreateSampler_ptr)(context, normalized_coords, addressing_mode, filter_mode, errcode_ret); } -static cl_int (CL_API_CALL *clRetainSampler_ptr)(cl_sampler) = NULL; +static cl_int (*clRetainSampler_ptr)(cl_sampler) = NULL; cl_int CL_API_CALL clRetainSampler (cl_sampler sampler) { if(!clRetainSampler_ptr) clRetainSampler_ptr = getFunction("clRetainSampler"); return (*clRetainSampler_ptr)(sampler); } -static cl_int (CL_API_CALL *clReleaseSampler_ptr)(cl_sampler) = NULL; +static cl_int (*clReleaseSampler_ptr)(cl_sampler) = NULL; cl_int CL_API_CALL clReleaseSampler (cl_sampler sampler) { if(!clReleaseSampler_ptr) clReleaseSampler_ptr = getFunction("clReleaseSampler"); return (*clReleaseSampler_ptr)(sampler); } -static cl_int (CL_API_CALL *clGetSamplerInfo_ptr)(cl_sampler, cl_sampler_info, size_t, void *, size_t *) = NULL; +static cl_int (*clGetSamplerInfo_ptr)(cl_sampler, cl_sampler_info, size_t, void *, size_t *) = NULL; cl_int CL_API_CALL clGetSamplerInfo (cl_sampler sampler,cl_sampler_info param_name,size_t param_value_size,void * param_value,size_t * param_value_size_ret) { if(!clGetSamplerInfo_ptr) clGetSamplerInfo_ptr = getFunction("clGetSamplerInfo"); return (*clGetSamplerInfo_ptr)(sampler, param_name, param_value_size, param_value, param_value_size_ret); } -static cl_program (CL_API_CALL *clCreateProgramWithSource_ptr)(cl_context, cl_uint, const char **, const size_t *, cl_int *) = NULL; +static cl_program (*clCreateProgramWithSource_ptr)(cl_context, cl_uint, const char **, const size_t *, cl_int *) = NULL; cl_program CL_API_CALL clCreateProgramWithSource (cl_context context,cl_uint count,const char ** strings,const size_t * lengths,cl_int * errcode_ret) { if(!clCreateProgramWithSource_ptr) clCreateProgramWithSource_ptr = getFunction("clCreateProgramWithSource"); return (*clCreateProgramWithSource_ptr)(context, count, strings, lengths, errcode_ret); } -static cl_program (CL_API_CALL *clCreateProgramWithBinary_ptr)(cl_context, cl_uint, const cl_device_id *, const size_t *, const unsigned char **, cl_int *, cl_int *) = NULL; +static cl_program (*clCreateProgramWithBinary_ptr)(cl_context, cl_uint, const cl_device_id *, const size_t *, const unsigned char **, cl_int *, cl_int *) = NULL; cl_program CL_API_CALL clCreateProgramWithBinary (cl_context context,cl_uint num_devices,const cl_device_id * device_list,const size_t * lengths,const unsigned char ** binaries,cl_int * binary_status,cl_int * errcode_ret) { if(!clCreateProgramWithBinary_ptr) clCreateProgramWithBinary_ptr = getFunction("clCreateProgramWithBinary"); return (*clCreateProgramWithBinary_ptr)(context, num_devices, device_list, lengths, binaries, binary_status, errcode_ret); } -static cl_int (CL_API_CALL *clRetainProgram_ptr)(cl_program) = NULL; +static cl_program (*clCreateProgramWithBuiltInKernels_ptr)(cl_context, cl_uint, const cl_device_id *, const char *, cl_int *) = NULL; +cl_program CL_API_CALL clCreateProgramWithBuiltInKernels (cl_context context,cl_uint num_devices,const cl_device_id * device_list,const char * kernel_names,cl_int * errcode_ret) { + if(!clCreateProgramWithBuiltInKernels_ptr) clCreateProgramWithBuiltInKernels_ptr = getFunction("clCreateProgramWithBuiltInKernels"); + return (*clCreateProgramWithBuiltInKernels_ptr)(context, num_devices, device_list, kernel_names, errcode_ret); +} + +static cl_int (*clRetainProgram_ptr)(cl_program) = NULL; cl_int CL_API_CALL clRetainProgram (cl_program program) { if(!clRetainProgram_ptr) clRetainProgram_ptr = getFunction("clRetainProgram"); return (*clRetainProgram_ptr)(program); } -static cl_int (CL_API_CALL *clReleaseProgram_ptr)(cl_program) = NULL; +static cl_int (*clReleaseProgram_ptr)(cl_program) = NULL; cl_int CL_API_CALL clReleaseProgram (cl_program program) { if(!clReleaseProgram_ptr) clReleaseProgram_ptr = getFunction("clReleaseProgram"); return (*clReleaseProgram_ptr)(program); } -static cl_int (CL_API_CALL *clBuildProgram_ptr)(cl_program, cl_uint, const cl_device_id *, const char *, void (CL_CALLBACK * /* pfn_notify */)(cl_program /* program */, void *), void *) = NULL; -cl_int CL_API_CALL clBuildProgram (cl_program program,cl_uint num_devices,const cl_device_id * device_list,const char * options,void (CL_CALLBACK * pfn_notify)(cl_program /* program */, void *),void * user_data) { +static cl_int (*clBuildProgram_ptr)(cl_program, cl_uint, const cl_device_id *, const char *, void (CL_CALLBACK * /* pfn_notify */)(cl_program /* program */, void * /* user_data */), void *) = NULL; +cl_int CL_API_CALL clBuildProgram (cl_program program,cl_uint num_devices,const cl_device_id * device_list,const char * options, void (CL_CALLBACK * pfn_notify)(cl_program /* program */, void * /* user_data */),void * user_data) { if(!clBuildProgram_ptr) clBuildProgram_ptr = getFunction("clBuildProgram"); - return (*clBuildProgram_ptr)(program, num_devices, device_list, options, pfn_notify, user_data); + return (*clBuildProgram_ptr)(program, num_devices, device_list, options, user_data, user_data); } -static cl_int (CL_API_CALL *clUnloadCompiler_ptr)(void) = NULL; -cl_int CL_API_CALL clUnloadCompiler (void) { - if(!clUnloadCompiler_ptr) clUnloadCompiler_ptr = getFunction("clUnloadCompiler"); - return (*clUnloadCompiler_ptr)(); +static cl_int (*clCompileProgram_ptr)(cl_program, cl_uint, const cl_device_id *, const char *, cl_uint, const cl_program *, const char **, void (CL_CALLBACK * /* pfn_notify */)(cl_program /* program */, void * /* user_data */), void *) = NULL; +cl_int CL_API_CALL clCompileProgram (cl_program program,cl_uint num_devices,const cl_device_id * device_list,const char * options,cl_uint num_input_headers,const cl_program * input_headers,const char ** header_include_names,void (CL_CALLBACK * pfn_notify)(cl_program /* program */, void * /* user_data */),void * user_data) { + if(!clCompileProgram_ptr) clCompileProgram_ptr = getFunction("clCompileProgram"); + return (*clCompileProgram_ptr)(program, num_devices, device_list, options, num_input_headers, input_headers, header_include_names, user_data, user_data); } -static cl_int (CL_API_CALL *clGetProgramInfo_ptr)(cl_program, cl_program_info, size_t, void *, size_t *) = NULL; +static cl_program (*clLinkProgram_ptr)(cl_context, cl_uint, const cl_device_id *, const char *, cl_uint, const cl_program *, void (CL_CALLBACK * /* pfn_notify */)(cl_program /* program */, void * /* user_data */), void *, cl_int *) = NULL; +cl_program CL_API_CALL clLinkProgram (cl_context context,cl_uint num_devices,const cl_device_id * device_list,const char * options,cl_uint num_input_programs,const cl_program * input_programs,void (CL_CALLBACK * pfn_notify)(cl_program /* program */, void * /* user_data */),void * user_data,cl_int * errcode_ret) { + if(!clLinkProgram_ptr) clLinkProgram_ptr = getFunction("clLinkProgram"); + return (*clLinkProgram_ptr)(context, num_devices, device_list, options, num_input_programs, input_programs, user_data, user_data, errcode_ret); +} + +static cl_int (*clUnloadPlatformCompiler_ptr)(cl_platform_id) = NULL; +cl_int CL_API_CALL clUnloadPlatformCompiler (cl_platform_id platform) { + if(!clUnloadPlatformCompiler_ptr) clUnloadPlatformCompiler_ptr = getFunction("clUnloadPlatformCompiler"); + return (*clUnloadPlatformCompiler_ptr)(platform); +} + +static cl_int (*clGetProgramInfo_ptr)(cl_program, cl_program_info, size_t, void *, size_t *) = NULL; cl_int CL_API_CALL clGetProgramInfo (cl_program program,cl_program_info param_name,size_t param_value_size,void * param_value,size_t * param_value_size_ret) { if(!clGetProgramInfo_ptr) clGetProgramInfo_ptr = getFunction("clGetProgramInfo"); return (*clGetProgramInfo_ptr)(program, param_name, param_value_size, param_value, param_value_size_ret); } -static cl_int (CL_API_CALL *clGetProgramBuildInfo_ptr)(cl_program, cl_device_id, cl_program_build_info, size_t, void *, size_t *) = NULL; +static cl_int (*clGetProgramBuildInfo_ptr)(cl_program, cl_device_id, cl_program_build_info, size_t, void *, size_t *) = NULL; cl_int CL_API_CALL clGetProgramBuildInfo (cl_program program,cl_device_id device,cl_program_build_info param_name,size_t param_value_size,void * param_value,size_t * param_value_size_ret) { if(!clGetProgramBuildInfo_ptr) clGetProgramBuildInfo_ptr = getFunction("clGetProgramBuildInfo"); return (*clGetProgramBuildInfo_ptr)(program, device, param_name, param_value_size, param_value, param_value_size_ret); } -static cl_kernel (CL_API_CALL *clCreateKernel_ptr)(cl_program, const char *, cl_int *) = NULL; +static cl_kernel (*clCreateKernel_ptr)(cl_program, const char *, cl_int *) = NULL; cl_kernel CL_API_CALL clCreateKernel (cl_program program,const char * kernel_name,cl_int * errcode_ret) { if(!clCreateKernel_ptr) clCreateKernel_ptr = getFunction("clCreateKernel"); return (*clCreateKernel_ptr)(program, kernel_name, errcode_ret); } -static cl_int (CL_API_CALL *clCreateKernelsInProgram_ptr)(cl_program, cl_uint, cl_kernel *, cl_uint *) = NULL; +static cl_int (*clCreateKernelsInProgram_ptr)(cl_program, cl_uint, cl_kernel *, cl_uint *) = NULL; cl_int CL_API_CALL clCreateKernelsInProgram (cl_program program,cl_uint num_kernels,cl_kernel * kernels,cl_uint * num_kernels_ret) { if(!clCreateKernelsInProgram_ptr) clCreateKernelsInProgram_ptr = getFunction("clCreateKernelsInProgram"); return (*clCreateKernelsInProgram_ptr)(program, num_kernels, kernels, num_kernels_ret); } -static cl_int (CL_API_CALL *clRetainKernel_ptr)(cl_kernel) = NULL; +static cl_int (*clRetainKernel_ptr)(cl_kernel) = NULL; cl_int CL_API_CALL clRetainKernel (cl_kernel kernel) { if(!clRetainKernel_ptr) clRetainKernel_ptr = getFunction("clRetainKernel"); return (*clRetainKernel_ptr)(kernel); } -static cl_int (CL_API_CALL *clReleaseKernel_ptr)(cl_kernel) = NULL; +static cl_int (*clReleaseKernel_ptr)(cl_kernel) = NULL; cl_int CL_API_CALL clReleaseKernel (cl_kernel kernel) { if(!clReleaseKernel_ptr) clReleaseKernel_ptr = getFunction("clReleaseKernel"); return (*clReleaseKernel_ptr)(kernel); } -static cl_int (CL_API_CALL *clSetKernelArg_ptr)(cl_kernel, cl_uint, size_t, const void *) = NULL; +static cl_int (*clSetKernelArg_ptr)(cl_kernel, cl_uint, size_t, const void *) = NULL; cl_int CL_API_CALL clSetKernelArg (cl_kernel kernel,cl_uint arg_index,size_t arg_size,const void * arg_value) { if(!clSetKernelArg_ptr) clSetKernelArg_ptr = getFunction("clSetKernelArg"); return (*clSetKernelArg_ptr)(kernel, arg_index, arg_size, arg_value); } -static cl_int (CL_API_CALL *clGetKernelInfo_ptr)(cl_kernel, cl_kernel_info, size_t, void *, size_t *) = NULL; +static cl_int (*clGetKernelInfo_ptr)(cl_kernel, cl_kernel_info, size_t, void *, size_t *) = NULL; cl_int CL_API_CALL clGetKernelInfo (cl_kernel kernel,cl_kernel_info param_name,size_t param_value_size,void * param_value,size_t * param_value_size_ret) { if(!clGetKernelInfo_ptr) clGetKernelInfo_ptr = getFunction("clGetKernelInfo"); return (*clGetKernelInfo_ptr)(kernel, param_name, param_value_size, param_value, param_value_size_ret); } -static cl_int (CL_API_CALL *clGetKernelWorkGroupInfo_ptr)(cl_kernel, cl_device_id, cl_kernel_work_group_info, size_t, void *, size_t *) = NULL; +static cl_int (*clGetKernelArgInfo_ptr)(cl_kernel, cl_uint, cl_kernel_arg_info, size_t, void *, size_t *) = NULL; +cl_int CL_API_CALL clGetKernelArgInfo (cl_kernel kernel,cl_uint arg_indx,cl_kernel_arg_info param_name,size_t param_value_size,void * param_value,size_t * param_value_size_ret) { + if(!clGetKernelArgInfo_ptr) clGetKernelArgInfo_ptr = getFunction("clGetKernelArgInfo"); + return (*clGetKernelArgInfo_ptr)(kernel, arg_indx, param_name, param_value_size, param_value, param_value_size_ret); +} + +static cl_int (*clGetKernelWorkGroupInfo_ptr)(cl_kernel, cl_device_id, cl_kernel_work_group_info, size_t, void *, size_t *) = NULL; cl_int CL_API_CALL clGetKernelWorkGroupInfo (cl_kernel kernel,cl_device_id device,cl_kernel_work_group_info param_name,size_t param_value_size,void * param_value,size_t * param_value_size_ret) { if(!clGetKernelWorkGroupInfo_ptr) clGetKernelWorkGroupInfo_ptr = getFunction("clGetKernelWorkGroupInfo"); return (*clGetKernelWorkGroupInfo_ptr)(kernel, device, param_name, param_value_size, param_value, param_value_size_ret); } -static cl_int (CL_API_CALL *clWaitForEvents_ptr)(cl_uint, const cl_event *) = NULL; +static cl_int (*clWaitForEvents_ptr)(cl_uint, const cl_event *) = NULL; cl_int CL_API_CALL clWaitForEvents (cl_uint num_events,const cl_event * event_list) { if(!clWaitForEvents_ptr) clWaitForEvents_ptr = getFunction("clWaitForEvents"); return (*clWaitForEvents_ptr)(num_events, event_list); } -static cl_int (CL_API_CALL *clGetEventInfo_ptr)(cl_event, cl_event_info, size_t, void *, size_t *) = NULL; +static cl_int (*clGetEventInfo_ptr)(cl_event, cl_event_info, size_t, void *, size_t *) = NULL; cl_int CL_API_CALL clGetEventInfo (cl_event event,cl_event_info param_name,size_t param_value_size,void * param_value,size_t * param_value_size_ret) { if(!clGetEventInfo_ptr) clGetEventInfo_ptr = getFunction("clGetEventInfo"); return (*clGetEventInfo_ptr)(event, param_name, param_value_size, param_value, param_value_size_ret); } -static cl_int (CL_API_CALL *clRetainEvent_ptr)(cl_event) = NULL; -cl_int CL_API_CALL clRetainEvent (cl_event event) { +static cl_event (*clCreateUserEvent_ptr)(cl_context, cl_int * /* errcode_ret */) = NULL; +cl_event CL_API_CALL clCreateUserEvent (cl_context context,cl_int * errcode_ret) +{ + if(!clCreateUserEvent_ptr) clCreateUserEvent_ptr = getFunction("clCreateUserEvent"); + return (*clCreateUserEvent_ptr)(context,errcode_ret); +} + +static cl_int (*clRetainEvent_ptr)(cl_event) = NULL; +cl_int CL_API_CALL clRetainEvent(cl_event event) { if(!clRetainEvent_ptr) clRetainEvent_ptr = getFunction("clRetainEvent"); return (*clRetainEvent_ptr)(event); } -static cl_int (CL_API_CALL *clReleaseEvent_ptr)(cl_event) = NULL; +static cl_int (*clReleaseEvent_ptr)(cl_event) = NULL; cl_int CL_API_CALL clReleaseEvent (cl_event event) { if(!clReleaseEvent_ptr) clReleaseEvent_ptr = getFunction("clReleaseEvent"); return (*clReleaseEvent_ptr)(event); } -static cl_int (CL_API_CALL *clGetEventProfilingInfo_ptr)(cl_event, cl_profiling_info, size_t, void *, size_t *) = NULL; +static cl_int (*clSetUserEventStatus_ptr)(cl_event, cl_int) = NULL; +cl_int CL_API_CALL clSetUserEventStatus (cl_event event,cl_int execution_status) { + if(!clSetUserEventStatus_ptr) clSetUserEventStatus_ptr = getFunction("clSetUserEventStatus"); + return (*clSetUserEventStatus_ptr)(event, execution_status); +} + +static cl_int (*clSetEventCallback_ptr)(cl_event, cl_int, void (CL_CALLBACK * /* pfn_notify */)(cl_event, cl_int, void *), void*) = NULL; +cl_int CL_API_CALL clSetEventCallback (cl_event event,cl_int command_exec_callback_type, void (CL_CALLBACK * pfn_notify)(cl_event, cl_int, void *), void* user_data) { + if(!clSetEventCallback_ptr) clSetEventCallback_ptr = getFunction("clSetEventCallback"); + return (*clSetEventCallback_ptr)(event, command_exec_callback_type, pfn_notify, user_data); +} + +static cl_int (*clGetEventProfilingInfo_ptr)(cl_event, cl_profiling_info, size_t, void *, size_t *) = NULL; cl_int CL_API_CALL clGetEventProfilingInfo (cl_event event,cl_profiling_info param_name,size_t param_value_size,void * param_value,size_t * param_value_size_ret) { if(!clGetEventProfilingInfo_ptr) clGetEventProfilingInfo_ptr = getFunction("clGetEventProfilingInfo"); return (*clGetEventProfilingInfo_ptr)(event, param_name, param_value_size, param_value, param_value_size_ret); } -static cl_int (CL_API_CALL *clFlush_ptr)(cl_command_queue) = NULL; +static cl_int (*clFlush_ptr)(cl_command_queue) = NULL; cl_int CL_API_CALL clFlush (cl_command_queue command_queue) { if(!clFlush_ptr) clFlush_ptr = getFunction("clFlush"); return (*clFlush_ptr)(command_queue); } -static cl_int (CL_API_CALL *clFinish_ptr)(cl_command_queue) = NULL; +static cl_int (*clFinish_ptr)(cl_command_queue) = NULL; cl_int CL_API_CALL clFinish (cl_command_queue command_queue) { if(!clFinish_ptr) clFinish_ptr = getFunction("clFinish"); return (*clFinish_ptr)(command_queue); } -static cl_int (CL_API_CALL *clEnqueueReadBuffer_ptr)(cl_command_queue, cl_mem, cl_bool, size_t, size_t, void *, cl_uint, const cl_event *, cl_event *) = NULL; -cl_int CL_API_CALL clEnqueueReadBuffer (cl_command_queue command_queue,cl_mem buffer,cl_bool blocking_read,size_t offset,size_t cb,void * ptr,cl_uint num_events_in_wait_list,const cl_event * event_wait_list,cl_event * event) { +static cl_int (*clEnqueueReadBuffer_ptr)(cl_command_queue, cl_mem, cl_bool, size_t, size_t, void *, cl_uint, const cl_event *, cl_event *) = NULL; +cl_int CL_API_CALL clEnqueueReadBuffer (cl_command_queue command_queue,cl_mem buffer,cl_bool blocking_read,size_t offset,size_t size,void * ptr,cl_uint num_events_in_wait_list,const cl_event * event_wait_list,cl_event * event) { if(!clEnqueueReadBuffer_ptr) clEnqueueReadBuffer_ptr = getFunction("clEnqueueReadBuffer"); - return (*clEnqueueReadBuffer_ptr)(command_queue, buffer, blocking_read, offset, cb, ptr, num_events_in_wait_list, event_wait_list, event); + return (*clEnqueueReadBuffer_ptr)(command_queue, buffer, blocking_read, offset, size, ptr, num_events_in_wait_list, event_wait_list, event); } -static cl_int (CL_API_CALL *clEnqueueWriteBuffer_ptr)(cl_command_queue, cl_mem, cl_bool, size_t, size_t, const void *, cl_uint, const cl_event *, cl_event *) = NULL; -cl_int CL_API_CALL clEnqueueWriteBuffer (cl_command_queue command_queue,cl_mem buffer,cl_bool blocking_write,size_t offset,size_t cb,const void * ptr,cl_uint num_events_in_wait_list,const cl_event * event_wait_list,cl_event * event) { +static cl_int (*clEnqueueReadBufferRect_ptr)(cl_command_queue, cl_mem, cl_bool, const size_t *, const size_t *, const size_t *, size_t, size_t, size_t, size_t, void *, cl_uint, const cl_event *, cl_event *) = NULL; +cl_int CL_API_CALL clEnqueueReadBufferRect (cl_command_queue command_queue,cl_mem buffer,cl_bool blocking_read,const size_t * buffer_offset,const size_t * host_offset,const size_t * region,size_t buffer_row_pitch,size_t buffer_slice_pitch,size_t host_row_pitch,size_t host_slice_pitch,void * ptr,cl_uint num_events_in_wait_list,const cl_event * event_wait_list,cl_event * event) { + if(!clEnqueueReadBufferRect_ptr) clEnqueueReadBufferRect_ptr = getFunction("clEnqueueReadBufferRect"); + return (*clEnqueueReadBufferRect_ptr)(command_queue, buffer, blocking_read, buffer_offset, host_offset, region, buffer_row_pitch, buffer_slice_pitch, host_row_pitch, host_slice_pitch, ptr, num_events_in_wait_list, event_wait_list, event); +} + +static cl_int (*clEnqueueWriteBuffer_ptr)(cl_command_queue, cl_mem, cl_bool, size_t, size_t, const void *, cl_uint, const cl_event *, cl_event *) = NULL; +cl_int CL_API_CALL clEnqueueWriteBuffer (cl_command_queue command_queue,cl_mem buffer,cl_bool blocking_write,size_t offset,size_t size,const void * ptr,cl_uint num_events_in_wait_list,const cl_event * event_wait_list,cl_event * event) { if(!clEnqueueWriteBuffer_ptr) clEnqueueWriteBuffer_ptr = getFunction("clEnqueueWriteBuffer"); - return (*clEnqueueWriteBuffer_ptr)(command_queue, buffer, blocking_write, offset, cb, ptr, num_events_in_wait_list, event_wait_list, event); + return (*clEnqueueWriteBuffer_ptr)(command_queue, buffer, blocking_write, offset, size, ptr, num_events_in_wait_list, event_wait_list, event); } -static cl_int (CL_API_CALL *clEnqueueCopyBuffer_ptr)(cl_command_queue, cl_mem, cl_mem, size_t, size_t, size_t, cl_uint, const cl_event *, cl_event *) = NULL; -cl_int CL_API_CALL clEnqueueCopyBuffer (cl_command_queue command_queue,cl_mem src_buffer,cl_mem dst_buffer,size_t src_offset,size_t dst_offset,size_t cb,cl_uint num_events_in_wait_list,const cl_event * event_wait_list,cl_event * event) { +static cl_int (*clEnqueueWriteBufferRect_ptr)(cl_command_queue, cl_mem, cl_bool, const size_t *, const size_t *, const size_t *, size_t, size_t, size_t, size_t, const void *, cl_uint, const cl_event *, cl_event *) = NULL; +cl_int CL_API_CALL clEnqueueWriteBufferRect (cl_command_queue command_queue,cl_mem buffer,cl_bool blocking_write,const size_t * buffer_offset,const size_t * host_offset,const size_t * region,size_t buffer_row_pitch,size_t buffer_slice_pitch,size_t host_row_pitch,size_t host_slice_pitch,const void * ptr,cl_uint num_events_in_wait_list,const cl_event * event_wait_list,cl_event * event) { + if(!clEnqueueWriteBufferRect_ptr) clEnqueueWriteBufferRect_ptr = getFunction("clEnqueueWriteBufferRect"); + return (*clEnqueueWriteBufferRect_ptr)(command_queue, buffer, blocking_write, buffer_offset, host_offset, region, buffer_row_pitch, buffer_slice_pitch, host_row_pitch, host_slice_pitch, ptr, num_events_in_wait_list, event_wait_list, event); +} + +static cl_int (*clEnqueueFillBuffer_ptr)(cl_command_queue, cl_mem, const void *, size_t, size_t, size_t, cl_uint, const cl_event *, cl_event *) = NULL; +cl_int CL_API_CALL clEnqueueFillBuffer (cl_command_queue command_queue,cl_mem buffer,const void * pattern,size_t pattern_size,size_t offset,size_t size,cl_uint num_events_in_wait_list,const cl_event * event_wait_list,cl_event * event) { + if(!clEnqueueFillBuffer_ptr) clEnqueueFillBuffer_ptr = getFunction("clEnqueueFillBuffer"); + return (*clEnqueueFillBuffer_ptr)(command_queue, buffer, pattern, pattern_size, offset, size, num_events_in_wait_list, event_wait_list, event); +} + +static cl_int (*clEnqueueCopyBuffer_ptr)(cl_command_queue, cl_mem, cl_mem, size_t, size_t, size_t, cl_uint, const cl_event *, cl_event *) = NULL; +cl_int CL_API_CALL clEnqueueCopyBuffer (cl_command_queue command_queue,cl_mem src_buffer,cl_mem dst_buffer,size_t src_offset,size_t dst_offset,size_t size,cl_uint num_events_in_wait_list,const cl_event * event_wait_list,cl_event * event) { if(!clEnqueueCopyBuffer_ptr) clEnqueueCopyBuffer_ptr = getFunction("clEnqueueCopyBuffer"); - return (*clEnqueueCopyBuffer_ptr)(command_queue, src_buffer, dst_buffer, src_offset, dst_offset, cb, num_events_in_wait_list, event_wait_list, event); + return (*clEnqueueCopyBuffer_ptr)(command_queue, src_buffer, dst_buffer, src_offset, dst_offset, size, num_events_in_wait_list, event_wait_list, event); } -static cl_int (CL_API_CALL *clEnqueueReadImage_ptr)(cl_command_queue, cl_mem, cl_bool, const size_t *, const size_t *, size_t, size_t, void *, cl_uint, const cl_event *, cl_event *) = NULL; +static cl_int (*clEnqueueCopyBufferRect_ptr)(cl_command_queue, cl_mem, cl_mem, const size_t *, const size_t *, const size_t *, size_t, size_t, size_t, size_t, cl_uint, const cl_event *, cl_event *) = NULL; +cl_int CL_API_CALL clEnqueueCopyBufferRect (cl_command_queue command_queue,cl_mem src_buffer,cl_mem dst_buffer,const size_t * src_origin,const size_t * dst_origin,const size_t * region,size_t src_row_pitch,size_t src_slice_pitch,size_t dst_row_pitch,size_t dst_slice_pitch,cl_uint num_events_in_wait_list,const cl_event * event_wait_list,cl_event * event) { + if(!clEnqueueCopyBufferRect_ptr) clEnqueueCopyBufferRect_ptr = getFunction("clEnqueueCopyBufferRect"); + return (*clEnqueueCopyBufferRect_ptr)(command_queue, src_buffer, dst_buffer, src_origin, dst_origin, region, src_row_pitch, src_slice_pitch, dst_row_pitch, dst_slice_pitch, num_events_in_wait_list, event_wait_list, event); +} + +static cl_int (*clEnqueueReadImage_ptr)(cl_command_queue, cl_mem, cl_bool, const size_t *, const size_t *, size_t, size_t, void *, cl_uint, const cl_event *, cl_event *) = NULL; cl_int CL_API_CALL clEnqueueReadImage (cl_command_queue command_queue,cl_mem image,cl_bool blocking_read,const size_t * origin,const size_t * region,size_t row_pitch,size_t slice_pitch,void * ptr,cl_uint num_events_in_wait_list,const cl_event * event_wait_list,cl_event * event) { if(!clEnqueueReadImage_ptr) clEnqueueReadImage_ptr = getFunction("clEnqueueReadImage"); return (*clEnqueueReadImage_ptr)(command_queue, image, blocking_read, origin, region, row_pitch, slice_pitch, ptr, num_events_in_wait_list, event_wait_list, event); } -static cl_int (CL_API_CALL *clEnqueueWriteImage_ptr)(cl_command_queue, cl_mem, cl_bool, const size_t *, const size_t *, size_t, size_t, const void *, cl_uint, const cl_event *, cl_event *) = NULL; +static cl_int (*clEnqueueWriteImage_ptr)(cl_command_queue, cl_mem, cl_bool, const size_t *, const size_t *, size_t, size_t, const void *, cl_uint, const cl_event *, cl_event *) = NULL; cl_int CL_API_CALL clEnqueueWriteImage (cl_command_queue command_queue,cl_mem image,cl_bool blocking_write,const size_t * origin,const size_t * region,size_t input_row_pitch,size_t input_slice_pitch,const void * ptr,cl_uint num_events_in_wait_list,const cl_event * event_wait_list,cl_event * event) { if(!clEnqueueWriteImage_ptr) clEnqueueWriteImage_ptr = getFunction("clEnqueueWriteImage"); return (*clEnqueueWriteImage_ptr)(command_queue, image, blocking_write, origin, region, input_row_pitch, input_slice_pitch, ptr, num_events_in_wait_list, event_wait_list, event); } -static cl_int (CL_API_CALL *clEnqueueCopyImage_ptr)(cl_command_queue, cl_mem, cl_mem, const size_t *, const size_t *, const size_t *, cl_uint, const cl_event *, cl_event *) = NULL; +static cl_int (*clEnqueueFillImage_ptr)(cl_command_queue, cl_mem, const void *, const size_t *, const size_t *, cl_uint, const cl_event *, cl_event *) = NULL; +cl_int CL_API_CALL clEnqueueFillImage (cl_command_queue command_queue,cl_mem image,const void * fill_color,const size_t * origin,const size_t * region,cl_uint num_events_in_wait_list,const cl_event * event_wait_list,cl_event * event) { + if(!clEnqueueFillImage_ptr) clEnqueueFillImage_ptr = getFunction("clEnqueueFillImage"); + return (*clEnqueueFillImage_ptr)(command_queue, image, fill_color, origin, region, num_events_in_wait_list, event_wait_list, event); +} + +static cl_int (*clEnqueueCopyImage_ptr)(cl_command_queue, cl_mem, cl_mem, const size_t *, const size_t *, const size_t *, cl_uint, const cl_event *, cl_event *) = NULL; cl_int CL_API_CALL clEnqueueCopyImage (cl_command_queue command_queue,cl_mem src_image,cl_mem dst_image,const size_t * src_origin,const size_t * dst_origin,const size_t * region,cl_uint num_events_in_wait_list,const cl_event * event_wait_list,cl_event * event) { if(!clEnqueueCopyImage_ptr) clEnqueueCopyImage_ptr = getFunction("clEnqueueCopyImage"); return (*clEnqueueCopyImage_ptr)(command_queue, src_image, dst_image, src_origin, dst_origin, region, num_events_in_wait_list, event_wait_list, event); } -static cl_int (CL_API_CALL *clEnqueueCopyImageToBuffer_ptr)(cl_command_queue, cl_mem, cl_mem, const size_t *, const size_t *, size_t, cl_uint, const cl_event *, cl_event *) = NULL; +static cl_int (*clEnqueueCopyImageToBuffer_ptr)(cl_command_queue, cl_mem, cl_mem, const size_t *, const size_t *, size_t, cl_uint, const cl_event *, cl_event *) = NULL; cl_int CL_API_CALL clEnqueueCopyImageToBuffer (cl_command_queue command_queue,cl_mem src_image,cl_mem dst_buffer,const size_t * src_origin,const size_t * region,size_t dst_offset,cl_uint num_events_in_wait_list,const cl_event * event_wait_list,cl_event * event) { if(!clEnqueueCopyImageToBuffer_ptr) clEnqueueCopyImageToBuffer_ptr = getFunction("clEnqueueCopyImageToBuffer"); return (*clEnqueueCopyImageToBuffer_ptr)(command_queue, src_image, dst_buffer, src_origin, region, dst_offset, num_events_in_wait_list, event_wait_list, event); } -static cl_int (CL_API_CALL *clEnqueueCopyBufferToImage_ptr)(cl_command_queue, cl_mem, cl_mem, size_t, const size_t *, const size_t *, cl_uint, const cl_event *, cl_event *) = NULL; +static cl_int (*clEnqueueCopyBufferToImage_ptr)(cl_command_queue, cl_mem, cl_mem, size_t, const size_t *, const size_t *, cl_uint, const cl_event *, cl_event *) = NULL; cl_int CL_API_CALL clEnqueueCopyBufferToImage (cl_command_queue command_queue,cl_mem src_buffer,cl_mem dst_image,size_t src_offset,const size_t * dst_origin,const size_t * region,cl_uint num_events_in_wait_list,const cl_event * event_wait_list,cl_event * event) { if(!clEnqueueCopyBufferToImage_ptr) clEnqueueCopyBufferToImage_ptr = getFunction("clEnqueueCopyBufferToImage"); return (*clEnqueueCopyBufferToImage_ptr)(command_queue, src_buffer, dst_image, src_offset, dst_origin, region, num_events_in_wait_list, event_wait_list, event); } -static void * (CL_API_CALL *clEnqueueMapBuffer_ptr)(cl_command_queue, cl_mem, cl_bool, cl_map_flags, size_t, size_t, cl_uint, const cl_event *, cl_event *, cl_int *) = NULL; -void * CL_API_CALL clEnqueueMapBuffer (cl_command_queue command_queue,cl_mem buffer,cl_bool blocking_map,cl_map_flags map_flags,size_t offset,size_t cb,cl_uint num_events_in_wait_list,const cl_event * event_wait_list,cl_event * event,cl_int * errcode_ret) { +static void * (*clEnqueueMapBuffer_ptr)(cl_command_queue, cl_mem, cl_bool, cl_map_flags, size_t, size_t, cl_uint, const cl_event *, cl_event *, cl_int *) = NULL; +void * CL_API_CALL clEnqueueMapBuffer (cl_command_queue command_queue,cl_mem buffer,cl_bool blocking_map,cl_map_flags map_flags,size_t offset,size_t size,cl_uint num_events_in_wait_list,const cl_event * event_wait_list,cl_event * event,cl_int * errcode_ret) { if(!clEnqueueMapBuffer_ptr) clEnqueueMapBuffer_ptr = getFunction("clEnqueueMapBuffer"); - return (*clEnqueueMapBuffer_ptr)(command_queue, buffer, blocking_map, map_flags, offset, cb, num_events_in_wait_list, event_wait_list, event, errcode_ret); + return (*clEnqueueMapBuffer_ptr)(command_queue, buffer, blocking_map, map_flags, offset, size, num_events_in_wait_list, event_wait_list, event, errcode_ret); } -static void * (CL_API_CALL *clEnqueueMapImage_ptr)(cl_command_queue, cl_mem, cl_bool, cl_map_flags, const size_t *, const size_t *, size_t *, size_t *, cl_uint, const cl_event *, cl_event *, cl_int *) = NULL; +static void * (*clEnqueueMapImage_ptr)(cl_command_queue, cl_mem, cl_bool, cl_map_flags, const size_t *, const size_t *, size_t *, size_t *, cl_uint, const cl_event *, cl_event *, cl_int *) = NULL; void * CL_API_CALL clEnqueueMapImage (cl_command_queue command_queue,cl_mem image,cl_bool blocking_map,cl_map_flags map_flags,const size_t * origin,const size_t * region,size_t * image_row_pitch,size_t * image_slice_pitch,cl_uint num_events_in_wait_list,const cl_event * event_wait_list,cl_event * event,cl_int * errcode_ret) { if(!clEnqueueMapImage_ptr) clEnqueueMapImage_ptr = getFunction("clEnqueueMapImage"); return (*clEnqueueMapImage_ptr)(command_queue, image, blocking_map, map_flags, origin, region, image_row_pitch, image_slice_pitch, num_events_in_wait_list, event_wait_list, event, errcode_ret); } -static cl_int (CL_API_CALL *clEnqueueUnmapMemObject_ptr)(cl_command_queue, cl_mem, void *, cl_uint, const cl_event *, cl_event *) = NULL; +static cl_int (*clEnqueueUnmapMemObject_ptr)(cl_command_queue, cl_mem, void *, cl_uint, const cl_event *, cl_event *) = NULL; cl_int CL_API_CALL clEnqueueUnmapMemObject (cl_command_queue command_queue,cl_mem memobj,void * mapped_ptr,cl_uint num_events_in_wait_list,const cl_event * event_wait_list,cl_event * event) { if(!clEnqueueUnmapMemObject_ptr) clEnqueueUnmapMemObject_ptr = getFunction("clEnqueueUnmapMemObject"); return (*clEnqueueUnmapMemObject_ptr)(command_queue, memobj, mapped_ptr, num_events_in_wait_list, event_wait_list, event); } -static cl_int (CL_API_CALL *clEnqueueNDRangeKernel_ptr)(cl_command_queue, cl_kernel, cl_uint, const size_t *, const size_t *, const size_t *, cl_uint, const cl_event *, cl_event *) = NULL; +static cl_int (*clEnqueueMigrateMemObjects_ptr)(cl_command_queue, cl_uint, const cl_mem *, cl_mem_migration_flags, cl_uint, const cl_event *, cl_event *) = NULL; +cl_int CL_API_CALL clEnqueueMigrateMemObjects (cl_command_queue command_queue,cl_uint num_mem_objects,const cl_mem * mem_objects,cl_mem_migration_flags flags,cl_uint num_events_in_wait_list,const cl_event * event_wait_list,cl_event * event) { + if(!clEnqueueMigrateMemObjects_ptr) clEnqueueMigrateMemObjects_ptr = getFunction("clEnqueueMigrateMemObjects"); + return (*clEnqueueMigrateMemObjects_ptr)(command_queue, num_mem_objects, mem_objects, flags, num_events_in_wait_list, event_wait_list, event); +} + +static cl_int (*clEnqueueNDRangeKernel_ptr)(cl_command_queue, cl_kernel, cl_uint, const size_t *, const size_t *, const size_t *, cl_uint, const cl_event *, cl_event *) = NULL; cl_int CL_API_CALL clEnqueueNDRangeKernel (cl_command_queue command_queue,cl_kernel kernel,cl_uint work_dim,const size_t * global_work_offset,const size_t * global_work_size,const size_t * local_work_size,cl_uint num_events_in_wait_list,const cl_event * event_wait_list,cl_event * event) { if(!clEnqueueNDRangeKernel_ptr) clEnqueueNDRangeKernel_ptr = getFunction("clEnqueueNDRangeKernel"); return (*clEnqueueNDRangeKernel_ptr)(command_queue, kernel, work_dim, global_work_offset, global_work_size, local_work_size, num_events_in_wait_list, event_wait_list, event); } -static cl_int (CL_API_CALL *clEnqueueTask_ptr)(cl_command_queue, cl_kernel, cl_uint, const cl_event *, cl_event *) = NULL; +static cl_int (*clEnqueueTask_ptr)(cl_command_queue, cl_kernel, cl_uint, const cl_event *, cl_event *) = NULL; cl_int CL_API_CALL clEnqueueTask (cl_command_queue command_queue,cl_kernel kernel,cl_uint num_events_in_wait_list,const cl_event * event_wait_list,cl_event * event) { if(!clEnqueueTask_ptr) clEnqueueTask_ptr = getFunction("clEnqueueTask"); return (*clEnqueueTask_ptr)(command_queue, kernel, num_events_in_wait_list, event_wait_list, event); } -static cl_int (CL_API_CALL *clEnqueueNativeKernel_ptr)(cl_command_queue, void (*)(void *), void *, size_t, cl_uint, const cl_mem *, const void **, cl_uint, const cl_event *, cl_event *) = NULL; -cl_int CL_API_CALL clEnqueueNativeKernel (cl_command_queue command_queue,void (*user_func)(void *),void * args,size_t cb_args,cl_uint num_mem_objects,const cl_mem * mem_list,const void ** args_mem_loc,cl_uint num_events_in_wait_list,const cl_event * event_wait_list,cl_event * event) { +static cl_int (*clEnqueueNativeKernel_ptr)(cl_command_queue, void (CL_CALLBACK * /*user_func*/)(void *), void *, size_t, cl_uint, const cl_mem *, const void **, cl_uint, const cl_event *, cl_event *) = NULL; +cl_int CL_API_CALL clEnqueueNativeKernel (cl_command_queue command_queue,void (CL_CALLBACK *user_func)(void *) ,void * args,size_t cb_args,cl_uint num_mem_objects,const cl_mem * mem_list,const void ** args_mem_loc,cl_uint num_events_in_wait_list,const cl_event * event_wait_list,cl_event * event) { if(!clEnqueueNativeKernel_ptr) clEnqueueNativeKernel_ptr = getFunction("clEnqueueNativeKernel"); return (*clEnqueueNativeKernel_ptr)(command_queue, user_func, args, cb_args, num_mem_objects, mem_list, args_mem_loc, num_events_in_wait_list, event_wait_list, event); } -static cl_int (CL_API_CALL *clEnqueueMarker_ptr)(cl_command_queue, cl_event *) = NULL; -cl_int CL_API_CALL clEnqueueMarker (cl_command_queue command_queue,cl_event * event) { +static cl_int (*clEnqueueMarkerWithWaitList_ptr)(cl_command_queue, cl_uint, const cl_event *, cl_event *) = NULL; +cl_int CL_API_CALL clEnqueueMarkerWithWaitList (cl_command_queue command_queue,cl_uint num_events_in_wait_list,const cl_event * event_wait_list,cl_event * event) { + if(!clEnqueueMarkerWithWaitList_ptr) clEnqueueMarkerWithWaitList_ptr = getFunction("clEnqueueMarkerWithWaitList"); + return (*clEnqueueMarkerWithWaitList_ptr)(command_queue, num_events_in_wait_list, event_wait_list, event); +} + +static cl_int (*clEnqueueBarrierWithWaitList_ptr)(cl_command_queue, cl_uint, const cl_event *, cl_event *) = NULL; +cl_int CL_API_CALL clEnqueueBarrierWithWaitList (cl_command_queue command_queue,cl_uint num_events_in_wait_list,const cl_event * event_wait_list,cl_event * event) { + if(!clEnqueueBarrierWithWaitList_ptr) clEnqueueBarrierWithWaitList_ptr = getFunction("clEnqueueBarrierWithWaitList"); + return (*clEnqueueBarrierWithWaitList_ptr)(command_queue, num_events_in_wait_list, event_wait_list, event); +} + +static void * (*clGetExtensionFunctionAddressForPlatform_ptr)(cl_platform_id, const char *) = NULL; +void * CL_API_CALL clGetExtensionFunctionAddressForPlatform (cl_platform_id platform,const char * func_name) { + if(!clGetExtensionFunctionAddressForPlatform_ptr) clGetExtensionFunctionAddressForPlatform_ptr = getFunction("clGetExtensionFunctionAddressForPlatform"); + return (*clGetExtensionFunctionAddressForPlatform_ptr)(platform, func_name); +} + +static CL_EXT_PREFIX__VERSION_1_1_DEPRECATED cl_mem (*clCreateImage2D_ptr)(cl_context, cl_mem_flags, const cl_image_format *, size_t, size_t, size_t, void *, cl_int *) = NULL; +CL_EXT_PREFIX__VERSION_1_1_DEPRECATED cl_mem CL_API_CALL clCreateImage2D (cl_context context,cl_mem_flags flags,const cl_image_format * image_format,size_t image_width,size_t image_height,size_t image_row_pitch,void * host_ptr,cl_int * errcode_ret) { + if(!clCreateImage2D_ptr) clCreateImage2D_ptr = getFunction("clCreateImage2D"); + return (*clCreateImage2D_ptr)(context, flags, image_format, image_width, image_height, image_row_pitch, host_ptr, errcode_ret); +} + +static CL_EXT_PREFIX__VERSION_1_1_DEPRECATED cl_mem (*clCreateImage3D_ptr)(cl_context, cl_mem_flags, const cl_image_format *, size_t, size_t, size_t, size_t, size_t, void *, cl_int *) = NULL; +CL_EXT_PREFIX__VERSION_1_1_DEPRECATED cl_mem CL_API_CALL clCreateImage3D (cl_context context,cl_mem_flags flags,const cl_image_format * image_format,size_t image_width,size_t image_height,size_t image_depth,size_t image_row_pitch,size_t image_slice_pitch,void * host_ptr,cl_int * errcode_ret) { + if(!clCreateImage3D_ptr) clCreateImage3D_ptr = getFunction("clCreateImage3D"); + return (*clCreateImage3D_ptr)(context, flags, image_format, image_width, image_height, image_depth, image_row_pitch, image_slice_pitch, host_ptr, errcode_ret); +} + +static CL_EXT_PREFIX__VERSION_1_1_DEPRECATED cl_int (*clEnqueueMarker_ptr)(cl_command_queue, cl_event *) = NULL; +CL_EXT_PREFIX__VERSION_1_1_DEPRECATED cl_int CL_API_CALL clEnqueueMarker (cl_command_queue command_queue,cl_event * event) { if(!clEnqueueMarker_ptr) clEnqueueMarker_ptr = getFunction("clEnqueueMarker"); return (*clEnqueueMarker_ptr)(command_queue, event); } -static cl_int (CL_API_CALL *clEnqueueWaitForEvents_ptr)(cl_command_queue, cl_uint, const cl_event *) = NULL; -cl_int CL_API_CALL clEnqueueWaitForEvents (cl_command_queue command_queue,cl_uint num_events,const cl_event * event_list) { +static CL_EXT_PREFIX__VERSION_1_1_DEPRECATED cl_int (*clEnqueueWaitForEvents_ptr)(cl_command_queue, cl_uint, const cl_event *) = NULL; +CL_EXT_PREFIX__VERSION_1_1_DEPRECATED cl_int CL_API_CALL clEnqueueWaitForEvents (cl_command_queue command_queue,cl_uint num_events,const cl_event * event_list) { if(!clEnqueueWaitForEvents_ptr) clEnqueueWaitForEvents_ptr = getFunction("clEnqueueWaitForEvents"); return (*clEnqueueWaitForEvents_ptr)(command_queue, num_events, event_list); } -static cl_int (CL_API_CALL *clEnqueueBarrier_ptr)(cl_command_queue) = NULL; -cl_int CL_API_CALL clEnqueueBarrier (cl_command_queue command_queue) { +static CL_EXT_PREFIX__VERSION_1_1_DEPRECATED cl_int (*clEnqueueBarrier_ptr)(cl_command_queue) = NULL; +CL_EXT_PREFIX__VERSION_1_1_DEPRECATED cl_int CL_API_CALL clEnqueueBarrier (cl_command_queue command_queue) { if(!clEnqueueBarrier_ptr) clEnqueueBarrier_ptr = getFunction("clEnqueueBarrier"); return (*clEnqueueBarrier_ptr)(command_queue); } -static void * (CL_API_CALL *clGetExtensionFunctionAddress_ptr)(const char *) = NULL; -void * CL_API_CALL clGetExtensionFunctionAddress (const char * func_name) { +static CL_EXT_PREFIX__VERSION_1_1_DEPRECATED cl_int (*clUnloadCompiler_ptr)(void) = NULL; +CL_EXT_PREFIX__VERSION_1_1_DEPRECATED cl_int CL_API_CALL clUnloadCompiler (void) { + if(!clUnloadCompiler_ptr) clUnloadCompiler_ptr = getFunction("clUnloadCompiler"); + return (*clUnloadCompiler_ptr)(); +} + +static CL_EXT_PREFIX__VERSION_1_1_DEPRECATED void * (*clGetExtensionFunctionAddress_ptr)(const char *) = NULL; +CL_EXT_PREFIX__VERSION_1_1_DEPRECATED void * CL_API_CALL clGetExtensionFunctionAddress (const char * func_name) { if(!clGetExtensionFunctionAddress_ptr) clGetExtensionFunctionAddress_ptr = getFunction("clGetExtensionFunctionAddress"); return (*clGetExtensionFunctionAddress_ptr)(func_name); } diff --git a/Externals/CLRun/clrun/genclext.c b/Externals/CLRun/clrun/genclext.c new file mode 100644 index 0000000000..e6a73afabf --- /dev/null +++ b/Externals/CLRun/clrun/genclext.c @@ -0,0 +1,28 @@ +// Automatically generated by generateClRun.pl +#include "dynamiclib.h" +#include "../include/CL/cl_ext.h" + + +static cl_int (*clIcdGetPlatformIDsKHR_ptr)(cl_uint, cl_platform_id *, cl_uint *) = NULL; +cl_int CL_API_CALL clIcdGetPlatformIDsKHR (cl_uint num_entries,cl_platform_id * platforms,cl_uint * num_platforms) { + if(!clIcdGetPlatformIDsKHR_ptr) clIcdGetPlatformIDsKHR_ptr = getFunction("clIcdGetPlatformIDsKHR"); + return (*clIcdGetPlatformIDsKHR_ptr)(num_entries, platforms, num_platforms); +} +static cl_int (* clReleaseDeviceEXT_ptr)(cl_device_id) = NULL; +cl_int CL_API_CALL clReleaseDeviceEXT (cl_device_id device) { + if(! clReleaseDeviceEXT_ptr) clReleaseDeviceEXT_ptr = getFunction(" clReleaseDeviceEXT"); + return (* clReleaseDeviceEXT_ptr)(device); +} + +static cl_int (* clRetainDeviceEXT_ptr)(cl_device_id) = NULL; +cl_int CL_API_CALL clRetainDeviceEXT (cl_device_id device) { + if(! clRetainDeviceEXT_ptr) clRetainDeviceEXT_ptr = getFunction(" clRetainDeviceEXT"); + return (* clRetainDeviceEXT_ptr)(device); +} + +static cl_int (* clCreateSubDevicesEXT_ptr)(cl_device_id, const cl_device_partition_property_ext *, cl_uint, cl_device_id *, cl_uint *) = NULL; +cl_int CL_API_CALL clCreateSubDevicesEXT (cl_device_id in_device,const cl_device_partition_property_ext * properties,cl_uint num_entries,cl_device_id * out_devices,cl_uint * num_devices) { + if(! clCreateSubDevicesEXT_ptr) clCreateSubDevicesEXT_ptr = getFunction(" clCreateSubDevicesEXT"); + return (* clCreateSubDevicesEXT_ptr)(in_device, properties, num_entries, out_devices, num_devices); +} + diff --git a/Externals/CLRun/clrun/genclgl.c b/Externals/CLRun/clrun/genclgl.c index cc83a8a7ff..acb06a1ff7 100644 --- a/Externals/CLRun/clrun/genclgl.c +++ b/Externals/CLRun/clrun/genclgl.c @@ -3,55 +3,61 @@ #include "../include/CL/cl_gl.h" -static cl_mem (CL_API_CALL *clCreateFromGLBuffer_ptr)(cl_context, cl_mem_flags, cl_GLuint, int *) = NULL; +static cl_mem (*clCreateFromGLBuffer_ptr)(cl_context, cl_mem_flags, cl_GLuint, int *) = NULL; cl_mem CL_API_CALL clCreateFromGLBuffer (cl_context context,cl_mem_flags flags,cl_GLuint bufobj,int * errcode_ret) { if(!clCreateFromGLBuffer_ptr) clCreateFromGLBuffer_ptr = getFunction("clCreateFromGLBuffer"); - return (*clCreateFromGLBuffer_ptr)(context, flags, bufobj, errcode_ret ); + return (*clCreateFromGLBuffer_ptr)(context, flags, bufobj, errcode_ret); } -static cl_mem (CL_API_CALL *clCreateFromGLTexture2D_ptr)(cl_context, cl_mem_flags, cl_GLenum, cl_GLint, cl_GLuint, cl_int *) = NULL; -cl_mem CL_API_CALL clCreateFromGLTexture2D (cl_context context,cl_mem_flags flags,cl_GLenum target,cl_GLint miplevel,cl_GLuint texture,cl_int * errcode_ret) { - if(!clCreateFromGLTexture2D_ptr) clCreateFromGLTexture2D_ptr = getFunction("clCreateFromGLTexture2D"); - return (*clCreateFromGLTexture2D_ptr)(context, flags, target, miplevel, texture, errcode_ret); +static cl_mem (*clCreateFromGLTexture_ptr)(cl_context, cl_mem_flags, cl_GLenum, cl_GLint, cl_GLuint, cl_int *) = NULL; +cl_mem CL_API_CALL clCreateFromGLTexture (cl_context context,cl_mem_flags flags,cl_GLenum target,cl_GLint miplevel,cl_GLuint texture,cl_int * errcode_ret) { + if(!clCreateFromGLTexture_ptr) clCreateFromGLTexture_ptr = getFunction("clCreateFromGLTexture"); + return (*clCreateFromGLTexture_ptr)(context, flags, target, miplevel, texture, errcode_ret); } -static cl_mem (CL_API_CALL *clCreateFromGLTexture3D_ptr)(cl_context, cl_mem_flags, cl_GLenum, cl_GLint, cl_GLuint, cl_int *) = NULL; -cl_mem CL_API_CALL clCreateFromGLTexture3D (cl_context context,cl_mem_flags flags,cl_GLenum target,cl_GLint miplevel,cl_GLuint texture,cl_int * errcode_ret) { - if(!clCreateFromGLTexture3D_ptr) clCreateFromGLTexture3D_ptr = getFunction("clCreateFromGLTexture3D"); - return (*clCreateFromGLTexture3D_ptr)(context, flags, target, miplevel, texture, errcode_ret); -} - -static cl_mem (CL_API_CALL *clCreateFromGLRenderbuffer_ptr)(cl_context, cl_mem_flags, cl_GLuint, cl_int *) = NULL; +static cl_mem (*clCreateFromGLRenderbuffer_ptr)(cl_context, cl_mem_flags, cl_GLuint, cl_int *) = NULL; cl_mem CL_API_CALL clCreateFromGLRenderbuffer (cl_context context,cl_mem_flags flags,cl_GLuint renderbuffer,cl_int * errcode_ret) { if(!clCreateFromGLRenderbuffer_ptr) clCreateFromGLRenderbuffer_ptr = getFunction("clCreateFromGLRenderbuffer"); return (*clCreateFromGLRenderbuffer_ptr)(context, flags, renderbuffer, errcode_ret); } -static cl_int (CL_API_CALL *clGetGLObjectInfo_ptr)(cl_mem, cl_gl_object_type *, cl_GLuint *) = NULL; +static cl_int (*clGetGLObjectInfo_ptr)(cl_mem, cl_gl_object_type *, cl_GLuint *) = NULL; cl_int CL_API_CALL clGetGLObjectInfo (cl_mem memobj,cl_gl_object_type * gl_object_type,cl_GLuint * gl_object_name) { if(!clGetGLObjectInfo_ptr) clGetGLObjectInfo_ptr = getFunction("clGetGLObjectInfo"); return (*clGetGLObjectInfo_ptr)(memobj, gl_object_type, gl_object_name); } -static cl_int (CL_API_CALL *clGetGLTextureInfo_ptr)(cl_mem, cl_gl_texture_info, size_t, void *, size_t *) = NULL; +static cl_int (*clGetGLTextureInfo_ptr)(cl_mem, cl_gl_texture_info, size_t, void *, size_t *) = NULL; cl_int CL_API_CALL clGetGLTextureInfo (cl_mem memobj,cl_gl_texture_info param_name,size_t param_value_size,void * param_value,size_t * param_value_size_ret) { if(!clGetGLTextureInfo_ptr) clGetGLTextureInfo_ptr = getFunction("clGetGLTextureInfo"); return (*clGetGLTextureInfo_ptr)(memobj, param_name, param_value_size, param_value, param_value_size_ret); } -static cl_int (CL_API_CALL *clEnqueueAcquireGLObjects_ptr)(cl_command_queue, cl_uint, const cl_mem *, cl_uint, const cl_event *, cl_event *) = NULL; +static cl_int (*clEnqueueAcquireGLObjects_ptr)(cl_command_queue, cl_uint, const cl_mem *, cl_uint, const cl_event *, cl_event *) = NULL; cl_int CL_API_CALL clEnqueueAcquireGLObjects (cl_command_queue command_queue,cl_uint num_objects,const cl_mem * mem_objects,cl_uint num_events_in_wait_list,const cl_event * event_wait_list,cl_event * event) { if(!clEnqueueAcquireGLObjects_ptr) clEnqueueAcquireGLObjects_ptr = getFunction("clEnqueueAcquireGLObjects"); return (*clEnqueueAcquireGLObjects_ptr)(command_queue, num_objects, mem_objects, num_events_in_wait_list, event_wait_list, event); } -static cl_int (CL_API_CALL *clEnqueueReleaseGLObjects_ptr)(cl_command_queue, cl_uint, const cl_mem *, cl_uint, const cl_event *, cl_event *) = NULL; +static cl_int (*clEnqueueReleaseGLObjects_ptr)(cl_command_queue, cl_uint, const cl_mem *, cl_uint, const cl_event *, cl_event *) = NULL; cl_int CL_API_CALL clEnqueueReleaseGLObjects (cl_command_queue command_queue,cl_uint num_objects,const cl_mem * mem_objects,cl_uint num_events_in_wait_list,const cl_event * event_wait_list,cl_event * event) { if(!clEnqueueReleaseGLObjects_ptr) clEnqueueReleaseGLObjects_ptr = getFunction("clEnqueueReleaseGLObjects"); return (*clEnqueueReleaseGLObjects_ptr)(command_queue, num_objects, mem_objects, num_events_in_wait_list, event_wait_list, event); } -static cl_int (CL_API_CALL *clGetGLContextInfoKHR_ptr)(const cl_context_properties *, cl_gl_context_info, size_t, void *, size_t *) = NULL; +static CL_EXT_PREFIX__VERSION_1_1_DEPRECATED cl_mem (*clCreateFromGLTexture2D_ptr)(cl_context, cl_mem_flags, cl_GLenum, cl_GLint, cl_GLuint, cl_int *) = NULL; +CL_EXT_PREFIX__VERSION_1_1_DEPRECATED cl_mem CL_API_CALL clCreateFromGLTexture2D (cl_context context,cl_mem_flags flags,cl_GLenum target,cl_GLint miplevel,cl_GLuint texture,cl_int * errcode_ret) { + if(!clCreateFromGLTexture2D_ptr) clCreateFromGLTexture2D_ptr = getFunction("clCreateFromGLTexture2D"); + return (*clCreateFromGLTexture2D_ptr)(context, flags, target, miplevel, texture, errcode_ret); +} + +static CL_EXT_PREFIX__VERSION_1_1_DEPRECATED cl_mem (*clCreateFromGLTexture3D_ptr)(cl_context, cl_mem_flags, cl_GLenum, cl_GLint, cl_GLuint, cl_int *) = NULL; +CL_EXT_PREFIX__VERSION_1_1_DEPRECATED cl_mem CL_API_CALL clCreateFromGLTexture3D (cl_context context,cl_mem_flags flags,cl_GLenum target,cl_GLint miplevel,cl_GLuint texture,cl_int * errcode_ret) { + if(!clCreateFromGLTexture3D_ptr) clCreateFromGLTexture3D_ptr = getFunction("clCreateFromGLTexture3D"); + return (*clCreateFromGLTexture3D_ptr)(context, flags, target, miplevel, texture, errcode_ret); +} + +static cl_int (*clGetGLContextInfoKHR_ptr)(const cl_context_properties *, cl_gl_context_info, size_t, void *, size_t *) = NULL; cl_int CL_API_CALL clGetGLContextInfoKHR (const cl_context_properties * properties,cl_gl_context_info param_name,size_t param_value_size,void * param_value,size_t * param_value_size_ret) { if(!clGetGLContextInfoKHR_ptr) clGetGLContextInfoKHR_ptr = getFunction("clGetGLContextInfoKHR"); return (*clGetGLContextInfoKHR_ptr)(properties, param_name, param_value_size, param_value, param_value_size_ret); diff --git a/Externals/CLRun/clrun/genclglext.c b/Externals/CLRun/clrun/genclglext.c new file mode 100644 index 0000000000..333103ea85 --- /dev/null +++ b/Externals/CLRun/clrun/genclglext.c @@ -0,0 +1,11 @@ +// Automatically generated by generateClRun.pl +#include "dynamiclib.h" +#include "../include/CL/cl_gl_ext.h" + + +static cl_event (*clCreateEventFromGLsyncKHR_ptr)(cl_context, cl_GLsync, cl_int *) = NULL; +cl_event CL_API_CALL clCreateEventFromGLsyncKHR (cl_context context,cl_GLsync cl_GLsync,cl_int * errcode_ret) { + if(!clCreateEventFromGLsyncKHR_ptr) clCreateEventFromGLsyncKHR_ptr = getFunction("clCreateEventFromGLsyncKHR"); + return (*clCreateEventFromGLsyncKHR_ptr)(context, cl_GLsync, errcode_ret); +} + diff --git a/Externals/CLRun/clrun/generateClRun.pl b/Externals/CLRun/clrun/generateClRun.pl old mode 100644 new mode 100755 diff --git a/Externals/CLRun/include/CL/cl.h b/Externals/CLRun/include/CL/cl.h index 6e9a72c776..203c65974f 100644 --- a/Externals/CLRun/include/CL/cl.h +++ b/Externals/CLRun/include/CL/cl.h @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2008-2010 The Khronos Group Inc. + * Copyright (c) 2008 - 2012 The Khronos Group Inc. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and/or associated documentation files (the @@ -21,8 +21,6 @@ * MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS. ******************************************************************************/ -/* $Revision: 11707 $ on $Date: 2010-06-13 23:30:16 -0700 (Sun, 13 Jun 2010) $ */ - #ifndef __OPENCL_CL_H #define __OPENCL_CL_H @@ -53,14 +51,15 @@ typedef cl_ulong cl_bitfield; typedef cl_bitfield cl_device_type; typedef cl_uint cl_platform_info; typedef cl_uint cl_device_info; -typedef cl_bitfield cl_device_address_info; typedef cl_bitfield cl_device_fp_config; typedef cl_uint cl_device_mem_cache_type; typedef cl_uint cl_device_local_mem_type; typedef cl_bitfield cl_device_exec_capabilities; typedef cl_bitfield cl_command_queue_properties; +typedef intptr_t cl_device_partition_property; +typedef cl_bitfield cl_device_affinity_domain; -typedef intptr_t cl_context_properties; +typedef intptr_t cl_context_properties; typedef cl_uint cl_context_info; typedef cl_uint cl_command_queue_info; typedef cl_uint cl_channel_order; @@ -68,25 +67,50 @@ typedef cl_uint cl_channel_type; typedef cl_bitfield cl_mem_flags; typedef cl_uint cl_mem_object_type; typedef cl_uint cl_mem_info; +typedef cl_bitfield cl_mem_migration_flags; typedef cl_uint cl_image_info; +typedef cl_uint cl_buffer_create_type; typedef cl_uint cl_addressing_mode; typedef cl_uint cl_filter_mode; typedef cl_uint cl_sampler_info; typedef cl_bitfield cl_map_flags; typedef cl_uint cl_program_info; typedef cl_uint cl_program_build_info; +typedef cl_uint cl_program_binary_type; typedef cl_int cl_build_status; typedef cl_uint cl_kernel_info; +typedef cl_uint cl_kernel_arg_info; +typedef cl_uint cl_kernel_arg_address_qualifier; +typedef cl_uint cl_kernel_arg_access_qualifier; +typedef cl_bitfield cl_kernel_arg_type_qualifier; typedef cl_uint cl_kernel_work_group_info; typedef cl_uint cl_event_info; typedef cl_uint cl_command_type; typedef cl_uint cl_profiling_info; + typedef struct _cl_image_format { cl_channel_order image_channel_order; cl_channel_type image_channel_data_type; } cl_image_format; +typedef struct _cl_image_desc { + cl_mem_object_type image_type; + size_t image_width; + size_t image_height; + size_t image_depth; + size_t image_array_size; + size_t image_row_pitch; + size_t image_slice_pitch; + cl_uint num_mip_levels; + cl_uint num_samples; + cl_mem buffer; +} cl_image_desc; + +typedef struct _cl_buffer_region { + size_t origin; + size_t size; +} cl_buffer_region; /******************************************************************************/ @@ -105,6 +129,13 @@ typedef struct _cl_image_format { #define CL_IMAGE_FORMAT_NOT_SUPPORTED -10 #define CL_BUILD_PROGRAM_FAILURE -11 #define CL_MAP_FAILURE -12 +#define CL_MISALIGNED_SUB_BUFFER_OFFSET -13 +#define CL_EXEC_STATUS_ERROR_FOR_EVENTS_IN_WAIT_LIST -14 +#define CL_COMPILE_PROGRAM_FAILURE -15 +#define CL_LINKER_NOT_AVAILABLE -16 +#define CL_LINK_PROGRAM_FAILURE -17 +#define CL_DEVICE_PARTITION_FAILED -18 +#define CL_KERNEL_ARG_INFO_NOT_AVAILABLE -19 #define CL_INVALID_VALUE -30 #define CL_INVALID_DEVICE_TYPE -31 @@ -140,13 +171,22 @@ typedef struct _cl_image_format { #define CL_INVALID_BUFFER_SIZE -61 #define CL_INVALID_MIP_LEVEL -62 #define CL_INVALID_GLOBAL_WORK_SIZE -63 +#define CL_INVALID_PROPERTY -64 +#define CL_INVALID_IMAGE_DESCRIPTOR -65 +#define CL_INVALID_COMPILER_OPTIONS -66 +#define CL_INVALID_LINKER_OPTIONS -67 +#define CL_INVALID_DEVICE_PARTITION_COUNT -68 /* OpenCL Version */ #define CL_VERSION_1_0 1 +#define CL_VERSION_1_1 1 +#define CL_VERSION_1_2 1 /* cl_bool */ #define CL_FALSE 0 #define CL_TRUE 1 +#define CL_BLOCKING CL_TRUE +#define CL_NON_BLOCKING CL_FALSE /* cl_platform_info */ #define CL_PLATFORM_PROFILE 0x0900 @@ -160,6 +200,7 @@ typedef struct _cl_image_format { #define CL_DEVICE_TYPE_CPU (1 << 1) #define CL_DEVICE_TYPE_GPU (1 << 2) #define CL_DEVICE_TYPE_ACCELERATOR (1 << 3) +#define CL_DEVICE_TYPE_CUSTOM (1 << 4) #define CL_DEVICE_TYPE_ALL 0xFFFFFFFF /* cl_device_info */ @@ -213,8 +254,32 @@ typedef struct _cl_image_format { #define CL_DEVICE_VERSION 0x102F #define CL_DEVICE_EXTENSIONS 0x1030 #define CL_DEVICE_PLATFORM 0x1031 -/* 0x1032 reserved for CL_DEVICE_DOUBLE_FP_CONFIG */ +#define CL_DEVICE_DOUBLE_FP_CONFIG 0x1032 /* 0x1033 reserved for CL_DEVICE_HALF_FP_CONFIG */ +#define CL_DEVICE_PREFERRED_VECTOR_WIDTH_HALF 0x1034 +#define CL_DEVICE_HOST_UNIFIED_MEMORY 0x1035 +#define CL_DEVICE_NATIVE_VECTOR_WIDTH_CHAR 0x1036 +#define CL_DEVICE_NATIVE_VECTOR_WIDTH_SHORT 0x1037 +#define CL_DEVICE_NATIVE_VECTOR_WIDTH_INT 0x1038 +#define CL_DEVICE_NATIVE_VECTOR_WIDTH_LONG 0x1039 +#define CL_DEVICE_NATIVE_VECTOR_WIDTH_FLOAT 0x103A +#define CL_DEVICE_NATIVE_VECTOR_WIDTH_DOUBLE 0x103B +#define CL_DEVICE_NATIVE_VECTOR_WIDTH_HALF 0x103C +#define CL_DEVICE_OPENCL_C_VERSION 0x103D +#define CL_DEVICE_LINKER_AVAILABLE 0x103E +#define CL_DEVICE_BUILT_IN_KERNELS 0x103F +#define CL_DEVICE_IMAGE_MAX_BUFFER_SIZE 0x1040 +#define CL_DEVICE_IMAGE_MAX_ARRAY_SIZE 0x1041 +#define CL_DEVICE_PARENT_DEVICE 0x1042 +#define CL_DEVICE_PARTITION_MAX_SUB_DEVICES 0x1043 +#define CL_DEVICE_PARTITION_PROPERTIES 0x1044 +#define CL_DEVICE_PARTITION_AFFINITY_DOMAIN 0x1045 +#define CL_DEVICE_PARTITION_TYPE 0x1046 +#define CL_DEVICE_REFERENCE_COUNT 0x1047 +#define CL_DEVICE_PREFERRED_INTEROP_USER_SYNC 0x1048 +#define CL_DEVICE_PRINTF_BUFFER_SIZE 0x1049 +#define CL_DEVICE_IMAGE_PITCH_ALIGNMENT 0x104A +#define CL_DEVICE_IMAGE_BASE_ADDRESS_ALIGNMENT 0x104B /* cl_device_fp_config - bitfield */ #define CL_FP_DENORM (1 << 0) @@ -223,6 +288,8 @@ typedef struct _cl_image_format { #define CL_FP_ROUND_TO_ZERO (1 << 3) #define CL_FP_ROUND_TO_INF (1 << 4) #define CL_FP_FMA (1 << 5) +#define CL_FP_SOFT_FLOAT (1 << 6) +#define CL_FP_CORRECTLY_ROUNDED_DIVIDE_SQRT (1 << 7) /* cl_device_mem_cache_type */ #define CL_NONE 0x0 @@ -245,9 +312,25 @@ typedef struct _cl_image_format { #define CL_CONTEXT_REFERENCE_COUNT 0x1080 #define CL_CONTEXT_DEVICES 0x1081 #define CL_CONTEXT_PROPERTIES 0x1082 +#define CL_CONTEXT_NUM_DEVICES 0x1083 -/* cl_context_info + cl_context_properties */ +/* cl_context_properties */ #define CL_CONTEXT_PLATFORM 0x1084 +#define CL_CONTEXT_INTEROP_USER_SYNC 0x1085 + +/* cl_device_partition_property */ +#define CL_DEVICE_PARTITION_EQUALLY 0x1086 +#define CL_DEVICE_PARTITION_BY_COUNTS 0x1087 +#define CL_DEVICE_PARTITION_BY_COUNTS_LIST_END 0x0 +#define CL_DEVICE_PARTITION_BY_AFFINITY_DOMAIN 0x1088 + +/* cl_device_affinity_domain */ +#define CL_DEVICE_AFFINITY_DOMAIN_NUMA (1 << 0) +#define CL_DEVICE_AFFINITY_DOMAIN_L4_CACHE (1 << 1) +#define CL_DEVICE_AFFINITY_DOMAIN_L3_CACHE (1 << 2) +#define CL_DEVICE_AFFINITY_DOMAIN_L2_CACHE (1 << 3) +#define CL_DEVICE_AFFINITY_DOMAIN_L1_CACHE (1 << 4) +#define CL_DEVICE_AFFINITY_DOMAIN_NEXT_PARTITIONABLE (1 << 5) /* cl_command_queue_info */ #define CL_QUEUE_CONTEXT 0x1090 @@ -262,6 +345,14 @@ typedef struct _cl_image_format { #define CL_MEM_USE_HOST_PTR (1 << 3) #define CL_MEM_ALLOC_HOST_PTR (1 << 4) #define CL_MEM_COPY_HOST_PTR (1 << 5) +// reserved (1 << 6) +#define CL_MEM_HOST_WRITE_ONLY (1 << 7) +#define CL_MEM_HOST_READ_ONLY (1 << 8) +#define CL_MEM_HOST_NO_ACCESS (1 << 9) + +/* cl_mem_migration_flags - bitfield */ +#define CL_MIGRATE_MEM_OBJECT_HOST (1 << 0) +#define CL_MIGRATE_MEM_OBJECT_CONTENT_UNDEFINED (1 << 1) /* cl_channel_order */ #define CL_R 0x10B0 @@ -274,6 +365,11 @@ typedef struct _cl_image_format { #define CL_ARGB 0x10B7 #define CL_INTENSITY 0x10B8 #define CL_LUMINANCE 0x10B9 +#define CL_Rx 0x10BA +#define CL_RGx 0x10BB +#define CL_RGBx 0x10BC +#define CL_DEPTH 0x10BD +#define CL_DEPTH_STENCIL 0x10BE /* cl_channel_type */ #define CL_SNORM_INT8 0x10D0 @@ -291,11 +387,16 @@ typedef struct _cl_image_format { #define CL_UNSIGNED_INT32 0x10DC #define CL_HALF_FLOAT 0x10DD #define CL_FLOAT 0x10DE +#define CL_UNORM_INT24 0x10DF /* cl_mem_object_type */ #define CL_MEM_OBJECT_BUFFER 0x10F0 #define CL_MEM_OBJECT_IMAGE2D 0x10F1 #define CL_MEM_OBJECT_IMAGE3D 0x10F2 +#define CL_MEM_OBJECT_IMAGE2D_ARRAY 0x10F3 +#define CL_MEM_OBJECT_IMAGE1D 0x10F4 +#define CL_MEM_OBJECT_IMAGE1D_ARRAY 0x10F5 +#define CL_MEM_OBJECT_IMAGE1D_BUFFER 0x10F6 /* cl_mem_info */ #define CL_MEM_TYPE 0x1100 @@ -305,6 +406,8 @@ typedef struct _cl_image_format { #define CL_MEM_MAP_COUNT 0x1104 #define CL_MEM_REFERENCE_COUNT 0x1105 #define CL_MEM_CONTEXT 0x1106 +#define CL_MEM_ASSOCIATED_MEMOBJECT 0x1107 +#define CL_MEM_OFFSET 0x1108 /* cl_image_info */ #define CL_IMAGE_FORMAT 0x1110 @@ -314,12 +417,17 @@ typedef struct _cl_image_format { #define CL_IMAGE_WIDTH 0x1114 #define CL_IMAGE_HEIGHT 0x1115 #define CL_IMAGE_DEPTH 0x1116 +#define CL_IMAGE_ARRAY_SIZE 0x1117 +#define CL_IMAGE_BUFFER 0x1118 +#define CL_IMAGE_NUM_MIP_LEVELS 0x1119 +#define CL_IMAGE_NUM_SAMPLES 0x111A /* cl_addressing_mode */ #define CL_ADDRESS_NONE 0x1130 #define CL_ADDRESS_CLAMP_TO_EDGE 0x1131 #define CL_ADDRESS_CLAMP 0x1132 #define CL_ADDRESS_REPEAT 0x1133 +#define CL_ADDRESS_MIRRORED_REPEAT 0x1134 /* cl_filter_mode */ #define CL_FILTER_NEAREST 0x1140 @@ -335,6 +443,7 @@ typedef struct _cl_image_format { /* cl_map_flags - bitfield */ #define CL_MAP_READ (1 << 0) #define CL_MAP_WRITE (1 << 1) +#define CL_MAP_WRITE_INVALIDATE_REGION (1 << 2) /* cl_program_info */ #define CL_PROGRAM_REFERENCE_COUNT 0x1160 @@ -344,11 +453,20 @@ typedef struct _cl_image_format { #define CL_PROGRAM_SOURCE 0x1164 #define CL_PROGRAM_BINARY_SIZES 0x1165 #define CL_PROGRAM_BINARIES 0x1166 +#define CL_PROGRAM_NUM_KERNELS 0x1167 +#define CL_PROGRAM_KERNEL_NAMES 0x1168 /* cl_program_build_info */ #define CL_PROGRAM_BUILD_STATUS 0x1181 #define CL_PROGRAM_BUILD_OPTIONS 0x1182 #define CL_PROGRAM_BUILD_LOG 0x1183 +#define CL_PROGRAM_BINARY_TYPE 0x1184 + +/* cl_program_binary_type */ +#define CL_PROGRAM_BINARY_TYPE_NONE 0x0 +#define CL_PROGRAM_BINARY_TYPE_COMPILED_OBJECT 0x1 +#define CL_PROGRAM_BINARY_TYPE_LIBRARY 0x2 +#define CL_PROGRAM_BINARY_TYPE_EXECUTABLE 0x4 /* cl_build_status */ #define CL_BUILD_SUCCESS 0 @@ -362,17 +480,47 @@ typedef struct _cl_image_format { #define CL_KERNEL_REFERENCE_COUNT 0x1192 #define CL_KERNEL_CONTEXT 0x1193 #define CL_KERNEL_PROGRAM 0x1194 +#define CL_KERNEL_ATTRIBUTES 0x1195 + +/* cl_kernel_arg_info */ +#define CL_KERNEL_ARG_ADDRESS_QUALIFIER 0x1196 +#define CL_KERNEL_ARG_ACCESS_QUALIFIER 0x1197 +#define CL_KERNEL_ARG_TYPE_NAME 0x1198 +#define CL_KERNEL_ARG_TYPE_QUALIFIER 0x1199 +#define CL_KERNEL_ARG_NAME 0x119A + +/* cl_kernel_arg_address_qualifier */ +#define CL_KERNEL_ARG_ADDRESS_GLOBAL 0x119B +#define CL_KERNEL_ARG_ADDRESS_LOCAL 0x119C +#define CL_KERNEL_ARG_ADDRESS_CONSTANT 0x119D +#define CL_KERNEL_ARG_ADDRESS_PRIVATE 0x119E + +/* cl_kernel_arg_access_qualifier */ +#define CL_KERNEL_ARG_ACCESS_READ_ONLY 0x11A0 +#define CL_KERNEL_ARG_ACCESS_WRITE_ONLY 0x11A1 +#define CL_KERNEL_ARG_ACCESS_READ_WRITE 0x11A2 +#define CL_KERNEL_ARG_ACCESS_NONE 0x11A3 + +/* cl_kernel_arg_type_qualifer */ +#define CL_KERNEL_ARG_TYPE_NONE 0 +#define CL_KERNEL_ARG_TYPE_CONST (1 << 0) +#define CL_KERNEL_ARG_TYPE_RESTRICT (1 << 1) +#define CL_KERNEL_ARG_TYPE_VOLATILE (1 << 2) /* cl_kernel_work_group_info */ #define CL_KERNEL_WORK_GROUP_SIZE 0x11B0 #define CL_KERNEL_COMPILE_WORK_GROUP_SIZE 0x11B1 #define CL_KERNEL_LOCAL_MEM_SIZE 0x11B2 +#define CL_KERNEL_PREFERRED_WORK_GROUP_SIZE_MULTIPLE 0x11B3 +#define CL_KERNEL_PRIVATE_MEM_SIZE 0x11B4 +#define CL_KERNEL_GLOBAL_WORK_SIZE 0x11B5 /* cl_event_info */ #define CL_EVENT_COMMAND_QUEUE 0x11D0 #define CL_EVENT_COMMAND_TYPE 0x11D1 #define CL_EVENT_REFERENCE_COUNT 0x11D2 #define CL_EVENT_COMMAND_EXECUTION_STATUS 0x11D3 +#define CL_EVENT_CONTEXT 0x11D4 /* cl_command_type */ #define CL_COMMAND_NDRANGE_KERNEL 0x11F0 @@ -392,13 +540,24 @@ typedef struct _cl_image_format { #define CL_COMMAND_MARKER 0x11FE #define CL_COMMAND_ACQUIRE_GL_OBJECTS 0x11FF #define CL_COMMAND_RELEASE_GL_OBJECTS 0x1200 +#define CL_COMMAND_READ_BUFFER_RECT 0x1201 +#define CL_COMMAND_WRITE_BUFFER_RECT 0x1202 +#define CL_COMMAND_COPY_BUFFER_RECT 0x1203 +#define CL_COMMAND_USER 0x1204 +#define CL_COMMAND_BARRIER 0x1205 +#define CL_COMMAND_MIGRATE_MEM_OBJECTS 0x1206 +#define CL_COMMAND_FILL_BUFFER 0x1207 +#define CL_COMMAND_FILL_IMAGE 0x1208 /* command execution status */ #define CL_COMPLETE 0x0 #define CL_RUNNING 0x1 #define CL_SUBMITTED 0x2 #define CL_QUEUED 0x3 - + +/* cl_buffer_create_type */ +#define CL_BUFFER_CREATE_TYPE_REGION 0x1220 + /* cl_profiling_info */ #define CL_PROFILING_COMMAND_QUEUED 0x1280 #define CL_PROFILING_COMMAND_SUBMIT 0x1281 @@ -434,22 +593,35 @@ clGetDeviceInfo(cl_device_id /* device */, size_t /* param_value_size */, void * /* param_value */, size_t * /* param_value_size_ret */) CL_API_SUFFIX__VERSION_1_0; + +extern CL_API_ENTRY cl_int CL_API_CALL +clCreateSubDevices(cl_device_id /* in_device */, + const cl_device_partition_property * /* properties */, + cl_uint /* num_devices */, + cl_device_id * /* out_devices */, + cl_uint * /* num_devices_ret */) CL_API_SUFFIX__VERSION_1_2; +extern CL_API_ENTRY cl_int CL_API_CALL +clRetainDevice(cl_device_id /* device */) CL_API_SUFFIX__VERSION_1_2; + +extern CL_API_ENTRY cl_int CL_API_CALL +clReleaseDevice(cl_device_id /* device */) CL_API_SUFFIX__VERSION_1_2; + /* Context APIs */ extern CL_API_ENTRY cl_context CL_API_CALL clCreateContext(const cl_context_properties * /* properties */, - cl_uint /* num_devices */, - const cl_device_id * /* devices */, + cl_uint /* num_devices */, + const cl_device_id * /* devices */, void (CL_CALLBACK * /* pfn_notify */)(const char *, const void *, size_t, void *), - void * /* user_data */, - cl_int * /* errcode_ret */) CL_API_SUFFIX__VERSION_1_0; + void * /* user_data */, + cl_int * /* errcode_ret */) CL_API_SUFFIX__VERSION_1_0; extern CL_API_ENTRY cl_context CL_API_CALL clCreateContextFromType(const cl_context_properties * /* properties */, - cl_device_type /* device_type */, + cl_device_type /* device_type */, void (CL_CALLBACK * /* pfn_notify*/ )(const char *, const void *, size_t, void *), - void * /* user_data */, - cl_int * /* errcode_ret */) CL_API_SUFFIX__VERSION_1_0; + void * /* user_data */, + cl_int * /* errcode_ret */) CL_API_SUFFIX__VERSION_1_0; extern CL_API_ENTRY cl_int CL_API_CALL clRetainContext(cl_context /* context */) CL_API_SUFFIX__VERSION_1_0; @@ -484,13 +656,7 @@ clGetCommandQueueInfo(cl_command_queue /* command_queue */, void * /* param_value */, size_t * /* param_value_size_ret */) CL_API_SUFFIX__VERSION_1_0; -extern CL_API_ENTRY cl_int CL_API_CALL -clSetCommandQueueProperty(cl_command_queue /* command_queue */, - cl_command_queue_properties /* properties */, - cl_bool /* enable */, - cl_command_queue_properties * /* old_properties */) CL_API_SUFFIX__VERSION_1_0; - -/* Memory Object APIs */ +/* Memory Object APIs */ extern CL_API_ENTRY cl_mem CL_API_CALL clCreateBuffer(cl_context /* context */, cl_mem_flags /* flags */, @@ -499,26 +665,19 @@ clCreateBuffer(cl_context /* context */, cl_int * /* errcode_ret */) CL_API_SUFFIX__VERSION_1_0; extern CL_API_ENTRY cl_mem CL_API_CALL -clCreateImage2D(cl_context /* context */, - cl_mem_flags /* flags */, - const cl_image_format * /* image_format */, - size_t /* image_width */, - size_t /* image_height */, - size_t /* image_row_pitch */, - void * /* host_ptr */, - cl_int * /* errcode_ret */) CL_API_SUFFIX__VERSION_1_0; - +clCreateSubBuffer(cl_mem /* buffer */, + cl_mem_flags /* flags */, + cl_buffer_create_type /* buffer_create_type */, + const void * /* buffer_create_info */, + cl_int * /* errcode_ret */) CL_API_SUFFIX__VERSION_1_1; + extern CL_API_ENTRY cl_mem CL_API_CALL -clCreateImage3D(cl_context /* context */, - cl_mem_flags /* flags */, - const cl_image_format * /* image_format */, - size_t /* image_width */, - size_t /* image_height */, - size_t /* image_depth */, - size_t /* image_row_pitch */, - size_t /* image_slice_pitch */, - void * /* host_ptr */, - cl_int * /* errcode_ret */) CL_API_SUFFIX__VERSION_1_0; +clCreateImage(cl_context /* context */, + cl_mem_flags /* flags */, + const cl_image_format * /* image_format */, + const cl_image_desc * /* image_desc */, + void * /* host_ptr */, + cl_int * /* errcode_ret */) CL_API_SUFFIX__VERSION_1_2; extern CL_API_ENTRY cl_int CL_API_CALL clRetainMemObject(cl_mem /* memobj */) CL_API_SUFFIX__VERSION_1_0; @@ -548,7 +707,12 @@ clGetImageInfo(cl_mem /* image */, void * /* param_value */, size_t * /* param_value_size_ret */) CL_API_SUFFIX__VERSION_1_0; -/* Sampler APIs */ +extern CL_API_ENTRY cl_int CL_API_CALL +clSetMemObjectDestructorCallback( cl_mem /* memobj */, + void (CL_CALLBACK * /*pfn_notify*/)( cl_mem /* memobj */, void* /*user_data*/), + void * /*user_data */ ) CL_API_SUFFIX__VERSION_1_1; + +/* Sampler APIs */ extern CL_API_ENTRY cl_sampler CL_API_CALL clCreateSampler(cl_context /* context */, cl_bool /* normalized_coords */, @@ -586,6 +750,13 @@ clCreateProgramWithBinary(cl_context /* context */, cl_int * /* binary_status */, cl_int * /* errcode_ret */) CL_API_SUFFIX__VERSION_1_0; +extern CL_API_ENTRY cl_program CL_API_CALL +clCreateProgramWithBuiltInKernels(cl_context /* context */, + cl_uint /* num_devices */, + const cl_device_id * /* device_list */, + const char * /* kernel_names */, + cl_int * /* errcode_ret */) CL_API_SUFFIX__VERSION_1_2; + extern CL_API_ENTRY cl_int CL_API_CALL clRetainProgram(cl_program /* program */) CL_API_SUFFIX__VERSION_1_0; @@ -601,7 +772,30 @@ clBuildProgram(cl_program /* program */, void * /* user_data */) CL_API_SUFFIX__VERSION_1_0; extern CL_API_ENTRY cl_int CL_API_CALL -clUnloadCompiler(void) CL_API_SUFFIX__VERSION_1_0; +clCompileProgram(cl_program /* program */, + cl_uint /* num_devices */, + const cl_device_id * /* device_list */, + const char * /* options */, + cl_uint /* num_input_headers */, + const cl_program * /* input_headers */, + const char ** /* header_include_names */, + void (CL_CALLBACK * /* pfn_notify */)(cl_program /* program */, void * /* user_data */), + void * /* user_data */) CL_API_SUFFIX__VERSION_1_2; + +extern CL_API_ENTRY cl_program CL_API_CALL +clLinkProgram(cl_context /* context */, + cl_uint /* num_devices */, + const cl_device_id * /* device_list */, + const char * /* options */, + cl_uint /* num_input_programs */, + const cl_program * /* input_programs */, + void (CL_CALLBACK * /* pfn_notify */)(cl_program /* program */, void * /* user_data */), + void * /* user_data */, + cl_int * /* errcode_ret */ ) CL_API_SUFFIX__VERSION_1_2; + + +extern CL_API_ENTRY cl_int CL_API_CALL +clUnloadPlatformCompiler(cl_platform_id /* platform */) CL_API_SUFFIX__VERSION_1_2; extern CL_API_ENTRY cl_int CL_API_CALL clGetProgramInfo(cl_program /* program */, @@ -649,6 +843,14 @@ clGetKernelInfo(cl_kernel /* kernel */, void * /* param_value */, size_t * /* param_value_size_ret */) CL_API_SUFFIX__VERSION_1_0; +extern CL_API_ENTRY cl_int CL_API_CALL +clGetKernelArgInfo(cl_kernel /* kernel */, + cl_uint /* arg_indx */, + cl_kernel_arg_info /* param_name */, + size_t /* param_value_size */, + void * /* param_value */, + size_t * /* param_value_size_ret */) CL_API_SUFFIX__VERSION_1_2; + extern CL_API_ENTRY cl_int CL_API_CALL clGetKernelWorkGroupInfo(cl_kernel /* kernel */, cl_device_id /* device */, @@ -657,7 +859,7 @@ clGetKernelWorkGroupInfo(cl_kernel /* kernel */, void * /* param_value */, size_t * /* param_value_size_ret */) CL_API_SUFFIX__VERSION_1_0; -/* Event Object APIs */ +/* Event Object APIs */ extern CL_API_ENTRY cl_int CL_API_CALL clWaitForEvents(cl_uint /* num_events */, const cl_event * /* event_list */) CL_API_SUFFIX__VERSION_1_0; @@ -669,13 +871,27 @@ clGetEventInfo(cl_event /* event */, void * /* param_value */, size_t * /* param_value_size_ret */) CL_API_SUFFIX__VERSION_1_0; +extern CL_API_ENTRY cl_event CL_API_CALL +clCreateUserEvent(cl_context /* context */, + cl_int * /* errcode_ret */) CL_API_SUFFIX__VERSION_1_1; + extern CL_API_ENTRY cl_int CL_API_CALL clRetainEvent(cl_event /* event */) CL_API_SUFFIX__VERSION_1_0; extern CL_API_ENTRY cl_int CL_API_CALL clReleaseEvent(cl_event /* event */) CL_API_SUFFIX__VERSION_1_0; -/* Profiling APIs */ +extern CL_API_ENTRY cl_int CL_API_CALL +clSetUserEventStatus(cl_event /* event */, + cl_int /* execution_status */) CL_API_SUFFIX__VERSION_1_1; + +extern CL_API_ENTRY cl_int CL_API_CALL +clSetEventCallback( cl_event /* event */, + cl_int /* command_exec_callback_type */, + void (CL_CALLBACK * /* pfn_notify */)(cl_event, cl_int, void *), + void * /* user_data */) CL_API_SUFFIX__VERSION_1_1; + +/* Profiling APIs */ extern CL_API_ENTRY cl_int CL_API_CALL clGetEventProfilingInfo(cl_event /* event */, cl_profiling_info /* param_name */, @@ -696,34 +912,92 @@ clEnqueueReadBuffer(cl_command_queue /* command_queue */, cl_mem /* buffer */, cl_bool /* blocking_read */, size_t /* offset */, - size_t /* cb */, + size_t /* size */, void * /* ptr */, cl_uint /* num_events_in_wait_list */, const cl_event * /* event_wait_list */, cl_event * /* event */) CL_API_SUFFIX__VERSION_1_0; +extern CL_API_ENTRY cl_int CL_API_CALL +clEnqueueReadBufferRect(cl_command_queue /* command_queue */, + cl_mem /* buffer */, + cl_bool /* blocking_read */, + const size_t * /* buffer_offset */, + const size_t * /* host_offset */, + const size_t * /* region */, + size_t /* buffer_row_pitch */, + size_t /* buffer_slice_pitch */, + size_t /* host_row_pitch */, + size_t /* host_slice_pitch */, + void * /* ptr */, + cl_uint /* num_events_in_wait_list */, + const cl_event * /* event_wait_list */, + cl_event * /* event */) CL_API_SUFFIX__VERSION_1_1; + extern CL_API_ENTRY cl_int CL_API_CALL clEnqueueWriteBuffer(cl_command_queue /* command_queue */, cl_mem /* buffer */, cl_bool /* blocking_write */, size_t /* offset */, - size_t /* cb */, + size_t /* size */, const void * /* ptr */, cl_uint /* num_events_in_wait_list */, const cl_event * /* event_wait_list */, cl_event * /* event */) CL_API_SUFFIX__VERSION_1_0; +extern CL_API_ENTRY cl_int CL_API_CALL +clEnqueueWriteBufferRect(cl_command_queue /* command_queue */, + cl_mem /* buffer */, + cl_bool /* blocking_write */, + const size_t * /* buffer_offset */, + const size_t * /* host_offset */, + const size_t * /* region */, + size_t /* buffer_row_pitch */, + size_t /* buffer_slice_pitch */, + size_t /* host_row_pitch */, + size_t /* host_slice_pitch */, + const void * /* ptr */, + cl_uint /* num_events_in_wait_list */, + const cl_event * /* event_wait_list */, + cl_event * /* event */) CL_API_SUFFIX__VERSION_1_1; + +extern CL_API_ENTRY cl_int CL_API_CALL +clEnqueueFillBuffer(cl_command_queue /* command_queue */, + cl_mem /* buffer */, + const void * /* pattern */, + size_t /* pattern_size */, + size_t /* offset */, + size_t /* size */, + cl_uint /* num_events_in_wait_list */, + const cl_event * /* event_wait_list */, + cl_event * /* event */) CL_API_SUFFIX__VERSION_1_2; + extern CL_API_ENTRY cl_int CL_API_CALL clEnqueueCopyBuffer(cl_command_queue /* command_queue */, cl_mem /* src_buffer */, cl_mem /* dst_buffer */, size_t /* src_offset */, size_t /* dst_offset */, - size_t /* cb */, + size_t /* size */, cl_uint /* num_events_in_wait_list */, const cl_event * /* event_wait_list */, cl_event * /* event */) CL_API_SUFFIX__VERSION_1_0; +extern CL_API_ENTRY cl_int CL_API_CALL +clEnqueueCopyBufferRect(cl_command_queue /* command_queue */, + cl_mem /* src_buffer */, + cl_mem /* dst_buffer */, + const size_t * /* src_origin */, + const size_t * /* dst_origin */, + const size_t * /* region */, + size_t /* src_row_pitch */, + size_t /* src_slice_pitch */, + size_t /* dst_row_pitch */, + size_t /* dst_slice_pitch */, + cl_uint /* num_events_in_wait_list */, + const cl_event * /* event_wait_list */, + cl_event * /* event */) CL_API_SUFFIX__VERSION_1_1; + extern CL_API_ENTRY cl_int CL_API_CALL clEnqueueReadImage(cl_command_queue /* command_queue */, cl_mem /* image */, @@ -750,6 +1024,16 @@ clEnqueueWriteImage(cl_command_queue /* command_queue */, const cl_event * /* event_wait_list */, cl_event * /* event */) CL_API_SUFFIX__VERSION_1_0; +extern CL_API_ENTRY cl_int CL_API_CALL +clEnqueueFillImage(cl_command_queue /* command_queue */, + cl_mem /* image */, + const void * /* fill_color */, + const size_t * /* origin[3] */, + const size_t * /* region[3] */, + cl_uint /* num_events_in_wait_list */, + const cl_event * /* event_wait_list */, + cl_event * /* event */) CL_API_SUFFIX__VERSION_1_2; + extern CL_API_ENTRY cl_int CL_API_CALL clEnqueueCopyImage(cl_command_queue /* command_queue */, cl_mem /* src_image */, @@ -789,7 +1073,7 @@ clEnqueueMapBuffer(cl_command_queue /* command_queue */, cl_bool /* blocking_map */, cl_map_flags /* map_flags */, size_t /* offset */, - size_t /* cb */, + size_t /* size */, cl_uint /* num_events_in_wait_list */, const cl_event * /* event_wait_list */, cl_event * /* event */, @@ -817,6 +1101,15 @@ clEnqueueUnmapMemObject(cl_command_queue /* command_queue */, const cl_event * /* event_wait_list */, cl_event * /* event */) CL_API_SUFFIX__VERSION_1_0; +extern CL_API_ENTRY cl_int CL_API_CALL +clEnqueueMigrateMemObjects(cl_command_queue /* command_queue */, + cl_uint /* num_mem_objects */, + const cl_mem * /* mem_objects */, + cl_mem_migration_flags /* flags */, + cl_uint /* num_events_in_wait_list */, + const cl_event * /* event_wait_list */, + cl_event * /* event */) CL_API_SUFFIX__VERSION_1_2; + extern CL_API_ENTRY cl_int CL_API_CALL clEnqueueNDRangeKernel(cl_command_queue /* command_queue */, cl_kernel /* kernel */, @@ -837,7 +1130,7 @@ clEnqueueTask(cl_command_queue /* command_queue */, extern CL_API_ENTRY cl_int CL_API_CALL clEnqueueNativeKernel(cl_command_queue /* command_queue */, - void (*user_func)(void *), + void (CL_CALLBACK * /*user_func*/)(void *), void * /* args */, size_t /* cb_args */, cl_uint /* num_mem_objects */, @@ -848,16 +1141,17 @@ clEnqueueNativeKernel(cl_command_queue /* command_queue */, cl_event * /* event */) CL_API_SUFFIX__VERSION_1_0; extern CL_API_ENTRY cl_int CL_API_CALL -clEnqueueMarker(cl_command_queue /* command_queue */, - cl_event * /* event */) CL_API_SUFFIX__VERSION_1_0; +clEnqueueMarkerWithWaitList(cl_command_queue /* command_queue */, + cl_uint /* num_events_in_wait_list */, + const cl_event * /* event_wait_list */, + cl_event * /* event */) CL_API_SUFFIX__VERSION_1_2; extern CL_API_ENTRY cl_int CL_API_CALL -clEnqueueWaitForEvents(cl_command_queue /* command_queue */, - cl_uint /* num_events */, - const cl_event * /* event_list */) CL_API_SUFFIX__VERSION_1_0; +clEnqueueBarrierWithWaitList(cl_command_queue /* command_queue */, + cl_uint /* num_events_in_wait_list */, + const cl_event * /* event_wait_list */, + cl_event * /* event */) CL_API_SUFFIX__VERSION_1_2; -extern CL_API_ENTRY cl_int CL_API_CALL -clEnqueueBarrier(cl_command_queue /* command_queue */) CL_API_SUFFIX__VERSION_1_0; /* Extension function access * @@ -866,7 +1160,51 @@ clEnqueueBarrier(cl_command_queue /* command_queue */) CL_API_SUFFIX__VERSION_1_ * check to make sure the address is not NULL, before using or * calling the returned function address. */ -extern CL_API_ENTRY void * CL_API_CALL clGetExtensionFunctionAddress(const char * /* func_name */) CL_API_SUFFIX__VERSION_1_0; +extern CL_API_ENTRY void * CL_API_CALL +clGetExtensionFunctionAddressForPlatform(cl_platform_id /* platform */, + const char * /* func_name */) CL_API_SUFFIX__VERSION_1_2; + + +// Deprecated OpenCL 1.1 APIs +extern CL_API_ENTRY CL_EXT_PREFIX__VERSION_1_1_DEPRECATED cl_mem CL_API_CALL +clCreateImage2D(cl_context /* context */, + cl_mem_flags /* flags */, + const cl_image_format * /* image_format */, + size_t /* image_width */, + size_t /* image_height */, + size_t /* image_row_pitch */, + void * /* host_ptr */, + cl_int * /* errcode_ret */) CL_EXT_SUFFIX__VERSION_1_1_DEPRECATED; + +extern CL_API_ENTRY CL_EXT_PREFIX__VERSION_1_1_DEPRECATED cl_mem CL_API_CALL +clCreateImage3D(cl_context /* context */, + cl_mem_flags /* flags */, + const cl_image_format * /* image_format */, + size_t /* image_width */, + size_t /* image_height */, + size_t /* image_depth */, + size_t /* image_row_pitch */, + size_t /* image_slice_pitch */, + void * /* host_ptr */, + cl_int * /* errcode_ret */) CL_EXT_SUFFIX__VERSION_1_1_DEPRECATED; + +extern CL_API_ENTRY CL_EXT_PREFIX__VERSION_1_1_DEPRECATED cl_int CL_API_CALL +clEnqueueMarker(cl_command_queue /* command_queue */, + cl_event * /* event */) CL_EXT_SUFFIX__VERSION_1_1_DEPRECATED; + +extern CL_API_ENTRY CL_EXT_PREFIX__VERSION_1_1_DEPRECATED cl_int CL_API_CALL +clEnqueueWaitForEvents(cl_command_queue /* command_queue */, + cl_uint /* num_events */, + const cl_event * /* event_list */) CL_EXT_SUFFIX__VERSION_1_1_DEPRECATED; + +extern CL_API_ENTRY CL_EXT_PREFIX__VERSION_1_1_DEPRECATED cl_int CL_API_CALL +clEnqueueBarrier(cl_command_queue /* command_queue */) CL_EXT_SUFFIX__VERSION_1_1_DEPRECATED; + +extern CL_API_ENTRY CL_EXT_PREFIX__VERSION_1_1_DEPRECATED cl_int CL_API_CALL +clUnloadCompiler(void) CL_EXT_SUFFIX__VERSION_1_1_DEPRECATED; + +extern CL_API_ENTRY CL_EXT_PREFIX__VERSION_1_1_DEPRECATED void * CL_API_CALL +clGetExtensionFunctionAddress(const char * /* func_name */) CL_EXT_SUFFIX__VERSION_1_1_DEPRECATED; #ifdef __cplusplus } diff --git a/Externals/CLRun/include/CL/cl_d3d10.h b/Externals/CLRun/include/CL/cl_d3d10.h new file mode 100644 index 0000000000..81b0d37214 --- /dev/null +++ b/Externals/CLRun/include/CL/cl_d3d10.h @@ -0,0 +1,126 @@ +/********************************************************************************** + * Copyright (c) 2008-2012 The Khronos Group Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and/or associated documentation files (the + * "Materials"), to deal in the Materials without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Materials, and to + * permit persons to whom the Materials are furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Materials. + * + * THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS. + **********************************************************************************/ + +/* $Revision: 11708 $ on $Date: 2010-06-13 23:36:24 -0700 (Sun, 13 Jun 2010) $ */ + +#ifndef __OPENCL_CL_D3D10_H +#define __OPENCL_CL_D3D10_H + +#include +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/****************************************************************************** + * cl_khr_d3d10_sharing */ +#define cl_khr_d3d10_sharing 1 + +typedef cl_uint cl_d3d10_device_source_khr; +typedef cl_uint cl_d3d10_device_set_khr; + +/******************************************************************************/ + +// Error Codes +#define CL_INVALID_D3D10_DEVICE_KHR -1002 +#define CL_INVALID_D3D10_RESOURCE_KHR -1003 +#define CL_D3D10_RESOURCE_ALREADY_ACQUIRED_KHR -1004 +#define CL_D3D10_RESOURCE_NOT_ACQUIRED_KHR -1005 + +// cl_d3d10_device_source_nv +#define CL_D3D10_DEVICE_KHR 0x4010 +#define CL_D3D10_DXGI_ADAPTER_KHR 0x4011 + +// cl_d3d10_device_set_nv +#define CL_PREFERRED_DEVICES_FOR_D3D10_KHR 0x4012 +#define CL_ALL_DEVICES_FOR_D3D10_KHR 0x4013 + +// cl_context_info +#define CL_CONTEXT_D3D10_DEVICE_KHR 0x4014 +#define CL_CONTEXT_D3D10_PREFER_SHARED_RESOURCES_KHR 0x402C + +// cl_mem_info +#define CL_MEM_D3D10_RESOURCE_KHR 0x4015 + +// cl_image_info +#define CL_IMAGE_D3D10_SUBRESOURCE_KHR 0x4016 + +// cl_command_type +#define CL_COMMAND_ACQUIRE_D3D10_OBJECTS_KHR 0x4017 +#define CL_COMMAND_RELEASE_D3D10_OBJECTS_KHR 0x4018 + +/******************************************************************************/ + +typedef CL_API_ENTRY cl_int (CL_API_CALL *clGetDeviceIDsFromD3D10KHR_fn)( + cl_platform_id platform, + cl_d3d10_device_source_khr d3d_device_source, + void * d3d_object, + cl_d3d10_device_set_khr d3d_device_set, + cl_uint num_entries, + cl_device_id * devices, + cl_uint * num_devices) CL_API_SUFFIX__VERSION_1_0; + +typedef CL_API_ENTRY cl_mem (CL_API_CALL *clCreateFromD3D10BufferKHR_fn)( + cl_context context, + cl_mem_flags flags, + ID3D10Buffer * resource, + cl_int * errcode_ret) CL_API_SUFFIX__VERSION_1_0; + +typedef CL_API_ENTRY cl_mem (CL_API_CALL *clCreateFromD3D10Texture2DKHR_fn)( + cl_context context, + cl_mem_flags flags, + ID3D10Texture2D * resource, + UINT subresource, + cl_int * errcode_ret) CL_API_SUFFIX__VERSION_1_0; + +typedef CL_API_ENTRY cl_mem (CL_API_CALL *clCreateFromD3D10Texture3DKHR_fn)( + cl_context context, + cl_mem_flags flags, + ID3D10Texture3D * resource, + UINT subresource, + cl_int * errcode_ret) CL_API_SUFFIX__VERSION_1_0; + +typedef CL_API_ENTRY cl_int (CL_API_CALL *clEnqueueAcquireD3D10ObjectsKHR_fn)( + cl_command_queue command_queue, + cl_uint num_objects, + const cl_mem * mem_objects, + cl_uint num_events_in_wait_list, + const cl_event * event_wait_list, + cl_event * event) CL_API_SUFFIX__VERSION_1_0; + +typedef CL_API_ENTRY cl_int (CL_API_CALL *clEnqueueReleaseD3D10ObjectsKHR_fn)( + cl_command_queue command_queue, + cl_uint num_objects, + const cl_mem * mem_objects, + cl_uint num_events_in_wait_list, + const cl_event * event_wait_list, + cl_event * event) CL_API_SUFFIX__VERSION_1_0; + +#ifdef __cplusplus +} +#endif + +#endif // __OPENCL_CL_D3D10_H + diff --git a/Externals/CLRun/include/CL/cl_d3d11.h b/Externals/CLRun/include/CL/cl_d3d11.h new file mode 100644 index 0000000000..d3c8bdc2b1 --- /dev/null +++ b/Externals/CLRun/include/CL/cl_d3d11.h @@ -0,0 +1,126 @@ +/********************************************************************************** + * Copyright (c) 2008-2012 The Khronos Group Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and/or associated documentation files (the + * "Materials"), to deal in the Materials without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Materials, and to + * permit persons to whom the Materials are furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Materials. + * + * THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS. + **********************************************************************************/ + +/* $Revision: 11708 $ on $Date: 2010-06-13 23:36:24 -0700 (Sun, 13 Jun 2010) $ */ + +#ifndef __OPENCL_CL_D3D11_H +#define __OPENCL_CL_D3D11_H + +#include +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/****************************************************************************** + * cl_khr_d3d11_sharing */ +#define cl_khr_d3d11_sharing 1 + +typedef cl_uint cl_d3d11_device_source_khr; +typedef cl_uint cl_d3d11_device_set_khr; + +/******************************************************************************/ + +// Error Codes +#define CL_INVALID_D3D11_DEVICE_KHR -1006 +#define CL_INVALID_D3D11_RESOURCE_KHR -1007 +#define CL_D3D11_RESOURCE_ALREADY_ACQUIRED_KHR -1008 +#define CL_D3D11_RESOURCE_NOT_ACQUIRED_KHR -1009 + +// cl_d3d11_device_source +#define CL_D3D11_DEVICE_KHR 0x4019 +#define CL_D3D11_DXGI_ADAPTER_KHR 0x401A + +// cl_d3d11_device_set +#define CL_PREFERRED_DEVICES_FOR_D3D11_KHR 0x401B +#define CL_ALL_DEVICES_FOR_D3D11_KHR 0x401C + +// cl_context_info +#define CL_CONTEXT_D3D11_DEVICE_KHR 0x401D +#define CL_CONTEXT_D3D11_PREFER_SHARED_RESOURCES_KHR 0x402D + +// cl_mem_info +#define CL_MEM_D3D11_RESOURCE_KHR 0x401E + +// cl_image_info +#define CL_IMAGE_D3D11_SUBRESOURCE_KHR 0x401F + +// cl_command_type +#define CL_COMMAND_ACQUIRE_D3D11_OBJECTS_KHR 0x4020 +#define CL_COMMAND_RELEASE_D3D11_OBJECTS_KHR 0x4021 + +/******************************************************************************/ + +typedef CL_API_ENTRY cl_int (CL_API_CALL *clGetDeviceIDsFromD3D11KHR_fn)( + cl_platform_id platform, + cl_d3d11_device_source_khr d3d_device_source, + void * d3d_object, + cl_d3d11_device_set_khr d3d_device_set, + cl_uint num_entries, + cl_device_id * devices, + cl_uint * num_devices) CL_API_SUFFIX__VERSION_1_2; + +typedef CL_API_ENTRY cl_mem (CL_API_CALL *clCreateFromD3D11BufferKHR_fn)( + cl_context context, + cl_mem_flags flags, + ID3D11Buffer * resource, + cl_int * errcode_ret) CL_API_SUFFIX__VERSION_1_2; + +typedef CL_API_ENTRY cl_mem (CL_API_CALL *clCreateFromD3D11Texture2DKHR_fn)( + cl_context context, + cl_mem_flags flags, + ID3D11Texture2D * resource, + UINT subresource, + cl_int * errcode_ret) CL_API_SUFFIX__VERSION_1_2; + +typedef CL_API_ENTRY cl_mem (CL_API_CALL *clCreateFromD3D11Texture3DKHR_fn)( + cl_context context, + cl_mem_flags flags, + ID3D11Texture3D * resource, + UINT subresource, + cl_int * errcode_ret) CL_API_SUFFIX__VERSION_1_2; + +typedef CL_API_ENTRY cl_int (CL_API_CALL *clEnqueueAcquireD3D11ObjectsKHR_fn)( + cl_command_queue command_queue, + cl_uint num_objects, + const cl_mem * mem_objects, + cl_uint num_events_in_wait_list, + const cl_event * event_wait_list, + cl_event * event) CL_API_SUFFIX__VERSION_1_2; + +typedef CL_API_ENTRY cl_int (CL_API_CALL *clEnqueueReleaseD3D11ObjectsKHR_fn)( + cl_command_queue command_queue, + cl_uint num_objects, + const cl_mem * mem_objects, + cl_uint num_events_in_wait_list, + const cl_event * event_wait_list, + cl_event * event) CL_API_SUFFIX__VERSION_1_2; + +#ifdef __cplusplus +} +#endif + +#endif // __OPENCL_CL_D3D11_H + diff --git a/Externals/CLRun/include/CL/cl_dx9_media_sharing.h b/Externals/CLRun/include/CL/cl_dx9_media_sharing.h new file mode 100644 index 0000000000..1ef543a5af --- /dev/null +++ b/Externals/CLRun/include/CL/cl_dx9_media_sharing.h @@ -0,0 +1,127 @@ +/********************************************************************************** + * Copyright (c) 2008-2012 The Khronos Group Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and/or associated documentation files (the + * "Materials"), to deal in the Materials without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Materials, and to + * permit persons to whom the Materials are furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Materials. + * + * THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS. + **********************************************************************************/ + +/* $Revision: 11708 $ on $Date: 2010-06-13 23:36:24 -0700 (Sun, 13 Jun 2010) $ */ + +#ifndef __OPENCL_CL_DX9_MEDIA_SHARING_H +#define __OPENCL_CL_DX9_MEDIA_SHARING_H + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/****************************************************************************** +/* cl_khr_dx9_media_sharing */ +#define cl_khr_dx9_media_sharing 1 + +typedef cl_uint cl_dx9_media_adapter_type_khr; +typedef cl_uint cl_dx9_media_adapter_set_khr; + +#if defined(_WIN32) +#include +typedef struct _cl_dx9_surface_info_khr +{ + IDirect3DSurface9 *resource; + HANDLE shared_handle; +} cl_dx9_surface_info_khr; +#endif + + +/******************************************************************************/ + +// Error Codes +#define CL_INVALID_DX9_MEDIA_ADAPTER_KHR -1010 +#define CL_INVALID_DX9_MEDIA_SURFACE_KHR -1011 +#define CL_DX9_MEDIA_SURFACE_ALREADY_ACQUIRED_KHR -1012 +#define CL_DX9_MEDIA_SURFACE_NOT_ACQUIRED_KHR -1013 + +// cl_media_adapter_type_khr +#define CL_ADAPTER_D3D9_KHR 0x2020 +#define CL_ADAPTER_D3D9EX_KHR 0x2021 +#define CL_ADAPTER_DXVA_KHR 0x2022 + +// cl_media_adapter_set_khr +#define CL_PREFERRED_DEVICES_FOR_DX9_MEDIA_ADAPTER_KHR 0x2023 +#define CL_ALL_DEVICES_FOR_DX9_MEDIA_ADAPTER_KHR 0x2024 + +// cl_context_info +#define CL_CONTEXT_ADAPTER_D3D9_KHR 0x2025 +#define CL_CONTEXT_ADAPTER_D3D9EX_KHR 0x2026 +#define CL_CONTEXT_ADAPTER_DXVA_KHR 0x2027 + +// cl_mem_info +#define CL_MEM_DX9_MEDIA_ADAPTER_TYPE_KHR 0x2028 +#define CL_MEM_DX9_MEDIA_SURFACE_INFO_KHR 0x2029 + +// cl_image_info +#define CL_IMAGE_DX9_MEDIA_PLANE_KHR 0x202A + +// cl_command_type +#define CL_COMMAND_ACQUIRE_DX9_MEDIA_SURFACES_KHR 0x202B +#define CL_COMMAND_RELEASE_DX9_MEDIA_SURFACES_KHR 0x202C + +/******************************************************************************/ + +typedef CL_API_ENTRY cl_int (CL_API_CALL *clGetDeviceIDsFromDX9MediaAdapterKHR_fn)( + cl_platform_id platform, + cl_uint num_media_adapters, + cl_dx9_media_adapter_type_khr * media_adapter_type, + void * media_adapters, + cl_dx9_media_adapter_set_khr media_adapter_set, + cl_uint num_entries, + cl_device_id * devices, + cl_uint * num_devices) CL_API_SUFFIX__VERSION_1_2; + +typedef CL_API_ENTRY cl_mem (CL_API_CALL *clCreateFromDX9MediaSurfaceKHR_fn)( + cl_context context, + cl_mem_flags flags, + cl_dx9_media_adapter_type_khr adapter_type, + void * surface_info, + cl_uint plane, + cl_int * errcode_ret) CL_API_SUFFIX__VERSION_1_2; + +typedef CL_API_ENTRY cl_int (CL_API_CALL *clEnqueueAcquireDX9MediaSurfacesKHR_fn)( + cl_command_queue command_queue, + cl_uint num_objects, + const cl_mem * mem_objects, + cl_uint num_events_in_wait_list, + const cl_event * event_wait_list, + cl_event * event) CL_API_SUFFIX__VERSION_1_2; + +typedef CL_API_ENTRY cl_int (CL_API_CALL *clEnqueueReleaseDX9MediaSurfacesKHR_fn)( + cl_command_queue command_queue, + cl_uint num_objects, + const cl_mem * mem_objects, + cl_uint num_events_in_wait_list, + const cl_event * event_wait_list, + cl_event * event) CL_API_SUFFIX__VERSION_1_2; + +#ifdef __cplusplus +} +#endif + +#endif // __OPENCL_CL_DX9_MEDIA_SHARING_H + diff --git a/Externals/CLRun/include/CL/cl_ext.h b/Externals/CLRun/include/CL/cl_ext.h new file mode 100644 index 0000000000..632cb216b3 --- /dev/null +++ b/Externals/CLRun/include/CL/cl_ext.h @@ -0,0 +1,251 @@ +/******************************************************************************* + * Copyright (c) 2008 - 2012 The Khronos Group Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and/or associated documentation files (the + * "Materials"), to deal in the Materials without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Materials, and to + * permit persons to whom the Materials are furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Materials. + * + * THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS. + ******************************************************************************/ + +/* $Revision: 11928 $ on $Date: 2010-07-13 09:04:56 -0700 (Tue, 13 Jul 2010) $ */ + +/* cl_ext.h contains OpenCL extensions which don't have external */ +/* (OpenGL, D3D) dependencies. */ + +#ifndef __CL_EXT_H +#define __CL_EXT_H + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef __APPLE__ + #include + #include +#else + #include +#endif + +/* cl_khr_fp16 extension - no extension #define since it has no functions */ +#define CL_DEVICE_HALF_FP_CONFIG 0x1033 + +/* Memory object destruction + * + * Apple extension for use to manage externally allocated buffers used with cl_mem objects with CL_MEM_USE_HOST_PTR + * + * Registers a user callback function that will be called when the memory object is deleted and its resources + * freed. Each call to clSetMemObjectCallbackFn registers the specified user callback function on a callback + * stack associated with memobj. The registered user callback functions are called in the reverse order in + * which they were registered. The user callback functions are called and then the memory object is deleted + * and its resources freed. This provides a mechanism for the application (and libraries) using memobj to be + * notified when the memory referenced by host_ptr, specified when the memory object is created and used as + * the storage bits for the memory object, can be reused or freed. + * + * The application may not call CL api's with the cl_mem object passed to the pfn_notify. + * + * Please check for the "cl_APPLE_SetMemObjectDestructor" extension using clGetDeviceInfo(CL_DEVICE_EXTENSIONS) + * before using. + */ +#define cl_APPLE_SetMemObjectDestructor 1 +cl_int CL_API_ENTRY clSetMemObjectDestructorAPPLE( cl_mem /* memobj */, + void (* /*pfn_notify*/)( cl_mem /* memobj */, void* /*user_data*/), + void * /*user_data */ ) CL_EXT_SUFFIX__VERSION_1_0; + + +/* Context Logging Functions + * + * The next three convenience functions are intended to be used as the pfn_notify parameter to clCreateContext(). + * Please check for the "cl_APPLE_ContextLoggingFunctions" extension using clGetDeviceInfo(CL_DEVICE_EXTENSIONS) + * before using. + * + * clLogMessagesToSystemLog fowards on all log messages to the Apple System Logger + */ +#define cl_APPLE_ContextLoggingFunctions 1 +extern void CL_API_ENTRY clLogMessagesToSystemLogAPPLE( const char * /* errstr */, + const void * /* private_info */, + size_t /* cb */, + void * /* user_data */ ) CL_EXT_SUFFIX__VERSION_1_0; + +/* clLogMessagesToStdout sends all log messages to the file descriptor stdout */ +extern void CL_API_ENTRY clLogMessagesToStdoutAPPLE( const char * /* errstr */, + const void * /* private_info */, + size_t /* cb */, + void * /* user_data */ ) CL_EXT_SUFFIX__VERSION_1_0; + +/* clLogMessagesToStderr sends all log messages to the file descriptor stderr */ +extern void CL_API_ENTRY clLogMessagesToStderrAPPLE( const char * /* errstr */, + const void * /* private_info */, + size_t /* cb */, + void * /* user_data */ ) CL_EXT_SUFFIX__VERSION_1_0; + + +/************************ +* cl_khr_icd extension * +************************/ +#define cl_khr_icd 1 + +/* cl_platform_info */ +#define CL_PLATFORM_ICD_SUFFIX_KHR 0x0920 + +/* Additional Error Codes */ +#define CL_PLATFORM_NOT_FOUND_KHR -1001 + +extern CL_API_ENTRY cl_int CL_API_CALL +clIcdGetPlatformIDsKHR(cl_uint /* num_entries */, + cl_platform_id * /* platforms */, + cl_uint * /* num_platforms */); + +typedef CL_API_ENTRY cl_int (CL_API_CALL *clIcdGetPlatformIDsKHR_fn)( + cl_uint /* num_entries */, + cl_platform_id * /* platforms */, + cl_uint * /* num_platforms */); + + +/* Extension: cl_khr_image2D_buffer + * + * This extension allows a 2D image to be created from a cl_mem buffer without a copy. + * The type associated with a 2D image created from a buffer in an OpenCL program is image2d_t. + * Both the sampler and sampler-less read_image built-in functions are supported for 2D images + * and 2D images created from a buffer. Similarly, the write_image built-ins are also supported + * for 2D images created from a buffer. + * + * When the 2D image from buffer is created, the client must specify the width, + * height, image format (i.e. channel order and channel data type) and optionally the row pitch + * + * The pitch specified must be a multiple of CL_DEVICE_IMAGE_PITCH_ALIGNMENT pixels. + * The base address of the buffer must be aligned to CL_DEVICE_IMAGE_BASE_ADDRESS_ALIGNMENT pixels. + */ + +/************************************* + * cl_khr_initalize_memory extension * + *************************************/ + +#define CL_CONTEXT_MEMORY_INITIALIZE_KHR 0x200E + + +/************************************** + * cl_khr_terminate_context extension * + **************************************/ + +#define CL_DEVICE_TERMINATE_CAPABILITY_KHR 0x200F +#define CL_CONTEXT_TERMINATE_KHR 0x2010 + +#define cl_khr_terminate_context 1 +extern CL_API_ENTRY cl_int CL_API_CALL clTerminateContextKHR(cl_context /* context */) CL_EXT_SUFFIX__VERSION_1_2; + +typedef CL_API_ENTRY cl_int (CL_API_CALL *clTerminateContextKHR_fn)(cl_context /* context */) CL_EXT_SUFFIX__VERSION_1_2; + + +/* + * Extension: cl_khr_spir + * + * This extension adds support to create an OpenCL program object from a + * Standard Portable Intermediate Representation (SPIR) instance + */ + +/****************************************** +* cl_nv_device_attribute_query extension * +******************************************/ +/* cl_nv_device_attribute_query extension - no extension #define since it has no functions */ +#define CL_DEVICE_COMPUTE_CAPABILITY_MAJOR_NV 0x4000 +#define CL_DEVICE_COMPUTE_CAPABILITY_MINOR_NV 0x4001 +#define CL_DEVICE_REGISTERS_PER_BLOCK_NV 0x4002 +#define CL_DEVICE_WARP_SIZE_NV 0x4003 +#define CL_DEVICE_GPU_OVERLAP_NV 0x4004 +#define CL_DEVICE_KERNEL_EXEC_TIMEOUT_NV 0x4005 +#define CL_DEVICE_INTEGRATED_MEMORY_NV 0x4006 + + +/********************************* +* cl_amd_device_attribute_query * +*********************************/ +#define CL_DEVICE_PROFILING_TIMER_OFFSET_AMD 0x4036 + +#ifdef CL_VERSION_1_1 + /*********************************** + * cl_ext_device_fission extension * + ***********************************/ + #define cl_ext_device_fission 1 + + extern CL_API_ENTRY cl_int CL_API_CALL + clReleaseDeviceEXT( cl_device_id /*device*/ ) CL_EXT_SUFFIX__VERSION_1_1; + + typedef CL_API_ENTRY cl_int + (CL_API_CALL *clReleaseDeviceEXT_fn)( cl_device_id /*device*/ ) CL_EXT_SUFFIX__VERSION_1_1; + + extern CL_API_ENTRY cl_int CL_API_CALL + clRetainDeviceEXT( cl_device_id /*device*/ ) CL_EXT_SUFFIX__VERSION_1_1; + + typedef CL_API_ENTRY cl_int + (CL_API_CALL *clRetainDeviceEXT_fn)( cl_device_id /*device*/ ) CL_EXT_SUFFIX__VERSION_1_1; + + typedef cl_ulong cl_device_partition_property_ext; + extern CL_API_ENTRY cl_int CL_API_CALL + clCreateSubDevicesEXT( cl_device_id /*in_device*/, + const cl_device_partition_property_ext * /* properties */, + cl_uint /*num_entries*/, + cl_device_id * /*out_devices*/, + cl_uint * /*num_devices*/ ) CL_EXT_SUFFIX__VERSION_1_1; + + typedef CL_API_ENTRY cl_int + ( CL_API_CALL * clCreateSubDevicesEXT_fn)( cl_device_id /*in_device*/, + const cl_device_partition_property_ext * /* properties */, + cl_uint /*num_entries*/, + cl_device_id * /*out_devices*/, + cl_uint * /*num_devices*/ ) CL_EXT_SUFFIX__VERSION_1_1; + + /* cl_device_partition_property_ext */ + #define CL_DEVICE_PARTITION_EQUALLY_EXT 0x4050 + #define CL_DEVICE_PARTITION_BY_COUNTS_EXT 0x4051 + #define CL_DEVICE_PARTITION_BY_NAMES_EXT 0x4052 + #define CL_DEVICE_PARTITION_BY_AFFINITY_DOMAIN_EXT 0x4053 + + /* clDeviceGetInfo selectors */ + #define CL_DEVICE_PARENT_DEVICE_EXT 0x4054 + #define CL_DEVICE_PARTITION_TYPES_EXT 0x4055 + #define CL_DEVICE_AFFINITY_DOMAINS_EXT 0x4056 + #define CL_DEVICE_REFERENCE_COUNT_EXT 0x4057 + #define CL_DEVICE_PARTITION_STYLE_EXT 0x4058 + + /* error codes */ + #define CL_DEVICE_PARTITION_FAILED_EXT -1057 + #define CL_INVALID_PARTITION_COUNT_EXT -1058 + #define CL_INVALID_PARTITION_NAME_EXT -1059 + + /* CL_AFFINITY_DOMAINs */ + #define CL_AFFINITY_DOMAIN_L1_CACHE_EXT 0x1 + #define CL_AFFINITY_DOMAIN_L2_CACHE_EXT 0x2 + #define CL_AFFINITY_DOMAIN_L3_CACHE_EXT 0x3 + #define CL_AFFINITY_DOMAIN_L4_CACHE_EXT 0x4 + #define CL_AFFINITY_DOMAIN_NUMA_EXT 0x10 + #define CL_AFFINITY_DOMAIN_NEXT_FISSIONABLE_EXT 0x100 + + /* cl_device_partition_property_ext list terminators */ + #define CL_PROPERTIES_LIST_END_EXT ((cl_device_partition_property_ext) 0) + #define CL_PARTITION_BY_COUNTS_LIST_END_EXT ((cl_device_partition_property_ext) 0) + #define CL_PARTITION_BY_NAMES_LIST_END_EXT ((cl_device_partition_property_ext) 0 - 1) + + + +#endif /* CL_VERSION_1_1 */ + +#ifdef __cplusplus +} +#endif + + +#endif /* __CL_EXT_H */ diff --git a/Externals/CLRun/include/CL/cl_gl.h b/Externals/CLRun/include/CL/cl_gl.h index fcaa5bd392..af2036cc99 100644 --- a/Externals/CLRun/include/CL/cl_gl.h +++ b/Externals/CLRun/include/CL/cl_gl.h @@ -1,5 +1,5 @@ /********************************************************************************** - * Copyright (c) 2008-2010 The Khronos Group Inc. + * Copyright (c) 2008 - 2012 The Khronos Group Inc. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and/or associated documentation files (the @@ -21,14 +21,6 @@ * MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS. **********************************************************************************/ -/* $Revision: 11707 $ on $Date: 2010-06-13 23:30:16 -0700 (Sun, 13 Jun 2010) $ */ - -/* - * cl_gl.h contains Khronos-approved (KHR) OpenCL extensions which have - * OpenGL dependencies. The application is responsible for #including - * OpenGL or OpenGL ES headers before #including cl_gl.h. - */ - #ifndef __OPENCL_CL_GL_H #define __OPENCL_CL_GL_H @@ -36,7 +28,7 @@ #include #else #include -#endif +#endif #ifdef __cplusplus extern "C" { @@ -45,16 +37,23 @@ extern "C" { typedef cl_uint cl_gl_object_type; typedef cl_uint cl_gl_texture_info; typedef cl_uint cl_gl_platform_info; +typedef struct __GLsync *cl_GLsync; -/* cl_gl_object_type */ -#define CL_GL_OBJECT_BUFFER 0x2000 -#define CL_GL_OBJECT_TEXTURE2D 0x2001 -#define CL_GL_OBJECT_TEXTURE3D 0x2002 -#define CL_GL_OBJECT_RENDERBUFFER 0x2003 +/* cl_gl_object_type = 0x2000 - 0x200F enum values are currently taken */ +#define CL_GL_OBJECT_BUFFER 0x2000 +#define CL_GL_OBJECT_TEXTURE2D 0x2001 +#define CL_GL_OBJECT_TEXTURE3D 0x2002 +#define CL_GL_OBJECT_RENDERBUFFER 0x2003 +#define CL_GL_OBJECT_TEXTURE2D_ARRAY 0x200E +#define CL_GL_OBJECT_TEXTURE1D 0x200F +#define CL_GL_OBJECT_TEXTURE1D_ARRAY 0x2010 +#define CL_GL_OBJECT_TEXTURE_BUFFER 0x2011 + +/* cl_gl_texture_info */ +#define CL_GL_TEXTURE_TARGET 0x2004 +#define CL_GL_MIPMAP_LEVEL 0x2005 +#define CL_GL_NUM_SAMPLES 0x2012 -/* cl_gl_texture_info */ -#define CL_GL_TEXTURE_TARGET 0x2004 -#define CL_GL_MIPMAP_LEVEL 0x2005 extern CL_API_ENTRY cl_mem CL_API_CALL clCreateFromGLBuffer(cl_context /* context */, @@ -63,21 +62,13 @@ clCreateFromGLBuffer(cl_context /* context */, int * /* errcode_ret */) CL_API_SUFFIX__VERSION_1_0; extern CL_API_ENTRY cl_mem CL_API_CALL -clCreateFromGLTexture2D(cl_context /* context */, - cl_mem_flags /* flags */, - cl_GLenum /* target */, - cl_GLint /* miplevel */, - cl_GLuint /* texture */, - cl_int * /* errcode_ret */) CL_API_SUFFIX__VERSION_1_0; - -extern CL_API_ENTRY cl_mem CL_API_CALL -clCreateFromGLTexture3D(cl_context /* context */, - cl_mem_flags /* flags */, - cl_GLenum /* target */, - cl_GLint /* miplevel */, - cl_GLuint /* texture */, - cl_int * /* errcode_ret */) CL_API_SUFFIX__VERSION_1_0; - +clCreateFromGLTexture(cl_context /* context */, + cl_mem_flags /* flags */, + cl_GLenum /* target */, + cl_GLint /* miplevel */, + cl_GLuint /* texture */, + cl_int * /* errcode_ret */) CL_API_SUFFIX__VERSION_1_2; + extern CL_API_ENTRY cl_mem CL_API_CALL clCreateFromGLRenderbuffer(cl_context /* context */, cl_mem_flags /* flags */, @@ -87,8 +78,8 @@ clCreateFromGLRenderbuffer(cl_context /* context */, extern CL_API_ENTRY cl_int CL_API_CALL clGetGLObjectInfo(cl_mem /* memobj */, cl_gl_object_type * /* gl_object_type */, - cl_GLuint * /* gl_object_name */) CL_API_SUFFIX__VERSION_1_0; - + cl_GLuint * /* gl_object_name */) CL_API_SUFFIX__VERSION_1_0; + extern CL_API_ENTRY cl_int CL_API_CALL clGetGLTextureInfo(cl_mem /* memobj */, cl_gl_texture_info /* param_name */, @@ -112,33 +103,51 @@ clEnqueueReleaseGLObjects(cl_command_queue /* command_queue */, const cl_event * /* event_wait_list */, cl_event * /* event */) CL_API_SUFFIX__VERSION_1_0; + +// Deprecated OpenCL 1.1 APIs +extern CL_API_ENTRY CL_EXT_PREFIX__VERSION_1_1_DEPRECATED cl_mem CL_API_CALL +clCreateFromGLTexture2D(cl_context /* context */, + cl_mem_flags /* flags */, + cl_GLenum /* target */, + cl_GLint /* miplevel */, + cl_GLuint /* texture */, + cl_int * /* errcode_ret */) CL_EXT_SUFFIX__VERSION_1_1_DEPRECATED; + +extern CL_API_ENTRY CL_EXT_PREFIX__VERSION_1_1_DEPRECATED cl_mem CL_API_CALL +clCreateFromGLTexture3D(cl_context /* context */, + cl_mem_flags /* flags */, + cl_GLenum /* target */, + cl_GLint /* miplevel */, + cl_GLuint /* texture */, + cl_int * /* errcode_ret */) CL_EXT_SUFFIX__VERSION_1_1_DEPRECATED; + /* cl_khr_gl_sharing extension */ - + #define cl_khr_gl_sharing 1 - + typedef cl_uint cl_gl_context_info; - + /* Additional Error Codes */ #define CL_INVALID_GL_SHAREGROUP_REFERENCE_KHR -1000 - + /* cl_gl_context_info */ #define CL_CURRENT_DEVICE_FOR_GL_CONTEXT_KHR 0x2006 #define CL_DEVICES_FOR_GL_CONTEXT_KHR 0x2007 - + /* Additional cl_context_properties */ #define CL_GL_CONTEXT_KHR 0x2008 #define CL_EGL_DISPLAY_KHR 0x2009 #define CL_GLX_DISPLAY_KHR 0x200A #define CL_WGL_HDC_KHR 0x200B #define CL_CGL_SHAREGROUP_KHR 0x200C - + extern CL_API_ENTRY cl_int CL_API_CALL clGetGLContextInfoKHR(const cl_context_properties * /* properties */, cl_gl_context_info /* param_name */, size_t /* param_value_size */, void * /* param_value */, size_t * /* param_value_size_ret */) CL_API_SUFFIX__VERSION_1_0; - + typedef CL_API_ENTRY cl_int (CL_API_CALL *clGetGLContextInfoKHR_fn)( const cl_context_properties * properties, cl_gl_context_info param_name, @@ -150,4 +159,4 @@ typedef CL_API_ENTRY cl_int (CL_API_CALL *clGetGLContextInfoKHR_fn)( } #endif -#endif /* __OPENCL_CL_GL_H */ +#endif /* __OPENCL_CL_GL_H */ diff --git a/Externals/CLRun/include/CL/cl_gl_ext.h b/Externals/CLRun/include/CL/cl_gl_ext.h new file mode 100644 index 0000000000..77d53536f6 --- /dev/null +++ b/Externals/CLRun/include/CL/cl_gl_ext.h @@ -0,0 +1,69 @@ +/********************************************************************************** + * Copyright (c) 2008-2012 The Khronos Group Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and/or associated documentation files (the + * "Materials"), to deal in the Materials without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Materials, and to + * permit persons to whom the Materials are furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Materials. + * + * THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS. + **********************************************************************************/ + +/* $Revision: 11708 $ on $Date: 2010-06-13 23:36:24 -0700 (Sun, 13 Jun 2010) $ */ + +/* cl_gl_ext.h contains vendor (non-KHR) OpenCL extensions which have */ +/* OpenGL dependencies. */ + +#ifndef __OPENCL_CL_GL_EXT_H +#define __OPENCL_CL_GL_EXT_H + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef __APPLE__ + #include +#else + #include +#endif + +/* + * For each extension, follow this template + * cl_VEN_extname extension */ +/* #define cl_VEN_extname 1 + * ... define new types, if any + * ... define new tokens, if any + * ... define new APIs, if any + * + * If you need GLtypes here, mirror them with a cl_GLtype, rather than including a GL header + * This allows us to avoid having to decide whether to include GL headers or GLES here. + */ + +/* + * cl_khr_gl_event extension + * See section 9.9 in the OpenCL 1.1 spec for more information + */ +#define CL_COMMAND_GL_FENCE_SYNC_OBJECT_KHR 0x200D + +extern CL_API_ENTRY cl_event CL_API_CALL +clCreateEventFromGLsyncKHR(cl_context /* context */, + cl_GLsync /* cl_GLsync */, + cl_int * /* errcode_ret */) CL_EXT_SUFFIX__VERSION_1_1; + +#ifdef __cplusplus +} +#endif + +#endif /* __OPENCL_CL_GL_EXT_H */ diff --git a/Externals/CLRun/include/CL/cl_platform.h b/Externals/CLRun/include/CL/cl_platform.h index 8fdcb17341..cf2b7210ac 100644 --- a/Externals/CLRun/include/CL/cl_platform.h +++ b/Externals/CLRun/include/CL/cl_platform.h @@ -1,5 +1,5 @@ /********************************************************************************** - * Copyright (c) 2008-2010 The Khronos Group Inc. + * Copyright (c) 2008-2012 The Khronos Group Inc. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and/or associated documentation files (the @@ -21,7 +21,7 @@ * MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS. **********************************************************************************/ -/* $Revision: 11707 $ on $Date: 2010-06-13 23:30:16 -0700 (Sun, 13 Jun 2010) $ */ +/* $Revision: 11803 $ on $Date: 2010-06-25 10:02:12 -0700 (Fri, 25 Jun 2010) $ */ #ifndef __CL_PLATFORM_H #define __CL_PLATFORM_H @@ -36,21 +36,85 @@ extern "C" { #endif #if defined(_WIN32) -#define CL_API_ENTRY -#define CL_API_CALL __stdcall + #define CL_API_ENTRY + #define CL_API_CALL __stdcall + #define CL_CALLBACK __stdcall #else -#define CL_API_ENTRY -#define CL_API_CALL + #define CL_API_ENTRY + #define CL_API_CALL + #define CL_CALLBACK #endif #ifdef __APPLE__ -#define CL_API_SUFFIX__VERSION_1_0 AVAILABLE_MAC_OS_X_VERSION_10_6_AND_LATER -#define CL_API_SUFFIX__VERSION_1_1 -#define CL_EXTENSION_WEAK_LINK __attribute__((weak_import)) + #define CL_EXTENSION_WEAK_LINK __attribute__((weak_import)) + #define CL_API_SUFFIX__VERSION_1_0 AVAILABLE_MAC_OS_X_VERSION_10_6_AND_LATER + #define CL_EXT_SUFFIX__VERSION_1_0 CL_EXTENSION_WEAK_LINK AVAILABLE_MAC_OS_X_VERSION_10_6_AND_LATER + #define CL_API_SUFFIX__VERSION_1_1 AVAILABLE_MAC_OS_X_VERSION_10_7_AND_LATER + #define GCL_API_SUFFIX__VERSION_1_1 AVAILABLE_MAC_OS_X_VERSION_10_7_AND_LATER + #define CL_EXT_SUFFIX__VERSION_1_1 CL_EXTENSION_WEAK_LINK AVAILABLE_MAC_OS_X_VERSION_10_7_AND_LATER + #define CL_EXT_SUFFIX__VERSION_1_0_DEPRECATED CL_EXTENSION_WEAK_LINK AVAILABLE_MAC_OS_X_VERSION_10_6_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_7 + + #ifdef AVAILABLE_MAC_OS_X_VERSION_10_8_AND_LATER + #define CL_API_SUFFIX__VERSION_1_2 AVAILABLE_MAC_OS_X_VERSION_10_8_AND_LATER + #define GCL_API_SUFFIX__VERSION_1_2 AVAILABLE_MAC_OS_X_VERSION_10_8_AND_LATER + #define CL_EXT_SUFFIX__VERSION_1_2 CL_EXTENSION_WEAK_LINK AVAILABLE_MAC_OS_X_VERSION_10_8_AND_LATER + #define CL_EXT_PREFIX__VERSION_1_1_DEPRECATED + #define CL_EXT_SUFFIX__VERSION_1_1_DEPRECATED CL_EXTENSION_WEAK_LINK AVAILABLE_MAC_OS_X_VERSION_10_7_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_10_8 + #else + #warning This path should never happen outside of internal operating system development. AvailabilityMacros do not function correctly here! + #define CL_API_SUFFIX__VERSION_1_2 AVAILABLE_MAC_OS_X_VERSION_10_7_AND_LATER + #define GCL_API_SUFFIX__VERSION_1_2 AVAILABLE_MAC_OS_X_VERSION_10_7_AND_LATER + #define CL_EXT_SUFFIX__VERSION_1_2 CL_EXTENSION_WEAK_LINK AVAILABLE_MAC_OS_X_VERSION_10_7_AND_LATER + #define CL_EXT_SUFFIX__VERSION_1_1_DEPRECATED CL_EXTENSION_WEAK_LINK AVAILABLE_MAC_OS_X_VERSION_10_7_AND_LATER + #endif #else -#define CL_API_SUFFIX__VERSION_1_0 -#define CL_API_SUFFIX__VERSION_1_1 -#define CL_EXTENSION_WEAK_LINK + #define CL_EXTENSION_WEAK_LINK + #define CL_API_SUFFIX__VERSION_1_0 + #define CL_EXT_SUFFIX__VERSION_1_0 + #define CL_API_SUFFIX__VERSION_1_1 + #define CL_EXT_SUFFIX__VERSION_1_1 + #define CL_API_SUFFIX__VERSION_1_2 + #define CL_EXT_SUFFIX__VERSION_1_2 + + #ifdef __GNUC__ + #ifdef CL_USE_DEPRECATED_OPENCL_1_0_APIS + #define CL_EXT_SUFFIX__VERSION_1_0_DEPRECATED + #define CL_EXT_PREFIX__VERSION_1_0_DEPRECATED + #else + #define CL_EXT_SUFFIX__VERSION_1_0_DEPRECATED __attribute__((deprecated)) + #define CL_EXT_PREFIX__VERSION_1_0_DEPRECATED + #endif + + #ifdef CL_USE_DEPRECATED_OPENCL_1_1_APIS + #define CL_EXT_SUFFIX__VERSION_1_1_DEPRECATED + #define CL_EXT_PREFIX__VERSION_1_1_DEPRECATED + #else + #define CL_EXT_SUFFIX__VERSION_1_1_DEPRECATED __attribute__((deprecated)) + #define CL_EXT_PREFIX__VERSION_1_1_DEPRECATED + #endif + #elif _WIN32 + #ifdef CL_USE_DEPRECATED_OPENCL_1_0_APIS + #define CL_EXT_SUFFIX__VERSION_1_0_DEPRECATED + #define CL_EXT_PREFIX__VERSION_1_0_DEPRECATED + #else + #define CL_EXT_SUFFIX__VERSION_1_0_DEPRECATED + #define CL_EXT_PREFIX__VERSION_1_0_DEPRECATED __declspec(deprecated) + #endif + + #ifdef CL_USE_DEPRECATED_OPENCL_1_1_APIS + #define CL_EXT_SUFFIX__VERSION_1_1_DEPRECATED + #define CL_EXT_PREFIX__VERSION_1_1_DEPRECATED + #else + #define CL_EXT_SUFFIX__VERSION_1_1_DEPRECATED + #define CL_EXT_PREFIX__VERSION_1_1_DEPRECATED __declspec(deprecated) + #endif + #else + #define CL_EXT_SUFFIX__VERSION_1_0_DEPRECATED + #define CL_EXT_PREFIX__VERSION_1_0_DEPRECATED + + #define CL_EXT_SUFFIX__VERSION_1_1_DEPRECATED + #define CL_EXT_PREFIX__VERSION_1_1_DEPRECATED + #endif #endif #if (defined (_WIN32) && defined(_MSC_VER)) @@ -108,14 +172,40 @@ typedef double cl_double; #define CL_DBL_MIN 2.225073858507201383090e-308 #define CL_DBL_EPSILON 2.220446049250313080847e-16 +#define CL_M_E 2.718281828459045090796 +#define CL_M_LOG2E 1.442695040888963387005 +#define CL_M_LOG10E 0.434294481903251816668 +#define CL_M_LN2 0.693147180559945286227 +#define CL_M_LN10 2.302585092994045901094 +#define CL_M_PI 3.141592653589793115998 +#define CL_M_PI_2 1.570796326794896557999 +#define CL_M_PI_4 0.785398163397448278999 +#define CL_M_1_PI 0.318309886183790691216 +#define CL_M_2_PI 0.636619772367581382433 +#define CL_M_2_SQRTPI 1.128379167095512558561 +#define CL_M_SQRT2 1.414213562373095145475 +#define CL_M_SQRT1_2 0.707106781186547572737 + +#define CL_M_E_F 2.71828174591064f +#define CL_M_LOG2E_F 1.44269502162933f +#define CL_M_LOG10E_F 0.43429449200630f +#define CL_M_LN2_F 0.69314718246460f +#define CL_M_LN10_F 2.30258512496948f +#define CL_M_PI_F 3.14159274101257f +#define CL_M_PI_2_F 1.57079637050629f +#define CL_M_PI_4_F 0.78539818525314f +#define CL_M_1_PI_F 0.31830987334251f +#define CL_M_2_PI_F 0.63661974668503f +#define CL_M_2_SQRTPI_F 1.12837922573090f +#define CL_M_SQRT2_F 1.41421353816986f +#define CL_M_SQRT1_2_F 0.70710676908493f + #define CL_NAN (CL_INFINITY - CL_INFINITY) #define CL_HUGE_VALF ((cl_float) 1e50) #define CL_HUGE_VAL ((cl_double) 1e500) #define CL_MAXFLOAT CL_FLT_MAX #define CL_INFINITY CL_HUGE_VALF -#define CL_CALLBACK __stdcall - #else #include @@ -173,6 +263,34 @@ typedef double cl_double __attribute__((aligned(8))); #define CL_DBL_MIN 0x1.0p-1022 #define CL_DBL_EPSILON 0x1.0p-52 +#define CL_M_E 2.718281828459045090796 +#define CL_M_LOG2E 1.442695040888963387005 +#define CL_M_LOG10E 0.434294481903251816668 +#define CL_M_LN2 0.693147180559945286227 +#define CL_M_LN10 2.302585092994045901094 +#define CL_M_PI 3.141592653589793115998 +#define CL_M_PI_2 1.570796326794896557999 +#define CL_M_PI_4 0.785398163397448278999 +#define CL_M_1_PI 0.318309886183790691216 +#define CL_M_2_PI 0.636619772367581382433 +#define CL_M_2_SQRTPI 1.128379167095512558561 +#define CL_M_SQRT2 1.414213562373095145475 +#define CL_M_SQRT1_2 0.707106781186547572737 + +#define CL_M_E_F 2.71828174591064f +#define CL_M_LOG2E_F 1.44269502162933f +#define CL_M_LOG10E_F 0.43429449200630f +#define CL_M_LN2_F 0.69314718246460f +#define CL_M_LN10_F 2.30258512496948f +#define CL_M_PI_F 3.14159274101257f +#define CL_M_PI_2_F 1.57079637050629f +#define CL_M_PI_4_F 0.78539818525314f +#define CL_M_1_PI_F 0.31830987334251f +#define CL_M_2_PI_F 0.63661974668503f +#define CL_M_2_SQRTPI_F 1.12837922573090f +#define CL_M_SQRT2_F 1.41421353816986f +#define CL_M_SQRT1_2_F 0.70710676908493f + #if defined( __GNUC__ ) #define CL_HUGE_VALF __builtin_huge_valf() #define CL_HUGE_VAL __builtin_huge_val() @@ -186,13 +304,11 @@ typedef double cl_double __attribute__((aligned(8))); #define CL_MAXFLOAT CL_FLT_MAX #define CL_INFINITY CL_HUGE_VALF -#define CL_CALLBACK - #endif #include -/* Mirror types to GL types. Mirror types allow us to avoid deciding which headers to load based on whether we are using GL or GLES here. */ +/* Mirror types to GL types. Mirror types allow us to avoid deciding which 87s to load based on whether we are using GL or GLES here. */ typedef unsigned int cl_GLuint; typedef int cl_GLint; typedef unsigned int cl_GLenum; @@ -389,6 +505,9 @@ typedef union #endif }cl_char4; +/* cl_char3 is identical in size, alignment and behavior to cl_char4. See section 6.1.5. */ +typedef cl_char4 cl_char3; + typedef union { cl_char CL_ALIGNED(8) s[8]; @@ -461,6 +580,9 @@ typedef union #endif }cl_uchar4; +/* cl_uchar3 is identical in size, alignment and behavior to cl_uchar4. See section 6.1.5. */ +typedef cl_uchar4 cl_uchar3; + typedef union { cl_uchar CL_ALIGNED(8) s[8]; @@ -533,6 +655,9 @@ typedef union #endif }cl_short4; +/* cl_short3 is identical in size, alignment and behavior to cl_short4. See section 6.1.5. */ +typedef cl_short4 cl_short3; + typedef union { cl_short CL_ALIGNED(16) s[8]; @@ -605,6 +730,9 @@ typedef union #endif }cl_ushort4; +/* cl_ushort3 is identical in size, alignment and behavior to cl_ushort4. See section 6.1.5. */ +typedef cl_ushort4 cl_ushort3; + typedef union { cl_ushort CL_ALIGNED(16) s[8]; @@ -676,6 +804,9 @@ typedef union #endif }cl_int4; +/* cl_int3 is identical in size, alignment and behavior to cl_int4. See section 6.1.5. */ +typedef cl_int4 cl_int3; + typedef union { cl_int CL_ALIGNED(32) s[8]; @@ -748,6 +879,9 @@ typedef union #endif }cl_uint4; +/* cl_uint3 is identical in size, alignment and behavior to cl_uint4. See section 6.1.5. */ +typedef cl_uint4 cl_uint3; + typedef union { cl_uint CL_ALIGNED(32) s[8]; @@ -819,6 +953,9 @@ typedef union #endif }cl_long4; +/* cl_long3 is identical in size, alignment and behavior to cl_long4. See section 6.1.5. */ +typedef cl_long4 cl_long3; + typedef union { cl_long CL_ALIGNED(64) s[8]; @@ -891,6 +1028,9 @@ typedef union #endif }cl_ulong4; +/* cl_ulong3 is identical in size, alignment and behavior to cl_ulong4. See section 6.1.5. */ +typedef cl_ulong4 cl_ulong3; + typedef union { cl_ulong CL_ALIGNED(64) s[8]; @@ -964,6 +1104,9 @@ typedef union #endif }cl_float4; +/* cl_float3 is identical in size, alignment and behavior to cl_float4. See section 6.1.5. */ +typedef cl_float4 cl_float3; + typedef union { cl_float CL_ALIGNED(32) s[8]; @@ -1036,6 +1179,9 @@ typedef union #endif }cl_double4; +/* cl_double3 is identical in size, alignment and behavior to cl_double4. See section 6.1.5. */ +typedef cl_double4 cl_double3; + typedef union { cl_double CL_ALIGNED(64) s[8]; @@ -1077,6 +1223,29 @@ typedef union #endif }cl_double16; +/* Macro to facilitate debugging + * Usage: + * Place CL_PROGRAM_STRING_DEBUG_INFO on the line before the first line of your source. + * The first line ends with: CL_PROGRAM_STRING_DEBUG_INFO \" + * Each line thereafter of OpenCL C source must end with: \n\ + * The last line ends in "; + * + * Example: + * + * const char *my_program = CL_PROGRAM_STRING_DEBUG_INFO "\ + * kernel void foo( int a, float * b ) \n\ + * { \n\ + * // my comment \n\ + * *b[ get_global_id(0)] = a; \n\ + * } \n\ + * "; + * + * This should correctly set up the line, (column) and file information for your source + * string so you can do source level debugging. + */ +#define __CL_STRINGIFY( _x ) # _x +#define _CL_STRINGIFY( _x ) __CL_STRINGIFY( _x ) +#define CL_PROGRAM_STRING_DEBUG_INFO "#line " _CL_STRINGIFY(__LINE__) " \"" __FILE__ "\" \n\n" #ifdef __cplusplus } From dc98ce59224b7f0c175af1886d4d74d1d8fcb8d6 Mon Sep 17 00:00:00 2001 From: skidau Date: Sun, 24 Feb 2013 23:05:12 +1100 Subject: [PATCH 42/49] Added the addeo instruction to the JIT tables. Fixes Inkub (WiiWare). --- Source/Core/Core/Src/PowerPC/Interpreter/Interpreter_Tables.cpp | 1 + Source/Core/Core/Src/PowerPC/Jit64/Jit64_Tables.cpp | 1 + Source/Core/Core/Src/PowerPC/Jit64IL/JitIL_Tables.cpp | 1 + 3 files changed, 3 insertions(+) diff --git a/Source/Core/Core/Src/PowerPC/Interpreter/Interpreter_Tables.cpp b/Source/Core/Core/Src/PowerPC/Interpreter/Interpreter_Tables.cpp index 8ea35503bf..07219218a2 100644 --- a/Source/Core/Core/Src/PowerPC/Interpreter/Interpreter_Tables.cpp +++ b/Source/Core/Core/Src/PowerPC/Interpreter/Interpreter_Tables.cpp @@ -297,6 +297,7 @@ static GekkoOPTemplate table31_2[] = {10, Interpreter::addcx, {"addcx", OPTYPE_INTEGER, FL_OUT_D | FL_IN_AB | FL_SET_CA | FL_RC_BIT, 0, 0, 0, 0}}, {522, Interpreter::addcx, {"addcox", OPTYPE_INTEGER, FL_OUT_D | FL_IN_AB | FL_SET_CA | FL_RC_BIT, 0, 0, 0, 0}}, {138, Interpreter::addex, {"addex", OPTYPE_INTEGER, FL_OUT_D | FL_IN_AB | FL_READ_CA | FL_SET_CA | FL_RC_BIT, 0, 0, 0, 0}}, + {650, Interpreter::addex, {"addeox", OPTYPE_INTEGER, FL_OUT_D | FL_IN_AB | FL_READ_CA | FL_SET_CA | FL_RC_BIT, 0, 0, 0, 0}}, {234, Interpreter::addmex, {"addmex", OPTYPE_INTEGER, FL_OUT_D | FL_IN_AB | FL_READ_CA | FL_SET_CA | FL_RC_BIT, 0, 0, 0, 0}}, {202, Interpreter::addzex, {"addzex", OPTYPE_INTEGER, FL_OUT_D | FL_IN_AB | FL_READ_CA | FL_SET_CA | FL_RC_BIT, 0, 0, 0, 0}}, {491, Interpreter::divwx, {"divwx", OPTYPE_INTEGER, FL_OUT_D | FL_IN_AB | FL_RC_BIT, 39, 0, 0, 0}}, diff --git a/Source/Core/Core/Src/PowerPC/Jit64/Jit64_Tables.cpp b/Source/Core/Core/Src/PowerPC/Jit64/Jit64_Tables.cpp index ddb59903d2..cee1f4d048 100644 --- a/Source/Core/Core/Src/PowerPC/Jit64/Jit64_Tables.cpp +++ b/Source/Core/Core/Src/PowerPC/Jit64/Jit64_Tables.cpp @@ -310,6 +310,7 @@ static GekkoOPTemplate table31_2[] = {10, &Jit64::addcx}, //"addcx", OPTYPE_INTEGER, FL_OUT_D | FL_IN_AB | FL_SET_CA | FL_RC_BIT}}, {522, &Jit64::addcx}, //"addcox", OPTYPE_INTEGER, FL_OUT_D | FL_IN_AB | FL_SET_CA | FL_RC_BIT}}, {138, &Jit64::addex}, //"addex", OPTYPE_INTEGER, FL_OUT_D | FL_IN_AB | FL_READ_CA | FL_SET_CA | FL_RC_BIT}}, + {650, &Jit64::addex}, //"addeox", OPTYPE_INTEGER, FL_OUT_D | FL_IN_AB | FL_READ_CA | FL_SET_CA | FL_RC_BIT}}, {234, &Jit64::addmex}, //"addmex", OPTYPE_INTEGER, FL_OUT_D | FL_IN_AB | FL_READ_CA | FL_SET_CA | FL_RC_BIT}}, {202, &Jit64::addzex}, //"addzex", OPTYPE_INTEGER, FL_OUT_D | FL_IN_AB | FL_READ_CA | FL_SET_CA | FL_RC_BIT}}, {491, &Jit64::divwx}, //"divwx", OPTYPE_INTEGER, FL_OUT_D | FL_IN_AB | FL_RC_BIT, 39}}, diff --git a/Source/Core/Core/Src/PowerPC/Jit64IL/JitIL_Tables.cpp b/Source/Core/Core/Src/PowerPC/Jit64IL/JitIL_Tables.cpp index 9418030b9c..fd920c4a48 100644 --- a/Source/Core/Core/Src/PowerPC/Jit64IL/JitIL_Tables.cpp +++ b/Source/Core/Core/Src/PowerPC/Jit64IL/JitIL_Tables.cpp @@ -311,6 +311,7 @@ static GekkoOPTemplate table31_2[] = {10, &JitIL::Default}, //"addcx", OPTYPE_INTEGER, FL_OUT_D | FL_IN_AB | FL_SET_CA | FL_RC_BIT}}, {522, &JitIL::Default}, //"addcox", OPTYPE_INTEGER, FL_OUT_D | FL_IN_AB | FL_SET_CA | FL_RC_BIT}}, {138, &JitIL::addex}, //"addex", OPTYPE_INTEGER, FL_OUT_D | FL_IN_AB | FL_READ_CA | FL_SET_CA | FL_RC_BIT}}, + {650, &JitIL::addex}, //"addeox", OPTYPE_INTEGER, FL_OUT_D | FL_IN_AB | FL_READ_CA | FL_SET_CA | FL_RC_BIT}}, {234, &JitIL::Default}, //"addmex", OPTYPE_INTEGER, FL_OUT_D | FL_IN_AB | FL_READ_CA | FL_SET_CA | FL_RC_BIT}}, {202, &JitIL::addzex}, //"addzex", OPTYPE_INTEGER, FL_OUT_D | FL_IN_AB | FL_READ_CA | FL_SET_CA | FL_RC_BIT}}, {491, &JitIL::Default}, //"divwx", OPTYPE_INTEGER, FL_OUT_D | FL_IN_AB | FL_RC_BIT, 39}}, From 6b2804e2960b4c8d9ba9ef95ad4c843eab9ae00b Mon Sep 17 00:00:00 2001 From: Jordan Woyak Date: Sun, 24 Feb 2013 22:29:33 -0600 Subject: [PATCH 43/49] Possible crashfix for OSX. --- Source/Core/Core/Src/HW/WiimoteReal/IOdarwin.mm | 3 ++- Source/Core/Core/Src/HW/WiimoteReal/WiimoteReal.cpp | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/Source/Core/Core/Src/HW/WiimoteReal/IOdarwin.mm b/Source/Core/Core/Src/HW/WiimoteReal/IOdarwin.mm index fda1d99462..cec18ed63a 100644 --- a/Source/Core/Core/Src/HW/WiimoteReal/IOdarwin.mm +++ b/Source/Core/Core/Src/HW/WiimoteReal/IOdarwin.mm @@ -195,6 +195,8 @@ bool Wiimote::Connect() ERROR_LOG(WIIMOTE, "Unable to open L2CAP channels " "for wiimote %i", index + 1); Disconnect(); + + [cbt release]; return false; } @@ -209,7 +211,6 @@ bool Wiimote::Connect() m_connected = true; [cbt release]; - return true; } diff --git a/Source/Core/Core/Src/HW/WiimoteReal/WiimoteReal.cpp b/Source/Core/Core/Src/HW/WiimoteReal/WiimoteReal.cpp index b5a1703527..3608c060fc 100644 --- a/Source/Core/Core/Src/HW/WiimoteReal/WiimoteReal.cpp +++ b/Source/Core/Core/Src/HW/WiimoteReal/WiimoteReal.cpp @@ -51,7 +51,7 @@ WiimoteScanner g_wiimote_scanner; Wiimote::Wiimote() : index() #ifdef __APPLE__ - , inputlen(0) + , btd(), ichan(), cchan(), inputlen(), m_connected() #elif defined(__linux__) && HAVE_BLUEZ , cmd_sock(-1), int_sock(-1) #elif defined(_WIN32) From 1141af64f64b801fc1509bb9c1eff92436f340e6 Mon Sep 17 00:00:00 2001 From: NeoBrainX Date: Mon, 25 Feb 2013 12:36:50 +0000 Subject: [PATCH 44/49] TextureCacheBase: Do not assume EFB copies can safely be deleted when we think they're "unused". Fixes issue 6040. --- Source/Core/VideoCommon/Src/TextureCacheBase.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Source/Core/VideoCommon/Src/TextureCacheBase.cpp b/Source/Core/VideoCommon/Src/TextureCacheBase.cpp index fda4f21a7e..46aaf79bd4 100644 --- a/Source/Core/VideoCommon/Src/TextureCacheBase.cpp +++ b/Source/Core/VideoCommon/Src/TextureCacheBase.cpp @@ -129,8 +129,13 @@ void TextureCache::Cleanup() TexCache::iterator tcend = textures.end(); while (iter != tcend) { - if (frameCount > TEXTURE_KILL_THRESHOLD + iter->second->frameCount) // TODO: Deleting EFB copies might not be a good idea here... + if (frameCount > TEXTURE_KILL_THRESHOLD + iter->second->frameCount) { + // EFB copies living on the host GPU are unrecoverable and thus shouldn't be deleted + // TODO: encoding the texture back to RAM here might be a good idea + if (g_ActiveConfig.bCopyEFBToTexture && entry->IsEfbCopy()) + continue; + delete iter->second; textures.erase(iter++); } From 73a0bdd379672c4f218b92788002dbc39815fb85 Mon Sep 17 00:00:00 2001 From: NeoBrainX Date: Mon, 25 Feb 2013 12:42:52 +0000 Subject: [PATCH 45/49] Build fixing. --- Source/Core/VideoCommon/Src/TextureCacheBase.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/Core/VideoCommon/Src/TextureCacheBase.cpp b/Source/Core/VideoCommon/Src/TextureCacheBase.cpp index 46aaf79bd4..d261d9d6d2 100644 --- a/Source/Core/VideoCommon/Src/TextureCacheBase.cpp +++ b/Source/Core/VideoCommon/Src/TextureCacheBase.cpp @@ -133,7 +133,7 @@ void TextureCache::Cleanup() { // EFB copies living on the host GPU are unrecoverable and thus shouldn't be deleted // TODO: encoding the texture back to RAM here might be a good idea - if (g_ActiveConfig.bCopyEFBToTexture && entry->IsEfbCopy()) + if (g_ActiveConfig.bCopyEFBToTexture && iter->second->IsEfbCopy()) continue; delete iter->second; From d173d646de18bc9e158651989045fef8ddd1523f Mon Sep 17 00:00:00 2001 From: degasus Date: Mon, 25 Feb 2013 16:11:24 +0100 Subject: [PATCH 46/49] fix last commit by neobrain --- Source/Core/VideoCommon/Src/TextureCacheBase.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/Source/Core/VideoCommon/Src/TextureCacheBase.cpp b/Source/Core/VideoCommon/Src/TextureCacheBase.cpp index d261d9d6d2..6871c411fa 100644 --- a/Source/Core/VideoCommon/Src/TextureCacheBase.cpp +++ b/Source/Core/VideoCommon/Src/TextureCacheBase.cpp @@ -129,13 +129,12 @@ void TextureCache::Cleanup() TexCache::iterator tcend = textures.end(); while (iter != tcend) { - if (frameCount > TEXTURE_KILL_THRESHOLD + iter->second->frameCount) - { + if ( frameCount > TEXTURE_KILL_THRESHOLD + iter->second->frameCount + // EFB copies living on the host GPU are unrecoverable and thus shouldn't be deleted // TODO: encoding the texture back to RAM here might be a good idea - if (g_ActiveConfig.bCopyEFBToTexture && iter->second->IsEfbCopy()) - continue; - + && ! (g_ActiveConfig.bCopyEFBToTexture && iter->second->IsEfbCopy()) ) + { delete iter->second; textures.erase(iter++); } From 0e4b07ddf97b9769b341dbbc54b26b6784396da7 Mon Sep 17 00:00:00 2001 From: "kostamarino@hotmail.com" Date: Mon, 25 Feb 2013 19:14:36 +0200 Subject: [PATCH 47/49] Update the gameini of F-zero. Efb to Ram is no longer the default choice. --- Data/User/GameConfig/GFZE01.ini | 3 --- Data/User/GameConfig/GFZP01.ini | 3 --- 2 files changed, 6 deletions(-) diff --git a/Data/User/GameConfig/GFZE01.ini b/Data/User/GameConfig/GFZE01.ini index 450553aa06..32b1e195c0 100644 --- a/Data/User/GameConfig/GFZE01.ini +++ b/Data/User/GameConfig/GFZE01.ini @@ -43,7 +43,4 @@ $All Vehicles Unlocked 840030C8 FFDC6F00 [Gecko] [Video_Hacks] -EFBCopyEnable = True -EFBToTextureEnable = False -EFBCopyCacheEnable = True [Video_Settings] diff --git a/Data/User/GameConfig/GFZP01.ini b/Data/User/GameConfig/GFZP01.ini index 70c517ef4a..0586d53d3f 100644 --- a/Data/User/GameConfig/GFZP01.ini +++ b/Data/User/GameConfig/GFZP01.ini @@ -24,7 +24,4 @@ $Make Save Copyable 04C3110C 4B400410 [Gecko] [Video_Hacks] -EFBCopyEnable = True -EFBToTextureEnable = False -EFBCopyCacheEnable = True [Video_Settings] From a450ba442025d897a63f3b8e3655a8a49885df2b Mon Sep 17 00:00:00 2001 From: Rachel Bryk Date: Mon, 25 Feb 2013 15:58:12 -0500 Subject: [PATCH 48/49] Abort load state if it uses a different dsp engine, instead of crashing. --- Source/Core/Core/Src/HW/DSPHLE/DSPHLE.cpp | 9 +++++++++ Source/Core/Core/Src/HW/DSPLLE/DSPLLE.cpp | 9 +++++++++ Source/Core/Core/Src/State.cpp | 2 +- 3 files changed, 19 insertions(+), 1 deletion(-) diff --git a/Source/Core/Core/Src/HW/DSPHLE/DSPHLE.cpp b/Source/Core/Core/Src/HW/DSPHLE/DSPHLE.cpp index b22be91104..dac977922b 100644 --- a/Source/Core/Core/Src/HW/DSPHLE/DSPHLE.cpp +++ b/Source/Core/Core/Src/HW/DSPHLE/DSPHLE.cpp @@ -27,6 +27,7 @@ #include "UCodes/UCodes.h" #include "../AudioInterface.h" #include "ConfigManager.h" +#include "Core.h" DSPHLE::DSPHLE() { m_InitMixer = false; @@ -130,6 +131,14 @@ void DSPHLE::SwapUCode(u32 _crc) void DSPHLE::DoState(PointerWrap &p) { + bool isHLE = true; + p.Do(isHLE); + if (isHLE != true && p.GetMode() == PointerWrap::MODE_READ) + { + Core::DisplayMessage("Save states made with the LLE audio engine are incompatible with the HLE DSP engine. Aborting load state.", 3000); + p.SetMode(PointerWrap::MODE_VERIFY); + return; + } bool prevInitMixer = m_InitMixer; p.Do(m_InitMixer); if (prevInitMixer != m_InitMixer && p.GetMode() == PointerWrap::MODE_READ) diff --git a/Source/Core/Core/Src/HW/DSPLLE/DSPLLE.cpp b/Source/Core/Core/Src/HW/DSPLLE/DSPLLE.cpp index 92053053de..2dbb7a8292 100644 --- a/Source/Core/Core/Src/HW/DSPLLE/DSPLLE.cpp +++ b/Source/Core/Core/Src/HW/DSPLLE/DSPLLE.cpp @@ -26,6 +26,7 @@ #include "IniFile.h" #include "ConfigManager.h" #include "CPUDetect.h" +#include "Core.h" #include "DSPLLEGlobals.h" // Local #include "DSP/DSPInterpreter.h" @@ -56,6 +57,14 @@ Common::Event ppcEvent; void DSPLLE::DoState(PointerWrap &p) { + bool isHLE = false; + p.Do(isHLE); + if (isHLE != false && p.GetMode() == PointerWrap::MODE_READ) + { + Core::DisplayMessage("Save states made with the HLE audio engine are incompatible with the LLE DSP engine. Aborting load state.", 3000); + p.SetMode(PointerWrap::MODE_VERIFY); + return; + } p.Do(g_dsp.r); p.Do(g_dsp.pc); #if PROFILE diff --git a/Source/Core/Core/Src/State.cpp b/Source/Core/Core/Src/State.cpp index 084a94e5f6..0facf2f387 100644 --- a/Source/Core/Core/Src/State.cpp +++ b/Source/Core/Core/Src/State.cpp @@ -71,7 +71,7 @@ static Common::Event g_compressAndDumpStateSyncEvent; static std::thread g_save_thread; // Don't forget to increase this after doing changes on the savestate system -static const u32 STATE_VERSION = 13; +static const u32 STATE_VERSION = 14; struct StateHeader { From e5c53e371f5ea96504b7c903239c2059b2f288bc Mon Sep 17 00:00:00 2001 From: Rachel Bryk Date: Mon, 25 Feb 2013 18:12:25 -0500 Subject: [PATCH 49/49] Make error message for loading save state with wrong dsp engine shorter. --- Source/Core/Core/Src/HW/DSPHLE/DSPHLE.cpp | 2 +- Source/Core/Core/Src/HW/DSPLLE/DSPLLE.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Source/Core/Core/Src/HW/DSPHLE/DSPHLE.cpp b/Source/Core/Core/Src/HW/DSPHLE/DSPHLE.cpp index dac977922b..6d2a1f9097 100644 --- a/Source/Core/Core/Src/HW/DSPHLE/DSPHLE.cpp +++ b/Source/Core/Core/Src/HW/DSPHLE/DSPHLE.cpp @@ -135,7 +135,7 @@ void DSPHLE::DoState(PointerWrap &p) p.Do(isHLE); if (isHLE != true && p.GetMode() == PointerWrap::MODE_READ) { - Core::DisplayMessage("Save states made with the LLE audio engine are incompatible with the HLE DSP engine. Aborting load state.", 3000); + Core::DisplayMessage("State is incompatible with current DSP engine. Aborting load state.", 3000); p.SetMode(PointerWrap::MODE_VERIFY); return; } diff --git a/Source/Core/Core/Src/HW/DSPLLE/DSPLLE.cpp b/Source/Core/Core/Src/HW/DSPLLE/DSPLLE.cpp index 2dbb7a8292..2cbf39f457 100644 --- a/Source/Core/Core/Src/HW/DSPLLE/DSPLLE.cpp +++ b/Source/Core/Core/Src/HW/DSPLLE/DSPLLE.cpp @@ -61,7 +61,7 @@ void DSPLLE::DoState(PointerWrap &p) p.Do(isHLE); if (isHLE != false && p.GetMode() == PointerWrap::MODE_READ) { - Core::DisplayMessage("Save states made with the HLE audio engine are incompatible with the LLE DSP engine. Aborting load state.", 3000); + Core::DisplayMessage("State is incompatible with current DSP engine. Aborting load state.", 3000); p.SetMode(PointerWrap::MODE_VERIFY); return; }