This commit is contained in:
zilmar 2016-02-10 17:47:17 +11:00
commit 236a4d2704
15 changed files with 110 additions and 29 deletions

View File

@ -110,6 +110,7 @@
#212# "ロム設定の編集(&S)" #212# "ロム設定の編集(&S)"
#213# "チートの編集(&E)" #213# "チートの編集(&E)"
#214# "ビデオプラグイン" #214# "ビデオプラグイン"
#215# "ディスク有りで起動する"
//Alternate Name to save Slot //Alternate Name to save Slot
#220# "デフォルト" #220# "デフォルト"

View File

@ -74,7 +74,7 @@ the plugin
#include "GlideExtensions.h" #include "GlideExtensions.h"
#include "rdp.h" #include "rdp.h"
#include "Keys.h" #include "Keys.h"
#include "config.h" #include "Config.h"
#include "Settings.h" #include "Settings.h"
#if defined __VISUALC__ #if defined __VISUALC__

View File

@ -1,5 +1,7 @@
#include "trace.h" #include "trace.h"
#include "Config.h" #include "Config.h"
#include <string.h>
#include <Common/Trace.h> #include <Common/Trace.h>
#include <Common/path.h> #include <Common/path.h>
#include <Common/LogClass.h> #include <Common/LogClass.h>

View File

@ -9,7 +9,7 @@
#include <stdlib.h> #include <stdlib.h>
#include "glide.h" #include "glide.h"
#include "glitchmain.h" #include "glitchmain.h"
#include <Glide64\trace.h> #include <Glide64/trace.h>
static int fct[4], source0[4], operand0[4], source1[4], operand1[4], source2[4], operand2[4]; 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]; static int fcta[4], sourcea0[4], operanda0[4], sourcea1[4], operanda1[4], sourcea2[4], operanda2[4];

View File

@ -4,7 +4,7 @@
#endif // _WIN32 #endif // _WIN32
#include "glide.h" #include "glide.h"
#include "glitchmain.h" #include "glitchmain.h"
#include <Glide64\trace.h> #include <Glide64/trace.h>
#define Z_MAX (65536.0f) #define Z_MAX (65536.0f)

View File

@ -17,7 +17,7 @@
#include "glide.h" #include "glide.h"
#include "g3ext.h" #include "g3ext.h"
#include "glitchmain.h" #include "glitchmain.h"
#include <Glide64\trace.h> #include <Glide64/trace.h>
#ifdef VPDEBUG #ifdef VPDEBUG
#include <IL/il.h> #include <IL/il.h>
@ -2964,8 +2964,10 @@ static void CorrectGamma(LPVOID apGammaRamp)
#else #else
static void CorrectGamma(const FxU16 aGammaRamp[3][256]) static void CorrectGamma(const FxU16 aGammaRamp[3][256])
{ {
int res = SDL_SetGammaRamp(aGammaRamp[0], aGammaRamp[1], aGammaRamp[2]); int res;
LOG("SDL_SetGammaRamp returned %d\r\n", res);
res = SDL_SetGammaRamp(aGammaRamp[0], aGammaRamp[1], aGammaRamp[2]);
WriteTrace(TraceGlitch, TraceDebug, "SDL_SetGammaRamp returned %d\r\n", res);
} }
#endif #endif

View File

@ -7,7 +7,7 @@
#include "glitchmain.h" #include "glitchmain.h"
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <Glide64\trace.h> #include <Glide64/trace.h>
/* Napalm extensions to GrTextureFormat_t */ /* Napalm extensions to GrTextureFormat_t */
#define GR_TEXFMT_ARGB_CMP_FXT1 0x11 #define GR_TEXFMT_ARGB_CMP_FXT1 0x11

View File

@ -12,6 +12,7 @@
#include "GBCart.h" #include "GBCart.h"
#include <time.h> #include <time.h>
#include <memory>
static void read_gb_cart_normal(struct gb_cart* gb_cart, uint16_t address, uint8_t* data) static void read_gb_cart_normal(struct gb_cart* gb_cart, uint16_t address, uint8_t* data)
{ {

View File

@ -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 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 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 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: default:
if (g_Settings->LoadBool(Debugger_ShowUnhandledMemory)) 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"); 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"); AndConstToVariable(0xFF, &g_Reg->PI_BSD_DOM1_RLS_REG, "PI_BSD_DOM1_RLS_REG");
break; 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: default:
CPU_Message(" Should be moving %s in to %08X ?!?", x86_Name(Reg), VAddr); CPU_Message(" Should be moving %s in to %08X ?!?", x86_Name(Reg), VAddr);
if (g_Settings->LoadBool(Debugger_ShowUnhandledMemory)) if (g_Settings->LoadBool(Debugger_ShowUnhandledMemory))
@ -5593,4 +5613,4 @@ void CMipsMemoryVM::Write32PifRam(void)
g_MMU->PifRamWrite(); g_MMU->PifRamWrite();
} }
} }
} }

View File

@ -10,9 +10,11 @@
****************************************************************************/ ****************************************************************************/
#include "stdafx.h" #include "stdafx.h"
#include "Mempak.H" #include "Mempak.H"
#include <stdio.h>
#include <Common/path.h> #include <Common/path.h>
uint8_t Mempaks[4][0x8000]; uint8_t Mempaks[4][128 * 256]; /* [CONTROLLERS][PAGES][BYTES_PER_PAGE] */
CPath MempakNames[4]; CPath MempakNames[4];
void Mempak::Load() void Mempak::Load()
@ -44,8 +46,8 @@ void Mempak::Load()
void Mempak::Format(int32_t Control) void Mempak::Format(int32_t Control)
{ {
uint8_t Initialize[] = { 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, 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, 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, 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, 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; Mempaks[Control][count + 1] = 0x03;
} }
} }

View File

@ -161,13 +161,27 @@ void CSystemTimer::UpdateTimers()
int TimeTaken = m_LastUpdate - m_NextTimer; int TimeTaken = m_LastUpdate - m_NextTimer;
if (TimeTaken != 0) if (TimeTaken != 0)
{ {
uint32_t random, wired;
m_LastUpdate = m_NextTimer; m_LastUpdate = m_NextTimer;
g_Reg->COUNT_REGISTER += TimeTaken; g_Reg->COUNT_REGISTER += TimeTaken;
g_Reg->RANDOM_REGISTER -= TimeTaken / g_System->CountPerOp(); random = g_Reg->RANDOM_REGISTER - (TimeTaken / g_System->CountPerOp());
while ((int)g_Reg->RANDOM_REGISTER < (int)g_Reg->WIRED_REGISTER) 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;
} }
} }

View File

@ -5,6 +5,7 @@ mkdir -p $obj
FLAGS_x86="\ FLAGS_x86="\
-S \ -S \
-fPIC \
-masm=intel \ -masm=intel \
-march=native \ -march=native \
-Os" -Os"
@ -40,7 +41,7 @@ $AS -o $obj/SyncEvent.o $obj/SyncEvent.asm
$AS -o $obj/Trace.o $obj/Trace.asm $AS -o $obj/Trace.o $obj/Trace.asm
$AS -o $obj/Util.o $obj/Util.asm $AS -o $obj/Util.o $obj/Util.asm
set OBJ_LIST="\ OBJ_LIST="\
$obj/Util.o \ $obj/Util.o \
$obj/Trace.o \ $obj/Trace.o \
$obj/SyncEvent.o \ $obj/SyncEvent.o \

29
Source/Script/Unix/settings.sh Executable file
View File

@ -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

View File

@ -1,5 +1,8 @@
#include <windows.h>
#include <stdio.h> #include <stdio.h>
#include <string.h>
#include <Common/stdtypes.h>
#include <Common/Platform.h>
#include "Settings.h" #include "Settings.h"
enum SettingLocation { enum SettingLocation {
@ -24,7 +27,7 @@ enum SettingDataType {
}; };
typedef struct { typedef struct {
DWORD dwSize; uint32_t dwSize;
int DefaultStartRange; int DefaultStartRange;
int SettingStartRange; int SettingStartRange;
int MaximumSettings; int MaximumSettings;
@ -35,9 +38,9 @@ typedef struct {
const char * (*GetSettingSz) ( void * handle, int ID, char * Buffer, int BufferLen ); const char * (*GetSettingSz) ( void * handle, int ID, char * Buffer, int BufferLen );
void (*SetSetting) ( void * handle, int ID, unsigned int Value ); void (*SetSetting) ( void * handle, int ID, unsigned int Value );
void (*SetSettingSz) ( void * handle, int ID, const char * Value ); void (*SetSettingSz) ( void * handle, int ID, const char * Value );
void (*RegisterSetting) ( void * handle, int ID, int DefaultID, SettingDataType Type, void (*RegisterSetting) (void * handle, int ID, int DefaultID, SettingDataType Type,
SettingLocation Location, const char * Category, const char * DefaultStr, DWORD Value ); SettingLocation Location, const char * Category, const char * DefaultStr, uint32_t Value);
void (*UseUnregisteredSetting) (int ID); void (*UseUnregisteredSetting) (int ID);
} PLUGIN_SETTINGS; } PLUGIN_SETTINGS;
typedef struct { typedef struct {
@ -55,24 +58,24 @@ static bool g_PluginInitilized = false;
static char g_PluginSettingName[300]; static char g_PluginSettingName[300];
extern "C" { extern "C" {
__declspec(dllexport) void SetSettingInfo (PLUGIN_SETTINGS * info); EXPORT void SetSettingInfo (PLUGIN_SETTINGS * info);
__declspec(dllexport) void SetSettingInfo2 (PLUGIN_SETTINGS2 * info); EXPORT void SetSettingInfo2 (PLUGIN_SETTINGS2 * info);
__declspec(dllexport) void SetSettingInfo3 (PLUGIN_SETTINGS3 * info); EXPORT void SetSettingInfo3 (PLUGIN_SETTINGS3 * info);
} }
__declspec(dllexport) void SetSettingInfo (PLUGIN_SETTINGS * info) EXPORT void SetSettingInfo (PLUGIN_SETTINGS * info)
{ {
g_PluginSettings = *info; g_PluginSettings = *info;
g_PluginInitilized = true; g_PluginInitilized = true;
info->UseUnregisteredSetting = UseUnregisteredSetting; info->UseUnregisteredSetting = UseUnregisteredSetting;
} }
__declspec(dllexport) void SetSettingInfo2 (PLUGIN_SETTINGS2 * info) EXPORT void SetSettingInfo2 (PLUGIN_SETTINGS2 * info)
{ {
g_PluginSettings2 = *info; g_PluginSettings2 = *info;
} }
__declspec(dllexport) void SetSettingInfo3 (PLUGIN_SETTINGS3 * info) EXPORT void SetSettingInfo3 (PLUGIN_SETTINGS3 * info)
{ {
g_PluginSettings3 = *info; g_PluginSettings3 = *info;
} }

View File

@ -4,6 +4,12 @@
extern "C" { extern "C" {
#endif #endif
#if defined(_WIN32)
#define EXPORT __declspec(dllexport)
#else
#define EXPORT __attribute__((visibility("default")))
#endif
// Get Plugin Settings, take a setting id // Get Plugin Settings, take a setting id
unsigned int GetSetting ( short SettingID ); unsigned int GetSetting ( short SettingID );
const char * GetSettingSz ( short SettingID, char * Buffer, int BufferLen ); const char * GetSettingSz ( short SettingID, char * Buffer, int BufferLen );