diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/core/hle/service/ac_u.cpp | 20 | ||||
| -rw-r--r-- | src/core/hle/service/ptm_u.cpp | 94 | ||||
| -rw-r--r-- | src/video_core/command_processor.cpp | 2 | ||||
| -rw-r--r-- | src/video_core/debug_utils/debug_utils.cpp | 8 | ||||
| -rw-r--r-- | src/video_core/renderer_opengl/renderer_opengl.cpp | 2 |
5 files changed, 115 insertions, 11 deletions
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 | ||
| 12 | namespace AC_U { | 12 | namespace 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 | */ | ||
| 20 | void 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 | |||
| 14 | const Interface::FunctionInfo FunctionTable[] = { | 32 | const 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/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 | ||
| 12 | namespace PTM_U { | 12 | namespace PTM_U { |
| 13 | 13 | ||
| 14 | /// Charge levels used by PTM functions | ||
| 15 | enum class ChargeLevels : u32 { | ||
| 16 | CriticalBattery = 1, | ||
| 17 | LowBattery = 2, | ||
| 18 | HalfFull = 3, | ||
| 19 | MostlyFull = 4, | ||
| 20 | CompletelyFull = 5, | ||
| 21 | }; | ||
| 22 | |||
| 23 | static bool shell_open = true; | ||
| 24 | |||
| 25 | static 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 | */ | ||
| 36 | static 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 | */ | ||
| 54 | static 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 | */ | ||
| 70 | static 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 | */ | ||
| 88 | static 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 | |||
| 14 | const Interface::FunctionInfo FunctionTable[] = { | 100 | const 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/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. |