summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/citra_qt/main.cpp7
-rw-r--r--src/citra_qt/main.h2
-rw-r--r--src/common/vector_math.h5
-rw-r--r--src/core/hle/service/fs/fs_user.cpp26
-rw-r--r--src/video_core/command_processor.cpp23
-rw-r--r--src/video_core/debug_utils/debug_utils.cpp24
-rw-r--r--src/video_core/shader/shader_interpreter.cpp2
7 files changed, 58 insertions, 31 deletions
diff --git a/src/citra_qt/main.cpp b/src/citra_qt/main.cpp
index 57adbc136..32cceaf7e 100644
--- a/src/citra_qt/main.cpp
+++ b/src/citra_qt/main.cpp
@@ -310,6 +310,7 @@ bool GMainWindow::LoadROM(const std::string& filename) {
310 310
311void GMainWindow::BootGame(const std::string& filename) { 311void GMainWindow::BootGame(const std::string& filename) {
312 LOG_INFO(Frontend, "Citra starting..."); 312 LOG_INFO(Frontend, "Citra starting...");
313 StoreRecentFile(filename); // Put the filename on top of the list
313 314
314 if (!InitializeSystem()) 315 if (!InitializeSystem())
315 return; 316 return;
@@ -374,11 +375,11 @@ void GMainWindow::ShutdownGame() {
374 emulation_running = false; 375 emulation_running = false;
375} 376}
376 377
377void GMainWindow::StoreRecentFile(const QString& filename) 378void GMainWindow::StoreRecentFile(const std::string& filename)
378{ 379{
379 QSettings settings; 380 QSettings settings;
380 QStringList recent_files = settings.value("recentFiles").toStringList(); 381 QStringList recent_files = settings.value("recentFiles").toStringList();
381 recent_files.prepend(filename); 382 recent_files.prepend(QString::fromStdString(filename));
382 recent_files.removeDuplicates(); 383 recent_files.removeDuplicates();
383 while (recent_files.size() > max_recent_files_item) { 384 while (recent_files.size() > max_recent_files_item) {
384 recent_files.removeLast(); 385 recent_files.removeLast();
@@ -426,7 +427,6 @@ void GMainWindow::OnMenuLoadFile() {
426 QString filename = QFileDialog::getOpenFileName(this, tr("Load File"), rom_path, tr("3DS executable (*.3ds *.3dsx *.elf *.axf *.cci *.cxi)")); 427 QString filename = QFileDialog::getOpenFileName(this, tr("Load File"), rom_path, tr("3DS executable (*.3ds *.3dsx *.elf *.axf *.cci *.cxi)"));
427 if (!filename.isEmpty()) { 428 if (!filename.isEmpty()) {
428 settings.setValue("romsPath", QFileInfo(filename).path()); 429 settings.setValue("romsPath", QFileInfo(filename).path());
429 StoreRecentFile(filename);
430 430
431 BootGame(filename.toLocal8Bit().data()); 431 BootGame(filename.toLocal8Bit().data());
432 } 432 }
@@ -462,7 +462,6 @@ void GMainWindow::OnMenuRecentFile() {
462 QFileInfo file_info(filename); 462 QFileInfo file_info(filename);
463 if (file_info.exists()) { 463 if (file_info.exists()) {
464 BootGame(filename.toLocal8Bit().data()); 464 BootGame(filename.toLocal8Bit().data());
465 StoreRecentFile(filename); // Put the filename on top of the list
466 } else { 465 } else {
467 // Display an error message and remove the file from the list. 466 // Display an error message and remove the file from the list.
468 QMessageBox::information(this, tr("File not found"), tr("File \"%1\" not found").arg(filename)); 467 QMessageBox::information(this, tr("File not found"), tr("File \"%1\" not found").arg(filename));
diff --git a/src/citra_qt/main.h b/src/citra_qt/main.h
index 945aea0cd..6e4e56689 100644
--- a/src/citra_qt/main.h
+++ b/src/citra_qt/main.h
@@ -75,7 +75,7 @@ private:
75 * 75 *
76 * @param filename the filename to store 76 * @param filename the filename to store
77 */ 77 */
78 void StoreRecentFile(const QString& filename); 78 void StoreRecentFile(const std::string& filename);
79 79
80 /** 80 /**
81 * Updates the recent files menu. 81 * Updates the recent files menu.
diff --git a/src/common/vector_math.h b/src/common/vector_math.h
index 02688e35e..cfb9481b6 100644
--- a/src/common/vector_math.h
+++ b/src/common/vector_math.h
@@ -447,7 +447,10 @@ public:
447 447
448 void SetZero() 448 void SetZero()
449 { 449 {
450 x=0; y=0; z=0; 450 x = 0;
451 y = 0;
452 z = 0;
453 w = 0;
451 } 454 }
452 455
453 // Common alias: RGBA (colors) 456 // Common alias: RGBA (colors)
diff --git a/src/core/hle/service/fs/fs_user.cpp b/src/core/hle/service/fs/fs_user.cpp
index 632620a56..e6c1f3616 100644
--- a/src/core/hle/service/fs/fs_user.cpp
+++ b/src/core/hle/service/fs/fs_user.cpp
@@ -707,6 +707,30 @@ static void GetPriority(Service::Interface* self) {
707 LOG_DEBUG(Service_FS, "called priority=0x%X", priority); 707 LOG_DEBUG(Service_FS, "called priority=0x%X", priority);
708} 708}
709 709
710/**
711 * FS_User::GetArchiveResource service function.
712 * Inputs:
713 * 0 : 0x08490040
714 * 1 : Media type
715 * Outputs:
716 * 1 : Result of function, 0 on success, otherwise error code
717 * 2 : Sector byte-size
718 * 3 : Cluster byte-size
719 * 4 : Partition capacity in clusters
720 * 5 : Available free space in clusters
721 */
722static void GetArchiveResource(Service::Interface* self) {
723 u32* cmd_buff = Kernel::GetCommandBuffer();
724
725 LOG_WARNING(Service_FS, "(STUBBED) called Media type=0x%08X", cmd_buff[1]);
726
727 cmd_buff[1] = RESULT_SUCCESS.raw;
728 cmd_buff[2] = 512;
729 cmd_buff[3] = 16384;
730 cmd_buff[4] = 0x80000; // 8GiB capacity
731 cmd_buff[5] = 0x80000; // 8GiB free
732}
733
710const Interface::FunctionInfo FunctionTable[] = { 734const Interface::FunctionInfo FunctionTable[] = {
711 {0x000100C6, nullptr, "Dummy1"}, 735 {0x000100C6, nullptr, "Dummy1"},
712 {0x040100C4, nullptr, "Control"}, 736 {0x040100C4, nullptr, "Control"},
@@ -782,7 +806,7 @@ const Interface::FunctionInfo FunctionTable[] = {
782 {0x08460102, nullptr, "GetLegacyRomHeader2"}, 806 {0x08460102, nullptr, "GetLegacyRomHeader2"},
783 {0x08470180, nullptr, "FormatCtrCardUserSaveData"}, 807 {0x08470180, nullptr, "FormatCtrCardUserSaveData"},
784 {0x08480042, nullptr, "GetSdmcCtrRootPath"}, 808 {0x08480042, nullptr, "GetSdmcCtrRootPath"},
785 {0x08490040, nullptr, "GetArchiveResource"}, 809 {0x08490040, GetArchiveResource, "GetArchiveResource"},
786 {0x084A0002, nullptr, "ExportIntegrityVerificationSeed"}, 810 {0x084A0002, nullptr, "ExportIntegrityVerificationSeed"},
787 {0x084B0002, nullptr, "ImportIntegrityVerificationSeed"}, 811 {0x084B0002, nullptr, "ImportIntegrityVerificationSeed"},
788 {0x084C0242, FormatSaveData, "FormatSaveData"}, 812 {0x084C0242, FormatSaveData, "FormatSaveData"},
diff --git a/src/video_core/command_processor.cpp b/src/video_core/command_processor.cpp
index 54721561e..4b59984ad 100644
--- a/src/video_core/command_processor.cpp
+++ b/src/video_core/command_processor.cpp
@@ -200,7 +200,7 @@ static void WritePicaReg(u32 id, u32 value, u32 mask) {
200 for (int loader = 0; loader < 12; ++loader) { 200 for (int loader = 0; loader < 12; ++loader) {
201 const auto& loader_config = attribute_config.attribute_loaders[loader]; 201 const auto& loader_config = attribute_config.attribute_loaders[loader];
202 202
203 u32 load_address = base_address + loader_config.data_offset; 203 u32 offset = 0;
204 204
205 // TODO: What happens if a loader overwrites a previous one's data? 205 // TODO: What happens if a loader overwrites a previous one's data?
206 for (unsigned component = 0; component < loader_config.component_count; ++component) { 206 for (unsigned component = 0; component < loader_config.component_count; ++component) {
@@ -212,17 +212,17 @@ static void WritePicaReg(u32 id, u32 value, u32 mask) {
212 u32 attribute_index = loader_config.GetComponent(component); 212 u32 attribute_index = loader_config.GetComponent(component);
213 if (attribute_index < 12) { 213 if (attribute_index < 12) {
214 int element_size = attribute_config.GetElementSizeInBytes(attribute_index); 214 int element_size = attribute_config.GetElementSizeInBytes(attribute_index);
215 load_address = Common::AlignUp(load_address, element_size); 215 offset = Common::AlignUp(offset, element_size);
216 vertex_attribute_sources[attribute_index] = load_address; 216 vertex_attribute_sources[attribute_index] = base_address + loader_config.data_offset + offset;
217 vertex_attribute_strides[attribute_index] = static_cast<u32>(loader_config.byte_count); 217 vertex_attribute_strides[attribute_index] = static_cast<u32>(loader_config.byte_count);
218 vertex_attribute_formats[attribute_index] = attribute_config.GetFormat(attribute_index); 218 vertex_attribute_formats[attribute_index] = attribute_config.GetFormat(attribute_index);
219 vertex_attribute_elements[attribute_index] = attribute_config.GetNumElements(attribute_index); 219 vertex_attribute_elements[attribute_index] = attribute_config.GetNumElements(attribute_index);
220 vertex_attribute_element_size[attribute_index] = element_size; 220 vertex_attribute_element_size[attribute_index] = element_size;
221 load_address += attribute_config.GetStride(attribute_index); 221 offset += attribute_config.GetStride(attribute_index);
222 } else if (attribute_index < 16) { 222 } else if (attribute_index < 16) {
223 // Attribute ids 12, 13, 14 and 15 signify 4, 8, 12 and 16-byte paddings, respectively 223 // Attribute ids 12, 13, 14 and 15 signify 4, 8, 12 and 16-byte paddings, respectively
224 load_address = Common::AlignUp(load_address, 4); 224 offset = Common::AlignUp(offset, 4);
225 load_address += (attribute_index - 11) * 4; 225 offset += (attribute_index - 11) * 4;
226 } else { 226 } else {
227 UNREACHABLE(); // This is truly unreachable due to the number of bits for each component 227 UNREACHABLE(); // This is truly unreachable due to the number of bits for each component
228 } 228 }
@@ -234,7 +234,7 @@ static void WritePicaReg(u32 id, u32 value, u32 mask) {
234 234
235 const auto& index_info = regs.index_array; 235 const auto& index_info = regs.index_array;
236 const u8* index_address_8 = Memory::GetPhysicalPointer(base_address + index_info.offset); 236 const u8* index_address_8 = Memory::GetPhysicalPointer(base_address + index_info.offset);
237 const u16* index_address_16 = (u16*)index_address_8; 237 const u16* index_address_16 = reinterpret_cast<const u16*>(index_address_8);
238 bool index_u16 = index_info.format != 0; 238 bool index_u16 = index_info.format != 0;
239 239
240#if PICA_DUMP_GEOMETRY 240#if PICA_DUMP_GEOMETRY
@@ -345,10 +345,11 @@ static void WritePicaReg(u32 id, u32 value, u32 mask) {
345 : (vertex_attribute_formats[i] == Regs::VertexAttributeFormat::SHORT) ? 2 : 1); 345 : (vertex_attribute_formats[i] == Regs::VertexAttributeFormat::SHORT) ? 2 : 1);
346 } 346 }
347 347
348 const float srcval = (vertex_attribute_formats[i] == Regs::VertexAttributeFormat::BYTE) ? *(s8*)srcdata : 348 const float srcval =
349 (vertex_attribute_formats[i] == Regs::VertexAttributeFormat::UBYTE) ? *(u8*)srcdata : 349 (vertex_attribute_formats[i] == Regs::VertexAttributeFormat::BYTE) ? *reinterpret_cast<const s8*>(srcdata) :
350 (vertex_attribute_formats[i] == Regs::VertexAttributeFormat::SHORT) ? *(s16*)srcdata : 350 (vertex_attribute_formats[i] == Regs::VertexAttributeFormat::UBYTE) ? *reinterpret_cast<const u8*>(srcdata) :
351 *(float*)srcdata; 351 (vertex_attribute_formats[i] == Regs::VertexAttributeFormat::SHORT) ? *reinterpret_cast<const s16*>(srcdata) :
352 *reinterpret_cast<const float*>(srcdata);
352 353
353 input.attr[i][comp] = float24::FromFloat32(srcval); 354 input.attr[i][comp] = float24::FromFloat32(srcval);
354 LOG_TRACE(HW_GPU, "Loaded component %x of attribute %x for vertex %x (index %x) from 0x%08x + 0x%08x + 0x%04x: %f", 355 LOG_TRACE(HW_GPU, "Loaded component %x of attribute %x for vertex %x (index %x) from 0x%08x + 0x%08x + 0x%04x: %f",
diff --git a/src/video_core/debug_utils/debug_utils.cpp b/src/video_core/debug_utils/debug_utils.cpp
index 271e81ca1..bac6d69c7 100644
--- a/src/video_core/debug_utils/debug_utils.cpp
+++ b/src/video_core/debug_utils/debug_utils.cpp
@@ -117,13 +117,13 @@ void GeometryDumper::Dump() {
117void DumpShader(const std::string& filename, const Regs::ShaderConfig& config, const Shader::ShaderSetup& setup, const Regs::VSOutputAttributes* output_attributes) 117void DumpShader(const std::string& filename, const Regs::ShaderConfig& config, const Shader::ShaderSetup& setup, const Regs::VSOutputAttributes* output_attributes)
118{ 118{
119 struct StuffToWrite { 119 struct StuffToWrite {
120 u8* pointer; 120 const u8* pointer;
121 u32 size; 121 u32 size;
122 }; 122 };
123 std::vector<StuffToWrite> writing_queue; 123 std::vector<StuffToWrite> writing_queue;
124 u32 write_offset = 0; 124 u32 write_offset = 0;
125 125
126 auto QueueForWriting = [&writing_queue,&write_offset](u8* pointer, u32 size) { 126 auto QueueForWriting = [&writing_queue,&write_offset](const u8* pointer, u32 size) {
127 writing_queue.push_back({pointer, size}); 127 writing_queue.push_back({pointer, size});
128 u32 old_write_offset = write_offset; 128 u32 old_write_offset = write_offset;
129 write_offset += size; 129 write_offset += size;
@@ -228,27 +228,27 @@ void DumpShader(const std::string& filename, const Regs::ShaderConfig& config, c
228 DVLPHeader dvlp{ DVLPHeader::MAGIC_WORD }; 228 DVLPHeader dvlp{ DVLPHeader::MAGIC_WORD };
229 DVLEHeader dvle{ DVLEHeader::MAGIC_WORD }; 229 DVLEHeader dvle{ DVLEHeader::MAGIC_WORD };
230 230
231 QueueForWriting((u8*)&dvlb, sizeof(dvlb)); 231 QueueForWriting(reinterpret_cast<const u8*>(&dvlb), sizeof(dvlb));
232 u32 dvlp_offset = QueueForWriting((u8*)&dvlp, sizeof(dvlp)); 232 u32 dvlp_offset = QueueForWriting(reinterpret_cast<const u8*>(&dvlp), sizeof(dvlp));
233 dvlb.dvle_offset = QueueForWriting((u8*)&dvle, sizeof(dvle)); 233 dvlb.dvle_offset = QueueForWriting(reinterpret_cast<const u8*>(&dvle), sizeof(dvle));
234 234
235 // TODO: Reduce the amount of binary code written to relevant portions 235 // TODO: Reduce the amount of binary code written to relevant portions
236 dvlp.binary_offset = write_offset - dvlp_offset; 236 dvlp.binary_offset = write_offset - dvlp_offset;
237 dvlp.binary_size_words = setup.program_code.size(); 237 dvlp.binary_size_words = setup.program_code.size();
238 QueueForWriting((u8*)setup.program_code.data(), setup.program_code.size() * sizeof(u32)); 238 QueueForWriting(reinterpret_cast<const u8*>(setup.program_code.data()), setup.program_code.size() * sizeof(u32));
239 239
240 dvlp.swizzle_info_offset = write_offset - dvlp_offset; 240 dvlp.swizzle_info_offset = write_offset - dvlp_offset;
241 dvlp.swizzle_info_num_entries = setup.swizzle_data.size(); 241 dvlp.swizzle_info_num_entries = setup.swizzle_data.size();
242 u32 dummy = 0; 242 u32 dummy = 0;
243 for (unsigned int i = 0; i < setup.swizzle_data.size(); ++i) { 243 for (unsigned int i = 0; i < setup.swizzle_data.size(); ++i) {
244 QueueForWriting((u8*)&setup.swizzle_data[i], sizeof(setup.swizzle_data[i])); 244 QueueForWriting(reinterpret_cast<const u8*>(&setup.swizzle_data[i]), sizeof(setup.swizzle_data[i]));
245 QueueForWriting((u8*)&dummy, sizeof(dummy)); 245 QueueForWriting(reinterpret_cast<const u8*>(&dummy), sizeof(dummy));
246 } 246 }
247 247
248 dvle.main_offset_words = config.main_offset; 248 dvle.main_offset_words = config.main_offset;
249 dvle.output_register_table_offset = write_offset - dvlb.dvle_offset; 249 dvle.output_register_table_offset = write_offset - dvlb.dvle_offset;
250 dvle.output_register_table_size = static_cast<u32>(output_info_table.size()); 250 dvle.output_register_table_size = static_cast<u32>(output_info_table.size());
251 QueueForWriting((u8*)output_info_table.data(), static_cast<u32>(output_info_table.size() * sizeof(OutputRegisterInfo))); 251 QueueForWriting(reinterpret_cast<const u8*>(output_info_table.data()), static_cast<u32>(output_info_table.size() * sizeof(OutputRegisterInfo)));
252 252
253 // TODO: Create a label table for "main" 253 // TODO: Create a label table for "main"
254 254
@@ -292,14 +292,14 @@ void DumpShader(const std::string& filename, const Regs::ShaderConfig& config, c
292 dvle.constant_table_offset = write_offset - dvlb.dvle_offset; 292 dvle.constant_table_offset = write_offset - dvlb.dvle_offset;
293 dvle.constant_table_size = constant_table.size(); 293 dvle.constant_table_size = constant_table.size();
294 for (const auto& constant : constant_table) { 294 for (const auto& constant : constant_table) {
295 QueueForWriting((uint8_t*)&constant, sizeof(constant)); 295 QueueForWriting(reinterpret_cast<const u8*>(&constant), sizeof(constant));
296 } 296 }
297 297
298 // Write data to file 298 // Write data to file
299 std::ofstream file(filename, std::ios_base::out | std::ios_base::binary); 299 std::ofstream file(filename, std::ios_base::out | std::ios_base::binary);
300 300
301 for (auto& chunk : writing_queue) { 301 for (const auto& chunk : writing_queue) {
302 file.write((char*)chunk.pointer, chunk.size); 302 file.write(reinterpret_cast<const char*>(chunk.pointer), chunk.size);
303 } 303 }
304} 304}
305 305
diff --git a/src/video_core/shader/shader_interpreter.cpp b/src/video_core/shader/shader_interpreter.cpp
index 2dc8d5d5e..9b978583e 100644
--- a/src/video_core/shader/shader_interpreter.cpp
+++ b/src/video_core/shader/shader_interpreter.cpp
@@ -407,7 +407,7 @@ void RunInterpreter(UnitState<Debug>& state) {
407 { 407 {
408 if ((instr.opcode.Value().EffectiveOpCode() == OpCode::Id::MAD) || 408 if ((instr.opcode.Value().EffectiveOpCode() == OpCode::Id::MAD) ||
409 (instr.opcode.Value().EffectiveOpCode() == OpCode::Id::MADI)) { 409 (instr.opcode.Value().EffectiveOpCode() == OpCode::Id::MADI)) {
410 const SwizzlePattern& swizzle = *(SwizzlePattern*)&swizzle_data[instr.mad.operand_desc_id]; 410 const SwizzlePattern& swizzle = *reinterpret_cast<const SwizzlePattern*>(&swizzle_data[instr.mad.operand_desc_id]);
411 411
412 bool is_inverted = (instr.opcode.Value().EffectiveOpCode() == OpCode::Id::MADI); 412 bool is_inverted = (instr.opcode.Value().EffectiveOpCode() == OpCode::Id::MADI);
413 413