summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/citra/CMakeLists.txt14
-rw-r--r--src/citra/citra.cpp2
-rw-r--r--src/citra/config.cpp2
-rw-r--r--src/citra/config.h2
-rw-r--r--src/citra/default_ini.h2
-rw-r--r--src/citra/emu_window/emu_window_glfw.cpp2
-rw-r--r--src/citra/emu_window/emu_window_glfw.h2
-rw-r--r--src/citra_qt/CMakeLists.txt4
-rw-r--r--src/citra_qt/config.cpp2
-rw-r--r--src/citra_qt/config.h2
-rw-r--r--src/citra_qt/debugger/graphics.cpp2
-rw-r--r--src/citra_qt/debugger/graphics.hxx2
-rw-r--r--src/citra_qt/debugger/graphics_breakpoints.cpp2
-rw-r--r--src/citra_qt/debugger/graphics_breakpoints.hxx2
-rw-r--r--src/citra_qt/debugger/graphics_breakpoints_p.hxx2
-rw-r--r--src/citra_qt/debugger/graphics_cmdlists.cpp2
-rw-r--r--src/citra_qt/debugger/graphics_cmdlists.hxx2
-rw-r--r--src/citra_qt/debugger/graphics_framebuffer.cpp2
-rw-r--r--src/citra_qt/debugger/graphics_framebuffer.hxx2
-rw-r--r--src/citra_qt/util/spinbox.cpp2
-rw-r--r--src/citra_qt/util/spinbox.hxx2
-rw-r--r--src/common/bit_field.h8
-rw-r--r--src/common/break_points.cpp4
-rw-r--r--src/common/break_points.h4
-rw-r--r--src/common/common.h4
-rw-r--r--src/common/common_funcs.h4
-rw-r--r--src/common/common_paths.h4
-rw-r--r--src/common/concurrent_ring_buffer.h2
-rw-r--r--src/common/cpu_detect.h4
-rw-r--r--src/common/emu_window.cpp2
-rw-r--r--src/common/emu_window.h2
-rw-r--r--src/common/file_search.cpp4
-rw-r--r--src/common/file_search.h4
-rw-r--r--src/common/file_util.cpp4
-rw-r--r--src/common/file_util.h4
-rw-r--r--src/common/hash.cpp4
-rw-r--r--src/common/hash.h4
-rw-r--r--src/common/key_map.cpp2
-rw-r--r--src/common/key_map.h2
-rw-r--r--src/common/linear_disk_cache.h4
-rw-r--r--src/common/log.h4
-rw-r--r--src/common/logging/backend.cpp2
-rw-r--r--src/common/logging/backend.h2
-rw-r--r--src/common/logging/filter.cpp2
-rw-r--r--src/common/logging/filter.h2
-rw-r--r--src/common/logging/log.h2
-rw-r--r--src/common/logging/text_formatter.cpp2
-rw-r--r--src/common/logging/text_formatter.h2
-rw-r--r--src/common/math_util.cpp4
-rw-r--r--src/common/math_util.h4
-rw-r--r--src/common/memory_util.cpp4
-rw-r--r--src/common/memory_util.h4
-rw-r--r--src/common/misc.cpp4
-rw-r--r--src/common/msg_handler.cpp4
-rw-r--r--src/common/msg_handler.h4
-rw-r--r--src/common/scm_rev.h2
-rw-r--r--src/common/scope_exit.h2
-rw-r--r--src/common/string_util.cpp4
-rw-r--r--src/common/string_util.h4
-rw-r--r--src/common/symbols.cpp2
-rw-r--r--src/common/symbols.h2
-rw-r--r--src/common/thread.cpp4
-rw-r--r--src/common/thread.h4
-rw-r--r--src/common/thread_queue_list.h2
-rw-r--r--src/common/thunk.h4
-rw-r--r--src/common/timer.cpp4
-rw-r--r--src/common/timer.h4
-rw-r--r--src/core/CMakeLists.txt26
-rw-r--r--src/core/arm/arm_interface.h8
-rw-r--r--src/core/arm/disassembler/load_symbol_map.cpp2
-rw-r--r--src/core/arm/disassembler/load_symbol_map.h2
-rw-r--r--src/core/arm/dyncom/arm_dyncom.cpp51
-rw-r--r--src/core/arm/dyncom/arm_dyncom.h16
-rw-r--r--src/core/arm/dyncom/arm_dyncom_dec.h2
-rw-r--r--src/core/arm/dyncom/arm_dyncom_interpreter.cpp274
-rw-r--r--src/core/arm/dyncom/arm_dyncom_interpreter.h2
-rw-r--r--src/core/arm/dyncom/arm_dyncom_run.cpp1
-rw-r--r--src/core/arm/interpreter/arm_interpreter.cpp53
-rw-r--r--src/core/arm/interpreter/arm_interpreter.h8
-rw-r--r--src/core/arm/interpreter/armemu.cpp262
-rw-r--r--src/core/arm/interpreter/armsupp.cpp13
-rw-r--r--src/core/arm/skyeye_common/armdefs.h2
-rw-r--r--src/core/arm/skyeye_common/armemu.h8
-rw-r--r--src/core/core.cpp2
-rw-r--r--src/core/core.h2
-rw-r--r--src/core/core_timing.cpp4
-rw-r--r--src/core/core_timing.h4
-rw-r--r--src/core/file_sys/archive_backend.h7
-rw-r--r--src/core/file_sys/archive_romfs.cpp2
-rw-r--r--src/core/file_sys/archive_romfs.h2
-rw-r--r--src/core/file_sys/archive_savedata.cpp2
-rw-r--r--src/core/file_sys/archive_savedata.h2
-rw-r--r--src/core/file_sys/archive_sdmc.cpp2
-rw-r--r--src/core/file_sys/archive_sdmc.h2
-rw-r--r--src/core/file_sys/archive_systemsavedata.cpp12
-rw-r--r--src/core/file_sys/archive_systemsavedata.h4
-rw-r--r--src/core/file_sys/directory_backend.h2
-rw-r--r--src/core/file_sys/directory_romfs.cpp2
-rw-r--r--src/core/file_sys/directory_romfs.h2
-rw-r--r--src/core/file_sys/disk_archive.cpp2
-rw-r--r--src/core/file_sys/disk_archive.h3
-rw-r--r--src/core/file_sys/file_backend.h2
-rw-r--r--src/core/file_sys/file_romfs.cpp2
-rw-r--r--src/core/file_sys/file_romfs.h2
-rw-r--r--src/core/hle/config_mem.cpp2
-rw-r--r--src/core/hle/config_mem.h2
-rw-r--r--src/core/hle/coprocessor.cpp2
-rw-r--r--src/core/hle/function_wrappers.h2
-rw-r--r--src/core/hle/hle.cpp13
-rw-r--r--src/core/hle/hle.h2
-rw-r--r--src/core/hle/kernel/address_arbiter.cpp2
-rw-r--r--src/core/hle/kernel/address_arbiter.h2
-rw-r--r--src/core/hle/kernel/event.cpp2
-rw-r--r--src/core/hle/kernel/event.h2
-rw-r--r--src/core/hle/kernel/kernel.cpp4
-rw-r--r--src/core/hle/kernel/kernel.h2
-rw-r--r--src/core/hle/kernel/mutex.cpp2
-rw-r--r--src/core/hle/kernel/mutex.h2
-rw-r--r--src/core/hle/kernel/semaphore.cpp2
-rw-r--r--src/core/hle/kernel/semaphore.h2
-rw-r--r--src/core/hle/kernel/session.h2
-rw-r--r--src/core/hle/kernel/shared_memory.cpp2
-rw-r--r--src/core/hle/kernel/shared_memory.h2
-rw-r--r--src/core/hle/kernel/thread.cpp2
-rw-r--r--src/core/hle/kernel/thread.h2
-rw-r--r--src/core/hle/result.h2
-rw-r--r--src/core/hle/service/ac_u.cpp5
-rw-r--r--src/core/hle/service/ac_u.h8
-rw-r--r--src/core/hle/service/act_u.cpp24
-rw-r--r--src/core/hle/service/act_u.h23
-rw-r--r--src/core/hle/service/am_app.cpp2
-rw-r--r--src/core/hle/service/am_app.h6
-rw-r--r--src/core/hle/service/am_net.cpp5
-rw-r--r--src/core/hle/service/am_net.h8
-rw-r--r--src/core/hle/service/apt_a.cpp34
-rw-r--r--src/core/hle/service/apt_a.h23
-rw-r--r--src/core/hle/service/apt_u.cpp9
-rw-r--r--src/core/hle/service/apt_u.h9
-rw-r--r--src/core/hle/service/boss_u.cpp21
-rw-r--r--src/core/hle/service/boss_u.h22
-rw-r--r--src/core/hle/service/cecd_u.cpp2
-rw-r--r--src/core/hle/service/cecd_u.h6
-rw-r--r--src/core/hle/service/cfg/cfg.cpp202
-rw-r--r--src/core/hle/service/cfg/cfg.h144
-rw-r--r--src/core/hle/service/cfg/cfg_i.cpp110
-rw-r--r--src/core/hle/service/cfg/cfg_i.h (renamed from src/core/hle/service/cfg_i.h)8
-rw-r--r--src/core/hle/service/cfg/cfg_u.cpp (renamed from src/core/hle/service/cfg_u.cpp)84
-rw-r--r--src/core/hle/service/cfg/cfg_u.h (renamed from src/core/hle/service/cfg_u.h)8
-rw-r--r--src/core/hle/service/cfg_i.cpp59
-rw-r--r--src/core/hle/service/csnd_snd.cpp5
-rw-r--r--src/core/hle/service/csnd_snd.h8
-rw-r--r--src/core/hle/service/dsp_dsp.cpp5
-rw-r--r--src/core/hle/service/dsp_dsp.h8
-rw-r--r--src/core/hle/service/err_f.cpp20
-rw-r--r--src/core/hle/service/err_f.h22
-rw-r--r--src/core/hle/service/frd_u.cpp36
-rw-r--r--src/core/hle/service/frd_u.h22
-rw-r--r--src/core/hle/service/fs/archive.cpp11
-rw-r--r--src/core/hle/service/fs/archive.h2
-rw-r--r--src/core/hle/service/fs/fs_user.cpp24
-rw-r--r--src/core/hle/service/fs/fs_user.h9
-rw-r--r--src/core/hle/service/gsp_gpu.cpp5
-rw-r--r--src/core/hle/service/gsp_gpu.h10
-rw-r--r--src/core/hle/service/hid_user.cpp6
-rw-r--r--src/core/hle/service/hid_user.h10
-rw-r--r--src/core/hle/service/http_c.cpp64
-rw-r--r--src/core/hle/service/http_c.h23
-rw-r--r--src/core/hle/service/ir_rst.cpp5
-rw-r--r--src/core/hle/service/ir_rst.h10
-rw-r--r--src/core/hle/service/ir_u.cpp5
-rw-r--r--src/core/hle/service/ir_u.h8
-rw-r--r--src/core/hle/service/ldr_ro.cpp3
-rw-r--r--src/core/hle/service/ldr_ro.h6
-rw-r--r--src/core/hle/service/mic_u.cpp5
-rw-r--r--src/core/hle/service/mic_u.h8
-rw-r--r--src/core/hle/service/ndm_u.cpp5
-rw-r--r--src/core/hle/service/ndm_u.h10
-rw-r--r--src/core/hle/service/news_u.cpp25
-rw-r--r--src/core/hle/service/news_u.h23
-rw-r--r--src/core/hle/service/nim_aoc.cpp2
-rw-r--r--src/core/hle/service/nim_aoc.h6
-rw-r--r--src/core/hle/service/nwm_uds.cpp5
-rw-r--r--src/core/hle/service/nwm_uds.h8
-rw-r--r--src/core/hle/service/pm_app.cpp5
-rw-r--r--src/core/hle/service/pm_app.h8
-rw-r--r--src/core/hle/service/ptm_u.cpp5
-rw-r--r--src/core/hle/service/ptm_u.h8
-rw-r--r--src/core/hle/service/service.cpp18
-rw-r--r--src/core/hle/service/service.h2
-rw-r--r--src/core/hle/service/soc_u.cpp5
-rw-r--r--src/core/hle/service/soc_u.h8
-rw-r--r--src/core/hle/service/srv.cpp5
-rw-r--r--src/core/hle/service/srv.h11
-rw-r--r--src/core/hle/service/ssl_c.cpp5
-rw-r--r--src/core/hle/service/ssl_c.h10
-rw-r--r--src/core/hle/svc.cpp2
-rw-r--r--src/core/hle/svc.h2
-rw-r--r--src/core/hw/gpu.cpp44
-rw-r--r--src/core/hw/gpu.h2
-rw-r--r--src/core/hw/hw.cpp2
-rw-r--r--src/core/hw/hw.h2
-rw-r--r--src/core/loader/3dsx.cpp2
-rw-r--r--src/core/loader/3dsx.h2
-rw-r--r--src/core/loader/elf.cpp4
-rw-r--r--src/core/loader/elf.h4
-rw-r--r--src/core/loader/loader.cpp2
-rw-r--r--src/core/loader/loader.h2
-rw-r--r--src/core/loader/ncch.cpp2
-rw-r--r--src/core/loader/ncch.h2
-rw-r--r--src/core/mem_map.cpp4
-rw-r--r--src/core/mem_map.h2
-rw-r--r--src/core/mem_map_funcs.cpp2
-rw-r--r--src/core/settings.cpp2
-rw-r--r--src/core/settings.h2
-rw-r--r--src/core/system.cpp2
-rw-r--r--src/core/system.h2
-rw-r--r--src/video_core/clipper.cpp2
-rw-r--r--src/video_core/clipper.h2
-rw-r--r--src/video_core/command_processor.cpp6
-rw-r--r--src/video_core/command_processor.h2
-rw-r--r--src/video_core/gpu_debugger.h2
-rw-r--r--src/video_core/math.h2
-rw-r--r--src/video_core/pica.h12
-rw-r--r--src/video_core/primitive_assembly.cpp2
-rw-r--r--src/video_core/primitive_assembly.h2
-rw-r--r--src/video_core/rasterizer.cpp2
-rw-r--r--src/video_core/rasterizer.h2
-rw-r--r--src/video_core/renderer_base.h2
-rw-r--r--src/video_core/renderer_opengl/gl_shader_util.cpp2
-rw-r--r--src/video_core/renderer_opengl/gl_shader_util.h2
-rw-r--r--src/video_core/renderer_opengl/gl_shaders.h2
-rw-r--r--src/video_core/renderer_opengl/renderer_opengl.cpp2
-rw-r--r--src/video_core/renderer_opengl/renderer_opengl.h2
-rw-r--r--src/video_core/utils.cpp2
-rw-r--r--src/video_core/utils.h2
-rw-r--r--src/video_core/vertex_shader.cpp2
-rw-r--r--src/video_core/vertex_shader.h2
-rw-r--r--src/video_core/video_core.cpp2
-rw-r--r--src/video_core/video_core.h2
239 files changed, 1700 insertions, 847 deletions
diff --git a/src/citra/CMakeLists.txt b/src/citra/CMakeLists.txt
index f2add394f..b06259f5e 100644
--- a/src/citra/CMakeLists.txt
+++ b/src/citra/CMakeLists.txt
@@ -12,22 +12,20 @@ set(HEADERS
12 12
13create_directory_groups(${SRCS} ${HEADERS}) 13create_directory_groups(${SRCS} ${HEADERS})
14 14
15# NOTE: This is a workaround for CMake bug 0006976 (missing X11_xf86vmode_LIB variable)
16if (NOT X11_xf86vmode_LIB)
17 set(X11_xv86vmode_LIB Xxf86vm)
18endif()
19
20add_executable(citra ${SRCS} ${HEADERS}) 15add_executable(citra ${SRCS} ${HEADERS})
21target_link_libraries(citra core common video_core) 16target_link_libraries(citra core common video_core)
22target_link_libraries(citra ${OPENGL_gl_LIBRARY} ${GLFW_LIBRARIES} inih) 17target_link_libraries(citra ${OPENGL_gl_LIBRARY} ${GLFW_LIBRARIES} inih)
23 18
19if (UNIX)
20 target_link_libraries(citra -pthread)
21endif()
22
24if (APPLE) 23if (APPLE)
25 target_link_libraries(citra iconv pthread ${COREFOUNDATION_LIBRARY}) 24 target_link_libraries(citra iconv ${COREFOUNDATION_LIBRARY})
26elseif (WIN32) 25elseif (WIN32)
27 target_link_libraries(citra winmm) 26 target_link_libraries(citra winmm)
28else() # Unix 27else() # Unix
29 target_link_libraries(citra pthread rt) 28 target_link_libraries(citra rt)
30 target_link_libraries(citra ${X11_X11_LIB} ${X11_Xi_LIB} ${X11_Xcursor_LIB} ${X11_Xrandr_LIB} ${X11_xv86vmode_LIB})
31endif() 29endif()
32 30
33#install(TARGETS citra RUNTIME DESTINATION ${bindir}) 31#install(TARGETS citra RUNTIME DESTINATION ${bindir})
diff --git a/src/citra/citra.cpp b/src/citra/citra.cpp
index d6e8a4ec7..f6a52758b 100644
--- a/src/citra/citra.cpp
+++ b/src/citra/citra.cpp
@@ -1,5 +1,5 @@
1// Copyright 2014 Citra Emulator Project 1// Copyright 2014 Citra Emulator Project
2// Licensed under GPLv2 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 <thread> 5#include <thread>
diff --git a/src/citra/config.cpp b/src/citra/config.cpp
index 92764809e..b9d6441be 100644
--- a/src/citra/config.cpp
+++ b/src/citra/config.cpp
@@ -1,5 +1,5 @@
1// Copyright 2014 Citra Emulator Project 1// Copyright 2014 Citra Emulator Project
2// Licensed under GPLv2 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 <GLFW/glfw3.h> 5#include <GLFW/glfw3.h>
diff --git a/src/citra/config.h b/src/citra/config.h
index 2b46fa8aa..0eb176c7d 100644
--- a/src/citra/config.h
+++ b/src/citra/config.h
@@ -1,5 +1,5 @@
1// Copyright 2014 Citra Emulator Project 1// Copyright 2014 Citra Emulator Project
2// Licensed under GPLv2 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#pragma once 5#pragma once
diff --git a/src/citra/default_ini.h b/src/citra/default_ini.h
index 7cf543e07..a281c536f 100644
--- a/src/citra/default_ini.h
+++ b/src/citra/default_ini.h
@@ -1,5 +1,5 @@
1// Copyright 2014 Citra Emulator Project 1// Copyright 2014 Citra Emulator Project
2// Licensed under GPLv2 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#pragma once 5#pragma once
diff --git a/src/citra/emu_window/emu_window_glfw.cpp b/src/citra/emu_window/emu_window_glfw.cpp
index 929e09f43..a6282809b 100644
--- a/src/citra/emu_window/emu_window_glfw.cpp
+++ b/src/citra/emu_window/emu_window_glfw.cpp
@@ -1,5 +1,5 @@
1// Copyright 2014 Citra Emulator Project 1// Copyright 2014 Citra Emulator Project
2// Licensed under GPLv2 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 <GLFW/glfw3.h> 5#include <GLFW/glfw3.h>
diff --git a/src/citra/emu_window/emu_window_glfw.h b/src/citra/emu_window/emu_window_glfw.h
index 5b04e87bb..5252fccc8 100644
--- a/src/citra/emu_window/emu_window_glfw.h
+++ b/src/citra/emu_window/emu_window_glfw.h
@@ -1,5 +1,5 @@
1// Copyright 2014 Citra Emulator Project 1// Copyright 2014 Citra Emulator Project
2// Licensed under GPLv2 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#pragma once 5#pragma once
diff --git a/src/citra_qt/CMakeLists.txt b/src/citra_qt/CMakeLists.txt
index 90e5c6aa6..54d0a1271 100644
--- a/src/citra_qt/CMakeLists.txt
+++ b/src/citra_qt/CMakeLists.txt
@@ -60,6 +60,10 @@ add_executable(citra-qt ${SRCS} ${HEADERS} ${UI_HDRS})
60target_link_libraries(citra-qt core common video_core qhexedit) 60target_link_libraries(citra-qt core common video_core qhexedit)
61target_link_libraries(citra-qt ${OPENGL_gl_LIBRARY} ${CITRA_QT_LIBS}) 61target_link_libraries(citra-qt ${OPENGL_gl_LIBRARY} ${CITRA_QT_LIBS})
62 62
63if (UNIX)
64 target_link_libraries(citra-qt -pthread)
65endif()
66
63if (APPLE) 67if (APPLE)
64 target_link_libraries(citra-qt iconv ${COREFOUNDATION_LIBRARY}) 68 target_link_libraries(citra-qt iconv ${COREFOUNDATION_LIBRARY})
65elseif (WIN32) 69elseif (WIN32)
diff --git a/src/citra_qt/config.cpp b/src/citra_qt/config.cpp
index 0ae6b8b2d..0fea8e4f9 100644
--- a/src/citra_qt/config.cpp
+++ b/src/citra_qt/config.cpp
@@ -1,5 +1,5 @@
1// Copyright 2014 Citra Emulator Project 1// Copyright 2014 Citra Emulator Project
2// Licensed under GPLv2 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 <QString> 5#include <QString>
diff --git a/src/citra_qt/config.h b/src/citra_qt/config.h
index 4c95d0cb9..4485cae73 100644
--- a/src/citra_qt/config.h
+++ b/src/citra_qt/config.h
@@ -1,5 +1,5 @@
1// Copyright 2014 Citra Emulator Project 1// Copyright 2014 Citra Emulator Project
2// Licensed under GPLv2 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#pragma once 5#pragma once
diff --git a/src/citra_qt/debugger/graphics.cpp b/src/citra_qt/debugger/graphics.cpp
index a86a55404..6ff4c290d 100644
--- a/src/citra_qt/debugger/graphics.cpp
+++ b/src/citra_qt/debugger/graphics.cpp
@@ -1,5 +1,5 @@
1// Copyright 2014 Citra Emulator Project 1// Copyright 2014 Citra Emulator Project
2// Licensed under GPLv2 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 "graphics.hxx" 5#include "graphics.hxx"
diff --git a/src/citra_qt/debugger/graphics.hxx b/src/citra_qt/debugger/graphics.hxx
index 72656f93c..8119b4c87 100644
--- a/src/citra_qt/debugger/graphics.hxx
+++ b/src/citra_qt/debugger/graphics.hxx
@@ -1,5 +1,5 @@
1// Copyright 2014 Citra Emulator Project 1// Copyright 2014 Citra Emulator Project
2// Licensed under GPLv2 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#pragma once 5#pragma once
diff --git a/src/citra_qt/debugger/graphics_breakpoints.cpp b/src/citra_qt/debugger/graphics_breakpoints.cpp
index 4cb41db22..9486f06cc 100644
--- a/src/citra_qt/debugger/graphics_breakpoints.cpp
+++ b/src/citra_qt/debugger/graphics_breakpoints.cpp
@@ -1,5 +1,5 @@
1// Copyright 2014 Citra Emulator Project 1// Copyright 2014 Citra Emulator Project
2// Licensed under GPLv2 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 <QMetaType> 5#include <QMetaType>
diff --git a/src/citra_qt/debugger/graphics_breakpoints.hxx b/src/citra_qt/debugger/graphics_breakpoints.hxx
index 2142c6fa1..5b9ba324e 100644
--- a/src/citra_qt/debugger/graphics_breakpoints.hxx
+++ b/src/citra_qt/debugger/graphics_breakpoints.hxx
@@ -1,5 +1,5 @@
1// Copyright 2014 Citra Emulator Project 1// Copyright 2014 Citra Emulator Project
2// Licensed under GPLv2 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#pragma once 5#pragma once
diff --git a/src/citra_qt/debugger/graphics_breakpoints_p.hxx b/src/citra_qt/debugger/graphics_breakpoints_p.hxx
index bf5daf73d..232bfc863 100644
--- a/src/citra_qt/debugger/graphics_breakpoints_p.hxx
+++ b/src/citra_qt/debugger/graphics_breakpoints_p.hxx
@@ -1,5 +1,5 @@
1// Copyright 2014 Citra Emulator Project 1// Copyright 2014 Citra Emulator Project
2// Licensed under GPLv2 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#pragma once 5#pragma once
diff --git a/src/citra_qt/debugger/graphics_cmdlists.cpp b/src/citra_qt/debugger/graphics_cmdlists.cpp
index 95187e54d..753cc25da 100644
--- a/src/citra_qt/debugger/graphics_cmdlists.cpp
+++ b/src/citra_qt/debugger/graphics_cmdlists.cpp
@@ -1,5 +1,5 @@
1// Copyright 2014 Citra Emulator Project 1// Copyright 2014 Citra Emulator Project
2// Licensed under GPLv2 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 <QLabel> 5#include <QLabel>
diff --git a/src/citra_qt/debugger/graphics_cmdlists.hxx b/src/citra_qt/debugger/graphics_cmdlists.hxx
index a459bba64..a465d044c 100644
--- a/src/citra_qt/debugger/graphics_cmdlists.hxx
+++ b/src/citra_qt/debugger/graphics_cmdlists.hxx
@@ -1,5 +1,5 @@
1// Copyright 2014 Citra Emulator Project 1// Copyright 2014 Citra Emulator Project
2// Licensed under GPLv2 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#pragma once 5#pragma once
diff --git a/src/citra_qt/debugger/graphics_framebuffer.cpp b/src/citra_qt/debugger/graphics_framebuffer.cpp
index 484be1db5..dd41c3880 100644
--- a/src/citra_qt/debugger/graphics_framebuffer.cpp
+++ b/src/citra_qt/debugger/graphics_framebuffer.cpp
@@ -1,5 +1,5 @@
1// Copyright 2014 Citra Emulator Project 1// Copyright 2014 Citra Emulator Project
2// Licensed under GPLv2 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 <QBoxLayout> 5#include <QBoxLayout>
diff --git a/src/citra_qt/debugger/graphics_framebuffer.hxx b/src/citra_qt/debugger/graphics_framebuffer.hxx
index 1151ee7a1..56215761e 100644
--- a/src/citra_qt/debugger/graphics_framebuffer.hxx
+++ b/src/citra_qt/debugger/graphics_framebuffer.hxx
@@ -1,5 +1,5 @@
1// Copyright 2014 Citra Emulator Project 1// Copyright 2014 Citra Emulator Project
2// Licensed under GPLv2 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#pragma once 5#pragma once
diff --git a/src/citra_qt/util/spinbox.cpp b/src/citra_qt/util/spinbox.cpp
index 24ea3a967..f9988409f 100644
--- a/src/citra_qt/util/spinbox.cpp
+++ b/src/citra_qt/util/spinbox.cpp
@@ -1,4 +1,4 @@
1// Licensed under GPLv2+ 1// Licensed under GPLv2 or any later version
2// Refer to the license.txt file included. 2// Refer to the license.txt file included.
3 3
4 4
diff --git a/src/citra_qt/util/spinbox.hxx b/src/citra_qt/util/spinbox.hxx
index 68f5b9894..ee7f08ec2 100644
--- a/src/citra_qt/util/spinbox.hxx
+++ b/src/citra_qt/util/spinbox.hxx
@@ -1,4 +1,4 @@
1// Licensed under GPLv2+ 1// Licensed under GPLv2 or any later version
2// Refer to the license.txt file included. 2// Refer to the license.txt file included.
3 3
4 4
diff --git a/src/common/bit_field.h b/src/common/bit_field.h
index 3ec061e63..8eab054b8 100644
--- a/src/common/bit_field.h
+++ b/src/common/bit_field.h
@@ -1,4 +1,4 @@
1// Licensed under GPLv2 1// Licensed under GPLv2 or any later version
2// Refer to the license.txt file included. 2// Refer to the license.txt file included.
3 3
4 4
@@ -168,6 +168,12 @@ public:
168 } 168 }
169 } 169 }
170 170
171 // TODO: we may want to change this to explicit operator bool() if it's bug-free in VS2015
172 __forceinline bool ToBool() const
173 {
174 return Value() != 0;
175 }
176
171private: 177private:
172 // StorageType is T for non-enum types and the underlying type of T if 178 // StorageType is T for non-enum types and the underlying type of T if
173 // T is an enumeration. Note that T is wrapped within an enable_if in the 179 // T is an enumeration. Note that T is wrapped within an enable_if in the
diff --git a/src/common/break_points.cpp b/src/common/break_points.cpp
index 587dbf40a..6696935fa 100644
--- a/src/common/break_points.cpp
+++ b/src/common/break_points.cpp
@@ -1,5 +1,5 @@
1// Copyright 2013 Dolphin Emulator Project 1// Copyright 2013 Dolphin Emulator Project / 2014 Citra Emulator Project
2// Licensed under GPLv2 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 "common/common.h" 5#include "common/common.h"
diff --git a/src/common/break_points.h b/src/common/break_points.h
index cf3884fbc..5557cd50e 100644
--- a/src/common/break_points.h
+++ b/src/common/break_points.h
@@ -1,5 +1,5 @@
1// Copyright 2013 Dolphin Emulator Project 1// Copyright 2013 Dolphin Emulator Project / 2014 Citra Emulator Project
2// Licensed under GPLv2 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#pragma once 5#pragma once
diff --git a/src/common/common.h b/src/common/common.h
index 9f3016d34..66f0ccd0c 100644
--- a/src/common/common.h
+++ b/src/common/common.h
@@ -1,5 +1,5 @@
1// Copyright 2013 Dolphin Emulator Project 1// Copyright 2013 Dolphin Emulator Project / 2014 Citra Emulator Project
2// Licensed under GPLv2 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#pragma once 5#pragma once
diff --git a/src/common/common_funcs.h b/src/common/common_funcs.h
index 67b3679b0..ca7abbea6 100644
--- a/src/common/common_funcs.h
+++ b/src/common/common_funcs.h
@@ -1,5 +1,5 @@
1// Copyright 2013 Dolphin Emulator Project 1// Copyright 2013 Dolphin Emulator Project / 2014 Citra Emulator Project
2// Licensed under GPLv2 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#pragma once 5#pragma once
diff --git a/src/common/common_paths.h b/src/common/common_paths.h
index 966402a3d..9d62a8368 100644
--- a/src/common/common_paths.h
+++ b/src/common/common_paths.h
@@ -1,5 +1,5 @@
1// Copyright 2013 Dolphin Emulator Project 1// Copyright 2013 Dolphin Emulator Project / 2014 Citra Emulator Project
2// Licensed under GPLv2 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#pragma once 5#pragma once
diff --git a/src/common/concurrent_ring_buffer.h b/src/common/concurrent_ring_buffer.h
index 2951d93db..311bb01f4 100644
--- a/src/common/concurrent_ring_buffer.h
+++ b/src/common/concurrent_ring_buffer.h
@@ -1,5 +1,5 @@
1// Copyright 2014 Citra Emulator Project 1// Copyright 2014 Citra Emulator Project
2// Licensed under GPLv2+ 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#pragma once 5#pragma once
diff --git a/src/common/cpu_detect.h b/src/common/cpu_detect.h
index def6afdee..b585f9608 100644
--- a/src/common/cpu_detect.h
+++ b/src/common/cpu_detect.h
@@ -1,5 +1,5 @@
1// Copyright 2013 Dolphin Emulator Project 1// Copyright 2013 Dolphin Emulator Project / 2014 Citra Emulator Project
2// Licensed under GPLv2 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 5
diff --git a/src/common/emu_window.cpp b/src/common/emu_window.cpp
index 7a2c50ac8..4ec7b263a 100644
--- a/src/common/emu_window.cpp
+++ b/src/common/emu_window.cpp
@@ -1,5 +1,5 @@
1// Copyright 2014 Citra Emulator Project 1// Copyright 2014 Citra Emulator Project
2// Licensed under GPLv2 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 "emu_window.h" 5#include "emu_window.h"
diff --git a/src/common/emu_window.h b/src/common/emu_window.h
index 4cb94fed1..1ad4b82a3 100644
--- a/src/common/emu_window.h
+++ b/src/common/emu_window.h
@@ -1,5 +1,5 @@
1// Copyright 2014 Citra Emulator Project 1// Copyright 2014 Citra Emulator Project
2// Licensed under GPLv2 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#pragma once 5#pragma once
diff --git a/src/common/file_search.cpp b/src/common/file_search.cpp
index bfb54ce72..b3a0a84fb 100644
--- a/src/common/file_search.cpp
+++ b/src/common/file_search.cpp
@@ -1,5 +1,5 @@
1// Copyright 2013 Dolphin Emulator Project 1// Copyright 2013 Dolphin Emulator Project / 2014 Citra Emulator Project
2// Licensed under GPLv2 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 5
diff --git a/src/common/file_search.h b/src/common/file_search.h
index f966a008d..55ca02638 100644
--- a/src/common/file_search.h
+++ b/src/common/file_search.h
@@ -1,5 +1,5 @@
1// Copyright 2013 Dolphin Emulator Project 1// Copyright 2013 Dolphin Emulator Project / 2014 Citra Emulator Project
2// Licensed under GPLv2 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#pragma once 5#pragma once
diff --git a/src/common/file_util.cpp b/src/common/file_util.cpp
index 20c680571..bba830c70 100644
--- a/src/common/file_util.cpp
+++ b/src/common/file_util.cpp
@@ -1,5 +1,5 @@
1// Copyright 2013 Dolphin Emulator Project 1// Copyright 2013 Dolphin Emulator Project / 2014 Citra Emulator Project
2// Licensed under GPLv2 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 5
diff --git a/src/common/file_util.h b/src/common/file_util.h
index b1a60fb81..293c30941 100644
--- a/src/common/file_util.h
+++ b/src/common/file_util.h
@@ -1,5 +1,5 @@
1// Copyright 2013 Dolphin Emulator Project 1// Copyright 2013 Dolphin Emulator Project / 2014 Citra Emulator Project
2// Licensed under GPLv2 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#pragma once 5#pragma once
diff --git a/src/common/hash.cpp b/src/common/hash.cpp
index 2ddcfe6b7..fe2c9e636 100644
--- a/src/common/hash.cpp
+++ b/src/common/hash.cpp
@@ -1,5 +1,5 @@
1// Copyright 2013 Dolphin Emulator Project 1// Copyright 2013 Dolphin Emulator Project / 2014 Citra Emulator Project
2// Licensed under GPLv2 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 5
diff --git a/src/common/hash.h b/src/common/hash.h
index 29f699d7f..3ac42bc44 100644
--- a/src/common/hash.h
+++ b/src/common/hash.h
@@ -1,5 +1,5 @@
1// Copyright 2013 Dolphin Emulator Project 1// Copyright 2013 Dolphin Emulator Project / 2014 Citra Emulator Project
2// Licensed under GPLv2 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#pragma once 5#pragma once
diff --git a/src/common/key_map.cpp b/src/common/key_map.cpp
index 309caab98..d8945bb13 100644
--- a/src/common/key_map.cpp
+++ b/src/common/key_map.cpp
@@ -1,5 +1,5 @@
1// Copyright 2014 Citra Emulator Project 1// Copyright 2014 Citra Emulator Project
2// Licensed under GPLv2 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 "key_map.h" 5#include "key_map.h"
diff --git a/src/common/key_map.h b/src/common/key_map.h
index bf72362c0..8d949b852 100644
--- a/src/common/key_map.h
+++ b/src/common/key_map.h
@@ -1,5 +1,5 @@
1// Copyright 2014 Citra Emulator Project 1// Copyright 2014 Citra Emulator Project
2// Licensed under GPLv2 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#pragma once 5#pragma once
diff --git a/src/common/linear_disk_cache.h b/src/common/linear_disk_cache.h
index bb1b5174f..74ce74aba 100644
--- a/src/common/linear_disk_cache.h
+++ b/src/common/linear_disk_cache.h
@@ -1,5 +1,5 @@
1// Copyright 2013 Dolphin Emulator Project 1// Copyright 2013 Dolphin Emulator Project / 2014 Citra Emulator Project
2// Licensed under GPLv2 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#pragma once 5#pragma once
diff --git a/src/common/log.h b/src/common/log.h
index 663eda9ad..96d97249f 100644
--- a/src/common/log.h
+++ b/src/common/log.h
@@ -1,5 +1,5 @@
1// Copyright 2013 Dolphin Emulator Project 1// Copyright 2013 Dolphin Emulator Project / 2014 Citra Emulator Project
2// Licensed under GPLv2 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#pragma once 5#pragma once
diff --git a/src/common/logging/backend.cpp b/src/common/logging/backend.cpp
index e79b84604..816d1bb55 100644
--- a/src/common/logging/backend.cpp
+++ b/src/common/logging/backend.cpp
@@ -1,5 +1,5 @@
1// Copyright 2014 Citra Emulator Project 1// Copyright 2014 Citra Emulator Project
2// Licensed under GPLv2+ 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 <algorithm> 5#include <algorithm>
diff --git a/src/common/logging/backend.h b/src/common/logging/backend.h
index ae270efe8..1c44c929e 100644
--- a/src/common/logging/backend.h
+++ b/src/common/logging/backend.h
@@ -1,5 +1,5 @@
1// Copyright 2014 Citra Emulator Project 1// Copyright 2014 Citra Emulator Project
2// Licensed under GPLv2+ 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#pragma once 5#pragma once
diff --git a/src/common/logging/filter.cpp b/src/common/logging/filter.cpp
index 0cf9b05e7..50f2e13f4 100644
--- a/src/common/logging/filter.cpp
+++ b/src/common/logging/filter.cpp
@@ -1,5 +1,5 @@
1// Copyright 2014 Citra Emulator Project 1// Copyright 2014 Citra Emulator Project
2// Licensed under GPLv2+ 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 <algorithm> 5#include <algorithm>
diff --git a/src/common/logging/filter.h b/src/common/logging/filter.h
index 32b14b159..c3da9989f 100644
--- a/src/common/logging/filter.h
+++ b/src/common/logging/filter.h
@@ -1,5 +1,5 @@
1// Copyright 2014 Citra Emulator Project 1// Copyright 2014 Citra Emulator Project
2// Licensed under GPLv2+ 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 <array> 5#include <array>
diff --git a/src/common/logging/log.h b/src/common/logging/log.h
index 1eec34fbb..d1c391862 100644
--- a/src/common/logging/log.h
+++ b/src/common/logging/log.h
@@ -1,5 +1,5 @@
1// Copyright 2014 Citra Emulator Project 1// Copyright 2014 Citra Emulator Project
2// Licensed under GPLv2+ 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#pragma once 5#pragma once
diff --git a/src/common/logging/text_formatter.cpp b/src/common/logging/text_formatter.cpp
index f6b02fd47..ef5739d84 100644
--- a/src/common/logging/text_formatter.cpp
+++ b/src/common/logging/text_formatter.cpp
@@ -1,5 +1,5 @@
1// Copyright 2014 Citra Emulator Project 1// Copyright 2014 Citra Emulator Project
2// Licensed under GPLv2+ 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 <array> 5#include <array>
diff --git a/src/common/logging/text_formatter.h b/src/common/logging/text_formatter.h
index 1f73ca44a..2f05794f0 100644
--- a/src/common/logging/text_formatter.h
+++ b/src/common/logging/text_formatter.h
@@ -1,5 +1,5 @@
1// Copyright 2014 Citra Emulator Project 1// Copyright 2014 Citra Emulator Project
2// Licensed under GPLv2+ 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#pragma once 5#pragma once
diff --git a/src/common/math_util.cpp b/src/common/math_util.cpp
index 3613e82a6..a83592dd2 100644
--- a/src/common/math_util.cpp
+++ b/src/common/math_util.cpp
@@ -1,5 +1,5 @@
1// Copyright 2013 Dolphin Emulator Project 1// Copyright 2013 Dolphin Emulator Project / 2014 Citra Emulator Project
2// Licensed under GPLv2 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 5
diff --git a/src/common/math_util.h b/src/common/math_util.h
index b10a25c13..43b0e0dc3 100644
--- a/src/common/math_util.h
+++ b/src/common/math_util.h
@@ -1,5 +1,5 @@
1// Copyright 2013 Dolphin Emulator Project 1// Copyright 2013 Dolphin Emulator Project / 2014 Citra Emulator Project
2// Licensed under GPLv2 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#pragma once 5#pragma once
diff --git a/src/common/memory_util.cpp b/src/common/memory_util.cpp
index ca8a2a9e4..8f982da89 100644
--- a/src/common/memory_util.cpp
+++ b/src/common/memory_util.cpp
@@ -1,5 +1,5 @@
1// Copyright 2013 Dolphin Emulator Project 1// Copyright 2013 Dolphin Emulator Project / 2014 Citra Emulator Project
2// Licensed under GPLv2 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 5
diff --git a/src/common/memory_util.h b/src/common/memory_util.h
index 922bd44b2..9fdbf1f12 100644
--- a/src/common/memory_util.h
+++ b/src/common/memory_util.h
@@ -1,5 +1,5 @@
1// Copyright 2013 Dolphin Emulator Project 1// Copyright 2013 Dolphin Emulator Project / 2014 Citra Emulator Project
2// Licensed under GPLv2 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#pragma once 5#pragma once
diff --git a/src/common/misc.cpp b/src/common/misc.cpp
index bc9d26188..e33055d10 100644
--- a/src/common/misc.cpp
+++ b/src/common/misc.cpp
@@ -1,5 +1,5 @@
1// Copyright 2013 Dolphin Emulator Project 1// Copyright 2013 Dolphin Emulator Project / 2014 Citra Emulator Project
2// Licensed under GPLv2 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 "common/common.h" 5#include "common/common.h"
diff --git a/src/common/msg_handler.cpp b/src/common/msg_handler.cpp
index 7ffedc45a..4a47b518e 100644
--- a/src/common/msg_handler.cpp
+++ b/src/common/msg_handler.cpp
@@ -1,5 +1,5 @@
1// Copyright 2013 Dolphin Emulator Project 1// Copyright 2013 Dolphin Emulator Project / 2014 Citra Emulator Project
2// Licensed under GPLv2 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 <cstdio> 5#include <cstdio>
diff --git a/src/common/msg_handler.h b/src/common/msg_handler.h
index 9bfdf950e..7bb216e98 100644
--- a/src/common/msg_handler.h
+++ b/src/common/msg_handler.h
@@ -1,5 +1,5 @@
1// Copyright 2013 Dolphin Emulator Project 1// Copyright 2013 Dolphin Emulator Project / 2014 Citra Emulator Project
2// Licensed under GPLv2 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#pragma once 5#pragma once
diff --git a/src/common/scm_rev.h b/src/common/scm_rev.h
index d34664614..0ef190afa 100644
--- a/src/common/scm_rev.h
+++ b/src/common/scm_rev.h
@@ -1,5 +1,5 @@
1// Copyright 2014 Citra Emulator Project 1// Copyright 2014 Citra Emulator Project
2// Licensed under GPLv2 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#pragma once 5#pragma once
diff --git a/src/common/scope_exit.h b/src/common/scope_exit.h
index 1d3e59319..263beaf0e 100644
--- a/src/common/scope_exit.h
+++ b/src/common/scope_exit.h
@@ -1,5 +1,5 @@
1// Copyright 2014 Citra Emulator Project 1// Copyright 2014 Citra Emulator Project
2// Licensed under GPLv2+ 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#pragma once 5#pragma once
diff --git a/src/common/string_util.cpp b/src/common/string_util.cpp
index 6d9612fb5..d919b7a4c 100644
--- a/src/common/string_util.cpp
+++ b/src/common/string_util.cpp
@@ -1,5 +1,5 @@
1// Copyright 2013 Dolphin Emulator Project 1// Copyright 2013 Dolphin Emulator Project / 2014 Citra Emulator Project
2// Licensed under GPLv2 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 <boost/range/algorithm.hpp> 5#include <boost/range/algorithm.hpp>
diff --git a/src/common/string_util.h b/src/common/string_util.h
index 7d75691b1..74974263f 100644
--- a/src/common/string_util.h
+++ b/src/common/string_util.h
@@ -1,5 +1,5 @@
1// Copyright 2013 Dolphin Emulator Project 1// Copyright 2013 Dolphin Emulator Project / 2014 Citra Emulator Project
2// Licensed under GPLv2 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#pragma once 5#pragma once
diff --git a/src/common/symbols.cpp b/src/common/symbols.cpp
index 63ad6218b..9e4dccfb3 100644
--- a/src/common/symbols.cpp
+++ b/src/common/symbols.cpp
@@ -1,5 +1,5 @@
1// Copyright 2014 Citra Emulator Project 1// Copyright 2014 Citra Emulator Project
2// Licensed under GPLv2 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 "common/symbols.h" 5#include "common/symbols.h"
diff --git a/src/common/symbols.h b/src/common/symbols.h
index 4560f5240..f76cb6b1e 100644
--- a/src/common/symbols.h
+++ b/src/common/symbols.h
@@ -1,5 +1,5 @@
1// Copyright 2014 Citra Emulator Project 1// Copyright 2014 Citra Emulator Project
2// Licensed under GPLv2 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#pragma once 5#pragma once
diff --git a/src/common/thread.cpp b/src/common/thread.cpp
index dc153ba71..8c83d67b5 100644
--- a/src/common/thread.cpp
+++ b/src/common/thread.cpp
@@ -1,5 +1,5 @@
1// Copyright 2013 Dolphin Emulator Project 1// Copyright 2013 Dolphin Emulator Project / 2014 Citra Emulator Project
2// Licensed under GPLv2 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 "common/thread.h" 5#include "common/thread.h"
diff --git a/src/common/thread.h b/src/common/thread.h
index 8c36d3f07..eaf1ba00c 100644
--- a/src/common/thread.h
+++ b/src/common/thread.h
@@ -1,5 +1,5 @@
1// Copyright 2013 Dolphin Emulator Project 1// Copyright 2013 Dolphin Emulator Project / 2014 Citra Emulator Project
2// Licensed under GPLv2 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#pragma once 5#pragma once
diff --git a/src/common/thread_queue_list.h b/src/common/thread_queue_list.h
index 7e3b620c7..4e1c0a215 100644
--- a/src/common/thread_queue_list.h
+++ b/src/common/thread_queue_list.h
@@ -1,5 +1,5 @@
1// Copyright 2014 Citra Emulator Project / PPSSPP Project 1// Copyright 2014 Citra Emulator Project / PPSSPP Project
2// Licensed under GPLv2 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#pragma once 5#pragma once
diff --git a/src/common/thunk.h b/src/common/thunk.h
index 90c8be888..4fb7c98e1 100644
--- a/src/common/thunk.h
+++ b/src/common/thunk.h
@@ -1,5 +1,5 @@
1// Copyright 2013 Dolphin Emulator Project 1// Copyright 2013 Dolphin Emulator Project / 2014 Citra Emulator Project
2// Licensed under GPLv2 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#pragma once 5#pragma once
diff --git a/src/common/timer.cpp b/src/common/timer.cpp
index 4a797f751..a6682ea19 100644
--- a/src/common/timer.cpp
+++ b/src/common/timer.cpp
@@ -1,5 +1,5 @@
1// Copyright 2013 Dolphin Emulator Project 1// Copyright 2013 Dolphin Emulator Project / 2014 Citra Emulator Project
2// Licensed under GPLv2 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 <time.h> 5#include <time.h>
diff --git a/src/common/timer.h b/src/common/timer.h
index 86418e7a7..4b44c33a0 100644
--- a/src/common/timer.h
+++ b/src/common/timer.h
@@ -1,5 +1,5 @@
1// Copyright 2013 Dolphin Emulator Project 1// Copyright 2013 Dolphin Emulator Project / 2014 Citra Emulator Project
2// Licensed under GPLv2 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#pragma once 5#pragma once
diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt
index 3381524e3..fdd97c184 100644
--- a/src/core/CMakeLists.txt
+++ b/src/core/CMakeLists.txt
@@ -32,27 +32,32 @@ set(SRCS
32 hle/kernel/shared_memory.cpp 32 hle/kernel/shared_memory.cpp
33 hle/kernel/thread.cpp 33 hle/kernel/thread.cpp
34 hle/service/ac_u.cpp 34 hle/service/ac_u.cpp
35 hle/service/act_u.cpp
35 hle/service/am_app.cpp 36 hle/service/am_app.cpp
36 hle/service/am_net.cpp 37 hle/service/am_net.cpp
38 hle/service/apt_a.cpp
37 hle/service/apt_u.cpp 39 hle/service/apt_u.cpp
38 hle/service/boss_u.cpp 40 hle/service/boss_u.cpp
39 hle/service/cecd_u.cpp 41 hle/service/cecd_u.cpp
40 hle/service/cfg_i.cpp 42 hle/service/cfg/cfg.cpp
41 hle/service/cfg_u.cpp 43 hle/service/cfg/cfg_i.cpp
44 hle/service/cfg/cfg_u.cpp
42 hle/service/csnd_snd.cpp 45 hle/service/csnd_snd.cpp
43 hle/service/dsp_dsp.cpp 46 hle/service/dsp_dsp.cpp
44 hle/service/err_f.cpp 47 hle/service/err_f.cpp
48 hle/service/frd_u.cpp
45 hle/service/fs/archive.cpp 49 hle/service/fs/archive.cpp
46 hle/service/fs/fs_user.cpp 50 hle/service/fs/fs_user.cpp
47 hle/service/frd_u.cpp
48 hle/service/gsp_gpu.cpp 51 hle/service/gsp_gpu.cpp
49 hle/service/hid_user.cpp 52 hle/service/hid_user.cpp
53 hle/service/http_c.cpp
50 hle/service/ir_rst.cpp 54 hle/service/ir_rst.cpp
51 hle/service/ir_u.cpp 55 hle/service/ir_u.cpp
52 hle/service/ldr_ro.cpp 56 hle/service/ldr_ro.cpp
53 hle/service/mic_u.cpp 57 hle/service/mic_u.cpp
54 hle/service/nim_aoc.cpp
55 hle/service/ndm_u.cpp 58 hle/service/ndm_u.cpp
59 hle/service/news_u.cpp
60 hle/service/nim_aoc.cpp
56 hle/service/nwm_uds.cpp 61 hle/service/nwm_uds.cpp
57 hle/service/pm_app.cpp 62 hle/service/pm_app.cpp
58 hle/service/ptm_u.cpp 63 hle/service/ptm_u.cpp
@@ -117,27 +122,32 @@ set(HEADERS
117 hle/kernel/shared_memory.h 122 hle/kernel/shared_memory.h
118 hle/kernel/thread.h 123 hle/kernel/thread.h
119 hle/service/ac_u.h 124 hle/service/ac_u.h
125 hle/service/act_u.h
120 hle/service/am_app.h 126 hle/service/am_app.h
121 hle/service/am_net.h 127 hle/service/am_net.h
128 hle/service/apt_a.h
122 hle/service/apt_u.h 129 hle/service/apt_u.h
123 hle/service/boss_u.h 130 hle/service/boss_u.h
124 hle/service/cecd_u.h 131 hle/service/cecd_u.h
125 hle/service/cfg_i.h 132 hle/service/cfg/cfg.h
126 hle/service/cfg_u.h 133 hle/service/cfg/cfg_i.h
134 hle/service/cfg/cfg_u.h
127 hle/service/csnd_snd.h 135 hle/service/csnd_snd.h
128 hle/service/dsp_dsp.h 136 hle/service/dsp_dsp.h
129 hle/service/err_f.h 137 hle/service/err_f.h
138 hle/service/frd_u.h
130 hle/service/fs/archive.h 139 hle/service/fs/archive.h
131 hle/service/fs/fs_user.h 140 hle/service/fs/fs_user.h
132 hle/service/frd_u.h
133 hle/service/gsp_gpu.h 141 hle/service/gsp_gpu.h
134 hle/service/hid_user.h 142 hle/service/hid_user.h
143 hle/service/http_c.h
135 hle/service/ir_rst.h 144 hle/service/ir_rst.h
136 hle/service/ir_u.h 145 hle/service/ir_u.h
137 hle/service/ldr_ro.h 146 hle/service/ldr_ro.h
138 hle/service/mic_u.h 147 hle/service/mic_u.h
139 hle/service/nim_aoc.h
140 hle/service/ndm_u.h 148 hle/service/ndm_u.h
149 hle/service/news_u.h
150 hle/service/nim_aoc.h
141 hle/service/nwm_uds.h 151 hle/service/nwm_uds.h
142 hle/service/pm_app.h 152 hle/service/pm_app.h
143 hle/service/ptm_u.h 153 hle/service/ptm_u.h
diff --git a/src/core/arm/arm_interface.h b/src/core/arm/arm_interface.h
index 3ae528562..3b7209418 100644
--- a/src/core/arm/arm_interface.h
+++ b/src/core/arm/arm_interface.h
@@ -1,5 +1,5 @@
1// Copyright 2014 Citra Emulator Project 1// Copyright 2014 Citra Emulator Project
2// Licensed under GPLv2 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#pragma once 5#pragma once
@@ -78,6 +78,12 @@ public:
78 virtual u64 GetTicks() const = 0; 78 virtual u64 GetTicks() const = 0;
79 79
80 /** 80 /**
81 * Advance the CPU core by the specified number of ticks (e.g. to simulate CPU execution time)
82 * @param ticks Number of ticks to advance the CPU core
83 */
84 virtual void AddTicks(u64 ticks) = 0;
85
86 /**
81 * Saves the current CPU context 87 * Saves the current CPU context
82 * @param ctx Thread context to save 88 * @param ctx Thread context to save
83 */ 89 */
diff --git a/src/core/arm/disassembler/load_symbol_map.cpp b/src/core/arm/disassembler/load_symbol_map.cpp
index 55278474b..13d26d170 100644
--- a/src/core/arm/disassembler/load_symbol_map.cpp
+++ b/src/core/arm/disassembler/load_symbol_map.cpp
@@ -1,5 +1,5 @@
1// Copyright 2014 Citra Emulator Project 1// Copyright 2014 Citra Emulator Project
2// Licensed under GPLv2 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 <string> 5#include <string>
diff --git a/src/core/arm/disassembler/load_symbol_map.h b/src/core/arm/disassembler/load_symbol_map.h
index 837cca99b..d28c551c3 100644
--- a/src/core/arm/disassembler/load_symbol_map.h
+++ b/src/core/arm/disassembler/load_symbol_map.h
@@ -1,5 +1,5 @@
1// Copyright 2014 Citra Emulator Project 1// Copyright 2014 Citra Emulator Project
2// Licensed under GPLv2 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#pragma once 5#pragma once
diff --git a/src/core/arm/dyncom/arm_dyncom.cpp b/src/core/arm/dyncom/arm_dyncom.cpp
index 6c8ea211e..a838fd25a 100644
--- a/src/core/arm/dyncom/arm_dyncom.cpp
+++ b/src/core/arm/dyncom/arm_dyncom.cpp
@@ -1,5 +1,5 @@
1// Copyright 2014 Citra Emulator Project 1// Copyright 2014 Citra Emulator Project
2// Licensed under GPLv2 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/arm/skyeye_common/armcpu.h" 5#include "core/arm/skyeye_common/armcpu.h"
@@ -47,68 +47,38 @@ ARM_DynCom::ARM_DynCom() : ticks(0) {
47ARM_DynCom::~ARM_DynCom() { 47ARM_DynCom::~ARM_DynCom() {
48} 48}
49 49
50/**
51 * Set the Program Counter to an address
52 * @param addr Address to set PC to
53 */
54void ARM_DynCom::SetPC(u32 pc) { 50void ARM_DynCom::SetPC(u32 pc) {
55 state->pc = state->Reg[15] = pc; 51 state->pc = state->Reg[15] = pc;
56} 52}
57 53
58/*
59 * Get the current Program Counter
60 * @return Returns current PC
61 */
62u32 ARM_DynCom::GetPC() const { 54u32 ARM_DynCom::GetPC() const {
63 return state->Reg[15]; 55 return state->Reg[15];
64} 56}
65 57
66/**
67 * Get an ARM register
68 * @param index Register index (0-15)
69 * @return Returns the value in the register
70 */
71u32 ARM_DynCom::GetReg(int index) const { 58u32 ARM_DynCom::GetReg(int index) const {
72 return state->Reg[index]; 59 return state->Reg[index];
73} 60}
74 61
75/**
76 * Set an ARM register
77 * @param index Register index (0-15)
78 * @param value Value to set register to
79 */
80void ARM_DynCom::SetReg(int index, u32 value) { 62void ARM_DynCom::SetReg(int index, u32 value) {
81 state->Reg[index] = value; 63 state->Reg[index] = value;
82} 64}
83 65
84/**
85 * Get the current CPSR register
86 * @return Returns the value of the CPSR register
87 */
88u32 ARM_DynCom::GetCPSR() const { 66u32 ARM_DynCom::GetCPSR() const {
89 return state->Cpsr; 67 return state->Cpsr;
90} 68}
91 69
92/**
93 * Set the current CPSR register
94 * @param cpsr Value to set CPSR to
95 */
96void ARM_DynCom::SetCPSR(u32 cpsr) { 70void ARM_DynCom::SetCPSR(u32 cpsr) {
97 state->Cpsr = cpsr; 71 state->Cpsr = cpsr;
98} 72}
99 73
100/**
101 * Returns the number of clock ticks since the last reset
102 * @return Returns number of clock ticks
103 */
104u64 ARM_DynCom::GetTicks() const { 74u64 ARM_DynCom::GetTicks() const {
105 return ticks; 75 return ticks;
106} 76}
107 77
108/** 78void ARM_DynCom::AddTicks(u64 ticks) {
109 * Executes the given number of instructions 79 this->ticks += ticks;
110 * @param num_instructions Number of instructions to executes 80}
111 */ 81
112void ARM_DynCom::ExecuteInstructions(int num_instructions) { 82void ARM_DynCom::ExecuteInstructions(int num_instructions) {
113 state->NumInstrsToExecute = num_instructions; 83 state->NumInstrsToExecute = num_instructions;
114 84
@@ -118,11 +88,6 @@ void ARM_DynCom::ExecuteInstructions(int num_instructions) {
118 ticks += InterpreterMainLoop(state.get()); 88 ticks += InterpreterMainLoop(state.get());
119} 89}
120 90
121/**
122 * Saves the current CPU context
123 * @param ctx Thread context to save
124 * @todo Do we need to save Reg[15] and NextInstr?
125 */
126void ARM_DynCom::SaveContext(ThreadContext& ctx) { 91void ARM_DynCom::SaveContext(ThreadContext& ctx) {
127 memcpy(ctx.cpu_registers, state->Reg, sizeof(ctx.cpu_registers)); 92 memcpy(ctx.cpu_registers, state->Reg, sizeof(ctx.cpu_registers));
128 memcpy(ctx.fpu_registers, state->ExtReg, sizeof(ctx.fpu_registers)); 93 memcpy(ctx.fpu_registers, state->ExtReg, sizeof(ctx.fpu_registers));
@@ -139,11 +104,6 @@ void ARM_DynCom::SaveContext(ThreadContext& ctx) {
139 ctx.mode = state->NextInstr; 104 ctx.mode = state->NextInstr;
140} 105}
141 106
142/**
143 * Loads a CPU context
144 * @param ctx Thread context to load
145 * @param Do we need to load Reg[15] and NextInstr?
146 */
147void ARM_DynCom::LoadContext(const ThreadContext& ctx) { 107void ARM_DynCom::LoadContext(const ThreadContext& ctx) {
148 memcpy(state->Reg, ctx.cpu_registers, sizeof(ctx.cpu_registers)); 108 memcpy(state->Reg, ctx.cpu_registers, sizeof(ctx.cpu_registers));
149 memcpy(state->ExtReg, ctx.fpu_registers, sizeof(ctx.fpu_registers)); 109 memcpy(state->ExtReg, ctx.fpu_registers, sizeof(ctx.fpu_registers));
@@ -160,7 +120,6 @@ void ARM_DynCom::LoadContext(const ThreadContext& ctx) {
160 state->NextInstr = ctx.mode; 120 state->NextInstr = ctx.mode;
161} 121}
162 122
163/// Prepare core for thread reschedule (if needed to correctly handle state)
164void ARM_DynCom::PrepareReschedule() { 123void ARM_DynCom::PrepareReschedule() {
165 state->NumInstrsToExecute = 0; 124 state->NumInstrsToExecute = 0;
166} 125}
diff --git a/src/core/arm/dyncom/arm_dyncom.h b/src/core/arm/dyncom/arm_dyncom.h
index 51eea41ed..7284dcd07 100644
--- a/src/core/arm/dyncom/arm_dyncom.h
+++ b/src/core/arm/dyncom/arm_dyncom.h
@@ -1,5 +1,5 @@
1// Copyright 2014 Citra Emulator Project 1// Copyright 2014 Citra Emulator Project
2// Licensed under GPLv2 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#pragma once 5#pragma once
@@ -27,14 +27,14 @@ public:
27 * Get the current Program Counter 27 * Get the current Program Counter
28 * @return Returns current PC 28 * @return Returns current PC
29 */ 29 */
30 u32 GetPC() const; 30 u32 GetPC() const override;
31 31
32 /** 32 /**
33 * Get an ARM register 33 * Get an ARM register
34 * @param index Register index (0-15) 34 * @param index Register index (0-15)
35 * @return Returns the value in the register 35 * @return Returns the value in the register
36 */ 36 */
37 u32 GetReg(int index) const; 37 u32 GetReg(int index) const override;
38 38
39 /** 39 /**
40 * Set an ARM register 40 * Set an ARM register
@@ -47,7 +47,7 @@ public:
47 * Get the current CPSR register 47 * Get the current CPSR register
48 * @return Returns the value of the CPSR register 48 * @return Returns the value of the CPSR register
49 */ 49 */
50 u32 GetCPSR() const; 50 u32 GetCPSR() const override;
51 51
52 /** 52 /**
53 * Set the current CPSR register 53 * Set the current CPSR register
@@ -59,7 +59,13 @@ public:
59 * Returns the number of clock ticks since the last reset 59 * Returns the number of clock ticks since the last reset
60 * @return Returns number of clock ticks 60 * @return Returns number of clock ticks
61 */ 61 */
62 u64 GetTicks() const; 62 u64 GetTicks() const override;
63
64 /**
65 * Advance the CPU core by the specified number of ticks (e.g. to simulate CPU execution time)
66 * @param ticks Number of ticks to advance the CPU core
67 */
68 void AddTicks(u64 ticks) override;
63 69
64 /** 70 /**
65 * Saves the current CPU context 71 * Saves the current CPU context
diff --git a/src/core/arm/dyncom/arm_dyncom_dec.h b/src/core/arm/dyncom/arm_dyncom_dec.h
index 19d94f369..70eb96e93 100644
--- a/src/core/arm/dyncom/arm_dyncom_dec.h
+++ b/src/core/arm/dyncom/arm_dyncom_dec.h
@@ -56,8 +56,6 @@
56#define RN ((instr >> 16) & 0xF) 56#define RN ((instr >> 16) & 0xF)
57/*xxxx xxxx xxxx xxxx xxxx xxxx xxxx 1111 */ 57/*xxxx xxxx xxxx xxxx xxxx xxxx xxxx 1111 */
58#define RM (instr & 0xF) 58#define RM (instr & 0xF)
59#define BIT(n) ((instr >> (n)) & 1)
60#define BITS(a,b) ((instr >> (a)) & ((1 << (1+(b)-(a)))-1))
61 59
62/* CP15 registers */ 60/* CP15 registers */
63#define OPCODE_1 BITS(21, 23) 61#define OPCODE_1 BITS(21, 23)
diff --git a/src/core/arm/dyncom/arm_dyncom_interpreter.cpp b/src/core/arm/dyncom/arm_dyncom_interpreter.cpp
index 84b4a38f0..460001b1a 100644
--- a/src/core/arm/dyncom/arm_dyncom_interpreter.cpp
+++ b/src/core/arm/dyncom/arm_dyncom_interpreter.cpp
@@ -1019,6 +1019,15 @@ typedef struct _arm_inst {
1019 char component[0]; 1019 char component[0];
1020} arm_inst; 1020} arm_inst;
1021 1021
1022typedef struct generic_arm_inst {
1023 u32 Ra;
1024 u32 Rm;
1025 u32 Rn;
1026 u32 Rd;
1027 u8 op1;
1028 u8 op2;
1029} generic_arm_inst;
1030
1022typedef struct _adc_inst { 1031typedef struct _adc_inst {
1023 unsigned int I; 1032 unsigned int I;
1024 unsigned int S; 1033 unsigned int S;
@@ -2381,15 +2390,41 @@ ARM_INST_PTR INTERPRETER_TRANSLATE(pld)(unsigned int inst, int index)
2381 return inst_base; 2390 return inst_base;
2382} 2391}
2383ARM_INST_PTR INTERPRETER_TRANSLATE(qadd)(unsigned int inst, int index) { UNIMPLEMENTED_INSTRUCTION("QADD"); } 2392ARM_INST_PTR INTERPRETER_TRANSLATE(qadd)(unsigned int inst, int index) { UNIMPLEMENTED_INSTRUCTION("QADD"); }
2384ARM_INST_PTR INTERPRETER_TRANSLATE(qadd16)(unsigned int inst, int index) { UNIMPLEMENTED_INSTRUCTION("QADD16"); }
2385ARM_INST_PTR INTERPRETER_TRANSLATE(qadd8)(unsigned int inst, int index) { UNIMPLEMENTED_INSTRUCTION("QADD8"); } 2393ARM_INST_PTR INTERPRETER_TRANSLATE(qadd8)(unsigned int inst, int index) { UNIMPLEMENTED_INSTRUCTION("QADD8"); }
2386ARM_INST_PTR INTERPRETER_TRANSLATE(qaddsubx)(unsigned int inst, int index) { UNIMPLEMENTED_INSTRUCTION("QADDSUBX"); } 2394ARM_INST_PTR INTERPRETER_TRANSLATE(qadd16)(unsigned int inst, int index)
2395{
2396 arm_inst* const inst_base = (arm_inst*)AllocBuffer(sizeof(arm_inst) + sizeof(generic_arm_inst));
2397 generic_arm_inst* const inst_cream = (generic_arm_inst*)inst_base->component;
2398
2399 inst_base->cond = BITS(inst, 28, 31);
2400 inst_base->idx = index;
2401 inst_base->br = NON_BRANCH;
2402 inst_base->load_r15 = 0;
2403
2404 inst_cream->Rm = BITS(inst, 0, 3);
2405 inst_cream->Rn = BITS(inst, 16, 19);
2406 inst_cream->Rd = BITS(inst, 12, 15);
2407 inst_cream->op1 = BITS(inst, 20, 21);
2408 inst_cream->op2 = BITS(inst, 5, 7);
2409
2410 return inst_base;
2411}
2412ARM_INST_PTR INTERPRETER_TRANSLATE(qaddsubx)(unsigned int inst, int index)
2413{
2414 return INTERPRETER_TRANSLATE(qadd16)(inst, index);
2415}
2387ARM_INST_PTR INTERPRETER_TRANSLATE(qdadd)(unsigned int inst, int index) { UNIMPLEMENTED_INSTRUCTION("QDADD"); } 2416ARM_INST_PTR INTERPRETER_TRANSLATE(qdadd)(unsigned int inst, int index) { UNIMPLEMENTED_INSTRUCTION("QDADD"); }
2388ARM_INST_PTR INTERPRETER_TRANSLATE(qdsub)(unsigned int inst, int index) { UNIMPLEMENTED_INSTRUCTION("QDSUB"); } 2417ARM_INST_PTR INTERPRETER_TRANSLATE(qdsub)(unsigned int inst, int index) { UNIMPLEMENTED_INSTRUCTION("QDSUB"); }
2389ARM_INST_PTR INTERPRETER_TRANSLATE(qsub)(unsigned int inst, int index) { UNIMPLEMENTED_INSTRUCTION("QSUB"); } 2418ARM_INST_PTR INTERPRETER_TRANSLATE(qsub)(unsigned int inst, int index) { UNIMPLEMENTED_INSTRUCTION("QSUB"); }
2390ARM_INST_PTR INTERPRETER_TRANSLATE(qsub16)(unsigned int inst, int index) { UNIMPLEMENTED_INSTRUCTION("QSUB16"); }
2391ARM_INST_PTR INTERPRETER_TRANSLATE(qsub8)(unsigned int inst, int index) { UNIMPLEMENTED_INSTRUCTION("QSUB8"); } 2419ARM_INST_PTR INTERPRETER_TRANSLATE(qsub8)(unsigned int inst, int index) { UNIMPLEMENTED_INSTRUCTION("QSUB8"); }
2392ARM_INST_PTR INTERPRETER_TRANSLATE(qsubaddx)(unsigned int inst, int index) { UNIMPLEMENTED_INSTRUCTION("QSUBADDX"); } 2420ARM_INST_PTR INTERPRETER_TRANSLATE(qsub16)(unsigned int inst, int index)
2421{
2422 return INTERPRETER_TRANSLATE(qadd16)(inst, index);
2423}
2424ARM_INST_PTR INTERPRETER_TRANSLATE(qsubaddx)(unsigned int inst, int index)
2425{
2426 return INTERPRETER_TRANSLATE(qadd16)(inst, index);
2427}
2393ARM_INST_PTR INTERPRETER_TRANSLATE(rev)(unsigned int inst, int index) 2428ARM_INST_PTR INTERPRETER_TRANSLATE(rev)(unsigned int inst, int index)
2394{ 2429{
2395 arm_inst *inst_base = (arm_inst *)AllocBuffer(sizeof(arm_inst) + sizeof(rev_inst)); 2430 arm_inst *inst_base = (arm_inst *)AllocBuffer(sizeof(arm_inst) + sizeof(rev_inst));
@@ -2469,9 +2504,29 @@ ARM_INST_PTR INTERPRETER_TRANSLATE(rsc)(unsigned int inst, int index)
2469 } 2504 }
2470 return inst_base; 2505 return inst_base;
2471} 2506}
2472ARM_INST_PTR INTERPRETER_TRANSLATE(sadd16)(unsigned int inst, int index) { UNIMPLEMENTED_INSTRUCTION("SADD16"); }
2473ARM_INST_PTR INTERPRETER_TRANSLATE(sadd8)(unsigned int inst, int index) { UNIMPLEMENTED_INSTRUCTION("SADD8"); } 2507ARM_INST_PTR INTERPRETER_TRANSLATE(sadd8)(unsigned int inst, int index) { UNIMPLEMENTED_INSTRUCTION("SADD8"); }
2474ARM_INST_PTR INTERPRETER_TRANSLATE(saddsubx)(unsigned int inst, int index) { UNIMPLEMENTED_INSTRUCTION("SADDSUBX"); } 2508ARM_INST_PTR INTERPRETER_TRANSLATE(sadd16)(unsigned int inst, int index)
2509{
2510 arm_inst* const inst_base = (arm_inst*)AllocBuffer(sizeof(arm_inst) + sizeof(generic_arm_inst));
2511 generic_arm_inst* const inst_cream = (generic_arm_inst*)inst_base->component;
2512
2513 inst_base->cond = BITS(inst, 28, 31);
2514 inst_base->idx = index;
2515 inst_base->br = NON_BRANCH;
2516 inst_base->load_r15 = 0;
2517
2518 inst_cream->Rm = BITS(inst, 0, 3);
2519 inst_cream->Rn = BITS(inst, 16, 19);
2520 inst_cream->Rd = BITS(inst, 12, 15);
2521 inst_cream->op1 = BITS(inst, 20, 21);
2522 inst_cream->op2 = BITS(inst, 5, 7);
2523
2524 return inst_base;
2525}
2526ARM_INST_PTR INTERPRETER_TRANSLATE(saddsubx)(unsigned int inst, int index)
2527{
2528 return INTERPRETER_TRANSLATE(sadd16)(inst, index);
2529}
2475ARM_INST_PTR INTERPRETER_TRANSLATE(sbc)(unsigned int inst, int index) 2530ARM_INST_PTR INTERPRETER_TRANSLATE(sbc)(unsigned int inst, int index)
2476{ 2531{
2477 arm_inst *inst_base = (arm_inst *)AllocBuffer(sizeof(arm_inst) + sizeof(sbc_inst)); 2532 arm_inst *inst_base = (arm_inst *)AllocBuffer(sizeof(arm_inst) + sizeof(sbc_inst));
@@ -2496,7 +2551,24 @@ ARM_INST_PTR INTERPRETER_TRANSLATE(sbc)(unsigned int inst, int index)
2496 } 2551 }
2497 return inst_base; 2552 return inst_base;
2498} 2553}
2499ARM_INST_PTR INTERPRETER_TRANSLATE(sel)(unsigned int inst, int index) { UNIMPLEMENTED_INSTRUCTION("SEL"); } 2554ARM_INST_PTR INTERPRETER_TRANSLATE(sel)(unsigned int inst, int index)
2555{
2556 arm_inst* const inst_base = (arm_inst*)AllocBuffer(sizeof(arm_inst) + sizeof(generic_arm_inst));
2557 generic_arm_inst* const inst_cream = (generic_arm_inst*)inst_base->component;
2558
2559 inst_base->cond = BITS(inst, 28, 31);
2560 inst_base->idx = index;
2561 inst_base->br = NON_BRANCH;
2562 inst_base->load_r15 = 0;
2563
2564 inst_cream->Rm = BITS(inst, 0, 3);
2565 inst_cream->Rn = BITS(inst, 16, 19);
2566 inst_cream->Rd = BITS(inst, 12, 15);
2567 inst_cream->op1 = BITS(inst, 20, 22);
2568 inst_cream->op2 = BITS(inst, 5, 7);
2569
2570 return inst_base;
2571}
2500ARM_INST_PTR INTERPRETER_TRANSLATE(setend)(unsigned int inst, int index) { UNIMPLEMENTED_INSTRUCTION("SETEND"); } 2572ARM_INST_PTR INTERPRETER_TRANSLATE(setend)(unsigned int inst, int index) { UNIMPLEMENTED_INSTRUCTION("SETEND"); }
2501ARM_INST_PTR INTERPRETER_TRANSLATE(shadd16)(unsigned int inst, int index) { UNIMPLEMENTED_INSTRUCTION("SHADD16"); } 2573ARM_INST_PTR INTERPRETER_TRANSLATE(shadd16)(unsigned int inst, int index) { UNIMPLEMENTED_INSTRUCTION("SHADD16"); }
2502ARM_INST_PTR INTERPRETER_TRANSLATE(shadd8)(unsigned int inst, int index) { UNIMPLEMENTED_INSTRUCTION("SHADD8"); } 2574ARM_INST_PTR INTERPRETER_TRANSLATE(shadd8)(unsigned int inst, int index) { UNIMPLEMENTED_INSTRUCTION("SHADD8"); }
@@ -2637,9 +2709,15 @@ ARM_INST_PTR INTERPRETER_TRANSLATE(smusd)(unsigned int inst, int index) { UNI
2637ARM_INST_PTR INTERPRETER_TRANSLATE(srs)(unsigned int inst, int index) { UNIMPLEMENTED_INSTRUCTION("SRS"); } 2709ARM_INST_PTR INTERPRETER_TRANSLATE(srs)(unsigned int inst, int index) { UNIMPLEMENTED_INSTRUCTION("SRS"); }
2638ARM_INST_PTR INTERPRETER_TRANSLATE(ssat)(unsigned int inst, int index) { UNIMPLEMENTED_INSTRUCTION("SSAT"); } 2710ARM_INST_PTR INTERPRETER_TRANSLATE(ssat)(unsigned int inst, int index) { UNIMPLEMENTED_INSTRUCTION("SSAT"); }
2639ARM_INST_PTR INTERPRETER_TRANSLATE(ssat16)(unsigned int inst, int index) { UNIMPLEMENTED_INSTRUCTION("SSAT16"); } 2711ARM_INST_PTR INTERPRETER_TRANSLATE(ssat16)(unsigned int inst, int index) { UNIMPLEMENTED_INSTRUCTION("SSAT16"); }
2640ARM_INST_PTR INTERPRETER_TRANSLATE(ssub16)(unsigned int inst, int index) { UNIMPLEMENTED_INSTRUCTION("SSUB16"); }
2641ARM_INST_PTR INTERPRETER_TRANSLATE(ssub8)(unsigned int inst, int index) { UNIMPLEMENTED_INSTRUCTION("SSUB8"); } 2712ARM_INST_PTR INTERPRETER_TRANSLATE(ssub8)(unsigned int inst, int index) { UNIMPLEMENTED_INSTRUCTION("SSUB8"); }
2642ARM_INST_PTR INTERPRETER_TRANSLATE(ssubaddx)(unsigned int inst, int index) { UNIMPLEMENTED_INSTRUCTION("SSUBADDX"); } 2713ARM_INST_PTR INTERPRETER_TRANSLATE(ssub16)(unsigned int inst, int index)
2714{
2715 return INTERPRETER_TRANSLATE(sadd16)(inst, index);
2716}
2717ARM_INST_PTR INTERPRETER_TRANSLATE(ssubaddx)(unsigned int inst, int index)
2718{
2719 return INTERPRETER_TRANSLATE(sadd16)(inst, index);
2720}
2643ARM_INST_PTR INTERPRETER_TRANSLATE(stc)(unsigned int inst, int index) 2721ARM_INST_PTR INTERPRETER_TRANSLATE(stc)(unsigned int inst, int index)
2644{ 2722{
2645 arm_inst *inst_base = (arm_inst *)AllocBuffer(sizeof(arm_inst) + sizeof(stc_inst)); 2723 arm_inst *inst_base = (arm_inst *)AllocBuffer(sizeof(arm_inst) + sizeof(stc_inst));
@@ -3746,9 +3824,9 @@ unsigned InterpreterMainLoop(ARMul_State* state)
3746 #define INC_ICOUNTER cpu->icounter++; \ 3824 #define INC_ICOUNTER cpu->icounter++; \
3747 if(cpu->Reg[15] > 0xc0000000) \ 3825 if(cpu->Reg[15] > 0xc0000000) \
3748 cpu->kernel_icounter++; 3826 cpu->kernel_icounter++;
3749 //if (debug_function(core)) \ 3827 /*if (debug_function(core)) \
3750 if (core->check_int_flag) \ 3828 if (core->check_int_flag) \
3751 goto END 3829 goto END*/
3752 //LOG_TRACE(Core_ARM11, "icounter is %llx pc is %x\n", cpu->icounter, cpu->Reg[15]) 3830 //LOG_TRACE(Core_ARM11, "icounter is %llx pc is %x\n", cpu->icounter, cpu->Reg[15])
3753 #else 3831 #else
3754 #define INC_ICOUNTER ; 3832 #define INC_ICOUNTER ;
@@ -3969,18 +4047,18 @@ unsigned InterpreterMainLoop(ARMul_State* state)
3969 4047
3970 #define UPDATE_NFLAG(dst) (cpu->NFlag = BIT(dst, 31) ? 1 : 0) 4048 #define UPDATE_NFLAG(dst) (cpu->NFlag = BIT(dst, 31) ? 1 : 0)
3971 #define UPDATE_ZFLAG(dst) (cpu->ZFlag = dst ? 0 : 1) 4049 #define UPDATE_ZFLAG(dst) (cpu->ZFlag = dst ? 0 : 1)
3972// #define UPDATE_CFLAG(dst, lop, rop) (cpu->CFlag = ((ISNEG(lop) && ISPOS(rop)) || \ 4050/* #define UPDATE_CFLAG(dst, lop, rop) (cpu->CFlag = ((ISNEG(lop) && ISPOS(rop)) || \
3973 (ISNEG(lop) && ISPOS(dst)) || \ 4051 (ISNEG(lop) && ISPOS(dst)) || \
3974 (ISPOS(rop) && ISPOS(dst)))) 4052 (ISPOS(rop) && ISPOS(dst)))) */
3975 #define UPDATE_CFLAG(dst, lop, rop) (cpu->CFlag = ((dst < lop) || (dst < rop))) 4053 #define UPDATE_CFLAG(dst, lop, rop) (cpu->CFlag = ((dst < lop) || (dst < rop)))
3976 #define UPDATE_CFLAG_CARRY_FROM_ADD(lop, rop, flag) (cpu->CFlag = (((uint64_t) lop + (uint64_t) rop + (uint64_t) flag) > 0xffffffff) ) 4054 #define UPDATE_CFLAG_CARRY_FROM_ADD(lop, rop, flag) (cpu->CFlag = (((uint64_t) lop + (uint64_t) rop + (uint64_t) flag) > 0xffffffff) )
3977 #define UPDATE_CFLAG_NOT_BORROW_FROM_FLAG(lop, rop, flag) (cpu->CFlag = ((uint64_t) lop >= ((uint64_t) rop + (uint64_t) flag))) 4055 #define UPDATE_CFLAG_NOT_BORROW_FROM_FLAG(lop, rop, flag) (cpu->CFlag = ((uint64_t) lop >= ((uint64_t) rop + (uint64_t) flag)))
3978 #define UPDATE_CFLAG_NOT_BORROW_FROM(lop, rop) (cpu->CFlag = (lop >= rop)) 4056 #define UPDATE_CFLAG_NOT_BORROW_FROM(lop, rop) (cpu->CFlag = (lop >= rop))
3979 #define UPDATE_CFLAG_WITH_NOT(dst, lop, rop) (cpu->CFlag = !(dst < lop)) 4057 #define UPDATE_CFLAG_WITH_NOT(dst, lop, rop) (cpu->CFlag = !(dst < lop))
3980 #define UPDATE_CFLAG_WITH_SC cpu->CFlag = cpu->shifter_carry_out 4058 #define UPDATE_CFLAG_WITH_SC cpu->CFlag = cpu->shifter_carry_out
3981// #define UPDATE_CFLAG_WITH_NOT(dst, lop, rop) cpu->CFlag = !((ISNEG(lop) && ISPOS(rop)) || \ 4059/* #define UPDATE_CFLAG_WITH_NOT(dst, lop, rop) cpu->CFlag = !((ISNEG(lop) && ISPOS(rop)) || \
3982 (ISNEG(lop) && ISPOS(dst)) || \ 4060 (ISNEG(lop) && ISPOS(dst)) || \
3983 (ISPOS(rop) && ISPOS(dst))) 4061 (ISPOS(rop) && ISPOS(dst))) */
3984 #define UPDATE_VFLAG(dst, lop, rop) (cpu->VFlag = (((lop < 0) && (rop < 0) && (dst >= 0)) || \ 4062 #define UPDATE_VFLAG(dst, lop, rop) (cpu->VFlag = (((lop < 0) && (rop < 0) && (dst >= 0)) || \
3985 ((lop >= 0) && (rop) >= 0 && (dst < 0)))) 4063 ((lop >= 0) && (rop) >= 0 && (dst < 0))))
3986 #define UPDATE_VFLAG_WITH_NOT(dst, lop, rop) (cpu->VFlag = !(((lop < 0) && (rop < 0) && (dst >= 0)) || \ 4064 #define UPDATE_VFLAG_WITH_NOT(dst, lop, rop) (cpu->VFlag = !(((lop < 0) && (rop < 0) && (dst >= 0)) || \
@@ -5509,15 +5587,69 @@ unsigned InterpreterMainLoop(ARMul_State* state)
5509 GOTO_NEXT_INST; 5587 GOTO_NEXT_INST;
5510 } 5588 }
5511 QADD_INST: 5589 QADD_INST:
5512 QADD16_INST:
5513 QADD8_INST: 5590 QADD8_INST:
5591
5592 QADD16_INST:
5514 QADDSUBX_INST: 5593 QADDSUBX_INST:
5594 QSUB16_INST:
5595 QSUBADDX_INST:
5596 {
5597 INC_ICOUNTER;
5598 if (inst_base->cond == 0xE || CondPassed(cpu, inst_base->cond)) {
5599 generic_arm_inst* const inst_cream = (generic_arm_inst*)inst_base->component;
5600 const s16 rm_lo = (RM & 0xFFFF);
5601 const s16 rm_hi = ((RM >> 16) & 0xFFFF);
5602 const s16 rn_lo = (RN & 0xFFFF);
5603 const s16 rn_hi = ((RN >> 16) & 0xFFFF);
5604 const u8 op2 = inst_cream->op2;
5605
5606 s32 lo_result = 0;
5607 s32 hi_result = 0;
5608
5609 // QADD16
5610 if (op2 == 0x00) {
5611 lo_result = (rn_lo + rm_lo);
5612 hi_result = (rn_hi + rm_hi);
5613 }
5614 // QASX
5615 else if (op2 == 0x01) {
5616 lo_result = (rn_lo - rm_hi);
5617 hi_result = (rn_hi + rm_lo);
5618 }
5619 // QSAX
5620 else if (op2 == 0x02) {
5621 lo_result = (rn_lo + rm_hi);
5622 hi_result = (rn_hi - rm_lo);
5623 }
5624 // QSUB16
5625 else if (op2 == 0x03) {
5626 lo_result = (rn_lo - rm_lo);
5627 hi_result = (rn_hi - rm_hi);
5628 }
5629
5630 if (lo_result > 0x7FFF)
5631 lo_result = 0x7FFF;
5632 else if (lo_result < -0x8000)
5633 lo_result = -0x8000;
5634
5635 if (hi_result > 0x7FFF)
5636 hi_result = 0x7FFF;
5637 else if (hi_result < -0x8000)
5638 hi_result = -0x8000;
5639
5640 RD = (lo_result & 0xFFFF) | ((hi_result & 0xFFFF) << 16);
5641 }
5642
5643 cpu->Reg[15] += GET_INST_SIZE(cpu);
5644 INC_PC(sizeof(generic_arm_inst));
5645 FETCH_INST;
5646 GOTO_NEXT_INST;
5647 }
5648
5515 QDADD_INST: 5649 QDADD_INST:
5516 QDSUB_INST: 5650 QDSUB_INST:
5517 QSUB_INST: 5651 QSUB_INST:
5518 QSUB16_INST:
5519 QSUB8_INST: 5652 QSUB8_INST:
5520 QSUBADDX_INST:
5521 REV_INST: 5653 REV_INST:
5522 { 5654 {
5523 INC_ICOUNTER; 5655 INC_ICOUNTER;
@@ -5626,9 +5758,71 @@ unsigned InterpreterMainLoop(ARMul_State* state)
5626 FETCH_INST; 5758 FETCH_INST;
5627 GOTO_NEXT_INST; 5759 GOTO_NEXT_INST;
5628 } 5760 }
5629 SADD16_INST:
5630 SADD8_INST: 5761 SADD8_INST:
5762
5763 SADD16_INST:
5631 SADDSUBX_INST: 5764 SADDSUBX_INST:
5765 SSUBADDX_INST:
5766 SSUB16_INST:
5767 {
5768 INC_ICOUNTER;
5769 if (inst_base->cond == 0xE || CondPassed(cpu, inst_base->cond)) {
5770 generic_arm_inst* const inst_cream = (generic_arm_inst*)inst_base->component;
5771
5772 const s16 rn_lo = (RN & 0xFFFF);
5773 const s16 rn_hi = ((RN >> 16) & 0xFFFF);
5774 const s16 rm_lo = (RM & 0xFFFF);
5775 const s16 rm_hi = ((RM >> 16) & 0xFFFF);
5776
5777 s32 lo_result = 0;
5778 s32 hi_result = 0;
5779
5780 // SADD16
5781 if (inst_cream->op2 == 0x00) {
5782 lo_result = (rn_lo + rm_lo);
5783 hi_result = (rn_hi + rm_hi);
5784 }
5785 // SASX
5786 else if (inst_cream->op2 == 0x01) {
5787 lo_result = (rn_lo - rm_hi);
5788 hi_result = (rn_hi + rm_lo);
5789 }
5790 // SSAX
5791 else if (inst_cream->op2 == 0x02) {
5792 lo_result = (rn_lo + rm_hi);
5793 hi_result = (rn_hi - rm_lo);
5794 }
5795 // SSUB16
5796 else if (inst_cream->op2 == 0x03) {
5797 lo_result = (rn_lo - rm_lo);
5798 hi_result = (rn_hi - rm_hi);
5799 }
5800
5801 RD = (lo_result & 0xFFFF) | ((hi_result & 0xFFFF) << 16);
5802
5803 if (lo_result >= 0) {
5804 cpu->Cpsr |= (1 << 16);
5805 cpu->Cpsr |= (1 << 17);
5806 } else {
5807 cpu->Cpsr &= ~(1 << 16);
5808 cpu->Cpsr &= ~(1 << 17);
5809 }
5810
5811 if (hi_result >= 0) {
5812 cpu->Cpsr |= (1 << 18);
5813 cpu->Cpsr |= (1 << 19);
5814 } else {
5815 cpu->Cpsr &= ~(1 << 18);
5816 cpu->Cpsr &= ~(1 << 19);
5817 }
5818 }
5819
5820 cpu->Reg[15] += GET_INST_SIZE(cpu);
5821 INC_PC(sizeof(generic_arm_inst));
5822 FETCH_INST;
5823 GOTO_NEXT_INST;
5824 }
5825
5632 SBC_INST: 5826 SBC_INST:
5633 { 5827 {
5634 INC_ICOUNTER; 5828 INC_ICOUNTER;
@@ -5667,7 +5861,47 @@ unsigned InterpreterMainLoop(ARMul_State* state)
5667 FETCH_INST; 5861 FETCH_INST;
5668 GOTO_NEXT_INST; 5862 GOTO_NEXT_INST;
5669 } 5863 }
5864
5670 SEL_INST: 5865 SEL_INST:
5866 {
5867 INC_ICOUNTER;
5868 if (inst_base->cond == 0xE || CondPassed(cpu, inst_base->cond)) {
5869 generic_arm_inst* const inst_cream = (generic_arm_inst*)inst_base->component;
5870
5871 const u32 to = RM;
5872 const u32 from = RN;
5873 const u32 cpsr = cpu->Cpsr;
5874
5875 u32 result;
5876 if (cpsr & (1 << 16))
5877 result = from & 0xff;
5878 else
5879 result = to & 0xff;
5880
5881 if (cpsr & (1 << 17))
5882 result |= from & 0x0000ff00;
5883 else
5884 result |= to & 0x0000ff00;
5885
5886 if (cpsr & (1 << 18))
5887 result |= from & 0x00ff0000;
5888 else
5889 result |= to & 0x00ff0000;
5890
5891 if (cpsr & (1 << 19))
5892 result |= from & 0xff000000;
5893 else
5894 result |= to & 0xff000000;
5895
5896 RD = result;
5897 }
5898
5899 cpu->Reg[15] += GET_INST_SIZE(cpu);
5900 INC_PC(sizeof(generic_arm_inst));
5901 FETCH_INST;
5902 GOTO_NEXT_INST;
5903 }
5904
5671 SETEND_INST: 5905 SETEND_INST:
5672 SHADD16_INST: 5906 SHADD16_INST:
5673 SHADD8_INST: 5907 SHADD8_INST:
@@ -5851,9 +6085,7 @@ unsigned InterpreterMainLoop(ARMul_State* state)
5851 SRS_INST: 6085 SRS_INST:
5852 SSAT_INST: 6086 SSAT_INST:
5853 SSAT16_INST: 6087 SSAT16_INST:
5854 SSUB16_INST:
5855 SSUB8_INST: 6088 SSUB8_INST:
5856 SSUBADDX_INST:
5857 STC_INST: 6089 STC_INST:
5858 { 6090 {
5859 INC_ICOUNTER; 6091 INC_ICOUNTER;
diff --git a/src/core/arm/dyncom/arm_dyncom_interpreter.h b/src/core/arm/dyncom/arm_dyncom_interpreter.h
index 3a2462f55..4791ea25f 100644
--- a/src/core/arm/dyncom/arm_dyncom_interpreter.h
+++ b/src/core/arm/dyncom/arm_dyncom_interpreter.h
@@ -1,5 +1,5 @@
1// Copyright 2014 Citra Emulator Project 1// Copyright 2014 Citra Emulator Project
2// Licensed under GPLv2 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#pragma once 5#pragma once
diff --git a/src/core/arm/dyncom/arm_dyncom_run.cpp b/src/core/arm/dyncom/arm_dyncom_run.cpp
index a2026cbf3..b66b92cf5 100644
--- a/src/core/arm/dyncom/arm_dyncom_run.cpp
+++ b/src/core/arm/dyncom/arm_dyncom_run.cpp
@@ -29,7 +29,6 @@
29 29
30void switch_mode(arm_core_t *core, uint32_t mode) 30void switch_mode(arm_core_t *core, uint32_t mode)
31{ 31{
32 uint32_t tmp1, tmp2;
33 if (core->Mode == mode) { 32 if (core->Mode == mode) {
34 //Mode not changed. 33 //Mode not changed.
35 //printf("mode not changed\n"); 34 //printf("mode not changed\n");
diff --git a/src/core/arm/interpreter/arm_interpreter.cpp b/src/core/arm/interpreter/arm_interpreter.cpp
index e2aa5ce92..80ebc359e 100644
--- a/src/core/arm/interpreter/arm_interpreter.cpp
+++ b/src/core/arm/interpreter/arm_interpreter.cpp
@@ -1,5 +1,5 @@
1// Copyright 2014 Citra Emulator Project 1// Copyright 2014 Citra Emulator Project
2// Licensed under GPLv2 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/arm/interpreter/arm_interpreter.h" 5#include "core/arm/interpreter/arm_interpreter.h"
@@ -38,78 +38,43 @@ ARM_Interpreter::~ARM_Interpreter() {
38 delete state; 38 delete state;
39} 39}
40 40
41/**
42 * Set the Program Counter to an address
43 * @param addr Address to set PC to
44 */
45void ARM_Interpreter::SetPC(u32 pc) { 41void ARM_Interpreter::SetPC(u32 pc) {
46 state->pc = state->Reg[15] = pc; 42 state->pc = state->Reg[15] = pc;
47} 43}
48 44
49/*
50 * Get the current Program Counter
51 * @return Returns current PC
52 */
53u32 ARM_Interpreter::GetPC() const { 45u32 ARM_Interpreter::GetPC() const {
54 return state->pc; 46 return state->pc;
55} 47}
56 48
57/**
58 * Get an ARM register
59 * @param index Register index (0-15)
60 * @return Returns the value in the register
61 */
62u32 ARM_Interpreter::GetReg(int index) const { 49u32 ARM_Interpreter::GetReg(int index) const {
63 return state->Reg[index]; 50 return state->Reg[index];
64} 51}
65 52
66/**
67 * Set an ARM register
68 * @param index Register index (0-15)
69 * @param value Value to set register to
70 */
71void ARM_Interpreter::SetReg(int index, u32 value) { 53void ARM_Interpreter::SetReg(int index, u32 value) {
72 state->Reg[index] = value; 54 state->Reg[index] = value;
73} 55}
74 56
75/**
76 * Get the current CPSR register
77 * @return Returns the value of the CPSR register
78 */
79u32 ARM_Interpreter::GetCPSR() const { 57u32 ARM_Interpreter::GetCPSR() const {
80 return state->Cpsr; 58 return state->Cpsr;
81} 59}
82 60
83/**
84 * Set the current CPSR register
85 * @param cpsr Value to set CPSR to
86 */
87void ARM_Interpreter::SetCPSR(u32 cpsr) { 61void ARM_Interpreter::SetCPSR(u32 cpsr) {
88 state->Cpsr = cpsr; 62 state->Cpsr = cpsr;
89} 63}
90 64
91/**
92 * Returns the number of clock ticks since the last reset
93 * @return Returns number of clock ticks
94 */
95u64 ARM_Interpreter::GetTicks() const { 65u64 ARM_Interpreter::GetTicks() const {
96 return ARMul_Time(state); 66 return state->NumInstrs;
67}
68
69void ARM_Interpreter::AddTicks(u64 ticks) {
70 state->NumInstrs += ticks;
97} 71}
98 72
99/**
100 * Executes the given number of instructions
101 * @param num_instructions Number of instructions to executes
102 */
103void ARM_Interpreter::ExecuteInstructions(int num_instructions) { 73void ARM_Interpreter::ExecuteInstructions(int num_instructions) {
104 state->NumInstrsToExecute = num_instructions - 1; 74 state->NumInstrsToExecute = num_instructions - 1;
105 ARMul_Emulate32(state); 75 ARMul_Emulate32(state);
106} 76}
107 77
108/**
109 * Saves the current CPU context
110 * @param ctx Thread context to save
111 * @todo Do we need to save Reg[15] and NextInstr?
112 */
113void ARM_Interpreter::SaveContext(ThreadContext& ctx) { 78void ARM_Interpreter::SaveContext(ThreadContext& ctx) {
114 memcpy(ctx.cpu_registers, state->Reg, sizeof(ctx.cpu_registers)); 79 memcpy(ctx.cpu_registers, state->Reg, sizeof(ctx.cpu_registers));
115 memcpy(ctx.fpu_registers, state->ExtReg, sizeof(ctx.fpu_registers)); 80 memcpy(ctx.fpu_registers, state->ExtReg, sizeof(ctx.fpu_registers));
@@ -126,11 +91,6 @@ void ARM_Interpreter::SaveContext(ThreadContext& ctx) {
126 ctx.mode = state->NextInstr; 91 ctx.mode = state->NextInstr;
127} 92}
128 93
129/**
130 * Loads a CPU context
131 * @param ctx Thread context to load
132 * @param Do we need to load Reg[15] and NextInstr?
133 */
134void ARM_Interpreter::LoadContext(const ThreadContext& ctx) { 94void ARM_Interpreter::LoadContext(const ThreadContext& ctx) {
135 memcpy(state->Reg, ctx.cpu_registers, sizeof(ctx.cpu_registers)); 95 memcpy(state->Reg, ctx.cpu_registers, sizeof(ctx.cpu_registers));
136 memcpy(state->ExtReg, ctx.fpu_registers, sizeof(ctx.fpu_registers)); 96 memcpy(state->ExtReg, ctx.fpu_registers, sizeof(ctx.fpu_registers));
@@ -147,7 +107,6 @@ void ARM_Interpreter::LoadContext(const ThreadContext& ctx) {
147 state->NextInstr = ctx.mode; 107 state->NextInstr = ctx.mode;
148} 108}
149 109
150/// Prepare core for thread reschedule (if needed to correctly handle state)
151void ARM_Interpreter::PrepareReschedule() { 110void ARM_Interpreter::PrepareReschedule() {
152 state->NumInstrsToExecute = 0; 111 state->NumInstrsToExecute = 0;
153} 112}
diff --git a/src/core/arm/interpreter/arm_interpreter.h b/src/core/arm/interpreter/arm_interpreter.h
index ed53d997c..019dad5df 100644
--- a/src/core/arm/interpreter/arm_interpreter.h
+++ b/src/core/arm/interpreter/arm_interpreter.h
@@ -1,5 +1,5 @@
1// Copyright 2014 Citra Emulator Project 1// Copyright 2014 Citra Emulator Project
2// Licensed under GPLv2 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#pragma once 5#pragma once
@@ -61,6 +61,12 @@ public:
61 u64 GetTicks() const override; 61 u64 GetTicks() const override;
62 62
63 /** 63 /**
64 * Advance the CPU core by the specified number of ticks (e.g. to simulate CPU execution time)
65 * @param ticks Number of ticks to advance the CPU core
66 */
67 void AddTicks(u64 ticks) override;
68
69 /**
64 * Saves the current CPU context 70 * Saves the current CPU context
65 * @param ctx Thread context to save 71 * @param ctx Thread context to save
66 */ 72 */
diff --git a/src/core/arm/interpreter/armemu.cpp b/src/core/arm/interpreter/armemu.cpp
index 610e04f10..d54dbeac5 100644
--- a/src/core/arm/interpreter/armemu.cpp
+++ b/src/core/arm/interpreter/armemu.cpp
@@ -1670,7 +1670,7 @@ mainswitch:
1670 op1 *= op2; 1670 op1 *= op2;
1671 //printf("SMLA_INST:BB,op1=0x%x, op2=0x%x. Rn=0x%x\n", op1, op2, Rn); 1671 //printf("SMLA_INST:BB,op1=0x%x, op2=0x%x. Rn=0x%x\n", op1, op2, Rn);
1672 if (AddOverflow(op1, Rn, op1 + Rn)) 1672 if (AddOverflow(op1, Rn, op1 + Rn))
1673 SETS; 1673 SETQ;
1674 state->Reg[BITS (16, 19)] = op1 + Rn; 1674 state->Reg[BITS (16, 19)] = op1 + Rn;
1675 break; 1675 break;
1676 } 1676 }
@@ -1682,7 +1682,7 @@ mainswitch:
1682 ARMword result = op1 + op2; 1682 ARMword result = op1 + op2;
1683 if (AddOverflow(op1, op2, result)) { 1683 if (AddOverflow(op1, op2, result)) {
1684 result = POS (result) ? 0x80000000 : 0x7fffffff; 1684 result = POS (result) ? 0x80000000 : 0x7fffffff;
1685 SETS; 1685 SETQ;
1686 } 1686 }
1687 state->Reg[BITS (12, 15)] = result; 1687 state->Reg[BITS (12, 15)] = result;
1688 break; 1688 break;
@@ -1724,7 +1724,7 @@ mainswitch:
1724 TAKEABORT; 1724 TAKEABORT;
1725 } else if ((BITS (0, 11) == 0) && (LHSReg == 15)) { /* MRS CPSR */ 1725 } else if ((BITS (0, 11) == 0) && (LHSReg == 15)) { /* MRS CPSR */
1726 UNDEF_MRSPC; 1726 UNDEF_MRSPC;
1727 DEST = ECC | EINT | EMODE; 1727 DEST = ARMul_GetCPSR(state);
1728 } else { 1728 } else {
1729 UNDEF_Test; 1729 UNDEF_Test;
1730 } 1730 }
@@ -1795,7 +1795,7 @@ mainswitch:
1795 ARMword Rn = state->Reg[BITS(12, 15)]; 1795 ARMword Rn = state->Reg[BITS(12, 15)];
1796 1796
1797 if (AddOverflow((ARMword)result, Rn, (ARMword)(result + Rn))) 1797 if (AddOverflow((ARMword)result, Rn, (ARMword)(result + Rn)))
1798 SETS; 1798 SETQ;
1799 result += Rn; 1799 result += Rn;
1800 } 1800 }
1801 state->Reg[BITS (16, 19)] = (ARMword)result; 1801 state->Reg[BITS (16, 19)] = (ARMword)result;
@@ -1811,7 +1811,7 @@ mainswitch:
1811 if (SubOverflow 1811 if (SubOverflow
1812 (op1, op2, result)) { 1812 (op1, op2, result)) {
1813 result = POS (result) ? 0x80000000 : 0x7fffffff; 1813 result = POS (result) ? 0x80000000 : 0x7fffffff;
1814 SETS; 1814 SETQ;
1815 } 1815 }
1816 1816
1817 state->Reg[BITS (12, 15)] = result; 1817 state->Reg[BITS (12, 15)] = result;
@@ -1934,13 +1934,13 @@ mainswitch:
1934 1934
1935 if (AddOverflow 1935 if (AddOverflow
1936 (op2, op2, op2d)) { 1936 (op2, op2, op2d)) {
1937 SETS; 1937 SETQ;
1938 op2d = POS (op2d) ? 0x80000000 : 0x7fffffff; 1938 op2d = POS (op2d) ? 0x80000000 : 0x7fffffff;
1939 } 1939 }
1940 1940
1941 result = op1 + op2d; 1941 result = op1 + op2d;
1942 if (AddOverflow(op1, op2d, result)) { 1942 if (AddOverflow(op1, op2d, result)) {
1943 SETS; 1943 SETQ;
1944 result = POS (result) ? 0x80000000 : 0x7fffffff; 1944 result = POS (result) ? 0x80000000 : 0x7fffffff;
1945 } 1945 }
1946 1946
@@ -2053,13 +2053,13 @@ mainswitch:
2053 ARMword result; 2053 ARMword result;
2054 2054
2055 if (AddOverflow(op2, op2, op2d)) { 2055 if (AddOverflow(op2, op2, op2d)) {
2056 SETS; 2056 SETQ;
2057 op2d = POS (op2d) ? 0x80000000 : 0x7fffffff; 2057 op2d = POS (op2d) ? 0x80000000 : 0x7fffffff;
2058 } 2058 }
2059 2059
2060 result = op1 - op2d; 2060 result = op1 - op2d;
2061 if (SubOverflow(op1, op2d, result)) { 2061 if (SubOverflow(op1, op2d, result)) {
2062 SETS; 2062 SETQ;
2063 result = POS (result) ? 0x80000000 : 0x7fffffff; 2063 result = POS (result) ? 0x80000000 : 0x7fffffff;
2064 } 2064 }
2065 2065
@@ -5863,20 +5863,21 @@ L_stm_s_takeabort:
5863 state->Reg[rd_idx] = (lo_result & 0xFFFF) | ((hi_result & 0xFFFF) << 16); 5863 state->Reg[rd_idx] = (lo_result & 0xFFFF) | ((hi_result & 0xFFFF) << 16);
5864 5864
5865 if (lo_result >= 0) { 5865 if (lo_result >= 0) {
5866 state->Cpsr |= (1 << 16); 5866 state->GEFlag |= (1 << 16);
5867 state->Cpsr |= (1 << 17); 5867 state->GEFlag |= (1 << 17);
5868 } else { 5868 } else {
5869 state->Cpsr &= ~(1 << 16); 5869 state->GEFlag &= ~(1 << 16);
5870 state->Cpsr &= ~(1 << 17); 5870 state->GEFlag &= ~(1 << 17);
5871 } 5871 }
5872 5872
5873 if (hi_result >= 0) { 5873 if (hi_result >= 0) {
5874 state->Cpsr |= (1 << 18); 5874 state->GEFlag |= (1 << 18);
5875 state->Cpsr |= (1 << 19); 5875 state->GEFlag |= (1 << 19);
5876 } else { 5876 } else {
5877 state->Cpsr &= ~(1 << 18); 5877 state->GEFlag &= ~(1 << 18);
5878 state->Cpsr &= ~(1 << 19); 5878 state->GEFlag &= ~(1 << 19);
5879 } 5879 }
5880
5880 return 1; 5881 return 1;
5881 } 5882 }
5882 // SADD8/SSUB8 5883 // SADD8/SSUB8
@@ -5901,24 +5902,24 @@ L_stm_s_takeabort:
5901 hi_val2 = (u8)(((rn_val >> 24) & 0xFF) + ((rm_val >> 24) & 0xFF)); 5902 hi_val2 = (u8)(((rn_val >> 24) & 0xFF) + ((rm_val >> 24) & 0xFF));
5902 5903
5903 if (lo_val1 & 0x80) 5904 if (lo_val1 & 0x80)
5904 state->Cpsr |= (1 << 16); 5905 state->GEFlag |= (1 << 16);
5905 else 5906 else
5906 state->Cpsr &= ~(1 << 16); 5907 state->GEFlag &= ~(1 << 16);
5907 5908
5908 if (lo_val2 & 0x80) 5909 if (lo_val2 & 0x80)
5909 state->Cpsr |= (1 << 17); 5910 state->GEFlag |= (1 << 17);
5910 else 5911 else
5911 state->Cpsr &= ~(1 << 17); 5912 state->GEFlag &= ~(1 << 17);
5912 5913
5913 if (hi_val1 & 0x80) 5914 if (hi_val1 & 0x80)
5914 state->Cpsr |= (1 << 18); 5915 state->GEFlag |= (1 << 18);
5915 else 5916 else
5916 state->Cpsr &= ~(1 << 18); 5917 state->GEFlag &= ~(1 << 18);
5917 5918
5918 if (hi_val2 & 0x80) 5919 if (hi_val2 & 0x80)
5919 state->Cpsr |= (1 << 19); 5920 state->GEFlag |= (1 << 19);
5920 else 5921 else
5921 state->Cpsr &= ~(1 << 19); 5922 state->GEFlag &= ~(1 << 19);
5922 } 5923 }
5923 // SSUB8 5924 // SSUB8
5924 else { 5925 else {
@@ -5928,24 +5929,24 @@ L_stm_s_takeabort:
5928 hi_val2 = (u8)(((rn_val >> 24) & 0xFF) - ((rm_val >> 24) & 0xFF)); 5929 hi_val2 = (u8)(((rn_val >> 24) & 0xFF) - ((rm_val >> 24) & 0xFF));
5929 5930
5930 if (!(lo_val1 & 0x80)) 5931 if (!(lo_val1 & 0x80))
5931 state->Cpsr |= (1 << 16); 5932 state->GEFlag |= (1 << 16);
5932 else 5933 else
5933 state->Cpsr &= ~(1 << 16); 5934 state->GEFlag &= ~(1 << 16);
5934 5935
5935 if (!(lo_val2 & 0x80)) 5936 if (!(lo_val2 & 0x80))
5936 state->Cpsr |= (1 << 17); 5937 state->GEFlag |= (1 << 17);
5937 else 5938 else
5938 state->Cpsr &= ~(1 << 17); 5939 state->GEFlag &= ~(1 << 17);
5939 5940
5940 if (!(hi_val1 & 0x80)) 5941 if (!(hi_val1 & 0x80))
5941 state->Cpsr |= (1 << 18); 5942 state->GEFlag |= (1 << 18);
5942 else 5943 else
5943 state->Cpsr &= ~(1 << 18); 5944 state->GEFlag &= ~(1 << 18);
5944 5945
5945 if (!(hi_val2 & 0x80)) 5946 if (!(hi_val2 & 0x80))
5946 state->Cpsr |= (1 << 19); 5947 state->GEFlag |= (1 << 19);
5947 else 5948 else
5948 state->Cpsr &= ~(1 << 19); 5949 state->GEFlag &= ~(1 << 19);
5949 } 5950 }
5950 5951
5951 state->Reg[rd_idx] = (lo_val1 | lo_val2 << 8 | hi_val1 << 16 | hi_val2 << 24); 5952 state->Reg[rd_idx] = (lo_val1 | lo_val2 << 8 | hi_val1 << 16 | hi_val2 << 24);
@@ -6024,15 +6025,32 @@ L_stm_s_takeabort:
6024 if ((instr & 0x0F0) == 0x070) { // USUB16 6025 if ((instr & 0x0F0) == 0x070) { // USUB16
6025 h1 = ((u16)from - (u16)to); 6026 h1 = ((u16)from - (u16)to);
6026 h2 = ((u16)(from >> 16) - (u16)(to >> 16)); 6027 h2 = ((u16)(from >> 16) - (u16)(to >> 16));
6027 if (!(h1 & 0xffff0000)) state->Cpsr |= (3 << 16); 6028
6028 if (!(h2 & 0xffff0000)) state->Cpsr |= (3 << 18); 6029 if (!(h1 & 0xffff0000))
6030 state->GEFlag |= (3 << 16);
6031 else
6032 state->GEFlag &= ~(3 << 16);
6033
6034 if (!(h2 & 0xffff0000))
6035 state->GEFlag |= (3 << 18);
6036 else
6037 state->GEFlag &= ~(3 << 18);
6029 } 6038 }
6030 else { // UADD16 6039 else { // UADD16
6031 h1 = ((u16)from + (u16)to); 6040 h1 = ((u16)from + (u16)to);
6032 h2 = ((u16)(from >> 16) + (u16)(to >> 16)); 6041 h2 = ((u16)(from >> 16) + (u16)(to >> 16));
6033 if (h1 & 0xffff0000) state->Cpsr |= (3 << 16); 6042
6034 if (h2 & 0xffff0000) state->Cpsr |= (3 << 18); 6043 if (h1 & 0xffff0000)
6044 state->GEFlag |= (3 << 16);
6045 else
6046 state->GEFlag &= ~(3 << 16);
6047
6048 if (h2 & 0xffff0000)
6049 state->GEFlag |= (3 << 18);
6050 else
6051 state->GEFlag &= ~(3 << 18);
6035 } 6052 }
6053
6036 state->Reg[rd] = (u32)((h1 & 0xffff) | ((h2 & 0xffff) << 16)); 6054 state->Reg[rd] = (u32)((h1 & 0xffff) | ((h2 & 0xffff) << 16));
6037 return 1; 6055 return 1;
6038 } 6056 }
@@ -6045,10 +6063,26 @@ L_stm_s_takeabort:
6045 b2 = ((u8)(from >> 8) - (u8)(to >> 8)); 6063 b2 = ((u8)(from >> 8) - (u8)(to >> 8));
6046 b3 = ((u8)(from >> 16) - (u8)(to >> 16)); 6064 b3 = ((u8)(from >> 16) - (u8)(to >> 16));
6047 b4 = ((u8)(from >> 24) - (u8)(to >> 24)); 6065 b4 = ((u8)(from >> 24) - (u8)(to >> 24));
6048 if (!(b1 & 0xffffff00)) state->Cpsr |= (1 << 16); 6066
6049 if (!(b2 & 0xffffff00)) state->Cpsr |= (1 << 17); 6067 if (!(b1 & 0xffffff00))
6050 if (!(b3 & 0xffffff00)) state->Cpsr |= (1 << 18); 6068 state->GEFlag |= (1 << 16);
6051 if (!(b4 & 0xffffff00)) state->Cpsr |= (1 << 19); 6069 else
6070 state->GEFlag &= ~(1 << 16);
6071
6072 if (!(b2 & 0xffffff00))
6073 state->GEFlag |= (1 << 17);
6074 else
6075 state->GEFlag &= ~(1 << 17);
6076
6077 if (!(b3 & 0xffffff00))
6078 state->GEFlag |= (1 << 18);
6079 else
6080 state->GEFlag &= ~(1 << 18);
6081
6082 if (!(b4 & 0xffffff00))
6083 state->GEFlag |= (1 << 19);
6084 else
6085 state->GEFlag &= ~(1 << 19);
6052 } 6086 }
6053 else { // UADD8 6087 else { // UADD8
6054 b1 = ((u8)from + (u8)to); 6088 b1 = ((u8)from + (u8)to);
@@ -6057,25 +6091,24 @@ L_stm_s_takeabort:
6057 b4 = ((u8)(from >> 24) + (u8)(to >> 24)); 6091 b4 = ((u8)(from >> 24) + (u8)(to >> 24));
6058 6092
6059 if (b1 & 0xffffff00) 6093 if (b1 & 0xffffff00)
6060 state->Cpsr |= (1 << 16); 6094 state->GEFlag |= (1 << 16);
6061 else 6095 else
6062 state->Cpsr &= ~(1 << 16); 6096 state->GEFlag &= ~(1 << 16);
6063 6097
6064 if (b2 & 0xffffff00) 6098 if (b2 & 0xffffff00)
6065 state->Cpsr |= (1 << 17); 6099 state->GEFlag |= (1 << 17);
6066 else 6100 else
6067 state->Cpsr &= ~(1 << 17); 6101 state->GEFlag &= ~(1 << 17);
6068 6102
6069 if (b3 & 0xffffff00) 6103 if (b3 & 0xffffff00)
6070 state->Cpsr |= (1 << 18); 6104 state->GEFlag |= (1 << 18);
6071 else 6105 else
6072 state->Cpsr &= ~(1 << 18); 6106 state->GEFlag &= ~(1 << 18);
6073
6074 6107
6075 if (b4 & 0xffffff00) 6108 if (b4 & 0xffffff00)
6076 state->Cpsr |= (1 << 19); 6109 state->GEFlag |= (1 << 19);
6077 else 6110 else
6078 state->Cpsr &= ~(1 << 19); 6111 state->GEFlag &= ~(1 << 19);
6079 } 6112 }
6080 6113
6081 state->Reg[rd] = (u32)(b1 | (b2 & 0xff) << 8 | (b3 & 0xff) << 16 | (b4 & 0xff) << 24); 6114 state->Reg[rd] = (u32)(b1 | (b2 & 0xff) << 8 | (b3 & 0xff) << 16 | (b4 & 0xff) << 24);
@@ -6116,7 +6149,7 @@ L_stm_s_takeabort:
6116 u32 rm = (instr >> 0) & 0xF; 6149 u32 rm = (instr >> 0) & 0xF;
6117 u32 from = state->Reg[rn]; 6150 u32 from = state->Reg[rn];
6118 u32 to = state->Reg[rm]; 6151 u32 to = state->Reg[rm];
6119 u32 cpsr = state->Cpsr; 6152 u32 cpsr = ARMul_GetCPSR(state);
6120 if ((instr & 0xFF0) == 0xFB0) { // SEL 6153 if ((instr & 0xFF0) == 0xFB0) { // SEL
6121 u32 result; 6154 u32 result;
6122 if (cpsr & (1 << 16)) 6155 if (cpsr & (1 << 16))
@@ -6172,15 +6205,21 @@ L_stm_s_takeabort:
6172 s16 rn_lo = (state->Reg[rn_idx]); 6205 s16 rn_lo = (state->Reg[rn_idx]);
6173 s16 rn_hi = (state->Reg[rn_idx] >> 16); 6206 s16 rn_hi = (state->Reg[rn_idx] >> 16);
6174 6207
6175 if (rn_lo > max) 6208 if (rn_lo > max) {
6176 rn_lo = max; 6209 rn_lo = max;
6177 else if (rn_lo < min) 6210 SETQ;
6211 } else if (rn_lo < min) {
6178 rn_lo = min; 6212 rn_lo = min;
6213 SETQ;
6214 }
6179 6215
6180 if (rn_hi > max) 6216 if (rn_hi > max) {
6181 rn_hi = max; 6217 rn_hi = max;
6182 else if (rn_hi < min) 6218 SETQ;
6219 } else if (rn_hi < min) {
6183 rn_hi = min; 6220 rn_hi = min;
6221 SETQ;
6222 }
6184 6223
6185 state->Reg[rd_idx] = (rn_lo & 0xFFFF) | ((rn_hi & 0xFFFF) << 16); 6224 state->Reg[rd_idx] = (rn_lo & 0xFFFF) | ((rn_hi & 0xFFFF) << 16);
6186 return 1; 6225 return 1;
@@ -6313,16 +6352,22 @@ L_stm_s_takeabort:
6313 s16 rn_lo = (state->Reg[rn_idx]); 6352 s16 rn_lo = (state->Reg[rn_idx]);
6314 s16 rn_hi = (state->Reg[rn_idx] >> 16); 6353 s16 rn_hi = (state->Reg[rn_idx] >> 16);
6315 6354
6316 if (max < rn_lo) 6355 if (max < rn_lo) {
6317 rn_lo = max; 6356 rn_lo = max;
6318 else if (rn_lo < 0) 6357 SETQ;
6358 } else if (rn_lo < 0) {
6319 rn_lo = 0; 6359 rn_lo = 0;
6360 SETQ;
6361 }
6320 6362
6321 if (max < rn_hi) 6363 if (max < rn_hi) {
6322 rn_hi = max; 6364 rn_hi = max;
6323 else if (rn_hi < 0) 6365 SETQ;
6366 } else if (rn_hi < 0) {
6324 rn_hi = 0; 6367 rn_hi = 0;
6325 6368 SETQ;
6369 }
6370
6326 state->Reg[rd_idx] = (rn_lo & 0xFFFF) | ((rn_hi << 16) & 0xFFFF); 6371 state->Reg[rd_idx] = (rn_lo & 0xFFFF) | ((rn_hi << 16) & 0xFFFF);
6327 return 1; 6372 return 1;
6328 } 6373 }
@@ -6427,30 +6472,95 @@ L_stm_s_takeabort:
6427 const s16 rn_lo = (rn_val & 0xFFFF); 6472 const s16 rn_lo = (rn_val & 0xFFFF);
6428 const s16 rn_hi = ((rn_val >> 16) & 0xFFFF); 6473 const s16 rn_hi = ((rn_val >> 16) & 0xFFFF);
6429 6474
6430 // SMUAD 6475 const u32 product1 = (rn_lo * rm_lo);
6431 if ((instr & 0xf0d0) == 0xf010) { 6476 const u32 product2 = (rn_hi * rm_hi);
6432 state->Reg[rd_idx] = (rn_lo * rm_lo) + (rn_hi * rm_hi); 6477
6478 // SMUAD and SMLAD
6479 if (BIT(6) == 0) {
6480 state->Reg[rd_idx] = product1 + product2;
6481
6482 if (BITS(12, 15) != 15) {
6483 state->Reg[rd_idx] += state->Reg[ra_idx];
6484 ARMul_AddOverflowQ(state, product1 + product2, state->Reg[ra_idx]);
6485 }
6486
6487 ARMul_AddOverflowQ(state, product1, product2);
6433 } 6488 }
6434 // SMUSD 6489 // SMUSD and SMLSD
6435 else if ((instr & 0xf0d0) == 0xf050) { 6490 else {
6436 state->Reg[rd_idx] = (rn_lo * rm_lo) - (rn_hi * rm_hi); 6491 state->Reg[rd_idx] = product1 - product2;
6492
6493 if (BITS(12, 15) != 15)
6494 state->Reg[rd_idx] += state->Reg[ra_idx];
6437 } 6495 }
6438 // SMLAD 6496
6439 else if ((instr & 0xd0) == 0x10) { 6497 return 1;
6440 state->Reg[rd_idx] = (rn_lo * rm_lo) + (rn_hi * rm_hi) + (s32)state->Reg[ra_idx]; 6498 }
6499 break;
6500 case 0x74: // SMLALD and SMLSLD
6501 {
6502 const u8 rm_idx = BITS(8, 11);
6503 const u8 rn_idx = BITS(0, 3);
6504 const u8 rdlo_idx = BITS(12, 15);
6505 const u8 rdhi_idx = BITS(16, 19);
6506 const bool do_swap = (BIT(5) == 1);
6507
6508 const u32 rdlo_val = state->Reg[rdlo_idx];
6509 const u32 rdhi_val = state->Reg[rdhi_idx];
6510 const u32 rn_val = state->Reg[rn_idx];
6511 u32 rm_val = state->Reg[rm_idx];
6512
6513 if (do_swap)
6514 rm_val = (((rm_val & 0xFFFF) << 16) | (rm_val >> 16));
6515
6516 const s32 product1 = (s16)(rn_val & 0xFFFF) * (s16)(rm_val & 0xFFFF);
6517 const s32 product2 = (s16)((rn_val >> 16) & 0xFFFF) * (s16)((rm_val >> 16) & 0xFFFF);
6518 s64 result;
6519
6520 // SMLALD
6521 if (BIT(6) == 0) {
6522 result = (product1 + product2) + (s64)(rdlo_val | ((s64)rdhi_val << 32));
6441 } 6523 }
6442 // SMLSD 6524 // SMLSLD
6443 else { 6525 else {
6444 state->Reg[rd_idx] = ((rn_lo * rm_lo) - (rn_hi * rm_hi)) + (s32)state->Reg[ra_idx]; 6526 result = (product1 - product2) + (s64)(rdlo_val | ((s64)rdhi_val << 32));
6445 } 6527 }
6528
6529 state->Reg[rdlo_idx] = (result & 0xFFFFFFFF);
6530 state->Reg[rdhi_idx] = ((result >> 32) & 0xFFFFFFFF);
6446 return 1; 6531 return 1;
6447 } 6532 }
6448 break; 6533 break;
6449 case 0x74: 6534 case 0x75: // SMMLA, SMMUL, and SMMLS
6450 printf ("Unhandled v6 insn: smlald/smlsld\n"); 6535 {
6451 break; 6536 const u8 rm_idx = BITS(8, 11);
6452 case 0x75: 6537 const u8 rn_idx = BITS(0, 3);
6453 printf ("Unhandled v6 insn: smmla/smmls/smmul\n"); 6538 const u8 ra_idx = BITS(12, 15);
6539 const u8 rd_idx = BITS(16, 19);
6540 const bool do_round = (BIT(5) == 1);
6541
6542 const u32 rm_val = state->Reg[rm_idx];
6543 const u32 rn_val = state->Reg[rn_idx];
6544
6545 // Assume SMMUL by default.
6546 s64 result = (s64)(s32)rn_val * (s64)(s32)rm_val;
6547
6548 if (ra_idx != 15) {
6549 const u32 ra_val = state->Reg[ra_idx];
6550
6551 // SMMLA, otherwise SMMLS
6552 if (BIT(6) == 0)
6553 result += ((s64)ra_val << 32);
6554 else
6555 result = ((s64)ra_val << 32) - result;
6556 }
6557
6558 if (do_round)
6559 result += 0x80000000;
6560
6561 state->Reg[rd_idx] = ((result >> 32) & 0xFFFFFFFF);
6562 return 1;
6563 }
6454 break; 6564 break;
6455 case 0x78: 6565 case 0x78:
6456 if (BITS(20, 24) == 0x18) 6566 if (BITS(20, 24) == 0x18)
diff --git a/src/core/arm/interpreter/armsupp.cpp b/src/core/arm/interpreter/armsupp.cpp
index 30519f216..6774f8a74 100644
--- a/src/core/arm/interpreter/armsupp.cpp
+++ b/src/core/arm/interpreter/armsupp.cpp
@@ -227,8 +227,9 @@ ARMul_CPSRAltered (ARMul_State * state)
227 //state->Cpsr &= ~CBIT; 227 //state->Cpsr &= ~CBIT;
228 ASSIGNV ((state->Cpsr & VBIT) != 0); 228 ASSIGNV ((state->Cpsr & VBIT) != 0);
229 //state->Cpsr &= ~VBIT; 229 //state->Cpsr &= ~VBIT;
230 ASSIGNS ((state->Cpsr & SBIT) != 0); 230 ASSIGNQ ((state->Cpsr & QBIT) != 0);
231 //state->Cpsr &= ~SBIT; 231 //state->Cpsr &= ~QBIT;
232 state->GEFlag = (state->Cpsr & 0x000F0000);
232#ifdef MODET 233#ifdef MODET
233 ASSIGNT ((state->Cpsr & TBIT) != 0); 234 ASSIGNT ((state->Cpsr & TBIT) != 0);
234 //state->Cpsr &= ~TBIT; 235 //state->Cpsr &= ~TBIT;
@@ -443,6 +444,14 @@ ARMul_AddOverflow (ARMul_State * state, ARMword a, ARMword b, ARMword result)
443 ASSIGNV (AddOverflow (a, b, result)); 444 ASSIGNV (AddOverflow (a, b, result));
444} 445}
445 446
447/* Assigns the Q flag if the given result is considered an overflow from the addition of a and b */
448void ARMul_AddOverflowQ(ARMul_State* state, ARMword a, ARMword b)
449{
450 u32 result = a + b;
451 if (((result ^ a) & (u32)0x80000000) && ((a ^ b) & (u32)0x80000000) == 0)
452 SETQ;
453}
454
446/* Assigns the C flag after an subtraction of a and b to give result. */ 455/* Assigns the C flag after an subtraction of a and b to give result. */
447 456
448void 457void
diff --git a/src/core/arm/skyeye_common/armdefs.h b/src/core/arm/skyeye_common/armdefs.h
index 28a4a0db4..34eb5aaf7 100644
--- a/src/core/arm/skyeye_common/armdefs.h
+++ b/src/core/arm/skyeye_common/armdefs.h
@@ -198,7 +198,7 @@ struct ARMul_State
198 //ARMword translate_pc; 198 //ARMword translate_pc;
199 199
200 /* add armv6 flags dyf:2010-08-09 */ 200 /* add armv6 flags dyf:2010-08-09 */
201 ARMword GEFlag, EFlag, AFlag, QFlags; 201 ARMword GEFlag, EFlag, AFlag, QFlag;
202 //chy:2003-08-19, used in arm v5e|xscale 202 //chy:2003-08-19, used in arm v5e|xscale
203 ARMword SFlag; 203 ARMword SFlag;
204#ifdef MODET 204#ifdef MODET
diff --git a/src/core/arm/skyeye_common/armemu.h b/src/core/arm/skyeye_common/armemu.h
index 7f7c0e682..3ea14b5a3 100644
--- a/src/core/arm/skyeye_common/armemu.h
+++ b/src/core/arm/skyeye_common/armemu.h
@@ -34,7 +34,7 @@
34#define ZBIT (1L << 30) 34#define ZBIT (1L << 30)
35#define CBIT (1L << 29) 35#define CBIT (1L << 29)
36#define VBIT (1L << 28) 36#define VBIT (1L << 28)
37#define SBIT (1L << 27) 37#define QBIT (1L << 27)
38#define IBIT (1L << 7) 38#define IBIT (1L << 7)
39#define FBIT (1L << 6) 39#define FBIT (1L << 6)
40#define IFBITS (3L << 6) 40#define IFBITS (3L << 6)
@@ -156,13 +156,14 @@
156#define R15PCMODE (state->Reg[15] & (R15PCBITS | R15MODEBITS)) 156#define R15PCMODE (state->Reg[15] & (R15PCBITS | R15MODEBITS))
157#define R15MODE (state->Reg[15] & R15MODEBITS) 157#define R15MODE (state->Reg[15] & R15MODEBITS)
158 158
159#define ECC ((NFLAG << 31) | (ZFLAG << 30) | (CFLAG << 29) | (VFLAG << 28) | (SFLAG << 27)) 159#define ECC ((NFLAG << 31) | (ZFLAG << 30) | (CFLAG << 29) | (VFLAG << 28) | (QFLAG << 27))
160#define EINT (IFFLAGS << 6) 160#define EINT (IFFLAGS << 6)
161#define ER15INT (IFFLAGS << 26) 161#define ER15INT (IFFLAGS << 26)
162#define EMODE (state->Mode) 162#define EMODE (state->Mode)
163#define EGEBITS (state->GEFlag & 0x000F0000)
163 164
164#ifdef MODET 165#ifdef MODET
165#define CPSR (ECC | EINT | EMODE | (TFLAG << 5)) 166#define CPSR (ECC | EGEBITS | (EFLAG << 9) | (AFLAG << 8) | EINT | (TFLAG << 5) | EMODE)
166#else 167#else
167#define CPSR (ECC | EINT | EMODE) 168#define CPSR (ECC | EINT | EMODE)
168#endif 169#endif
@@ -601,6 +602,7 @@ extern ARMword ARMul_SwitchMode (ARMul_State *, ARMword, ARMword);
601extern void ARMul_MSRCpsr (ARMul_State *, ARMword, ARMword); 602extern void ARMul_MSRCpsr (ARMul_State *, ARMword, ARMword);
602extern void ARMul_SubOverflow (ARMul_State *, ARMword, ARMword, ARMword); 603extern void ARMul_SubOverflow (ARMul_State *, ARMword, ARMword, ARMword);
603extern void ARMul_AddOverflow (ARMul_State *, ARMword, ARMword, ARMword); 604extern void ARMul_AddOverflow (ARMul_State *, ARMword, ARMword, ARMword);
605extern void ARMul_AddOverflowQ(ARMul_State*, ARMword, ARMword);
604extern void ARMul_SubCarry (ARMul_State *, ARMword, ARMword, ARMword); 606extern void ARMul_SubCarry (ARMul_State *, ARMword, ARMword, ARMword);
605extern void ARMul_AddCarry (ARMul_State *, ARMword, ARMword, ARMword); 607extern void ARMul_AddCarry (ARMul_State *, ARMword, ARMword, ARMword);
606extern tdstate ARMul_ThumbDecode (ARMul_State *, ARMword, ARMword, ARMword *); 608extern tdstate ARMul_ThumbDecode (ARMul_State *, ARMword, ARMword, ARMword *);
diff --git a/src/core/core.cpp b/src/core/core.cpp
index 64de0cbba..22213d647 100644
--- a/src/core/core.cpp
+++ b/src/core/core.cpp
@@ -1,5 +1,5 @@
1// Copyright 2014 Citra Emulator Project 1// Copyright 2014 Citra Emulator Project
2// Licensed under GPLv2 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 "common/common_types.h" 5#include "common/common_types.h"
diff --git a/src/core/core.h b/src/core/core.h
index 850bb0ab4..05dbe0ae5 100644
--- a/src/core/core.h
+++ b/src/core/core.h
@@ -1,5 +1,5 @@
1// Copyright 2014 Citra Emulator Project 1// Copyright 2014 Citra Emulator Project
2// Licensed under GPLv2 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#pragma once 5#pragma once
diff --git a/src/core/core_timing.cpp b/src/core/core_timing.cpp
index 1a0b2724a..321648b37 100644
--- a/src/core/core_timing.cpp
+++ b/src/core/core_timing.cpp
@@ -1,5 +1,5 @@
1// Copyright 2013 Dolphin Emulator Project 1// Copyright 2013 Dolphin Emulator Project / 2014 Citra Emulator Project
2// Licensed under GPLv2 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 <vector> 5#include <vector>
diff --git a/src/core/core_timing.h b/src/core/core_timing.h
index b197cf40c..496234538 100644
--- a/src/core/core_timing.h
+++ b/src/core/core_timing.h
@@ -1,5 +1,5 @@
1// Copyright 2013 Dolphin Emulator Project 1// Copyright 2013 Dolphin Emulator Project / 2014 Citra Emulator Project
2// Licensed under GPLv2 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#pragma once 5#pragma once
diff --git a/src/core/file_sys/archive_backend.h b/src/core/file_sys/archive_backend.h
index 43583d206..e2979be17 100644
--- a/src/core/file_sys/archive_backend.h
+++ b/src/core/file_sys/archive_backend.h
@@ -1,5 +1,5 @@
1// Copyright 2014 Citra Emulator Project 1// Copyright 2014 Citra Emulator Project
2// Licensed under GPLv2 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#pragma once 5#pragma once
@@ -45,6 +45,11 @@ public:
45 { 45 {
46 } 46 }
47 47
48 Path(const char* path):
49 type(Char), string(path)
50 {
51 }
52
48 Path(LowPathType type, u32 size, u32 pointer): 53 Path(LowPathType type, u32 size, u32 pointer):
49 type(type) 54 type(type)
50 { 55 {
diff --git a/src/core/file_sys/archive_romfs.cpp b/src/core/file_sys/archive_romfs.cpp
index 32d0777a0..ced0794ef 100644
--- a/src/core/file_sys/archive_romfs.cpp
+++ b/src/core/file_sys/archive_romfs.cpp
@@ -1,5 +1,5 @@
1// Copyright 2014 Citra Emulator Project 1// Copyright 2014 Citra Emulator Project
2// Licensed under GPLv2 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 <memory> 5#include <memory>
diff --git a/src/core/file_sys/archive_romfs.h b/src/core/file_sys/archive_romfs.h
index 3f5cdebed..2fafd0d2a 100644
--- a/src/core/file_sys/archive_romfs.h
+++ b/src/core/file_sys/archive_romfs.h
@@ -1,5 +1,5 @@
1// Copyright 2014 Citra Emulator Project 1// Copyright 2014 Citra Emulator Project
2// Licensed under GPLv2 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#pragma once 5#pragma once
diff --git a/src/core/file_sys/archive_savedata.cpp b/src/core/file_sys/archive_savedata.cpp
index 2414564e4..cb4a80f5b 100644
--- a/src/core/file_sys/archive_savedata.cpp
+++ b/src/core/file_sys/archive_savedata.cpp
@@ -1,5 +1,5 @@
1// Copyright 2014 Citra Emulator Project 1// Copyright 2014 Citra Emulator Project
2// Licensed under GPLv2+ 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 <sys/stat.h> 5#include <sys/stat.h>
diff --git a/src/core/file_sys/archive_savedata.h b/src/core/file_sys/archive_savedata.h
index d394ad37e..5b0ce29e6 100644
--- a/src/core/file_sys/archive_savedata.h
+++ b/src/core/file_sys/archive_savedata.h
@@ -1,5 +1,5 @@
1// Copyright 2014 Citra Emulator Project 1// Copyright 2014 Citra Emulator Project
2// Licensed under GPLv2+ 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#pragma once 5#pragma once
diff --git a/src/core/file_sys/archive_sdmc.cpp b/src/core/file_sys/archive_sdmc.cpp
index dccdf7f67..1c1c170b6 100644
--- a/src/core/file_sys/archive_sdmc.cpp
+++ b/src/core/file_sys/archive_sdmc.cpp
@@ -1,5 +1,5 @@
1// Copyright 2014 Citra Emulator Project 1// Copyright 2014 Citra Emulator Project
2// Licensed under GPLv2 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 <sys/stat.h> 5#include <sys/stat.h>
diff --git a/src/core/file_sys/archive_sdmc.h b/src/core/file_sys/archive_sdmc.h
index c84c6948e..1b801f217 100644
--- a/src/core/file_sys/archive_sdmc.h
+++ b/src/core/file_sys/archive_sdmc.h
@@ -1,5 +1,5 @@
1// Copyright 2014 Citra Emulator Project 1// Copyright 2014 Citra Emulator Project
2// Licensed under GPLv2 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#pragma once 5#pragma once
diff --git a/src/core/file_sys/archive_systemsavedata.cpp b/src/core/file_sys/archive_systemsavedata.cpp
index dc2c23b41..0da32d510 100644
--- a/src/core/file_sys/archive_systemsavedata.cpp
+++ b/src/core/file_sys/archive_systemsavedata.cpp
@@ -1,5 +1,5 @@
1// Copyright 2014 Citra Emulator Project 1// Copyright 2014 Citra Emulator Project
2// Licensed under GPLv2+ 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 <sys/stat.h> 5#include <sys/stat.h>
@@ -16,8 +16,14 @@
16 16
17namespace FileSys { 17namespace FileSys {
18 18
19Archive_SystemSaveData::Archive_SystemSaveData(const std::string& mount_point) 19static std::string GetSystemSaveDataPath(const std::string& mount_point, u64 save_id) {
20 : DiskArchive(mount_point) { 20 u32 save_high = static_cast<u32>((save_id >> 32) & 0xFFFFFFFF);
21 u32 save_low = static_cast<u32>(save_id & 0xFFFFFFFF);
22 return Common::StringFromFormat("%s%08X/%08X/", mount_point.c_str(), save_low, save_high);
23}
24
25Archive_SystemSaveData::Archive_SystemSaveData(const std::string& mount_point, u64 save_id)
26 : DiskArchive(GetSystemSaveDataPath(mount_point, save_id)) {
21 LOG_INFO(Service_FS, "Directory %s set as SystemSaveData.", this->mount_point.c_str()); 27 LOG_INFO(Service_FS, "Directory %s set as SystemSaveData.", this->mount_point.c_str());
22} 28}
23 29
diff --git a/src/core/file_sys/archive_systemsavedata.h b/src/core/file_sys/archive_systemsavedata.h
index 360ed1e13..443e27091 100644
--- a/src/core/file_sys/archive_systemsavedata.h
+++ b/src/core/file_sys/archive_systemsavedata.h
@@ -1,5 +1,5 @@
1// Copyright 2014 Citra Emulator Project 1// Copyright 2014 Citra Emulator Project
2// Licensed under GPLv2+ 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#pragma once 5#pragma once
@@ -19,7 +19,7 @@ namespace FileSys {
19/// specifically nand:/data/<ID0>/sysdata/<SaveID-Low>/<SaveID-High> 19/// specifically nand:/data/<ID0>/sysdata/<SaveID-Low>/<SaveID-High>
20class Archive_SystemSaveData final : public DiskArchive { 20class Archive_SystemSaveData final : public DiskArchive {
21public: 21public:
22 Archive_SystemSaveData(const std::string& mount_point); 22 Archive_SystemSaveData(const std::string& mount_point, u64 save_id);
23 23
24 /** 24 /**
25 * Initialize the archive. 25 * Initialize the archive.
diff --git a/src/core/file_sys/directory_backend.h b/src/core/file_sys/directory_backend.h
index 188746a6f..7f327dc42 100644
--- a/src/core/file_sys/directory_backend.h
+++ b/src/core/file_sys/directory_backend.h
@@ -1,5 +1,5 @@
1// Copyright 2014 Citra Emulator Project 1// Copyright 2014 Citra Emulator Project
2// Licensed under GPLv2 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#pragma once 5#pragma once
diff --git a/src/core/file_sys/directory_romfs.cpp b/src/core/file_sys/directory_romfs.cpp
index e6d571391..0b95f9b65 100644
--- a/src/core/file_sys/directory_romfs.cpp
+++ b/src/core/file_sys/directory_romfs.cpp
@@ -1,5 +1,5 @@
1// Copyright 2014 Citra Emulator Project 1// Copyright 2014 Citra Emulator Project
2// Licensed under GPLv2 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 "common/common_types.h" 5#include "common/common_types.h"
diff --git a/src/core/file_sys/directory_romfs.h b/src/core/file_sys/directory_romfs.h
index b775f014d..2297f1645 100644
--- a/src/core/file_sys/directory_romfs.h
+++ b/src/core/file_sys/directory_romfs.h
@@ -1,5 +1,5 @@
1// Copyright 2014 Citra Emulator Project 1// Copyright 2014 Citra Emulator Project
2// Licensed under GPLv2 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#pragma once 5#pragma once
diff --git a/src/core/file_sys/disk_archive.cpp b/src/core/file_sys/disk_archive.cpp
index f8096ebcf..1689a1a91 100644
--- a/src/core/file_sys/disk_archive.cpp
+++ b/src/core/file_sys/disk_archive.cpp
@@ -1,5 +1,5 @@
1// Copyright 2014 Citra Emulator Project 1// Copyright 2014 Citra Emulator Project
2// Licensed under GPLv2 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 <sys/stat.h> 5#include <sys/stat.h>
diff --git a/src/core/file_sys/disk_archive.h b/src/core/file_sys/disk_archive.h
index eaec435d2..6c9b689e0 100644
--- a/src/core/file_sys/disk_archive.h
+++ b/src/core/file_sys/disk_archive.h
@@ -1,10 +1,11 @@
1// Copyright 2014 Citra Emulator Project 1// Copyright 2014 Citra Emulator Project
2// Licensed under GPLv2 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#pragma once 5#pragma once
6 6
7#include "common/common_types.h" 7#include "common/common_types.h"
8#include "common/file_util.h"
8 9
9#include "core/file_sys/archive_backend.h" 10#include "core/file_sys/archive_backend.h"
10#include "core/loader/loader.h" 11#include "core/loader/loader.h"
diff --git a/src/core/file_sys/file_backend.h b/src/core/file_sys/file_backend.h
index 539ec7314..35890af1f 100644
--- a/src/core/file_sys/file_backend.h
+++ b/src/core/file_sys/file_backend.h
@@ -1,5 +1,5 @@
1// Copyright 2014 Citra Emulator Project 1// Copyright 2014 Citra Emulator Project
2// Licensed under GPLv2 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#pragma once 5#pragma once
diff --git a/src/core/file_sys/file_romfs.cpp b/src/core/file_sys/file_romfs.cpp
index 5f38c2704..e79936407 100644
--- a/src/core/file_sys/file_romfs.cpp
+++ b/src/core/file_sys/file_romfs.cpp
@@ -1,5 +1,5 @@
1// Copyright 2014 Citra Emulator Project 1// Copyright 2014 Citra Emulator Project
2// Licensed under GPLv2 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 "common/common_types.h" 5#include "common/common_types.h"
diff --git a/src/core/file_sys/file_romfs.h b/src/core/file_sys/file_romfs.h
index 32fa6b6d3..04d8a16a2 100644
--- a/src/core/file_sys/file_romfs.h
+++ b/src/core/file_sys/file_romfs.h
@@ -1,5 +1,5 @@
1// Copyright 2014 Citra Emulator Project 1// Copyright 2014 Citra Emulator Project
2// Licensed under GPLv2 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#pragma once 5#pragma once
diff --git a/src/core/hle/config_mem.cpp b/src/core/hle/config_mem.cpp
index d8ba9e6cf..721a600b5 100644
--- a/src/core/hle/config_mem.cpp
+++ b/src/core/hle/config_mem.cpp
@@ -1,5 +1,5 @@
1// Copyright 2014 Citra Emulator Project 1// Copyright 2014 Citra Emulator Project
2// Licensed under GPLv2 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 "common/common_types.h" 5#include "common/common_types.h"
diff --git a/src/core/hle/config_mem.h b/src/core/hle/config_mem.h
index fa01b5cdb..3975af18f 100644
--- a/src/core/hle/config_mem.h
+++ b/src/core/hle/config_mem.h
@@ -1,5 +1,5 @@
1// Copyright 2014 Citra Emulator Project 1// Copyright 2014 Citra Emulator Project
2// Licensed under GPLv2 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#pragma once 5#pragma once
diff --git a/src/core/hle/coprocessor.cpp b/src/core/hle/coprocessor.cpp
index e34229a57..425959be4 100644
--- a/src/core/hle/coprocessor.cpp
+++ b/src/core/hle/coprocessor.cpp
@@ -1,5 +1,5 @@
1// Copyright 2014 Citra Emulator Project 1// Copyright 2014 Citra Emulator Project
2// Licensed under GPLv2 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/coprocessor.h" 5#include "core/hle/coprocessor.h"
diff --git a/src/core/hle/function_wrappers.h b/src/core/hle/function_wrappers.h
index b44479b2f..3259ce9eb 100644
--- a/src/core/hle/function_wrappers.h
+++ b/src/core/hle/function_wrappers.h
@@ -1,5 +1,5 @@
1// Copyright 2014 Citra Emulator Project 1// Copyright 2014 Citra Emulator Project
2// Licensed under GPLv2 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#pragma once 5#pragma once
diff --git a/src/core/hle/hle.cpp b/src/core/hle/hle.cpp
index cc3d5255a..33ac12507 100644
--- a/src/core/hle/hle.cpp
+++ b/src/core/hle/hle.cpp
@@ -1,5 +1,5 @@
1// Copyright 2014 Citra Emulator Project 1// Copyright 2014 Citra Emulator Project
2// Licensed under GPLv2 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 <vector> 5#include <vector>
@@ -9,6 +9,7 @@
9#include "core/hle/kernel/thread.h" 9#include "core/hle/kernel/thread.h"
10#include "core/hle/service/service.h" 10#include "core/hle/service/service.h"
11#include "core/hle/service/fs/archive.h" 11#include "core/hle/service/fs/archive.h"
12#include "core/hle/service/cfg/cfg.h"
12 13
13//////////////////////////////////////////////////////////////////////////////////////////////////// 14////////////////////////////////////////////////////////////////////////////////////////////////////
14 15
@@ -42,7 +43,15 @@ void CallSVC(u32 opcode) {
42 43
43void Reschedule(const char *reason) { 44void Reschedule(const char *reason) {
44 _dbg_assert_msg_(Kernel, reason != 0 && strlen(reason) < 256, "Reschedule: Invalid or too long reason."); 45 _dbg_assert_msg_(Kernel, reason != 0 && strlen(reason) < 256, "Reschedule: Invalid or too long reason.");
46
47 // TODO(bunnei): It seems that games depend on some CPU execution time elapsing during HLE
48 // routines. This simulates that time by artificially advancing the number of CPU "ticks".
49 // The value was chosen empirically, it seems to work well enough for everything tested, but
50 // is likely not ideal. We should find a more accurate way to simulate timing with HLE.
51 Core::g_app_core->AddTicks(4000);
52
45 Core::g_app_core->PrepareReschedule(); 53 Core::g_app_core->PrepareReschedule();
54
46 g_reschedule = true; 55 g_reschedule = true;
47} 56}
48 57
@@ -58,6 +67,7 @@ void RegisterAllModules() {
58void Init() { 67void Init() {
59 Service::Init(); 68 Service::Init();
60 Service::FS::ArchiveInit(); 69 Service::FS::ArchiveInit();
70 Service::CFG::CFGInit();
61 71
62 RegisterAllModules(); 72 RegisterAllModules();
63 73
@@ -65,6 +75,7 @@ void Init() {
65} 75}
66 76
67void Shutdown() { 77void Shutdown() {
78 Service::CFG::CFGShutdown();
68 Service::FS::ArchiveShutdown(); 79 Service::FS::ArchiveShutdown();
69 Service::Shutdown(); 80 Service::Shutdown();
70 81
diff --git a/src/core/hle/hle.h b/src/core/hle/hle.h
index 4ab258c69..59b770f02 100644
--- a/src/core/hle/hle.h
+++ b/src/core/hle/hle.h
@@ -1,5 +1,5 @@
1// Copyright 2014 Citra Emulator Project 1// Copyright 2014 Citra Emulator Project
2// Licensed under GPLv2 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#pragma once 5#pragma once
diff --git a/src/core/hle/kernel/address_arbiter.cpp b/src/core/hle/kernel/address_arbiter.cpp
index 9a921108d..77491900a 100644
--- a/src/core/hle/kernel/address_arbiter.cpp
+++ b/src/core/hle/kernel/address_arbiter.cpp
@@ -1,5 +1,5 @@
1// Copyright 2014 Citra Emulator Project 1// Copyright 2014 Citra Emulator Project
2// Licensed under GPLv2 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 "common/common_types.h" 5#include "common/common_types.h"
diff --git a/src/core/hle/kernel/address_arbiter.h b/src/core/hle/kernel/address_arbiter.h
index 8a5fb10b4..030e7ad7b 100644
--- a/src/core/hle/kernel/address_arbiter.h
+++ b/src/core/hle/kernel/address_arbiter.h
@@ -1,5 +1,5 @@
1// Copyright 2014 Citra Emulator Project 1// Copyright 2014 Citra Emulator Project
2// Licensed under GPLv2 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#pragma once 5#pragma once
diff --git a/src/core/hle/kernel/event.cpp b/src/core/hle/kernel/event.cpp
index 288080209..4de3fab3c 100644
--- a/src/core/hle/kernel/event.cpp
+++ b/src/core/hle/kernel/event.cpp
@@ -1,5 +1,5 @@
1// Copyright 2014 Citra Emulator Project 1// Copyright 2014 Citra Emulator Project
2// Licensed under GPLv2 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 <map> 5#include <map>
diff --git a/src/core/hle/kernel/event.h b/src/core/hle/kernel/event.h
index 73aec4e79..da793df1a 100644
--- a/src/core/hle/kernel/event.h
+++ b/src/core/hle/kernel/event.h
@@ -1,5 +1,5 @@
1// Copyright 2014 Citra Emulator Project 1// Copyright 2014 Citra Emulator Project
2// Licensed under GPLv2 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#pragma once 5#pragma once
diff --git a/src/core/hle/kernel/kernel.cpp b/src/core/hle/kernel/kernel.cpp
index 6a690e915..5fd06046e 100644
--- a/src/core/hle/kernel/kernel.cpp
+++ b/src/core/hle/kernel/kernel.cpp
@@ -1,5 +1,5 @@
1// Copyright 2014 Citra Emulator Project / PPSSPP Project 1// Copyright 2014 Citra Emulator Project
2// Licensed under GPLv2 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 <algorithm> 5#include <algorithm>
diff --git a/src/core/hle/kernel/kernel.h b/src/core/hle/kernel/kernel.h
index 683fffeee..32258d5a0 100644
--- a/src/core/hle/kernel/kernel.h
+++ b/src/core/hle/kernel/kernel.h
@@ -1,5 +1,5 @@
1// Copyright 2014 Citra Emulator Project / PPSSPP Project 1// Copyright 2014 Citra Emulator Project / PPSSPP Project
2// Licensed under GPLv2 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#pragma once 5#pragma once
diff --git a/src/core/hle/kernel/mutex.cpp b/src/core/hle/kernel/mutex.cpp
index 5a173e129..5a18af114 100644
--- a/src/core/hle/kernel/mutex.cpp
+++ b/src/core/hle/kernel/mutex.cpp
@@ -1,5 +1,5 @@
1// Copyright 2014 Citra Emulator Project 1// Copyright 2014 Citra Emulator Project
2// Licensed under GPLv2 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 <map> 5#include <map>
diff --git a/src/core/hle/kernel/mutex.h b/src/core/hle/kernel/mutex.h
index 7f4909a6e..a8ca97014 100644
--- a/src/core/hle/kernel/mutex.h
+++ b/src/core/hle/kernel/mutex.h
@@ -1,5 +1,5 @@
1// Copyright 2014 Citra Emulator Project 1// Copyright 2014 Citra Emulator Project
2// Licensed under GPLv2 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#pragma once 5#pragma once
diff --git a/src/core/hle/kernel/semaphore.cpp b/src/core/hle/kernel/semaphore.cpp
index f955d1957..b81d0b26a 100644
--- a/src/core/hle/kernel/semaphore.cpp
+++ b/src/core/hle/kernel/semaphore.cpp
@@ -1,5 +1,5 @@
1// Copyright 2014 Citra Emulator Project 1// Copyright 2014 Citra Emulator Project
2// Licensed under GPLv2+ 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 <queue> 5#include <queue>
diff --git a/src/core/hle/kernel/semaphore.h b/src/core/hle/kernel/semaphore.h
index ad474b875..8644ecf0c 100644
--- a/src/core/hle/kernel/semaphore.h
+++ b/src/core/hle/kernel/semaphore.h
@@ -1,5 +1,5 @@
1// Copyright 2014 Citra Emulator Project 1// Copyright 2014 Citra Emulator Project
2// Licensed under GPLv2+ 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#pragma once 5#pragma once
diff --git a/src/core/hle/kernel/session.h b/src/core/hle/kernel/session.h
index 06ae4bc39..6760f346e 100644
--- a/src/core/hle/kernel/session.h
+++ b/src/core/hle/kernel/session.h
@@ -1,5 +1,5 @@
1// Copyright 2014 Citra Emulator Project 1// Copyright 2014 Citra Emulator Project
2// Licensed under GPLv2+ 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#pragma once 5#pragma once
diff --git a/src/core/hle/kernel/shared_memory.cpp b/src/core/hle/kernel/shared_memory.cpp
index 3c8c502c6..2840f13bb 100644
--- a/src/core/hle/kernel/shared_memory.cpp
+++ b/src/core/hle/kernel/shared_memory.cpp
@@ -1,5 +1,5 @@
1// Copyright 2014 Citra Emulator Project 1// Copyright 2014 Citra Emulator Project
2// Licensed under GPLv2 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 "common/common.h" 5#include "common/common.h"
diff --git a/src/core/hle/kernel/shared_memory.h b/src/core/hle/kernel/shared_memory.h
index bb778ec26..bb65c7ccd 100644
--- a/src/core/hle/kernel/shared_memory.h
+++ b/src/core/hle/kernel/shared_memory.h
@@ -1,5 +1,5 @@
1// Copyright 2014 Citra Emulator Project 1// Copyright 2014 Citra Emulator Project
2// Licensed under GPLv2 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#pragma once 5#pragma once
diff --git a/src/core/hle/kernel/thread.cpp b/src/core/hle/kernel/thread.cpp
index 834308926..c6a8dc7b9 100644
--- a/src/core/hle/kernel/thread.cpp
+++ b/src/core/hle/kernel/thread.cpp
@@ -1,5 +1,5 @@
1// Copyright 2014 Citra Emulator Project / PPSSPP Project 1// Copyright 2014 Citra Emulator Project / PPSSPP Project
2// Licensed under GPLv2 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 <algorithm> 5#include <algorithm>
diff --git a/src/core/hle/kernel/thread.h b/src/core/hle/kernel/thread.h
index 65e8ef554..9396b6b26 100644
--- a/src/core/hle/kernel/thread.h
+++ b/src/core/hle/kernel/thread.h
@@ -1,5 +1,5 @@
1// Copyright 2014 Citra Emulator Project / PPSSPP Project 1// Copyright 2014 Citra Emulator Project / PPSSPP Project
2// Licensed under GPLv2 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#pragma once 5#pragma once
diff --git a/src/core/hle/result.h b/src/core/hle/result.h
index 14d2be4a2..0e9c213e0 100644
--- a/src/core/hle/result.h
+++ b/src/core/hle/result.h
@@ -1,5 +1,5 @@
1// Copyright 2014 Citra Emulator Project 1// Copyright 2014 Citra Emulator Project
2// Licensed under GPLv2 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#pragma once 5#pragma once
diff --git a/src/core/hle/service/ac_u.cpp b/src/core/hle/service/ac_u.cpp
index 311682abf..20a3fa2e5 100644
--- a/src/core/hle/service/ac_u.cpp
+++ b/src/core/hle/service/ac_u.cpp
@@ -1,5 +1,5 @@
1// Copyright 2014 Citra Emulator Project 1// Copyright 2014 Citra Emulator Project
2// Licensed under GPLv2 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 "common/log.h" 5#include "common/log.h"
@@ -56,7 +56,4 @@ Interface::Interface() {
56 Register(FunctionTable, ARRAY_SIZE(FunctionTable)); 56 Register(FunctionTable, ARRAY_SIZE(FunctionTable));
57} 57}
58 58
59Interface::~Interface() {
60}
61
62} // namespace 59} // namespace
diff --git a/src/core/hle/service/ac_u.h b/src/core/hle/service/ac_u.h
index c91b28353..f1d26ebe8 100644
--- a/src/core/hle/service/ac_u.h
+++ b/src/core/hle/service/ac_u.h
@@ -1,5 +1,5 @@
1// Copyright 2014 Citra Emulator Project 1// Copyright 2014 Citra Emulator Project
2// Licensed under GPLv2 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#pragma once 5#pragma once
@@ -16,11 +16,7 @@ namespace AC_U {
16class Interface : public Service::Interface { 16class Interface : public Service::Interface {
17public: 17public:
18 Interface(); 18 Interface();
19 ~Interface(); 19
20 /**
21 * Gets the string port name used by CTROS for the service
22 * @return Port name of service
23 */
24 std::string GetPortName() const override { 20 std::string GetPortName() const override {
25 return "ac:u"; 21 return "ac:u";
26 } 22 }
diff --git a/src/core/hle/service/act_u.cpp b/src/core/hle/service/act_u.cpp
new file mode 100644
index 000000000..10870f14b
--- /dev/null
+++ b/src/core/hle/service/act_u.cpp
@@ -0,0 +1,24 @@
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/service/act_u.h"
8
9////////////////////////////////////////////////////////////////////////////////////////////////////
10// Namespace ACT_U
11
12namespace ACT_U {
13
14// Empty arrays are illegal -- commented out until an entry is added.
15//const Interface::FunctionInfo FunctionTable[] = { };
16
17////////////////////////////////////////////////////////////////////////////////////////////////////
18// Interface class
19
20Interface::Interface() {
21 //Register(FunctionTable, ARRAY_SIZE(FunctionTable));
22}
23
24} // namespace
diff --git a/src/core/hle/service/act_u.h b/src/core/hle/service/act_u.h
new file mode 100644
index 000000000..be41454a4
--- /dev/null
+++ b/src/core/hle/service/act_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 ACT_U
11
12namespace ACT_U {
13
14class Interface : public Service::Interface {
15public:
16 Interface();
17
18 std::string GetPortName() const override {
19 return "act:u";
20 }
21};
22
23} // namespace
diff --git a/src/core/hle/service/am_app.cpp b/src/core/hle/service/am_app.cpp
index b8b06418c..0b396b6d3 100644
--- a/src/core/hle/service/am_app.cpp
+++ b/src/core/hle/service/am_app.cpp
@@ -1,5 +1,5 @@
1// Copyright 2014 Citra Emulator Project 1// Copyright 2014 Citra Emulator Project
2// Licensed under GPLv2+ 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 "common/log.h" 5#include "common/log.h"
diff --git a/src/core/hle/service/am_app.h b/src/core/hle/service/am_app.h
index 86a5f5b74..50dc2f5a2 100644
--- a/src/core/hle/service/am_app.h
+++ b/src/core/hle/service/am_app.h
@@ -1,5 +1,5 @@
1// Copyright 2014 Citra Emulator Project 1// Copyright 2014 Citra Emulator Project
2// Licensed under GPLv2+ 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#pragma once 5#pragma once
@@ -15,10 +15,6 @@ class Interface : public Service::Interface {
15public: 15public:
16 Interface(); 16 Interface();
17 17
18 /**
19 * Gets the string port name used by CTROS for the service
20 * @return Port name of service
21 */
22 std::string GetPortName() const override { 18 std::string GetPortName() const override {
23 return "am:app"; 19 return "am:app";
24 } 20 }
diff --git a/src/core/hle/service/am_net.cpp b/src/core/hle/service/am_net.cpp
index 403cac353..112844e5b 100644
--- a/src/core/hle/service/am_net.cpp
+++ b/src/core/hle/service/am_net.cpp
@@ -1,5 +1,5 @@
1// Copyright 2014 Citra Emulator Project 1// Copyright 2014 Citra Emulator Project
2// Licensed under GPLv2 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 "common/log.h" 5#include "common/log.h"
@@ -41,7 +41,4 @@ Interface::Interface() {
41 Register(FunctionTable, ARRAY_SIZE(FunctionTable)); 41 Register(FunctionTable, ARRAY_SIZE(FunctionTable));
42} 42}
43 43
44Interface::~Interface() {
45}
46
47} // namespace 44} // namespace
diff --git a/src/core/hle/service/am_net.h b/src/core/hle/service/am_net.h
index 4816e1697..616c33ee8 100644
--- a/src/core/hle/service/am_net.h
+++ b/src/core/hle/service/am_net.h
@@ -1,5 +1,5 @@
1// Copyright 2014 Citra Emulator Project 1// Copyright 2014 Citra Emulator Project
2// Licensed under GPLv2 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#pragma once 5#pragma once
@@ -14,11 +14,7 @@ namespace AM_NET {
14class Interface : public Service::Interface { 14class Interface : public Service::Interface {
15public: 15public:
16 Interface(); 16 Interface();
17 ~Interface(); 17
18 /**
19 * Gets the string port name used by CTROS for the service
20 * @return Port name of service
21 */
22 std::string GetPortName() const override { 18 std::string GetPortName() const override {
23 return "am:net"; 19 return "am:net";
24 } 20 }
diff --git a/src/core/hle/service/apt_a.cpp b/src/core/hle/service/apt_a.cpp
new file mode 100644
index 000000000..dcf5ec4fe
--- /dev/null
+++ b/src/core/hle/service/apt_a.cpp
@@ -0,0 +1,34 @@
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/service/apt_a.h"
8
9////////////////////////////////////////////////////////////////////////////////////////////////////
10// Namespace APT_A
11
12namespace APT_A {
13
14const Interface::FunctionInfo FunctionTable[] = {
15 {0x00010040, nullptr, "GetLockHandle?"},
16 {0x00020080, nullptr, "Initialize?"},
17 {0x00030040, nullptr, "Enable?"},
18 {0x00040040, nullptr, "Finalize?"},
19 {0x00050040, nullptr, "GetAppletManInfo?"},
20 {0x00060040, nullptr, "GetAppletInfo?"},
21 {0x003B0040, nullptr, "CancelLibraryApplet?"},
22 {0x00430040, nullptr, "NotifyToWait?"},
23 {0x004B00C2, nullptr, "AppletUtility?"},
24 {0x00550040, nullptr, "WriteInputToNsState?"},
25};
26
27////////////////////////////////////////////////////////////////////////////////////////////////////
28// Interface class
29
30Interface::Interface() {
31 Register(FunctionTable, ARRAY_SIZE(FunctionTable));
32}
33
34} // namespace
diff --git a/src/core/hle/service/apt_a.h b/src/core/hle/service/apt_a.h
new file mode 100644
index 000000000..6cbf1288f
--- /dev/null
+++ b/src/core/hle/service/apt_a.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 APT_A
11
12namespace APT_A {
13
14class Interface : public Service::Interface {
15public:
16 Interface();
17
18 std::string GetPortName() const override {
19 return "APT:A";
20 }
21};
22
23} // namespace
diff --git a/src/core/hle/service/apt_u.cpp b/src/core/hle/service/apt_u.cpp
index ebfba4d8d..d8b261ba7 100644
--- a/src/core/hle/service/apt_u.cpp
+++ b/src/core/hle/service/apt_u.cpp
@@ -1,5 +1,5 @@
1// Copyright 2014 Citra Emulator Project 1// Copyright 2014 Citra Emulator Project
2// Licensed under GPLv2 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 5
@@ -315,8 +315,8 @@ Interface::Interface() {
315 315
316 if (file.IsOpen()) { 316 if (file.IsOpen()) {
317 // Read shared font data 317 // Read shared font data
318 shared_font.resize(file.GetSize()); 318 shared_font.resize((size_t)file.GetSize());
319 file.ReadBytes(shared_font.data(), file.GetSize()); 319 file.ReadBytes(shared_font.data(), (size_t)file.GetSize());
320 320
321 // Create shared font memory object 321 // Create shared font memory object
322 shared_font_mem = Kernel::CreateSharedMemory("APT_U:shared_font_mem"); 322 shared_font_mem = Kernel::CreateSharedMemory("APT_U:shared_font_mem");
@@ -330,7 +330,4 @@ Interface::Interface() {
330 Register(FunctionTable, ARRAY_SIZE(FunctionTable)); 330 Register(FunctionTable, ARRAY_SIZE(FunctionTable));
331} 331}
332 332
333Interface::~Interface() {
334}
335
336} // namespace 333} // namespace
diff --git a/src/core/hle/service/apt_u.h b/src/core/hle/service/apt_u.h
index 306730400..aad918cfc 100644
--- a/src/core/hle/service/apt_u.h
+++ b/src/core/hle/service/apt_u.h
@@ -1,5 +1,5 @@
1// Copyright 2014 Citra Emulator Project 1// Copyright 2014 Citra Emulator Project
2// Licensed under GPLv2 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#pragma once 5#pragma once
@@ -20,15 +20,8 @@ namespace APT_U {
20/// Interface to "APT:U" service 20/// Interface to "APT:U" service
21class Interface : public Service::Interface { 21class Interface : public Service::Interface {
22public: 22public:
23
24 Interface(); 23 Interface();
25 24
26 ~Interface();
27
28 /**
29 * Gets the string port name used by CTROS for the service
30 * @return Port name of service
31 */
32 std::string GetPortName() const override { 25 std::string GetPortName() const override {
33 return "APT:U"; 26 return "APT:U";
34 } 27 }
diff --git a/src/core/hle/service/boss_u.cpp b/src/core/hle/service/boss_u.cpp
index b2ff4a756..1820ea7ad 100644
--- a/src/core/hle/service/boss_u.cpp
+++ b/src/core/hle/service/boss_u.cpp
@@ -1,5 +1,5 @@
1// Copyright 2014 Citra Emulator Project 1// Copyright 2014 Citra Emulator Project
2// Licensed under GPLv2 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 "common/log.h" 5#include "common/log.h"
@@ -11,18 +11,15 @@
11 11
12namespace BOSS_U { 12namespace BOSS_U {
13 13
14 const Interface::FunctionInfo FunctionTable[] = { 14const Interface::FunctionInfo FunctionTable[] = {
15 {0x00020100, nullptr, "GetStorageInfo"}, 15 {0x00020100, nullptr, "GetStorageInfo"},
16 }; 16};
17 17
18 //////////////////////////////////////////////////////////////////////////////////////////////////// 18////////////////////////////////////////////////////////////////////////////////////////////////////
19 // Interface class 19// Interface class
20
21 Interface::Interface() {
22 Register(FunctionTable, ARRAY_SIZE(FunctionTable));
23 }
24 20
25 Interface::~Interface() { 21Interface::Interface() {
26 } 22 Register(FunctionTable, ARRAY_SIZE(FunctionTable));
23}
27 24
28} // namespace 25} // namespace
diff --git a/src/core/hle/service/boss_u.h b/src/core/hle/service/boss_u.h
index af39b8e65..2668f2dfd 100644
--- a/src/core/hle/service/boss_u.h
+++ b/src/core/hle/service/boss_u.h
@@ -1,5 +1,5 @@
1// Copyright 2014 Citra Emulator Project 1// Copyright 2014 Citra Emulator Project
2// Licensed under GPLv2 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#pragma once 5#pragma once
@@ -11,17 +11,13 @@
11 11
12namespace BOSS_U { 12namespace BOSS_U {
13 13
14 class Interface : public Service::Interface { 14class Interface : public Service::Interface {
15 public: 15public:
16 Interface(); 16 Interface();
17 ~Interface(); 17
18 /** 18 std::string GetPortName() const override {
19 * Gets the string port name used by CTROS for the service 19 return "boss:U";
20 * @return Port name of service 20 }
21 */ 21};
22 std::string GetPortName() const {
23 return "boss:U";
24 }
25 };
26 22
27} // namespace 23} // namespace
diff --git a/src/core/hle/service/cecd_u.cpp b/src/core/hle/service/cecd_u.cpp
index 25d903516..b7655ef0b 100644
--- a/src/core/hle/service/cecd_u.cpp
+++ b/src/core/hle/service/cecd_u.cpp
@@ -1,5 +1,5 @@
1// Copyright 2014 Citra Emulator Project 1// Copyright 2014 Citra Emulator Project
2// Licensed under GPLv2+ 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 "common/log.h" 5#include "common/log.h"
diff --git a/src/core/hle/service/cecd_u.h b/src/core/hle/service/cecd_u.h
index 969e1ed1b..e67564135 100644
--- a/src/core/hle/service/cecd_u.h
+++ b/src/core/hle/service/cecd_u.h
@@ -1,5 +1,5 @@
1// Copyright 2014 Citra Emulator Project 1// Copyright 2014 Citra Emulator Project
2// Licensed under GPLv2+ 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#pragma once 5#pragma once
@@ -15,10 +15,6 @@ class Interface : public Service::Interface {
15public: 15public:
16 Interface(); 16 Interface();
17 17
18 /**
19 * Gets the string port name used by CTROS for the service
20 * @return Port name of service
21 */
22 std::string GetPortName() const override { 18 std::string GetPortName() const override {
23 return "cecd:u"; 19 return "cecd:u";
24 } 20 }
diff --git a/src/core/hle/service/cfg/cfg.cpp b/src/core/hle/service/cfg/cfg.cpp
new file mode 100644
index 000000000..161aa8531
--- /dev/null
+++ b/src/core/hle/service/cfg/cfg.cpp
@@ -0,0 +1,202 @@
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 <algorithm>
6#include "common/log.h"
7#include "common/make_unique.h"
8#include "core/file_sys/archive_systemsavedata.h"
9#include "core/hle/service/cfg/cfg.h"
10
11namespace Service {
12namespace CFG {
13
14const u64 CFG_SAVE_ID = 0x00010017;
15const u64 CONSOLE_UNIQUE_ID = 0xDEADC0DE;
16const ConsoleModelInfo CONSOLE_MODEL = { NINTENDO_3DS_XL, { 0, 0, 0 } };
17const u8 CONSOLE_LANGUAGE = LANGUAGE_EN;
18const char CONSOLE_USERNAME[0x14] = "CITRA";
19/// This will be initialized in CFGInit, and will be used when creating the block
20UsernameBlock CONSOLE_USERNAME_BLOCK;
21/// TODO(Subv): Find out what this actually is
22const u8 SOUND_OUTPUT_MODE = 2;
23const u8 UNITED_STATES_COUNTRY_ID = 49;
24/// TODO(Subv): Find what the other bytes are
25const ConsoleCountryInfo COUNTRY_INFO = { { 0, 0, 0 }, UNITED_STATES_COUNTRY_ID };
26
27/**
28 * TODO(Subv): Find out what this actually is, these values fix some NaN uniforms in some games,
29 * for example Nintendo Zone
30 * Thanks Normmatt for providing this information
31 */
32const std::array<float, 8> STEREO_CAMERA_SETTINGS = {
33 62.0f, 289.0f, 76.80000305175781f, 46.08000183105469f,
34 10.0f, 5.0f, 55.58000183105469f, 21.56999969482422f
35};
36
37static const u32 CONFIG_SAVEFILE_SIZE = 0x8000;
38static std::array<u8, CONFIG_SAVEFILE_SIZE> cfg_config_file_buffer;
39
40static std::unique_ptr<FileSys::Archive_SystemSaveData> cfg_system_save_data;
41
42ResultCode GetConfigInfoBlock(u32 block_id, u32 size, u32 flag, u8* output) {
43 // Read the header
44 SaveFileConfig* config = reinterpret_cast<SaveFileConfig*>(cfg_config_file_buffer.data());
45
46 auto itr = std::find_if(std::begin(config->block_entries), std::end(config->block_entries),
47 [&](const SaveConfigBlockEntry& entry) {
48 return entry.block_id == block_id && entry.size == size && (entry.flags & flag);
49 });
50
51 if (itr == std::end(config->block_entries)) {
52 LOG_ERROR(Service_CFG, "Config block %u with size %u and flags %u not found", block_id, size, flag);
53 return ResultCode(-1); // TODO(Subv): Find the correct error code
54 }
55
56 // The data is located in the block header itself if the size is less than 4 bytes
57 if (itr->size <= 4)
58 memcpy(output, &itr->offset_or_data, itr->size);
59 else
60 memcpy(output, &cfg_config_file_buffer[itr->offset_or_data], itr->size);
61
62 return RESULT_SUCCESS;
63}
64
65ResultCode CreateConfigInfoBlk(u32 block_id, u16 size, u16 flags, const u8* data) {
66 SaveFileConfig* config = reinterpret_cast<SaveFileConfig*>(cfg_config_file_buffer.data());
67 if (config->total_entries >= CONFIG_FILE_MAX_BLOCK_ENTRIES)
68 return ResultCode(-1); // TODO(Subv): Find the right error code
69
70 // Insert the block header with offset 0 for now
71 config->block_entries[config->total_entries] = { block_id, 0, size, flags };
72 if (size > 4) {
73 u32 offset = config->data_entries_offset;
74 // Perform a search to locate the next offset for the new data
75 // use the offset and size of the previous block to determine the new position
76 for (int i = config->total_entries - 1; i >= 0; --i) {
77 // Ignore the blocks that don't have a separate data offset
78 if (config->block_entries[i].size > 4) {
79 offset = config->block_entries[i].offset_or_data +
80 config->block_entries[i].size;
81 break;
82 }
83 }
84
85 config->block_entries[config->total_entries].offset_or_data = offset;
86
87 // Write the data at the new offset
88 memcpy(&cfg_config_file_buffer[offset], data, size);
89 }
90 else {
91 // The offset_or_data field in the header contains the data itself if it's 4 bytes or less
92 memcpy(&config->block_entries[config->total_entries].offset_or_data, data, size);
93 }
94
95 ++config->total_entries;
96 return RESULT_SUCCESS;
97}
98
99ResultCode DeleteConfigNANDSaveFile() {
100 FileSys::Path path("config");
101 if (cfg_system_save_data->DeleteFile(path))
102 return RESULT_SUCCESS;
103 return ResultCode(-1); // TODO(Subv): Find the right error code
104}
105
106ResultCode UpdateConfigNANDSavegame() {
107 FileSys::Mode mode = {};
108 mode.write_flag = 1;
109 mode.create_flag = 1;
110 FileSys::Path path("config");
111 auto file = cfg_system_save_data->OpenFile(path, mode);
112 _assert_msg_(Service_CFG, file != nullptr, "could not open file");
113 file->Write(0, CONFIG_SAVEFILE_SIZE, 1, cfg_config_file_buffer.data());
114 return RESULT_SUCCESS;
115}
116
117ResultCode FormatConfig() {
118 ResultCode res = DeleteConfigNANDSaveFile();
119 if (!res.IsSuccess())
120 return res;
121 // Delete the old data
122 cfg_config_file_buffer.fill(0);
123 // Create the header
124 SaveFileConfig* config = reinterpret_cast<SaveFileConfig*>(cfg_config_file_buffer.data());
125 // This value is hardcoded, taken from 3dbrew, verified by hardware, it's always the same value
126 config->data_entries_offset = 0x455C;
127 // Insert the default blocks
128 res = CreateConfigInfoBlk(0x00050005, sizeof(STEREO_CAMERA_SETTINGS), 0xE,
129 reinterpret_cast<const u8*>(STEREO_CAMERA_SETTINGS.data()));
130 if (!res.IsSuccess())
131 return res;
132 res = CreateConfigInfoBlk(0x00090001, sizeof(CONSOLE_UNIQUE_ID), 0xE,
133 reinterpret_cast<const u8*>(&CONSOLE_UNIQUE_ID));
134 if (!res.IsSuccess())
135 return res;
136 res = CreateConfigInfoBlk(0x000F0004, sizeof(CONSOLE_MODEL), 0x8,
137 reinterpret_cast<const u8*>(&CONSOLE_MODEL));
138 if (!res.IsSuccess())
139 return res;
140 res = CreateConfigInfoBlk(0x000A0002, sizeof(CONSOLE_LANGUAGE), 0xA, &CONSOLE_LANGUAGE);
141 if (!res.IsSuccess())
142 return res;
143 res = CreateConfigInfoBlk(0x00070001, sizeof(SOUND_OUTPUT_MODE), 0xE, &SOUND_OUTPUT_MODE);
144 if (!res.IsSuccess())
145 return res;
146 res = CreateConfigInfoBlk(0x000B0000, sizeof(COUNTRY_INFO), 0xE,
147 reinterpret_cast<const u8*>(&COUNTRY_INFO));
148 if (!res.IsSuccess())
149 return res;
150 res = CreateConfigInfoBlk(0x000A0000, sizeof(CONSOLE_USERNAME_BLOCK), 0xE,
151 reinterpret_cast<const u8*>(&CONSOLE_USERNAME_BLOCK));
152 if (!res.IsSuccess())
153 return res;
154 // Save the buffer to the file
155 res = UpdateConfigNANDSavegame();
156 if (!res.IsSuccess())
157 return res;
158 return RESULT_SUCCESS;
159}
160
161void CFGInit() {
162 // TODO(Subv): In the future we should use the FS service to query this archive,
163 // currently it is not possible because you can only have one open archive of the same type at any time
164 std::string syssavedata_directory = FileUtil::GetUserPath(D_SYSSAVEDATA_IDX);
165 cfg_system_save_data = Common::make_unique<FileSys::Archive_SystemSaveData>(
166 syssavedata_directory, CFG_SAVE_ID);
167 if (!cfg_system_save_data->Initialize()) {
168 LOG_CRITICAL(Service_CFG, "Could not initialize SystemSaveData archive for the CFG:U service");
169 return;
170 }
171
172 // TODO(Subv): All this code should be moved to cfg:i,
173 // it's only here because we do not currently emulate the lower level code that uses that service
174 // Try to open the file in read-only mode to check its existence
175 FileSys::Mode mode = {};
176 mode.read_flag = 1;
177 FileSys::Path path("config");
178 auto file = cfg_system_save_data->OpenFile(path, mode);
179
180 // Load the config if it already exists
181 if (file != nullptr) {
182 file->Read(0, CONFIG_SAVEFILE_SIZE, cfg_config_file_buffer.data());
183 return;
184 }
185
186 // Initialize the Username block
187 // TODO(Subv): Initialize this directly in the variable when MSVC supports char16_t string literals
188 CONSOLE_USERNAME_BLOCK.ng_word = 0;
189 CONSOLE_USERNAME_BLOCK.zero = 0;
190 // Copy string to buffer and pad with zeros at the end
191 auto size = Common::UTF8ToUTF16(CONSOLE_USERNAME).copy(CONSOLE_USERNAME_BLOCK.username, 0x14);
192 std::fill(std::begin(CONSOLE_USERNAME_BLOCK.username) + size,
193 std::end(CONSOLE_USERNAME_BLOCK.username), 0);
194 FormatConfig();
195}
196
197void CFGShutdown() {
198
199}
200
201} // namespace CFG
202} // namespace Service
diff --git a/src/core/hle/service/cfg/cfg.h b/src/core/hle/service/cfg/cfg.h
new file mode 100644
index 000000000..c74527ca4
--- /dev/null
+++ b/src/core/hle/service/cfg/cfg.h
@@ -0,0 +1,144 @@
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 <array>
8#include "core/hle/result.h"
9
10namespace Service {
11namespace CFG {
12
13enum SystemModel {
14 NINTENDO_3DS = 0,
15 NINTENDO_3DS_XL = 1,
16 NEW_NINTENDO_3DS = 2,
17 NINTENDO_2DS = 3,
18 NEW_NINTENDO_3DS_XL = 4
19};
20
21enum SystemLanguage {
22 LANGUAGE_JP = 0,
23 LANGUAGE_EN = 1,
24 LANGUAGE_FR = 2,
25 LANGUAGE_DE = 3,
26 LANGUAGE_IT = 4,
27 LANGUAGE_ES = 5,
28 LANGUAGE_ZH = 6,
29 LANGUAGE_KO = 7,
30 LANGUAGE_NL = 8,
31 LANGUAGE_PT = 9,
32 LANGUAGE_RU = 10
33};
34
35/// Block header in the config savedata file
36struct SaveConfigBlockEntry {
37 u32 block_id; ///< The id of the current block
38 u32 offset_or_data; ///< This is the absolute offset to the block data if the size is greater than 4 bytes, otherwise it contains the data itself
39 u16 size; ///< The size of the block
40 u16 flags; ///< The flags of the block, possibly used for access control
41};
42
43/// The maximum number of block entries that can exist in the config file
44static const u32 CONFIG_FILE_MAX_BLOCK_ENTRIES = 1479;
45
46/**
47* The header of the config savedata file,
48* contains information about the blocks in the file
49*/
50struct SaveFileConfig {
51 u16 total_entries; ///< The total number of set entries in the config file
52 u16 data_entries_offset; ///< The offset where the data for the blocks start, this is hardcoded to 0x455C as per hardware
53 SaveConfigBlockEntry block_entries[CONFIG_FILE_MAX_BLOCK_ENTRIES]; ///< The block headers, the maximum possible value is 1479 as per hardware
54 u32 unknown; ///< This field is unknown, possibly padding, 0 has been observed in hardware
55};
56static_assert(sizeof(SaveFileConfig) == 0x455C, "The SaveFileConfig header must be exactly 0x455C bytes");
57
58struct UsernameBlock {
59 char16_t username[10]; ///< Exactly 20 bytes long, padded with zeros at the end if necessary
60 u32 zero;
61 u32 ng_word;
62};
63static_assert(sizeof(UsernameBlock) == 0x1C, "Size of UsernameBlock must be 0x1C");
64
65struct ConsoleModelInfo {
66 u8 model; ///< The console model (3DS, 2DS, etc)
67 u8 unknown[3]; ///< Unknown data
68};
69static_assert(sizeof(ConsoleModelInfo) == 4, "ConsoleModelInfo must be exactly 4 bytes");
70
71struct ConsoleCountryInfo {
72 u8 unknown[3]; ///< Unknown data
73 u8 country_code; ///< The country code of the console
74};
75static_assert(sizeof(ConsoleCountryInfo) == 4, "ConsoleCountryInfo must be exactly 4 bytes");
76
77extern const u64 CFG_SAVE_ID;
78extern const u64 CONSOLE_UNIQUE_ID;
79extern const ConsoleModelInfo CONSOLE_MODEL;
80extern const u8 CONSOLE_LANGUAGE;
81extern const char CONSOLE_USERNAME[0x14];
82/// This will be initialized in the Interface constructor, and will be used when creating the block
83extern UsernameBlock CONSOLE_USERNAME_BLOCK;
84/// TODO(Subv): Find out what this actually is
85extern const u8 SOUND_OUTPUT_MODE;
86extern const u8 UNITED_STATES_COUNTRY_ID;
87/// TODO(Subv): Find what the other bytes are
88extern const ConsoleCountryInfo COUNTRY_INFO;
89extern const std::array<float, 8> STEREO_CAMERA_SETTINGS;
90
91static_assert(sizeof(STEREO_CAMERA_SETTINGS) == 0x20, "STEREO_CAMERA_SETTINGS must be exactly 0x20 bytes");
92static_assert(sizeof(CONSOLE_UNIQUE_ID) == 8, "CONSOLE_UNIQUE_ID must be exactly 8 bytes");
93static_assert(sizeof(CONSOLE_LANGUAGE) == 1, "CONSOLE_LANGUAGE must be exactly 1 byte");
94static_assert(sizeof(SOUND_OUTPUT_MODE) == 1, "SOUND_OUTPUT_MODE must be exactly 1 byte");
95
96/**
97 * Reads a block with the specified id and flag from the Config savegame buffer
98 * and writes the output to output.
99 * The input size must match exactly the size of the requested block
100 * @param block_id The id of the block we want to read
101 * @param size The size of the block we want to read
102 * @param flag The requested block must have this flag set
103 * @param output A pointer where we will write the read data
104 * @returns ResultCode indicating the result of the operation, 0 on success
105 */
106ResultCode GetConfigInfoBlock(u32 block_id, u32 size, u32 flag, u8* output);
107
108/**
109 * Creates a block with the specified id and writes the input data to the cfg savegame buffer in memory.
110 * The config savegame file in the filesystem is not updated.
111 * @param block_id The id of the block we want to create
112 * @param size The size of the block we want to create
113 * @param flag The flags of the new block
114 * @param data A pointer containing the data we will write to the new block
115 * @returns ResultCode indicating the result of the operation, 0 on success
116 */
117ResultCode CreateConfigInfoBlk(u32 block_id, u16 size, u16 flags, const u8* data);
118
119/**
120 * Deletes the config savegame file from the filesystem, the buffer in memory is not affected
121 * @returns ResultCode indicating the result of the operation, 0 on success
122 */
123ResultCode DeleteConfigNANDSaveFile();
124
125/**
126 * Writes the config savegame memory buffer to the config savegame file in the filesystem
127 * @returns ResultCode indicating the result of the operation, 0 on success
128 */
129ResultCode UpdateConfigNANDSavegame();
130
131/**
132 * Re-creates the config savegame file in memory and the filesystem with the default blocks
133 * @returns ResultCode indicating the result of the operation, 0 on success
134 */
135ResultCode FormatConfig();
136
137/// Initialize the config service
138void CFGInit();
139
140/// Shutdown the config service
141void CFGShutdown();
142
143} // namespace CFG
144} // namespace Service
diff --git a/src/core/hle/service/cfg/cfg_i.cpp b/src/core/hle/service/cfg/cfg_i.cpp
new file mode 100644
index 000000000..7c1ee8ac3
--- /dev/null
+++ b/src/core/hle/service/cfg/cfg_i.cpp
@@ -0,0 +1,110 @@
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/service/cfg/cfg.h"
8#include "core/hle/service/cfg/cfg_i.h"
9
10////////////////////////////////////////////////////////////////////////////////////////////////////
11// Namespace CFG_I
12
13namespace CFG_I {
14
15/**
16 * CFG_I::GetConfigInfoBlk8 service function
17 * This function is called by two command headers,
18 * there appears to be no difference between them according to 3dbrew
19 * Inputs:
20 * 0 : 0x04010082 / 0x08010082
21 * 1 : Size
22 * 2 : Block ID
23 * 3 : Descriptor for the output buffer
24 * 4 : Output buffer pointer
25 * Outputs:
26 * 1 : Result of function, 0 on success, otherwise error code
27 */
28static void GetConfigInfoBlk8(Service::Interface* self) {
29 u32* cmd_buffer = Kernel::GetCommandBuffer();
30 u32 size = cmd_buffer[1];
31 u32 block_id = cmd_buffer[2];
32 u8* data_pointer = Memory::GetPointer(cmd_buffer[4]);
33
34 if (data_pointer == nullptr) {
35 cmd_buffer[1] = -1; // TODO(Subv): Find the right error code
36 return;
37 }
38
39 cmd_buffer[1] = Service::CFG::GetConfigInfoBlock(block_id, size, 0x8, data_pointer).raw;
40}
41
42/**
43 * CFG_I::UpdateConfigNANDSavegame service function
44 * This function is called by two command headers,
45 * there appears to be no difference between them according to 3dbrew
46 * Inputs:
47 * 0 : 0x04030000 / 0x08030000
48 * Outputs:
49 * 1 : Result of function, 0 on success, otherwise error code
50 */
51static void UpdateConfigNANDSavegame(Service::Interface* self) {
52 u32* cmd_buffer = Kernel::GetCommandBuffer();
53 cmd_buffer[1] = Service::CFG::UpdateConfigNANDSavegame().raw;
54}
55
56/**
57 * CFG_I::FormatConfig service function
58 * Inputs:
59 * 0 : 0x08060000
60 * Outputs:
61 * 1 : Result of function, 0 on success, otherwise error code
62 */
63static void FormatConfig(Service::Interface* self) {
64 u32* cmd_buffer = Kernel::GetCommandBuffer();
65 cmd_buffer[1] = Service::CFG::FormatConfig().raw;
66}
67
68const Interface::FunctionInfo FunctionTable[] = {
69 {0x04010082, GetConfigInfoBlk8, "GetConfigInfoBlk8"},
70 {0x04020082, nullptr, "SetConfigInfoBlk4"},
71 {0x04030000, UpdateConfigNANDSavegame, "UpdateConfigNANDSavegame"},
72 {0x04040042, nullptr, "GetLocalFriendCodeSeedData"},
73 {0x04050000, nullptr, "GetLocalFriendCodeSeed"},
74 {0x04060000, nullptr, "SecureInfoGetRegion"},
75 {0x04070000, nullptr, "SecureInfoGetByte101"},
76 {0x04080042, nullptr, "SecureInfoGetSerialNo"},
77 {0x04090000, nullptr, "UpdateConfigBlk00040003"},
78 {0x08010082, GetConfigInfoBlk8, "GetConfigInfoBlk8"},
79 {0x08020082, nullptr, "SetConfigInfoBlk4"},
80 {0x08030000, UpdateConfigNANDSavegame, "UpdateConfigNANDSavegame"},
81 {0x080400C2, nullptr, "CreateConfigInfoBlk"},
82 {0x08050000, nullptr, "DeleteConfigNANDSavefile"},
83 {0x08060000, FormatConfig, "FormatConfig"},
84 {0x08080000, nullptr, "UpdateConfigBlk1"},
85 {0x08090000, nullptr, "UpdateConfigBlk2"},
86 {0x080A0000, nullptr, "UpdateConfigBlk3"},
87 {0x080B0082, nullptr, "SetGetLocalFriendCodeSeedData"},
88 {0x080C0042, nullptr, "SetLocalFriendCodeSeedSignature"},
89 {0x080D0000, nullptr, "DeleteCreateNANDLocalFriendCodeSeed"},
90 {0x080E0000, nullptr, "VerifySigLocalFriendCodeSeed"},
91 {0x080F0042, nullptr, "GetLocalFriendCodeSeedData"},
92 {0x08100000, nullptr, "GetLocalFriendCodeSeed"},
93 {0x08110084, nullptr, "SetSecureInfo"},
94 {0x08120000, nullptr, "DeleteCreateNANDSecureInfo"},
95 {0x08130000, nullptr, "VerifySigSecureInfo"},
96 {0x08140042, nullptr, "SecureInfoGetData"},
97 {0x08150042, nullptr, "SecureInfoGetSignature"},
98 {0x08160000, nullptr, "SecureInfoGetRegion"},
99 {0x08170000, nullptr, "SecureInfoGetByte101"},
100 {0x08180042, nullptr, "SecureInfoGetSerialNo"},
101};
102
103////////////////////////////////////////////////////////////////////////////////////////////////////
104// Interface class
105
106Interface::Interface() {
107 Register(FunctionTable, ARRAY_SIZE(FunctionTable));
108}
109
110} // namespace
diff --git a/src/core/hle/service/cfg_i.h b/src/core/hle/service/cfg/cfg_i.h
index fe343c968..a498dd589 100644
--- a/src/core/hle/service/cfg_i.h
+++ b/src/core/hle/service/cfg/cfg_i.h
@@ -1,5 +1,5 @@
1// Copyright 2014 Citra Emulator Project 1// Copyright 2014 Citra Emulator Project
2// Licensed under GPLv2 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#pragma once 5#pragma once
@@ -14,11 +14,7 @@ namespace CFG_I {
14class Interface : public Service::Interface { 14class Interface : public Service::Interface {
15public: 15public:
16 Interface(); 16 Interface();
17 ~Interface(); 17
18 /**
19 * Gets the string port name used by CTROS for the service
20 * @return Port name of service
21 */
22 std::string GetPortName() const override { 18 std::string GetPortName() const override {
23 return "cfg:i"; 19 return "cfg:i";
24 } 20 }
diff --git a/src/core/hle/service/cfg_u.cpp b/src/core/hle/service/cfg/cfg_u.cpp
index 2e9d7bf21..03c01cf90 100644
--- a/src/core/hle/service/cfg_u.cpp
+++ b/src/core/hle/service/cfg/cfg_u.cpp
@@ -1,10 +1,14 @@
1// Copyright 2014 Citra Emulator Project 1// Copyright 2014 Citra Emulator Project
2// Licensed under GPLv2 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 "common/file_util.h"
5#include "common/log.h" 6#include "common/log.h"
7#include "common/string_util.h"
8#include "core/file_sys/archive_systemsavedata.h"
6#include "core/hle/hle.h" 9#include "core/hle/hle.h"
7#include "core/hle/service/cfg_u.h" 10#include "core/hle/service/cfg/cfg.h"
11#include "core/hle/service/cfg/cfg_u.h"
8 12
9//////////////////////////////////////////////////////////////////////////////////////////////////// 13////////////////////////////////////////////////////////////////////////////////////////////////////
10// Namespace CFG_U 14// Namespace CFG_U
@@ -99,18 +103,85 @@ static void GetCountryCodeID(Service::Interface* self) {
99 cmd_buffer[2] = country_code_id; 103 cmd_buffer[2] = country_code_id;
100} 104}
101 105
106/**
107 * CFG_User::GetConfigInfoBlk2 service function
108 * Inputs:
109 * 0 : 0x00010082
110 * 1 : Size
111 * 2 : Block ID
112 * 3 : Descriptor for the output buffer
113 * 4 : Output buffer pointer
114 * Outputs:
115 * 1 : Result of function, 0 on success, otherwise error code
116 */
117static void GetConfigInfoBlk2(Service::Interface* self) {
118 u32* cmd_buffer = Kernel::GetCommandBuffer();
119 u32 size = cmd_buffer[1];
120 u32 block_id = cmd_buffer[2];
121 u8* data_pointer = Memory::GetPointer(cmd_buffer[4]);
122
123 if (data_pointer == nullptr) {
124 cmd_buffer[1] = -1; // TODO(Subv): Find the right error code
125 return;
126 }
127
128 cmd_buffer[1] = Service::CFG::GetConfigInfoBlock(block_id, size, 0x2, data_pointer).raw;
129}
130
131/**
132 * CFG_User::GetSystemModel service function
133 * Inputs:
134 * 0 : 0x00050000
135 * Outputs:
136 * 1 : Result of function, 0 on success, otherwise error code
137 * 2 : Model of the console
138 */
139static void GetSystemModel(Service::Interface* self) {
140 u32* cmd_buffer = Kernel::GetCommandBuffer();
141 u32 data;
142
143 // TODO(Subv): Find out the correct error codes
144 cmd_buffer[1] = Service::CFG::GetConfigInfoBlock(0x000F0004, 4, 0x8,
145 reinterpret_cast<u8*>(&data)).raw;
146 cmd_buffer[2] = data & 0xFF;
147}
148
149/**
150 * CFG_User::GetModelNintendo2DS service function
151 * Inputs:
152 * 0 : 0x00060000
153 * Outputs:
154 * 1 : Result of function, 0 on success, otherwise error code
155 * 2 : 0 if the system is a Nintendo 2DS, 1 otherwise
156 */
157static void GetModelNintendo2DS(Service::Interface* self) {
158 u32* cmd_buffer = Kernel::GetCommandBuffer();
159 u32 data;
160
161 // TODO(Subv): Find out the correct error codes
162 cmd_buffer[1] = Service::CFG::GetConfigInfoBlock(0x000F0004, 4, 0x8,
163 reinterpret_cast<u8*>(&data)).raw;
164
165 u8 model = data & 0xFF;
166 if (model == Service::CFG::NINTENDO_2DS)
167 cmd_buffer[2] = 0;
168 else
169 cmd_buffer[2] = 1;
170}
171
102const Interface::FunctionInfo FunctionTable[] = { 172const Interface::FunctionInfo FunctionTable[] = {
103 {0x00010082, nullptr, "GetConfigInfoBlk2"}, 173 {0x00010082, GetConfigInfoBlk2, "GetConfigInfoBlk2"},
104 {0x00020000, nullptr, "SecureInfoGetRegion"}, 174 {0x00020000, nullptr, "SecureInfoGetRegion"},
105 {0x00030000, nullptr, "GenHashConsoleUnique"}, 175 {0x00030000, nullptr, "GenHashConsoleUnique"},
106 {0x00040000, nullptr, "GetRegionCanadaUSA"}, 176 {0x00040000, nullptr, "GetRegionCanadaUSA"},
107 {0x00050000, nullptr, "GetSystemModel"}, 177 {0x00050000, GetSystemModel, "GetSystemModel"},
108 {0x00060000, nullptr, "GetModelNintendo2DS"}, 178 {0x00060000, GetModelNintendo2DS, "GetModelNintendo2DS"},
109 {0x00070040, nullptr, "unknown"}, 179 {0x00070040, nullptr, "unknown"},
110 {0x00080080, nullptr, "unknown"}, 180 {0x00080080, nullptr, "unknown"},
111 {0x00090040, GetCountryCodeString, "GetCountryCodeString"}, 181 {0x00090040, GetCountryCodeString, "GetCountryCodeString"},
112 {0x000A0040, GetCountryCodeID, "GetCountryCodeID"}, 182 {0x000A0040, GetCountryCodeID, "GetCountryCodeID"},
113}; 183};
184
114//////////////////////////////////////////////////////////////////////////////////////////////////// 185////////////////////////////////////////////////////////////////////////////////////////////////////
115// Interface class 186// Interface class
116 187
@@ -118,7 +189,4 @@ Interface::Interface() {
118 Register(FunctionTable, ARRAY_SIZE(FunctionTable)); 189 Register(FunctionTable, ARRAY_SIZE(FunctionTable));
119} 190}
120 191
121Interface::~Interface() {
122}
123
124} // namespace 192} // namespace
diff --git a/src/core/hle/service/cfg_u.h b/src/core/hle/service/cfg/cfg_u.h
index 8075d19a8..9ad73f355 100644
--- a/src/core/hle/service/cfg_u.h
+++ b/src/core/hle/service/cfg/cfg_u.h
@@ -1,5 +1,5 @@
1// Copyright 2014 Citra Emulator Project 1// Copyright 2014 Citra Emulator Project
2// Licensed under GPLv2 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#pragma once 5#pragma once
@@ -14,11 +14,7 @@ namespace CFG_U {
14class Interface : public Service::Interface { 14class Interface : public Service::Interface {
15public: 15public:
16 Interface(); 16 Interface();
17 ~Interface(); 17
18 /**
19 * Gets the string port name used by CTROS for the service
20 * @return Port name of service
21 */
22 std::string GetPortName() const override { 18 std::string GetPortName() const override {
23 return "cfg:u"; 19 return "cfg:u";
24 } 20 }
diff --git a/src/core/hle/service/cfg_i.cpp b/src/core/hle/service/cfg_i.cpp
deleted file mode 100644
index 88d13d459..000000000
--- a/src/core/hle/service/cfg_i.cpp
+++ /dev/null
@@ -1,59 +0,0 @@
1// Copyright 2014 Citra Emulator Project
2// Licensed under GPLv2
3// Refer to the license.txt file included.
4
5#include "common/log.h"
6#include "core/hle/hle.h"
7#include "core/hle/service/cfg_i.h"
8
9////////////////////////////////////////////////////////////////////////////////////////////////////
10// Namespace CFG_I
11
12namespace CFG_I {
13
14const Interface::FunctionInfo FunctionTable[] = {
15 {0x04010082, nullptr, "GetConfigInfoBlk8"},
16 {0x04020082, nullptr, "GetConfigInfoBlk4"},
17 {0x04030000, nullptr, "UpdateConfigNANDSavegame"},
18 {0x04040042, nullptr, "GetLocalFriendCodeSeedData"},
19 {0x04050000, nullptr, "GetLocalFriendCodeSeed"},
20 {0x04060000, nullptr, "SecureInfoGetRegion"},
21 {0x04070000, nullptr, "SecureInfoGetByte101"},
22 {0x04080042, nullptr, "SecureInfoGetSerialNo"},
23 {0x04090000, nullptr, "UpdateConfigBlk00040003"},
24 {0x08010082, nullptr, "GetConfigInfoBlk8"},
25 {0x08020082, nullptr, "GetConfigInfoBlk4"},
26 {0x08030000, nullptr, "UpdateConfigNANDSavegame"},
27 {0x080400C2, nullptr, "CreateConfigInfoBlk"},
28 {0x08050000, nullptr, "DeleteConfigNANDSavefile"},
29 {0x08060000, nullptr, "FormatConfig"},
30 {0x08070000, nullptr, "Unknown"},
31 {0x08080000, nullptr, "UpdateConfigBlk1"},
32 {0x08090000, nullptr, "UpdateConfigBlk2"},
33 {0x080A0000, nullptr, "UpdateConfigBlk3"},
34 {0x080B0082, nullptr, "SetGetLocalFriendCodeSeedData"},
35 {0x080C0042, nullptr, "SetLocalFriendCodeSeedSignature"},
36 {0x080D0000, nullptr, "DeleteCreateNANDLocalFriendCodeSeed"},
37 {0x080E0000, nullptr, "VerifySigLocalFriendCodeSeed"},
38 {0x080F0042, nullptr, "GetLocalFriendCodeSeedData"},
39 {0x08100000, nullptr, "GetLocalFriendCodeSeed"},
40 {0x08110084, nullptr, "SetSecureInfo"},
41 {0x08120000, nullptr, "DeleteCreateNANDSecureInfo"},
42 {0x08130000, nullptr, "VerifySigSecureInfo"},
43 {0x08140042, nullptr, "SecureInfoGetData"},
44 {0x08150042, nullptr, "SecureInfoGetSignature"},
45 {0x08160000, nullptr, "SecureInfoGetRegion"},
46 {0x08170000, nullptr, "SecureInfoGetByte101"},
47 {0x08180042, nullptr, "SecureInfoGetSerialNo"},
48};
49////////////////////////////////////////////////////////////////////////////////////////////////////
50// Interface class
51
52Interface::Interface() {
53 Register(FunctionTable, ARRAY_SIZE(FunctionTable));
54}
55
56Interface::~Interface() {
57}
58
59} // namespace
diff --git a/src/core/hle/service/csnd_snd.cpp b/src/core/hle/service/csnd_snd.cpp
index 6e59a9bf3..aef8cfbca 100644
--- a/src/core/hle/service/csnd_snd.cpp
+++ b/src/core/hle/service/csnd_snd.cpp
@@ -1,5 +1,5 @@
1// Copyright 2014 Citra Emulator Project 1// Copyright 2014 Citra Emulator Project
2// Licensed under GPLv2 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 "common/log.h" 5#include "common/log.h"
@@ -33,7 +33,4 @@ Interface::Interface() {
33 Register(FunctionTable, ARRAY_SIZE(FunctionTable)); 33 Register(FunctionTable, ARRAY_SIZE(FunctionTable));
34} 34}
35 35
36Interface::~Interface() {
37}
38
39} // namespace 36} // namespace
diff --git a/src/core/hle/service/csnd_snd.h b/src/core/hle/service/csnd_snd.h
index 31cc85b07..a84752473 100644
--- a/src/core/hle/service/csnd_snd.h
+++ b/src/core/hle/service/csnd_snd.h
@@ -1,5 +1,5 @@
1// Copyright 2014 Citra Emulator Project 1// Copyright 2014 Citra Emulator Project
2// Licensed under GPLv2 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#pragma once 5#pragma once
@@ -14,11 +14,7 @@ namespace CSND_SND {
14class Interface : public Service::Interface { 14class Interface : public Service::Interface {
15public: 15public:
16 Interface(); 16 Interface();
17 ~Interface(); 17
18 /**
19 * Gets the string port name used by CTROS for the service
20 * @return Port name of service
21 */
22 std::string GetPortName() const override { 18 std::string GetPortName() const override {
23 return "csnd:SND"; 19 return "csnd:SND";
24 } 20 }
diff --git a/src/core/hle/service/dsp_dsp.cpp b/src/core/hle/service/dsp_dsp.cpp
index bd82063c6..2cf4d118f 100644
--- a/src/core/hle/service/dsp_dsp.cpp
+++ b/src/core/hle/service/dsp_dsp.cpp
@@ -1,5 +1,5 @@
1// Copyright 2014 Citra Emulator Project 1// Copyright 2014 Citra Emulator Project
2// Licensed under GPLv2 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 "common/log.h" 5#include "common/log.h"
@@ -190,7 +190,4 @@ Interface::Interface() {
190 Register(FunctionTable, ARRAY_SIZE(FunctionTable)); 190 Register(FunctionTable, ARRAY_SIZE(FunctionTable));
191} 191}
192 192
193Interface::~Interface() {
194}
195
196} // namespace 193} // namespace
diff --git a/src/core/hle/service/dsp_dsp.h b/src/core/hle/service/dsp_dsp.h
index 9431b62f6..0b8b64600 100644
--- a/src/core/hle/service/dsp_dsp.h
+++ b/src/core/hle/service/dsp_dsp.h
@@ -1,5 +1,5 @@
1// Copyright 2014 Citra Emulator Project 1// Copyright 2014 Citra Emulator Project
2// Licensed under GPLv2 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#pragma once 5#pragma once
@@ -14,11 +14,7 @@ namespace DSP_DSP {
14class Interface : public Service::Interface { 14class Interface : public Service::Interface {
15public: 15public:
16 Interface(); 16 Interface();
17 ~Interface(); 17
18 /**
19 * Gets the string port name used by CTROS for the service
20 * @return Port name of service
21 */
22 std::string GetPortName() const override { 18 std::string GetPortName() const override {
23 return "dsp::DSP"; 19 return "dsp::DSP";
24 } 20 }
diff --git a/src/core/hle/service/err_f.cpp b/src/core/hle/service/err_f.cpp
index 785c351e9..8c900eabc 100644
--- a/src/core/hle/service/err_f.cpp
+++ b/src/core/hle/service/err_f.cpp
@@ -1,5 +1,5 @@
1// Copyright 2014 Citra Emulator Project 1// Copyright 2014 Citra Emulator Project
2// Licensed under GPLv2 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 "common/log.h" 5#include "common/log.h"
@@ -11,17 +11,15 @@
11 11
12namespace ERR_F { 12namespace ERR_F {
13 13
14 const Interface::FunctionInfo FunctionTable[] = { 14const Interface::FunctionInfo FunctionTable[] = {
15 {0x00010800, nullptr, "ThrowFatalError"} 15 {0x00010800, nullptr, "ThrowFatalError"}
16 }; 16};
17 ////////////////////////////////////////////////////////////////////////////////////////////////////
18 // Interface class
19 17
20 Interface::Interface() { 18////////////////////////////////////////////////////////////////////////////////////////////////////
21 Register(FunctionTable, ARRAY_SIZE(FunctionTable)); 19// Interface class
22 }
23 20
24 Interface::~Interface() { 21Interface::Interface() {
25 } 22 Register(FunctionTable, ARRAY_SIZE(FunctionTable));
23}
26 24
27} // namespace 25} // namespace
diff --git a/src/core/hle/service/err_f.h b/src/core/hle/service/err_f.h
index 6d7141c1b..892d8af9b 100644
--- a/src/core/hle/service/err_f.h
+++ b/src/core/hle/service/err_f.h
@@ -1,5 +1,5 @@
1// Copyright 2014 Citra Emulator Project 1// Copyright 2014 Citra Emulator Project
2// Licensed under GPLv2 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#pragma once 5#pragma once
@@ -11,17 +11,13 @@
11 11
12namespace ERR_F { 12namespace ERR_F {
13 13
14 class Interface : public Service::Interface { 14class Interface : public Service::Interface {
15 public: 15public:
16 Interface(); 16 Interface();
17 ~Interface(); 17
18 /** 18 std::string GetPortName() const override {
19 * Gets the string port name used by CTROS for the service 19 return "err:f";
20 * @return Port name of service 20 }
21 */ 21};
22 std::string GetPortName() const override {
23 return "err:f";
24 }
25 };
26 22
27} // namespace 23} // namespace
diff --git a/src/core/hle/service/frd_u.cpp b/src/core/hle/service/frd_u.cpp
index 58023e536..021186e57 100644
--- a/src/core/hle/service/frd_u.cpp
+++ b/src/core/hle/service/frd_u.cpp
@@ -1,5 +1,5 @@
1// Copyright 2014 Citra Emulator Project 1// Copyright 2014 Citra Emulator Project
2// Licensed under GPLv2 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 "common/log.h" 5#include "common/log.h"
@@ -11,25 +11,23 @@
11 11
12namespace FRD_U { 12namespace FRD_U {
13 13
14 const Interface::FunctionInfo FunctionTable[] = { 14const Interface::FunctionInfo FunctionTable[] = {
15 {0x00050000, nullptr, "GetFriendKey"}, 15 {0x00050000, nullptr, "GetFriendKey"},
16 {0x00080000, nullptr, "GetMyPresence"}, 16 {0x00080000, nullptr, "GetMyPresence"},
17 {0x00100040, nullptr, "GetPassword"}, 17 {0x00100040, nullptr, "GetPassword"},
18 {0x00190042, nullptr, "GetFriendFavoriteGame"}, 18 {0x00190042, nullptr, "GetFriendFavoriteGame"},
19 {0x001A00C4, nullptr, "GetFriendInfo"}, 19 {0x001A00C4, nullptr, "GetFriendInfo"},
20 {0x001B0080, nullptr, "IsOnFriendList"}, 20 {0x001B0080, nullptr, "IsOnFriendList"},
21 {0x001C0042, nullptr, "DecodeLocalFriendCode"}, 21 {0x001C0042, nullptr, "DecodeLocalFriendCode"},
22 {0x001D0002, nullptr, "SetCurrentlyPlayingText"}, 22 {0x001D0002, nullptr, "SetCurrentlyPlayingText"},
23 {0x00320042, nullptr, "SetClientSdkVersion"} 23 {0x00320042, nullptr, "SetClientSdkVersion"}
24 }; 24};
25 ////////////////////////////////////////////////////////////////////////////////////////////////////
26 // Interface class
27 25
28 Interface::Interface() { 26////////////////////////////////////////////////////////////////////////////////////////////////////
29 Register(FunctionTable, ARRAY_SIZE(FunctionTable)); 27// Interface class
30 }
31 28
32 Interface::~Interface() { 29Interface::Interface() {
33 } 30 Register(FunctionTable, ARRAY_SIZE(FunctionTable));
31}
34 32
35} // namespace 33} // namespace
diff --git a/src/core/hle/service/frd_u.h b/src/core/hle/service/frd_u.h
index 4020c6664..ab8897d5b 100644
--- a/src/core/hle/service/frd_u.h
+++ b/src/core/hle/service/frd_u.h
@@ -1,5 +1,5 @@
1// Copyright 2014 Citra Emulator Project 1// Copyright 2014 Citra Emulator Project
2// Licensed under GPLv2 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#pragma once 5#pragma once
@@ -11,17 +11,13 @@
11 11
12namespace FRD_U { 12namespace FRD_U {
13 13
14 class Interface : public Service::Interface { 14class Interface : public Service::Interface {
15 public: 15public:
16 Interface(); 16 Interface();
17 ~Interface(); 17
18 /** 18 std::string GetPortName() const override {
19 * Gets the string port name used by CTROS for the service 19 return "frd:u";
20 * @return Port name of service 20 }
21 */ 21};
22 std::string GetPortName() const override {
23 return "frd:u";
24 }
25 };
26 22
27} // namespace 23} // namespace
diff --git a/src/core/hle/service/fs/archive.cpp b/src/core/hle/service/fs/archive.cpp
index b7f97495c..98db02f15 100644
--- a/src/core/hle/service/fs/archive.cpp
+++ b/src/core/hle/service/fs/archive.cpp
@@ -1,5 +1,5 @@
1// Copyright 2014 Citra Emulator Project 1// Copyright 2014 Citra Emulator Project
2// Licensed under GPLv2 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 <memory> 5#include <memory>
@@ -428,15 +428,6 @@ void ArchiveInit() {
428 CreateArchive(std::move(sdmc_archive), ArchiveIdCode::SDMC); 428 CreateArchive(std::move(sdmc_archive), ArchiveIdCode::SDMC);
429 else 429 else
430 LOG_ERROR(Service_FS, "Can't instantiate SDMC archive with path %s", sdmc_directory.c_str()); 430 LOG_ERROR(Service_FS, "Can't instantiate SDMC archive with path %s", sdmc_directory.c_str());
431
432 std::string systemsavedata_directory = FileUtil::GetUserPath(D_SYSSAVEDATA_IDX);
433 auto systemsavedata_archive = Common::make_unique<FileSys::Archive_SDMC>(systemsavedata_directory);
434 if (systemsavedata_archive->Initialize()) {
435 CreateArchive(std::move(systemsavedata_archive), ArchiveIdCode::SystemSaveData);
436 } else {
437 LOG_ERROR(Service_FS, "Can't instantiate SystemSaveData archive with path %s",
438 systemsavedata_directory.c_str());
439 }
440} 431}
441 432
442/// Shutdown archives 433/// Shutdown archives
diff --git a/src/core/hle/service/fs/archive.h b/src/core/hle/service/fs/archive.h
index 0fd3aaa0c..b39bc41b6 100644
--- a/src/core/hle/service/fs/archive.h
+++ b/src/core/hle/service/fs/archive.h
@@ -1,5 +1,5 @@
1// Copyright 2014 Citra Emulator Project 1// Copyright 2014 Citra Emulator Project
2// Licensed under GPLv2 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#pragma once 5#pragma once
diff --git a/src/core/hle/service/fs/fs_user.cpp b/src/core/hle/service/fs/fs_user.cpp
index 1402abe83..b1a465274 100644
--- a/src/core/hle/service/fs/fs_user.cpp
+++ b/src/core/hle/service/fs/fs_user.cpp
@@ -1,5 +1,5 @@
1// Copyright 2014 Citra Emulator Project 1// Copyright 2014 Citra Emulator Project
2// Licensed under GPLv2 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 "common/common.h" 5#include "common/common.h"
@@ -426,6 +426,23 @@ static void IsSdmcDetected(Service::Interface* self) {
426} 426}
427 427
428/** 428/**
429 * FS_User::IsSdmcWriteable service function
430 * Outputs:
431 * 0 : Command header 0x08180000
432 * 1 : Result of function, 0 on success, otherwise error code
433 * 2 : Whether the Sdmc is currently writeable
434 */
435static void IsSdmcWriteable(Service::Interface* self) {
436 u32* cmd_buff = Kernel::GetCommandBuffer();
437
438 cmd_buff[1] = RESULT_SUCCESS.raw;
439 // If the SD isn't enabled, it can't be writeable...else, stubbed true
440 cmd_buff[2] = Settings::values.use_virtual_sd ? 1 : 0;
441
442 LOG_DEBUG(Service_FS, " (STUBBED)");
443}
444
445/**
429 * FS_User::FormatSaveData service function, 446 * FS_User::FormatSaveData service function,
430 * formats the SaveData specified by the input path. 447 * formats the SaveData specified by the input path.
431 * Inputs: 448 * Inputs:
@@ -510,7 +527,7 @@ const FSUserInterface::FunctionInfo FunctionTable[] = {
510 {0x08150000, nullptr, "GetNandArchiveResource"}, 527 {0x08150000, nullptr, "GetNandArchiveResource"},
511 {0x08160000, nullptr, "GetSdmcFatfsErro"}, 528 {0x08160000, nullptr, "GetSdmcFatfsErro"},
512 {0x08170000, IsSdmcDetected, "IsSdmcDetected"}, 529 {0x08170000, IsSdmcDetected, "IsSdmcDetected"},
513 {0x08180000, nullptr, "IsSdmcWritable"}, 530 {0x08180000, IsSdmcWriteable, "IsSdmcWritable"},
514 {0x08190042, nullptr, "GetSdmcCid"}, 531 {0x08190042, nullptr, "GetSdmcCid"},
515 {0x081A0042, nullptr, "GetNandCid"}, 532 {0x081A0042, nullptr, "GetNandCid"},
516 {0x081B0000, nullptr, "GetSdmcSpeedInfo"}, 533 {0x081B0000, nullptr, "GetSdmcSpeedInfo"},
@@ -580,8 +597,5 @@ FSUserInterface::FSUserInterface() {
580 Register(FunctionTable, ARRAY_SIZE(FunctionTable)); 597 Register(FunctionTable, ARRAY_SIZE(FunctionTable));
581} 598}
582 599
583FSUserInterface::~FSUserInterface() {
584}
585
586} // namespace FS 600} // namespace FS
587} // namespace Service 601} // namespace Service
diff --git a/src/core/hle/service/fs/fs_user.h b/src/core/hle/service/fs/fs_user.h
index 80e3804e0..2d896dd5f 100644
--- a/src/core/hle/service/fs/fs_user.h
+++ b/src/core/hle/service/fs/fs_user.h
@@ -1,5 +1,5 @@
1// Copyright 2014 Citra Emulator Project 1// Copyright 2014 Citra Emulator Project
2// Licensed under GPLv2 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#pragma once 5#pragma once
@@ -15,15 +15,8 @@ namespace FS {
15/// Interface to "fs:USER" service 15/// Interface to "fs:USER" service
16class FSUserInterface : public Service::Interface { 16class FSUserInterface : public Service::Interface {
17public: 17public:
18
19 FSUserInterface(); 18 FSUserInterface();
20 19
21 ~FSUserInterface();
22
23 /**
24 * Gets the string port name used by CTROS for the service
25 * @return Port name of service
26 */
27 std::string GetPortName() const override { 20 std::string GetPortName() const override {
28 return "fs:USER"; 21 return "fs:USER";
29 } 22 }
diff --git a/src/core/hle/service/gsp_gpu.cpp b/src/core/hle/service/gsp_gpu.cpp
index 8c9ad2712..0127d4ee5 100644
--- a/src/core/hle/service/gsp_gpu.cpp
+++ b/src/core/hle/service/gsp_gpu.cpp
@@ -1,5 +1,5 @@
1// Copyright 2014 Citra Emulator Project 1// Copyright 2014 Citra Emulator Project
2// Licensed under GPLv2 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 5
@@ -396,7 +396,4 @@ Interface::Interface() {
396 g_thread_id = 1; 396 g_thread_id = 1;
397} 397}
398 398
399Interface::~Interface() {
400}
401
402} // namespace 399} // namespace
diff --git a/src/core/hle/service/gsp_gpu.h b/src/core/hle/service/gsp_gpu.h
index 177ce8da6..932b6170f 100644
--- a/src/core/hle/service/gsp_gpu.h
+++ b/src/core/hle/service/gsp_gpu.h
@@ -1,5 +1,5 @@
1// Copyright 2014 Citra Emulator Project 1// Copyright 2014 Citra Emulator Project
2// Licensed under GPLv2 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#pragma once 5#pragma once
@@ -158,19 +158,11 @@ static_assert(sizeof(CommandBuffer) == 0x200, "CommandBuffer struct has incorrec
158/// Interface to "srv:" service 158/// Interface to "srv:" service
159class Interface : public Service::Interface { 159class Interface : public Service::Interface {
160public: 160public:
161
162 Interface(); 161 Interface();
163 162
164 ~Interface();
165
166 /**
167 * Gets the string port name used by CTROS for the service
168 * @return Port name of service
169 */
170 std::string GetPortName() const override { 163 std::string GetPortName() const override {
171 return "gsp::Gpu"; 164 return "gsp::Gpu";
172 } 165 }
173
174}; 166};
175 167
176/** 168/**
diff --git a/src/core/hle/service/hid_user.cpp b/src/core/hle/service/hid_user.cpp
index eb2d35964..99b0ea5a0 100644
--- a/src/core/hle/service/hid_user.cpp
+++ b/src/core/hle/service/hid_user.cpp
@@ -1,5 +1,5 @@
1// Copyright 2014 Citra Emulator Project 1// Copyright 2014 Citra Emulator Project
2// Licensed under GPLv2 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 "common/log.h" 5#include "common/log.h"
@@ -179,7 +179,6 @@ const Interface::FunctionInfo FunctionTable[] = {
179 {0x00170000, nullptr, "GetSoundVolume"}, 179 {0x00170000, nullptr, "GetSoundVolume"},
180}; 180};
181 181
182
183//////////////////////////////////////////////////////////////////////////////////////////////////// 182////////////////////////////////////////////////////////////////////////////////////////////////////
184// Interface class 183// Interface class
185 184
@@ -196,7 +195,4 @@ Interface::Interface() {
196 Register(FunctionTable, ARRAY_SIZE(FunctionTable)); 195 Register(FunctionTable, ARRAY_SIZE(FunctionTable));
197} 196}
198 197
199Interface::~Interface() {
200}
201
202} // namespace 198} // namespace
diff --git a/src/core/hle/service/hid_user.h b/src/core/hle/service/hid_user.h
index 8f53befdb..5b96dda60 100644
--- a/src/core/hle/service/hid_user.h
+++ b/src/core/hle/service/hid_user.h
@@ -1,5 +1,5 @@
1// Copyright 2014 Citra Emulator Project 1// Copyright 2014 Citra Emulator Project
2// Licensed under GPLv2 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#pragma once 5#pragma once
@@ -102,19 +102,11 @@ void PadUpdateComplete();
102 */ 102 */
103class Interface : public Service::Interface { 103class Interface : public Service::Interface {
104public: 104public:
105
106 Interface(); 105 Interface();
107 106
108 ~Interface();
109
110 /**
111 * Gets the string port name used by CTROS for the service
112 * @return Port name of service
113 */
114 std::string GetPortName() const override { 107 std::string GetPortName() const override {
115 return "hid:USER"; 108 return "hid:USER";
116 } 109 }
117
118}; 110};
119 111
120} // namespace 112} // namespace
diff --git a/src/core/hle/service/http_c.cpp b/src/core/hle/service/http_c.cpp
new file mode 100644
index 000000000..d0bff552f
--- /dev/null
+++ b/src/core/hle/service/http_c.cpp
@@ -0,0 +1,64 @@
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/service/http_c.h"
8
9////////////////////////////////////////////////////////////////////////////////////////////////////
10// Namespace HTTP_C
11
12namespace HTTP_C {
13
14const Interface::FunctionInfo FunctionTable[] = {
15 {0x00010044, nullptr, "Initialize"},
16 {0x00020082, nullptr, "CreateContext"},
17 {0x00030040, nullptr, "CloseContext"},
18 {0x00040040, nullptr, "CancelConnection"},
19 {0x00050040, nullptr, "GetRequestState"},
20 {0x00060040, nullptr, "GetDownloadSizeState"},
21 {0x00070040, nullptr, "GetRequestError"},
22 {0x00080042, nullptr, "InitializeConnectionSession"},
23 {0x00090040, nullptr, "BeginRequest"},
24 {0x000A0040, nullptr, "BeginRequestAsync"},
25 {0x000B0082, nullptr, "ReceiveData"},
26 {0x000C0102, nullptr, "ReceiveDataTimeout"},
27 {0x000D0146, nullptr, "SetProxy"},
28 {0x000E0040, nullptr, "SetProxyDefault"},
29 {0x000F00C4, nullptr, "SetBasicAuthorization"},
30 {0x00100080, nullptr, "SetSocketBufferSize"},
31 {0x001100C4, nullptr, "AddRequestHeader"},
32 {0x001200C4, nullptr, "AddPostDataAscii"},
33 {0x001300C4, nullptr, "AddPostDataBinary"},
34 {0x00140082, nullptr, "AddPostDataRaw"},
35 {0x00150080, nullptr, "SetPostDataType"},
36 {0x001600C4, nullptr, "SendPostDataAscii"},
37 {0x00170144, nullptr, "SendPostDataAsciiTimeout"},
38 {0x001800C4, nullptr, "SendPostDataBinary"},
39 {0x00190144, nullptr, "SendPostDataBinaryTimeout"},
40 {0x001A0082, nullptr, "SendPostDataRaw"},
41 {0x001B0102, nullptr, "SendPOSTDataRawTimeout"},
42 {0x001C0080, nullptr, "SetPostDataEncoding"},
43 {0x001D0040, nullptr, "NotifyFinishSendPostData"},
44 {0x001E00C4, nullptr, "GetResponseHeader"},
45 {0x001F0144, nullptr, "GetResponseHeaderTimeout"},
46 {0x00200082, nullptr, "GetResponseData"},
47 {0x00210102, nullptr, "GetResponseDataTimeout"},
48 {0x00220040, nullptr, "GetResponseStatusCode"},
49 {0x002300C0, nullptr, "GetResponseStatusCodeTimeout"},
50 {0x00240082, nullptr, "AddTrustedRootCA"},
51 {0x00350186, nullptr, "SetDefaultProxy"},
52 {0x00360000, nullptr, "ClearDNSCache"},
53 {0x00370080, nullptr, "SetKeepAlive"},
54 {0x003800C0, nullptr, "Finalize"},
55};
56
57////////////////////////////////////////////////////////////////////////////////////////////////////
58// Interface class
59
60Interface::Interface() {
61 Register(FunctionTable, ARRAY_SIZE(FunctionTable));
62}
63
64} // namespace
diff --git a/src/core/hle/service/http_c.h b/src/core/hle/service/http_c.h
new file mode 100644
index 000000000..5ea3d1df3
--- /dev/null
+++ b/src/core/hle/service/http_c.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 HTTP_C
11
12namespace HTTP_C {
13
14class Interface : public Service::Interface {
15public:
16 Interface();
17
18 std::string GetPortName() const override {
19 return "http:C";
20 }
21};
22
23} // namespace
diff --git a/src/core/hle/service/ir_rst.cpp b/src/core/hle/service/ir_rst.cpp
index be15db231..b388afb15 100644
--- a/src/core/hle/service/ir_rst.cpp
+++ b/src/core/hle/service/ir_rst.cpp
@@ -1,5 +1,5 @@
1// Copyright 2014 Citra Emulator Project 1// Copyright 2014 Citra Emulator Project
2// Licensed under GPLv2 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 "common/log.h" 5#include "common/log.h"
@@ -30,7 +30,4 @@ Interface::Interface() {
30 Register(FunctionTable, ARRAY_SIZE(FunctionTable)); 30 Register(FunctionTable, ARRAY_SIZE(FunctionTable));
31} 31}
32 32
33Interface::~Interface() {
34}
35
36} // namespace 33} // namespace
diff --git a/src/core/hle/service/ir_rst.h b/src/core/hle/service/ir_rst.h
index 73effd7e3..deef701c5 100644
--- a/src/core/hle/service/ir_rst.h
+++ b/src/core/hle/service/ir_rst.h
@@ -1,6 +1,6 @@
1// Copyright 2014 Citra Emulator Project 1// Copyright 2014 Citra Emulator Project
2// Licensed under GPLv2 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#pragma once 5#pragma once
6 6
@@ -14,11 +14,7 @@ namespace IR_RST {
14class Interface : public Service::Interface { 14class Interface : public Service::Interface {
15public: 15public:
16 Interface(); 16 Interface();
17 ~Interface(); 17
18 /**
19 * Gets the string port name used by CTROS for the service
20 * @return Port name of service
21 */
22 std::string GetPortName() const override { 18 std::string GetPortName() const override {
23 return "ir:rst"; 19 return "ir:rst";
24 } 20 }
diff --git a/src/core/hle/service/ir_u.cpp b/src/core/hle/service/ir_u.cpp
index aa9db6f6d..da6f38e41 100644
--- a/src/core/hle/service/ir_u.cpp
+++ b/src/core/hle/service/ir_u.cpp
@@ -1,5 +1,5 @@
1// Copyright 2014 Citra Emulator Project 1// Copyright 2014 Citra Emulator Project
2// Licensed under GPLv2 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 "common/log.h" 5#include "common/log.h"
@@ -39,7 +39,4 @@ Interface::Interface() {
39 Register(FunctionTable, ARRAY_SIZE(FunctionTable)); 39 Register(FunctionTable, ARRAY_SIZE(FunctionTable));
40} 40}
41 41
42Interface::~Interface() {
43}
44
45} // namespace 42} // namespace
diff --git a/src/core/hle/service/ir_u.h b/src/core/hle/service/ir_u.h
index 86d98d079..ec47a1524 100644
--- a/src/core/hle/service/ir_u.h
+++ b/src/core/hle/service/ir_u.h
@@ -1,5 +1,5 @@
1// Copyright 2014 Citra Emulator Project 1// Copyright 2014 Citra Emulator Project
2// Licensed under GPLv2 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#pragma once 5#pragma once
@@ -14,11 +14,7 @@ namespace IR_U {
14class Interface : public Service::Interface { 14class Interface : public Service::Interface {
15public: 15public:
16 Interface(); 16 Interface();
17 ~Interface(); 17
18 /**
19 * Gets the string port name used by CTROS for the service
20 * @return Port name of service
21 */
22 std::string GetPortName() const override { 18 std::string GetPortName() const override {
23 return "ir:u"; 19 return "ir:u";
24 } 20 }
diff --git a/src/core/hle/service/ldr_ro.cpp b/src/core/hle/service/ldr_ro.cpp
index 91b1a6fc5..9c9e90a40 100644
--- a/src/core/hle/service/ldr_ro.cpp
+++ b/src/core/hle/service/ldr_ro.cpp
@@ -1,5 +1,5 @@
1// Copyright 2014 Citra Emulator Project 1// Copyright 2014 Citra Emulator Project
2// Licensed under GPLv2+ 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 "common/log.h" 5#include "common/log.h"
@@ -18,6 +18,7 @@ const Interface::FunctionInfo FunctionTable[] = {
18 {0x000402C2, nullptr, "CRO_LoadAndFix"}, 18 {0x000402C2, nullptr, "CRO_LoadAndFix"},
19 {0x000500C2, nullptr, "CRO_ApplyRelocationPatchesAndLink"} 19 {0x000500C2, nullptr, "CRO_ApplyRelocationPatchesAndLink"}
20}; 20};
21
21//////////////////////////////////////////////////////////////////////////////////////////////////// 22////////////////////////////////////////////////////////////////////////////////////////////////////
22// Interface class 23// Interface class
23 24
diff --git a/src/core/hle/service/ldr_ro.h b/src/core/hle/service/ldr_ro.h
index 32d7c29cf..331637cde 100644
--- a/src/core/hle/service/ldr_ro.h
+++ b/src/core/hle/service/ldr_ro.h
@@ -1,5 +1,5 @@
1// Copyright 2014 Citra Emulator Project 1// Copyright 2014 Citra Emulator Project
2// Licensed under GPLv2+ 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#pragma once 5#pragma once
@@ -15,10 +15,6 @@ class Interface : public Service::Interface {
15public: 15public:
16 Interface(); 16 Interface();
17 17
18 /**
19 * Gets the string port name used by CTROS for the service
20 * @return Port name of service
21 */
22 std::string GetPortName() const override { 18 std::string GetPortName() const override {
23 return "ldr:ro"; 19 return "ldr:ro";
24 } 20 }
diff --git a/src/core/hle/service/mic_u.cpp b/src/core/hle/service/mic_u.cpp
index d6f30e9ae..82bce9180 100644
--- a/src/core/hle/service/mic_u.cpp
+++ b/src/core/hle/service/mic_u.cpp
@@ -1,5 +1,5 @@
1// Copyright 2014 Citra Emulator Project 1// Copyright 2014 Citra Emulator Project
2// Licensed under GPLv2 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 "common/log.h" 5#include "common/log.h"
@@ -37,7 +37,4 @@ Interface::Interface() {
37 Register(FunctionTable, ARRAY_SIZE(FunctionTable)); 37 Register(FunctionTable, ARRAY_SIZE(FunctionTable));
38} 38}
39 39
40Interface::~Interface() {
41}
42
43} // namespace 40} // namespace
diff --git a/src/core/hle/service/mic_u.h b/src/core/hle/service/mic_u.h
index 2a495f3a9..dc795d14c 100644
--- a/src/core/hle/service/mic_u.h
+++ b/src/core/hle/service/mic_u.h
@@ -1,5 +1,5 @@
1// Copyright 2014 Citra Emulator Project 1// Copyright 2014 Citra Emulator Project
2// Licensed under GPLv2 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#pragma once 5#pragma once
@@ -16,11 +16,7 @@ namespace MIC_U {
16class Interface : public Service::Interface { 16class Interface : public Service::Interface {
17public: 17public:
18 Interface(); 18 Interface();
19 ~Interface(); 19
20 /**
21 * Gets the string port name used by CTROS for the service
22 * @return Port name of service
23 */
24 std::string GetPortName() const override { 20 std::string GetPortName() const override {
25 return "mic:u"; 21 return "mic:u";
26 } 22 }
diff --git a/src/core/hle/service/ndm_u.cpp b/src/core/hle/service/ndm_u.cpp
index 37c0661bf..233b14f6d 100644
--- a/src/core/hle/service/ndm_u.cpp
+++ b/src/core/hle/service/ndm_u.cpp
@@ -1,5 +1,5 @@
1// Copyright 2014 Citra Emulator Project 1// Copyright 2014 Citra Emulator Project
2// Licensed under GPLv2 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/hle.h" 5#include "core/hle/hle.h"
@@ -24,7 +24,4 @@ Interface::Interface() {
24 Register(FunctionTable, ARRAY_SIZE(FunctionTable)); 24 Register(FunctionTable, ARRAY_SIZE(FunctionTable));
25} 25}
26 26
27Interface::~Interface() {
28}
29
30} // namespace 27} // namespace
diff --git a/src/core/hle/service/ndm_u.h b/src/core/hle/service/ndm_u.h
index 2ca9fcf22..51c4b3902 100644
--- a/src/core/hle/service/ndm_u.h
+++ b/src/core/hle/service/ndm_u.h
@@ -1,5 +1,5 @@
1// Copyright 2014 Citra Emulator Project 1// Copyright 2014 Citra Emulator Project
2// Licensed under GPLv2 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#pragma once 5#pragma once
@@ -15,19 +15,11 @@ namespace NDM_U {
15 15
16class Interface : public Service::Interface { 16class Interface : public Service::Interface {
17public: 17public:
18
19 Interface(); 18 Interface();
20 19
21 ~Interface();
22
23 /**
24 * Gets the string port name used by CTROS for the service
25 * @return Port name of service
26 */
27 std::string GetPortName() const override { 20 std::string GetPortName() const override {
28 return "ndm:u"; 21 return "ndm:u";
29 } 22 }
30
31}; 23};
32 24
33} // namespace 25} // namespace
diff --git a/src/core/hle/service/news_u.cpp b/src/core/hle/service/news_u.cpp
new file mode 100644
index 000000000..b5adad4c6
--- /dev/null
+++ b/src/core/hle/service/news_u.cpp
@@ -0,0 +1,25 @@
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/service/news_u.h"
8
9////////////////////////////////////////////////////////////////////////////////////////////////////
10// Namespace NEWS_U
11
12namespace NEWS_U {
13
14const Interface::FunctionInfo FunctionTable[] = {
15 {0x000100C8, nullptr, "AddNotification"},
16};
17
18////////////////////////////////////////////////////////////////////////////////////////////////////
19// Interface class
20
21Interface::Interface() {
22 Register(FunctionTable, ARRAY_SIZE(FunctionTable));
23}
24
25} // namespace
diff --git a/src/core/hle/service/news_u.h b/src/core/hle/service/news_u.h
new file mode 100644
index 000000000..0473cd19c
--- /dev/null
+++ b/src/core/hle/service/news_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 NEWS_U
11
12namespace NEWS_U {
13
14class Interface : public Service::Interface {
15public:
16 Interface();
17
18 std::string GetPortName() const override {
19 return "news:u";
20 }
21};
22
23} // namespace
diff --git a/src/core/hle/service/nim_aoc.cpp b/src/core/hle/service/nim_aoc.cpp
index 04c1e0cf3..17d1c4ff5 100644
--- a/src/core/hle/service/nim_aoc.cpp
+++ b/src/core/hle/service/nim_aoc.cpp
@@ -1,5 +1,5 @@
1// Copyright 2014 Citra Emulator Project 1// Copyright 2014 Citra Emulator Project
2// Licensed under GPLv2+ 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 "common/log.h" 5#include "common/log.h"
diff --git a/src/core/hle/service/nim_aoc.h b/src/core/hle/service/nim_aoc.h
index 2cc673118..aeb71eed2 100644
--- a/src/core/hle/service/nim_aoc.h
+++ b/src/core/hle/service/nim_aoc.h
@@ -1,5 +1,5 @@
1// Copyright 2014 Citra Emulator Project 1// Copyright 2014 Citra Emulator Project
2// Licensed under GPLv2+ 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#pragma once 5#pragma once
@@ -15,10 +15,6 @@ class Interface : public Service::Interface {
15public: 15public:
16 Interface(); 16 Interface();
17 17
18 /**
19 * Gets the string port name used by CTROS for the service
20 * @return Port name of service
21 */
22 std::string GetPortName() const override { 18 std::string GetPortName() const override {
23 return "nim:aoc"; 19 return "nim:aoc";
24 } 20 }
diff --git a/src/core/hle/service/nwm_uds.cpp b/src/core/hle/service/nwm_uds.cpp
index 14df86d85..ce456a966 100644
--- a/src/core/hle/service/nwm_uds.cpp
+++ b/src/core/hle/service/nwm_uds.cpp
@@ -1,5 +1,5 @@
1// Copyright 2014 Citra Emulator Project 1// Copyright 2014 Citra Emulator Project
2// Licensed under GPLv2 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 "common/log.h" 5#include "common/log.h"
@@ -29,7 +29,4 @@ Interface::Interface() {
29 Register(FunctionTable, ARRAY_SIZE(FunctionTable)); 29 Register(FunctionTable, ARRAY_SIZE(FunctionTable));
30} 30}
31 31
32Interface::~Interface() {
33}
34
35} // namespace 32} // namespace
diff --git a/src/core/hle/service/nwm_uds.h b/src/core/hle/service/nwm_uds.h
index 69d2c2002..9043f5aa7 100644
--- a/src/core/hle/service/nwm_uds.h
+++ b/src/core/hle/service/nwm_uds.h
@@ -1,5 +1,5 @@
1// Copyright 2014 Citra Emulator Project 1// Copyright 2014 Citra Emulator Project
2// Licensed under GPLv2 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#pragma once 5#pragma once
@@ -16,11 +16,7 @@ namespace NWM_UDS {
16class Interface : public Service::Interface { 16class Interface : public Service::Interface {
17public: 17public:
18 Interface(); 18 Interface();
19 ~Interface(); 19
20 /**
21 * Gets the string port name used by CTROS for the service
22 * @return Port name of service
23 */
24 std::string GetPortName() const override { 20 std::string GetPortName() const override {
25 return "nwm:UDS"; 21 return "nwm:UDS";
26 } 22 }
diff --git a/src/core/hle/service/pm_app.cpp b/src/core/hle/service/pm_app.cpp
index 90e9b1bfa..529dccafb 100644
--- a/src/core/hle/service/pm_app.cpp
+++ b/src/core/hle/service/pm_app.cpp
@@ -1,5 +1,5 @@
1// Copyright 2014 Citra Emulator Project 1// Copyright 2014 Citra Emulator Project
2// Licensed under GPLv2 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 "common/log.h" 5#include "common/log.h"
@@ -29,7 +29,4 @@ Interface::Interface() {
29 Register(FunctionTable, ARRAY_SIZE(FunctionTable)); 29 Register(FunctionTable, ARRAY_SIZE(FunctionTable));
30} 30}
31 31
32Interface::~Interface() {
33}
34
35} // namespace 32} // namespace
diff --git a/src/core/hle/service/pm_app.h b/src/core/hle/service/pm_app.h
index 28c38f582..c1fb1f9da 100644
--- a/src/core/hle/service/pm_app.h
+++ b/src/core/hle/service/pm_app.h
@@ -1,5 +1,5 @@
1// Copyright 2014 Citra Emulator Project 1// Copyright 2014 Citra Emulator Project
2// Licensed under GPLv2 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#pragma once 5#pragma once
@@ -14,11 +14,7 @@ namespace PM_APP {
14class Interface : public Service::Interface { 14class Interface : public Service::Interface {
15public: 15public:
16 Interface(); 16 Interface();
17 ~Interface(); 17
18 /**
19 * Gets the string port name used by CTROS for the service
20 * @return Port name of service
21 */
22 std::string GetPortName() const override { 18 std::string GetPortName() const override {
23 return "pm:app"; 19 return "pm:app";
24 } 20 }
diff --git a/src/core/hle/service/ptm_u.cpp b/src/core/hle/service/ptm_u.cpp
index b8c0f6da8..d1498f05c 100644
--- a/src/core/hle/service/ptm_u.cpp
+++ b/src/core/hle/service/ptm_u.cpp
@@ -1,5 +1,5 @@
1// Copyright 2014 Citra Emulator Project 1// Copyright 2014 Citra Emulator Project
2// Licensed under GPLv2 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 "common/log.h" 5#include "common/log.h"
@@ -122,7 +122,4 @@ Interface::Interface() {
122 Register(FunctionTable, ARRAY_SIZE(FunctionTable)); 122 Register(FunctionTable, ARRAY_SIZE(FunctionTable));
123} 123}
124 124
125Interface::~Interface() {
126}
127
128} // namespace 125} // namespace
diff --git a/src/core/hle/service/ptm_u.h b/src/core/hle/service/ptm_u.h
index f8d9f57be..a44624fd5 100644
--- a/src/core/hle/service/ptm_u.h
+++ b/src/core/hle/service/ptm_u.h
@@ -1,5 +1,5 @@
1// Copyright 2014 Citra Emulator Project 1// Copyright 2014 Citra Emulator Project
2// Licensed under GPLv2 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#pragma once 5#pragma once
@@ -16,11 +16,7 @@ namespace PTM_U {
16class Interface : public Service::Interface { 16class Interface : public Service::Interface {
17public: 17public:
18 Interface(); 18 Interface();
19 ~Interface(); 19
20 /**
21 * Gets the string port name used by CTROS for the service
22 * @return Port name of service
23 */
24 std::string GetPortName() const override { 20 std::string GetPortName() const override {
25 return "ptm:u"; 21 return "ptm:u";
26 } 22 }
diff --git a/src/core/hle/service/service.cpp b/src/core/hle/service/service.cpp
index 2230045e3..44e4fbcb2 100644
--- a/src/core/hle/service/service.cpp
+++ b/src/core/hle/service/service.cpp
@@ -1,5 +1,5 @@
1// Copyright 2014 Citra Emulator Project 1// Copyright 2014 Citra Emulator Project
2// Licensed under GPLv2 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 "common/common.h" 5#include "common/common.h"
@@ -7,13 +7,15 @@
7 7
8#include "core/hle/service/service.h" 8#include "core/hle/service/service.h"
9#include "core/hle/service/ac_u.h" 9#include "core/hle/service/ac_u.h"
10#include "core/hle/service/act_u.h"
10#include "core/hle/service/am_app.h" 11#include "core/hle/service/am_app.h"
11#include "core/hle/service/am_net.h" 12#include "core/hle/service/am_net.h"
13#include "core/hle/service/apt_a.h"
12#include "core/hle/service/apt_u.h" 14#include "core/hle/service/apt_u.h"
13#include "core/hle/service/boss_u.h" 15#include "core/hle/service/boss_u.h"
14#include "core/hle/service/cecd_u.h" 16#include "core/hle/service/cecd_u.h"
15#include "core/hle/service/cfg_i.h" 17#include "core/hle/service/cfg/cfg_i.h"
16#include "core/hle/service/cfg_u.h" 18#include "core/hle/service/cfg/cfg_u.h"
17#include "core/hle/service/csnd_snd.h" 19#include "core/hle/service/csnd_snd.h"
18#include "core/hle/service/dsp_dsp.h" 20#include "core/hle/service/dsp_dsp.h"
19#include "core/hle/service/err_f.h" 21#include "core/hle/service/err_f.h"
@@ -21,12 +23,14 @@
21#include "core/hle/service/frd_u.h" 23#include "core/hle/service/frd_u.h"
22#include "core/hle/service/gsp_gpu.h" 24#include "core/hle/service/gsp_gpu.h"
23#include "core/hle/service/hid_user.h" 25#include "core/hle/service/hid_user.h"
26#include "core/hle/service/http_c.h"
24#include "core/hle/service/ir_rst.h" 27#include "core/hle/service/ir_rst.h"
25#include "core/hle/service/ir_u.h" 28#include "core/hle/service/ir_u.h"
26#include "core/hle/service/ldr_ro.h" 29#include "core/hle/service/ldr_ro.h"
27#include "core/hle/service/mic_u.h" 30#include "core/hle/service/mic_u.h"
28#include "core/hle/service/nim_aoc.h"
29#include "core/hle/service/ndm_u.h" 31#include "core/hle/service/ndm_u.h"
32#include "core/hle/service/news_u.h"
33#include "core/hle/service/nim_aoc.h"
30#include "core/hle/service/nwm_uds.h" 34#include "core/hle/service/nwm_uds.h"
31#include "core/hle/service/pm_app.h" 35#include "core/hle/service/pm_app.h"
32#include "core/hle/service/ptm_u.h" 36#include "core/hle/service/ptm_u.h"
@@ -88,8 +92,10 @@ void Init() {
88 92
89 g_manager->AddService(new SRV::Interface); 93 g_manager->AddService(new SRV::Interface);
90 g_manager->AddService(new AC_U::Interface); 94 g_manager->AddService(new AC_U::Interface);
95 g_manager->AddService(new ACT_U::Interface);
91 g_manager->AddService(new AM_APP::Interface); 96 g_manager->AddService(new AM_APP::Interface);
92 g_manager->AddService(new AM_NET::Interface); 97 g_manager->AddService(new AM_NET::Interface);
98 g_manager->AddService(new APT_A::Interface);
93 g_manager->AddService(new APT_U::Interface); 99 g_manager->AddService(new APT_U::Interface);
94 g_manager->AddService(new BOSS_U::Interface); 100 g_manager->AddService(new BOSS_U::Interface);
95 g_manager->AddService(new CECD_U::Interface); 101 g_manager->AddService(new CECD_U::Interface);
@@ -102,12 +108,14 @@ void Init() {
102 g_manager->AddService(new FS::FSUserInterface); 108 g_manager->AddService(new FS::FSUserInterface);
103 g_manager->AddService(new GSP_GPU::Interface); 109 g_manager->AddService(new GSP_GPU::Interface);
104 g_manager->AddService(new HID_User::Interface); 110 g_manager->AddService(new HID_User::Interface);
111 g_manager->AddService(new HTTP_C::Interface);
105 g_manager->AddService(new IR_RST::Interface); 112 g_manager->AddService(new IR_RST::Interface);
106 g_manager->AddService(new IR_U::Interface); 113 g_manager->AddService(new IR_U::Interface);
107 g_manager->AddService(new LDR_RO::Interface); 114 g_manager->AddService(new LDR_RO::Interface);
108 g_manager->AddService(new MIC_U::Interface); 115 g_manager->AddService(new MIC_U::Interface);
109 g_manager->AddService(new NIM_AOC::Interface);
110 g_manager->AddService(new NDM_U::Interface); 116 g_manager->AddService(new NDM_U::Interface);
117 g_manager->AddService(new NEWS_U::Interface);
118 g_manager->AddService(new NIM_AOC::Interface);
111 g_manager->AddService(new NWM_UDS::Interface); 119 g_manager->AddService(new NWM_UDS::Interface);
112 g_manager->AddService(new PM_APP::Interface); 120 g_manager->AddService(new PM_APP::Interface);
113 g_manager->AddService(new PTM_U::Interface); 121 g_manager->AddService(new PTM_U::Interface);
diff --git a/src/core/hle/service/service.h b/src/core/hle/service/service.h
index 9cd906150..0616822fa 100644
--- a/src/core/hle/service/service.h
+++ b/src/core/hle/service/service.h
@@ -1,5 +1,5 @@
1// Copyright 2014 Citra Emulator Project 1// Copyright 2014 Citra Emulator Project
2// Licensed under GPLv2 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#pragma once 5#pragma once
diff --git a/src/core/hle/service/soc_u.cpp b/src/core/hle/service/soc_u.cpp
index 2f8910468..ef4f9829d 100644
--- a/src/core/hle/service/soc_u.cpp
+++ b/src/core/hle/service/soc_u.cpp
@@ -1,5 +1,5 @@
1// Copyright 2014 Citra Emulator Project 1// Copyright 2014 Citra Emulator Project
2// Licensed under GPLv2 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 "common/log.h" 5#include "common/log.h"
@@ -52,7 +52,4 @@ Interface::Interface() {
52 Register(FunctionTable, ARRAY_SIZE(FunctionTable)); 52 Register(FunctionTable, ARRAY_SIZE(FunctionTable));
53} 53}
54 54
55Interface::~Interface() {
56}
57
58} // namespace 55} // namespace
diff --git a/src/core/hle/service/soc_u.h b/src/core/hle/service/soc_u.h
index d5590a683..2edf3b482 100644
--- a/src/core/hle/service/soc_u.h
+++ b/src/core/hle/service/soc_u.h
@@ -1,5 +1,5 @@
1// Copyright 2014 Citra Emulator Project 1// Copyright 2014 Citra Emulator Project
2// Licensed under GPLv2 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#pragma once 5#pragma once
@@ -14,11 +14,7 @@ namespace SOC_U {
14class Interface : public Service::Interface { 14class Interface : public Service::Interface {
15public: 15public:
16 Interface(); 16 Interface();
17 ~Interface(); 17
18 /**
19 * Gets the string port name used by CTROS for the service
20 * @return Port name of service
21 */
22 std::string GetPortName() const override { 18 std::string GetPortName() const override {
23 return "soc:U"; 19 return "soc:U";
24 } 20 }
diff --git a/src/core/hle/service/srv.cpp b/src/core/hle/service/srv.cpp
index 165fd7aac..25fab1a4f 100644
--- a/src/core/hle/service/srv.cpp
+++ b/src/core/hle/service/srv.cpp
@@ -1,5 +1,5 @@
1// Copyright 2014 Citra Emulator Project 1// Copyright 2014 Citra Emulator Project
2// Licensed under GPLv2 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/hle.h" 5#include "core/hle/hle.h"
@@ -68,7 +68,4 @@ Interface::Interface() {
68 Register(FunctionTable, ARRAY_SIZE(FunctionTable)); 68 Register(FunctionTable, ARRAY_SIZE(FunctionTable));
69} 69}
70 70
71Interface::~Interface() {
72}
73
74} // namespace 71} // namespace
diff --git a/src/core/hle/service/srv.h b/src/core/hle/service/srv.h
index 6d5fe5048..653aba5cb 100644
--- a/src/core/hle/service/srv.h
+++ b/src/core/hle/service/srv.h
@@ -1,5 +1,5 @@
1// Copyright 2014 Citra Emulator Project 1// Copyright 2014 Citra Emulator Project
2// Licensed under GPLv2 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/service.h" 5#include "core/hle/service/service.h"
@@ -11,21 +11,12 @@ namespace SRV {
11 11
12/// Interface to "srv:" service 12/// Interface to "srv:" service
13class Interface : public Service::Interface { 13class Interface : public Service::Interface {
14
15public: 14public:
16
17 Interface(); 15 Interface();
18 16
19 ~Interface();
20
21 /**
22 * Gets the string name used by CTROS for the service
23 * @return Port name of service
24 */
25 std::string GetPortName() const override { 17 std::string GetPortName() const override {
26 return "srv:"; 18 return "srv:";
27 } 19 }
28
29}; 20};
30 21
31} // namespace 22} // namespace
diff --git a/src/core/hle/service/ssl_c.cpp b/src/core/hle/service/ssl_c.cpp
index 4aa660ecc..360516cdf 100644
--- a/src/core/hle/service/ssl_c.cpp
+++ b/src/core/hle/service/ssl_c.cpp
@@ -1,5 +1,5 @@
1// Copyright 2014 Citra Emulator Project 1// Copyright 2014 Citra Emulator Project
2// Licensed under GPLv2 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 "common/log.h" 5#include "common/log.h"
@@ -25,7 +25,4 @@ Interface::Interface() {
25 Register(FunctionTable, ARRAY_SIZE(FunctionTable)); 25 Register(FunctionTable, ARRAY_SIZE(FunctionTable));
26} 26}
27 27
28Interface::~Interface() {
29}
30
31} // namespace 28} // namespace
diff --git a/src/core/hle/service/ssl_c.h b/src/core/hle/service/ssl_c.h
index 7b4e7fd8a..58e87c1cb 100644
--- a/src/core/hle/service/ssl_c.h
+++ b/src/core/hle/service/ssl_c.h
@@ -1,5 +1,5 @@
1// Copyright 2014 Citra Emulator Project 1// Copyright 2014 Citra Emulator Project
2// Licensed under GPLv2 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#pragma once 5#pragma once
@@ -14,12 +14,8 @@ namespace SSL_C {
14class Interface : public Service::Interface { 14class Interface : public Service::Interface {
15public: 15public:
16 Interface(); 16 Interface();
17 ~Interface(); 17
18 /** 18 std::string GetPortName() const override {
19 * Gets the string port name used by CTROS for the service
20 * @return Port name of service
21 */
22 std::string GetPortName() const {
23 return "ssl:C"; 19 return "ssl:C";
24 } 20 }
25}; 21};
diff --git a/src/core/hle/svc.cpp b/src/core/hle/svc.cpp
index 70ef7839c..c98168e51 100644
--- a/src/core/hle/svc.cpp
+++ b/src/core/hle/svc.cpp
@@ -1,5 +1,5 @@
1// Copyright 2014 Citra Emulator Project 1// Copyright 2014 Citra Emulator Project
2// Licensed under GPLv2 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 <map> 5#include <map>
diff --git a/src/core/hle/svc.h b/src/core/hle/svc.h
index 6be393d0b..ad780818e 100644
--- a/src/core/hle/svc.h
+++ b/src/core/hle/svc.h
@@ -1,5 +1,5 @@
1// Copyright 2014 Citra Emulator Project 1// Copyright 2014 Citra Emulator Project
2// Licensed under GPLv2 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#pragma once 5#pragma once
diff --git a/src/core/hw/gpu.cpp b/src/core/hw/gpu.cpp
index da78b85e5..7e70b34c1 100644
--- a/src/core/hw/gpu.cpp
+++ b/src/core/hw/gpu.cpp
@@ -1,5 +1,5 @@
1// Copyright 2014 Citra Emulator Project 1// Copyright 2014 Citra Emulator Project
2// Licensed under GPLv2 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 "common/common_types.h" 5#include "common/common_types.h"
@@ -21,12 +21,10 @@ namespace GPU {
21 21
22Regs g_regs; 22Regs g_regs;
23 23
24u32 g_cur_line = 0; ///< Current vertical screen line 24static u64 frame_ticks = 0; ///< 268MHz / 60 frames per second
25u64 g_last_line_ticks = 0; ///< CPU tick count from last vertical screen line 25static u32 cur_line = 0; ///< Current vertical screen line
26u64 g_last_frame_ticks = 0; ///< CPU tick count from last frame 26static u64 last_frame_ticks = 0; ///< CPU tick count from last frame
27 27static u64 last_update_tick = 0; ///< CPU ticl count from last GPU update
28static u32 kFrameCycles = 0; ///< 268MHz / 60 frames per second
29static u32 kFrameTicks = 0; ///< Approximate number of instructions/frame
30 28
31template <typename T> 29template <typename T>
32inline void Read(T &var, const u32 raw_addr) { 30inline void Read(T &var, const u32 raw_addr) {
@@ -34,7 +32,7 @@ inline void Read(T &var, const u32 raw_addr) {
34 u32 index = addr / 4; 32 u32 index = addr / 4;
35 33
36 // Reads other than u32 are untested, so I'd rather have them abort than silently fail 34 // Reads other than u32 are untested, so I'd rather have them abort than silently fail
37 if (index >= Regs::NumIds() || !std::is_same<T,u32>::value) { 35 if (index >= Regs::NumIds() || !std::is_same<T, u32>::value) {
38 LOG_ERROR(HW_GPU, "unknown Read%lu @ 0x%08X", sizeof(var) * 8, addr); 36 LOG_ERROR(HW_GPU, "unknown Read%lu @ 0x%08X", sizeof(var) * 8, addr);
39 return; 37 return;
40 } 38 }
@@ -48,7 +46,7 @@ inline void Write(u32 addr, const T data) {
48 u32 index = addr / 4; 46 u32 index = addr / 4;
49 47
50 // Writes other than u32 are untested, so I'd rather have them abort than silently fail 48 // Writes other than u32 are untested, so I'd rather have them abort than silently fail
51 if (index >= Regs::NumIds() || !std::is_same<T,u32>::value) { 49 if (index >= Regs::NumIds() || !std::is_same<T, u32>::value) {
52 LOG_ERROR(HW_GPU, "unknown Write%lu 0x%08X @ 0x%08X", sizeof(data) * 8, (u32)data, addr); 50 LOG_ERROR(HW_GPU, "unknown Write%lu 0x%08X @ 0x%08X", sizeof(data) * 8, (u32)data, addr);
53 return; 51 return;
54 } 52 }
@@ -179,7 +177,6 @@ template void Write<u8>(u32 addr, const u8 data);
179/// Update hardware 177/// Update hardware
180void Update() { 178void Update() {
181 auto& framebuffer_top = g_regs.framebuffer_config[0]; 179 auto& framebuffer_top = g_regs.framebuffer_config[0];
182 u64 current_ticks = Core::g_app_core->GetTicks();
183 180
184 // Update the frame after a certain number of CPU ticks have elapsed. This assumes that the 181 // Update the frame after a certain number of CPU ticks have elapsed. This assumes that the
185 // active frame in memory is always complete to render. There also may be issues with this 182 // active frame in memory is always complete to render. There also may be issues with this
@@ -189,9 +186,9 @@ void Update() {
189 // primitive homebrew relies on a vertical blank interrupt to happen inevitably (regardless of a 186 // primitive homebrew relies on a vertical blank interrupt to happen inevitably (regardless of a
190 // threading reschedule). 187 // threading reschedule).
191 188
192 if ((current_ticks - g_last_frame_ticks) > GPU::kFrameTicks) { 189 if ((Core::g_app_core->GetTicks() - last_frame_ticks) > (GPU::frame_ticks)) {
193 VideoCore::g_renderer->SwapBuffers(); 190 VideoCore::g_renderer->SwapBuffers();
194 g_last_frame_ticks = current_ticks; 191 last_frame_ticks = Core::g_app_core->GetTicks();
195 } 192 }
196 193
197 // Synchronize GPU on a thread reschedule: Because we cannot accurately predict a vertical 194 // Synchronize GPU on a thread reschedule: Because we cannot accurately predict a vertical
@@ -199,17 +196,20 @@ void Update() {
199 // accurately when this is signalled between thread switches. 196 // accurately when this is signalled between thread switches.
200 197
201 if (HLE::g_reschedule) { 198 if (HLE::g_reschedule) {
199 u64 current_ticks = Core::g_app_core->GetTicks();
200 u64 line_ticks = (GPU::frame_ticks / framebuffer_top.height) * 16;
202 201
203 // Synchronize line... 202 //// Synchronize line...
204 if ((current_ticks - g_last_line_ticks) >= GPU::kFrameTicks / framebuffer_top.height) { 203 if ((current_ticks - last_update_tick) >= line_ticks) {
205 GSP_GPU::SignalInterrupt(GSP_GPU::InterruptId::PDC0); 204 GSP_GPU::SignalInterrupt(GSP_GPU::InterruptId::PDC0);
206 g_cur_line++; 205 cur_line++;
207 g_last_line_ticks = current_ticks; 206 last_update_tick += line_ticks;
208 } 207 }
209 208
210 // Synchronize frame... 209 // Synchronize frame...
211 if (g_cur_line >= framebuffer_top.height) { 210 if (cur_line >= framebuffer_top.height) {
212 g_cur_line = 0; 211 cur_line = 0;
212 VideoCore::g_renderer->SwapBuffers();
213 GSP_GPU::SignalInterrupt(GSP_GPU::InterruptId::PDC1); 213 GSP_GPU::SignalInterrupt(GSP_GPU::InterruptId::PDC1);
214 } 214 }
215 } 215 }
@@ -217,11 +217,9 @@ void Update() {
217 217
218/// Initialize hardware 218/// Initialize hardware
219void Init() { 219void Init() {
220 kFrameCycles = 268123480 / Settings::values.gpu_refresh_rate; 220 frame_ticks = 268123480 / Settings::values.gpu_refresh_rate;
221 kFrameTicks = kFrameCycles / 3; 221 cur_line = 0;
222 222 last_update_tick = last_frame_ticks = Core::g_app_core->GetTicks();
223 g_cur_line = 0;
224 g_last_frame_ticks = g_last_line_ticks = Core::g_app_core->GetTicks();
225 223
226 auto& framebuffer_top = g_regs.framebuffer_config[0]; 224 auto& framebuffer_top = g_regs.framebuffer_config[0];
227 auto& framebuffer_sub = g_regs.framebuffer_config[1]; 225 auto& framebuffer_sub = g_regs.framebuffer_config[1];
diff --git a/src/core/hw/gpu.h b/src/core/hw/gpu.h
index 86cd5e680..68f11bfcb 100644
--- a/src/core/hw/gpu.h
+++ b/src/core/hw/gpu.h
@@ -1,5 +1,5 @@
1// Copyright 2014 Citra Emulator Project 1// Copyright 2014 Citra Emulator Project
2// Licensed under GPLv2 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#pragma once 5#pragma once
diff --git a/src/core/hw/hw.cpp b/src/core/hw/hw.cpp
index af42b41fb..848ab5348 100644
--- a/src/core/hw/hw.cpp
+++ b/src/core/hw/hw.cpp
@@ -1,5 +1,5 @@
1// Copyright 2014 Citra Emulator Project 1// Copyright 2014 Citra Emulator Project
2// Licensed under GPLv2 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 "common/common_types.h" 5#include "common/common_types.h"
diff --git a/src/core/hw/hw.h b/src/core/hw/hw.h
index 1055ed94f..991c0a07d 100644
--- a/src/core/hw/hw.h
+++ b/src/core/hw/hw.h
@@ -1,5 +1,5 @@
1// Copyright 2014 Citra Emulator Project 1// Copyright 2014 Citra Emulator Project
2// Licensed under GPLv2 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#pragma once 5#pragma once
diff --git a/src/core/loader/3dsx.cpp b/src/core/loader/3dsx.cpp
index 3d84fc5da..4d072871a 100644
--- a/src/core/loader/3dsx.cpp
+++ b/src/core/loader/3dsx.cpp
@@ -1,5 +1,5 @@
1// Copyright 2014 Citra Emulator Project 1// Copyright 2014 Citra Emulator Project
2// Licensed under GPLv2+ 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 <algorithm> 5#include <algorithm>
diff --git a/src/core/loader/3dsx.h b/src/core/loader/3dsx.h
index 848d3ef8a..da8836662 100644
--- a/src/core/loader/3dsx.h
+++ b/src/core/loader/3dsx.h
@@ -1,5 +1,5 @@
1// Copyright 2014 Dolphin Emulator Project / Citra Emulator Project 1// Copyright 2014 Dolphin Emulator Project / Citra Emulator Project
2// Licensed under GPLv2+ 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#pragma once 5#pragma once
diff --git a/src/core/loader/elf.cpp b/src/core/loader/elf.cpp
index c95882f4a..354335014 100644
--- a/src/core/loader/elf.cpp
+++ b/src/core/loader/elf.cpp
@@ -1,5 +1,5 @@
1// Copyright 2013 Dolphin Emulator Project 1// Copyright 2013 Dolphin Emulator Project / 2014 Citra Emulator Project
2// Licensed under GPLv2 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 <string> 5#include <string>
diff --git a/src/core/loader/elf.h b/src/core/loader/elf.h
index 5ae88439a..c221cce6d 100644
--- a/src/core/loader/elf.h
+++ b/src/core/loader/elf.h
@@ -1,5 +1,5 @@
1// Copyright 2013 Dolphin Emulator Project / Citra Emulator Project 1// Copyright 2013 Dolphin Emulator Project / 2014 Citra Emulator Project
2// Licensed under GPLv2 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#pragma once 5#pragma once
diff --git a/src/core/loader/loader.cpp b/src/core/loader/loader.cpp
index b3b58da72..87580cb2a 100644
--- a/src/core/loader/loader.cpp
+++ b/src/core/loader/loader.cpp
@@ -1,5 +1,5 @@
1// Copyright 2014 Citra Emulator Project 1// Copyright 2014 Citra Emulator Project
2// Licensed under GPLv2 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 <string> 5#include <string>
diff --git a/src/core/loader/loader.h b/src/core/loader/loader.h
index 0f836d285..ec5534d41 100644
--- a/src/core/loader/loader.h
+++ b/src/core/loader/loader.h
@@ -1,5 +1,5 @@
1// Copyright 2014 Citra Emulator Project 1// Copyright 2014 Citra Emulator Project
2// Licensed under GPLv2 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#pragma once 5#pragma once
diff --git a/src/core/loader/ncch.cpp b/src/core/loader/ncch.cpp
index 4d23656ec..0dc21699e 100644
--- a/src/core/loader/ncch.cpp
+++ b/src/core/loader/ncch.cpp
@@ -1,5 +1,5 @@
1// Copyright 2014 Citra Emulator Project 1// Copyright 2014 Citra Emulator Project
2// Licensed under GPLv2 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 <memory> 5#include <memory>
diff --git a/src/core/loader/ncch.h b/src/core/loader/ncch.h
index 2fe2a7d82..fd9258970 100644
--- a/src/core/loader/ncch.h
+++ b/src/core/loader/ncch.h
@@ -1,5 +1,5 @@
1// Copyright 2014 Citra Emulator Project 1// Copyright 2014 Citra Emulator Project
2// Licensed under GPLv2 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#pragma once 5#pragma once
diff --git a/src/core/mem_map.cpp b/src/core/mem_map.cpp
index d1c44ed24..eea6c5bf1 100644
--- a/src/core/mem_map.cpp
+++ b/src/core/mem_map.cpp
@@ -1,5 +1,5 @@
1 // Copyright 2014 Citra Emulator Project 1// Copyright 2014 Citra Emulator Project
2// Licensed under GPLv2 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 "common/common.h" 5#include "common/common.h"
diff --git a/src/core/mem_map.h b/src/core/mem_map.h
index 7b750f848..e63e81a4b 100644
--- a/src/core/mem_map.h
+++ b/src/core/mem_map.h
@@ -1,5 +1,5 @@
1// Copyright 2014 Citra Emulator Project 1// Copyright 2014 Citra Emulator Project
2// Licensed under GPLv2 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#pragma once 5#pragma once
diff --git a/src/core/mem_map_funcs.cpp b/src/core/mem_map_funcs.cpp
index 7f7e77233..0f378eaee 100644
--- a/src/core/mem_map_funcs.cpp
+++ b/src/core/mem_map_funcs.cpp
@@ -1,5 +1,5 @@
1// Copyright 2014 Citra Emulator Project 1// Copyright 2014 Citra Emulator Project
2// Licensed under GPLv2 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 <map> 5#include <map>
diff --git a/src/core/settings.cpp b/src/core/settings.cpp
index c486f6274..8a14f75aa 100644
--- a/src/core/settings.cpp
+++ b/src/core/settings.cpp
@@ -1,5 +1,5 @@
1// Copyright 2014 Citra Emulator Project 1// Copyright 2014 Citra Emulator Project
2// Licensed under GPLv2 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 "settings.h" 5#include "settings.h"
diff --git a/src/core/settings.h b/src/core/settings.h
index 138ffc615..4808872ae 100644
--- a/src/core/settings.h
+++ b/src/core/settings.h
@@ -1,5 +1,5 @@
1// Copyright 2014 Citra Emulator Project 1// Copyright 2014 Citra Emulator Project
2// Licensed under GPLv2 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#pragma once 5#pragma once
diff --git a/src/core/system.cpp b/src/core/system.cpp
index 2885ff45f..d6188f055 100644
--- a/src/core/system.cpp
+++ b/src/core/system.cpp
@@ -1,5 +1,5 @@
1// Copyright 2014 Citra Emulator Project 1// Copyright 2014 Citra Emulator Project
2// Licensed under GPLv2 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/core.h" 5#include "core/core.h"
diff --git a/src/core/system.h b/src/core/system.h
index 2bc2edc75..05d836530 100644
--- a/src/core/system.h
+++ b/src/core/system.h
@@ -1,5 +1,5 @@
1// Copyright 2014 Citra Emulator Project 1// Copyright 2014 Citra Emulator Project
2// Licensed under GPLv2 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#pragma once 5#pragma once
diff --git a/src/video_core/clipper.cpp b/src/video_core/clipper.cpp
index 632fb959a..0bcd0b895 100644
--- a/src/video_core/clipper.cpp
+++ b/src/video_core/clipper.cpp
@@ -1,5 +1,5 @@
1// Copyright 2014 Citra Emulator Project 1// Copyright 2014 Citra Emulator Project
2// Licensed under GPLv2 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 <vector> 5#include <vector>
diff --git a/src/video_core/clipper.h b/src/video_core/clipper.h
index 14d31ca1e..19ce8e140 100644
--- a/src/video_core/clipper.h
+++ b/src/video_core/clipper.h
@@ -1,5 +1,5 @@
1// Copyright 2014 Citra Emulator Project 1// Copyright 2014 Citra Emulator Project
2// Licensed under GPLv2 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#pragma once 5#pragma once
diff --git a/src/video_core/command_processor.cpp b/src/video_core/command_processor.cpp
index 9b8ecf8e3..2083357fe 100644
--- a/src/video_core/command_processor.cpp
+++ b/src/video_core/command_processor.cpp
@@ -1,5 +1,5 @@
1// Copyright 2014 Citra Emulator Project 1// Copyright 2014 Citra Emulator Project
2// Licensed under GPLv2 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 "clipper.h" 5#include "clipper.h"
@@ -90,7 +90,7 @@ static inline void WritePicaReg(u32 id, u32 value, u32 mask) {
90 const auto& index_info = registers.index_array; 90 const auto& index_info = registers.index_array;
91 const u8* index_address_8 = Memory::GetPointer(PAddrToVAddr(base_address + index_info.offset)); 91 const u8* index_address_8 = Memory::GetPointer(PAddrToVAddr(base_address + index_info.offset));
92 const u16* index_address_16 = (u16*)index_address_8; 92 const u16* index_address_16 = (u16*)index_address_8;
93 bool index_u16 = (bool)index_info.format; 93 bool index_u16 = index_info.format != 0;
94 94
95 DebugUtils::GeometryDumper geometry_dumper; 95 DebugUtils::GeometryDumper geometry_dumper;
96 PrimitiveAssembler<VertexShader::OutputVertex> clipper_primitive_assembler(registers.triangle_topology.Value()); 96 PrimitiveAssembler<VertexShader::OutputVertex> clipper_primitive_assembler(registers.triangle_topology.Value());
@@ -164,7 +164,7 @@ static inline void WritePicaReg(u32 id, u32 value, u32 mask) {
164 164
165 case PICA_REG_INDEX(vs_bool_uniforms): 165 case PICA_REG_INDEX(vs_bool_uniforms):
166 for (unsigned i = 0; i < 16; ++i) 166 for (unsigned i = 0; i < 16; ++i)
167 VertexShader::GetBoolUniform(i) = (registers.vs_bool_uniforms.Value() & (1 << i)); 167 VertexShader::GetBoolUniform(i) = (registers.vs_bool_uniforms.Value() & (1 << i)) != 0;
168 168
169 break; 169 break;
170 170
diff --git a/src/video_core/command_processor.h b/src/video_core/command_processor.h
index 955f9daec..bb3d4150f 100644
--- a/src/video_core/command_processor.h
+++ b/src/video_core/command_processor.h
@@ -1,5 +1,5 @@
1// Copyright 2014 Citra Emulator Project 1// Copyright 2014 Citra Emulator Project
2// Licensed under GPLv2 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#pragma once 5#pragma once
diff --git a/src/video_core/gpu_debugger.h b/src/video_core/gpu_debugger.h
index 4eb8b3d4d..a51d49c92 100644
--- a/src/video_core/gpu_debugger.h
+++ b/src/video_core/gpu_debugger.h
@@ -1,5 +1,5 @@
1// Copyright 2014 Citra Emulator Project 1// Copyright 2014 Citra Emulator Project
2// Licensed under GPLv2 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#pragma once 5#pragma once
diff --git a/src/video_core/math.h b/src/video_core/math.h
index 83ba81235..9622e7614 100644
--- a/src/video_core/math.h
+++ b/src/video_core/math.h
@@ -1,4 +1,4 @@
1// Licensed under GPLv2 1// Licensed under GPLv2 or any later version
2// Refer to the license.txt file included. 2// Refer to the license.txt file included.
3 3
4 4
diff --git a/src/video_core/pica.h b/src/video_core/pica.h
index 06552a3ef..89d97e4e9 100644
--- a/src/video_core/pica.h
+++ b/src/video_core/pica.h
@@ -1,5 +1,5 @@
1// Copyright 2014 Citra Emulator Project 1// Copyright 2014 Citra Emulator Project
2// Licensed under GPLv2 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#pragma once 5#pragma once
@@ -201,9 +201,9 @@ struct Regs {
201 }; 201 };
202 const std::array<FullTextureConfig, 3> GetTextures() const { 202 const std::array<FullTextureConfig, 3> GetTextures() const {
203 return {{ 203 return {{
204 { static_cast<bool>(texture0_enable), texture0, texture0_format }, 204 { texture0_enable.ToBool(), texture0, texture0_format },
205 { static_cast<bool>(texture1_enable), texture1, texture1_format }, 205 { texture1_enable.ToBool(), texture1, texture1_format },
206 { static_cast<bool>(texture2_enable), texture2, texture2_format } 206 { texture2_enable.ToBool(), texture2, texture2_format }
207 }}; 207 }};
208 } 208 }
209 209
@@ -590,11 +590,11 @@ struct Regs {
590 static std::string GetCommandName(int index) { 590 static std::string GetCommandName(int index) {
591 std::map<u32, std::string> map; 591 std::map<u32, std::string> map;
592 592
593 Regs regs;
594 #define ADD_FIELD(name) \ 593 #define ADD_FIELD(name) \
595 do { \ 594 do { \
596 map.insert({PICA_REG_INDEX(name), #name}); \ 595 map.insert({PICA_REG_INDEX(name), #name}); \
597 for (u32 i = PICA_REG_INDEX(name) + 1; i < PICA_REG_INDEX(name) + sizeof(regs.name) / 4; ++i) \ 596 /* TODO: change to Regs::name when VS2015 and other compilers support it */ \
597 for (u32 i = PICA_REG_INDEX(name) + 1; i < PICA_REG_INDEX(name) + sizeof(Regs().name) / 4; ++i) \
598 map.insert({i, #name + std::string("+") + std::to_string(i-PICA_REG_INDEX(name))}); \ 598 map.insert({i, #name + std::string("+") + std::to_string(i-PICA_REG_INDEX(name))}); \
599 } while(false) 599 } while(false)
600 600
diff --git a/src/video_core/primitive_assembly.cpp b/src/video_core/primitive_assembly.cpp
index ff46c7b52..242a07e26 100644
--- a/src/video_core/primitive_assembly.cpp
+++ b/src/video_core/primitive_assembly.cpp
@@ -1,5 +1,5 @@
1// Copyright 2014 Citra Emulator Project 1// Copyright 2014 Citra Emulator Project
2// Licensed under GPLv2 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 "pica.h" 5#include "pica.h"
diff --git a/src/video_core/primitive_assembly.h b/src/video_core/primitive_assembly.h
index decf0fd64..52ff4cd89 100644
--- a/src/video_core/primitive_assembly.h
+++ b/src/video_core/primitive_assembly.h
@@ -1,5 +1,5 @@
1// Copyright 2014 Citra Emulator Project 1// Copyright 2014 Citra Emulator Project
2// Licensed under GPLv2 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#pragma once 5#pragma once
diff --git a/src/video_core/rasterizer.cpp b/src/video_core/rasterizer.cpp
index bf9c36661..df1f88c79 100644
--- a/src/video_core/rasterizer.cpp
+++ b/src/video_core/rasterizer.cpp
@@ -1,5 +1,5 @@
1// Copyright 2014 Citra Emulator Project 1// Copyright 2014 Citra Emulator Project
2// Licensed under GPLv2 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 <algorithm> 5#include <algorithm>
diff --git a/src/video_core/rasterizer.h b/src/video_core/rasterizer.h
index 500be9462..42148f8b1 100644
--- a/src/video_core/rasterizer.h
+++ b/src/video_core/rasterizer.h
@@ -1,5 +1,5 @@
1// Copyright 2014 Citra Emulator Project 1// Copyright 2014 Citra Emulator Project
2// Licensed under GPLv2 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#pragma once 5#pragma once
diff --git a/src/video_core/renderer_base.h b/src/video_core/renderer_base.h
index bce402b88..b77f29c11 100644
--- a/src/video_core/renderer_base.h
+++ b/src/video_core/renderer_base.h
@@ -1,5 +1,5 @@
1// Copyright 2014 Citra Emulator Project 1// Copyright 2014 Citra Emulator Project
2// Licensed under GPLv2 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#pragma once 5#pragma once
diff --git a/src/video_core/renderer_opengl/gl_shader_util.cpp b/src/video_core/renderer_opengl/gl_shader_util.cpp
index d0f82e6cd..e982e3746 100644
--- a/src/video_core/renderer_opengl/gl_shader_util.cpp
+++ b/src/video_core/renderer_opengl/gl_shader_util.cpp
@@ -1,5 +1,5 @@
1// Copyright 2014 Citra Emulator Project 1// Copyright 2014 Citra Emulator Project
2// Licensed under GPLv2 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 "gl_shader_util.h" 5#include "gl_shader_util.h"
diff --git a/src/video_core/renderer_opengl/gl_shader_util.h b/src/video_core/renderer_opengl/gl_shader_util.h
index 986cbabc0..9b93a8a0c 100644
--- a/src/video_core/renderer_opengl/gl_shader_util.h
+++ b/src/video_core/renderer_opengl/gl_shader_util.h
@@ -1,5 +1,5 @@
1// Copyright 2014 Citra Emulator Project 1// Copyright 2014 Citra Emulator Project
2// Licensed under GPLv2 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#pragma once 5#pragma once
diff --git a/src/video_core/renderer_opengl/gl_shaders.h b/src/video_core/renderer_opengl/gl_shaders.h
index 0f88ab802..746a37afe 100644
--- a/src/video_core/renderer_opengl/gl_shaders.h
+++ b/src/video_core/renderer_opengl/gl_shaders.h
@@ -1,5 +1,5 @@
1// Copyright 2014 Citra Emulator Project 1// Copyright 2014 Citra Emulator Project
2// Licensed under GPLv2 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#pragma once 5#pragma once
diff --git a/src/video_core/renderer_opengl/renderer_opengl.cpp b/src/video_core/renderer_opengl/renderer_opengl.cpp
index e20d7adb7..4df3a5e25 100644
--- a/src/video_core/renderer_opengl/renderer_opengl.cpp
+++ b/src/video_core/renderer_opengl/renderer_opengl.cpp
@@ -1,5 +1,5 @@
1// Copyright 2014 Citra Emulator Project 1// Copyright 2014 Citra Emulator Project
2// Licensed under GPLv2 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/hw/gpu.h" 5#include "core/hw/gpu.h"
diff --git a/src/video_core/renderer_opengl/renderer_opengl.h b/src/video_core/renderer_opengl/renderer_opengl.h
index 7fdcec731..cf78c1e77 100644
--- a/src/video_core/renderer_opengl/renderer_opengl.h
+++ b/src/video_core/renderer_opengl/renderer_opengl.h
@@ -1,5 +1,5 @@
1// Copyright 2014 Citra Emulator Project 1// Copyright 2014 Citra Emulator Project
2// Licensed under GPLv2 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#pragma once 5#pragma once
diff --git a/src/video_core/utils.cpp b/src/video_core/utils.cpp
index f1156a493..c7cc93cea 100644
--- a/src/video_core/utils.cpp
+++ b/src/video_core/utils.cpp
@@ -1,5 +1,5 @@
1// Copyright 2014 Citra Emulator Project 1// Copyright 2014 Citra Emulator Project
2// Licensed under GPLv2 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 <stdio.h> 5#include <stdio.h>
diff --git a/src/video_core/utils.h b/src/video_core/utils.h
index 21380a908..63ebccbde 100644
--- a/src/video_core/utils.h
+++ b/src/video_core/utils.h
@@ -1,5 +1,5 @@
1// Copyright 2014 Citra Emulator Project 1// Copyright 2014 Citra Emulator Project
2// Licensed under GPLv2 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#pragma once 5#pragma once
diff --git a/src/video_core/vertex_shader.cpp b/src/video_core/vertex_shader.cpp
index 859b4836d..e31bc3bc7 100644
--- a/src/video_core/vertex_shader.cpp
+++ b/src/video_core/vertex_shader.cpp
@@ -1,5 +1,5 @@
1// Copyright 2014 Citra Emulator Project 1// Copyright 2014 Citra Emulator Project
2// Licensed under GPLv2 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 <stack> 5#include <stack>
diff --git a/src/video_core/vertex_shader.h b/src/video_core/vertex_shader.h
index 047dde046..af3fb2a2f 100644
--- a/src/video_core/vertex_shader.h
+++ b/src/video_core/vertex_shader.h
@@ -1,5 +1,5 @@
1// Copyright 2014 Citra Emulator Project 1// Copyright 2014 Citra Emulator Project
2// Licensed under GPLv2 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#pragma once 5#pragma once
diff --git a/src/video_core/video_core.cpp b/src/video_core/video_core.cpp
index 6791e4007..c9707e5f1 100644
--- a/src/video_core/video_core.cpp
+++ b/src/video_core/video_core.cpp
@@ -1,5 +1,5 @@
1// Copyright 2014 Citra Emulator Project 1// Copyright 2014 Citra Emulator Project
2// Licensed under GPLv2 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 "common/common.h" 5#include "common/common.h"
diff --git a/src/video_core/video_core.h b/src/video_core/video_core.h
index 609aac513..b782f17bd 100644
--- a/src/video_core/video_core.h
+++ b/src/video_core/video_core.h
@@ -1,5 +1,5 @@
1// Copyright 2014 Citra Emulator Project 1// Copyright 2014 Citra Emulator Project
2// Licensed under GPLv2 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#pragma once 5#pragma once