Last active
May 9, 2021 04:19
-
-
Save mataha/0f15afca673b6263e99109415e2a6ec4 to your computer and use it in GitHub Desktop.
Touhou Music Room 2.3.0 patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --unified a/musicroom/extract.cpp b/musicroom/extract.cpp | |
--- a/musicroom/extract.cpp | |
+++ b/musicroom/extract.cpp | |
@@ -8,6 +8,14 @@ | |
#include <math.h> | |
+#if __cplusplus > 201703L | |
+# include <numbers> | |
+ static constexpr double PI = std::numbers::pi_v<double>; | |
+#else | |
+# include <cmath> | |
+ static constexpr double PI = std::acos(-1.0); | |
+#endif | |
+ | |
// FOX | |
#include <FXHash.h> | |
#include <FXStream.h> | |
@@ -95,6 +103,24 @@ | |
SINGLETON(FadeAlg_Exp); | |
}; | |
+class FadeAlg_Smooth : public FadeAlg | |
+{ | |
+public: | |
+ short* Eval(short* f, long& c, long& Len) | |
+ { | |
+ double Step = (double)c / (double)Len; | |
+ for (unsigned short i = 0; i < 2; ++i) | |
+ { | |
+ *f = (double)*f * (0.5 * (cos(Step * PI) + 1.0)); | |
+ f++; | |
+ } | |
+ return f; | |
+ } | |
+ | |
+ FadeAlg_Smooth() {Name = "Smooth";} | |
+ SINGLETON(FadeAlg_Smooth); | |
+} | |
+ | |
// Decryption thread | |
// ----------------- | |
FXint Decrypter::run() | |
@@ -136,6 +162,7 @@ | |
{ | |
FAs.Add()->Data = &FadeAlg_Linear::Inst(); | |
FAs.Add()->Data = &FadeAlg_Exp::Inst(); | |
+ FAs.Add()->Data = &FadeAlg_Smooth::Inst(); | |
} | |
Extract_Vals::Extract_Vals() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment