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# "デフォルト" 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__ 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 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..4db637b6d 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 @@ -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 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 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) { 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 +} diff --git a/Source/Project64-core/N64System/Mips/Mempak.cpp b/Source/Project64-core/N64System/Mips/Mempak.cpp index c816fbdb8..10b2e01c2 100644 --- a/Source/Project64-core/N64System/Mips/Mempak.cpp +++ b/Source/Project64-core/N64System/Mips/Mempak.cpp @@ -10,9 +10,11 @@ ****************************************************************************/ #include "stdafx.h" #include "Mempak.H" + +#include #include -uint8_t Mempaks[4][0x8000]; +uint8_t Mempaks[4][128 * 256]; /* [CONTROLLERS][PAGES][BYTES_PER_PAGE] */ CPath MempakNames[4]; void Mempak::Load() @@ -44,8 +46,8 @@ void Mempak::Load() void Mempak::Format(int32_t Control) { - uint8_t Initialize[] = { - 0x81, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0C, 0x0D, 0x0E, 0x0F, + 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, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x01, 0xFF, 0x66, 0x25, 0x99, 0xCD, @@ -64,11 +66,11 @@ 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], sizeof(Initialize)); - for (int32_t count = 0x110; count < 0x8000; count += 2) + 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; } } 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; } } diff --git a/Source/Script/Unix/common.sh b/Source/Script/Unix/common.sh index 11fdb8393..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" @@ -40,7 +41,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 \ 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 diff --git a/Source/Settings/Settings.cpp b/Source/Settings/Settings.cpp index 89e419245..7d8e1d964 100644 --- a/Source/Settings/Settings.cpp +++ b/Source/Settings/Settings.cpp @@ -1,5 +1,8 @@ -#include #include +#include + +#include +#include #include "Settings.h" enum SettingLocation { @@ -24,7 +27,7 @@ enum SettingDataType { }; typedef struct { - DWORD dwSize; + uint32_t dwSize; int DefaultStartRange; int SettingStartRange; int MaximumSettings; @@ -35,9 +38,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 { @@ -55,24 +58,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 );