diff --git a/Core/Core.vcxproj b/Core/Core.vcxproj
index 6c410820..d2c7c06e 100644
--- a/Core/Core.vcxproj
+++ b/Core/Core.vcxproj
@@ -668,6 +668,7 @@
+
diff --git a/Core/Core.vcxproj.filters b/Core/Core.vcxproj.filters
index 67c73ec7..4bc5aa48 100644
--- a/Core/Core.vcxproj.filters
+++ b/Core/Core.vcxproj.filters
@@ -916,6 +916,9 @@
Nes\Mappers\MMC
+
+ Nes\Mappers\Waixing
+
diff --git a/Core/MapperFactory.cpp b/Core/MapperFactory.cpp
index ba660fc7..1cebe1c0 100644
--- a/Core/MapperFactory.cpp
+++ b/Core/MapperFactory.cpp
@@ -170,6 +170,7 @@
#include "VRC6.h"
#include "VRC7.h"
#include "VsSystem.h"
+#include "Waixing162.h"
#include "Waixing164.h"
#include "Waixing176.h"
#include "Waixing178.h"
@@ -191,7 +192,7 @@ Supported mappers:
|112|113|114|115| |117|118|119|120|121|===| |===| | |===|
|===|===|===|===|132|133| |===|136|137|138|139|140|141|142|143|
|144|145|146|147|148|149|150|151|152|153|154|155|156|157| |159|
-|---|===| |163|164|165|166|167|168|===|170|171|172|173|===|175|
+|---|===|162|163|164|165|166|167|168|===|170|171|172|173|===|175|
|176|177|178|179|180|---|182|183|184|185|186|187|188|189|===|191|
|192|193|194|195| |197| | |200|201|202|203|204|205|206|207|
| |209|210|211|212|213|214| | | |218| | |221|222| |
@@ -345,6 +346,7 @@ BaseMapper* MapperFactory::GetMapperFromID(RomData &romData)
case 156: return new DaouInfosys();
case 157: return new BandaiFcg();
case 159: return new BandaiFcg();
+ case 162: return new Waixing162();
case 163: return new Nanjing();
case 164: return new Waixing164();
case 165: return new MMC3_165();
diff --git a/Core/Waixing162.h b/Core/Waixing162.h
new file mode 100644
index 00000000..67cfa7d1
--- /dev/null
+++ b/Core/Waixing162.h
@@ -0,0 +1,48 @@
+#pragma once
+#include "BaseMapper.h"
+
+class Waixing162 : public BaseMapper
+{
+private:
+ uint8_t _regs[4];
+
+protected:
+ uint16_t GetPRGPageSize() { return 0x8000; }
+ uint16_t GetCHRPageSize() { return 0x2000; }
+ uint16_t RegisterStartAddress() { return 0x5000; }
+ uint16_t RegisterEndAddress() { return 0x5FFF; }
+
+ void InitMapper()
+ {
+ _regs[0] = 3;
+ _regs[1] = 0;
+ _regs[2] = 0;
+ _regs[3] = 7;
+
+ SelectCHRPage(0, 0);
+ UpdateState();
+ }
+
+ void StreamState(bool saving)
+ {
+ BaseMapper::StreamState(saving);
+ ArrayInfo regs{ _regs, 4 };
+ Stream(regs);
+ }
+
+ void UpdateState()
+ {
+ switch(_regs[3] & 0x5) {
+ case 0: SelectPRGPage(0, (_regs[0] & 0x0C) | (_regs[1] & 0x02) | ((_regs[2] & 0x0F) << 4)); break;
+ case 1: SelectPRGPage(0, (_regs[0] & 0x0C) | (_regs[2] & 0x0F) << 4); break;
+ case 4: SelectPRGPage(0, (_regs[0] & 0x0E) | ((_regs[1] >> 1) & 0x01) | ((_regs[2] & 0x0F) << 4)); break;
+ case 5: SelectPRGPage(0, (_regs[0] & 0x0F) | ((_regs[2] & 0x0F) << 4)); break;
+ }
+ }
+
+ void WriteRegister(uint16_t addr, uint8_t value)
+ {
+ _regs[(addr >> 8) & 0x03] = value;
+ UpdateState();
+ }
+};
\ No newline at end of file