diff --git a/configure.py b/configure.py index af7f79487..d836ff2f7 100644 --- a/configure.py +++ b/configure.py @@ -685,7 +685,7 @@ config.libs = [ Object(Matching, "JSystem/JAudio/JASSimpleWaveBank.cpp"), Object(Matching, "JSystem/JAudio/JASInstEffect.cpp"), Object(NonMatching, "JSystem/JAudio/JASInstSense.cpp"), - Object(NonMatching, "JSystem/JAudio/JASInstRand.cpp"), + Object(Matching, "JSystem/JAudio/JASInstRand.cpp"), Object(NonMatching, "JSystem/JAudio/JASWSParser.cpp"), Object(NonMatching, "JSystem/JAudio/JASBNKParser.cpp"), Object(Matching, "JSystem/JAudio/JASWaveArcLoader.cpp"), diff --git a/include/JSystem/JAudio/JASInstRand.h b/include/JSystem/JAudio/JASInstRand.h new file mode 100644 index 000000000..e83c3f537 --- /dev/null +++ b/include/JSystem/JAudio/JASInstRand.h @@ -0,0 +1,20 @@ +#ifndef JASINSTRAND_H +#define JASINSTRAND_H + +#include "JSystem/JAudio/JASInstEffect.h" + +namespace JASystem { + class TInstRand : public TInstEffect { + public: + TInstRand() { + field_0x8 = 1.0f; + field_0xc = 0.0f; + } + virtual f32 getY(int, int) const; + + /* 0x08 */ f32 field_0x8; + /* 0x0C */ f32 field_0xc; + }; +} + +#endif /* JASINSTRAND_H */ diff --git a/src/JSystem/JAudio/JASInstRand.cpp b/src/JSystem/JAudio/JASInstRand.cpp index ce302d8a6..ec0df58c6 100644 --- a/src/JSystem/JAudio/JASInstRand.cpp +++ b/src/JSystem/JAudio/JASInstRand.cpp @@ -3,11 +3,13 @@ // Translation Unit: JASInstRand.cpp // -#include "JASInstRand.h" -#include "dolphin/types.h" +#include "JSystem/JAudio/JASInstRand.h" +#include "JSystem/JMath/random.h" /* 80286B58-80286BF4 .text getY__Q28JASystem9TInstRandCFii */ -void JASystem::TInstRand::getY(int, int) const { - /* Nonmatching */ +f32 JASystem::TInstRand::getY(int, int) const { + static JMath::TRandom_fast_ oRandom(0); + f32 tmp = (oRandom.get_ufloat_1() * 2.0f - 0.9999999f); + tmp *= field_0xc; + return tmp + field_0x8; } -