diff options
Diffstat (limited to 'src')
54 files changed, 463 insertions, 160 deletions
diff --git a/src/citra/citra.cpp b/src/citra/citra.cpp index f6a52758b..69f0b35b3 100644 --- a/src/citra/citra.cpp +++ b/src/citra/citra.cpp | |||
| @@ -51,6 +51,8 @@ int __cdecl main(int argc, char **argv) { | |||
| 51 | Core::RunLoop(); | 51 | Core::RunLoop(); |
| 52 | } | 52 | } |
| 53 | 53 | ||
| 54 | System::Shutdown(); | ||
| 55 | |||
| 54 | delete emu_window; | 56 | delete emu_window; |
| 55 | 57 | ||
| 56 | return 0; | 58 | return 0; |
diff --git a/src/citra/default_ini.h b/src/citra/default_ini.h index f41020f7b..ebe2e9767 100644 --- a/src/citra/default_ini.h +++ b/src/citra/default_ini.h | |||
| @@ -27,7 +27,7 @@ pad_sleft = | |||
| 27 | pad_sright = | 27 | pad_sright = |
| 28 | 28 | ||
| 29 | [Core] | 29 | [Core] |
| 30 | cpu_core = ## 0: Interpreter (default), 1: FastInterpreter (experimental) | 30 | cpu_core = ## 0: Interpreter (default), 1: OldInterpreter (may work better, soon to be deprecated) |
| 31 | gpu_refresh_rate = ## 30 (default) | 31 | gpu_refresh_rate = ## 30 (default) |
| 32 | frame_skip = ## 0: No frameskip (default), 1 : 2x frameskip, 2 : 4x frameskip, etc. | 32 | frame_skip = ## 0: No frameskip (default), 1 : 2x frameskip, 2 : 4x frameskip, etc. |
| 33 | 33 | ||
diff --git a/src/citra_qt/bootmanager.cpp b/src/citra_qt/bootmanager.cpp index 6d08d6afc..e753ea108 100644 --- a/src/citra_qt/bootmanager.cpp +++ b/src/citra_qt/bootmanager.cpp | |||
| @@ -13,6 +13,7 @@ | |||
| 13 | 13 | ||
| 14 | #include "core/core.h" | 14 | #include "core/core.h" |
| 15 | #include "core/settings.h" | 15 | #include "core/settings.h" |
| 16 | #include "core/system.h" | ||
| 16 | 17 | ||
| 17 | #include "video_core/debug_utils/debug_utils.h" | 18 | #include "video_core/debug_utils/debug_utils.h" |
| 18 | 19 | ||
| @@ -89,6 +90,8 @@ void EmuThread::Stop() | |||
| 89 | } | 90 | } |
| 90 | } | 91 | } |
| 91 | LOG_INFO(Frontend, "EmuThread stopped"); | 92 | LOG_INFO(Frontend, "EmuThread stopped"); |
| 93 | |||
| 94 | System::Shutdown(); | ||
| 92 | } | 95 | } |
| 93 | 96 | ||
| 94 | 97 | ||
diff --git a/src/citra_qt/bootmanager.hxx b/src/citra_qt/bootmanager.hxx index 5f69f15ea..1c893384c 100644 --- a/src/citra_qt/bootmanager.hxx +++ b/src/citra_qt/bootmanager.hxx | |||
| @@ -1,3 +1,7 @@ | |||
| 1 | // Copyright 2014 Citra Emulator Project | ||
| 2 | // Licensed under GPLv2 or any later version | ||
| 3 | // Refer to the license.txt file included. | ||
| 4 | |||
| 1 | #include <atomic> | 5 | #include <atomic> |
| 2 | 6 | ||
| 3 | #include <QThread> | 7 | #include <QThread> |
diff --git a/src/citra_qt/config/controller_config.cpp b/src/citra_qt/config/controller_config.cpp index 52dfb627c..41000e29b 100644 --- a/src/citra_qt/config/controller_config.cpp +++ b/src/citra_qt/config/controller_config.cpp | |||
| @@ -1,3 +1,7 @@ | |||
| 1 | // Copyright 2014 Citra Emulator Project | ||
| 2 | // Licensed under GPLv2 or any later version | ||
| 3 | // Refer to the license.txt file included. | ||
| 4 | |||
| 1 | #include <QDialogButtonBox> | 5 | #include <QDialogButtonBox> |
| 2 | 6 | ||
| 3 | #include "controller_config.hxx" | 7 | #include "controller_config.hxx" |
diff --git a/src/citra_qt/config/controller_config.hxx b/src/citra_qt/config/controller_config.hxx index 0e423ee50..451593de1 100644 --- a/src/citra_qt/config/controller_config.hxx +++ b/src/citra_qt/config/controller_config.hxx | |||
| @@ -1,3 +1,7 @@ | |||
| 1 | // Copyright 2014 Citra Emulator Project | ||
| 2 | // Licensed under GPLv2 or any later version | ||
| 3 | // Refer to the license.txt file included. | ||
| 4 | |||
| 1 | #ifndef _CONTROLLER_CONFIG_HXX_ | 5 | #ifndef _CONTROLLER_CONFIG_HXX_ |
| 2 | #define _CONTROLLER_CONFIG_HXX_ | 6 | #define _CONTROLLER_CONFIG_HXX_ |
| 3 | 7 | ||
diff --git a/src/citra_qt/config/controller_config_util.cpp b/src/citra_qt/config/controller_config_util.cpp index aee3f8616..272e8d41e 100644 --- a/src/citra_qt/config/controller_config_util.cpp +++ b/src/citra_qt/config/controller_config_util.cpp | |||
| @@ -1,3 +1,7 @@ | |||
| 1 | // Copyright 2014 Citra Emulator Project | ||
| 2 | // Licensed under GPLv2 or any later version | ||
| 3 | // Refer to the license.txt file included. | ||
| 4 | |||
| 1 | #include <QPushButton> | 5 | #include <QPushButton> |
| 2 | #include <QStyle> | 6 | #include <QStyle> |
| 3 | #include <QGridLayout> | 7 | #include <QGridLayout> |
diff --git a/src/citra_qt/config/controller_config_util.hxx b/src/citra_qt/config/controller_config_util.hxx index af38f126c..15e025b57 100644 --- a/src/citra_qt/config/controller_config_util.hxx +++ b/src/citra_qt/config/controller_config_util.hxx | |||
| @@ -1,3 +1,7 @@ | |||
| 1 | // Copyright 2014 Citra Emulator Project | ||
| 2 | // Licensed under GPLv2 or any later version | ||
| 3 | // Refer to the license.txt file included. | ||
| 4 | |||
| 1 | #ifndef _CONTROLLER_CONFIG_UTIL_HXX_ | 5 | #ifndef _CONTROLLER_CONFIG_UTIL_HXX_ |
| 2 | #define _CONTROLLER_CONFIG_UTIL_HXX_ | 6 | #define _CONTROLLER_CONFIG_UTIL_HXX_ |
| 3 | 7 | ||
diff --git a/src/citra_qt/debugger/callstack.cpp b/src/citra_qt/debugger/callstack.cpp index 16c6113be..4a47ad468 100644 --- a/src/citra_qt/debugger/callstack.cpp +++ b/src/citra_qt/debugger/callstack.cpp | |||
| @@ -1,3 +1,7 @@ | |||
| 1 | // Copyright 2014 Citra Emulator Project | ||
| 2 | // Licensed under GPLv2 or any later version | ||
| 3 | // Refer to the license.txt file included. | ||
| 4 | |||
| 1 | #include <QStandardItemModel> | 5 | #include <QStandardItemModel> |
| 2 | 6 | ||
| 3 | #include "callstack.hxx" | 7 | #include "callstack.hxx" |
diff --git a/src/citra_qt/debugger/callstack.hxx b/src/citra_qt/debugger/callstack.hxx index 680a73b6d..4f4f74823 100644 --- a/src/citra_qt/debugger/callstack.hxx +++ b/src/citra_qt/debugger/callstack.hxx | |||
| @@ -1,3 +1,7 @@ | |||
| 1 | // Copyright 2014 Citra Emulator Project | ||
| 2 | // Licensed under GPLv2 or any later version | ||
| 3 | // Refer to the license.txt file included. | ||
| 4 | |||
| 1 | #include <QDockWidget> | 5 | #include <QDockWidget> |
| 2 | #include "ui_callstack.h" | 6 | #include "ui_callstack.h" |
| 3 | 7 | ||
diff --git a/src/citra_qt/debugger/disassembler.cpp b/src/citra_qt/debugger/disassembler.cpp index 14745f3bb..636a0f187 100644 --- a/src/citra_qt/debugger/disassembler.cpp +++ b/src/citra_qt/debugger/disassembler.cpp | |||
| @@ -1,3 +1,7 @@ | |||
| 1 | // Copyright 2014 Citra Emulator Project | ||
| 2 | // Licensed under GPLv2 or any later version | ||
| 3 | // Refer to the license.txt file included. | ||
| 4 | |||
| 1 | #include "disassembler.hxx" | 5 | #include "disassembler.hxx" |
| 2 | 6 | ||
| 3 | #include "../bootmanager.hxx" | 7 | #include "../bootmanager.hxx" |
diff --git a/src/citra_qt/debugger/disassembler.hxx b/src/citra_qt/debugger/disassembler.hxx index a842da956..6d3cef108 100644 --- a/src/citra_qt/debugger/disassembler.hxx +++ b/src/citra_qt/debugger/disassembler.hxx | |||
| @@ -1,3 +1,7 @@ | |||
| 1 | // Copyright 2014 Citra Emulator Project | ||
| 2 | // Licensed under GPLv2 or any later version | ||
| 3 | // Refer to the license.txt file included. | ||
| 4 | |||
| 1 | #include <QAbstractItemModel> | 5 | #include <QAbstractItemModel> |
| 2 | #include <QDockWidget> | 6 | #include <QDockWidget> |
| 3 | #include "ui_disassembler.h" | 7 | #include "ui_disassembler.h" |
diff --git a/src/citra_qt/debugger/graphics_cmdlists.cpp b/src/citra_qt/debugger/graphics_cmdlists.cpp index 753cc25da..708b805a7 100644 --- a/src/citra_qt/debugger/graphics_cmdlists.cpp +++ b/src/citra_qt/debugger/graphics_cmdlists.cpp | |||
| @@ -229,7 +229,7 @@ void GPUCommandListModel::OnPicaTraceFinished(const Pica::DebugUtils::PicaTrace& | |||
| 229 | cmd_id < PICA_REG_INDEX(reg_name) + sizeof(decltype(Pica::registers.reg_name)) / 4) | 229 | cmd_id < PICA_REG_INDEX(reg_name) + sizeof(decltype(Pica::registers.reg_name)) / 4) |
| 230 | 230 | ||
| 231 | void GPUCommandListWidget::OnCommandDoubleClicked(const QModelIndex& index) { | 231 | void GPUCommandListWidget::OnCommandDoubleClicked(const QModelIndex& index) { |
| 232 | const int command_id = list_widget->model()->data(index, GPUCommandListModel::CommandIdRole).toInt(); | 232 | const unsigned int command_id = list_widget->model()->data(index, GPUCommandListModel::CommandIdRole).toUInt(); |
| 233 | if (COMMAND_IN_RANGE(command_id, texture0) || | 233 | if (COMMAND_IN_RANGE(command_id, texture0) || |
| 234 | COMMAND_IN_RANGE(command_id, texture1) || | 234 | COMMAND_IN_RANGE(command_id, texture1) || |
| 235 | COMMAND_IN_RANGE(command_id, texture2)) { | 235 | COMMAND_IN_RANGE(command_id, texture2)) { |
| @@ -255,7 +255,7 @@ void GPUCommandListWidget::OnCommandDoubleClicked(const QModelIndex& index) { | |||
| 255 | void GPUCommandListWidget::SetCommandInfo(const QModelIndex& index) { | 255 | void GPUCommandListWidget::SetCommandInfo(const QModelIndex& index) { |
| 256 | QWidget* new_info_widget; | 256 | QWidget* new_info_widget; |
| 257 | 257 | ||
| 258 | const int command_id = list_widget->model()->data(index, GPUCommandListModel::CommandIdRole).toInt(); | 258 | const unsigned int command_id = list_widget->model()->data(index, GPUCommandListModel::CommandIdRole).toUInt(); |
| 259 | if (COMMAND_IN_RANGE(command_id, texture0) || | 259 | if (COMMAND_IN_RANGE(command_id, texture0) || |
| 260 | COMMAND_IN_RANGE(command_id, texture1) || | 260 | COMMAND_IN_RANGE(command_id, texture1) || |
| 261 | COMMAND_IN_RANGE(command_id, texture2)) { | 261 | COMMAND_IN_RANGE(command_id, texture2)) { |
diff --git a/src/citra_qt/debugger/graphics_framebuffer.cpp b/src/citra_qt/debugger/graphics_framebuffer.cpp index a9e9de652..7ef699f37 100644 --- a/src/citra_qt/debugger/graphics_framebuffer.cpp +++ b/src/citra_qt/debugger/graphics_framebuffer.cpp | |||
| @@ -158,7 +158,7 @@ void GraphicsFramebufferWidget::OnFramebufferAddressChanged(qint64 new_value) | |||
| 158 | } | 158 | } |
| 159 | } | 159 | } |
| 160 | 160 | ||
| 161 | void GraphicsFramebufferWidget::OnFramebufferWidthChanged(int new_value) | 161 | void GraphicsFramebufferWidget::OnFramebufferWidthChanged(unsigned int new_value) |
| 162 | { | 162 | { |
| 163 | if (framebuffer_width != new_value) { | 163 | if (framebuffer_width != new_value) { |
| 164 | framebuffer_width = new_value; | 164 | framebuffer_width = new_value; |
| @@ -168,7 +168,7 @@ void GraphicsFramebufferWidget::OnFramebufferWidthChanged(int new_value) | |||
| 168 | } | 168 | } |
| 169 | } | 169 | } |
| 170 | 170 | ||
| 171 | void GraphicsFramebufferWidget::OnFramebufferHeightChanged(int new_value) | 171 | void GraphicsFramebufferWidget::OnFramebufferHeightChanged(unsigned int new_value) |
| 172 | { | 172 | { |
| 173 | if (framebuffer_height != new_value) { | 173 | if (framebuffer_height != new_value) { |
| 174 | framebuffer_height = new_value; | 174 | framebuffer_height = new_value; |
| @@ -227,8 +227,8 @@ void GraphicsFramebufferWidget::OnUpdate() | |||
| 227 | { | 227 | { |
| 228 | QImage decoded_image(framebuffer_width, framebuffer_height, QImage::Format_ARGB32); | 228 | QImage decoded_image(framebuffer_width, framebuffer_height, QImage::Format_ARGB32); |
| 229 | u32* color_buffer = (u32*)Memory::GetPointer(Pica::PAddrToVAddr(framebuffer_address)); | 229 | u32* color_buffer = (u32*)Memory::GetPointer(Pica::PAddrToVAddr(framebuffer_address)); |
| 230 | for (unsigned y = 0; y < framebuffer_height; ++y) { | 230 | for (unsigned int y = 0; y < framebuffer_height; ++y) { |
| 231 | for (unsigned x = 0; x < framebuffer_width; ++x) { | 231 | for (unsigned int x = 0; x < framebuffer_width; ++x) { |
| 232 | u32 value = *(color_buffer + x + y * framebuffer_width); | 232 | u32 value = *(color_buffer + x + y * framebuffer_width); |
| 233 | 233 | ||
| 234 | decoded_image.setPixel(x, y, qRgba((value >> 16) & 0xFF, (value >> 8) & 0xFF, value & 0xFF, 255/*value >> 24*/)); | 234 | decoded_image.setPixel(x, y, qRgba((value >> 16) & 0xFF, (value >> 8) & 0xFF, value & 0xFF, 255/*value >> 24*/)); |
| @@ -242,8 +242,8 @@ void GraphicsFramebufferWidget::OnUpdate() | |||
| 242 | { | 242 | { |
| 243 | QImage decoded_image(framebuffer_width, framebuffer_height, QImage::Format_ARGB32); | 243 | QImage decoded_image(framebuffer_width, framebuffer_height, QImage::Format_ARGB32); |
| 244 | u8* color_buffer = Memory::GetPointer(Pica::PAddrToVAddr(framebuffer_address)); | 244 | u8* color_buffer = Memory::GetPointer(Pica::PAddrToVAddr(framebuffer_address)); |
| 245 | for (unsigned y = 0; y < framebuffer_height; ++y) { | 245 | for (unsigned int y = 0; y < framebuffer_height; ++y) { |
| 246 | for (unsigned x = 0; x < framebuffer_width; ++x) { | 246 | for (unsigned int x = 0; x < framebuffer_width; ++x) { |
| 247 | u8* pixel_pointer = color_buffer + x * 3 + y * 3 * framebuffer_width; | 247 | u8* pixel_pointer = color_buffer + x * 3 + y * 3 * framebuffer_width; |
| 248 | 248 | ||
| 249 | decoded_image.setPixel(x, y, qRgba(pixel_pointer[0], pixel_pointer[1], pixel_pointer[2], 255/*value >> 24*/)); | 249 | decoded_image.setPixel(x, y, qRgba(pixel_pointer[0], pixel_pointer[1], pixel_pointer[2], 255/*value >> 24*/)); |
| @@ -257,8 +257,8 @@ void GraphicsFramebufferWidget::OnUpdate() | |||
| 257 | { | 257 | { |
| 258 | QImage decoded_image(framebuffer_width, framebuffer_height, QImage::Format_ARGB32); | 258 | QImage decoded_image(framebuffer_width, framebuffer_height, QImage::Format_ARGB32); |
| 259 | u32* color_buffer = (u32*)Memory::GetPointer(Pica::PAddrToVAddr(framebuffer_address)); | 259 | u32* color_buffer = (u32*)Memory::GetPointer(Pica::PAddrToVAddr(framebuffer_address)); |
| 260 | for (unsigned y = 0; y < framebuffer_height; ++y) { | 260 | for (unsigned int y = 0; y < framebuffer_height; ++y) { |
| 261 | for (unsigned x = 0; x < framebuffer_width; ++x) { | 261 | for (unsigned int x = 0; x < framebuffer_width; ++x) { |
| 262 | u16 value = *(u16*)(((u8*)color_buffer) + x * 2 + y * framebuffer_width * 2); | 262 | u16 value = *(u16*)(((u8*)color_buffer) + x * 2 + y * framebuffer_width * 2); |
| 263 | u8 r = Color::Convert5To8((value >> 11) & 0x1F); | 263 | u8 r = Color::Convert5To8((value >> 11) & 0x1F); |
| 264 | u8 g = Color::Convert5To8((value >> 6) & 0x1F); | 264 | u8 g = Color::Convert5To8((value >> 6) & 0x1F); |
diff --git a/src/citra_qt/debugger/graphics_framebuffer.hxx b/src/citra_qt/debugger/graphics_framebuffer.hxx index 56215761e..02813525c 100644 --- a/src/citra_qt/debugger/graphics_framebuffer.hxx +++ b/src/citra_qt/debugger/graphics_framebuffer.hxx | |||
| @@ -62,8 +62,8 @@ public: | |||
| 62 | public slots: | 62 | public slots: |
| 63 | void OnFramebufferSourceChanged(int new_value); | 63 | void OnFramebufferSourceChanged(int new_value); |
| 64 | void OnFramebufferAddressChanged(qint64 new_value); | 64 | void OnFramebufferAddressChanged(qint64 new_value); |
| 65 | void OnFramebufferWidthChanged(int new_value); | 65 | void OnFramebufferWidthChanged(unsigned int new_value); |
| 66 | void OnFramebufferHeightChanged(int new_value); | 66 | void OnFramebufferHeightChanged(unsigned int new_value); |
| 67 | void OnFramebufferFormatChanged(int new_value); | 67 | void OnFramebufferFormatChanged(int new_value); |
| 68 | void OnUpdate(); | 68 | void OnUpdate(); |
| 69 | 69 | ||
diff --git a/src/citra_qt/debugger/ramview.cpp b/src/citra_qt/debugger/ramview.cpp index 3f899b95e..d3ff69a61 100644 --- a/src/citra_qt/debugger/ramview.cpp +++ b/src/citra_qt/debugger/ramview.cpp | |||
| @@ -1,3 +1,7 @@ | |||
| 1 | // Copyright 2014 Citra Emulator Project | ||
| 2 | // Licensed under GPLv2 or any later version | ||
| 3 | // Refer to the license.txt file included. | ||
| 4 | |||
| 1 | #include "ramview.hxx" | 5 | #include "ramview.hxx" |
| 2 | 6 | ||
| 3 | #include "common/common.h" | 7 | #include "common/common.h" |
diff --git a/src/citra_qt/debugger/ramview.hxx b/src/citra_qt/debugger/ramview.hxx index 1db1546aa..18423036f 100644 --- a/src/citra_qt/debugger/ramview.hxx +++ b/src/citra_qt/debugger/ramview.hxx | |||
| @@ -1,3 +1,7 @@ | |||
| 1 | // Copyright 2014 Citra Emulator Project | ||
| 2 | // Licensed under GPLv2 or any later version | ||
| 3 | // Refer to the license.txt file included. | ||
| 4 | |||
| 1 | #include "qhexedit.h" | 5 | #include "qhexedit.h" |
| 2 | 6 | ||
| 3 | class GRamView : public QHexEdit | 7 | class GRamView : public QHexEdit |
diff --git a/src/citra_qt/debugger/registers.cpp b/src/citra_qt/debugger/registers.cpp index ed17ee4b4..f798495b2 100644 --- a/src/citra_qt/debugger/registers.cpp +++ b/src/citra_qt/debugger/registers.cpp | |||
| @@ -1,3 +1,7 @@ | |||
| 1 | // Copyright 2014 Citra Emulator Project | ||
| 2 | // Licensed under GPLv2 or any later version | ||
| 3 | // Refer to the license.txt file included. | ||
| 4 | |||
| 1 | #include "registers.hxx" | 5 | #include "registers.hxx" |
| 2 | 6 | ||
| 3 | #include "core/core.h" | 7 | #include "core/core.h" |
diff --git a/src/citra_qt/debugger/registers.hxx b/src/citra_qt/debugger/registers.hxx index 4cca957ce..ac8429f2b 100644 --- a/src/citra_qt/debugger/registers.hxx +++ b/src/citra_qt/debugger/registers.hxx | |||
| @@ -1,3 +1,7 @@ | |||
| 1 | // Copyright 2014 Citra Emulator Project | ||
| 2 | // Licensed under GPLv2 or any later version | ||
| 3 | // Refer to the license.txt file included. | ||
| 4 | |||
| 1 | #include "ui_registers.h" | 5 | #include "ui_registers.h" |
| 2 | 6 | ||
| 3 | #include <QDockWidget> | 7 | #include <QDockWidget> |
diff --git a/src/citra_qt/hotkeys.cpp b/src/citra_qt/hotkeys.cpp index 5d0b52e4f..08be7ff74 100644 --- a/src/citra_qt/hotkeys.cpp +++ b/src/citra_qt/hotkeys.cpp | |||
| @@ -1,3 +1,7 @@ | |||
| 1 | // Copyright 2014 Citra Emulator Project | ||
| 2 | // Licensed under GPLv2 or any later version | ||
| 3 | // Refer to the license.txt file included. | ||
| 4 | |||
| 1 | #include <QKeySequence> | 5 | #include <QKeySequence> |
| 2 | #include <QSettings> | 6 | #include <QSettings> |
| 3 | #include "hotkeys.hxx" | 7 | #include "hotkeys.hxx" |
diff --git a/src/citra_qt/hotkeys.hxx b/src/citra_qt/hotkeys.hxx index 66ef7bb4e..75c7cc625 100644 --- a/src/citra_qt/hotkeys.hxx +++ b/src/citra_qt/hotkeys.hxx | |||
| @@ -1,3 +1,7 @@ | |||
| 1 | // Copyright 2014 Citra Emulator Project | ||
| 2 | // Licensed under GPLv2 or any later version | ||
| 3 | // Refer to the license.txt file included. | ||
| 4 | |||
| 1 | #include <QShortcut> | 5 | #include <QShortcut> |
| 2 | #include <QDialog> | 6 | #include <QDialog> |
| 3 | #include "ui_hotkeys.h" | 7 | #include "ui_hotkeys.h" |
diff --git a/src/citra_qt/main.cpp b/src/citra_qt/main.cpp index 5864f1f9d..64e389f25 100644 --- a/src/citra_qt/main.cpp +++ b/src/citra_qt/main.cpp | |||
| @@ -1,3 +1,7 @@ | |||
| 1 | // Copyright 2014 Citra Emulator Project | ||
| 2 | // Licensed under GPLv2 or any later version | ||
| 3 | // Refer to the license.txt file included. | ||
| 4 | |||
| 1 | #include <thread> | 5 | #include <thread> |
| 2 | 6 | ||
| 3 | #include <QtGui> | 7 | #include <QtGui> |
| @@ -175,7 +179,7 @@ void GMainWindow::BootGame(std::string filename) | |||
| 175 | 179 | ||
| 176 | void GMainWindow::OnMenuLoadFile() | 180 | void GMainWindow::OnMenuLoadFile() |
| 177 | { | 181 | { |
| 178 | QString filename = QFileDialog::getOpenFileName(this, tr("Load File"), QString(), tr("3DS executable (*.3dsx *.elf *.axf *.bin *.cci *.cxi)")); | 182 | QString filename = QFileDialog::getOpenFileName(this, tr("Load File"), QString(), tr("3DS executable (*.3ds *.3dsx *.elf *.axf *.bin *.cci *.cxi)")); |
| 179 | if (filename.size()) | 183 | if (filename.size()) |
| 180 | BootGame(filename.toLatin1().data()); | 184 | BootGame(filename.toLatin1().data()); |
| 181 | } | 185 | } |
diff --git a/src/citra_qt/main.hxx b/src/citra_qt/main.hxx index b1b40df46..72df17c50 100644 --- a/src/citra_qt/main.hxx +++ b/src/citra_qt/main.hxx | |||
| @@ -1,3 +1,7 @@ | |||
| 1 | // Copyright 2014 Citra Emulator Project | ||
| 2 | // Licensed under GPLv2 or any later version | ||
| 3 | // Refer to the license.txt file included. | ||
| 4 | |||
| 1 | #ifndef _CITRA_QT_MAIN_HXX_ | 5 | #ifndef _CITRA_QT_MAIN_HXX_ |
| 2 | #define _CITRA_QT_MAIN_HXX_ | 6 | #define _CITRA_QT_MAIN_HXX_ |
| 3 | 7 | ||
diff --git a/src/citra_qt/version.h b/src/citra_qt/version.h index 07022de5c..9d5a2b1a2 100644 --- a/src/citra_qt/version.h +++ b/src/citra_qt/version.h | |||
| @@ -1,3 +1,7 @@ | |||
| 1 | // Copyright 2014 Citra Emulator Project | ||
| 2 | // Licensed under GPLv2 or any later version | ||
| 3 | // Refer to the license.txt file included. | ||
| 4 | |||
| 1 | // TODO: Supposed to be generated... | 5 | // TODO: Supposed to be generated... |
| 2 | // GENERATED - Do not edit! | 6 | // GENERATED - Do not edit! |
| 3 | #ifndef VERSION_H_ | 7 | #ifndef VERSION_H_ |
diff --git a/src/common/common_types.h b/src/common/common_types.h index c74c74f0f..94e1406b1 100644 --- a/src/common/common_types.h +++ b/src/common/common_types.h | |||
| @@ -26,7 +26,7 @@ | |||
| 26 | 26 | ||
| 27 | #include <cmath> | 27 | #include <cmath> |
| 28 | #include <cstdint> | 28 | #include <cstdint> |
| 29 | #include <xmmintrin.h> // data_types__m128.cpp | 29 | #include <cstdlib> |
| 30 | 30 | ||
| 31 | typedef std::uint8_t u8; ///< 8-bit unsigned byte | 31 | typedef std::uint8_t u8; ///< 8-bit unsigned byte |
| 32 | typedef std::uint16_t u16; ///< 16-bit unsigned short | 32 | typedef std::uint16_t u16; ///< 16-bit unsigned short |
| @@ -67,16 +67,6 @@ union t64 { | |||
| 67 | u8 _u8[8]; ///< 8-bit unsigned char(s) | 67 | u8 _u8[8]; ///< 8-bit unsigned char(s) |
| 68 | }; | 68 | }; |
| 69 | 69 | ||
| 70 | /// Union for fast 128-bit type casting | ||
| 71 | union t128 { | ||
| 72 | struct | ||
| 73 | { | ||
| 74 | t64 ps0; ///< 64-bit paired single 0 | ||
| 75 | t64 ps1; ///< 64-bit paired single 1 | ||
| 76 | }; | ||
| 77 | __m128 a; ///< 128-bit floating point (__m128 maps to the XMM[0-7] registers) | ||
| 78 | }; | ||
| 79 | |||
| 80 | namespace Common { | 70 | namespace Common { |
| 81 | /// Rectangle data structure | 71 | /// Rectangle data structure |
| 82 | class Rect { | 72 | class Rect { |
| @@ -94,8 +84,8 @@ public: | |||
| 94 | int x1_; ///< Rect bottom left X-coordinate | 84 | int x1_; ///< Rect bottom left X-coordinate |
| 95 | int y1_; ///< Rect bottom right Y-coordinate | 85 | int y1_; ///< Rect bottom right Y-coordinate |
| 96 | 86 | ||
| 97 | inline u32 width() const { return abs(x1_ - x0_); } | 87 | inline u32 width() const { return std::abs(x1_ - x0_); } |
| 98 | inline u32 height() const { return abs(y1_ - y0_); } | 88 | inline u32 height() const { return std::abs(y1_ - y0_); } |
| 99 | 89 | ||
| 100 | inline bool operator == (const Rect& val) const { | 90 | inline bool operator == (const Rect& val) const { |
| 101 | return (x0_ == val.x0_ && y0_ == val.y0_ && x1_ == val.x1_ && y1_ == val.y1_); | 91 | return (x0_ == val.x0_ && y0_ == val.y0_ && x1_ == val.x1_ && y1_ == val.y1_); |
diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt index addcb953c..b67226d8d 100644 --- a/src/core/CMakeLists.txt +++ b/src/core/CMakeLists.txt | |||
| @@ -66,6 +66,7 @@ set(SRCS | |||
| 66 | hle/service/soc_u.cpp | 66 | hle/service/soc_u.cpp |
| 67 | hle/service/srv.cpp | 67 | hle/service/srv.cpp |
| 68 | hle/service/ssl_c.cpp | 68 | hle/service/ssl_c.cpp |
| 69 | hle/service/y2r_u.cpp | ||
| 69 | hle/config_mem.cpp | 70 | hle/config_mem.cpp |
| 70 | hle/hle.cpp | 71 | hle/hle.cpp |
| 71 | hle/svc.cpp | 72 | hle/svc.cpp |
| @@ -157,6 +158,7 @@ set(HEADERS | |||
| 157 | hle/service/soc_u.h | 158 | hle/service/soc_u.h |
| 158 | hle/service/srv.h | 159 | hle/service/srv.h |
| 159 | hle/service/ssl_c.h | 160 | hle/service/ssl_c.h |
| 161 | hle/service/y2r_u.h | ||
| 160 | hle/config_mem.h | 162 | hle/config_mem.h |
| 161 | hle/result.h | 163 | hle/result.h |
| 162 | hle/function_wrappers.h | 164 | hle/function_wrappers.h |
diff --git a/src/core/arm/dyncom/arm_dyncom_interpreter.cpp b/src/core/arm/dyncom/arm_dyncom_interpreter.cpp index ba23ef383..9b291862c 100644 --- a/src/core/arm/dyncom/arm_dyncom_interpreter.cpp +++ b/src/core/arm/dyncom/arm_dyncom_interpreter.cpp | |||
| @@ -1083,7 +1083,7 @@ typedef struct _cdp_inst { | |||
| 1083 | unsigned int cp_num; | 1083 | unsigned int cp_num; |
| 1084 | unsigned int opcode_2; | 1084 | unsigned int opcode_2; |
| 1085 | unsigned int CRm; | 1085 | unsigned int CRm; |
| 1086 | uint32 inst; | 1086 | unsigned int inst; |
| 1087 | }cdp_inst; | 1087 | }cdp_inst; |
| 1088 | 1088 | ||
| 1089 | typedef struct _uxtb_inst { | 1089 | typedef struct _uxtb_inst { |
| @@ -1423,15 +1423,19 @@ ARM_INST_PTR INTERPRETER_TRANSLATE(bx)(unsigned int inst, int index) | |||
| 1423 | arm_inst *inst_base = (arm_inst *)AllocBuffer(sizeof(arm_inst) + sizeof(bx_inst)); | 1423 | arm_inst *inst_base = (arm_inst *)AllocBuffer(sizeof(arm_inst) + sizeof(bx_inst)); |
| 1424 | bx_inst *inst_cream = (bx_inst *)inst_base->component; | 1424 | bx_inst *inst_cream = (bx_inst *)inst_base->component; |
| 1425 | 1425 | ||
| 1426 | inst_base->cond = BITS(inst, 28, 31); | 1426 | inst_base->cond = BITS(inst, 28, 31); |
| 1427 | inst_base->idx = index; | 1427 | inst_base->idx = index; |
| 1428 | inst_base->br = INDIRECT_BRANCH; | 1428 | inst_base->br = INDIRECT_BRANCH; |
| 1429 | 1429 | ||
| 1430 | inst_cream->Rm = BITS(inst, 0, 3); | 1430 | inst_cream->Rm = BITS(inst, 0, 3); |
| 1431 | 1431 | ||
| 1432 | return inst_base; | 1432 | return inst_base; |
| 1433 | } | 1433 | } |
| 1434 | ARM_INST_PTR INTERPRETER_TRANSLATE(bxj)(unsigned int inst, int index) { UNIMPLEMENTED_INSTRUCTION("BXJ"); } | 1434 | ARM_INST_PTR INTERPRETER_TRANSLATE(bxj)(unsigned int inst, int index) |
| 1435 | { | ||
| 1436 | return INTERPRETER_TRANSLATE(bx)(inst, index); | ||
| 1437 | } | ||
| 1438 | |||
| 1435 | ARM_INST_PTR INTERPRETER_TRANSLATE(cdp)(unsigned int inst, int index){ | 1439 | ARM_INST_PTR INTERPRETER_TRANSLATE(cdp)(unsigned int inst, int index){ |
| 1436 | arm_inst *inst_base = (arm_inst *)AllocBuffer(sizeof(arm_inst) + sizeof(cdp_inst)); | 1440 | arm_inst *inst_base = (arm_inst *)AllocBuffer(sizeof(arm_inst) + sizeof(cdp_inst)); |
| 1437 | cdp_inst *inst_cream = (cdp_inst *)inst_base->component; | 1441 | cdp_inst *inst_cream = (cdp_inst *)inst_base->component; |
| @@ -2057,7 +2061,37 @@ ARM_INST_PTR INTERPRETER_TRANSLATE(pld)(unsigned int inst, int index) | |||
| 2057 | 2061 | ||
| 2058 | return inst_base; | 2062 | return inst_base; |
| 2059 | } | 2063 | } |
| 2060 | ARM_INST_PTR INTERPRETER_TRANSLATE(qadd)(unsigned int inst, int index) { UNIMPLEMENTED_INSTRUCTION("QADD"); } | 2064 | |
| 2065 | ARM_INST_PTR INTERPRETER_TRANSLATE(qadd)(unsigned int inst, int index) | ||
| 2066 | { | ||
| 2067 | arm_inst* const inst_base = (arm_inst*)AllocBuffer(sizeof(arm_inst) + sizeof(generic_arm_inst)); | ||
| 2068 | generic_arm_inst* const inst_cream = (generic_arm_inst*)inst_base->component; | ||
| 2069 | |||
| 2070 | inst_base->cond = BITS(inst, 28, 31); | ||
| 2071 | inst_base->idx = index; | ||
| 2072 | inst_base->br = NON_BRANCH; | ||
| 2073 | inst_base->load_r15 = 0; | ||
| 2074 | |||
| 2075 | inst_cream->op1 = BITS(inst, 21, 22); | ||
| 2076 | inst_cream->Rm = BITS(inst, 0, 3); | ||
| 2077 | inst_cream->Rn = BITS(inst, 16, 19); | ||
| 2078 | inst_cream->Rd = BITS(inst, 12, 15); | ||
| 2079 | |||
| 2080 | return inst_base; | ||
| 2081 | } | ||
| 2082 | ARM_INST_PTR INTERPRETER_TRANSLATE(qdadd)(unsigned int inst, int index) | ||
| 2083 | { | ||
| 2084 | return INTERPRETER_TRANSLATE(qadd)(inst, index); | ||
| 2085 | } | ||
| 2086 | ARM_INST_PTR INTERPRETER_TRANSLATE(qdsub)(unsigned int inst, int index) | ||
| 2087 | { | ||
| 2088 | return INTERPRETER_TRANSLATE(qadd)(inst, index); | ||
| 2089 | } | ||
| 2090 | ARM_INST_PTR INTERPRETER_TRANSLATE(qsub)(unsigned int inst, int index) | ||
| 2091 | { | ||
| 2092 | return INTERPRETER_TRANSLATE(qadd)(inst, index); | ||
| 2093 | } | ||
| 2094 | |||
| 2061 | ARM_INST_PTR INTERPRETER_TRANSLATE(qadd8)(unsigned int inst, int index) | 2095 | ARM_INST_PTR INTERPRETER_TRANSLATE(qadd8)(unsigned int inst, int index) |
| 2062 | { | 2096 | { |
| 2063 | arm_inst* const inst_base = (arm_inst*)AllocBuffer(sizeof(arm_inst) + sizeof(generic_arm_inst)); | 2097 | arm_inst* const inst_base = (arm_inst*)AllocBuffer(sizeof(arm_inst) + sizeof(generic_arm_inst)); |
| @@ -2084,9 +2118,6 @@ ARM_INST_PTR INTERPRETER_TRANSLATE(qaddsubx)(unsigned int inst, int index) | |||
| 2084 | { | 2118 | { |
| 2085 | return INTERPRETER_TRANSLATE(qadd8)(inst, index); | 2119 | return INTERPRETER_TRANSLATE(qadd8)(inst, index); |
| 2086 | } | 2120 | } |
| 2087 | ARM_INST_PTR INTERPRETER_TRANSLATE(qdadd)(unsigned int inst, int index) { UNIMPLEMENTED_INSTRUCTION("QDADD"); } | ||
| 2088 | ARM_INST_PTR INTERPRETER_TRANSLATE(qdsub)(unsigned int inst, int index) { UNIMPLEMENTED_INSTRUCTION("QDSUB"); } | ||
| 2089 | ARM_INST_PTR INTERPRETER_TRANSLATE(qsub)(unsigned int inst, int index) { UNIMPLEMENTED_INSTRUCTION("QSUB"); } | ||
| 2090 | ARM_INST_PTR INTERPRETER_TRANSLATE(qsub8)(unsigned int inst, int index) | 2121 | ARM_INST_PTR INTERPRETER_TRANSLATE(qsub8)(unsigned int inst, int index) |
| 2091 | { | 2122 | { |
| 2092 | return INTERPRETER_TRANSLATE(qadd8)(inst, index); | 2123 | return INTERPRETER_TRANSLATE(qadd8)(inst, index); |
| @@ -2373,7 +2404,25 @@ ARM_INST_PTR INTERPRETER_TRANSLATE(smlal)(unsigned int inst, int index) | |||
| 2373 | } | 2404 | } |
| 2374 | 2405 | ||
| 2375 | ARM_INST_PTR INTERPRETER_TRANSLATE(smlalxy)(unsigned int inst, int index) { UNIMPLEMENTED_INSTRUCTION("SMLALXY"); } | 2406 | ARM_INST_PTR INTERPRETER_TRANSLATE(smlalxy)(unsigned int inst, int index) { UNIMPLEMENTED_INSTRUCTION("SMLALXY"); } |
| 2376 | ARM_INST_PTR INTERPRETER_TRANSLATE(smlaw)(unsigned int inst, int index) { UNIMPLEMENTED_INSTRUCTION("SMLAW"); } | 2407 | |
| 2408 | ARM_INST_PTR INTERPRETER_TRANSLATE(smlaw)(unsigned int inst, int index) | ||
| 2409 | { | ||
| 2410 | arm_inst* const inst_base = (arm_inst*)AllocBuffer(sizeof(arm_inst) + sizeof(smlad_inst)); | ||
| 2411 | smlad_inst* const inst_cream = (smlad_inst*)inst_base->component; | ||
| 2412 | |||
| 2413 | inst_base->cond = BITS(inst, 28, 31); | ||
| 2414 | inst_base->idx = index; | ||
| 2415 | inst_base->br = NON_BRANCH; | ||
| 2416 | inst_base->load_r15 = 0; | ||
| 2417 | |||
| 2418 | inst_cream->Ra = BITS(inst, 12, 15); | ||
| 2419 | inst_cream->Rm = BITS(inst, 8, 11); | ||
| 2420 | inst_cream->Rn = BITS(inst, 0, 3); | ||
| 2421 | inst_cream->Rd = BITS(inst, 16, 19); | ||
| 2422 | inst_cream->m = BIT(inst, 6); | ||
| 2423 | |||
| 2424 | return inst_base; | ||
| 2425 | } | ||
| 2377 | 2426 | ||
| 2378 | ARM_INST_PTR INTERPRETER_TRANSLATE(smlald)(unsigned int inst, int index) | 2427 | ARM_INST_PTR INTERPRETER_TRANSLATE(smlald)(unsigned int inst, int index) |
| 2379 | { | 2428 | { |
| @@ -3444,7 +3493,7 @@ static tdstate decode_thumb_instr(arm_processor *cpu, uint32_t inst, addr_t addr | |||
| 3444 | tdstate ret = thumb_translate (addr, inst, arm_inst, inst_size); | 3493 | tdstate ret = thumb_translate (addr, inst, arm_inst, inst_size); |
| 3445 | if(ret == t_branch){ | 3494 | if(ret == t_branch){ |
| 3446 | // TODO: FIXME, endian should be judged | 3495 | // TODO: FIXME, endian should be judged |
| 3447 | uint32 tinstr; | 3496 | u32 tinstr; |
| 3448 | if((addr & 0x3) != 0) | 3497 | if((addr & 0x3) != 0) |
| 3449 | tinstr = inst >> 16; | 3498 | tinstr = inst >> 16; |
| 3450 | else | 3499 | else |
| @@ -3457,7 +3506,7 @@ static tdstate decode_thumb_instr(arm_processor *cpu, uint32_t inst, addr_t addr | |||
| 3457 | case 26: | 3506 | case 26: |
| 3458 | case 27: | 3507 | case 27: |
| 3459 | if (((tinstr & 0x0F00) != 0x0E00) && ((tinstr & 0x0F00) != 0x0F00)){ | 3508 | if (((tinstr & 0x0F00) != 0x0E00) && ((tinstr & 0x0F00) != 0x0F00)){ |
| 3460 | uint32 cond = (tinstr & 0x0F00) >> 8; | 3509 | u32 cond = (tinstr & 0x0F00) >> 8; |
| 3461 | inst_index = table_length - 4; | 3510 | inst_index = table_length - 4; |
| 3462 | *ptr_inst_base = arm_instruction_trans[inst_index](tinstr, inst_index); | 3511 | *ptr_inst_base = arm_instruction_trans[inst_index](tinstr, inst_index); |
| 3463 | } else { | 3512 | } else { |
| @@ -4088,22 +4137,35 @@ unsigned InterpreterMainLoop(ARMul_State* state) { | |||
| 4088 | INC_PC(sizeof(blx_inst)); | 4137 | INC_PC(sizeof(blx_inst)); |
| 4089 | goto DISPATCH; | 4138 | goto DISPATCH; |
| 4090 | } | 4139 | } |
| 4140 | |||
| 4091 | BX_INST: | 4141 | BX_INST: |
| 4142 | BXJ_INST: | ||
| 4092 | { | 4143 | { |
| 4093 | bx_inst *inst_cream = (bx_inst *)inst_base->component; | 4144 | // Note that only the 'fail' case of BXJ is emulated. This is because |
| 4094 | if ((inst_base->cond == 0xe) || CondPassed(cpu, inst_base->cond)) { | 4145 | // the facilities for Jazelle emulation are not implemented. |
| 4146 | // | ||
| 4147 | // According to the ARM documentation on BXJ, if setting the J bit in the APSR | ||
| 4148 | // fails, then BXJ functions identically like a regular BX instruction. | ||
| 4149 | // | ||
| 4150 | // This is sufficient for citra, as the CPU for the 3DS does not implement Jazelle. | ||
| 4151 | |||
| 4152 | if (inst_base->cond == 0xE || CondPassed(cpu, inst_base->cond)) { | ||
| 4153 | bx_inst* const inst_cream = (bx_inst*)inst_base->component; | ||
| 4154 | |||
| 4095 | if (inst_cream->Rm == 15) | 4155 | if (inst_cream->Rm == 15) |
| 4096 | LOG_WARNING(Core_ARM11, "BX at pc %x: use of Rm = R15 is discouraged", cpu->Reg[15]); | 4156 | LOG_WARNING(Core_ARM11, "BX at pc %x: use of Rm = R15 is discouraged", cpu->Reg[15]); |
| 4157 | |||
| 4097 | cpu->TFlag = cpu->Reg[inst_cream->Rm] & 0x1; | 4158 | cpu->TFlag = cpu->Reg[inst_cream->Rm] & 0x1; |
| 4098 | cpu->Reg[15] = cpu->Reg[inst_cream->Rm] & 0xfffffffe; | 4159 | cpu->Reg[15] = cpu->Reg[inst_cream->Rm] & 0xfffffffe; |
| 4099 | INC_PC(sizeof(bx_inst)); | 4160 | INC_PC(sizeof(bx_inst)); |
| 4100 | goto DISPATCH; | 4161 | goto DISPATCH; |
| 4101 | } | 4162 | } |
| 4163 | |||
| 4102 | cpu->Reg[15] += GET_INST_SIZE(cpu); | 4164 | cpu->Reg[15] += GET_INST_SIZE(cpu); |
| 4103 | INC_PC(sizeof(bx_inst)); | 4165 | INC_PC(sizeof(bx_inst)); |
| 4104 | goto DISPATCH; | 4166 | goto DISPATCH; |
| 4105 | } | 4167 | } |
| 4106 | BXJ_INST: | 4168 | |
| 4107 | CDP_INST: | 4169 | CDP_INST: |
| 4108 | { | 4170 | { |
| 4109 | cdp_inst *inst_cream = (cdp_inst *)inst_base->component; | 4171 | cdp_inst *inst_cream = (cdp_inst *)inst_base->component; |
| @@ -5027,6 +5089,78 @@ unsigned InterpreterMainLoop(ARMul_State* state) { | |||
| 5027 | } | 5089 | } |
| 5028 | 5090 | ||
| 5029 | QADD_INST: | 5091 | QADD_INST: |
| 5092 | QDADD_INST: | ||
| 5093 | QDSUB_INST: | ||
| 5094 | QSUB_INST: | ||
| 5095 | { | ||
| 5096 | if (inst_base->cond == 0xE || CondPassed(cpu, inst_base->cond)) { | ||
| 5097 | generic_arm_inst* const inst_cream = (generic_arm_inst*)inst_base->component; | ||
| 5098 | const u8 op1 = inst_cream->op1; | ||
| 5099 | const u32 rm_val = RM; | ||
| 5100 | const u32 rn_val = RN; | ||
| 5101 | |||
| 5102 | u32 result = 0; | ||
| 5103 | |||
| 5104 | // QADD | ||
| 5105 | if (op1 == 0x00) { | ||
| 5106 | result = rm_val + rn_val; | ||
| 5107 | |||
| 5108 | if (AddOverflow(rm_val, rn_val, result)) { | ||
| 5109 | result = POS(result) ? 0x80000000 : 0x7FFFFFFF; | ||
| 5110 | cpu->Cpsr |= (1 << 27); | ||
| 5111 | } | ||
| 5112 | } | ||
| 5113 | // QSUB | ||
| 5114 | else if (op1 == 0x01) { | ||
| 5115 | result = rm_val - rn_val; | ||
| 5116 | |||
| 5117 | if (SubOverflow(rm_val, rn_val, result)) { | ||
| 5118 | result = POS(result) ? 0x80000000 : 0x7FFFFFFF; | ||
| 5119 | cpu->Cpsr |= (1 << 27); | ||
| 5120 | } | ||
| 5121 | } | ||
| 5122 | // QDADD | ||
| 5123 | else if (op1 == 0x02) { | ||
| 5124 | u32 mul = (rn_val * 2); | ||
| 5125 | |||
| 5126 | if (AddOverflow(rn_val, rn_val, rn_val * 2)) { | ||
| 5127 | mul = POS(mul) ? 0x80000000 : 0x7FFFFFFF; | ||
| 5128 | cpu->Cpsr |= (1 << 27); | ||
| 5129 | } | ||
| 5130 | |||
| 5131 | result = mul + rm_val; | ||
| 5132 | |||
| 5133 | if (AddOverflow(rm_val, mul, result)) { | ||
| 5134 | result = POS(result) ? 0x80000000 : 0x7FFFFFFF; | ||
| 5135 | cpu->Cpsr |= (1 << 27); | ||
| 5136 | } | ||
| 5137 | } | ||
| 5138 | // QDSUB | ||
| 5139 | else if (op1 == 0x03) { | ||
| 5140 | u32 mul = (rn_val * 2); | ||
| 5141 | |||
| 5142 | if (AddOverflow(rn_val, rn_val, mul)) { | ||
| 5143 | mul = POS(mul) ? 0x80000000 : 0x7FFFFFFF; | ||
| 5144 | cpu->Cpsr |= (1 << 27); | ||
| 5145 | } | ||
| 5146 | |||
| 5147 | result = rm_val - mul; | ||
| 5148 | |||
| 5149 | if (SubOverflow(rm_val, mul, result)) { | ||
| 5150 | result = POS(result) ? 0x80000000 : 0x7FFFFFFF; | ||
| 5151 | cpu->Cpsr |= (1 << 27); | ||
| 5152 | } | ||
| 5153 | } | ||
| 5154 | |||
| 5155 | RD = result; | ||
| 5156 | } | ||
| 5157 | |||
| 5158 | cpu->Reg[15] += GET_INST_SIZE(cpu); | ||
| 5159 | INC_PC(sizeof(generic_arm_inst)); | ||
| 5160 | FETCH_INST; | ||
| 5161 | GOTO_NEXT_INST; | ||
| 5162 | } | ||
| 5163 | |||
| 5030 | QADD8_INST: | 5164 | QADD8_INST: |
| 5031 | QADD16_INST: | 5165 | QADD16_INST: |
| 5032 | QADDSUBX_INST: | 5166 | QADDSUBX_INST: |
| @@ -5089,10 +5223,6 @@ unsigned InterpreterMainLoop(ARMul_State* state) { | |||
| 5089 | GOTO_NEXT_INST; | 5223 | GOTO_NEXT_INST; |
| 5090 | } | 5224 | } |
| 5091 | 5225 | ||
| 5092 | QDADD_INST: | ||
| 5093 | QDSUB_INST: | ||
| 5094 | QSUB_INST: | ||
| 5095 | |||
| 5096 | REV_INST: | 5226 | REV_INST: |
| 5097 | REV16_INST: | 5227 | REV16_INST: |
| 5098 | REVSH_INST: | 5228 | REVSH_INST: |
| @@ -5461,7 +5591,8 @@ unsigned InterpreterMainLoop(ARMul_State* state) { | |||
| 5461 | operand2 = (BIT(RS, 31)) ? (BITS(RS, 16, 31) | 0xffff0000) : BITS(RS, 16, 31); | 5591 | operand2 = (BIT(RS, 31)) ? (BITS(RS, 16, 31) | 0xffff0000) : BITS(RS, 16, 31); |
| 5462 | RD = operand1 * operand2 + RN; | 5592 | RD = operand1 * operand2 + RN; |
| 5463 | 5593 | ||
| 5464 | // TODO: FIXME: UPDATE Q FLAGS | 5594 | if (AddOverflow(operand1 * operand2, RN, RD)) |
| 5595 | cpu->Cpsr |= (1 << 27); | ||
| 5465 | } | 5596 | } |
| 5466 | cpu->Reg[15] += GET_INST_SIZE(cpu); | 5597 | cpu->Reg[15] += GET_INST_SIZE(cpu); |
| 5467 | INC_PC(sizeof(smla_inst)); | 5598 | INC_PC(sizeof(smla_inst)); |
| @@ -5555,7 +5686,31 @@ unsigned InterpreterMainLoop(ARMul_State* state) { | |||
| 5555 | } | 5686 | } |
| 5556 | 5687 | ||
| 5557 | SMLALXY_INST: | 5688 | SMLALXY_INST: |
| 5689 | |||
| 5558 | SMLAW_INST: | 5690 | SMLAW_INST: |
| 5691 | { | ||
| 5692 | if (inst_base->cond == 0xE || CondPassed(cpu, inst_base->cond)) { | ||
| 5693 | smlad_inst* const inst_cream = (smlad_inst*)inst_base->component; | ||
| 5694 | |||
| 5695 | const u32 rm_val = RM; | ||
| 5696 | const u32 rn_val = RN; | ||
| 5697 | const u32 ra_val = cpu->Reg[inst_cream->Ra]; | ||
| 5698 | const bool high = (inst_cream->m == 1); | ||
| 5699 | |||
| 5700 | const s16 operand2 = (high) ? ((rm_val >> 16) & 0xFFFF) : (rm_val & 0xFFFF); | ||
| 5701 | const s64 result = (s64)(s32)rn_val * (s64)(s32)operand2 + ((s64)(s32)ra_val << 16); | ||
| 5702 | |||
| 5703 | RD = (result & (0xFFFFFFFFFFFFFFFFLL >> 15)) >> 16; | ||
| 5704 | |||
| 5705 | if ((result >> 16) != (s32)RD) | ||
| 5706 | cpu->Cpsr |= (1 << 27); | ||
| 5707 | } | ||
| 5708 | |||
| 5709 | cpu->Reg[15] += GET_INST_SIZE(cpu); | ||
| 5710 | INC_PC(sizeof(smlad_inst)); | ||
| 5711 | FETCH_INST; | ||
| 5712 | GOTO_NEXT_INST; | ||
| 5713 | } | ||
| 5559 | 5714 | ||
| 5560 | SMLALD_INST: | 5715 | SMLALD_INST: |
| 5561 | SMLSLD_INST: | 5716 | SMLSLD_INST: |
| @@ -6585,7 +6740,7 @@ unsigned InterpreterMainLoop(ARMul_State* state) { | |||
| 6585 | BLX_1_THUMB: | 6740 | BLX_1_THUMB: |
| 6586 | { | 6741 | { |
| 6587 | // BLX 1 for armv5t and above | 6742 | // BLX 1 for armv5t and above |
| 6588 | uint32 tmp = cpu->Reg[15]; | 6743 | u32 tmp = cpu->Reg[15]; |
| 6589 | blx_1_thumb *inst_cream = (blx_1_thumb *)inst_base->component; | 6744 | blx_1_thumb *inst_cream = (blx_1_thumb *)inst_base->component; |
| 6590 | cpu->Reg[15] = (cpu->Reg[14] + inst_cream->imm) & 0xFFFFFFFC; | 6745 | cpu->Reg[15] = (cpu->Reg[14] + inst_cream->imm) & 0xFFFFFFFC; |
| 6591 | cpu->Reg[14] = ((tmp + 2) | 1); | 6746 | cpu->Reg[14] = ((tmp + 2) | 1); |
diff --git a/src/core/arm/dyncom/arm_dyncom_run.h b/src/core/arm/dyncom/arm_dyncom_run.h index aeabeac16..c70522274 100644 --- a/src/core/arm/dyncom/arm_dyncom_run.h +++ b/src/core/arm/dyncom/arm_dyncom_run.h | |||
| @@ -24,8 +24,8 @@ | |||
| 24 | void switch_mode(arm_core_t *core, uint32_t mode); | 24 | void switch_mode(arm_core_t *core, uint32_t mode); |
| 25 | 25 | ||
| 26 | /* FIXME, we temporarily think thumb instruction is always 16 bit */ | 26 | /* FIXME, we temporarily think thumb instruction is always 16 bit */ |
| 27 | static inline uint32 GET_INST_SIZE(arm_core_t* core){ | 27 | static inline u32 GET_INST_SIZE(arm_core_t* core) { |
| 28 | return core->TFlag? 2 : 4; | 28 | return core->TFlag? 2 : 4; |
| 29 | } | 29 | } |
| 30 | 30 | ||
| 31 | /** | 31 | /** |
| @@ -36,8 +36,8 @@ static inline uint32 GET_INST_SIZE(arm_core_t* core){ | |||
| 36 | * | 36 | * |
| 37 | * @return | 37 | * @return |
| 38 | */ | 38 | */ |
| 39 | static inline addr_t CHECK_READ_REG15_WA(arm_core_t* core, int Rn){ | 39 | static inline addr_t CHECK_READ_REG15_WA(arm_core_t* core, int Rn) { |
| 40 | return (Rn == 15)? ((core->Reg[15] & ~0x3) + GET_INST_SIZE(core) * 2) : core->Reg[Rn]; | 40 | return (Rn == 15)? ((core->Reg[15] & ~0x3) + GET_INST_SIZE(core) * 2) : core->Reg[Rn]; |
| 41 | } | 41 | } |
| 42 | 42 | ||
| 43 | /** | 43 | /** |
| @@ -48,8 +48,8 @@ static inline addr_t CHECK_READ_REG15_WA(arm_core_t* core, int Rn){ | |||
| 48 | * | 48 | * |
| 49 | * @return | 49 | * @return |
| 50 | */ | 50 | */ |
| 51 | static inline uint32 CHECK_READ_REG15(arm_core_t* core, int Rn){ | 51 | static inline u32 CHECK_READ_REG15(arm_core_t* core, int Rn) { |
| 52 | return (Rn == 15)? ((core->Reg[15] & ~0x1) + GET_INST_SIZE(core) * 2) : core->Reg[Rn]; | 52 | return (Rn == 15)? ((core->Reg[15] & ~0x1) + GET_INST_SIZE(core) * 2) : core->Reg[Rn]; |
| 53 | } | 53 | } |
| 54 | 54 | ||
| 55 | #endif | 55 | #endif |
diff --git a/src/core/arm/dyncom/arm_dyncom_thumb.h b/src/core/arm/dyncom/arm_dyncom_thumb.h index 5541de9d1..bf69b2fd4 100644 --- a/src/core/arm/dyncom/arm_dyncom_thumb.h +++ b/src/core/arm/dyncom/arm_dyncom_thumb.h | |||
| @@ -37,10 +37,10 @@ enum tdstate { | |||
| 37 | t_uninitialized, | 37 | t_uninitialized, |
| 38 | }; | 38 | }; |
| 39 | 39 | ||
| 40 | tdstate | 40 | tdstate thumb_translate(addr_t addr, u32 instr, u32* ainstr, u32* inst_size); |
| 41 | thumb_translate(addr_t addr, uint32_t instr, uint32_t* ainstr, uint32_t* inst_size); | 41 | |
| 42 | static inline uint32 get_thumb_instr(uint32 instr, addr_t pc){ | 42 | static inline u32 get_thumb_instr(u32 instr, addr_t pc) { |
| 43 | uint32 tinstr; | 43 | u32 tinstr; |
| 44 | if ((pc & 0x3) != 0) | 44 | if ((pc & 0x3) != 0) |
| 45 | tinstr = instr >> 16; | 45 | tinstr = instr >> 16; |
| 46 | else | 46 | else |
diff --git a/src/core/arm/interpreter/armsupp.cpp b/src/core/arm/interpreter/armsupp.cpp index eec34143e..68ac2a0ce 100644 --- a/src/core/arm/interpreter/armsupp.cpp +++ b/src/core/arm/interpreter/armsupp.cpp | |||
| @@ -418,22 +418,18 @@ ARMul_NegZero (ARMul_State * state, ARMword result) | |||
| 418 | } | 418 | } |
| 419 | } | 419 | } |
| 420 | 420 | ||
| 421 | /* Compute whether an addition of A and B, giving RESULT, overflowed. */ | 421 | // Compute whether an addition of A and B, giving RESULT, overflowed. |
| 422 | 422 | bool AddOverflow(ARMword a, ARMword b, ARMword result) | |
| 423 | int | ||
| 424 | AddOverflow (ARMword a, ARMword b, ARMword result) | ||
| 425 | { | 423 | { |
| 426 | return ((NEG (a) && NEG (b) && POS (result)) | 424 | return ((NEG(a) && NEG(b) && POS(result)) || |
| 427 | || (POS (a) && POS (b) && NEG (result))); | 425 | (POS(a) && POS(b) && NEG(result))); |
| 428 | } | 426 | } |
| 429 | 427 | ||
| 430 | /* Compute whether a subtraction of A and B, giving RESULT, overflowed. */ | 428 | // Compute whether a subtraction of A and B, giving RESULT, overflowed. |
| 431 | 429 | bool SubOverflow(ARMword a, ARMword b, ARMword result) | |
| 432 | int | ||
| 433 | SubOverflow (ARMword a, ARMword b, ARMword result) | ||
| 434 | { | 430 | { |
| 435 | return ((NEG (a) && POS (b) && POS (result)) | 431 | return ((NEG(a) && POS(b) && POS(result)) || |
| 436 | || (POS (a) && NEG (b) && NEG (result))); | 432 | (POS(a) && NEG(b) && NEG(result))); |
| 437 | } | 433 | } |
| 438 | 434 | ||
| 439 | /* Assigns the C flag after an addition of a and b to give result. */ | 435 | /* Assigns the C flag after an addition of a and b to give result. */ |
diff --git a/src/core/arm/skyeye_common/armdefs.h b/src/core/arm/skyeye_common/armdefs.h index 4592c5808..1b2cef451 100644 --- a/src/core/arm/skyeye_common/armdefs.h +++ b/src/core/arm/skyeye_common/armdefs.h | |||
| @@ -70,6 +70,9 @@ | |||
| 70 | #define DATACACHE 1 | 70 | #define DATACACHE 1 |
| 71 | #define INSTCACHE 2 | 71 | #define INSTCACHE 2 |
| 72 | 72 | ||
| 73 | #define POS(i) ( (~(i)) >> 31 ) | ||
| 74 | #define NEG(i) ( (i) >> 31 ) | ||
| 75 | |||
| 73 | #ifndef __STDC__ | 76 | #ifndef __STDC__ |
| 74 | typedef char *VoidStar; | 77 | typedef char *VoidStar; |
| 75 | #endif | 78 | #endif |
| @@ -783,6 +786,8 @@ RUn %x,%x,%x,%x,%x,%x,%x,%x,%x,%x,%x,%x,%x,%x,%x,%x\n",\ | |||
| 783 | //#define PXA250 0x69052903 | 786 | //#define PXA250 0x69052903 |
| 784 | // 0x69052903; //PXA250 B1 from intel 278522-001.pdf | 787 | // 0x69052903; //PXA250 B1 from intel 278522-001.pdf |
| 785 | 788 | ||
| 789 | extern bool AddOverflow(ARMword, ARMword, ARMword); | ||
| 790 | extern bool SubOverflow(ARMword, ARMword, ARMword); | ||
| 786 | 791 | ||
| 787 | extern void ARMul_UndefInstr(ARMul_State*, ARMword); | 792 | extern void ARMul_UndefInstr(ARMul_State*, ARMword); |
| 788 | extern void ARMul_FixCPSR(ARMul_State*, ARMword, ARMword); | 793 | extern void ARMul_FixCPSR(ARMul_State*, ARMword, ARMword); |
diff --git a/src/core/arm/skyeye_common/armemu.h b/src/core/arm/skyeye_common/armemu.h index e1b286f0f..1dfcc635a 100644 --- a/src/core/arm/skyeye_common/armemu.h +++ b/src/core/arm/skyeye_common/armemu.h | |||
| @@ -42,9 +42,6 @@ | |||
| 42 | #define R15FBIT (1L << 26) | 42 | #define R15FBIT (1L << 26) |
| 43 | #define R15IFBITS (3L << 26) | 43 | #define R15IFBITS (3L << 26) |
| 44 | 44 | ||
| 45 | #define POS(i) ( (~(i)) >> 31 ) | ||
| 46 | #define NEG(i) ( (i) >> 31 ) | ||
| 47 | |||
| 48 | #ifdef MODET /* Thumb support. */ | 45 | #ifdef MODET /* Thumb support. */ |
| 49 | /* ??? This bit is actually in the low order bit of the PC in the hardware. | 46 | /* ??? This bit is actually in the low order bit of the PC in the hardware. |
| 50 | It isn't clear if the simulator needs to model that or not. */ | 47 | It isn't clear if the simulator needs to model that or not. */ |
| @@ -561,8 +558,7 @@ tdstate; | |||
| 561 | 558 | ||
| 562 | /* Prototypes for exported functions. */ | 559 | /* Prototypes for exported functions. */ |
| 563 | extern unsigned ARMul_NthReg (ARMword, unsigned); | 560 | extern unsigned ARMul_NthReg (ARMword, unsigned); |
| 564 | extern int AddOverflow (ARMword, ARMword, ARMword); | 561 | |
| 565 | extern int SubOverflow (ARMword, ARMword, ARMword); | ||
| 566 | /* Prototypes for exported functions. */ | 562 | /* Prototypes for exported functions. */ |
| 567 | #ifdef __cplusplus | 563 | #ifdef __cplusplus |
| 568 | extern "C" { | 564 | extern "C" { |
diff --git a/src/core/arm/skyeye_common/skyeye_types.h b/src/core/arm/skyeye_common/skyeye_types.h index e7f022f19..fc7d8d922 100644 --- a/src/core/arm/skyeye_common/skyeye_types.h +++ b/src/core/arm/skyeye_common/skyeye_types.h | |||
| @@ -22,34 +22,10 @@ | |||
| 22 | * 12/16/2006 Michael.Kang <blackfin.kang@gmail.com> | 22 | * 12/16/2006 Michael.Kang <blackfin.kang@gmail.com> |
| 23 | */ | 23 | */ |
| 24 | 24 | ||
| 25 | #ifndef __SKYEYE_TYPES_H | 25 | #pragma once |
| 26 | #define __SKYEYE_TYPES_H | ||
| 27 | 26 | ||
| 28 | #include <stdint.h> | 27 | #include <cstdint> |
| 29 | |||
| 30 | /*default machine word length */ | ||
| 31 | |||
| 32 | #ifndef __BEOS__ | ||
| 33 | /* To avoid the type conflict with the qemu */ | ||
| 34 | #ifndef QEMU | ||
| 35 | typedef uint8_t uint8; | ||
| 36 | typedef uint16_t uint16; | ||
| 37 | typedef uint32_t uint32; | ||
| 38 | typedef uint64_t uint64; | ||
| 39 | |||
| 40 | typedef int8_t sint8; | ||
| 41 | typedef int16_t sint16; | ||
| 42 | typedef int32_t sint32; | ||
| 43 | typedef int64_t sint64; | ||
| 44 | #endif | ||
| 45 | 28 | ||
| 46 | typedef uint32_t address_t; | 29 | typedef uint32_t address_t; |
| 47 | typedef uint32_t uinteger_t; | ||
| 48 | typedef int32_t integer_t; | ||
| 49 | |||
| 50 | typedef uint32_t physical_address_t; | 30 | typedef uint32_t physical_address_t; |
| 51 | typedef uint32_t generic_address_t; | 31 | typedef uint32_t generic_address_t; |
| 52 | |||
| 53 | #endif | ||
| 54 | |||
| 55 | #endif | ||
diff --git a/src/core/core.cpp b/src/core/core.cpp index 22213d647..8ac4481cc 100644 --- a/src/core/core.cpp +++ b/src/core/core.cpp | |||
| @@ -53,10 +53,10 @@ int Init() { | |||
| 53 | g_sys_core = new ARM_Interpreter(); | 53 | g_sys_core = new ARM_Interpreter(); |
| 54 | 54 | ||
| 55 | switch (Settings::values.cpu_core) { | 55 | switch (Settings::values.cpu_core) { |
| 56 | case CPU_FastInterpreter: | 56 | case CPU_Interpreter: |
| 57 | g_app_core = new ARM_DynCom(); | 57 | g_app_core = new ARM_DynCom(); |
| 58 | break; | 58 | break; |
| 59 | case CPU_Interpreter: | 59 | case CPU_OldInterpreter: |
| 60 | default: | 60 | default: |
| 61 | g_app_core = new ARM_Interpreter(); | 61 | g_app_core = new ARM_Interpreter(); |
| 62 | break; | 62 | break; |
diff --git a/src/core/core.h b/src/core/core.h index 05dbe0ae5..ecd58a73a 100644 --- a/src/core/core.h +++ b/src/core/core.h | |||
| @@ -13,7 +13,7 @@ namespace Core { | |||
| 13 | 13 | ||
| 14 | enum CPUCore { | 14 | enum CPUCore { |
| 15 | CPU_Interpreter, | 15 | CPU_Interpreter, |
| 16 | CPU_FastInterpreter | 16 | CPU_OldInterpreter, |
| 17 | }; | 17 | }; |
| 18 | 18 | ||
| 19 | extern ARM_Interface* g_app_core; ///< ARM11 application core | 19 | extern ARM_Interface* g_app_core; ///< ARM11 application core |
diff --git a/src/core/file_sys/disk_archive.cpp b/src/core/file_sys/disk_archive.cpp index 0197f727d..c6e033fcd 100644 --- a/src/core/file_sys/disk_archive.cpp +++ b/src/core/file_sys/disk_archive.cpp | |||
| @@ -6,6 +6,7 @@ | |||
| 6 | 6 | ||
| 7 | #include "common/common_types.h" | 7 | #include "common/common_types.h" |
| 8 | #include "common/file_util.h" | 8 | #include "common/file_util.h" |
| 9 | #include "common/make_unique.h" | ||
| 9 | 10 | ||
| 10 | #include "core/file_sys/disk_archive.h" | 11 | #include "core/file_sys/disk_archive.h" |
| 11 | #include "core/settings.h" | 12 | #include "core/settings.h" |
| @@ -17,10 +18,10 @@ namespace FileSys { | |||
| 17 | 18 | ||
| 18 | std::unique_ptr<FileBackend> DiskArchive::OpenFile(const Path& path, const Mode mode) const { | 19 | std::unique_ptr<FileBackend> DiskArchive::OpenFile(const Path& path, const Mode mode) const { |
| 19 | LOG_DEBUG(Service_FS, "called path=%s mode=%01X", path.DebugStr().c_str(), mode.hex); | 20 | LOG_DEBUG(Service_FS, "called path=%s mode=%01X", path.DebugStr().c_str(), mode.hex); |
| 20 | DiskFile* file = new DiskFile(this, path, mode); | 21 | auto file = Common::make_unique<DiskFile>(this, path, mode); |
| 21 | if (!file->Open()) | 22 | if (!file->Open()) |
| 22 | return nullptr; | 23 | return nullptr; |
| 23 | return std::unique_ptr<FileBackend>(file); | 24 | return std::move(file); |
| 24 | } | 25 | } |
| 25 | 26 | ||
| 26 | bool DiskArchive::DeleteFile(const Path& path) const { | 27 | bool DiskArchive::DeleteFile(const Path& path) const { |
| @@ -66,10 +67,10 @@ bool DiskArchive::RenameDirectory(const Path& src_path, const Path& dest_path) c | |||
| 66 | 67 | ||
| 67 | std::unique_ptr<DirectoryBackend> DiskArchive::OpenDirectory(const Path& path) const { | 68 | std::unique_ptr<DirectoryBackend> DiskArchive::OpenDirectory(const Path& path) const { |
| 68 | LOG_DEBUG(Service_FS, "called path=%s", path.DebugStr().c_str()); | 69 | LOG_DEBUG(Service_FS, "called path=%s", path.DebugStr().c_str()); |
| 69 | DiskDirectory* directory = new DiskDirectory(this, path); | 70 | auto directory = Common::make_unique<DiskDirectory>(this, path); |
| 70 | if (!directory->Open()) | 71 | if (!directory->Open()) |
| 71 | return nullptr; | 72 | return nullptr; |
| 72 | return std::unique_ptr<DirectoryBackend>(directory); | 73 | return std::move(directory); |
| 73 | } | 74 | } |
| 74 | 75 | ||
| 75 | //////////////////////////////////////////////////////////////////////////////////////////////////// | 76 | //////////////////////////////////////////////////////////////////////////////////////////////////// |
| @@ -100,7 +101,7 @@ bool DiskFile::Open() { | |||
| 100 | // Open the file in binary mode, to avoid problems with CR/LF on Windows systems | 101 | // Open the file in binary mode, to avoid problems with CR/LF on Windows systems |
| 101 | mode_string += "b"; | 102 | mode_string += "b"; |
| 102 | 103 | ||
| 103 | file = new FileUtil::IOFile(path, mode_string.c_str()); | 104 | file = Common::make_unique<FileUtil::IOFile>(path, mode_string.c_str()); |
| 104 | return true; | 105 | return true; |
| 105 | } | 106 | } |
| 106 | 107 | ||
diff --git a/src/core/file_sys/disk_archive.h b/src/core/file_sys/disk_archive.h index f18d96f5a..3472f6874 100644 --- a/src/core/file_sys/disk_archive.h +++ b/src/core/file_sys/disk_archive.h | |||
| @@ -56,10 +56,6 @@ public: | |||
| 56 | DiskFile(); | 56 | DiskFile(); |
| 57 | DiskFile(const DiskArchive* archive, const Path& path, const Mode mode); | 57 | DiskFile(const DiskArchive* archive, const Path& path, const Mode mode); |
| 58 | 58 | ||
| 59 | ~DiskFile() override { | ||
| 60 | Close(); | ||
| 61 | } | ||
| 62 | |||
| 63 | bool Open() override; | 59 | bool Open() override; |
| 64 | size_t Read(const u64 offset, const u32 length, u8* buffer) const override; | 60 | size_t Read(const u64 offset, const u32 length, u8* buffer) const override; |
| 65 | size_t Write(const u64 offset, const u32 length, const u32 flush, const u8* buffer) const override; | 61 | size_t Write(const u64 offset, const u32 length, const u32 flush, const u8* buffer) const override; |
| @@ -75,7 +71,7 @@ protected: | |||
| 75 | const DiskArchive* archive; | 71 | const DiskArchive* archive; |
| 76 | std::string path; | 72 | std::string path; |
| 77 | Mode mode; | 73 | Mode mode; |
| 78 | FileUtil::IOFile* file; | 74 | std::unique_ptr<FileUtil::IOFile> file; |
| 79 | }; | 75 | }; |
| 80 | 76 | ||
| 81 | class DiskDirectory : public DirectoryBackend { | 77 | class DiskDirectory : public DirectoryBackend { |
diff --git a/src/core/hle/kernel/address_arbiter.cpp b/src/core/hle/kernel/address_arbiter.cpp index 38705e3cd..736bbc36a 100644 --- a/src/core/hle/kernel/address_arbiter.cpp +++ b/src/core/hle/kernel/address_arbiter.cpp | |||
| @@ -51,6 +51,17 @@ ResultCode ArbitrateAddress(Handle handle, ArbitrationType type, u32 address, s3 | |||
| 51 | HLE::Reschedule(__func__); | 51 | HLE::Reschedule(__func__); |
| 52 | } | 52 | } |
| 53 | break; | 53 | break; |
| 54 | |||
| 55 | case ArbitrationType::DecrementAndWaitIfLessThan: | ||
| 56 | { | ||
| 57 | s32 memory_value = Memory::Read32(address) - 1; | ||
| 58 | Memory::Write32(address, memory_value); | ||
| 59 | if (memory_value <= value) { | ||
| 60 | Kernel::WaitCurrentThread(WAITTYPE_ARB, handle, address); | ||
| 61 | HLE::Reschedule(__func__); | ||
| 62 | } | ||
| 63 | break; | ||
| 64 | } | ||
| 54 | 65 | ||
| 55 | default: | 66 | default: |
| 56 | LOG_ERROR(Kernel, "unknown type=%d", type); | 67 | LOG_ERROR(Kernel, "unknown type=%d", type); |
diff --git a/src/core/hle/kernel/mutex.cpp b/src/core/hle/kernel/mutex.cpp index 558068c79..3dfeffc9b 100644 --- a/src/core/hle/kernel/mutex.cpp +++ b/src/core/hle/kernel/mutex.cpp | |||
| @@ -168,9 +168,9 @@ Handle CreateMutex(bool initial_locked, const std::string& name) { | |||
| 168 | ResultVal<bool> Mutex::WaitSynchronization() { | 168 | ResultVal<bool> Mutex::WaitSynchronization() { |
| 169 | bool wait = locked; | 169 | bool wait = locked; |
| 170 | if (locked) { | 170 | if (locked) { |
| 171 | waiting_threads.push_back(GetCurrentThreadHandle()); | ||
| 171 | Kernel::WaitCurrentThread(WAITTYPE_MUTEX, GetHandle()); | 172 | Kernel::WaitCurrentThread(WAITTYPE_MUTEX, GetHandle()); |
| 172 | } | 173 | } else { |
| 173 | else { | ||
| 174 | // Lock the mutex when the first thread accesses it | 174 | // Lock the mutex when the first thread accesses it |
| 175 | locked = true; | 175 | locked = true; |
| 176 | MutexAcquireLock(this); | 176 | MutexAcquireLock(this); |
diff --git a/src/core/hle/service/apt_a.cpp b/src/core/hle/service/apt_a.cpp index 4b0f761d9..37be4b027 100644 --- a/src/core/hle/service/apt_a.cpp +++ b/src/core/hle/service/apt_a.cpp | |||
| @@ -25,12 +25,12 @@ const Interface::FunctionInfo FunctionTable[] = { | |||
| 25 | {0x00040040, nullptr, "Finalize?"}, | 25 | {0x00040040, nullptr, "Finalize?"}, |
| 26 | {0x00050040, nullptr, "GetAppletManInfo?"}, | 26 | {0x00050040, nullptr, "GetAppletManInfo?"}, |
| 27 | {0x00060040, nullptr, "GetAppletInfo?"}, | 27 | {0x00060040, nullptr, "GetAppletInfo?"}, |
| 28 | {0x000D0080, APT_U::ReceiveParameter, "ReceiveParameter?"}, | ||
| 29 | {0x000E0080, APT_U::GlanceParameter, "GlanceParameter?"}, | ||
| 28 | {0x003B0040, nullptr, "CancelLibraryApplet?"}, | 30 | {0x003B0040, nullptr, "CancelLibraryApplet?"}, |
| 29 | {0x00430040, nullptr, "NotifyToWait?"}, | 31 | {0x00430040, nullptr, "NotifyToWait?"}, |
| 30 | {0x004B00C2, nullptr, "AppletUtility?"}, | 32 | {0x004B00C2, nullptr, "AppletUtility?"}, |
| 31 | {0x00550040, nullptr, "WriteInputToNsState?"}, | 33 | {0x00550040, nullptr, "WriteInputToNsState?"}, |
| 32 | {0x000D0080, APT_U::ReceiveParameter, "ReceiveParameter" }, | ||
| 33 | {0x000E0080, APT_U::GlanceParameter, "GlanceParameter" }, | ||
| 34 | }; | 34 | }; |
| 35 | 35 | ||
| 36 | //////////////////////////////////////////////////////////////////////////////////////////////////// | 36 | //////////////////////////////////////////////////////////////////////////////////////////////////// |
diff --git a/src/core/hle/service/cfg/cfg_u.cpp b/src/core/hle/service/cfg/cfg_u.cpp index 03c01cf90..835620909 100644 --- a/src/core/hle/service/cfg/cfg_u.cpp +++ b/src/core/hle/service/cfg/cfg_u.cpp | |||
| @@ -172,12 +172,12 @@ static void GetModelNintendo2DS(Service::Interface* self) { | |||
| 172 | const Interface::FunctionInfo FunctionTable[] = { | 172 | const Interface::FunctionInfo FunctionTable[] = { |
| 173 | {0x00010082, GetConfigInfoBlk2, "GetConfigInfoBlk2"}, | 173 | {0x00010082, GetConfigInfoBlk2, "GetConfigInfoBlk2"}, |
| 174 | {0x00020000, nullptr, "SecureInfoGetRegion"}, | 174 | {0x00020000, nullptr, "SecureInfoGetRegion"}, |
| 175 | {0x00030000, nullptr, "GenHashConsoleUnique"}, | 175 | {0x00030040, nullptr, "GenHashConsoleUnique"}, |
| 176 | {0x00040000, nullptr, "GetRegionCanadaUSA"}, | 176 | {0x00040000, nullptr, "GetRegionCanadaUSA"}, |
| 177 | {0x00050000, GetSystemModel, "GetSystemModel"}, | 177 | {0x00050000, GetSystemModel, "GetSystemModel"}, |
| 178 | {0x00060000, GetModelNintendo2DS, "GetModelNintendo2DS"}, | 178 | {0x00060000, GetModelNintendo2DS, "GetModelNintendo2DS"}, |
| 179 | {0x00070040, nullptr, "unknown"}, | 179 | {0x00070040, nullptr, "WriteToFirstByteCfgSavegame"}, |
| 180 | {0x00080080, nullptr, "unknown"}, | 180 | {0x00080080, nullptr, "GoThroughTable"}, |
| 181 | {0x00090040, GetCountryCodeString, "GetCountryCodeString"}, | 181 | {0x00090040, GetCountryCodeString, "GetCountryCodeString"}, |
| 182 | {0x000A0040, GetCountryCodeID, "GetCountryCodeID"}, | 182 | {0x000A0040, GetCountryCodeID, "GetCountryCodeID"}, |
| 183 | }; | 183 | }; |
diff --git a/src/core/hle/service/csnd_snd.cpp b/src/core/hle/service/csnd_snd.cpp index aef8cfbca..3a557efe1 100644 --- a/src/core/hle/service/csnd_snd.cpp +++ b/src/core/hle/service/csnd_snd.cpp | |||
| @@ -14,16 +14,15 @@ namespace CSND_SND { | |||
| 14 | const Interface::FunctionInfo FunctionTable[] = { | 14 | const Interface::FunctionInfo FunctionTable[] = { |
| 15 | {0x00010140, nullptr, "Initialize"}, | 15 | {0x00010140, nullptr, "Initialize"}, |
| 16 | {0x00020000, nullptr, "Shutdown"}, | 16 | {0x00020000, nullptr, "Shutdown"}, |
| 17 | {0x00030040, nullptr, "Unknown"}, | 17 | {0x00030040, nullptr, "ExecuteType0Commands"}, |
| 18 | {0x00040080, nullptr, "Unknown"}, | 18 | {0x00040080, nullptr, "ExecuteType1Commands"}, |
| 19 | {0x00050000, nullptr, "Unknown"}, | 19 | {0x00050000, nullptr, "AcquireSoundChannels"}, |
| 20 | {0x00060000, nullptr, "Unknown"}, | 20 | {0x00060000, nullptr, "ReleaseSoundChannels"}, |
| 21 | {0x00070000, nullptr, "Unknown"}, | 21 | {0x00070000, nullptr, "AcquireCaptureDevice"}, |
| 22 | {0x00080040, nullptr, "Unknown"}, | 22 | {0x00080040, nullptr, "ReleaseCaptureDevice"}, |
| 23 | {0x00090082, nullptr, "FlushDCache"}, | 23 | {0x00090082, nullptr, "FlushDCache"}, |
| 24 | {0x000A0082, nullptr, "StoreDCache"}, | 24 | {0x000A0082, nullptr, "StoreDCache"}, |
| 25 | {0x000B0082, nullptr, "InvalidateDCache"}, | 25 | {0x000B0082, nullptr, "InvalidateDCache"}, |
| 26 | {0x000C0000, nullptr, "Unknown"}, | ||
| 27 | }; | 26 | }; |
| 28 | 27 | ||
| 29 | //////////////////////////////////////////////////////////////////////////////////////////////////// | 28 | //////////////////////////////////////////////////////////////////////////////////////////////////// |
diff --git a/src/core/hle/service/dsp_dsp.cpp b/src/core/hle/service/dsp_dsp.cpp index 2cf4d118f..d4affdfbf 100644 --- a/src/core/hle/service/dsp_dsp.cpp +++ b/src/core/hle/service/dsp_dsp.cpp | |||
| @@ -12,9 +12,23 @@ | |||
| 12 | 12 | ||
| 13 | namespace DSP_DSP { | 13 | namespace DSP_DSP { |
| 14 | 14 | ||
| 15 | static u32 read_pipe_count; | 15 | static u32 read_pipe_count = 0; |
| 16 | static Handle semaphore_event; | 16 | static Handle semaphore_event = 0; |
| 17 | static Handle interrupt_event; | 17 | static Handle interrupt_event = 0; |
| 18 | |||
| 19 | void SignalInterrupt() { | ||
| 20 | // TODO(bunnei): This is just a stub, it does not do anything other than signal to the emulated | ||
| 21 | // application that a DSP interrupt occurred, without specifying which one. Since we do not | ||
| 22 | // emulate the DSP yet (and how it works is largely unknown), this is a work around to get games | ||
| 23 | // that check the DSP interrupt signal event to run. We should figure out the different types of | ||
| 24 | // DSP interrupts, and trigger them at the appropriate times. | ||
| 25 | |||
| 26 | if (interrupt_event == 0) { | ||
| 27 | LOG_WARNING(Service_DSP, "cannot signal interrupt until DSP event has been created!"); | ||
| 28 | return; | ||
| 29 | } | ||
| 30 | Kernel::SignalEvent(interrupt_event); | ||
| 31 | } | ||
| 18 | 32 | ||
| 19 | /** | 33 | /** |
| 20 | * DSP_DSP::ConvertProcessAddressFromDspDram service function | 34 | * DSP_DSP::ConvertProcessAddressFromDspDram service function |
| @@ -102,7 +116,7 @@ void RegisterInterruptEvents(Service::Interface* self) { | |||
| 102 | void WriteReg0x10(Service::Interface* self) { | 116 | void WriteReg0x10(Service::Interface* self) { |
| 103 | u32* cmd_buff = Kernel::GetCommandBuffer(); | 117 | u32* cmd_buff = Kernel::GetCommandBuffer(); |
| 104 | 118 | ||
| 105 | Kernel::SignalEvent(interrupt_event); | 119 | SignalInterrupt(); |
| 106 | 120 | ||
| 107 | cmd_buff[1] = 0; // No error | 121 | cmd_buff[1] = 0; // No error |
| 108 | 122 | ||
diff --git a/src/core/hle/service/dsp_dsp.h b/src/core/hle/service/dsp_dsp.h index 0b8b64600..fa13bfb7c 100644 --- a/src/core/hle/service/dsp_dsp.h +++ b/src/core/hle/service/dsp_dsp.h | |||
| @@ -20,4 +20,7 @@ public: | |||
| 20 | } | 20 | } |
| 21 | }; | 21 | }; |
| 22 | 22 | ||
| 23 | /// Signals that a DSP interrupt has occurred to userland code | ||
| 24 | void SignalInterrupt(); | ||
| 25 | |||
| 23 | } // namespace | 26 | } // namespace |
diff --git a/src/core/hle/service/ir_rst.cpp b/src/core/hle/service/ir_rst.cpp index b388afb15..d49bd5335 100644 --- a/src/core/hle/service/ir_rst.cpp +++ b/src/core/hle/service/ir_rst.cpp | |||
| @@ -15,12 +15,7 @@ const Interface::FunctionInfo FunctionTable[] = { | |||
| 15 | {0x00010000, nullptr, "GetHandles"}, | 15 | {0x00010000, nullptr, "GetHandles"}, |
| 16 | {0x00020080, nullptr, "Initialize"}, | 16 | {0x00020080, nullptr, "Initialize"}, |
| 17 | {0x00030000, nullptr, "Shutdown"}, | 17 | {0x00030000, nullptr, "Shutdown"}, |
| 18 | {0x00040000, nullptr, "Unknown"}, | 18 | {0x00090000, nullptr, "WriteToTwoFields"}, |
| 19 | {0x00050000, nullptr, "Unknown"}, | ||
| 20 | {0x00060000, nullptr, "Unknown"}, | ||
| 21 | {0x00070080, nullptr, "Unknown"}, | ||
| 22 | {0x00080000, nullptr, "Unknown"}, | ||
| 23 | {0x00090000, nullptr, "Unknown"}, | ||
| 24 | }; | 19 | }; |
| 25 | 20 | ||
| 26 | //////////////////////////////////////////////////////////////////////////////////////////////////// | 21 | //////////////////////////////////////////////////////////////////////////////////////////////////// |
diff --git a/src/core/hle/service/ldr_ro.cpp b/src/core/hle/service/ldr_ro.cpp index 9c9e90a40..7d6e2e8e8 100644 --- a/src/core/hle/service/ldr_ro.cpp +++ b/src/core/hle/service/ldr_ro.cpp | |||
| @@ -13,10 +13,14 @@ namespace LDR_RO { | |||
| 13 | 13 | ||
| 14 | const Interface::FunctionInfo FunctionTable[] = { | 14 | const Interface::FunctionInfo FunctionTable[] = { |
| 15 | {0x000100C2, nullptr, "Initialize"}, | 15 | {0x000100C2, nullptr, "Initialize"}, |
| 16 | {0x00020082, nullptr, "CRR_Load"}, | 16 | {0x00020082, nullptr, "LoadCRR"}, |
| 17 | {0x00030042, nullptr, "CRR_Unload"}, | 17 | {0x00030042, nullptr, "UnloadCCR"}, |
| 18 | {0x000402C2, nullptr, "CRO_LoadAndFix"}, | 18 | {0x000402C2, nullptr, "LoadExeCRO"}, |
| 19 | {0x000500C2, nullptr, "CRO_ApplyRelocationPatchesAndLink"} | 19 | {0x000500C2, nullptr, "LoadCROSymbols"}, |
| 20 | {0x00060042, nullptr, "CRO_Load?"}, | ||
| 21 | {0x00070042, nullptr, "LoadCROSymbols"}, | ||
| 22 | {0x00080042, nullptr, "Shutdown"}, | ||
| 23 | {0x000902C2, nullptr, "LoadExeCRO_New?"}, | ||
| 20 | }; | 24 | }; |
| 21 | 25 | ||
| 22 | //////////////////////////////////////////////////////////////////////////////////////////////////// | 26 | //////////////////////////////////////////////////////////////////////////////////////////////////// |
diff --git a/src/core/hle/service/ndm_u.cpp b/src/core/hle/service/ndm_u.cpp index 233b14f6d..0f03de6ae 100644 --- a/src/core/hle/service/ndm_u.cpp +++ b/src/core/hle/service/ndm_u.cpp | |||
| @@ -11,10 +11,13 @@ | |||
| 11 | namespace NDM_U { | 11 | namespace NDM_U { |
| 12 | 12 | ||
| 13 | const Interface::FunctionInfo FunctionTable[] = { | 13 | const Interface::FunctionInfo FunctionTable[] = { |
| 14 | {0x00060040, nullptr, "SuspendDaemons"}, | 14 | {0x00010042, nullptr, "EnterExclusiveState"}, |
| 15 | {0x00080040, nullptr, "DisableWifiUsage"}, | 15 | {0x00020002, nullptr, "LeaveExclusiveState"}, |
| 16 | {0x00090000, nullptr, "EnableWifiUsage"}, | 16 | {0x00030000, nullptr, "QueryExclusiveMode"}, |
| 17 | {0x00140040, nullptr, "OverrideDefaultDaemons"}, | 17 | {0x00060040, nullptr, "SuspendDaemons"}, |
| 18 | {0x00080040, nullptr, "DisableWifiUsage"}, | ||
| 19 | {0x00090000, nullptr, "EnableWifiUsage"}, | ||
| 20 | {0x00140040, nullptr, "OverrideDefaultDaemons"}, | ||
| 18 | }; | 21 | }; |
| 19 | 22 | ||
| 20 | //////////////////////////////////////////////////////////////////////////////////////////////////// | 23 | //////////////////////////////////////////////////////////////////////////////////////////////////// |
diff --git a/src/core/hle/service/service.cpp b/src/core/hle/service/service.cpp index 0f3cc2aa8..c5233e687 100644 --- a/src/core/hle/service/service.cpp +++ b/src/core/hle/service/service.cpp | |||
| @@ -37,6 +37,7 @@ | |||
| 37 | #include "core/hle/service/soc_u.h" | 37 | #include "core/hle/service/soc_u.h" |
| 38 | #include "core/hle/service/srv.h" | 38 | #include "core/hle/service/srv.h" |
| 39 | #include "core/hle/service/ssl_c.h" | 39 | #include "core/hle/service/ssl_c.h" |
| 40 | #include "core/hle/service/y2r_u.h" | ||
| 40 | 41 | ||
| 41 | namespace Service { | 42 | namespace Service { |
| 42 | 43 | ||
| @@ -122,6 +123,7 @@ void Init() { | |||
| 122 | g_manager->AddService(new PTM_U::Interface); | 123 | g_manager->AddService(new PTM_U::Interface); |
| 123 | g_manager->AddService(new SOC_U::Interface); | 124 | g_manager->AddService(new SOC_U::Interface); |
| 124 | g_manager->AddService(new SSL_C::Interface); | 125 | g_manager->AddService(new SSL_C::Interface); |
| 126 | g_manager->AddService(new Y2R_U::Interface); | ||
| 125 | 127 | ||
| 126 | LOG_DEBUG(Service, "initialized OK"); | 128 | LOG_DEBUG(Service, "initialized OK"); |
| 127 | } | 129 | } |
diff --git a/src/core/hle/service/soc_u.cpp b/src/core/hle/service/soc_u.cpp index 8e7abcf9c..f502c6afe 100644 --- a/src/core/hle/service/soc_u.cpp +++ b/src/core/hle/service/soc_u.cpp | |||
| @@ -308,11 +308,11 @@ static void Socket(Service::Interface* self) { | |||
| 308 | 308 | ||
| 309 | u32 socket_handle = static_cast<u32>(::socket(domain, type, protocol)); | 309 | u32 socket_handle = static_cast<u32>(::socket(domain, type, protocol)); |
| 310 | 310 | ||
| 311 | if (socket_handle != SOCKET_ERROR_VALUE) | 311 | if ((s32)socket_handle != SOCKET_ERROR_VALUE) |
| 312 | open_sockets[socket_handle] = { socket_handle, true }; | 312 | open_sockets[socket_handle] = { socket_handle, true }; |
| 313 | 313 | ||
| 314 | int result = 0; | 314 | int result = 0; |
| 315 | if (socket_handle == SOCKET_ERROR_VALUE) | 315 | if ((s32)socket_handle == SOCKET_ERROR_VALUE) |
| 316 | result = TranslateError(GET_ERRNO); | 316 | result = TranslateError(GET_ERRNO); |
| 317 | 317 | ||
| 318 | cmd_buffer[1] = result; | 318 | cmd_buffer[1] = result; |
| @@ -436,11 +436,11 @@ static void Accept(Service::Interface* self) { | |||
| 436 | socklen_t addr_len = sizeof(addr); | 436 | socklen_t addr_len = sizeof(addr); |
| 437 | u32 ret = static_cast<u32>(::accept(socket_handle, &addr, &addr_len)); | 437 | u32 ret = static_cast<u32>(::accept(socket_handle, &addr, &addr_len)); |
| 438 | 438 | ||
| 439 | if (ret != SOCKET_ERROR_VALUE) | 439 | if ((s32)ret != SOCKET_ERROR_VALUE) |
| 440 | open_sockets[ret] = { ret, true }; | 440 | open_sockets[ret] = { ret, true }; |
| 441 | 441 | ||
| 442 | int result = 0; | 442 | int result = 0; |
| 443 | if (ret == SOCKET_ERROR_VALUE) { | 443 | if ((s32)ret == SOCKET_ERROR_VALUE) { |
| 444 | result = TranslateError(GET_ERRNO); | 444 | result = TranslateError(GET_ERRNO); |
| 445 | } else { | 445 | } else { |
| 446 | CTRSockAddr ctr_addr = CTRSockAddr::FromPlatform(addr); | 446 | CTRSockAddr ctr_addr = CTRSockAddr::FromPlatform(addr); |
diff --git a/src/core/hle/service/srv.cpp b/src/core/hle/service/srv.cpp index 25fab1a4f..912b52adf 100644 --- a/src/core/hle/service/srv.cpp +++ b/src/core/hle/service/srv.cpp | |||
| @@ -52,13 +52,15 @@ static void GetServiceHandle(Service::Interface* self) { | |||
| 52 | } | 52 | } |
| 53 | 53 | ||
| 54 | const Interface::FunctionInfo FunctionTable[] = { | 54 | const Interface::FunctionInfo FunctionTable[] = { |
| 55 | {0x00010002, Initialize, "Initialize"}, | 55 | {0x00010002, Initialize, "Initialize"}, |
| 56 | {0x00020000, GetProcSemaphore, "GetProcSemaphore"}, | 56 | {0x00020000, GetProcSemaphore, "GetProcSemaphore"}, |
| 57 | {0x00030100, nullptr, "RegisterService"}, | 57 | {0x00030100, nullptr, "RegisterService"}, |
| 58 | {0x000400C0, nullptr, "UnregisterService"}, | 58 | {0x000400C0, nullptr, "UnregisterService"}, |
| 59 | {0x00050100, GetServiceHandle, "GetServiceHandle"}, | 59 | {0x00050100, GetServiceHandle, "GetServiceHandle"}, |
| 60 | {0x000B0000, nullptr, "ReceiveNotification"}, | 60 | {0x000600C2, nullptr, "RegisterHandle"}, |
| 61 | {0x000C0080, nullptr, "PublishToSubscriber"} | 61 | {0x00090040, nullptr, "Subscribe"}, |
| 62 | {0x000B0000, nullptr, "ReceiveNotification"}, | ||
| 63 | {0x000C0080, nullptr, "PublishToSubscriber"}, | ||
| 62 | }; | 64 | }; |
| 63 | 65 | ||
| 64 | //////////////////////////////////////////////////////////////////////////////////////////////////// | 66 | //////////////////////////////////////////////////////////////////////////////////////////////////// |
diff --git a/src/core/hle/service/y2r_u.cpp b/src/core/hle/service/y2r_u.cpp new file mode 100644 index 000000000..f9e3619dd --- /dev/null +++ b/src/core/hle/service/y2r_u.cpp | |||
| @@ -0,0 +1,45 @@ | |||
| 1 | // Copyright 2014 Citra Emulator Project | ||
| 2 | // Licensed under GPLv2 or any later version | ||
| 3 | // Refer to the license.txt file included. | ||
| 4 | |||
| 5 | #include "common/log.h" | ||
| 6 | #include "core/hle/hle.h" | ||
| 7 | #include "core/hle/kernel/event.h" | ||
| 8 | #include "core/hle/service/y2r_u.h" | ||
| 9 | |||
| 10 | //////////////////////////////////////////////////////////////////////////////////////////////////// | ||
| 11 | // Namespace Y2R_U | ||
| 12 | |||
| 13 | namespace Y2R_U { | ||
| 14 | |||
| 15 | const Interface::FunctionInfo FunctionTable[] = { | ||
| 16 | {0x00010040, nullptr, "SetInputFormat"}, | ||
| 17 | {0x00030040, nullptr, "SetOutputFormat"}, | ||
| 18 | {0x00050040, nullptr, "SetRotation"}, | ||
| 19 | {0x00070040, nullptr, "SetBlockAlignment"}, | ||
| 20 | {0x000D0040, nullptr, "SetTransferEndInterrupt"}, | ||
| 21 | {0x000F0000, nullptr, "GetTransferEndEvent"}, | ||
| 22 | {0x00100102, nullptr, "SetSendingY"}, | ||
| 23 | {0x00110102, nullptr, "SetSendingU"}, | ||
| 24 | {0x00120102, nullptr, "SetSendingV"}, | ||
| 25 | {0x00180102, nullptr, "SetReceiving"}, | ||
| 26 | {0x001A0040, nullptr, "SetInputLineWidth"}, | ||
| 27 | {0x001C0040, nullptr, "SetInputLines"}, | ||
| 28 | {0x00200040, nullptr, "SetStandardCoefficient"}, | ||
| 29 | {0x00220040, nullptr, "SetAlpha"}, | ||
| 30 | {0x00260000, nullptr, "StartConversion"}, | ||
| 31 | {0x00270000, nullptr, "StopConversion"}, | ||
| 32 | {0x00280000, nullptr, "IsBusyConversion"}, | ||
| 33 | {0x002A0000, nullptr, "PingProcess"}, | ||
| 34 | {0x002B0000, nullptr, "DriverInitialize"}, | ||
| 35 | {0x002C0000, nullptr, "DriverFinalize"} | ||
| 36 | }; | ||
| 37 | |||
| 38 | //////////////////////////////////////////////////////////////////////////////////////////////////// | ||
| 39 | // Interface class | ||
| 40 | |||
| 41 | Interface::Interface() { | ||
| 42 | Register(FunctionTable, ARRAY_SIZE(FunctionTable)); | ||
| 43 | } | ||
| 44 | |||
| 45 | } // namespace | ||
diff --git a/src/core/hle/service/y2r_u.h b/src/core/hle/service/y2r_u.h new file mode 100644 index 000000000..171aecfd1 --- /dev/null +++ b/src/core/hle/service/y2r_u.h | |||
| @@ -0,0 +1,23 @@ | |||
| 1 | // Copyright 2014 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 "core/hle/service/service.h" | ||
| 8 | |||
| 9 | //////////////////////////////////////////////////////////////////////////////////////////////////// | ||
| 10 | // Namespace Y2R_U | ||
| 11 | |||
| 12 | namespace Y2R_U { | ||
| 13 | |||
| 14 | class Interface : public Service::Interface { | ||
| 15 | public: | ||
| 16 | Interface(); | ||
| 17 | |||
| 18 | std::string GetPortName() const override { | ||
| 19 | return "y2r:u"; | ||
| 20 | } | ||
| 21 | }; | ||
| 22 | |||
| 23 | } // namespace | ||
diff --git a/src/core/hw/gpu.cpp b/src/core/hw/gpu.cpp index 0ff6c6cde..e346e0ad6 100644 --- a/src/core/hw/gpu.cpp +++ b/src/core/hw/gpu.cpp | |||
| @@ -10,6 +10,7 @@ | |||
| 10 | 10 | ||
| 11 | #include "core/hle/hle.h" | 11 | #include "core/hle/hle.h" |
| 12 | #include "core/hle/service/gsp_gpu.h" | 12 | #include "core/hle/service/gsp_gpu.h" |
| 13 | #include "core/hle/service/dsp_dsp.h" | ||
| 13 | 14 | ||
| 14 | #include "core/hw/gpu.h" | 15 | #include "core/hw/gpu.h" |
| 15 | 16 | ||
| @@ -214,13 +215,18 @@ void Update() { | |||
| 214 | // - If frameskip == 0 (disabled), always swap buffers | 215 | // - If frameskip == 0 (disabled), always swap buffers |
| 215 | // - If frameskip == 1, swap buffers every other frame (starting from the first frame) | 216 | // - If frameskip == 1, swap buffers every other frame (starting from the first frame) |
| 216 | // - If frameskip > 1, swap buffers every frameskip^n frames (starting from the second frame) | 217 | // - If frameskip > 1, swap buffers every frameskip^n frames (starting from the second frame) |
| 217 | |||
| 218 | if ((((Settings::values.frame_skip != 1) ^ last_skip_frame) && last_skip_frame != g_skip_frame) || | 218 | if ((((Settings::values.frame_skip != 1) ^ last_skip_frame) && last_skip_frame != g_skip_frame) || |
| 219 | Settings::values.frame_skip == 0) { | 219 | Settings::values.frame_skip == 0) { |
| 220 | VideoCore::g_renderer->SwapBuffers(); | 220 | VideoCore::g_renderer->SwapBuffers(); |
| 221 | } | 221 | } |
| 222 | 222 | ||
| 223 | // Signal to GSP that GPU interrupt has occurred | ||
| 223 | GSP_GPU::SignalInterrupt(GSP_GPU::InterruptId::PDC1); | 224 | GSP_GPU::SignalInterrupt(GSP_GPU::InterruptId::PDC1); |
| 225 | |||
| 226 | // TODO(bunnei): Fake a DSP interrupt on each frame. This does not belong here, but | ||
| 227 | // until we can emulate DSP interrupts, this is probably the only reasonable place to do | ||
| 228 | // this. Certain games expect this to be periodically signaled. | ||
| 229 | DSP_DSP::SignalInterrupt(); | ||
| 224 | } | 230 | } |
| 225 | } | 231 | } |
| 226 | } | 232 | } |
diff --git a/src/core/loader/loader.cpp b/src/core/loader/loader.cpp index 87580cb2a..45cf425df 100644 --- a/src/core/loader/loader.cpp +++ b/src/core/loader/loader.cpp | |||
| @@ -45,6 +45,8 @@ FileType IdentifyFile(const std::string &filename) { | |||
| 45 | return FileType::CCI; | 45 | return FileType::CCI; |
| 46 | } else if (extension == ".bin") { | 46 | } else if (extension == ".bin") { |
| 47 | return FileType::BIN; | 47 | return FileType::BIN; |
| 48 | } else if (extension == ".3ds") { | ||
| 49 | return FileType::CCI; | ||
| 48 | } else if (extension == ".3dsx") { | 50 | } else if (extension == ".3dsx") { |
| 49 | return FileType::THREEDSX; | 51 | return FileType::THREEDSX; |
| 50 | } | 52 | } |