From 002a264e9d5d62ed9736976447000b1a8d2c2698 Mon Sep 17 00:00:00 2001 From: V10lator Date: Fri, 23 Jun 2023 19:59:35 +0200 Subject: [PATCH 01/11] Add dependabot.yml (#7) Signed-off-by: Thomas Rohloff --- .github/dependabot.yml | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 .github/dependabot.yml diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..50b323b --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,10 @@ +version: 2 +updates: + - package-ecosystem: "docker" + directory: "/" + schedule: + interval: "daily" + - package-ecosystem: "github-actions" + directory: "/" + schedule: + interval: "daily" From 1fdf70a2784c24111fdca054c76365d557ba3e91 Mon Sep 17 00:00:00 2001 From: V10lator Date: Mon, 26 Jun 2023 03:18:03 +0200 Subject: [PATCH 02/11] Change CFLAGS (#6) * Change CFLAGS Signed-off-by: Thomas Rohloff * Add more compiler warnings Signed-off-by: Thomas Rohloff * Fix warnings Signed-off-by: Thomas Rohloff --------- Signed-off-by: Thomas Rohloff --- Makefile | 3 ++- source/main.cpp | 7 ++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 53b2b6e..ada526d 100644 --- a/Makefile +++ b/Makefile @@ -28,7 +28,8 @@ INCLUDES := source #------------------------------------------------------------------------------- # options for code generation #------------------------------------------------------------------------------- -CFLAGS := -g -Wall -O2 -ffunction-sections \ +CFLAGS := -Wall -Wextra -Wundef -Wshadow -Wpointer-arith -Wcast-align \ + -Ofast -fipa-pta -pipe -ffunction-sections \ $(MACHDEP) CFLAGS += $(INCLUDE) -D__WIIU__ -D__WUT__ -D__WUPS__ diff --git a/source/main.cpp b/source/main.cpp index 4f0d9a5..2b74016 100644 --- a/source/main.cpp +++ b/source/main.cpp @@ -231,6 +231,7 @@ INITIALIZE_PLUGIN() { void syncingEnabled(ConfigItemBoolean *item, bool value) { + (void)item; // If false, bro is literally a time traveler! WUPS_StoreBool(nullptr, SYNCING_ENABLED_CONFIG_ID, value); enabledSync = value; @@ -238,24 +239,28 @@ void syncingEnabled(ConfigItemBoolean *item, bool value) void savingsEnabled(ConfigItemBoolean *item, bool value) { + (void)item; WUPS_StoreBool(nullptr, DST_ENABLED_CONFIG_ID, value); enabledDST = value; } void notifyEnabled(ConfigItemBoolean *item, bool value) { + (void)item; WUPS_StoreBool(nullptr, NOTIFY_ENABLED_CONFIG_ID, value); enabledNotify = value; } void onHourOffsetChanged(ConfigItemIntegerRange *item, int32_t offset) { + (void)item; WUPS_StoreInt(nullptr, OFFSET_HOURS_CONFIG_ID, offset); offsetHours = offset; } void onMinuteOffsetChanged(ConfigItemIntegerRange *item, int32_t offset) { + (void)item; WUPS_StoreInt(nullptr, OFFSET_MINUTES_CONFIG_ID, offset); offsetMinutes = offset; } @@ -295,4 +300,4 @@ WUPS_CONFIG_CLOSED() { } WUPS_CloseStorage(); // Save all changes. -} \ No newline at end of file +} From 4519cf93f1d8f80b31f92742279f9f63a1e960df Mon Sep 17 00:00:00 2001 From: Nightkingale <63483138+Nightkingale@users.noreply.github.com> Date: Mon, 26 Jun 2023 07:23:55 -0600 Subject: [PATCH 03/11] Create LICENSE file --- LICENSE | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 LICENSE diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..d362aff --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2023 Nightkingale + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. \ No newline at end of file From 897cfd3ae67fccc319a08e7c44cdabbf5f7ee762 Mon Sep 17 00:00:00 2001 From: Nightkingale <63483138+Nightkingale@users.noreply.github.com> Date: Tue, 4 Jul 2023 15:51:07 -0600 Subject: [PATCH 04/11] Switch Ofast back to O2 --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index ada526d..9ac82ff 100644 --- a/Makefile +++ b/Makefile @@ -29,7 +29,7 @@ INCLUDES := source # options for code generation #------------------------------------------------------------------------------- CFLAGS := -Wall -Wextra -Wundef -Wshadow -Wpointer-arith -Wcast-align \ - -Ofast -fipa-pta -pipe -ffunction-sections \ + -O2 -fipa-pta -pipe -ffunction-sections \ $(MACHDEP) CFLAGS += $(INCLUDE) -D__WIIU__ -D__WUT__ -D__WUPS__ From b9d08bd21b4cb0da8069c575d2c26ad26423d2a6 Mon Sep 17 00:00:00 2001 From: Nightkingale <63483138+Nightkingale@users.noreply.github.com> Date: Sun, 16 Jul 2023 11:37:06 -0600 Subject: [PATCH 05/11] Change builder workflow --- .github/workflows/build.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 81b4e9f..dfca69b 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -9,8 +9,8 @@ jobs: - uses: actions/checkout@v3 - name: Build Binary run: | - docker build -t plugin_builder . - docker run --rm -v ${PWD}:/project plugin_builder make + docker build -t builder . + docker run --rm -v ${PWD}:/project builder make - uses: actions/upload-artifact@v3 with: name: Wii_U_Time_Sync.wps From cce4f4891b9c1e21abe0e6bdb58626d39145c4f0 Mon Sep 17 00:00:00 2001 From: Noah Mueller <63483138+Nightkingale@users.noreply.github.com> Date: Mon, 24 Jul 2023 22:09:57 -0600 Subject: [PATCH 06/11] Update to build using wut 1.3.0 --- .github/workflows/build.yml | 6 +++--- Dockerfile | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index dfca69b..41f9545 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -13,6 +13,6 @@ jobs: docker run --rm -v ${PWD}:/project builder make - uses: actions/upload-artifact@v3 with: - name: Wii_U_Time_Sync.wps - path: "*.wps" - if-no-files-found: error \ No newline at end of file + name: Wii_U_Time_Sync.wps + path: "*.wps" + if-no-files-found: error \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index ae2b6d6..35533f3 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,6 +1,6 @@ -FROM ghcr.io/wiiu-env/devkitppc:20230326 +FROM ghcr.io/wiiu-env/devkitppc:20230621 -COPY --from=ghcr.io/wiiu-env/wiiupluginsystem:20230215 /artifacts $DEVKITPRO -COPY --from=ghcr.io/wiiu-env/libnotifications:20230423 /artifacts $DEVKITPRO +COPY --from=ghcr.io/wiiu-env/wiiupluginsystem:20230719 /artifacts $DEVKITPRO +COPY --from=ghcr.io/wiiu-env/libnotifications:20230621 /artifacts $DEVKITPRO WORKDIR project \ No newline at end of file From ad680aef805a445726745ad867057b99f45c9137 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 4 Sep 2023 17:49:36 -0600 Subject: [PATCH 07/11] Bump actions/checkout from 3 to 4 (#14) Bumps [actions/checkout](https://github.com/actions/checkout) from 3 to 4. - [Release notes](https://github.com/actions/checkout/releases) - [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md) - [Commits](https://github.com/actions/checkout/compare/v3...v4) --- updated-dependencies: - dependency-name: actions/checkout dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 41f9545..e45f2d1 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -6,7 +6,7 @@ jobs: build-binary: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Build Binary run: | docker build -t builder . From b03ce45b587a195ae7fd29a40b65683616504ae8 Mon Sep 17 00:00:00 2001 From: Nightkingale <63483138+Nightkingale@users.noreply.github.com> Date: Sun, 17 Sep 2023 11:12:25 -0600 Subject: [PATCH 08/11] Adjust community health files --- README.md => .github/README.md | 0 LICENSE => LICENSE.md | 0 2 files changed, 0 insertions(+), 0 deletions(-) rename README.md => .github/README.md (100%) rename LICENSE => LICENSE.md (100%) diff --git a/README.md b/.github/README.md similarity index 100% rename from README.md rename to .github/README.md diff --git a/LICENSE b/LICENSE.md similarity index 100% rename from LICENSE rename to LICENSE.md From 102c23a383bcd1ee332be4b77b570ba013fa8bae Mon Sep 17 00:00:00 2001 From: Nightkingale <63483138+Nightkingale@users.noreply.github.com> Date: Sun, 17 Sep 2023 11:12:31 -0600 Subject: [PATCH 09/11] Add a link for funding --- .github/FUNDING.yml | 1 + 1 file changed, 1 insertion(+) create mode 100644 .github/FUNDING.yml diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml new file mode 100644 index 0000000..d3aca7b --- /dev/null +++ b/.github/FUNDING.yml @@ -0,0 +1 @@ +custom: "https://paypal.me/Nightkingale" \ No newline at end of file From 23e90196f0e0653a966bc7d25895cb762a68c189 Mon Sep 17 00:00:00 2001 From: Nightkingale <63483138+Nightkingale@users.noreply.github.com> Date: Wed, 4 Oct 2023 09:00:09 -0600 Subject: [PATCH 10/11] Add simple roundtrip calculations --- source/main.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/source/main.cpp b/source/main.cpp index 2b74016..359d6a8 100644 --- a/source/main.cpp +++ b/source/main.cpp @@ -164,12 +164,27 @@ OSTime NTPGetTime(const char* hostname) } void updateTime() { + uint64_t roundtripStart = 0; + uint64_t roundtripEnd = 0; + + // Get the time from the server. + roundtripStart = OSGetTime(); OSTime time = NTPGetTime("time.windows.com"); // Connect to the time server. + roundtripEnd = OSGetTime(); if (time == 0) { return; // Probably didn't connect correctly. } + // Calculate the roundtrip time. + uint64_t roundtrip = roundtripEnd - roundtripStart; + + // Calculate the time it took to get the time from the server. + uint64_t timeTook = roundtrip / 2; + + // Subtract the time it took to get the time from the server. + time -= OSMillisecondsToTicks(timeTook); + if (offsetHours < 0) { time -= OSSecondsToTicks(abs(offsetHours) * 60 * 60); } else { From d43f8187b69f54d971a2f038cc39b61e2d145946 Mon Sep 17 00:00:00 2001 From: Nightkingale <63483138+Nightkingale@users.noreply.github.com> Date: Wed, 4 Oct 2023 18:16:45 -0600 Subject: [PATCH 11/11] Fix roundtrip calculation oversight --- source/main.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/main.cpp b/source/main.cpp index 359d6a8..a3d8746 100644 --- a/source/main.cpp +++ b/source/main.cpp @@ -183,7 +183,7 @@ void updateTime() { uint64_t timeTook = roundtrip / 2; // Subtract the time it took to get the time from the server. - time -= OSMillisecondsToTicks(timeTook); + time -= timeTook; if (offsetHours < 0) { time -= OSSecondsToTicks(abs(offsetHours) * 60 * 60);