diff options
| -rw-r--r-- | .gitmodules | 3 | ||||
| -rw-r--r-- | CMakeLists.txt | 8 | ||||
| m--------- | externals/boost | 0 | ||||
| -rw-r--r-- | src/common/string_util.cpp | 6 | ||||
| -rw-r--r-- | src/core/hle/service/dsp_dsp.cpp | 46 | ||||
| -rw-r--r-- | src/video_core/vertex_shader.cpp | 16 |
6 files changed, 69 insertions, 10 deletions
diff --git a/.gitmodules b/.gitmodules index d7201387a..54714e5cd 100644 --- a/.gitmodules +++ b/.gitmodules | |||
| @@ -1,3 +1,6 @@ | |||
| 1 | [submodule "externals/inih/inih"] | 1 | [submodule "externals/inih/inih"] |
| 2 | path = externals/inih/inih | 2 | path = externals/inih/inih |
| 3 | url = https://github.com/svn2github/inih | 3 | url = https://github.com/svn2github/inih |
| 4 | [submodule "externals/boost"] | ||
| 5 | path = externals/boost | ||
| 6 | url = https://github.com/citra-emu/ext-boost.git | ||
diff --git a/CMakeLists.txt b/CMakeLists.txt index 05a560404..61d5d524a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt | |||
| @@ -19,6 +19,14 @@ if (PNG_FOUND) | |||
| 19 | add_definitions(-DHAVE_PNG) | 19 | add_definitions(-DHAVE_PNG) |
| 20 | endif () | 20 | endif () |
| 21 | 21 | ||
| 22 | find_package(Boost) | ||
| 23 | if (Boost_FOUND) | ||
| 24 | include_directories(${Boost_INCLUDE_DIRS}) | ||
| 25 | else() | ||
| 26 | message(STATUS "Boost not found, falling back to externals") | ||
| 27 | include_directories(externals/boost) | ||
| 28 | endif() | ||
| 29 | |||
| 22 | # Include bundled CMake modules | 30 | # Include bundled CMake modules |
| 23 | list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/externals/cmake-modules") | 31 | list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/externals/cmake-modules") |
| 24 | 32 | ||
diff --git a/externals/boost b/externals/boost new file mode 160000 | |||
| Subproject b060148c08ae87a3a5809c4f48cb26ac667487a | |||
diff --git a/src/common/string_util.cpp b/src/common/string_util.cpp index 19e162c27..7a8274a91 100644 --- a/src/common/string_util.cpp +++ b/src/common/string_util.cpp | |||
| @@ -2,7 +2,7 @@ | |||
| 2 | // Licensed under GPLv2 | 2 | // Licensed under GPLv2 |
| 3 | // Refer to the license.txt file included. | 3 | // Refer to the license.txt file included. |
| 4 | 4 | ||
| 5 | #include <algorithm> | 5 | #include <boost/range/algorithm.hpp> |
| 6 | 6 | ||
| 7 | #include "common/common.h" | 7 | #include "common/common.h" |
| 8 | #include "common/string_util.h" | 8 | #include "common/string_util.h" |
| @@ -18,13 +18,13 @@ namespace Common { | |||
| 18 | 18 | ||
| 19 | /// Make a string lowercase | 19 | /// Make a string lowercase |
| 20 | std::string ToLower(std::string str) { | 20 | std::string ToLower(std::string str) { |
| 21 | std::transform(str.begin(), str.end(), str.begin(), ::tolower); | 21 | boost::transform(str, str.begin(), ::tolower); |
| 22 | return str; | 22 | return str; |
| 23 | } | 23 | } |
| 24 | 24 | ||
| 25 | /// Make a string uppercase | 25 | /// Make a string uppercase |
| 26 | std::string ToUpper(std::string str) { | 26 | std::string ToUpper(std::string str) { |
| 27 | std::transform(str.begin(), str.end(), str.begin(), ::toupper); | 27 | boost::transform(str, str.begin(), ::toupper); |
| 28 | return str; | 28 | return str; |
| 29 | } | 29 | } |
| 30 | 30 | ||
diff --git a/src/core/hle/service/dsp_dsp.cpp b/src/core/hle/service/dsp_dsp.cpp index 72be4c817..e89c8aae3 100644 --- a/src/core/hle/service/dsp_dsp.cpp +++ b/src/core/hle/service/dsp_dsp.cpp | |||
| @@ -12,6 +12,7 @@ | |||
| 12 | 12 | ||
| 13 | namespace DSP_DSP { | 13 | namespace DSP_DSP { |
| 14 | 14 | ||
| 15 | static u32 read_pipe_count; | ||
| 15 | static Handle semaphore_event; | 16 | static Handle semaphore_event; |
| 16 | static Handle interrupt_event; | 17 | static Handle interrupt_event; |
| 17 | 18 | ||
| @@ -108,6 +109,48 @@ void WriteReg0x10(Service::Interface* self) { | |||
| 108 | DEBUG_LOG(KERNEL, "(STUBBED) called"); | 109 | DEBUG_LOG(KERNEL, "(STUBBED) called"); |
| 109 | } | 110 | } |
| 110 | 111 | ||
| 112 | /** | ||
| 113 | * DSP_DSP::ReadPipeIfPossible service function | ||
| 114 | * Inputs: | ||
| 115 | * 1 : Unknown | ||
| 116 | * 2 : Unknown | ||
| 117 | * 3 : Size in bytes of read (observed only lower half word used) | ||
| 118 | * 0x41 : Virtual address to read from DSP pipe to in memory | ||
| 119 | * Outputs: | ||
| 120 | * 1 : Result of function, 0 on success, otherwise error code | ||
| 121 | * 2 : Number of bytes read from pipe | ||
| 122 | */ | ||
| 123 | void ReadPipeIfPossible(Service::Interface* self) { | ||
| 124 | u32* cmd_buff = Service::GetCommandBuffer(); | ||
| 125 | |||
| 126 | u32 size = cmd_buff[3] & 0xFFFF;// Lower 16 bits are size | ||
| 127 | VAddr addr = cmd_buff[0x41]; | ||
| 128 | |||
| 129 | // Canned DSP responses that games expect. These were taken from HW by 3dmoo team. | ||
| 130 | // TODO: Remove this hack :) | ||
| 131 | static const std::array<u16, 16> canned_read_pipe = { | ||
| 132 | 0x000F, 0xBFFF, 0x9E8E, 0x8680, 0xA78E, 0x9430, 0x8400, 0x8540, | ||
| 133 | 0x948E, 0x8710, 0x8410, 0xA90E, 0xAA0E, 0xAACE, 0xAC4E, 0xAC58 | ||
| 134 | }; | ||
| 135 | |||
| 136 | u32 initial_size = read_pipe_count; | ||
| 137 | |||
| 138 | for (unsigned offset = 0; offset < size; offset += sizeof(u16)) { | ||
| 139 | if (read_pipe_count < canned_read_pipe.size()) { | ||
| 140 | Memory::Write16(addr + offset, canned_read_pipe[read_pipe_count]); | ||
| 141 | read_pipe_count++; | ||
| 142 | } else { | ||
| 143 | ERROR_LOG(KERNEL, "canned read pipe log exceeded!"); | ||
| 144 | break; | ||
| 145 | } | ||
| 146 | } | ||
| 147 | |||
| 148 | cmd_buff[1] = 0; // No error | ||
| 149 | cmd_buff[2] = (read_pipe_count - initial_size) * sizeof(u16); | ||
| 150 | |||
| 151 | DEBUG_LOG(KERNEL, "(STUBBED) called size=0x%08X, buffer=0x%08X", size, addr); | ||
| 152 | } | ||
| 153 | |||
| 111 | const Interface::FunctionInfo FunctionTable[] = { | 154 | const Interface::FunctionInfo FunctionTable[] = { |
| 112 | {0x00010040, nullptr, "RecvData"}, | 155 | {0x00010040, nullptr, "RecvData"}, |
| 113 | {0x00020040, nullptr, "RecvDataIsReady"}, | 156 | {0x00020040, nullptr, "RecvDataIsReady"}, |
| @@ -119,7 +162,7 @@ const Interface::FunctionInfo FunctionTable[] = { | |||
| 119 | {0x000B0000, nullptr, "CheckSemaphoreRequest"}, | 162 | {0x000B0000, nullptr, "CheckSemaphoreRequest"}, |
| 120 | {0x000C0040, ConvertProcessAddressFromDspDram, "ConvertProcessAddressFromDspDram"}, | 163 | {0x000C0040, ConvertProcessAddressFromDspDram, "ConvertProcessAddressFromDspDram"}, |
| 121 | {0x000D0082, nullptr, "WriteProcessPipe"}, | 164 | {0x000D0082, nullptr, "WriteProcessPipe"}, |
| 122 | {0x001000C0, nullptr, "ReadPipeIfPossible"}, | 165 | {0x001000C0, ReadPipeIfPossible, "ReadPipeIfPossible"}, |
| 123 | {0x001100C2, LoadComponent, "LoadComponent"}, | 166 | {0x001100C2, LoadComponent, "LoadComponent"}, |
| 124 | {0x00120000, nullptr, "UnloadComponent"}, | 167 | {0x00120000, nullptr, "UnloadComponent"}, |
| 125 | {0x00130082, nullptr, "FlushDataCache"}, | 168 | {0x00130082, nullptr, "FlushDataCache"}, |
| @@ -142,6 +185,7 @@ const Interface::FunctionInfo FunctionTable[] = { | |||
| 142 | Interface::Interface() { | 185 | Interface::Interface() { |
| 143 | semaphore_event = Kernel::CreateEvent(RESETTYPE_ONESHOT, "DSP_DSP::semaphore_event"); | 186 | semaphore_event = Kernel::CreateEvent(RESETTYPE_ONESHOT, "DSP_DSP::semaphore_event"); |
| 144 | interrupt_event = 0; | 187 | interrupt_event = 0; |
| 188 | read_pipe_count = 0; | ||
| 145 | 189 | ||
| 146 | Register(FunctionTable, ARRAY_SIZE(FunctionTable)); | 190 | Register(FunctionTable, ARRAY_SIZE(FunctionTable)); |
| 147 | } | 191 | } |
diff --git a/src/video_core/vertex_shader.cpp b/src/video_core/vertex_shader.cpp index 96625791c..0dff11a0f 100644 --- a/src/video_core/vertex_shader.cpp +++ b/src/video_core/vertex_shader.cpp | |||
| @@ -2,11 +2,16 @@ | |||
| 2 | // Licensed under GPLv2 | 2 | // Licensed under GPLv2 |
| 3 | // Refer to the license.txt file included. | 3 | // Refer to the license.txt file included. |
| 4 | 4 | ||
| 5 | #include <boost/range/algorithm.hpp> | ||
| 6 | |||
| 7 | #include <common/file_util.h> | ||
| 8 | |||
| 9 | #include <core/mem_map.h> | ||
| 10 | |||
| 11 | #include "debug_utils/debug_utils.h" | ||
| 12 | |||
| 5 | #include "pica.h" | 13 | #include "pica.h" |
| 6 | #include "vertex_shader.h" | 14 | #include "vertex_shader.h" |
| 7 | #include "debug_utils/debug_utils.h" | ||
| 8 | #include <core/mem_map.h> | ||
| 9 | #include <common/file_util.h> | ||
| 10 | 15 | ||
| 11 | namespace Pica { | 16 | namespace Pica { |
| 12 | 17 | ||
| @@ -238,7 +243,7 @@ OutputVertex RunShader(const InputVertex& input, int num_attributes) | |||
| 238 | // Setup input register table | 243 | // Setup input register table |
| 239 | const auto& attribute_register_map = registers.vs_input_register_map; | 244 | const auto& attribute_register_map = registers.vs_input_register_map; |
| 240 | float24 dummy_register; | 245 | float24 dummy_register; |
| 241 | std::fill(&state.input_register_table[0], &state.input_register_table[16], &dummy_register); | 246 | boost::fill(state.input_register_table, &dummy_register); |
| 242 | if(num_attributes > 0) state.input_register_table[attribute_register_map.attribute0_register] = &input.attr[0].x; | 247 | if(num_attributes > 0) state.input_register_table[attribute_register_map.attribute0_register] = &input.attr[0].x; |
| 243 | if(num_attributes > 1) state.input_register_table[attribute_register_map.attribute1_register] = &input.attr[1].x; | 248 | if(num_attributes > 1) state.input_register_table[attribute_register_map.attribute1_register] = &input.attr[1].x; |
| 244 | if(num_attributes > 2) state.input_register_table[attribute_register_map.attribute2_register] = &input.attr[2].x; | 249 | if(num_attributes > 2) state.input_register_table[attribute_register_map.attribute2_register] = &input.attr[2].x; |
| @@ -272,8 +277,7 @@ OutputVertex RunShader(const InputVertex& input, int num_attributes) | |||
| 272 | 277 | ||
| 273 | state.status_registers[0] = false; | 278 | state.status_registers[0] = false; |
| 274 | state.status_registers[1] = false; | 279 | state.status_registers[1] = false; |
| 275 | std::fill(state.call_stack, state.call_stack + sizeof(state.call_stack) / sizeof(state.call_stack[0]), | 280 | boost::fill(state.call_stack, VertexShaderState::INVALID_ADDRESS); |
| 276 | VertexShaderState::INVALID_ADDRESS); | ||
| 277 | state.call_stack_pointer = &state.call_stack[0]; | 281 | state.call_stack_pointer = &state.call_stack[0]; |
| 278 | 282 | ||
| 279 | ProcessShaderCode(state); | 283 | ProcessShaderCode(state); |