From 53e07d02e2a503ed4f27b41be61c0b38864ba1a9 Mon Sep 17 00:00:00 2001 From: Date: Thu, 4 Feb 2016 14:09:56 -0500 Subject: [PATCH 01/26] Have included to guarantee std::auto_ptr. --- Source/Project64-core/N64System/Mips/GBCart.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/Source/Project64-core/N64System/Mips/GBCart.cpp b/Source/Project64-core/N64System/Mips/GBCart.cpp index 49afdab14..a9e51bfc8 100644 --- a/Source/Project64-core/N64System/Mips/GBCart.cpp +++ b/Source/Project64-core/N64System/Mips/GBCart.cpp @@ -12,6 +12,7 @@ #include "GBCart.h" #include +#include static void read_gb_cart_normal(struct gb_cart* gb_cart, uint16_t address, uint8_t* data) { From 41ff26122a8024bc31cd3531eb56b6376d9cb48e Mon Sep 17 00:00:00 2001 From: Date: Thu, 4 Feb 2016 14:16:46 -0500 Subject: [PATCH 02/26] Have stdio.h to guarantee fopen() and fclose(). --- Source/Project64-core/N64System/Mips/Mempak.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Source/Project64-core/N64System/Mips/Mempak.cpp b/Source/Project64-core/N64System/Mips/Mempak.cpp index 6a29211f7..a6239981b 100644 --- a/Source/Project64-core/N64System/Mips/Mempak.cpp +++ b/Source/Project64-core/N64System/Mips/Mempak.cpp @@ -10,6 +10,8 @@ ****************************************************************************/ #include "stdafx.h" #include "Mempak.H" + +#include #include uint8_t Mempaks[4][0x8000]; From ab7671964bf6c31c8eff6c2bfce3f40bc7f99150 Mon Sep 17 00:00:00 2001 From: Date: Thu, 4 Feb 2016 14:30:23 -0500 Subject: [PATCH 03/26] Re-express Mempaks[][] allocation as pages * bytes_per_page. --- Source/Project64-core/N64System/Mips/Mempak.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/Project64-core/N64System/Mips/Mempak.cpp b/Source/Project64-core/N64System/Mips/Mempak.cpp index 6a29211f7..b28194474 100644 --- a/Source/Project64-core/N64System/Mips/Mempak.cpp +++ b/Source/Project64-core/N64System/Mips/Mempak.cpp @@ -12,7 +12,7 @@ #include "Mempak.H" #include -uint8_t Mempaks[4][0x8000]; +uint8_t Mempaks[4][128 * 256]; /* [CONTROLLERS][PAGES][BYTES_PER_PAGE] */ CPath MempakNames[4]; void Mempak::Load() From 25c537613ee2cac33494c30fecd7bcea47bf544e Mon Sep 17 00:00:00 2001 From: Date: Thu, 4 Feb 2016 14:32:43 -0500 Subject: [PATCH 04/26] *Statically* allocate mempak page 0 buffer. --- Source/Project64-core/N64System/Mips/Mempak.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/Project64-core/N64System/Mips/Mempak.cpp b/Source/Project64-core/N64System/Mips/Mempak.cpp index b28194474..b35b90e24 100644 --- a/Source/Project64-core/N64System/Mips/Mempak.cpp +++ b/Source/Project64-core/N64System/Mips/Mempak.cpp @@ -47,7 +47,7 @@ void Mempak::Load() void Mempak::Format(int32_t Control) { - uint8_t Initialize[] = { + static uint8_t Initialize[] = { 0x81, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0C, 0x0D, 0x0E, 0x0F, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F, 0xFF, 0xFF, 0xFF, 0xFF, 0x05, 0x1A, 0x5F, 0x13, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, From 17a2b6e8fc94c98f595a44de82bbb9ce8f22e008 Mon Sep 17 00:00:00 2001 From: Date: Thu, 4 Feb 2016 14:34:07 -0500 Subject: [PATCH 05/26] Make it const since we'll never write to it. --- Source/Project64-core/N64System/Mips/Mempak.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/Project64-core/N64System/Mips/Mempak.cpp b/Source/Project64-core/N64System/Mips/Mempak.cpp index b35b90e24..16f7323e4 100644 --- a/Source/Project64-core/N64System/Mips/Mempak.cpp +++ b/Source/Project64-core/N64System/Mips/Mempak.cpp @@ -47,7 +47,7 @@ void Mempak::Load() void Mempak::Format(int32_t Control) { - static uint8_t Initialize[] = { + static const uint8_t Initialize[] = { 0x81, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0C, 0x0D, 0x0E, 0x0F, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F, 0xFF, 0xFF, 0xFF, 0xFF, 0x05, 0x1A, 0x5F, 0x13, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, From a8116b09089e9756eb27fe9ff5dec2e7a1c0a104 Mon Sep 17 00:00:00 2001 From: Date: Thu, 4 Feb 2016 14:35:00 -0500 Subject: [PATCH 06/26] Technically, Initialize[] is an array, not a pointer. --- Source/Project64-core/N64System/Mips/Mempak.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/Project64-core/N64System/Mips/Mempak.cpp b/Source/Project64-core/N64System/Mips/Mempak.cpp index 16f7323e4..d3d28dba2 100644 --- a/Source/Project64-core/N64System/Mips/Mempak.cpp +++ b/Source/Project64-core/N64System/Mips/Mempak.cpp @@ -67,7 +67,7 @@ void Mempak::Format(int32_t Control) 0x00, 0x71, 0x00, 0x03, 0x00, 0x03, 0x00, 0x03, 0x00, 0x03, 0x00, 0x03, 0x00, 0x03, 0x00, 0x03, }; - memcpy(&Mempaks[Control][0], Initialize, 0x110); + memcpy(&Mempaks[Control][0], &Initialize[0], 0x110); for (int32_t count = 0x110; count < 0x8000; count += 2) { From b50313da987efff0e1eb51af0381adc79f9901ca Mon Sep 17 00:00:00 2001 From: Date: Thu, 4 Feb 2016 14:37:27 -0500 Subject: [PATCH 07/26] Use sizeof() instead of re-pasting a size literal. --- Source/Project64-core/N64System/Mips/Mempak.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Source/Project64-core/N64System/Mips/Mempak.cpp b/Source/Project64-core/N64System/Mips/Mempak.cpp index d3d28dba2..f6fa87b2b 100644 --- a/Source/Project64-core/N64System/Mips/Mempak.cpp +++ b/Source/Project64-core/N64System/Mips/Mempak.cpp @@ -67,9 +67,9 @@ void Mempak::Format(int32_t Control) 0x00, 0x71, 0x00, 0x03, 0x00, 0x03, 0x00, 0x03, 0x00, 0x03, 0x00, 0x03, 0x00, 0x03, 0x00, 0x03, }; - memcpy(&Mempaks[Control][0], &Initialize[0], 0x110); + memcpy(&Mempaks[Control][0], &Initialize[0], sizeof(Initialize)); - for (int32_t count = 0x110; count < 0x8000; count += 2) + for (int32_t count = sizeof(Initialize); count < 0x8000; count += 2) { Mempaks[Control][count] = 0x00; Mempaks[Control][count + 1] = 0x03; From 8be4b5bb0e4b616ba9ff3452782a09f0646f4381 Mon Sep 17 00:00:00 2001 From: Date: Thu, 4 Feb 2016 14:37:54 -0500 Subject: [PATCH 08/26] Use size_t. --- Source/Project64-core/N64System/Mips/Mempak.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/Project64-core/N64System/Mips/Mempak.cpp b/Source/Project64-core/N64System/Mips/Mempak.cpp index f6fa87b2b..c889c25ab 100644 --- a/Source/Project64-core/N64System/Mips/Mempak.cpp +++ b/Source/Project64-core/N64System/Mips/Mempak.cpp @@ -69,7 +69,7 @@ void Mempak::Format(int32_t Control) memcpy(&Mempaks[Control][0], &Initialize[0], sizeof(Initialize)); - for (int32_t count = sizeof(Initialize); count < 0x8000; count += 2) + for (size_t count = sizeof(Initialize); count < 0x8000; count += 2) { Mempaks[Control][count] = 0x00; Mempaks[Control][count + 1] = 0x03; From ebbecdef7ed9a5371f4c90c508d0238b5351b99e Mon Sep 17 00:00:00 2001 From: Date: Thu, 4 Feb 2016 14:39:43 -0500 Subject: [PATCH 09/26] 0x8000 = 32768 = pages * bytes_per_page --- Source/Project64-core/N64System/Mips/Mempak.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/Project64-core/N64System/Mips/Mempak.cpp b/Source/Project64-core/N64System/Mips/Mempak.cpp index c889c25ab..9d02212b8 100644 --- a/Source/Project64-core/N64System/Mips/Mempak.cpp +++ b/Source/Project64-core/N64System/Mips/Mempak.cpp @@ -69,7 +69,7 @@ void Mempak::Format(int32_t Control) memcpy(&Mempaks[Control][0], &Initialize[0], sizeof(Initialize)); - for (size_t count = sizeof(Initialize); count < 0x8000; count += 2) + for (size_t count = sizeof(Initialize); count < 128 * 256; count += 2) { Mempaks[Control][count] = 0x00; Mempaks[Control][count + 1] = 0x03; From 3dbe8d149484203faf38e0f8164e7c9cb78cf149 Mon Sep 17 00:00:00 2001 From: Date: Thu, 4 Feb 2016 14:40:45 -0500 Subject: [PATCH 10/26] padding by saying + 0 for consistency --- Source/Project64-core/N64System/Mips/Mempak.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/Project64-core/N64System/Mips/Mempak.cpp b/Source/Project64-core/N64System/Mips/Mempak.cpp index 9d02212b8..f80ace038 100644 --- a/Source/Project64-core/N64System/Mips/Mempak.cpp +++ b/Source/Project64-core/N64System/Mips/Mempak.cpp @@ -71,7 +71,7 @@ void Mempak::Format(int32_t Control) for (size_t count = sizeof(Initialize); count < 128 * 256; count += 2) { - Mempaks[Control][count] = 0x00; + Mempaks[Control][count + 0] = 0x00; Mempaks[Control][count + 1] = 0x03; } } From cf221dc21bc7cc2a0ff977a776cace8b58559c24 Mon Sep 17 00:00:00 2001 From: Date: Thu, 4 Feb 2016 14:47:47 -0500 Subject: [PATCH 11/26] Don't use lowercase digits in hex. --- Source/Project64-core/N64System/Mips/Mempak.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/Project64-core/N64System/Mips/Mempak.cpp b/Source/Project64-core/N64System/Mips/Mempak.cpp index f80ace038..b34c6cea0 100644 --- a/Source/Project64-core/N64System/Mips/Mempak.cpp +++ b/Source/Project64-core/N64System/Mips/Mempak.cpp @@ -48,7 +48,7 @@ void Mempak::Load() void Mempak::Format(int32_t Control) { static const uint8_t Initialize[] = { - 0x81, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0C, 0x0D, 0x0E, 0x0F, + 0x81, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F, 0xFF, 0xFF, 0xFF, 0xFF, 0x05, 0x1A, 0x5F, 0x13, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x01, 0xFF, 0x66, 0x25, 0x99, 0xCD, From 440fd437b0fd64265cd2ed9d20779d6d1a63959c Mon Sep 17 00:00:00 2001 From: Nekokabu Date: Fri, 5 Feb 2016 08:29:52 +0900 Subject: [PATCH 12/26] Update Japanese.pj.Lang --- Lang/Japanese.pj.Lang | 1 + 1 file changed, 1 insertion(+) diff --git a/Lang/Japanese.pj.Lang b/Lang/Japanese.pj.Lang index 7d2ae8fdf..bd59acc57 100644 --- a/Lang/Japanese.pj.Lang +++ b/Lang/Japanese.pj.Lang @@ -110,6 +110,7 @@ #212# "ロム設定の編集(&S)" #213# "チートの編集(&E)" #214# "ビデオプラグイン" +#215# "ディスク有りで起動する" //Alternate Name to save Slot #220# "デフォルト" From ab55df84e28fac2994ddcc180dfb5795d32533d9 Mon Sep 17 00:00:00 2001 From: Date: Thu, 4 Feb 2016 20:48:44 -0500 Subject: [PATCH 13/26] [Glide64] fixed yet again the case-sensitive include --- Source/Glide64/Gfx_1.3.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/Glide64/Gfx_1.3.h b/Source/Glide64/Gfx_1.3.h index 3421ac4ea..ac48a5afa 100644 --- a/Source/Glide64/Gfx_1.3.h +++ b/Source/Glide64/Gfx_1.3.h @@ -74,7 +74,7 @@ the plugin #include "GlideExtensions.h" #include "rdp.h" #include "Keys.h" -#include "config.h" +#include "Config.h" #include "Settings.h" #if defined __VISUALC__ From 8e11a9e1ae75f467d4453b80a64190736f258e2a Mon Sep 17 00:00:00 2001 From: Date: Fri, 5 Feb 2016 02:46:48 -0500 Subject: [PATCH 14/26] [Glitch64] need forward slashes for C standard paths --- Source/Glitch64/OGLcombiner.cpp | 2 +- Source/Glitch64/OGLgeometry.cpp | 2 +- Source/Glitch64/OGLglitchmain.cpp | 2 +- Source/Glitch64/OGLtextures.cpp | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Source/Glitch64/OGLcombiner.cpp b/Source/Glitch64/OGLcombiner.cpp index 63890e498..ce38857ff 100644 --- a/Source/Glitch64/OGLcombiner.cpp +++ b/Source/Glitch64/OGLcombiner.cpp @@ -9,7 +9,7 @@ #include #include "glide.h" #include "glitchmain.h" -#include +#include static int fct[4], source0[4], operand0[4], source1[4], operand1[4], source2[4], operand2[4]; static int fcta[4], sourcea0[4], operanda0[4], sourcea1[4], operanda1[4], sourcea2[4], operanda2[4]; diff --git a/Source/Glitch64/OGLgeometry.cpp b/Source/Glitch64/OGLgeometry.cpp index bf98ddea3..9c8397c45 100644 --- a/Source/Glitch64/OGLgeometry.cpp +++ b/Source/Glitch64/OGLgeometry.cpp @@ -4,7 +4,7 @@ #endif // _WIN32 #include "glide.h" #include "glitchmain.h" -#include +#include #define Z_MAX (65536.0f) diff --git a/Source/Glitch64/OGLglitchmain.cpp b/Source/Glitch64/OGLglitchmain.cpp index caacbf452..3ed7bc6d3 100644 --- a/Source/Glitch64/OGLglitchmain.cpp +++ b/Source/Glitch64/OGLglitchmain.cpp @@ -17,7 +17,7 @@ #include "glide.h" #include "g3ext.h" #include "glitchmain.h" -#include +#include #ifdef VPDEBUG #include diff --git a/Source/Glitch64/OGLtextures.cpp b/Source/Glitch64/OGLtextures.cpp index 3da9311dd..a51cabc92 100644 --- a/Source/Glitch64/OGLtextures.cpp +++ b/Source/Glitch64/OGLtextures.cpp @@ -7,7 +7,7 @@ #include "glitchmain.h" #include #include -#include +#include /* Napalm extensions to GrTextureFormat_t */ #define GR_TEXFMT_ARGB_CMP_FXT1 0x11 From 3609ca388eee91edf2fdad23afc76ea667764ef0 Mon Sep 17 00:00:00 2001 From: Date: Fri, 5 Feb 2016 02:57:00 -0500 Subject: [PATCH 15/26] [Glitch64] unresolved reference to old macro LOG() --- Source/Glitch64/OGLglitchmain.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Source/Glitch64/OGLglitchmain.cpp b/Source/Glitch64/OGLglitchmain.cpp index caacbf452..abf1aa6c5 100644 --- a/Source/Glitch64/OGLglitchmain.cpp +++ b/Source/Glitch64/OGLglitchmain.cpp @@ -2964,8 +2964,10 @@ static void CorrectGamma(LPVOID apGammaRamp) #else static void CorrectGamma(const FxU16 aGammaRamp[3][256]) { - int res = SDL_SetGammaRamp(aGammaRamp[0], aGammaRamp[1], aGammaRamp[2]); - LOG("SDL_SetGammaRamp returned %d\r\n", res); + int res; + + res = SDL_SetGammaRamp(aGammaRamp[0], aGammaRamp[1], aGammaRamp[2]); + WriteTrace(TraceGlitch, TraceDebug, "SDL_SetGammaRamp returned %d\r\n", res); } #endif From 1580876b1598f92d2a45dc646d0883c51bce4bb7 Mon Sep 17 00:00:00 2001 From: cxd4 Date: Fri, 5 Feb 2016 03:32:43 -0500 Subject: [PATCH 16/26] [Common] leftover remnant of Win32 command shell I found out the hard way while getting `libglitch64.a` to link into PJ64 Glide64 on Linux that I was getting an 8-byte static library file. This was because the Unix shell variable `$OBJ_LIST` was null, due to using the `set` keyword which was a result of lazy copy pasta while porting my MinGW script to compile the PJ64 Common library on Windows. --- Source/Script/Unix/common.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/Script/Unix/common.sh b/Source/Script/Unix/common.sh index 11fdb8393..c5bcaf6c6 100755 --- a/Source/Script/Unix/common.sh +++ b/Source/Script/Unix/common.sh @@ -40,7 +40,7 @@ $AS -o $obj/SyncEvent.o $obj/SyncEvent.asm $AS -o $obj/Trace.o $obj/Trace.asm $AS -o $obj/Util.o $obj/Util.asm -set OBJ_LIST="\ +OBJ_LIST="\ $obj/Util.o \ $obj/Trace.o \ $obj/SyncEvent.o \ From a8fa0067404c894b63edf3a226a65518bc3ead6e Mon Sep 17 00:00:00 2001 From: Date: Fri, 5 Feb 2016 18:53:58 -0500 Subject: [PATCH 17/26] [Glide64] undeclared memset and strlen in trace.cpp --- Source/Glide64/trace.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Source/Glide64/trace.cpp b/Source/Glide64/trace.cpp index 8d9dd4067..62bcd5035 100644 --- a/Source/Glide64/trace.cpp +++ b/Source/Glide64/trace.cpp @@ -1,5 +1,7 @@ #include "trace.h" #include "Config.h" + +#include #include #include #include From e08b1b93ec3790accda7bcd16975fac073225bb0 Mon Sep 17 00:00:00 2001 From: LegendOfDragoon Date: Sat, 6 Feb 2016 00:07:15 -0800 Subject: [PATCH 18/26] Optimize UpdateTimers --- .../N64System/Mips/SystemTiming.cpp | 20 ++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/Source/Project64-core/N64System/Mips/SystemTiming.cpp b/Source/Project64-core/N64System/Mips/SystemTiming.cpp index 9d301bdc6..736e9518b 100644 --- a/Source/Project64-core/N64System/Mips/SystemTiming.cpp +++ b/Source/Project64-core/N64System/Mips/SystemTiming.cpp @@ -161,13 +161,27 @@ void CSystemTimer::UpdateTimers() int TimeTaken = m_LastUpdate - m_NextTimer; if (TimeTaken != 0) { + uint32_t random, wired; m_LastUpdate = m_NextTimer; g_Reg->COUNT_REGISTER += TimeTaken; - g_Reg->RANDOM_REGISTER -= TimeTaken / g_System->CountPerOp(); - while ((int)g_Reg->RANDOM_REGISTER < (int)g_Reg->WIRED_REGISTER) + random = g_Reg->RANDOM_REGISTER - (TimeTaken / g_System->CountPerOp()); + wired = g_Reg->WIRED_REGISTER; + if ((int)random < (int)wired) { - g_Reg->RANDOM_REGISTER += 32 - g_Reg->WIRED_REGISTER; + if (wired == 0) + { + random &= 31; + } + else + { + uint32_t increment = 32 - wired; + do + { + random += increment; + } while ((int)random < (int)wired); + } } + g_Reg->RANDOM_REGISTER = random; } } From 37f41f2d45525b6e28ef29a25b2018594c7abc68 Mon Sep 17 00:00:00 2001 From: Date: Sat, 6 Feb 2016 05:36:44 -0500 Subject: [PATCH 19/26] [Common] 64-bit needs -fPIC for sectional linkage. --- Source/Script/Unix/common.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/Source/Script/Unix/common.sh b/Source/Script/Unix/common.sh index c5bcaf6c6..0e152110a 100755 --- a/Source/Script/Unix/common.sh +++ b/Source/Script/Unix/common.sh @@ -5,6 +5,7 @@ mkdir -p $obj FLAGS_x86="\ -S \ + -fPIC \ -masm=intel \ -march=native \ -Os" From b9b64035b5859a8cdf7924446c79cf61c22f3c90 Mon Sep 17 00:00:00 2001 From: Nekokabu Date: Sat, 6 Feb 2016 23:05:32 +0900 Subject: [PATCH 20/26] disable some trying to store XXXXXXXX error --- .../N64System/Mips/MemoryVirtualMem.cpp | 22 ++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/Source/Project64-core/N64System/Mips/MemoryVirtualMem.cpp b/Source/Project64-core/N64System/Mips/MemoryVirtualMem.cpp index 0da3988e1..22cc10891 100644 --- a/Source/Project64-core/N64System/Mips/MemoryVirtualMem.cpp +++ b/Source/Project64-core/N64System/Mips/MemoryVirtualMem.cpp @@ -1594,6 +1594,10 @@ void CMipsMemoryVM::Compile_SW_Const(uint32_t Value, uint32_t VAddr) case 0x04600018: MoveConstToVariable((Value & 0xFF), &g_Reg->PI_BSD_DOM1_PWD_REG, "PI_BSD_DOM1_PWD_REG"); break; case 0x0460001C: MoveConstToVariable((Value & 0xFF), &g_Reg->PI_BSD_DOM1_PGS_REG, "PI_BSD_DOM1_PGS_REG"); break; case 0x04600020: MoveConstToVariable((Value & 0xFF), &g_Reg->PI_BSD_DOM1_RLS_REG, "PI_BSD_DOM1_RLS_REG"); break; + case 0x04600024: MoveConstToVariable((Value & 0xFF), &g_Reg->PI_DOMAIN2_REG, "PI_DOMAIN2_REG"); break; + case 0x04600028: MoveConstToVariable((Value & 0xFF), &g_Reg->PI_BSD_DOM2_PWD_REG, "PI_BSD_DOM2_PWD_REG"); break; + case 0x0460002C: MoveConstToVariable((Value & 0xFF), &g_Reg->PI_BSD_DOM2_PGS_REG, "PI_BSD_DOM2_PGS_REG"); break; + case 0x04600030: MoveConstToVariable((Value & 0xFF), &g_Reg->PI_BSD_DOM2_RLS_REG, "PI_BSD_DOM2_RLS_REG"); break; default: if (g_Settings->LoadBool(Debugger_ShowUnhandledMemory)) { @@ -1977,6 +1981,22 @@ void CMipsMemoryVM::Compile_SW_Register(x86Reg Reg, uint32_t VAddr) MoveX86regToVariable(Reg, &g_Reg->PI_BSD_DOM1_RLS_REG, "PI_BSD_DOM1_RLS_REG"); AndConstToVariable(0xFF, &g_Reg->PI_BSD_DOM1_RLS_REG, "PI_BSD_DOM1_RLS_REG"); break; + case 0x04600024: + MoveX86regToVariable(Reg, &g_Reg->PI_DOMAIN2_REG, "PI_DOMAIN2_REG"); + AndConstToVariable(0xFF, &g_Reg->PI_DOMAIN2_REG, "PI_DOMAIN2_REG"); + break; + case 0x04600028: + MoveX86regToVariable(Reg, &g_Reg->PI_BSD_DOM2_PWD_REG, "PI_BSD_DOM2_PWD_REG"); + AndConstToVariable(0xFF, &g_Reg->PI_BSD_DOM2_PWD_REG, "PI_BSD_DOM2_PWD_REG"); + break; + case 0x0460002C: + MoveX86regToVariable(Reg, &g_Reg->PI_BSD_DOM2_PGS_REG, "PI_BSD_DOM2_PGS_REG"); + AndConstToVariable(0xFF, &g_Reg->PI_BSD_DOM2_PGS_REG, "PI_BSD_DOM2_PGS_REG"); + break; + case 0x04600030: + MoveX86regToVariable(Reg, &g_Reg->PI_BSD_DOM2_RLS_REG, "PI_BSD_DOM2_RLS_REG"); + AndConstToVariable(0xFF, &g_Reg->PI_BSD_DOM2_RLS_REG, "PI_BSD_DOM2_RLS_REG"); + break; default: CPU_Message(" Should be moving %s in to %08X ?!?", x86_Name(Reg), VAddr); if (g_Settings->LoadBool(Debugger_ShowUnhandledMemory)) @@ -5593,4 +5613,4 @@ void CMipsMemoryVM::Write32PifRam(void) g_MMU->PifRamWrite(); } } -} \ No newline at end of file +} From 3038a8f288d5b6e6b10331ca4e8b1db03d41a9f2 Mon Sep 17 00:00:00 2001 From: Date: Sat, 6 Feb 2016 17:23:27 -0500 Subject: [PATCH 21/26] [Settings] #define EXPORT to abolish some MSVC-isms. --- Source/Settings/Settings.cpp | 12 ++++++------ Source/Settings/Settings.h | 6 ++++++ 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/Source/Settings/Settings.cpp b/Source/Settings/Settings.cpp index 89e419245..e9ca21b60 100644 --- a/Source/Settings/Settings.cpp +++ b/Source/Settings/Settings.cpp @@ -55,24 +55,24 @@ static bool g_PluginInitilized = false; static char g_PluginSettingName[300]; extern "C" { -__declspec(dllexport) void SetSettingInfo (PLUGIN_SETTINGS * info); -__declspec(dllexport) void SetSettingInfo2 (PLUGIN_SETTINGS2 * info); -__declspec(dllexport) void SetSettingInfo3 (PLUGIN_SETTINGS3 * info); +EXPORT void SetSettingInfo (PLUGIN_SETTINGS * info); +EXPORT void SetSettingInfo2 (PLUGIN_SETTINGS2 * info); +EXPORT void SetSettingInfo3 (PLUGIN_SETTINGS3 * info); } -__declspec(dllexport) void SetSettingInfo (PLUGIN_SETTINGS * info) +EXPORT void SetSettingInfo (PLUGIN_SETTINGS * info) { g_PluginSettings = *info; g_PluginInitilized = true; info->UseUnregisteredSetting = UseUnregisteredSetting; } -__declspec(dllexport) void SetSettingInfo2 (PLUGIN_SETTINGS2 * info) +EXPORT void SetSettingInfo2 (PLUGIN_SETTINGS2 * info) { g_PluginSettings2 = *info; } -__declspec(dllexport) void SetSettingInfo3 (PLUGIN_SETTINGS3 * info) +EXPORT void SetSettingInfo3 (PLUGIN_SETTINGS3 * info) { g_PluginSettings3 = *info; } diff --git a/Source/Settings/Settings.h b/Source/Settings/Settings.h index 6b0177981..0b570ed58 100644 --- a/Source/Settings/Settings.h +++ b/Source/Settings/Settings.h @@ -4,6 +4,12 @@ extern "C" { #endif +#if defined(_WIN32) +#define EXPORT __declspec(dllexport) +#else +#define EXPORT __attribute__((visibility("default"))) +#endif + // Get Plugin Settings, take a setting id unsigned int GetSetting ( short SettingID ); const char * GetSettingSz ( short SettingID, char * Buffer, int BufferLen ); From 393cbc09dd472d0fe8097fbf2abb145c63d17e5e Mon Sep 17 00:00:00 2001 From: Date: Sat, 6 Feb 2016 17:25:04 -0500 Subject: [PATCH 22/26] [Settings] Remove windows.h to see why we need it. :P --- Source/Settings/Settings.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/Source/Settings/Settings.cpp b/Source/Settings/Settings.cpp index e9ca21b60..4f055f052 100644 --- a/Source/Settings/Settings.cpp +++ b/Source/Settings/Settings.cpp @@ -1,4 +1,3 @@ -#include #include #include "Settings.h" From 4dcc7eda5cc9c36386b870a7f4330121267bb539 Mon Sep 17 00:00:00 2001 From: Date: Sat, 6 Feb 2016 17:31:52 -0500 Subject: [PATCH 23/26] [Settings] Replace DWORD w/ unsigned long or maybe uint32_t. --- Source/Settings/Settings.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/Source/Settings/Settings.cpp b/Source/Settings/Settings.cpp index 4f055f052..def8e400d 100644 --- a/Source/Settings/Settings.cpp +++ b/Source/Settings/Settings.cpp @@ -1,4 +1,6 @@ #include + +#include #include "Settings.h" enum SettingLocation { @@ -23,7 +25,7 @@ enum SettingDataType { }; typedef struct { - DWORD dwSize; + uint32_t dwSize; int DefaultStartRange; int SettingStartRange; int MaximumSettings; @@ -34,9 +36,9 @@ typedef struct { const char * (*GetSettingSz) ( void * handle, int ID, char * Buffer, int BufferLen ); void (*SetSetting) ( void * handle, int ID, unsigned int Value ); void (*SetSettingSz) ( void * handle, int ID, const char * Value ); - void (*RegisterSetting) ( void * handle, int ID, int DefaultID, SettingDataType Type, - SettingLocation Location, const char * Category, const char * DefaultStr, DWORD Value ); - void (*UseUnregisteredSetting) (int ID); + void (*RegisterSetting) (void * handle, int ID, int DefaultID, SettingDataType Type, + SettingLocation Location, const char * Category, const char * DefaultStr, uint32_t Value); + void (*UseUnregisteredSetting) (int ID); } PLUGIN_SETTINGS; typedef struct { From 7e7f78630cf6a677d61a0b5425f310cfdb019e1a Mon Sep 17 00:00:00 2001 From: Date: Sat, 6 Feb 2016 17:33:46 -0500 Subject: [PATCH 24/26] [Settings] _snprintf is #define'd in Common/Platform.h. --- Source/Settings/Settings.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/Source/Settings/Settings.cpp b/Source/Settings/Settings.cpp index def8e400d..166ba4784 100644 --- a/Source/Settings/Settings.cpp +++ b/Source/Settings/Settings.cpp @@ -1,6 +1,7 @@ #include #include +#include #include "Settings.h" enum SettingLocation { From 56ed3cbc66394c4fe780a5a0289b2b715d181509 Mon Sep 17 00:00:00 2001 From: Date: Sat, 6 Feb 2016 17:34:46 -0500 Subject: [PATCH 25/26] [Settings] unresolved strlen() --- Source/Settings/Settings.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/Source/Settings/Settings.cpp b/Source/Settings/Settings.cpp index 166ba4784..7d8e1d964 100644 --- a/Source/Settings/Settings.cpp +++ b/Source/Settings/Settings.cpp @@ -1,4 +1,5 @@ #include +#include #include #include From fd4c2902d2ad94a49d0497b77233741e33038135 Mon Sep 17 00:00:00 2001 From: Date: Sat, 6 Feb 2016 17:35:50 -0500 Subject: [PATCH 26/26] [Settings] added working Unix build shell script --- Source/Script/Unix/settings.sh | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100755 Source/Script/Unix/settings.sh diff --git a/Source/Script/Unix/settings.sh b/Source/Script/Unix/settings.sh new file mode 100755 index 000000000..14d4f452f --- /dev/null +++ b/Source/Script/Unix/settings.sh @@ -0,0 +1,29 @@ +src=./../../Settings +obj=./Settings + +mkdir -p $obj + +FLAGS_x86="\ + -S \ + -fPIC \ + -I$src/.. \ + -masm=intel \ + -march=native \ + -Os" + +C_FLAGS=$FLAGS_x86 + +CC=g++ +AS=as + +echo Compiling settings library sources for Project64... +$CC -o $obj/Settings.asm $src/Settings.cpp $C_FLAGS + +echo Assembling settings library sources... +$AS -o $obj/Settings.o $obj/Settings.asm + +OBJ_LIST="\ + $obj/Settings.o" + +echo Linking static library objects for Settings... +ar rcs $obj/libsettings.a $OBJ_LIST