diff options
| -rw-r--r-- | CMakeLists.txt | 13 | ||||
| -rw-r--r-- | dist/citra.desktop | 14 | ||||
| -rw-r--r-- | dist/citra.svg | 80 | ||||
| -rw-r--r-- | dist/citra.xml | 59 | ||||
| -rw-r--r-- | src/core/arm/dyncom/arm_dyncom_interpreter.cpp | 2 | ||||
| -rw-r--r-- | src/core/hle/service/ptm/ptm.cpp | 50 | ||||
| -rw-r--r-- | src/core/hle/service/ptm/ptm.h | 42 | ||||
| -rw-r--r-- | src/core/hle/service/ptm/ptm_play.cpp | 8 | ||||
| -rw-r--r-- | src/core/hle/service/ptm/ptm_sysm.cpp | 75 | ||||
| -rw-r--r-- | src/core/hle/service/ptm/ptm_u.cpp | 62 |
10 files changed, 279 insertions, 126 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index b0fe285db..dc525aa3d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt | |||
| @@ -193,3 +193,16 @@ if(ENABLE_QT) | |||
| 193 | add_subdirectory(externals/qhexedit) | 193 | add_subdirectory(externals/qhexedit) |
| 194 | endif() | 194 | endif() |
| 195 | add_subdirectory(src) | 195 | add_subdirectory(src) |
| 196 | |||
| 197 | # Install freedesktop.org metadata files, following those specifications: | ||
| 198 | # http://standards.freedesktop.org/desktop-entry-spec/desktop-entry-spec-latest.html | ||
| 199 | # http://standards.freedesktop.org/icon-theme-spec/icon-theme-spec-latest.html | ||
| 200 | # http://standards.freedesktop.org/shared-mime-info-spec/shared-mime-info-spec-latest.html | ||
| 201 | if(${CMAKE_SYSTEM_NAME} MATCHES "Linux|FreeBSD|OpenBSD|NetBSD") | ||
| 202 | install(FILES "${CMAKE_SOURCE_DIR}/dist/citra.desktop" | ||
| 203 | DESTINATION "${CMAKE_INSTALL_PREFIX}/share/applications") | ||
| 204 | install(FILES "${CMAKE_SOURCE_DIR}/dist/citra.svg" | ||
| 205 | DESTINATION "${CMAKE_INSTALL_PREFIX}/share/pixmaps") | ||
| 206 | install(FILES "${CMAKE_SOURCE_DIR}/dist/citra.xml" | ||
| 207 | DESTINATION "${CMAKE_INSTALL_PREFIX}/share/mime/packages") | ||
| 208 | endif() | ||
diff --git a/dist/citra.desktop b/dist/citra.desktop new file mode 100644 index 000000000..1300d62c2 --- /dev/null +++ b/dist/citra.desktop | |||
| @@ -0,0 +1,14 @@ | |||
| 1 | [Desktop Entry] | ||
| 2 | Version=1.0 | ||
| 3 | Type=Application | ||
| 4 | Name=Citra | ||
| 5 | GenericName=3DS Emulator | ||
| 6 | GenericName[fr]=Émulateur 3DS | ||
| 7 | Comment=Nintendo 3DS video game console emulator | ||
| 8 | Comment[fr]=Émulateur de console de jeu Nintendo 3DS | ||
| 9 | Icon=citra | ||
| 10 | TryExec=citra-qt | ||
| 11 | Exec=citra-qt %f | ||
| 12 | Categories=Game;Emulator;Qt; | ||
| 13 | MimeType=application/x-ctr-3dsx;application/x-ctr-cci;application/x-ctr-cia;application/x-ctr-cxi; | ||
| 14 | Keywords=3DS;Nintendo; | ||
diff --git a/dist/citra.svg b/dist/citra.svg new file mode 100644 index 000000000..7b299cd89 --- /dev/null +++ b/dist/citra.svg | |||
| @@ -0,0 +1,80 @@ | |||
| 1 | <?xml version="1.0" encoding="UTF-8"?> | ||
| 2 | <!-- | ||
| 3 | Copyright 2014 Citra Emulator Project | ||
| 4 | Licensed under GPLv2 or any later version | ||
| 5 | Refer to the license.txt file included. | ||
| 6 | --> | ||
| 7 | <svg version="1.1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 341.071 338.846"> | ||
| 8 | <radialGradient id="a" cx="170.5356" cy="167.271" r="170.5332" gradientTransform="matrix(1 0 0 0.9935 0 3.2396)" gradientUnits="userSpaceOnUse"> | ||
| 9 | <stop offset="0.5193" stop-color="#FFFFFF" stop-opacity="0.1"/> | ||
| 10 | <stop offset="0.9415" stop-color="#000000" stop-opacity="0.5"/> | ||
| 11 | <stop offset="1" stop-color="#1A1818" stop-opacity="0"/> | ||
| 12 | </radialGradient> | ||
| 13 | <ellipse fill="url(#a)" cx="170.535" cy="169.423" rx="170.535" ry="169.423"/> | ||
| 14 | <circle fill="#D16F17" cx="170.536" cy="167.885" r="161.557"/> | ||
| 15 | <linearGradient id="b" gradientUnits="userSpaceOnUse" x1="234.4458" y1="33.5771" x2="97.5655" y2="321.2358"> | ||
| 16 | <stop offset="0" stop-color="#FFF8BD"/> | ||
| 17 | <stop offset="1" stop-color="#F6DCAE"/> | ||
| 18 | </linearGradient> | ||
| 19 | <circle fill="url(#b)" cx="170.536" cy="167.885" r="155.295"/> | ||
| 20 | <g> | ||
| 21 | <linearGradient id="c" gradientUnits="userSpaceOnUse" x1="332.436" y1="91.7446" x2="111.1593" y2="342.0988"> | ||
| 22 | <stop offset="0" stop-color="#F7A076"/> | ||
| 23 | <stop offset="0.4455" stop-color="#F3816C"/> | ||
| 24 | <stop offset="1" stop-color="#F06878"/> | ||
| 25 | </linearGradient> | ||
| 26 | <path fill="url(#c)" stroke="#F06564" stroke-miterlimit="10" d="M309.704,123.138 | ||
| 27 | c-5.9-7.802-128.517,44.681-128.517,44.681S303.803,221.01,309.704,212.5C322.434,194.142,323.182,140.957,309.704,123.138z"/> | ||
| 28 | <linearGradient id="d" gradientUnits="userSpaceOnUse" x1="285.5845" y1="50.3345" x2="64.3074" y2="300.6891"> | ||
| 29 | <stop offset="0" stop-color="#9DC63B"/> | ||
| 30 | <stop offset="1" stop-color="#9BC183"/> | ||
| 31 | </linearGradient> | ||
| 32 | <path fill="url(#d)" stroke="#72AA42" stroke-miterlimit="10" d="M300.518,100.96c-3.98-21.983-41.059-60.12-63.189-63.188 | ||
| 33 | c-9.688-1.345-59.28,122.469-59.28,122.469S302.364,111.149,300.518,100.96z"/> | ||
| 34 | <linearGradient id="e" gradientUnits="userSpaceOnUse" x1="229.4995" y1="0.7637" x2="8.2231" y2="251.1176"> | ||
| 35 | <stop offset="0" stop-color="#D5DE26"/> | ||
| 36 | <stop offset="1" stop-color="#C5D94B"/> | ||
| 37 | </linearGradient> | ||
| 38 | <path fill="url(#e)" stroke="#BECD30" stroke-miterlimit="10" d="M215.151,28.584c-18.357-12.73-71.543-13.478-89.362,0.001 | ||
| 39 | c-7.801,5.899,44.682,128.516,44.682,128.516S223.663,34.484,215.151,28.584z"/> | ||
| 40 | <linearGradient id="f" gradientUnits="userSpaceOnUse" x1="219.3823" y1="-8.1782" x2="-1.8941" y2="242.1756"> | ||
| 41 | <stop offset="0" stop-color="#F2D200"/> | ||
| 42 | <stop offset="1" stop-color="#FDEF52"/> | ||
| 43 | </linearGradient> | ||
| 44 | <path fill="url(#f)" stroke="#E1BE29" stroke-miterlimit="10" d="M162.893,160.239c0,0-49.092-124.315-59.281-122.469 | ||
| 45 | c-21.982,3.979-60.12,41.058-63.188,63.189C39.078,110.646,162.893,160.239,162.893,160.239z"/> | ||
| 46 | <linearGradient id="g" gradientUnits="userSpaceOnUse" x1="226.0718" y1="-2.2656" x2="4.7951" y2="248.0886"> | ||
| 47 | <stop offset="0" stop-color="#FFCD10"/> | ||
| 48 | <stop offset="1" stop-color="#F29634"/> | ||
| 49 | </linearGradient> | ||
| 50 | <path fill="url(#g)" stroke="#F79421" stroke-miterlimit="10" d="M31.236,123.136c-12.73,18.357-13.479,71.543,0,89.362 | ||
| 51 | c5.898,7.801,128.516-44.682,128.516-44.682S37.135,114.625,31.236,123.136z"/> | ||
| 52 | <linearGradient id="h" gradientUnits="userSpaceOnUse" x1="272.9214" y1="39.144" x2="51.6446" y2="289.4984"> | ||
| 53 | <stop offset="0" stop-color="#F79F1C"/> | ||
| 54 | <stop offset="0.4455" stop-color="#F08021"/> | ||
| 55 | <stop offset="1" stop-color="#ED693C"/> | ||
| 56 | </linearGradient> | ||
| 57 | <path fill="url(#h)" stroke="#F16622" stroke-miterlimit="10" d="M40.422,234.676c3.979,21.982,41.057,60.12,63.188,63.188 | ||
| 58 | c9.687,1.346,59.279-122.468,59.279-122.468S38.574,224.487,40.422,234.676z"/> | ||
| 59 | <linearGradient id="i" gradientUnits="userSpaceOnUse" x1="329.0083" y1="88.7129" x2="107.7311" y2="339.0677"> | ||
| 60 | <stop offset="0" stop-color="#E47C26"/> | ||
| 61 | <stop offset="0.4455" stop-color="#DF5B27"/> | ||
| 62 | <stop offset="1" stop-color="#DD3A3A"/> | ||
| 63 | </linearGradient> | ||
| 64 | <path fill="url(#i)" stroke="#E03827" stroke-miterlimit="10" d="M125.787,307.051c18.357,12.73,71.543,13.48,89.362,0 | ||
| 65 | c7.801-5.898-44.681-128.515-44.681-128.515S117.275,301.153,125.787,307.051z"/> | ||
| 66 | <linearGradient id="j" gradientUnits="userSpaceOnUse" x1="339.1245" y1="97.6562" x2="117.8478" y2="348.0104"> | ||
| 67 | <stop offset="0" stop-color="#F3783C"/> | ||
| 68 | <stop offset="0.4455" stop-color="#EF5339"/> | ||
| 69 | <stop offset="1" stop-color="#ED294A"/> | ||
| 70 | </linearGradient> | ||
| 71 | <path fill="url(#j)" stroke="#ED2836" stroke-miterlimit="10" d="M178.047,175.398c0,0,49.09,124.315,59.28,122.467 | ||
| 72 | c21.982-3.979,60.121-41.057,63.189-63.188C301.86,224.991,178.047,175.398,178.047,175.398z"/> | ||
| 73 | </g> | ||
| 74 | <linearGradient id="k" gradientUnits="userSpaceOnUse" x1="170.5352" y1="6.3281" x2="170.5351" y2="329.4424"> | ||
| 75 | <stop offset="0" stop-color="#FFFFFF" stop-opacity="0.2"/> | ||
| 76 | <stop offset="0.4504" stop-color="#908E8E" stop-opacity="0.05"/> | ||
| 77 | <stop offset="1" stop-color="#030003" stop-opacity="0.2"/> | ||
| 78 | </linearGradient> | ||
| 79 | <circle fill="url(#k)" cx="170.536" cy="167.885" r="161.557"/> | ||
| 80 | </svg> | ||
diff --git a/dist/citra.xml b/dist/citra.xml new file mode 100644 index 000000000..bcb9acd87 --- /dev/null +++ b/dist/citra.xml | |||
| @@ -0,0 +1,59 @@ | |||
| 1 | <?xml version="1.0" encoding="UTF-8"?> | ||
| 2 | <mime-info xmlns="http://www.freedesktop.org/standards/shared-mime-info"> | ||
| 3 | <mime-type type="application/x-ctr-3dsx"> | ||
| 4 | <comment>3DS homebrew executable</comment> | ||
| 5 | <comment xml:lang="fr">Exécutable 3DS homebrew</comment> | ||
| 6 | <acronym>3DSX</acronym> | ||
| 7 | <icon name="citra"/> | ||
| 8 | <glob pattern="*.3dsx"/> | ||
| 9 | <magic><match value="3DSX" type="string" offset="0"/></magic> | ||
| 10 | </mime-type> | ||
| 11 | |||
| 12 | <mime-type type="application/x-ctr-cci"> | ||
| 13 | <comment>3DS cartridge image</comment> | ||
| 14 | <comment xml:lang="fr">Image de cartouche 3DS</comment> | ||
| 15 | <acronym>CCI</acronym> | ||
| 16 | <expanded-acronym>CTR Cart Image</expanded-acronym> | ||
| 17 | <icon name="citra"/> | ||
| 18 | <glob pattern="*.cci"/> | ||
| 19 | <glob pattern="*.3ds"/> | ||
| 20 | <magic><match value="NCSD" type="string" offset="256"/></magic> | ||
| 21 | </mime-type> | ||
| 22 | |||
| 23 | <mime-type type="application/x-ctr-cxi"> | ||
| 24 | <comment>3DS executable</comment> | ||
| 25 | <comment xml:lang="fr">Exécutable 3DS</comment> | ||
| 26 | <acronym>CXI</acronym> | ||
| 27 | <expanded-acronym>CTR eXecutable Image</expanded-acronym> | ||
| 28 | <icon name="citra"/> | ||
| 29 | <glob pattern="*.cxi"/> | ||
| 30 | <magic><match value="NCCH" type="string" offset="256"/></magic> | ||
| 31 | </mime-type> | ||
| 32 | |||
| 33 | <mime-type type="application/x-ctr-cia"> | ||
| 34 | <comment>3DS importable archive</comment> | ||
| 35 | <comment xml:lang="fr">Archive importable 3DS</comment> | ||
| 36 | <acronym>CIA</acronym> | ||
| 37 | <expanded-acronym>CTR Importable Archive</expanded-acronym> | ||
| 38 | <icon name="citra"/> | ||
| 39 | <glob pattern="*.cia"/> | ||
| 40 | </mime-type> | ||
| 41 | |||
| 42 | <mime-type type="application/x-ctr-smdh"> | ||
| 43 | <comment>3DS icon</comment> | ||
| 44 | <comment xml:lang="fr">Icône 3DS</comment> | ||
| 45 | <acronym>SMDH</acronym> | ||
| 46 | <expanded-acronym>System Menu Data Header</expanded-acronym> | ||
| 47 | <glob pattern="*.smdh"/> | ||
| 48 | <magic><match value="SMDH" type="string" offset="0"/></magic> | ||
| 49 | </mime-type> | ||
| 50 | |||
| 51 | <mime-type type="application/x-ctr-cbmd"> | ||
| 52 | <comment>3DS banner</comment> | ||
| 53 | <comment xml:lang="fr">Bannière 3DS</comment> | ||
| 54 | <acronym>CBMD</acronym> | ||
| 55 | <expanded-acronym>CTR Banner Model Data</expanded-acronym> | ||
| 56 | <glob pattern="*.cbmd"/> | ||
| 57 | <magic><match value="CBMD" type="string" offset="0"/></magic> | ||
| 58 | </mime-type> | ||
| 59 | </mime-info> | ||
diff --git a/src/core/arm/dyncom/arm_dyncom_interpreter.cpp b/src/core/arm/dyncom/arm_dyncom_interpreter.cpp index 315b4cc91..8c52bdb72 100644 --- a/src/core/arm/dyncom/arm_dyncom_interpreter.cpp +++ b/src/core/arm/dyncom/arm_dyncom_interpreter.cpp | |||
| @@ -1393,7 +1393,7 @@ static ARM_INST_PTR INTERPRETER_TRANSLATE(bkpt)(unsigned int inst, int index) | |||
| 1393 | inst_base->br = NON_BRANCH; | 1393 | inst_base->br = NON_BRANCH; |
| 1394 | inst_base->load_r15 = 0; | 1394 | inst_base->load_r15 = 0; |
| 1395 | 1395 | ||
| 1396 | inst_cream->imm = BITS(inst, 8, 19) | BITS(inst, 0, 3); | 1396 | inst_cream->imm = (BITS(inst, 8, 19) << 4) | BITS(inst, 0, 3); |
| 1397 | 1397 | ||
| 1398 | return inst_base; | 1398 | return inst_base; |
| 1399 | } | 1399 | } |
diff --git a/src/core/hle/service/ptm/ptm.cpp b/src/core/hle/service/ptm/ptm.cpp index 6480a323d..2c7d49c9f 100644 --- a/src/core/hle/service/ptm/ptm.cpp +++ b/src/core/hle/service/ptm/ptm.cpp | |||
| @@ -2,6 +2,8 @@ | |||
| 2 | // Licensed under GPLv2 or any later version | 2 | // Licensed under GPLv2 or any later version |
| 3 | // Refer to the license.txt file included. | 3 | // Refer to the license.txt file included. |
| 4 | 4 | ||
| 5 | #include "common/logging/log.h" | ||
| 6 | |||
| 5 | #include "core/file_sys/file_backend.h" | 7 | #include "core/file_sys/file_backend.h" |
| 6 | #include "core/hle/service/fs/archive.h" | 8 | #include "core/hle/service/fs/archive.h" |
| 7 | #include "core/hle/service/ptm/ptm.h" | 9 | #include "core/hle/service/ptm/ptm.h" |
| @@ -23,20 +25,56 @@ static bool shell_open; | |||
| 23 | 25 | ||
| 24 | static bool battery_is_charging; | 26 | static bool battery_is_charging; |
| 25 | 27 | ||
| 26 | u32 GetAdapterState() { | 28 | void GetAdapterState(Service::Interface* self) { |
| 29 | u32* cmd_buff = Kernel::GetCommandBuffer(); | ||
| 30 | |||
| 27 | // TODO(purpasmart96): This function is only a stub, | 31 | // TODO(purpasmart96): This function is only a stub, |
| 28 | // it returns a valid result without implementing full functionality. | 32 | // it returns a valid result without implementing full functionality. |
| 29 | return battery_is_charging ? 1 : 0; | 33 | |
| 34 | cmd_buff[1] = RESULT_SUCCESS.raw; | ||
| 35 | cmd_buff[2] = battery_is_charging ? 1 : 0; | ||
| 36 | |||
| 37 | LOG_WARNING(Service_PTM, "(STUBBED) called"); | ||
| 30 | } | 38 | } |
| 31 | 39 | ||
| 32 | u32 GetShellState() { | 40 | void GetShellState(Service::Interface* self) { |
| 33 | return shell_open ? 1 : 0; | 41 | u32* cmd_buff = Kernel::GetCommandBuffer(); |
| 42 | |||
| 43 | cmd_buff[1] = RESULT_SUCCESS.raw; | ||
| 44 | cmd_buff[2] = shell_open ? 1 : 0; | ||
| 34 | } | 45 | } |
| 35 | 46 | ||
| 36 | ChargeLevels GetBatteryLevel() { | 47 | void GetBatteryLevel(Service::Interface* self) { |
| 48 | u32* cmd_buff = Kernel::GetCommandBuffer(); | ||
| 49 | |||
| 37 | // TODO(purpasmart96): This function is only a stub, | 50 | // TODO(purpasmart96): This function is only a stub, |
| 38 | // it returns a valid result without implementing full functionality. | 51 | // it returns a valid result without implementing full functionality. |
| 39 | return ChargeLevels::CompletelyFull; // Set to a completely full battery | 52 | |
| 53 | cmd_buff[1] = RESULT_SUCCESS.raw; | ||
| 54 | cmd_buff[2] = static_cast<u32>(ChargeLevels::CompletelyFull); // Set to a completely full battery | ||
| 55 | |||
| 56 | LOG_WARNING(Service_PTM, "(STUBBED) called"); | ||
| 57 | } | ||
| 58 | |||
| 59 | void GetBatteryChargeState(Service::Interface* self) { | ||
| 60 | u32* cmd_buff = Kernel::GetCommandBuffer(); | ||
| 61 | |||
| 62 | // TODO(purpasmart96): This function is only a stub, | ||
| 63 | // it returns a valid result without implementing full functionality. | ||
| 64 | |||
| 65 | cmd_buff[1] = RESULT_SUCCESS.raw; | ||
| 66 | cmd_buff[2] = battery_is_charging ? 1 : 0; | ||
| 67 | |||
| 68 | LOG_WARNING(Service_PTM, "(STUBBED) called"); | ||
| 69 | } | ||
| 70 | |||
| 71 | void IsLegacyPowerOff(Service::Interface* self) { | ||
| 72 | u32* cmd_buff = Kernel::GetCommandBuffer(); | ||
| 73 | |||
| 74 | cmd_buff[1] = RESULT_SUCCESS.raw; | ||
| 75 | cmd_buff[2] = 0; | ||
| 76 | |||
| 77 | LOG_WARNING(Service_PTM, "(STUBBED) called"); | ||
| 40 | } | 78 | } |
| 41 | 79 | ||
| 42 | void Init() { | 80 | void Init() { |
diff --git a/src/core/hle/service/ptm/ptm.h b/src/core/hle/service/ptm/ptm.h index 3c776aa8a..493e6a11f 100644 --- a/src/core/hle/service/ptm/ptm.h +++ b/src/core/hle/service/ptm/ptm.h | |||
| @@ -5,6 +5,7 @@ | |||
| 5 | #pragma once | 5 | #pragma once |
| 6 | 6 | ||
| 7 | #include <array> | 7 | #include <array> |
| 8 | #include "core/hle/service/service.h" | ||
| 8 | #include "core/hle/result.h" | 9 | #include "core/hle/result.h" |
| 9 | 10 | ||
| 10 | namespace Service { | 11 | namespace Service { |
| @@ -35,25 +36,48 @@ struct GameCoin { | |||
| 35 | }; | 36 | }; |
| 36 | 37 | ||
| 37 | /** | 38 | /** |
| 38 | * Returns whether the battery is charging or not. | ||
| 39 | * It is unknown if GetAdapterState is the same as GetBatteryChargeState, | 39 | * It is unknown if GetAdapterState is the same as GetBatteryChargeState, |
| 40 | * it is likely to just be a duplicate function of GetBatteryChargeState | 40 | * it is likely to just be a duplicate function of GetBatteryChargeState |
| 41 | * that controls another part of the HW. | 41 | * that controls another part of the HW. |
| 42 | * @returns 1 if the battery is charging, and 0 otherwise. | 42 | * PTM::GetAdapterState service function |
| 43 | * Outputs: | ||
| 44 | * 1 : Result of function, 0 on success, otherwise error code | ||
| 45 | * 2 : Output of function, 0 = not charging, 1 = charging. | ||
| 43 | */ | 46 | */ |
| 44 | u32 GetAdapterState(); | 47 | void GetAdapterState(Interface* self); |
| 45 | 48 | ||
| 46 | /** | 49 | /** |
| 47 | * Returns whether the 3DS's physical shell casing is open or closed | 50 | * PTM::GetShellState service function. |
| 48 | * @returns 1 if the shell is open, and 0 if otherwise | 51 | * Outputs: |
| 52 | * 1 : Result of function, 0 on success, otherwise error code | ||
| 53 | * 2 : Whether the 3DS's physical shell casing is open (1) or closed (0) | ||
| 49 | */ | 54 | */ |
| 50 | u32 GetShellState(); | 55 | void GetShellState(Interface* self); |
| 51 | 56 | ||
| 52 | /** | 57 | /** |
| 53 | * Get the current battery's charge level. | 58 | * PTM::GetBatteryLevel service function |
| 54 | * @returns The battery's charge level. | 59 | * Outputs: |
| 60 | * 1 : Result of function, 0 on success, otherwise error code | ||
| 61 | * 2 : Battery level, 5 = completely full battery, 4 = mostly full battery, | ||
| 62 | * 3 = half full battery, 2 = low battery, 1 = critical battery. | ||
| 55 | */ | 63 | */ |
| 56 | ChargeLevels GetBatteryLevel(); | 64 | void GetBatteryLevel(Interface* self); |
| 65 | |||
| 66 | /** | ||
| 67 | * PTM::GetBatteryChargeState service function | ||
| 68 | * Outputs: | ||
| 69 | * 1 : Result of function, 0 on success, otherwise error code | ||
| 70 | * 2 : Output of function, 0 = not charging, 1 = charging. | ||
| 71 | */ | ||
| 72 | void GetBatteryChargeState(Interface* self); | ||
| 73 | |||
| 74 | /** | ||
| 75 | * PTM::IsLegacyPowerOff service function | ||
| 76 | * Outputs: | ||
| 77 | * 1: Result code, 0 on success, otherwise error code | ||
| 78 | * 2: Whether the system is going through a power off | ||
| 79 | */ | ||
| 80 | void IsLegacyPowerOff(Interface* self); | ||
| 57 | 81 | ||
| 58 | /// Initialize the PTM service | 82 | /// Initialize the PTM service |
| 59 | void Init(); | 83 | void Init(); |
diff --git a/src/core/hle/service/ptm/ptm_play.cpp b/src/core/hle/service/ptm/ptm_play.cpp index 8e8ae8558..48e68a3d8 100644 --- a/src/core/hle/service/ptm/ptm_play.cpp +++ b/src/core/hle/service/ptm/ptm_play.cpp | |||
| @@ -9,10 +9,10 @@ namespace Service { | |||
| 9 | namespace PTM { | 9 | namespace PTM { |
| 10 | 10 | ||
| 11 | const Interface::FunctionInfo FunctionTable[] = { | 11 | const Interface::FunctionInfo FunctionTable[] = { |
| 12 | { 0x08070082, nullptr, "GetPlayHistory" }, | 12 | {0x08070082, nullptr, "GetPlayHistory"}, |
| 13 | { 0x08080000, nullptr, "GetPlayHistoryStart" }, | 13 | {0x08080000, nullptr, "GetPlayHistoryStart"}, |
| 14 | { 0x08090000, nullptr, "GetPlayHistoryLength" }, | 14 | {0x08090000, nullptr, "GetPlayHistoryLength"}, |
| 15 | { 0x080B0080, nullptr, "CalcPlayHistoryStart" }, | 15 | {0x080B0080, nullptr, "CalcPlayHistoryStart"}, |
| 16 | }; | 16 | }; |
| 17 | 17 | ||
| 18 | PTM_Play_Interface::PTM_Play_Interface() { | 18 | PTM_Play_Interface::PTM_Play_Interface() { |
diff --git a/src/core/hle/service/ptm/ptm_sysm.cpp b/src/core/hle/service/ptm/ptm_sysm.cpp index 13322bdbb..655658f3b 100644 --- a/src/core/hle/service/ptm/ptm_sysm.cpp +++ b/src/core/hle/service/ptm/ptm_sysm.cpp | |||
| @@ -2,57 +2,44 @@ | |||
| 2 | // Licensed under GPLv2 or any later version | 2 | // Licensed under GPLv2 or any later version |
| 3 | // Refer to the license.txt file included. | 3 | // Refer to the license.txt file included. |
| 4 | 4 | ||
| 5 | #include "common/make_unique.h" | ||
| 6 | #include "core/file_sys/archive_extsavedata.h" | ||
| 7 | #include "core/hle/hle.h" | 5 | #include "core/hle/hle.h" |
| 6 | #include "core/hle/service/ptm/ptm.h" | ||
| 8 | #include "core/hle/service/ptm/ptm_sysm.h" | 7 | #include "core/hle/service/ptm/ptm_sysm.h" |
| 9 | 8 | ||
| 10 | namespace Service { | 9 | namespace Service { |
| 11 | namespace PTM { | 10 | namespace PTM { |
| 12 | 11 | ||
| 13 | /** | ||
| 14 | * Returns whether the system is powering off (?) | ||
| 15 | * Outputs: | ||
| 16 | * 1: Result code, 0 on success, otherwise error code | ||
| 17 | * 2: Whether the system is going through a power off | ||
| 18 | */ | ||
| 19 | static void IsLegacyPowerOff(Service::Interface* self) { | ||
| 20 | u32* cmd_buff = Kernel::GetCommandBuffer(); | ||
| 21 | cmd_buff[1] = RESULT_SUCCESS.raw; | ||
| 22 | cmd_buff[2] = 0; | ||
| 23 | } | ||
| 24 | |||
| 25 | const Interface::FunctionInfo FunctionTable[] = { | 12 | const Interface::FunctionInfo FunctionTable[] = { |
| 26 | {0x040100C0, nullptr, "SetRtcAlarmEx"}, | 13 | {0x040100C0, nullptr, "SetRtcAlarmEx"}, |
| 27 | {0x04020042, nullptr, "ReplySleepQuery"}, | 14 | {0x04020042, nullptr, "ReplySleepQuery"}, |
| 28 | {0x04030042, nullptr, "NotifySleepPreparationComplete"}, | 15 | {0x04030042, nullptr, "NotifySleepPreparationComplete"}, |
| 29 | {0x04040102, nullptr, "SetWakeupTrigger"}, | 16 | {0x04040102, nullptr, "SetWakeupTrigger"}, |
| 30 | {0x04050000, nullptr, "GetAwakeReason"}, | 17 | {0x04050000, nullptr, "GetAwakeReason"}, |
| 31 | {0x04060000, nullptr, "RequestSleep"}, | 18 | {0x04060000, nullptr, "RequestSleep"}, |
| 32 | {0x040700C0, nullptr, "ShutdownAsync"}, | 19 | {0x040700C0, nullptr, "ShutdownAsync"}, |
| 33 | {0x04080000, nullptr, "Awake"}, | 20 | {0x04080000, nullptr, "Awake"}, |
| 34 | {0x04090080, nullptr, "RebootAsync"}, | 21 | {0x04090080, nullptr, "RebootAsync"}, |
| 35 | {0x040A0000, nullptr, "CheckNew3DS"}, | 22 | {0x040A0000, nullptr, "CheckNew3DS"}, |
| 36 | {0x08010640, nullptr, "SetInfoLEDPattern"}, | 23 | {0x08010640, nullptr, "SetInfoLEDPattern"}, |
| 37 | {0x08020040, nullptr, "SetInfoLEDPatternHeader"}, | 24 | {0x08020040, nullptr, "SetInfoLEDPatternHeader"}, |
| 38 | {0x08030000, nullptr, "GetInfoLEDStatus"}, | 25 | {0x08030000, nullptr, "GetInfoLEDStatus"}, |
| 39 | {0x08040040, nullptr, "SetBatteryEmptyLEDPattern"}, | 26 | {0x08040040, nullptr, "SetBatteryEmptyLEDPattern"}, |
| 40 | {0x08050000, nullptr, "ClearStepHistory"}, | 27 | {0x08050000, nullptr, "ClearStepHistory"}, |
| 41 | {0x080600C2, nullptr, "SetStepHistory"}, | 28 | {0x080600C2, nullptr, "SetStepHistory"}, |
| 42 | {0x08070082, nullptr, "GetPlayHistory"}, | 29 | {0x08070082, nullptr, "GetPlayHistory"}, |
| 43 | {0x08080000, nullptr, "GetPlayHistoryStart"}, | 30 | {0x08080000, nullptr, "GetPlayHistoryStart"}, |
| 44 | {0x08090000, nullptr, "GetPlayHistoryLength"}, | 31 | {0x08090000, nullptr, "GetPlayHistoryLength"}, |
| 45 | {0x080A0000, nullptr, "ClearPlayHistory"}, | 32 | {0x080A0000, nullptr, "ClearPlayHistory"}, |
| 46 | {0x080B0080, nullptr, "CalcPlayHistoryStart"}, | 33 | {0x080B0080, nullptr, "CalcPlayHistoryStart"}, |
| 47 | {0x080C0080, nullptr, "SetUserTime"}, | 34 | {0x080C0080, nullptr, "SetUserTime"}, |
| 48 | {0x080D0000, nullptr, "InvalidateSystemTime"}, | 35 | {0x080D0000, nullptr, "InvalidateSystemTime"}, |
| 49 | {0x080E0140, nullptr, "NotifyPlayEvent"}, | 36 | {0x080E0140, nullptr, "NotifyPlayEvent"}, |
| 50 | {0x080F0000, IsLegacyPowerOff, "IsLegacyPowerOff"}, | 37 | {0x080F0000, IsLegacyPowerOff, "IsLegacyPowerOff"}, |
| 51 | {0x08100000, nullptr, "ClearLegacyPowerOff"}, | 38 | {0x08100000, nullptr, "ClearLegacyPowerOff"}, |
| 52 | {0x08110000, nullptr, "GetShellStatus"}, | 39 | {0x08110000, nullptr, "GetShellStatus"}, |
| 53 | {0x08120000, nullptr, "IsShutdownByBatteryEmpty"}, | 40 | {0x08120000, nullptr, "IsShutdownByBatteryEmpty"}, |
| 54 | {0x08130000, nullptr, "FormatSavedata"}, | 41 | {0x08130000, nullptr, "FormatSavedata"}, |
| 55 | {0x08140000, nullptr, "GetLegacyJumpProhibitedFlag"} | 42 | {0x08140000, nullptr, "GetLegacyJumpProhibitedFlag"} |
| 56 | }; | 43 | }; |
| 57 | 44 | ||
| 58 | PTM_Sysm_Interface::PTM_Sysm_Interface() { | 45 | PTM_Sysm_Interface::PTM_Sysm_Interface() { |
diff --git a/src/core/hle/service/ptm/ptm_u.cpp b/src/core/hle/service/ptm/ptm_u.cpp index 9d6a5b0d7..3f5e9c7c1 100644 --- a/src/core/hle/service/ptm/ptm_u.cpp +++ b/src/core/hle/service/ptm/ptm_u.cpp | |||
| @@ -11,68 +11,6 @@ | |||
| 11 | namespace Service { | 11 | namespace Service { |
| 12 | namespace PTM { | 12 | namespace PTM { |
| 13 | 13 | ||
| 14 | /** | ||
| 15 | * PTM_U::GetAdapterState service function | ||
| 16 | * Outputs: | ||
| 17 | * 1 : Result of function, 0 on success, otherwise error code | ||
| 18 | * 2 : Output of function, 0 = not charging, 1 = charging. | ||
| 19 | */ | ||
| 20 | static void GetAdapterState(Service::Interface* self) { | ||
| 21 | u32* cmd_buff = Kernel::GetCommandBuffer(); | ||
| 22 | |||
| 23 | cmd_buff[1] = RESULT_SUCCESS.raw; | ||
| 24 | cmd_buff[2] = GetAdapterState(); | ||
| 25 | |||
| 26 | LOG_WARNING(Service_PTM, "(STUBBED) called"); | ||
| 27 | } | ||
| 28 | |||
| 29 | /* | ||
| 30 | * PTM_User::GetShellState service function. | ||
| 31 | * Outputs: | ||
| 32 | * 1 : Result of function, 0 on success, otherwise error code | ||
| 33 | * 2 : Whether the 3DS's physical shell casing is open (1) or closed (0) | ||
| 34 | */ | ||
| 35 | static void GetShellState(Service::Interface* self) { | ||
| 36 | u32* cmd_buff = Kernel::GetCommandBuffer(); | ||
| 37 | |||
| 38 | cmd_buff[1] = RESULT_SUCCESS.raw; | ||
| 39 | cmd_buff[2] = GetShellState(); | ||
| 40 | } | ||
| 41 | |||
| 42 | /** | ||
| 43 | * PTM_U::GetBatteryLevel service function | ||
| 44 | * Outputs: | ||
| 45 | * 1 : Result of function, 0 on success, otherwise error code | ||
| 46 | * 2 : Battery level, 5 = completely full battery, 4 = mostly full battery, | ||
| 47 | * 3 = half full battery, 2 = low battery, 1 = critical battery. | ||
| 48 | */ | ||
| 49 | static void GetBatteryLevel(Service::Interface* self) { | ||
| 50 | u32* cmd_buff = Kernel::GetCommandBuffer(); | ||
| 51 | |||
| 52 | cmd_buff[1] = RESULT_SUCCESS.raw; | ||
| 53 | cmd_buff[2] = static_cast<u32>(GetBatteryLevel()); | ||
| 54 | |||
| 55 | LOG_WARNING(Service_PTM, "(STUBBED) called"); | ||
| 56 | } | ||
| 57 | |||
| 58 | /** | ||
| 59 | * PTM_U::GetBatteryChargeState service function | ||
| 60 | * Outputs: | ||
| 61 | * 1 : Result of function, 0 on success, otherwise error code | ||
| 62 | * 2 : Output of function, 0 = not charging, 1 = charging. | ||
| 63 | */ | ||
| 64 | static void GetBatteryChargeState(Service::Interface* self) { | ||
| 65 | u32* cmd_buff = Kernel::GetCommandBuffer(); | ||
| 66 | |||
| 67 | // TODO(purpasmart96): This function is only a stub, | ||
| 68 | // it returns a valid result without implementing full functionality. | ||
| 69 | |||
| 70 | cmd_buff[1] = RESULT_SUCCESS.raw; | ||
| 71 | cmd_buff[2] = GetAdapterState(); | ||
| 72 | |||
| 73 | LOG_WARNING(Service_PTM, "(STUBBED) called"); | ||
| 74 | } | ||
| 75 | |||
| 76 | const Interface::FunctionInfo FunctionTable[] = { | 14 | const Interface::FunctionInfo FunctionTable[] = { |
| 77 | {0x00010002, nullptr, "RegisterAlarmClient"}, | 15 | {0x00010002, nullptr, "RegisterAlarmClient"}, |
| 78 | {0x00020080, nullptr, "SetRtcAlarm"}, | 16 | {0x00020080, nullptr, "SetRtcAlarm"}, |