diff --git a/Source/Common/Common.vcxproj b/Source/Common/Common.vcxproj
index 4ce014430..e8ba6cbe8 100644
--- a/Source/Common/Common.vcxproj
+++ b/Source/Common/Common.vcxproj
@@ -43,6 +43,7 @@
+
Create
@@ -64,6 +65,7 @@
+
diff --git a/Source/Common/Common.vcxproj.filters b/Source/Common/Common.vcxproj.filters
index 437d0328f..69caab164 100644
--- a/Source/Common/Common.vcxproj.filters
+++ b/Source/Common/Common.vcxproj.filters
@@ -62,6 +62,9 @@
Source Files
+
+ Source Files
+
@@ -124,5 +127,8 @@
Header Files
+
+ Header Files
+
\ No newline at end of file
diff --git a/Source/Project64-core/3rdParty/Random.cpp b/Source/Common/Random.cpp
similarity index 79%
rename from Source/Project64-core/3rdParty/Random.cpp
rename to Source/Common/Random.cpp
index 3209cf6db..a46f8887c 100644
--- a/Source/Project64-core/3rdParty/Random.cpp
+++ b/Source/Common/Random.cpp
@@ -15,6 +15,7 @@
*
*/
+#include "stdafx.h"
#include "Random.h"
#include
@@ -23,12 +24,12 @@ CRandom::CRandom()
state = (uint32_t)time(NULL);
}
-CRandom::CRandom(uint32_t seed_value)
+CRandom::CRandom(uint32_t state_value)
{
- state = seed_value;
+ state = state_value;
}
-uint32_t randomizer(uint32_t val)
+uint32_t CRandom::randomizer(uint32_t val)
{
return ((uint64_t)val * 279470273UL) % 4294967291UL;
}
@@ -39,10 +40,15 @@ uint32_t CRandom::next()
return state;
}
-void CRandom::seed(uint32_t seed_value)
+void CRandom::set_state(uint32_t state_value)
{
- if (seed_value == 0)
- state == 1;
+ if (state_value == 0)
+ state = 1;
else
- state = seed_value;
+ state = state_value;
+}
+
+uint32_t CRandom::get_state()
+{
+ return state;
}
diff --git a/Source/Project64-core/3rdParty/Random.h b/Source/Common/Random.h
similarity index 93%
rename from Source/Project64-core/3rdParty/Random.h
rename to Source/Common/Random.h
index 439f06a7f..1a599a47c 100644
--- a/Source/Project64-core/3rdParty/Random.h
+++ b/Source/Common/Random.h
@@ -14,7 +14,7 @@
* This class implements the Lehmer Random Number Generator.
*
*/
-
+#pragma once
#include
class CRandom
@@ -23,7 +23,8 @@ public:
CRandom();
CRandom(uint32_t seed_value);
uint32_t next();
- void seed(uint32_t seed_value);
+ uint32_t get_state();
+ void set_state(uint32_t state_value);
protected:
uint32_t randomizer(uint32_t val);
diff --git a/Source/Project64-core/N64System/N64Class.cpp b/Source/Project64-core/N64System/N64Class.cpp
index ac275402d..c2d649ee9 100644
--- a/Source/Project64-core/N64System/N64Class.cpp
+++ b/Source/Project64-core/N64System/N64Class.cpp
@@ -57,7 +57,8 @@ CN64System::CN64System(CPlugins * Plugins, bool SavesReadOnly, bool SyncSystem)
m_thread(NULL),
m_hPauseEvent(true),
m_CheatsSlectionChanged(false),
- m_SyncCpu(SyncSystem)
+ m_SyncCpu(SyncSystem),
+ m_Random((uint32_t)time(NULL))
{
WriteTrace(TraceN64System, TraceDebug, "Start");
memset(m_LastSuccessSyncPC, 0, sizeof(m_LastSuccessSyncPC));
diff --git a/Source/Project64-core/N64System/N64Class.h b/Source/Project64-core/N64System/N64Class.h
index c4326b01c..85ae9796c 100644
--- a/Source/Project64-core/N64System/N64Class.h
+++ b/Source/Project64-core/N64System/N64Class.h
@@ -10,6 +10,7 @@
****************************************************************************/
#pragma once
+#include
#include
#include
#include
@@ -23,7 +24,6 @@
#include
#include
#include
-#include
#include "Mips/TLBClass.h"
#include "CheatClass.h"
diff --git a/Source/Project64-core/N64System/SystemGlobals.cpp b/Source/Project64-core/N64System/SystemGlobals.cpp
index d6e058b1c..84552337b 100644
--- a/Source/Project64-core/N64System/SystemGlobals.cpp
+++ b/Source/Project64-core/N64System/SystemGlobals.cpp
@@ -32,5 +32,6 @@ uint32_t * g_TLBStoreAddress = NULL;
CDebugger * g_Debugger = NULL;
uint8_t ** g_RecompPos = NULL;
CMempak * g_Mempak = NULL;
+CRandom * g_Random = NULL;
int * g_NextTimer;
\ No newline at end of file
diff --git a/Source/Project64-core/Project64-core.vcxproj b/Source/Project64-core/Project64-core.vcxproj
index 9cbfef092..412d6fedc 100644
--- a/Source/Project64-core/Project64-core.vcxproj
+++ b/Source/Project64-core/Project64-core.vcxproj
@@ -35,7 +35,6 @@
NotUsing
-
@@ -127,7 +126,6 @@
-
diff --git a/Source/Project64-core/Project64-core.vcxproj.filters b/Source/Project64-core/Project64-core.vcxproj.filters
index 44f537ba3..f3f9f6b9b 100644
--- a/Source/Project64-core/Project64-core.vcxproj.filters
+++ b/Source/Project64-core/Project64-core.vcxproj.filters
@@ -339,9 +339,6 @@
Source Files\N64 System\Recompiler\Arm
-
- Source Files\3rd Party
-
@@ -662,9 +659,6 @@
Header Files
-
- Header Files\3rd Party
-