diff options
Diffstat (limited to 'src')
32 files changed, 239 insertions, 109 deletions
diff --git a/src/citra/citra.cpp b/src/citra/citra.cpp index 415b98a05..40e40f192 100644 --- a/src/citra/citra.cpp +++ b/src/citra/citra.cpp | |||
| @@ -19,6 +19,8 @@ | |||
| 19 | #include "common/logging/log.h" | 19 | #include "common/logging/log.h" |
| 20 | #include "common/logging/backend.h" | 20 | #include "common/logging/backend.h" |
| 21 | #include "common/logging/filter.h" | 21 | #include "common/logging/filter.h" |
| 22 | #include "common/make_unique.h" | ||
| 23 | #include "common/scope_exit.h" | ||
| 22 | 24 | ||
| 23 | #include "core/settings.h" | 25 | #include "core/settings.h" |
| 24 | #include "core/system.h" | 26 | #include "core/system.h" |
| @@ -64,6 +66,7 @@ int main(int argc, char **argv) { | |||
| 64 | Log::SetFilter(&log_filter); | 66 | Log::SetFilter(&log_filter); |
| 65 | 67 | ||
| 66 | MicroProfileOnThreadCreate("EmuThread"); | 68 | MicroProfileOnThreadCreate("EmuThread"); |
| 69 | SCOPE_EXIT({ MicroProfileShutdown(); }); | ||
| 67 | 70 | ||
| 68 | if (boot_filename.empty()) { | 71 | if (boot_filename.empty()) { |
| 69 | LOG_CRITICAL(Frontend, "Failed to load ROM: No ROM specified"); | 72 | LOG_CRITICAL(Frontend, "Failed to load ROM: No ROM specified"); |
| @@ -76,12 +79,13 @@ int main(int argc, char **argv) { | |||
| 76 | GDBStub::ToggleServer(Settings::values.use_gdbstub); | 79 | GDBStub::ToggleServer(Settings::values.use_gdbstub); |
| 77 | GDBStub::SetServerPort(static_cast<u32>(Settings::values.gdbstub_port)); | 80 | GDBStub::SetServerPort(static_cast<u32>(Settings::values.gdbstub_port)); |
| 78 | 81 | ||
| 79 | EmuWindow_SDL2* emu_window = new EmuWindow_SDL2; | 82 | std::unique_ptr<EmuWindow_SDL2> emu_window = Common::make_unique<EmuWindow_SDL2>(); |
| 80 | 83 | ||
| 81 | VideoCore::g_hw_renderer_enabled = Settings::values.use_hw_renderer; | 84 | VideoCore::g_hw_renderer_enabled = Settings::values.use_hw_renderer; |
| 82 | VideoCore::g_shader_jit_enabled = Settings::values.use_shader_jit; | 85 | VideoCore::g_shader_jit_enabled = Settings::values.use_shader_jit; |
| 83 | 86 | ||
| 84 | System::Init(emu_window); | 87 | System::Init(emu_window.get()); |
| 88 | SCOPE_EXIT({ System::Shutdown(); }); | ||
| 85 | 89 | ||
| 86 | Loader::ResultStatus load_result = Loader::LoadFile(boot_filename); | 90 | Loader::ResultStatus load_result = Loader::LoadFile(boot_filename); |
| 87 | if (Loader::ResultStatus::Success != load_result) { | 91 | if (Loader::ResultStatus::Success != load_result) { |
| @@ -93,11 +97,5 @@ int main(int argc, char **argv) { | |||
| 93 | Core::RunLoop(); | 97 | Core::RunLoop(); |
| 94 | } | 98 | } |
| 95 | 99 | ||
| 96 | System::Shutdown(); | ||
| 97 | |||
| 98 | delete emu_window; | ||
| 99 | |||
| 100 | MicroProfileShutdown(); | ||
| 101 | |||
| 102 | return 0; | 100 | return 0; |
| 103 | } | 101 | } |
diff --git a/src/citra/emu_window/emu_window_sdl2.cpp b/src/citra/emu_window/emu_window_sdl2.cpp index 1fed82e78..924189f4c 100644 --- a/src/citra/emu_window/emu_window_sdl2.cpp +++ b/src/citra/emu_window/emu_window_sdl2.cpp | |||
| @@ -73,6 +73,10 @@ EmuWindow_SDL2::EmuWindow_SDL2() { | |||
| 73 | SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 3); | 73 | SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 3); |
| 74 | SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_CORE); | 74 | SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_CORE); |
| 75 | SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1); | 75 | SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1); |
| 76 | SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 8); | ||
| 77 | SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 8); | ||
| 78 | SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 8); | ||
| 79 | SDL_GL_SetAttribute(SDL_GL_ALPHA_SIZE, 0); | ||
| 76 | 80 | ||
| 77 | std::string window_title = Common::StringFromFormat("Citra | %s-%s", Common::g_scm_branch, Common::g_scm_desc); | 81 | std::string window_title = Common::StringFromFormat("Citra | %s-%s", Common::g_scm_branch, Common::g_scm_desc); |
| 78 | render_window = SDL_CreateWindow(window_title.c_str(), | 82 | render_window = SDL_CreateWindow(window_title.c_str(), |
diff --git a/src/citra_qt/debugger/graphics_vertex_shader.cpp b/src/citra_qt/debugger/graphics_vertex_shader.cpp index 4b676f1b1..d648d4640 100644 --- a/src/citra_qt/debugger/graphics_vertex_shader.cpp +++ b/src/citra_qt/debugger/graphics_vertex_shader.cpp | |||
| @@ -179,9 +179,17 @@ QVariant GraphicsVertexShaderModel::data(const QModelIndex& index, int role) con | |||
| 179 | AlignToColumn(kOutputColumnWidth); | 179 | AlignToColumn(kOutputColumnWidth); |
| 180 | print_input(output, src1, swizzle.negate_src1, SelectorToString(swizzle.src1_selector)); | 180 | print_input(output, src1, swizzle.negate_src1, SelectorToString(swizzle.src1_selector)); |
| 181 | AlignToColumn(kInputOperandColumnWidth); | 181 | AlignToColumn(kInputOperandColumnWidth); |
| 182 | print_input(output, src2, swizzle.negate_src2, SelectorToString(swizzle.src2_selector)); | 182 | if (src_is_inverted) { |
| 183 | print_input(output, src2, swizzle.negate_src2, SelectorToString(swizzle.src2_selector)); | ||
| 184 | } else { | ||
| 185 | print_input(output, src2, swizzle.negate_src2, SelectorToString(swizzle.src2_selector), true, instr.mad.AddressRegisterName()); | ||
| 186 | } | ||
| 183 | AlignToColumn(kInputOperandColumnWidth); | 187 | AlignToColumn(kInputOperandColumnWidth); |
| 184 | print_input(output, src3, swizzle.negate_src3, SelectorToString(swizzle.src3_selector)); | 188 | if (src_is_inverted) { |
| 189 | print_input(output, src3, swizzle.negate_src3, SelectorToString(swizzle.src3_selector), true, instr.mad.AddressRegisterName()); | ||
| 190 | } else { | ||
| 191 | print_input(output, src3, swizzle.negate_src3, SelectorToString(swizzle.src3_selector)); | ||
| 192 | } | ||
| 185 | AlignToColumn(kInputOperandColumnWidth); | 193 | AlignToColumn(kInputOperandColumnWidth); |
| 186 | break; | 194 | break; |
| 187 | } | 195 | } |
diff --git a/src/common/CMakeLists.txt b/src/common/CMakeLists.txt index 959084cdf..1c9be718f 100644 --- a/src/common/CMakeLists.txt +++ b/src/common/CMakeLists.txt | |||
| @@ -22,6 +22,7 @@ set(SRCS | |||
| 22 | ) | 22 | ) |
| 23 | 23 | ||
| 24 | set(HEADERS | 24 | set(HEADERS |
| 25 | alignment.h | ||
| 25 | assert.h | 26 | assert.h |
| 26 | bit_field.h | 27 | bit_field.h |
| 27 | bit_set.h | 28 | bit_set.h |
diff --git a/src/common/alignment.h b/src/common/alignment.h new file mode 100644 index 000000000..b77da4a92 --- /dev/null +++ b/src/common/alignment.h | |||
| @@ -0,0 +1,22 @@ | |||
| 1 | // This file is under the public domain. | ||
| 2 | |||
| 3 | #pragma once | ||
| 4 | |||
| 5 | #include <cstddef> | ||
| 6 | #include <type_traits> | ||
| 7 | |||
| 8 | namespace Common { | ||
| 9 | |||
| 10 | template <typename T> | ||
| 11 | constexpr T AlignUp(T value, size_t size) { | ||
| 12 | static_assert(std::is_unsigned<T>::value, "T must be an unsigned value."); | ||
| 13 | return static_cast<T>(value + (size - value % size) % size); | ||
| 14 | } | ||
| 15 | |||
| 16 | template <typename T> | ||
| 17 | constexpr T AlignDown(T value, size_t size) { | ||
| 18 | static_assert(std::is_unsigned<T>::value, "T must be an unsigned value."); | ||
| 19 | return static_cast<T>(value - value % size); | ||
| 20 | } | ||
| 21 | |||
| 22 | } // namespace Common | ||
diff --git a/src/common/common_types.h b/src/common/common_types.h index fa3e0b8d6..9f51dff18 100644 --- a/src/common/common_types.h +++ b/src/common/common_types.h | |||
| @@ -53,9 +53,9 @@ typedef u32 PAddr; ///< Represents a pointer in the ARM11 physical address space | |||
| 53 | // An inheritable class to disallow the copy constructor and operator= functions | 53 | // An inheritable class to disallow the copy constructor and operator= functions |
| 54 | class NonCopyable { | 54 | class NonCopyable { |
| 55 | protected: | 55 | protected: |
| 56 | NonCopyable() = default; | 56 | constexpr NonCopyable() = default; |
| 57 | ~NonCopyable() = default; | 57 | ~NonCopyable() = default; |
| 58 | 58 | ||
| 59 | NonCopyable(NonCopyable&) = delete; | 59 | NonCopyable(const NonCopyable&) = delete; |
| 60 | NonCopyable& operator=(NonCopyable&) = delete; | 60 | NonCopyable& operator=(const NonCopyable&) = delete; |
| 61 | }; | 61 | }; |
diff --git a/src/common/logging/backend.cpp b/src/common/logging/backend.cpp index 54291429a..4c86151ab 100644 --- a/src/common/logging/backend.cpp +++ b/src/common/logging/backend.cpp | |||
| @@ -42,6 +42,7 @@ namespace Log { | |||
| 42 | SUB(Service, AM) \ | 42 | SUB(Service, AM) \ |
| 43 | SUB(Service, PTM) \ | 43 | SUB(Service, PTM) \ |
| 44 | SUB(Service, LDR) \ | 44 | SUB(Service, LDR) \ |
| 45 | SUB(Service, NDM) \ | ||
| 45 | SUB(Service, NIM) \ | 46 | SUB(Service, NIM) \ |
| 46 | SUB(Service, NWM) \ | 47 | SUB(Service, NWM) \ |
| 47 | SUB(Service, CAM) \ | 48 | SUB(Service, CAM) \ |
diff --git a/src/common/logging/log.h b/src/common/logging/log.h index 4b01805ae..e4c39c308 100644 --- a/src/common/logging/log.h +++ b/src/common/logging/log.h | |||
| @@ -57,6 +57,7 @@ enum class Class : ClassType { | |||
| 57 | Service_AM, ///< The AM (Application manager) service | 57 | Service_AM, ///< The AM (Application manager) service |
| 58 | Service_PTM, ///< The PTM (Power status & misc.) service | 58 | Service_PTM, ///< The PTM (Power status & misc.) service |
| 59 | Service_LDR, ///< The LDR (3ds dll loader) service | 59 | Service_LDR, ///< The LDR (3ds dll loader) service |
| 60 | Service_NDM, ///< The NDM (Network daemon manager) service | ||
| 60 | Service_NIM, ///< The NIM (Network interface manager) service | 61 | Service_NIM, ///< The NIM (Network interface manager) service |
| 61 | Service_NWM, ///< The NWM (Network wlan manager) service | 62 | Service_NWM, ///< The NWM (Network wlan manager) service |
| 62 | Service_CAM, ///< The CAM (Camera) service | 63 | Service_CAM, ///< The CAM (Camera) service |
diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt index 35b61dada..3473e2f5b 100644 --- a/src/core/CMakeLists.txt +++ b/src/core/CMakeLists.txt | |||
| @@ -87,7 +87,8 @@ set(SRCS | |||
| 87 | hle/service/ir/ir_user.cpp | 87 | hle/service/ir/ir_user.cpp |
| 88 | hle/service/ldr_ro.cpp | 88 | hle/service/ldr_ro.cpp |
| 89 | hle/service/mic_u.cpp | 89 | hle/service/mic_u.cpp |
| 90 | hle/service/ndm_u.cpp | 90 | hle/service/ndm/ndm.cpp |
| 91 | hle/service/ndm/ndm_u.cpp | ||
| 91 | hle/service/news/news.cpp | 92 | hle/service/news/news.cpp |
| 92 | hle/service/news/news_s.cpp | 93 | hle/service/news/news_s.cpp |
| 93 | hle/service/news/news_u.cpp | 94 | hle/service/news/news_u.cpp |
| @@ -218,7 +219,8 @@ set(HEADERS | |||
| 218 | hle/service/ir/ir_user.h | 219 | hle/service/ir/ir_user.h |
| 219 | hle/service/ldr_ro.h | 220 | hle/service/ldr_ro.h |
| 220 | hle/service/mic_u.h | 221 | hle/service/mic_u.h |
| 221 | hle/service/ndm_u.h | 222 | hle/service/ndm/ndm.h |
| 223 | hle/service/ndm/ndm_u.h | ||
| 222 | hle/service/news/news.h | 224 | hle/service/news/news.h |
| 223 | hle/service/news/news_s.h | 225 | hle/service/news/news_s.h |
| 224 | hle/service/news/news_u.h | 226 | hle/service/news/news_u.h |
diff --git a/src/core/hle/function_wrappers.h b/src/core/hle/function_wrappers.h index 882a51df1..4d718b681 100644 --- a/src/core/hle/function_wrappers.h +++ b/src/core/hle/function_wrappers.h | |||
| @@ -10,6 +10,7 @@ | |||
| 10 | #include "core/memory.h" | 10 | #include "core/memory.h" |
| 11 | #include "core/hle/hle.h" | 11 | #include "core/hle/hle.h" |
| 12 | #include "core/hle/result.h" | 12 | #include "core/hle/result.h" |
| 13 | #include "core/hle/svc.h" | ||
| 13 | 14 | ||
| 14 | namespace HLE { | 15 | namespace HLE { |
| 15 | 16 | ||
diff --git a/src/core/hle/kernel/event.cpp b/src/core/hle/kernel/event.cpp index 53feebbc0..2b7c6992a 100644 --- a/src/core/hle/kernel/event.cpp +++ b/src/core/hle/kernel/event.cpp | |||
| @@ -35,7 +35,7 @@ void Event::Acquire() { | |||
| 35 | ASSERT_MSG(!ShouldWait(), "object unavailable!"); | 35 | ASSERT_MSG(!ShouldWait(), "object unavailable!"); |
| 36 | 36 | ||
| 37 | // Release the event if it's not sticky... | 37 | // Release the event if it's not sticky... |
| 38 | if (reset_type != RESETTYPE_STICKY) | 38 | if (reset_type != ResetType::Sticky) |
| 39 | signaled = false; | 39 | signaled = false; |
| 40 | } | 40 | } |
| 41 | 41 | ||
diff --git a/src/core/hle/kernel/event.h b/src/core/hle/kernel/event.h index 89d405236..73d0da419 100644 --- a/src/core/hle/kernel/event.h +++ b/src/core/hle/kernel/event.h | |||
| @@ -7,10 +7,16 @@ | |||
| 7 | #include "common/common_types.h" | 7 | #include "common/common_types.h" |
| 8 | 8 | ||
| 9 | #include "core/hle/kernel/kernel.h" | 9 | #include "core/hle/kernel/kernel.h" |
| 10 | #include "core/hle/svc.h" | ||
| 11 | 10 | ||
| 12 | namespace Kernel { | 11 | namespace Kernel { |
| 13 | 12 | ||
| 13 | enum class ResetType { | ||
| 14 | OneShot, | ||
| 15 | Sticky, | ||
| 16 | Pulse, | ||
| 17 | }; | ||
| 18 | |||
| 19 | |||
| 14 | class Event final : public WaitObject { | 20 | class Event final : public WaitObject { |
| 15 | public: | 21 | public: |
| 16 | /** | 22 | /** |
diff --git a/src/core/hle/kernel/timer.cpp b/src/core/hle/kernel/timer.cpp index ce6bbd719..b8daaeede 100644 --- a/src/core/hle/kernel/timer.cpp +++ b/src/core/hle/kernel/timer.cpp | |||
| @@ -43,7 +43,7 @@ bool Timer::ShouldWait() { | |||
| 43 | void Timer::Acquire() { | 43 | void Timer::Acquire() { |
| 44 | ASSERT_MSG( !ShouldWait(), "object unavailable!"); | 44 | ASSERT_MSG( !ShouldWait(), "object unavailable!"); |
| 45 | 45 | ||
| 46 | if (reset_type == RESETTYPE_ONESHOT) | 46 | if (reset_type == ResetType::OneShot) |
| 47 | signaled = false; | 47 | signaled = false; |
| 48 | } | 48 | } |
| 49 | 49 | ||
diff --git a/src/core/hle/kernel/timer.h b/src/core/hle/kernel/timer.h index 540e4e187..b1db60e8f 100644 --- a/src/core/hle/kernel/timer.h +++ b/src/core/hle/kernel/timer.h | |||
| @@ -6,8 +6,8 @@ | |||
| 6 | 6 | ||
| 7 | #include "common/common_types.h" | 7 | #include "common/common_types.h" |
| 8 | 8 | ||
| 9 | #include "core/hle/kernel/event.h" | ||
| 9 | #include "core/hle/kernel/kernel.h" | 10 | #include "core/hle/kernel/kernel.h" |
| 10 | #include "core/hle/svc.h" | ||
| 11 | 11 | ||
| 12 | namespace Kernel { | 12 | namespace Kernel { |
| 13 | 13 | ||
diff --git a/src/core/hle/service/apt/apt.cpp b/src/core/hle/service/apt/apt.cpp index 98c72fc32..a49365287 100644 --- a/src/core/hle/service/apt/apt.cpp +++ b/src/core/hle/service/apt/apt.cpp | |||
| @@ -434,8 +434,8 @@ void Init() { | |||
| 434 | cpu_percent = 0; | 434 | cpu_percent = 0; |
| 435 | 435 | ||
| 436 | // TODO(bunnei): Check if these are created in Initialize or on APT process startup. | 436 | // TODO(bunnei): Check if these are created in Initialize or on APT process startup. |
| 437 | notification_event = Kernel::Event::Create(RESETTYPE_ONESHOT, "APT_U:Notification"); | 437 | notification_event = Kernel::Event::Create(Kernel::ResetType::OneShot, "APT_U:Notification"); |
| 438 | parameter_event = Kernel::Event::Create(RESETTYPE_ONESHOT, "APT_U:Start"); | 438 | parameter_event = Kernel::Event::Create(Kernel::ResetType::OneShot, "APT_U:Start"); |
| 439 | 439 | ||
| 440 | next_parameter.signal = static_cast<u32>(SignalType::AppJustStarted); | 440 | next_parameter.signal = static_cast<u32>(SignalType::AppJustStarted); |
| 441 | next_parameter.destination_id = 0x300; | 441 | next_parameter.destination_id = 0x300; |
diff --git a/src/core/hle/service/cam/cam.cpp b/src/core/hle/service/cam/cam.cpp index 4d714037f..9df48a650 100644 --- a/src/core/hle/service/cam/cam.cpp +++ b/src/core/hle/service/cam/cam.cpp | |||
| @@ -293,10 +293,10 @@ void Init() { | |||
| 293 | AddService(new CAM_S_Interface); | 293 | AddService(new CAM_S_Interface); |
| 294 | AddService(new CAM_U_Interface); | 294 | AddService(new CAM_U_Interface); |
| 295 | 295 | ||
| 296 | completion_event_cam1 = Kernel::Event::Create(RESETTYPE_ONESHOT, "CAM_U::completion_event_cam1"); | 296 | completion_event_cam1 = Kernel::Event::Create(ResetType::OneShot, "CAM_U::completion_event_cam1"); |
| 297 | completion_event_cam2 = Kernel::Event::Create(RESETTYPE_ONESHOT, "CAM_U::completion_event_cam2"); | 297 | completion_event_cam2 = Kernel::Event::Create(ResetType::OneShot, "CAM_U::completion_event_cam2"); |
| 298 | interrupt_error_event = Kernel::Event::Create(RESETTYPE_ONESHOT, "CAM_U::interrupt_error_event"); | 298 | interrupt_error_event = Kernel::Event::Create(ResetType::OneShot, "CAM_U::interrupt_error_event"); |
| 299 | vsync_interrupt_error_event = Kernel::Event::Create(RESETTYPE_ONESHOT, "CAM_U::vsync_interrupt_error_event"); | 299 | vsync_interrupt_error_event = Kernel::Event::Create(ResetType::OneShot, "CAM_U::vsync_interrupt_error_event"); |
| 300 | } | 300 | } |
| 301 | 301 | ||
| 302 | void Shutdown() { | 302 | void Shutdown() { |
diff --git a/src/core/hle/service/dsp_dsp.cpp b/src/core/hle/service/dsp_dsp.cpp index 3ba24d466..08e437125 100644 --- a/src/core/hle/service/dsp_dsp.cpp +++ b/src/core/hle/service/dsp_dsp.cpp | |||
| @@ -457,7 +457,7 @@ const Interface::FunctionInfo FunctionTable[] = { | |||
| 457 | // Interface class | 457 | // Interface class |
| 458 | 458 | ||
| 459 | Interface::Interface() { | 459 | Interface::Interface() { |
| 460 | semaphore_event = Kernel::Event::Create(RESETTYPE_ONESHOT, "DSP_DSP::semaphore_event"); | 460 | semaphore_event = Kernel::Event::Create(Kernel::ResetType::OneShot, "DSP_DSP::semaphore_event"); |
| 461 | read_pipe_count = 0; | 461 | read_pipe_count = 0; |
| 462 | 462 | ||
| 463 | Register(FunctionTable); | 463 | Register(FunctionTable); |
diff --git a/src/core/hle/service/hid/hid.cpp b/src/core/hle/service/hid/hid.cpp index 11d7e69a1..cb4fd38e2 100644 --- a/src/core/hle/service/hid/hid.cpp +++ b/src/core/hle/service/hid/hid.cpp | |||
| @@ -68,7 +68,7 @@ void Update() { | |||
| 68 | 68 | ||
| 69 | mem->pad.current_state.hex = state.hex; | 69 | mem->pad.current_state.hex = state.hex; |
| 70 | mem->pad.index = next_pad_index; | 70 | mem->pad.index = next_pad_index; |
| 71 | next_touch_index = (next_touch_index + 1) % mem->pad.entries.size(); | 71 | next_pad_index = (next_pad_index + 1) % mem->pad.entries.size(); |
| 72 | 72 | ||
| 73 | // Get the previous Pad state | 73 | // Get the previous Pad state |
| 74 | u32 last_entry_index = (mem->pad.index - 1) % mem->pad.entries.size(); | 74 | u32 last_entry_index = (mem->pad.index - 1) % mem->pad.entries.size(); |
| @@ -201,11 +201,11 @@ void Init() { | |||
| 201 | next_touch_index = 0; | 201 | next_touch_index = 0; |
| 202 | 202 | ||
| 203 | // Create event handles | 203 | // Create event handles |
| 204 | event_pad_or_touch_1 = Event::Create(RESETTYPE_ONESHOT, "HID:EventPadOrTouch1"); | 204 | event_pad_or_touch_1 = Event::Create(ResetType::OneShot, "HID:EventPadOrTouch1"); |
| 205 | event_pad_or_touch_2 = Event::Create(RESETTYPE_ONESHOT, "HID:EventPadOrTouch2"); | 205 | event_pad_or_touch_2 = Event::Create(ResetType::OneShot, "HID:EventPadOrTouch2"); |
| 206 | event_accelerometer = Event::Create(RESETTYPE_ONESHOT, "HID:EventAccelerometer"); | 206 | event_accelerometer = Event::Create(ResetType::OneShot, "HID:EventAccelerometer"); |
| 207 | event_gyroscope = Event::Create(RESETTYPE_ONESHOT, "HID:EventGyroscope"); | 207 | event_gyroscope = Event::Create(ResetType::OneShot, "HID:EventGyroscope"); |
| 208 | event_debug_pad = Event::Create(RESETTYPE_ONESHOT, "HID:EventDebugPad"); | 208 | event_debug_pad = Event::Create(ResetType::OneShot, "HID:EventDebugPad"); |
| 209 | } | 209 | } |
| 210 | 210 | ||
| 211 | void Shutdown() { | 211 | void Shutdown() { |
diff --git a/src/core/hle/service/ir/ir.cpp b/src/core/hle/service/ir/ir.cpp index c2121cb2e..505c441c6 100644 --- a/src/core/hle/service/ir/ir.cpp +++ b/src/core/hle/service/ir/ir.cpp | |||
| @@ -99,8 +99,8 @@ void Init() { | |||
| 99 | transfer_shared_memory = nullptr; | 99 | transfer_shared_memory = nullptr; |
| 100 | 100 | ||
| 101 | // Create event handle(s) | 101 | // Create event handle(s) |
| 102 | handle_event = Event::Create(RESETTYPE_ONESHOT, "IR:HandleEvent"); | 102 | handle_event = Event::Create(ResetType::OneShot, "IR:HandleEvent"); |
| 103 | conn_status_event = Event::Create(RESETTYPE_ONESHOT, "IR:ConnectionStatusEvent"); | 103 | conn_status_event = Event::Create(ResetType::OneShot, "IR:ConnectionStatusEvent"); |
| 104 | } | 104 | } |
| 105 | 105 | ||
| 106 | void Shutdown() { | 106 | void Shutdown() { |
diff --git a/src/core/hle/service/ndm/ndm.cpp b/src/core/hle/service/ndm/ndm.cpp new file mode 100644 index 000000000..47076a7b8 --- /dev/null +++ b/src/core/hle/service/ndm/ndm.cpp | |||
| @@ -0,0 +1,47 @@ | |||
| 1 | // Copyright 2016 Citra Emulator Project | ||
| 2 | // Licensed under GPLv2 or any later version | ||
| 3 | // Refer to the license.txt file included. | ||
| 4 | |||
| 5 | #include "common/common_types.h" | ||
| 6 | #include "common/logging/log.h" | ||
| 7 | #include "core/hle/service/service.h" | ||
| 8 | #include "core/hle/service/ndm/ndm.h" | ||
| 9 | #include "core/hle/service/ndm/ndm_u.h" | ||
| 10 | |||
| 11 | namespace Service { | ||
| 12 | namespace NDM { | ||
| 13 | |||
| 14 | void SuspendDaemons(Service::Interface* self) { | ||
| 15 | u32* cmd_buff = Kernel::GetCommandBuffer(); | ||
| 16 | |||
| 17 | LOG_WARNING(Service_NDM, "(STUBBED) bit_mask=0x%08X ", cmd_buff[1]); | ||
| 18 | |||
| 19 | cmd_buff[1] = RESULT_SUCCESS.raw; // No error | ||
| 20 | } | ||
| 21 | |||
| 22 | void ResumeDaemons(Service::Interface* self) { | ||
| 23 | u32* cmd_buff = Kernel::GetCommandBuffer(); | ||
| 24 | |||
| 25 | LOG_WARNING(Service_NDM, "(STUBBED) bit_mask=0x%08X ", cmd_buff[1]); | ||
| 26 | |||
| 27 | cmd_buff[1] = RESULT_SUCCESS.raw; // No error | ||
| 28 | } | ||
| 29 | |||
| 30 | void OverrideDefaultDaemons(Service::Interface* self) { | ||
| 31 | u32* cmd_buff = Kernel::GetCommandBuffer(); | ||
| 32 | |||
| 33 | LOG_WARNING(Service_NDM, "(STUBBED) bit_mask=0x%08X ", cmd_buff[1]); | ||
| 34 | |||
| 35 | cmd_buff[1] = RESULT_SUCCESS.raw; // No error | ||
| 36 | } | ||
| 37 | |||
| 38 | void Init() { | ||
| 39 | AddService(new NDM_U_Interface); | ||
| 40 | } | ||
| 41 | |||
| 42 | void Shutdown() { | ||
| 43 | |||
| 44 | } | ||
| 45 | |||
| 46 | }// namespace NDM | ||
| 47 | }// namespace Service | ||
diff --git a/src/core/hle/service/ndm/ndm.h b/src/core/hle/service/ndm/ndm.h new file mode 100644 index 000000000..734730f8c --- /dev/null +++ b/src/core/hle/service/ndm/ndm.h | |||
| @@ -0,0 +1,52 @@ | |||
| 1 | // Copyright 2016 Citra Emulator Project | ||
| 2 | // Licensed under GPLv2 or any later version | ||
| 3 | // Refer to the license.txt file included. | ||
| 4 | |||
| 5 | #pragma once | ||
| 6 | |||
| 7 | #include "common/common_types.h" | ||
| 8 | |||
| 9 | namespace Service { | ||
| 10 | |||
| 11 | class Interface; | ||
| 12 | |||
| 13 | namespace NDM { | ||
| 14 | |||
| 15 | /** | ||
| 16 | * SuspendDaemons | ||
| 17 | * Inputs: | ||
| 18 | * 0 : Command header (0x00020082) | ||
| 19 | * 1 : Daemon bit mask | ||
| 20 | * Outputs: | ||
| 21 | * 1 : Result, 0 on success, otherwise error code | ||
| 22 | */ | ||
| 23 | void SuspendDaemons(Service::Interface* self); | ||
| 24 | |||
| 25 | /** | ||
| 26 | * ResumeDaemons | ||
| 27 | * Inputs: | ||
| 28 | * 0 : Command header (0x00020082) | ||
| 29 | * 1 : Daemon bit mask | ||
| 30 | * Outputs: | ||
| 31 | * 1 : Result, 0 on success, otherwise error code | ||
| 32 | */ | ||
| 33 | void ResumeDaemons(Service::Interface* self); | ||
| 34 | |||
| 35 | /** | ||
| 36 | * OverrideDefaultDaemons | ||
| 37 | * Inputs: | ||
| 38 | * 0 : Command header (0x00020082) | ||
| 39 | * 1 : Daemon bit mask | ||
| 40 | * Outputs: | ||
| 41 | * 1 : Result, 0 on success, otherwise error code | ||
| 42 | */ | ||
| 43 | void OverrideDefaultDaemons(Service::Interface* self); | ||
| 44 | |||
| 45 | /// Initialize NDM service | ||
| 46 | void Init(); | ||
| 47 | |||
| 48 | /// Shutdown NDM service | ||
| 49 | void Shutdown(); | ||
| 50 | |||
| 51 | }// namespace NDM | ||
| 52 | }// namespace Service | ||
diff --git a/src/core/hle/service/ndm_u.cpp b/src/core/hle/service/ndm/ndm_u.cpp index 8fdf1ef90..bf95cc7aa 100644 --- a/src/core/hle/service/ndm_u.cpp +++ b/src/core/hle/service/ndm/ndm_u.cpp | |||
| @@ -2,12 +2,11 @@ | |||
| 2 | // Licensed under GPLv2 or any later version | 2 | // Licensed under GPLv2 or any later version |
| 3 | // Refer to the license.txt file included. | 3 | // Refer to the license.txt file included. |
| 4 | 4 | ||
| 5 | #include "core/hle/service/ndm_u.h" | 5 | #include "core/hle/service/ndm/ndm.h" |
| 6 | #include "core/hle/service/ndm/ndm_u.h" | ||
| 6 | 7 | ||
| 7 | //////////////////////////////////////////////////////////////////////////////////////////////////// | 8 | namespace Service { |
| 8 | // Namespace NDM_U | 9 | namespace NDM { |
| 9 | |||
| 10 | namespace NDM_U { | ||
| 11 | 10 | ||
| 12 | const Interface::FunctionInfo FunctionTable[] = { | 11 | const Interface::FunctionInfo FunctionTable[] = { |
| 13 | {0x00010042, nullptr, "EnterExclusiveState"}, | 12 | {0x00010042, nullptr, "EnterExclusiveState"}, |
| @@ -15,8 +14,8 @@ const Interface::FunctionInfo FunctionTable[] = { | |||
| 15 | {0x00030000, nullptr, "QueryExclusiveMode"}, | 14 | {0x00030000, nullptr, "QueryExclusiveMode"}, |
| 16 | {0x00040002, nullptr, "LockState"}, | 15 | {0x00040002, nullptr, "LockState"}, |
| 17 | {0x00050002, nullptr, "UnlockState"}, | 16 | {0x00050002, nullptr, "UnlockState"}, |
| 18 | {0x00060040, nullptr, "SuspendDaemons"}, | 17 | {0x00060040, SuspendDaemons, "SuspendDaemons"}, |
| 19 | {0x00070040, nullptr, "ResumeDaemons"}, | 18 | {0x00070040, ResumeDaemons, "ResumeDaemons"}, |
| 20 | {0x00080040, nullptr, "DisableWifiUsage"}, | 19 | {0x00080040, nullptr, "DisableWifiUsage"}, |
| 21 | {0x00090000, nullptr, "EnableWifiUsage"}, | 20 | {0x00090000, nullptr, "EnableWifiUsage"}, |
| 22 | {0x000A0000, nullptr, "GetCurrentState"}, | 21 | {0x000A0000, nullptr, "GetCurrentState"}, |
| @@ -29,17 +28,15 @@ const Interface::FunctionInfo FunctionTable[] = { | |||
| 29 | {0x00110000, nullptr, "GetScanInterval"}, | 28 | {0x00110000, nullptr, "GetScanInterval"}, |
| 30 | {0x00120040, nullptr, "SetRetryInterval"}, | 29 | {0x00120040, nullptr, "SetRetryInterval"}, |
| 31 | {0x00130000, nullptr, "GetRetryInterval"}, | 30 | {0x00130000, nullptr, "GetRetryInterval"}, |
| 32 | {0x00140040, nullptr, "OverrideDefaultDaemons"}, | 31 | {0x00140040, OverrideDefaultDaemons, "OverrideDefaultDaemons"}, |
| 33 | {0x00150000, nullptr, "ResetDefaultDaemons"}, | 32 | {0x00150000, nullptr, "ResetDefaultDaemons"}, |
| 34 | {0x00160000, nullptr, "GetDefaultDaemons"}, | 33 | {0x00160000, nullptr, "GetDefaultDaemons"}, |
| 35 | {0x00170000, nullptr, "ClearHalfAwakeMacFilter"}, | 34 | {0x00170000, nullptr, "ClearHalfAwakeMacFilter"}, |
| 36 | }; | 35 | }; |
| 37 | 36 | ||
| 38 | //////////////////////////////////////////////////////////////////////////////////////////////////// | 37 | NDM_U_Interface::NDM_U_Interface() { |
| 39 | // Interface class | ||
| 40 | |||
| 41 | Interface::Interface() { | ||
| 42 | Register(FunctionTable); | 38 | Register(FunctionTable); |
| 43 | } | 39 | } |
| 44 | 40 | ||
| 45 | } // namespace | 41 | } // namespace NDM |
| 42 | } // namespace Service | ||
diff --git a/src/core/hle/service/ndm_u.h b/src/core/hle/service/ndm/ndm_u.h index 51c4b3902..d567abc84 100644 --- a/src/core/hle/service/ndm_u.h +++ b/src/core/hle/service/ndm/ndm_u.h | |||
| @@ -6,20 +6,17 @@ | |||
| 6 | 6 | ||
| 7 | #include "core/hle/service/service.h" | 7 | #include "core/hle/service/service.h" |
| 8 | 8 | ||
| 9 | //////////////////////////////////////////////////////////////////////////////////////////////////// | 9 | namespace Service { |
| 10 | // Namespace NDM | 10 | namespace NDM { |
| 11 | 11 | ||
| 12 | // No idea what this is | 12 | class NDM_U_Interface : public Service::Interface { |
| 13 | |||
| 14 | namespace NDM_U { | ||
| 15 | |||
| 16 | class Interface : public Service::Interface { | ||
| 17 | public: | 13 | public: |
| 18 | Interface(); | 14 | NDM_U_Interface(); |
| 19 | 15 | ||
| 20 | std::string GetPortName() const override { | 16 | std::string GetPortName() const override { |
| 21 | return "ndm:u"; | 17 | return "ndm:u"; |
| 22 | } | 18 | } |
| 23 | }; | 19 | }; |
| 24 | 20 | ||
| 25 | } // namespace | 21 | } // namespace NDM |
| 22 | } // namespace Service | ||
diff --git a/src/core/hle/service/nwm_uds.cpp b/src/core/hle/service/nwm_uds.cpp index dc80984b2..ae4640409 100644 --- a/src/core/hle/service/nwm_uds.cpp +++ b/src/core/hle/service/nwm_uds.cpp | |||
| @@ -138,7 +138,7 @@ const Interface::FunctionInfo FunctionTable[] = { | |||
| 138 | // Interface class | 138 | // Interface class |
| 139 | 139 | ||
| 140 | Interface::Interface() { | 140 | Interface::Interface() { |
| 141 | handle_event = Kernel::Event::Create(RESETTYPE_ONESHOT, "NWM_UDS::handle_event"); | 141 | handle_event = Kernel::Event::Create(Kernel::ResetType::OneShot, "NWM_UDS::handle_event"); |
| 142 | 142 | ||
| 143 | Register(FunctionTable); | 143 | Register(FunctionTable); |
| 144 | } | 144 | } |
diff --git a/src/core/hle/service/service.cpp b/src/core/hle/service/service.cpp index 0de0b13a3..35b648409 100644 --- a/src/core/hle/service/service.cpp +++ b/src/core/hle/service/service.cpp | |||
| @@ -16,7 +16,6 @@ | |||
| 16 | #include "core/hle/service/http_c.h" | 16 | #include "core/hle/service/http_c.h" |
| 17 | #include "core/hle/service/ldr_ro.h" | 17 | #include "core/hle/service/ldr_ro.h" |
| 18 | #include "core/hle/service/mic_u.h" | 18 | #include "core/hle/service/mic_u.h" |
| 19 | #include "core/hle/service/ndm_u.h" | ||
| 20 | #include "core/hle/service/ns_s.h" | 19 | #include "core/hle/service/ns_s.h" |
| 21 | #include "core/hle/service/nwm_uds.h" | 20 | #include "core/hle/service/nwm_uds.h" |
| 22 | #include "core/hle/service/pm_app.h" | 21 | #include "core/hle/service/pm_app.h" |
| @@ -35,6 +34,7 @@ | |||
| 35 | #include "core/hle/service/cfg/cfg.h" | 34 | #include "core/hle/service/cfg/cfg.h" |
| 36 | #include "core/hle/service/hid/hid.h" | 35 | #include "core/hle/service/hid/hid.h" |
| 37 | #include "core/hle/service/ir/ir.h" | 36 | #include "core/hle/service/ir/ir.h" |
| 37 | #include "core/hle/service/ndm/ndm.h" | ||
| 38 | #include "core/hle/service/news/news.h" | 38 | #include "core/hle/service/news/news.h" |
| 39 | #include "core/hle/service/nim/nim.h" | 39 | #include "core/hle/service/nim/nim.h" |
| 40 | #include "core/hle/service/ptm/ptm.h" | 40 | #include "core/hle/service/ptm/ptm.h" |
| @@ -114,6 +114,7 @@ void Init() { | |||
| 114 | Service::HID::Init(); | 114 | Service::HID::Init(); |
| 115 | Service::IR::Init(); | 115 | Service::IR::Init(); |
| 116 | Service::NEWS::Init(); | 116 | Service::NEWS::Init(); |
| 117 | Service::NDM::Init(); | ||
| 117 | Service::NIM::Init(); | 118 | Service::NIM::Init(); |
| 118 | Service::PTM::Init(); | 119 | Service::PTM::Init(); |
| 119 | 120 | ||
| @@ -126,7 +127,6 @@ void Init() { | |||
| 126 | AddService(new HTTP_C::Interface); | 127 | AddService(new HTTP_C::Interface); |
| 127 | AddService(new LDR_RO::Interface); | 128 | AddService(new LDR_RO::Interface); |
| 128 | AddService(new MIC_U::Interface); | 129 | AddService(new MIC_U::Interface); |
| 129 | AddService(new NDM_U::Interface); | ||
| 130 | AddService(new NS_S::Interface); | 130 | AddService(new NS_S::Interface); |
| 131 | AddService(new NWM_UDS::Interface); | 131 | AddService(new NWM_UDS::Interface); |
| 132 | AddService(new PM_APP::Interface); | 132 | AddService(new PM_APP::Interface); |
| @@ -141,6 +141,7 @@ void Init() { | |||
| 141 | void Shutdown() { | 141 | void Shutdown() { |
| 142 | 142 | ||
| 143 | Service::PTM::Shutdown(); | 143 | Service::PTM::Shutdown(); |
| 144 | Service::NDM::Shutdown(); | ||
| 144 | Service::NIM::Shutdown(); | 145 | Service::NIM::Shutdown(); |
| 145 | Service::NEWS::Shutdown(); | 146 | Service::NEWS::Shutdown(); |
| 146 | Service::IR::Shutdown(); | 147 | Service::IR::Shutdown(); |
diff --git a/src/core/hle/service/srv.cpp b/src/core/hle/service/srv.cpp index 41fc3437b..aae955bf8 100644 --- a/src/core/hle/service/srv.cpp +++ b/src/core/hle/service/srv.cpp | |||
| @@ -25,7 +25,7 @@ static void GetProcSemaphore(Service::Interface* self) { | |||
| 25 | u32* cmd_buff = Kernel::GetCommandBuffer(); | 25 | u32* cmd_buff = Kernel::GetCommandBuffer(); |
| 26 | 26 | ||
| 27 | // TODO(bunnei): Change to a semaphore once these have been implemented | 27 | // TODO(bunnei): Change to a semaphore once these have been implemented |
| 28 | event_handle = Kernel::Event::Create(RESETTYPE_ONESHOT, "SRV:Event"); | 28 | event_handle = Kernel::Event::Create(Kernel::ResetType::OneShot, "SRV:Event"); |
| 29 | event_handle->Clear(); | 29 | event_handle->Clear(); |
| 30 | 30 | ||
| 31 | cmd_buff[1] = 0; // No error | 31 | cmd_buff[1] = 0; // No error |
diff --git a/src/core/hle/service/y2r_u.cpp b/src/core/hle/service/y2r_u.cpp index a495441a4..22f373adf 100644 --- a/src/core/hle/service/y2r_u.cpp +++ b/src/core/hle/service/y2r_u.cpp | |||
| @@ -424,7 +424,7 @@ const Interface::FunctionInfo FunctionTable[] = { | |||
| 424 | // Interface class | 424 | // Interface class |
| 425 | 425 | ||
| 426 | Interface::Interface() { | 426 | Interface::Interface() { |
| 427 | completion_event = Kernel::Event::Create(RESETTYPE_ONESHOT, "Y2R:Completed"); | 427 | completion_event = Kernel::Event::Create(Kernel::ResetType::OneShot, "Y2R:Completed"); |
| 428 | std::memset(&conversion, 0, sizeof(conversion)); | 428 | std::memset(&conversion, 0, sizeof(conversion)); |
| 429 | 429 | ||
| 430 | Register(FunctionTable); | 430 | Register(FunctionTable); |
diff --git a/src/core/hle/svc.cpp b/src/core/hle/svc.cpp index 7a39b101d..ae54afb1c 100644 --- a/src/core/hle/svc.cpp +++ b/src/core/hle/svc.cpp | |||
| @@ -661,7 +661,7 @@ static ResultCode QueryMemory(MemoryInfo* memory_info, PageInfo* page_info, u32 | |||
| 661 | static ResultCode CreateEvent(Handle* out_handle, u32 reset_type) { | 661 | static ResultCode CreateEvent(Handle* out_handle, u32 reset_type) { |
| 662 | using Kernel::Event; | 662 | using Kernel::Event; |
| 663 | 663 | ||
| 664 | SharedPtr<Event> evt = Kernel::Event::Create(static_cast<ResetType>(reset_type)); | 664 | SharedPtr<Event> evt = Event::Create(static_cast<Kernel::ResetType>(reset_type)); |
| 665 | CASCADE_RESULT(*out_handle, Kernel::g_handle_table.Create(std::move(evt))); | 665 | CASCADE_RESULT(*out_handle, Kernel::g_handle_table.Create(std::move(evt))); |
| 666 | 666 | ||
| 667 | LOG_TRACE(Kernel_SVC, "called reset_type=0x%08X : created handle=0x%08X", | 667 | LOG_TRACE(Kernel_SVC, "called reset_type=0x%08X : created handle=0x%08X", |
| @@ -707,7 +707,7 @@ static ResultCode ClearEvent(Handle handle) { | |||
| 707 | static ResultCode CreateTimer(Handle* out_handle, u32 reset_type) { | 707 | static ResultCode CreateTimer(Handle* out_handle, u32 reset_type) { |
| 708 | using Kernel::Timer; | 708 | using Kernel::Timer; |
| 709 | 709 | ||
| 710 | SharedPtr<Timer> timer = Timer::Create(static_cast<ResetType>(reset_type)); | 710 | SharedPtr<Timer> timer = Timer::Create(static_cast<Kernel::ResetType>(reset_type)); |
| 711 | CASCADE_RESULT(*out_handle, Kernel::g_handle_table.Create(std::move(timer))); | 711 | CASCADE_RESULT(*out_handle, Kernel::g_handle_table.Create(std::move(timer))); |
| 712 | 712 | ||
| 713 | LOG_TRACE(Kernel_SVC, "called reset_type=0x%08X : created handle=0x%08X", | 713 | LOG_TRACE(Kernel_SVC, "called reset_type=0x%08X : created handle=0x%08X", |
diff --git a/src/core/hle/svc.h b/src/core/hle/svc.h index 4b9c71e06..818973eb6 100644 --- a/src/core/hle/svc.h +++ b/src/core/hle/svc.h | |||
| @@ -20,22 +20,6 @@ struct PageInfo { | |||
| 20 | u32 flags; | 20 | u32 flags; |
| 21 | }; | 21 | }; |
| 22 | 22 | ||
| 23 | enum ResetType { | ||
| 24 | RESETTYPE_ONESHOT, | ||
| 25 | RESETTYPE_STICKY, | ||
| 26 | RESETTYPE_PULSE, | ||
| 27 | RESETTYPE_MAX_BIT = (1u << 31), | ||
| 28 | }; | ||
| 29 | |||
| 30 | enum ArbitrationType { | ||
| 31 | ARBITRATIONTYPE_SIGNAL, | ||
| 32 | ARBITRATIONTYPE_WAIT_IF_LESS_THAN, | ||
| 33 | ARBITRATIONTYPE_DECREMENT_AND_WAIT_IF_LESS_THAN, | ||
| 34 | ARBITRATIONTYPE_WAIT_IF_LESS_THAN_WITH_TIMEOUT, | ||
| 35 | ARBITRATIONTYPE_DECREMENT_AND_WAIT_IF_LESS_THAN_WITH_TIMEOUT, | ||
| 36 | ARBITRATIONTYPE_MAX_BIT = (1u << 31) | ||
| 37 | }; | ||
| 38 | |||
| 39 | //////////////////////////////////////////////////////////////////////////////////////////////////// | 23 | //////////////////////////////////////////////////////////////////////////////////////////////////// |
| 40 | // Namespace SVC | 24 | // Namespace SVC |
| 41 | 25 | ||
diff --git a/src/video_core/command_processor.cpp b/src/video_core/command_processor.cpp index 2274dfa66..54721561e 100644 --- a/src/video_core/command_processor.cpp +++ b/src/video_core/command_processor.cpp | |||
| @@ -5,6 +5,7 @@ | |||
| 5 | #include <cmath> | 5 | #include <cmath> |
| 6 | #include <boost/range/algorithm/fill.hpp> | 6 | #include <boost/range/algorithm/fill.hpp> |
| 7 | 7 | ||
| 8 | #include "common/alignment.h" | ||
| 8 | #include "common/microprofile.h" | 9 | #include "common/microprofile.h" |
| 9 | #include "common/profiler.h" | 10 | #include "common/profiler.h" |
| 10 | 11 | ||
| @@ -210,14 +211,17 @@ static void WritePicaReg(u32 id, u32 value, u32 mask) { | |||
| 210 | 211 | ||
| 211 | u32 attribute_index = loader_config.GetComponent(component); | 212 | u32 attribute_index = loader_config.GetComponent(component); |
| 212 | if (attribute_index < 12) { | 213 | if (attribute_index < 12) { |
| 214 | int element_size = attribute_config.GetElementSizeInBytes(attribute_index); | ||
| 215 | load_address = Common::AlignUp(load_address, element_size); | ||
| 213 | vertex_attribute_sources[attribute_index] = load_address; | 216 | vertex_attribute_sources[attribute_index] = load_address; |
| 214 | vertex_attribute_strides[attribute_index] = static_cast<u32>(loader_config.byte_count); | 217 | vertex_attribute_strides[attribute_index] = static_cast<u32>(loader_config.byte_count); |
| 215 | vertex_attribute_formats[attribute_index] = attribute_config.GetFormat(attribute_index); | 218 | vertex_attribute_formats[attribute_index] = attribute_config.GetFormat(attribute_index); |
| 216 | vertex_attribute_elements[attribute_index] = attribute_config.GetNumElements(attribute_index); | 219 | vertex_attribute_elements[attribute_index] = attribute_config.GetNumElements(attribute_index); |
| 217 | vertex_attribute_element_size[attribute_index] = attribute_config.GetElementSizeInBytes(attribute_index); | 220 | vertex_attribute_element_size[attribute_index] = element_size; |
| 218 | load_address += attribute_config.GetStride(attribute_index); | 221 | load_address += attribute_config.GetStride(attribute_index); |
| 219 | } else if (attribute_index < 16) { | 222 | } else if (attribute_index < 16) { |
| 220 | // Attribute ids 12, 13, 14 and 15 signify 4, 8, 12 and 16-byte paddings, respectively | 223 | // Attribute ids 12, 13, 14 and 15 signify 4, 8, 12 and 16-byte paddings, respectively |
| 224 | load_address = Common::AlignUp(load_address, 4); | ||
| 221 | load_address += (attribute_index - 11) * 4; | 225 | load_address += (attribute_index - 11) * 4; |
| 222 | } else { | 226 | } else { |
| 223 | UNREACHABLE(); // This is truly unreachable due to the number of bits for each component | 227 | UNREACHABLE(); // This is truly unreachable due to the number of bits for each component |
diff --git a/src/video_core/shader/shader_interpreter.cpp b/src/video_core/shader/shader_interpreter.cpp index 79fcc56b9..295a2466b 100644 --- a/src/video_core/shader/shader_interpreter.cpp +++ b/src/video_core/shader/shader_interpreter.cpp | |||
| @@ -413,9 +413,12 @@ void RunInterpreter(UnitState<Debug>& state) { | |||
| 413 | 413 | ||
| 414 | bool is_inverted = (instr.opcode.Value().EffectiveOpCode() == OpCode::Id::MADI); | 414 | bool is_inverted = (instr.opcode.Value().EffectiveOpCode() == OpCode::Id::MADI); |
| 415 | 415 | ||
| 416 | const int address_offset = (instr.mad.address_register_index == 0) | ||
| 417 | ? 0 : state.address_registers[instr.mad.address_register_index - 1]; | ||
| 418 | |||
| 416 | const float24* src1_ = LookupSourceRegister(instr.mad.GetSrc1(is_inverted)); | 419 | const float24* src1_ = LookupSourceRegister(instr.mad.GetSrc1(is_inverted)); |
| 417 | const float24* src2_ = LookupSourceRegister(instr.mad.GetSrc2(is_inverted)); | 420 | const float24* src2_ = LookupSourceRegister(instr.mad.GetSrc2(is_inverted) + (!is_inverted * address_offset)); |
| 418 | const float24* src3_ = LookupSourceRegister(instr.mad.GetSrc3(is_inverted)); | 421 | const float24* src3_ = LookupSourceRegister(instr.mad.GetSrc3(is_inverted) + ( is_inverted * address_offset)); |
| 419 | 422 | ||
| 420 | const bool negate_src1 = ((bool)swizzle.negate_src1 != false); | 423 | const bool negate_src1 = ((bool)swizzle.negate_src1 != false); |
| 421 | const bool negate_src2 = ((bool)swizzle.negate_src2 != false); | 424 | const bool negate_src2 = ((bool)swizzle.negate_src2 != false); |
diff --git a/src/video_core/shader/shader_jit_x64.cpp b/src/video_core/shader/shader_jit_x64.cpp index e6cdfe9c5..dffe051ef 100644 --- a/src/video_core/shader/shader_jit_x64.cpp +++ b/src/video_core/shader/shader_jit_x64.cpp | |||
| @@ -160,40 +160,41 @@ void JitCompiler::Compile_SwizzleSrc(Instruction instr, unsigned src_num, Source | |||
| 160 | ASSERT_MSG(src_offset == src_offset_disp, "Source register offset too large for int type"); | 160 | ASSERT_MSG(src_offset == src_offset_disp, "Source register offset too large for int type"); |
| 161 | 161 | ||
| 162 | unsigned operand_desc_id; | 162 | unsigned operand_desc_id; |
| 163 | |||
| 164 | const bool is_inverted = (0 != (instr.opcode.Value().GetInfo().subtype & OpCode::Info::SrcInversed)); | ||
| 165 | |||
| 166 | unsigned address_register_index; | ||
| 167 | unsigned offset_src; | ||
| 168 | |||
| 163 | if (instr.opcode.Value().EffectiveOpCode() == OpCode::Id::MAD || | 169 | if (instr.opcode.Value().EffectiveOpCode() == OpCode::Id::MAD || |
| 164 | instr.opcode.Value().EffectiveOpCode() == OpCode::Id::MADI) { | 170 | instr.opcode.Value().EffectiveOpCode() == OpCode::Id::MADI) { |
| 165 | // The MAD and MADI instructions do not use the address offset registers, so loading the | ||
| 166 | // source is a bit simpler here | ||
| 167 | |||
| 168 | operand_desc_id = instr.mad.operand_desc_id; | 171 | operand_desc_id = instr.mad.operand_desc_id; |
| 169 | 172 | offset_src = is_inverted ? 3 : 2; | |
| 170 | // Load the source | 173 | address_register_index = instr.mad.address_register_index; |
| 171 | MOVAPS(dest, MDisp(src_ptr, src_offset_disp)); | ||
| 172 | } else { | 174 | } else { |
| 173 | operand_desc_id = instr.common.operand_desc_id; | 175 | operand_desc_id = instr.common.operand_desc_id; |
| 176 | offset_src = is_inverted ? 2 : 1; | ||
| 177 | address_register_index = instr.common.address_register_index; | ||
| 178 | } | ||
| 174 | 179 | ||
| 175 | const bool is_inverted = (0 != (instr.opcode.Value().GetInfo().subtype & OpCode::Info::SrcInversed)); | 180 | if (src_num == offset_src && address_register_index != 0) { |
| 176 | unsigned offset_src = is_inverted ? 2 : 1; | 181 | switch (address_register_index) { |
| 177 | 182 | case 1: // address offset 1 | |
| 178 | if (src_num == offset_src && instr.common.address_register_index != 0) { | 183 | MOVAPS(dest, MComplex(src_ptr, ADDROFFS_REG_0, SCALE_1, src_offset_disp)); |
| 179 | switch (instr.common.address_register_index) { | 184 | break; |
| 180 | case 1: // address offset 1 | 185 | case 2: // address offset 2 |
| 181 | MOVAPS(dest, MComplex(src_ptr, ADDROFFS_REG_0, SCALE_1, src_offset_disp)); | 186 | MOVAPS(dest, MComplex(src_ptr, ADDROFFS_REG_1, SCALE_1, src_offset_disp)); |
| 182 | break; | 187 | break; |
| 183 | case 2: // address offset 2 | 188 | case 3: // address offset 3 |
| 184 | MOVAPS(dest, MComplex(src_ptr, ADDROFFS_REG_1, SCALE_1, src_offset_disp)); | 189 | MOVAPS(dest, MComplex(src_ptr, LOOPCOUNT_REG, SCALE_1, src_offset_disp)); |
| 185 | break; | 190 | break; |
| 186 | case 3: // address offset 3 | 191 | default: |
| 187 | MOVAPS(dest, MComplex(src_ptr, LOOPCOUNT_REG, SCALE_1, src_offset_disp)); | 192 | UNREACHABLE(); |
| 188 | break; | 193 | break; |
| 189 | default: | ||
| 190 | UNREACHABLE(); | ||
| 191 | break; | ||
| 192 | } | ||
| 193 | } else { | ||
| 194 | // Load the source | ||
| 195 | MOVAPS(dest, MDisp(src_ptr, src_offset_disp)); | ||
| 196 | } | 194 | } |
| 195 | } else { | ||
| 196 | // Load the source | ||
| 197 | MOVAPS(dest, MDisp(src_ptr, src_offset_disp)); | ||
| 197 | } | 198 | } |
| 198 | 199 | ||
| 199 | SwizzlePattern swiz = { g_state.vs.swizzle_data[operand_desc_id] }; | 200 | SwizzlePattern swiz = { g_state.vs.swizzle_data[operand_desc_id] }; |