summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CMakeLists.txt2
-rw-r--r--src/core/hle/service/ac_u.cpp20
-rw-r--r--src/core/hle/service/dsp_dsp.cpp69
-rw-r--r--src/core/hle/service/hid_user.cpp4
-rw-r--r--src/core/hle/service/hid_user.h4
-rw-r--r--src/core/hle/service/ptm_u.cpp94
-rw-r--r--src/core/mem_map.h6
-rw-r--r--src/video_core/command_processor.cpp2
-rw-r--r--src/video_core/debug_utils/debug_utils.cpp8
-rw-r--r--src/video_core/renderer_opengl/renderer_opengl.cpp2
10 files changed, 169 insertions, 42 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index bbe9f76cd..05a560404 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -9,6 +9,8 @@ if (NOT MSVC)
9else() 9else()
10 # Silence deprecation warnings 10 # Silence deprecation warnings
11 add_definitions(/D_CRT_SECURE_NO_WARNINGS) 11 add_definitions(/D_CRT_SECURE_NO_WARNINGS)
12 # set up output paths for executable binaries (.exe-files, and .dll-files on DLL-capable platforms)
13 set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
12endif() 14endif()
13add_definitions(-DSINGLETHREADED) 15add_definitions(-DSINGLETHREADED)
14 16
diff --git a/src/core/hle/service/ac_u.cpp b/src/core/hle/service/ac_u.cpp
index 9af96f6b8..46aee40d6 100644
--- a/src/core/hle/service/ac_u.cpp
+++ b/src/core/hle/service/ac_u.cpp
@@ -11,6 +11,24 @@
11 11
12namespace AC_U { 12namespace AC_U {
13 13
14/**
15 * AC_U::GetWifiStatus service function
16 * Outputs:
17 * 1 : Result of function, 0 on success, otherwise error code
18 * 2 : Output connection type, 0 = none, 1 = Old3DS Internet, 2 = New3DS Internet.
19 */
20void GetWifiStatus(Service::Interface* self) {
21 u32* cmd_buff = Service::GetCommandBuffer();
22
23 // TODO(purpasmart96): This function is only a stub,
24 // it returns a valid result without implementing full functionality.
25
26 cmd_buff[1] = 0; // No error
27 cmd_buff[2] = 0; // Connection type set to none
28
29 WARN_LOG(KERNEL, "(STUBBED) called");
30}
31
14const Interface::FunctionInfo FunctionTable[] = { 32const Interface::FunctionInfo FunctionTable[] = {
15 {0x00010000, nullptr, "CreateDefaultConfig"}, 33 {0x00010000, nullptr, "CreateDefaultConfig"},
16 {0x00040006, nullptr, "ConnectAsync"}, 34 {0x00040006, nullptr, "ConnectAsync"},
@@ -18,7 +36,7 @@ const Interface::FunctionInfo FunctionTable[] = {
18 {0x00080004, nullptr, "CloseAsync"}, 36 {0x00080004, nullptr, "CloseAsync"},
19 {0x00090002, nullptr, "GetCloseResult"}, 37 {0x00090002, nullptr, "GetCloseResult"},
20 {0x000A0000, nullptr, "GetLastErrorCode"}, 38 {0x000A0000, nullptr, "GetLastErrorCode"},
21 {0x000D0000, nullptr, "GetWifiStatus"}, 39 {0x000D0000, GetWifiStatus, "GetWifiStatus"},
22 {0x000E0042, nullptr, "GetCurrentAPInfo"}, 40 {0x000E0042, nullptr, "GetCurrentAPInfo"},
23 {0x00100042, nullptr, "GetCurrentNZoneInfo"}, 41 {0x00100042, nullptr, "GetCurrentNZoneInfo"},
24 {0x00110042, nullptr, "GetNZoneApNumService"}, 42 {0x00110042, nullptr, "GetNZoneApNumService"},
diff --git a/src/core/hle/service/dsp_dsp.cpp b/src/core/hle/service/dsp_dsp.cpp
index a2b68cac8..72be4c817 100644
--- a/src/core/hle/service/dsp_dsp.cpp
+++ b/src/core/hle/service/dsp_dsp.cpp
@@ -16,6 +16,25 @@ static Handle semaphore_event;
16static Handle interrupt_event; 16static Handle interrupt_event;
17 17
18/** 18/**
19 * DSP_DSP::ConvertProcessAddressFromDspDram service function
20 * Inputs:
21 * 1 : Address
22 * Outputs:
23 * 1 : Result of function, 0 on success, otherwise error code
24 * 2 : (inaddr << 1) + 0x1FF40000 (where 0x1FF00000 is the DSP RAM address)
25 */
26void ConvertProcessAddressFromDspDram(Service::Interface* self) {
27 u32* cmd_buff = Service::GetCommandBuffer();
28
29 u32 addr = cmd_buff[1];
30
31 cmd_buff[1] = 0; // No error
32 cmd_buff[2] = (addr << 1) + (Memory::DSP_MEMORY_VADDR + 0x40000);
33
34 DEBUG_LOG(KERNEL, "(STUBBED) called with address %u", addr);
35}
36
37/**
19 * DSP_DSP::LoadComponent service function 38 * DSP_DSP::LoadComponent service function
20 * Inputs: 39 * Inputs:
21 * 1 : Size 40 * 1 : Size
@@ -90,31 +109,31 @@ void WriteReg0x10(Service::Interface* self) {
90} 109}
91 110
92const Interface::FunctionInfo FunctionTable[] = { 111const Interface::FunctionInfo FunctionTable[] = {
93 {0x00010040, nullptr, "RecvData"}, 112 {0x00010040, nullptr, "RecvData"},
94 {0x00020040, nullptr, "RecvDataIsReady"}, 113 {0x00020040, nullptr, "RecvDataIsReady"},
95 {0x00030080, nullptr, "SendData"}, 114 {0x00030080, nullptr, "SendData"},
96 {0x00040040, nullptr, "SendDataIsEmpty"}, 115 {0x00040040, nullptr, "SendDataIsEmpty"},
97 {0x00070040, WriteReg0x10, "WriteReg0x10"}, 116 {0x00070040, WriteReg0x10, "WriteReg0x10"},
98 {0x00080000, nullptr, "GetSemaphore"}, 117 {0x00080000, nullptr, "GetSemaphore"},
99 {0x00090040, nullptr, "ClearSemaphore"}, 118 {0x00090040, nullptr, "ClearSemaphore"},
100 {0x000B0000, nullptr, "CheckSemaphoreRequest"}, 119 {0x000B0000, nullptr, "CheckSemaphoreRequest"},
101 {0x000C0040, nullptr, "ConvertProcessAddressFromDspDram"}, 120 {0x000C0040, ConvertProcessAddressFromDspDram, "ConvertProcessAddressFromDspDram"},
102 {0x000D0082, nullptr, "WriteProcessPipe"}, 121 {0x000D0082, nullptr, "WriteProcessPipe"},
103 {0x001000C0, nullptr, "ReadPipeIfPossible"}, 122 {0x001000C0, nullptr, "ReadPipeIfPossible"},
104 {0x001100C2, LoadComponent, "LoadComponent"}, 123 {0x001100C2, LoadComponent, "LoadComponent"},
105 {0x00120000, nullptr, "UnloadComponent"}, 124 {0x00120000, nullptr, "UnloadComponent"},
106 {0x00130082, nullptr, "FlushDataCache"}, 125 {0x00130082, nullptr, "FlushDataCache"},
107 {0x00140082, nullptr, "InvalidateDCache"}, 126 {0x00140082, nullptr, "InvalidateDCache"},
108 {0x00150082, RegisterInterruptEvents, "RegisterInterruptEvents"}, 127 {0x00150082, RegisterInterruptEvents, "RegisterInterruptEvents"},
109 {0x00160000, GetSemaphoreEventHandle, "GetSemaphoreEventHandle"}, 128 {0x00160000, GetSemaphoreEventHandle, "GetSemaphoreEventHandle"},
110 {0x00170040, nullptr, "SetSemaphoreMask"}, 129 {0x00170040, nullptr, "SetSemaphoreMask"},
111 {0x00180040, nullptr, "GetPhysicalAddress"}, 130 {0x00180040, nullptr, "GetPhysicalAddress"},
112 {0x00190040, nullptr, "GetVirtualAddress"}, 131 {0x00190040, nullptr, "GetVirtualAddress"},
113 {0x001A0042, nullptr, "SetIirFilterI2S1_cmd1"}, 132 {0x001A0042, nullptr, "SetIirFilterI2S1_cmd1"},
114 {0x001B0042, nullptr, "SetIirFilterI2S1_cmd2"}, 133 {0x001B0042, nullptr, "SetIirFilterI2S1_cmd2"},
115 {0x001C0082, nullptr, "SetIirFilterEQ"}, 134 {0x001C0082, nullptr, "SetIirFilterEQ"},
116 {0x001F0000, nullptr, "GetHeadphoneStatus"}, 135 {0x001F0000, nullptr, "GetHeadphoneStatus"},
117 {0x00210000, nullptr, "GetIsDspOccupied"}, 136 {0x00210000, nullptr, "GetIsDspOccupied"},
118}; 137};
119 138
120//////////////////////////////////////////////////////////////////////////////////////////////////// 139////////////////////////////////////////////////////////////////////////////////////////////////////
diff --git a/src/core/hle/service/hid_user.cpp b/src/core/hle/service/hid_user.cpp
index d29de1a52..2abaf0f2f 100644
--- a/src/core/hle/service/hid_user.cpp
+++ b/src/core/hle/service/hid_user.cpp
@@ -55,7 +55,7 @@ static void UpdateNextCirclePadState() {
55/** 55/**
56 * Sets a Pad state (button or button combo) as pressed 56 * Sets a Pad state (button or button combo) as pressed
57 */ 57 */
58void PadButtonPress(PadState pad_state) { 58void PadButtonPress(const PadState& pad_state) {
59 next_state.hex |= pad_state.hex; 59 next_state.hex |= pad_state.hex;
60 UpdateNextCirclePadState(); 60 UpdateNextCirclePadState();
61} 61}
@@ -63,7 +63,7 @@ void PadButtonPress(PadState pad_state) {
63/** 63/**
64 * Sets a Pad state (button or button combo) as released 64 * Sets a Pad state (button or button combo) as released
65 */ 65 */
66void PadButtonRelease(PadState pad_state) { 66void PadButtonRelease(const PadState& pad_state) {
67 next_state.hex &= ~pad_state.hex; 67 next_state.hex &= ~pad_state.hex;
68 UpdateNextCirclePadState(); 68 UpdateNextCirclePadState();
69} 69}
diff --git a/src/core/hle/service/hid_user.h b/src/core/hle/service/hid_user.h
index 5ed97085d..8f53befdb 100644
--- a/src/core/hle/service/hid_user.h
+++ b/src/core/hle/service/hid_user.h
@@ -93,8 +93,8 @@ const PadState PAD_CIRCLE_UP = {{1u << 30}};
93const PadState PAD_CIRCLE_DOWN = {{1u << 31}}; 93const PadState PAD_CIRCLE_DOWN = {{1u << 31}};
94 94
95// Methods for updating the HID module's state 95// Methods for updating the HID module's state
96void PadButtonPress(PadState pad_state); 96void PadButtonPress(const PadState& pad_state);
97void PadButtonRelease(PadState pad_state); 97void PadButtonRelease(const PadState& pad_state);
98void PadUpdateComplete(); 98void PadUpdateComplete();
99 99
100/** 100/**
diff --git a/src/core/hle/service/ptm_u.cpp b/src/core/hle/service/ptm_u.cpp
index d9122dbbc..941df467b 100644
--- a/src/core/hle/service/ptm_u.cpp
+++ b/src/core/hle/service/ptm_u.cpp
@@ -11,15 +11,101 @@
11 11
12namespace PTM_U { 12namespace PTM_U {
13 13
14/// Charge levels used by PTM functions
15enum class ChargeLevels : u32 {
16 CriticalBattery = 1,
17 LowBattery = 2,
18 HalfFull = 3,
19 MostlyFull = 4,
20 CompletelyFull = 5,
21};
22
23static bool shell_open = true;
24
25static bool battery_is_charging = true;
26
27/**
28 * It is unknown if GetAdapterState is the same as GetBatteryChargeState,
29 * it is likely to just be a duplicate function of GetBatteryChargeState
30 * that controls another part of the HW.
31 * PTM_U::GetAdapterState service function
32 * Outputs:
33 * 1 : Result of function, 0 on success, otherwise error code
34 * 2 : Output of function, 0 = not charging, 1 = charging.
35 */
36static void GetAdapterState(Service::Interface* self) {
37 u32* cmd_buff = Service::GetCommandBuffer();
38
39 // TODO(purpasmart96): This function is only a stub,
40 // it returns a valid result without implementing full functionality.
41
42 cmd_buff[1] = 0; // No error
43 cmd_buff[2] = battery_is_charging ? 1 : 0;
44
45 WARN_LOG(KERNEL, "(STUBBED) called");
46}
47
48/*
49 * PTM_User::GetShellState service function.
50 * Outputs:
51 * 1 : Result of function, 0 on success, otherwise error code
52 * 2 : Whether the 3DS's physical shell casing is open (1) or closed (0)
53 */
54static void GetShellState(Service::Interface* self) {
55 u32* cmd_buff = Service::GetCommandBuffer();
56
57 cmd_buff[1] = 0;
58 cmd_buff[2] = shell_open ? 1 : 0;
59
60 DEBUG_LOG(KERNEL, "PTM_U::GetShellState called");
61}
62
63/**
64 * PTM_U::GetBatteryLevel service function
65 * Outputs:
66 * 1 : Result of function, 0 on success, otherwise error code
67 * 2 : Battery level, 5 = completely full battery, 4 = mostly full battery,
68 * 3 = half full battery, 2 = low battery, 1 = critical battery.
69 */
70static void GetBatteryLevel(Service::Interface* self) {
71 u32* cmd_buff = Service::GetCommandBuffer();
72
73 // TODO(purpasmart96): This function is only a stub,
74 // it returns a valid result without implementing full functionality.
75
76 cmd_buff[1] = 0; // No error
77 cmd_buff[2] = static_cast<u32>(ChargeLevels::CompletelyFull); // Set to a completely full battery
78
79 WARN_LOG(KERNEL, "(STUBBED) called");
80}
81
82/**
83 * PTM_U::GetBatteryChargeState service function
84 * Outputs:
85 * 1 : Result of function, 0 on success, otherwise error code
86 * 2 : Output of function, 0 = not charging, 1 = charging.
87 */
88static void GetBatteryChargeState(Service::Interface* self) {
89 u32* cmd_buff = Service::GetCommandBuffer();
90
91 // TODO(purpasmart96): This function is only a stub,
92 // it returns a valid result without implementing full functionality.
93
94 cmd_buff[1] = 0; // No error
95 cmd_buff[2] = battery_is_charging ? 1 : 0;
96
97 WARN_LOG(KERNEL, "(STUBBED) called");
98}
99
14const Interface::FunctionInfo FunctionTable[] = { 100const Interface::FunctionInfo FunctionTable[] = {
15 {0x00010002, nullptr, "RegisterAlarmClient"}, 101 {0x00010002, nullptr, "RegisterAlarmClient"},
16 {0x00020080, nullptr, "SetRtcAlarm"}, 102 {0x00020080, nullptr, "SetRtcAlarm"},
17 {0x00030000, nullptr, "GetRtcAlarm"}, 103 {0x00030000, nullptr, "GetRtcAlarm"},
18 {0x00040000, nullptr, "CancelRtcAlarm"}, 104 {0x00040000, nullptr, "CancelRtcAlarm"},
19 {0x00050000, nullptr, "GetAdapterState"}, 105 {0x00050000, GetAdapterState, "GetAdapterState"},
20 {0x00060000, nullptr, "GetShellState"}, 106 {0x00060000, GetShellState, "GetShellState"},
21 {0x00070000, nullptr, "GetBatteryLevel"}, 107 {0x00070000, GetBatteryLevel, "GetBatteryLevel"},
22 {0x00080000, nullptr, "GetBatteryChargeState"}, 108 {0x00080000, GetBatteryChargeState, "GetBatteryChargeState"},
23 {0x00090000, nullptr, "GetPedometerState"}, 109 {0x00090000, nullptr, "GetPedometerState"},
24 {0x000A0042, nullptr, "GetStepHistoryEntry"}, 110 {0x000A0042, nullptr, "GetStepHistoryEntry"},
25 {0x000B00C2, nullptr, "GetStepHistory"}, 111 {0x000B00C2, nullptr, "GetStepHistory"},
diff --git a/src/core/mem_map.h b/src/core/mem_map.h
index a58c59244..c9529f84c 100644
--- a/src/core/mem_map.h
+++ b/src/core/mem_map.h
@@ -16,10 +16,9 @@ typedef u32 PAddr; ///< Represents a pointer in the physical address space.
16 16
17//////////////////////////////////////////////////////////////////////////////////////////////////// 17////////////////////////////////////////////////////////////////////////////////////////////////////
18 18
19enum { 19enum : u32 {
20 BOOTROM_SIZE = 0x00010000, ///< Bootrom (super secret code/data @ 0x8000) size 20 BOOTROM_SIZE = 0x00010000, ///< Bootrom (super secret code/data @ 0x8000) size
21 MPCORE_PRIV_SIZE = 0x00002000, ///< MPCore private memory region size 21 MPCORE_PRIV_SIZE = 0x00002000, ///< MPCore private memory region size
22 DSP_SIZE = 0x00080000, ///< DSP memory size
23 AXI_WRAM_SIZE = 0x00080000, ///< AXI WRAM size 22 AXI_WRAM_SIZE = 0x00080000, ///< AXI WRAM size
24 23
25 FCRAM_SIZE = 0x08000000, ///< FCRAM size 24 FCRAM_SIZE = 0x08000000, ///< FCRAM size
@@ -34,6 +33,9 @@ enum {
34 SHARED_MEMORY_VADDR_END = (SHARED_MEMORY_VADDR + SHARED_MEMORY_SIZE), 33 SHARED_MEMORY_VADDR_END = (SHARED_MEMORY_VADDR + SHARED_MEMORY_SIZE),
35 SHARED_MEMORY_MASK = (SHARED_MEMORY_SIZE - 1), 34 SHARED_MEMORY_MASK = (SHARED_MEMORY_SIZE - 1),
36 35
36 DSP_MEMORY_SIZE = 0x00080000, ///< DSP memory size
37 DSP_MEMORY_VADDR = 0x1FF00000, ///< DSP memory virtual address
38
37 CONFIG_MEMORY_SIZE = 0x00001000, ///< Configuration memory size 39 CONFIG_MEMORY_SIZE = 0x00001000, ///< Configuration memory size
38 CONFIG_MEMORY_VADDR = 0x1FF80000, ///< Configuration memory virtual address 40 CONFIG_MEMORY_VADDR = 0x1FF80000, ///< Configuration memory virtual address
39 CONFIG_MEMORY_VADDR_END = (CONFIG_MEMORY_VADDR + CONFIG_MEMORY_SIZE), 41 CONFIG_MEMORY_VADDR_END = (CONFIG_MEMORY_VADDR + CONFIG_MEMORY_SIZE),
diff --git a/src/video_core/command_processor.cpp b/src/video_core/command_processor.cpp
index 1ec727698..8a6ba2560 100644
--- a/src/video_core/command_processor.cpp
+++ b/src/video_core/command_processor.cpp
@@ -60,7 +60,7 @@ static inline void WritePicaReg(u32 id, u32 value, u32 mask) {
60 const u8* load_address = base_address + loader_config.data_offset; 60 const u8* load_address = base_address + loader_config.data_offset;
61 61
62 // TODO: What happens if a loader overwrites a previous one's data? 62 // TODO: What happens if a loader overwrites a previous one's data?
63 for (int component = 0; component < loader_config.component_count; ++component) { 63 for (unsigned component = 0; component < loader_config.component_count; ++component) {
64 u32 attribute_index = loader_config.GetComponent(component); 64 u32 attribute_index = loader_config.GetComponent(component);
65 vertex_attribute_sources[attribute_index] = load_address; 65 vertex_attribute_sources[attribute_index] = load_address;
66 vertex_attribute_strides[attribute_index] = static_cast<u32>(loader_config.byte_count); 66 vertex_attribute_strides[attribute_index] = static_cast<u32>(loader_config.byte_count);
diff --git a/src/video_core/debug_utils/debug_utils.cpp b/src/video_core/debug_utils/debug_utils.cpp
index 275b06b7c..8a5f11424 100644
--- a/src/video_core/debug_utils/debug_utils.cpp
+++ b/src/video_core/debug_utils/debug_utils.cpp
@@ -155,7 +155,7 @@ void DumpShader(const u32* binary_data, u32 binary_size, const u32* swizzle_data
155 155
156 // This is put into a try-catch block to make sure we notice unknown configurations. 156 // This is put into a try-catch block to make sure we notice unknown configurations.
157 std::vector<OutputRegisterInfo> output_info_table; 157 std::vector<OutputRegisterInfo> output_info_table;
158 for (int i = 0; i < 7; ++i) { 158 for (unsigned i = 0; i < 7; ++i) {
159 using OutputAttributes = Pica::Regs::VSOutputAttributes; 159 using OutputAttributes = Pica::Regs::VSOutputAttributes;
160 160
161 // TODO: It's still unclear how the attribute components map to the register! 161 // TODO: It's still unclear how the attribute components map to the register!
@@ -375,8 +375,8 @@ void DumpTexture(const Pica::Regs::TextureConfig& texture_config, u8* data) {
375 png_write_info(png_ptr, info_ptr); 375 png_write_info(png_ptr, info_ptr);
376 376
377 buf = new u8[row_stride * texture_config.height]; 377 buf = new u8[row_stride * texture_config.height];
378 for (int y = 0; y < texture_config.height; ++y) { 378 for (unsigned y = 0; y < texture_config.height; ++y) {
379 for (int x = 0; x < texture_config.width; ++x) { 379 for (unsigned x = 0; x < texture_config.width; ++x) {
380 // Cf. rasterizer code for an explanation of this algorithm. 380 // Cf. rasterizer code for an explanation of this algorithm.
381 int texel_index_within_tile = 0; 381 int texel_index_within_tile = 0;
382 for (int block_size_index = 0; block_size_index < 3; ++block_size_index) { 382 for (int block_size_index = 0; block_size_index < 3; ++block_size_index) {
@@ -402,7 +402,7 @@ void DumpTexture(const Pica::Regs::TextureConfig& texture_config, u8* data) {
402 } 402 }
403 403
404 // Write image data 404 // Write image data
405 for (auto y = 0; y < texture_config.height; ++y) 405 for (unsigned y = 0; y < texture_config.height; ++y)
406 { 406 {
407 u8* row_ptr = (u8*)buf + y * row_stride; 407 u8* row_ptr = (u8*)buf + y * row_stride;
408 u8* ptr = row_ptr; 408 u8* ptr = row_ptr;
diff --git a/src/video_core/renderer_opengl/renderer_opengl.cpp b/src/video_core/renderer_opengl/renderer_opengl.cpp
index fd44c3f68..06de6afbd 100644
--- a/src/video_core/renderer_opengl/renderer_opengl.cpp
+++ b/src/video_core/renderer_opengl/renderer_opengl.cpp
@@ -61,7 +61,7 @@ void RendererOpenGL::SwapBuffers() {
61 for(int i : {0, 1}) { 61 for(int i : {0, 1}) {
62 const auto& framebuffer = GPU::g_regs.framebuffer_config[i]; 62 const auto& framebuffer = GPU::g_regs.framebuffer_config[i];
63 63
64 if (textures[i].width != framebuffer.width || textures[i].height != framebuffer.height) { 64 if (textures[i].width != (GLsizei)framebuffer.width || textures[i].height != (GLsizei)framebuffer.height) {
65 // Reallocate texture if the framebuffer size has changed. 65 // Reallocate texture if the framebuffer size has changed.
66 // This is expected to not happen very often and hence should not be a 66 // This is expected to not happen very often and hence should not be a
67 // performance problem. 67 // performance problem.