summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/common/string_util.cpp6
-rw-r--r--src/core/hle/service/dsp_dsp.cpp46
-rw-r--r--src/video_core/vertex_shader.cpp16
3 files changed, 58 insertions, 10 deletions
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
20std::string ToLower(std::string str) { 20std::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
26std::string ToUpper(std::string str) { 26std::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
13namespace DSP_DSP { 13namespace DSP_DSP {
14 14
15static u32 read_pipe_count;
15static Handle semaphore_event; 16static Handle semaphore_event;
16static Handle interrupt_event; 17static 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 */
123void 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
111const Interface::FunctionInfo FunctionTable[] = { 154const 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[] = {
142Interface::Interface() { 185Interface::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
11namespace Pica { 16namespace 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);