This commit is contained in:
zilmar 2015-02-02 17:12:09 +11:00
commit b10487ee07
11 changed files with 117 additions and 52 deletions

View File

@ -15607,12 +15607,15 @@ void Combine ()
left = cc_lookup[actual_combine>>24];
right = cc_lookup[(actual_combine>>24)+1];
while (1)
{
do {
last = current;
current = left + ((right-left) >> 1);
if (current == last)
{
FRDP("Warning! Could not initialize current_combiner to valid index.\n");
current_combine = ~0u; /* Debug uncertain case, and fix warning (cxd4). */
break; // can't be found!
}
current_combine = color_cmb_list[current].key;
if (current_combine < actual_combine)
@ -15621,7 +15624,7 @@ void Combine ()
right = current;
else
break; // found it!
}
} while (1);
// Check if we didn't find it
if (actual_combine != current_combine)
@ -15981,15 +15984,10 @@ void InitCombine ()
if (const char * extstr = strstr(extensions, "COMBINE")) {
if (!strncmp(extstr, "COMBINE", 7)) {
LOG ("extensions ");
char strColorCombineExt[] = "grColorCombineExt";
cmb.grColorCombineExt = (GRCOLORCOMBINEEXT) grColorCombineExt;
char strAlphaCombineExt[] = "grAlphaCombineExt";
cmb.grAlphaCombineExt = (GRCOLORCOMBINEEXT)grAlphaCombineExt;
char strTexColorCombineExt[] = "grTexColorCombineExt";
cmb.grTexColorCombineExt = (GRTEXCOLORCOMBINEEXT)grTexColorCombineExt ;
char strTexAlphaCombineExt[] = "grTexAlphaCombineExt";
cmb.grTexAlphaCombineExt = (GRTEXCOLORCOMBINEEXT) grTexAlphaCombineExt ;
char strConstantColorValueExt[] = "grConstantColorValueExt";
cmb.grConstantColorValueExt = (GRCONSTANTCOLORVALUEEXT) grConstantColorValueExt;
if (cmb.grColorCombineExt && cmb.grAlphaCombineExt &&
cmb.grTexColorCombineExt && cmb.grTexAlphaCombineExt)
@ -16012,12 +16010,15 @@ void InitCombine ()
void ColorCombinerToExtension ()
{
wxUint32 ext_local, ext_local_a, ext_other, ext_other_a;
switch (cmb.c_loc)
{
case GR_COMBINE_LOCAL_ITERATED:
ext_local = GR_CMBX_ITRGB;
ext_local_a = GR_CMBX_ITALPHA;
break;
default:
FRDP("Invalid combiner locality %u.\n", cmb.c_loc);
case GR_COMBINE_LOCAL_CONSTANT:
ext_local = GR_CMBX_CONSTANT_COLOR;
ext_local_a = GR_CMBX_CONSTANT_ALPHA;
@ -16033,6 +16034,8 @@ void ColorCombinerToExtension ()
ext_other = GR_CMBX_TEXTURE_RGB;
ext_other_a = GR_CMBX_TEXTURE_ALPHA;
break;
default:
FRDP("Invalid combiner flag %u.\n", cmb.c_oth);
case GR_COMBINE_OTHER_CONSTANT:
ext_other = GR_CMBX_CONSTANT_COLOR;
ext_other_a = GR_CMBX_CONSTANT_ALPHA;
@ -16378,6 +16381,8 @@ void TexColorCombinerToExtension (GrChipID_t tmu)
tc_ext_c = GR_CMBX_OTHER_TEXTURE_ALPHA;
tc_ext_c_invert = 1;
break;
default:
FRDP("Invalid combiner TMU factor %u.\n", tmu_fac);
case GR_COMBINE_FACTOR_ONE_MINUS_DETAIL_FACTOR:
tc_ext_c = GR_CMBX_DETAIL_FACTOR;
tc_ext_c_invert = 1;
@ -16472,6 +16477,8 @@ void TexColorCombinerToExtension (GrChipID_t tmu)
tc_ext_d = GR_CMBX_B;
tc_ext_d_invert = 0;
break;
default:
FRDP("Invalid combiner TMU function %u.\n", tmu_func);
case GR_COMBINE_FUNCTION_SCALE_MINUS_LOCAL_ADD_LOCAL_ALPHA:
tc_ext_a = GR_CMBX_LOCAL_TEXTURE_RGB;
tc_ext_a_mode = GR_FUNC_MODE_ZERO;
@ -16555,6 +16562,8 @@ void TexAlphaCombinerToExtension (GrChipID_t tmu)
ta_ext_c = GR_CMBX_OTHER_TEXTURE_ALPHA;
ta_ext_c_invert = 1;
break;
default:
FRDP("Invalid combiner alpha factor %u.\n", tmu_a_fac);
case GR_COMBINE_FACTOR_ONE_MINUS_DETAIL_FACTOR:
ta_ext_c = GR_CMBX_DETAIL_FACTOR;
ta_ext_c_invert = 1;
@ -16618,6 +16627,8 @@ void TexAlphaCombinerToExtension (GrChipID_t tmu)
ta_ext_d = GR_CMBX_B;
ta_ext_d_invert = 0;
break;
default:
FRDP("Invalid combiner alpha coverage function %u.\n", tmu_a_func);
case GR_COMBINE_FUNCTION_SCALE_MINUS_LOCAL_ADD_LOCAL:
case GR_COMBINE_FUNCTION_SCALE_MINUS_LOCAL_ADD_LOCAL_ALPHA:
ta_ext_a = GR_CMBX_LOCAL_TEXTURE_ALPHA;

View File

@ -705,7 +705,12 @@ int FindTextureBuffer(wxUint32 addr, wxUint16 width)
if (rdp.tbuff_tex->crc == 0)
{
rdp.tbuff_tex->crc = CalcCRC(rdp.tbuff_tex);
bCorrect = width == 1 || rdp.tbuff_tex->width == width || (rdp.tbuff_tex->width > 320 && rdp.tbuff_tex->width == width*2);
bCorrect =
(width == 1)
|| (rdp.tbuff_tex->width == width)
|| ( (rdp.tbuff_tex->width > 320)
&& (rdp.tbuff_tex->width == (wxUint32)width*2)
);
}
else
bCorrect = rdp.tbuff_tex->crc == CalcCRC(rdp.tbuff_tex);

View File

@ -861,11 +861,13 @@ void TexCache ()
if (fullscreen)
{
int tmu_v[2];
tmu_v[0] = tmu_0;
tmu_v[1] = tmu_1;
for (int i=0; i<2; i++)
{
int tmu;
if (i==0) tmu=tmu_0;
else if (i==1) tmu=tmu_1;
const int tmu = tmu_v[i];
if (tmu >= voodoo.num_tmu) continue;

View File

@ -42,7 +42,14 @@
#include "TexLoad16b.h"
#include "TexLoad32b.h"
wxUint32 LoadNone (wxUIntPtr dst, wxUIntPtr src, int wid_64, int height, int line, int /*real_width*/, int tile)
wxUint32 LoadNone(
wxUIntPtr /*dst*/,
wxUIntPtr /*src*/,
int /*wid_64*/,
int /*height*/,
int /*line*/,
int /*real_width*/,
int /*tile*/)
{
memset (texture, 0, 4096*4);
return (1 << 16) | GR_TEXFMT_ARGB_1555;

View File

@ -1639,13 +1639,13 @@ static void rdp_setprimdepth()
static void rdp_setothermode()
{
#define F3DEX2_SETOTHERMODE(cmd,sft,len,data) { \
rdp.cmd0 = (cmd<<24) | ((32-(sft)-(len))<<8) | (((len)-1)); \
rdp.cmd1 = data; \
rdp.cmd0 = (wxUint32)(((cmd)<<24) | ((32-(sft)-(len))<<8) | (((len)-1))); \
rdp.cmd1 = (wxUint32)(data); \
gfx_instruction[settings.ucode][cmd] (); \
}
#define SETOTHERMODE(cmd,sft,len,data) { \
rdp.cmd0 = (cmd<<24) | ((sft)<<8) | (len); \
rdp.cmd1 = data; \
rdp.cmd0 = (wxUint32)(((cmd)<<24) | ((sft)<<8) | (len)); \
rdp.cmd1 = (wxUint32)(data); \
gfx_instruction[settings.ucode][cmd] (); \
}
@ -3002,10 +3002,16 @@ input: FrameBufferModifyEntry *plist
size = size of the plist, max = 1024
output: none
*******************************************************************/
EXPORT void CALL FBWList(FrameBufferModifyEntry *plist, wxUint32 size)
#ifdef RDP_LOGGING
EXPORT void CALL FBWList(FrameBufferModifyEntry* /*plist*/, wxUint32 size)
#else
EXPORT void CALL FBWList(FrameBufferModifyEntry* /*plist*/, wxUint32)
#endif
{
LOG ("FBWList ()\n");
#ifdef RDP_LOGGING
FRDP("FBWList. size: %d\n", size);
#endif
}
@ -3018,7 +3024,7 @@ val val
size 1 = wxUint8, 2 = wxUint16, 4 = wxUint32
output: none
*******************************************************************/
EXPORT void CALL FBWrite(wxUint32 addr, wxUint32 size)
EXPORT void CALL FBWrite(wxUint32 addr, wxUint32 /*size*/)
{
LOG ("FBWrite ()\n");
if (cpu_fb_ignore)

View File

@ -99,6 +99,8 @@ static void uc9_draw_object (wxUint8 * addr, wxUint32 type)
{
wxUint32 textured, vnum, vsize;
switch (type) {
default: /* added to fix uninitialized variable warnings + debugging */
FRDP("Unknown geometric primitive type %u.\n", type);
case 0: //null
textured = vnum = vsize = 0;
break;
@ -264,6 +266,10 @@ static void uc9_fmlight ()
case 8:
m = (M44*)rdp.combined;
break;
default:
m = NULL; /* allowing segfaults to debug in case of PJGlide64 bugs */
FRDP("Invalid FM light matrix ID %u.\n", mid);
break;
}
rdp.light[rdp.num_lights].r = (float)(((wxUint8*)gfx.DMEM)[(a+0)^3]) / 255.0f;
@ -400,6 +406,10 @@ static void uc9_mtxcat ()
s = (M44*)rdp.combined;
LRDP("Comb * ");
break;
default:
FRDP("Invalid mutex S-coordinate: %u\n", S);
s = NULL; /* intentional segfault to alert for bugs in PJGlide64 (cxd4) */
break;
}
switch (T) {
case 4:
@ -414,6 +424,10 @@ static void uc9_mtxcat ()
LRDP("Comb -> ");
t = (M44*)rdp.combined;
break;
default:
FRDP("Invalid mutex T-coordinate: %u\n", T);
t = NULL; /* intentional segfault to alert for bugs in PJGlide64 (cxd4) */
break;
}
DECLAREALIGN16VAR(m[4][4]);
MulMatrices(*s, *t, m);

View File

@ -213,7 +213,7 @@ int screen_width, screen_height;
static inline void opt_glCopyTexImage2D( GLenum target,
GLint level,
GLenum internalFormat,
GLint internalFormat,
GLint x,
GLint y,
GLsizei width,
@ -352,7 +352,10 @@ static fb fbs[100];
static int nb_fb = 0;
static unsigned int curBufferAddr = 0;
struct TMU_USAGE { int min, max; } tmu_usage[2] = { {0xfffffff, 0}, {0xfffffff, 0} };
struct TMU_USAGE { unsigned long min, max; } tmu_usage[2] = {
{ 0x0FFFFFFFul, 0x00000000ul },
{ 0x0FFFFFFFul, 0x00000000ul },
};
struct texbuf_t {
FxU32 start, end;
@ -500,8 +503,8 @@ grClipWindow( FxU32 minx, FxU32 miny, FxU32 maxx, FxU32 maxy )
maxy = th - maxy;
miny = th - miny;
FxU32 tmp = maxy; maxy = miny; miny = tmp;
if (maxx > width) maxx = width;
if (maxy > height) maxy = height;
if ((FxI32)maxx > width) maxx = width;
if ((FxI32)maxy > height) maxy = height;
if (int(minx) < 0) minx = 0;
if (int(miny) < 0) miny = 0;
if (maxx < minx) maxx = minx;
@ -604,13 +607,15 @@ grSstWinOpenExt(
GrScreenRefresh_t refresh_rate,
GrColorFormat_t color_format,
GrOriginLocation_t origin_location,
GrPixelFormat_t pixelformat,
GrPixelFormat_t /*pixelformat*/,
int nColBuffers,
int nAuxBuffers)
{
LOG("grSstWinOpenExt(%d, %d, %d, %d, %d, %d %d)\r\n", hWnd, screen_resolution, refresh_rate, color_format, origin_location, nColBuffers, nAuxBuffers);
return grSstWinOpen(hWnd, screen_resolution, refresh_rate, color_format,
origin_location, nColBuffers, nAuxBuffers);
LOG(
"grSstWinOpenExt(%d, %d, %d, %d, %d, %d %d)\r\n",
hWnd, screen_resolution, refresh_rate, color_format, origin_location, nColBuffers, nAuxBuffers);
return grSstWinOpen(
hWnd, screen_resolution, refresh_rate, color_format, origin_location, nColBuffers, nAuxBuffers);
}
#ifdef WIN32
@ -1173,8 +1178,8 @@ grSstWinClose( GrContext_t context )
LOG("grSstWinClose(%d)\r\n", context);
for (i=0; i<2; i++) {
tmu_usage[i].min = 0xfffffff;
tmu_usage[i].max = 0;
tmu_usage[i].min = 0x0FFFFFFFul;
tmu_usage[i].max = 0x00000000ul;
invtex[i] = 0;
}
@ -1328,10 +1333,10 @@ FX_ENTRY void FX_CALL grTextureBufferExt( GrChipID_t tmu,
int rtmu = startAddress < grTexMinAddress(GR_TMU1)? 0 : 1;
int size = pBufferWidth*pBufferHeight*2; //grTexFormatSize(fmt);
if (tmu_usage[rtmu].min > pBufferAddress)
tmu_usage[rtmu].min = pBufferAddress;
if (tmu_usage[rtmu].max < pBufferAddress+size)
tmu_usage[rtmu].max = pBufferAddress+size;
if (tmu_usage[rtmu].min > pBufferAddress + 0)
tmu_usage[rtmu].min = pBufferAddress + 0;
if (tmu_usage[rtmu].max < pBufferAddress + size)
tmu_usage[rtmu].max = pBufferAddress + size;
// printf("tmu %d usage now %gMb - %gMb\n",
// rtmu, tmu_usage[rtmu].min/1024.0f, tmu_usage[rtmu].max/1024.0f);

View File

@ -56,6 +56,7 @@
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="main.cpp" />
<ClCompile Include="Plugins\Plugin Base.cpp" />
<ClCompile Include="stdafx.cpp">
<PrecompiledHeader>Create</PrecompiledHeader>
</ClCompile>
@ -197,6 +198,7 @@
<ClInclude Include="Multilanguage.h" />
<ClInclude Include="N64 System.h" />
<ClInclude Include="Plugin.h" />
<ClInclude Include="Plugins\Plugin Base.h" />
<ClInclude Include="Settings.h" />
<ClInclude Include="stdafx.h" />
<ClInclude Include="User Interface.h" />

View File

@ -417,6 +417,9 @@
<ClCompile Include="3rd Party\zlib\zip.c">
<Filter>Source Files\3rd Party Source\ZLib Source</Filter>
</ClCompile>
<ClCompile Include="Plugins\Plugin Base.cpp">
<Filter>Source Files\Plugin Source</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<Image Include="User Interface\Bitmaps\AboutScreenBottom.bmp">
@ -839,5 +842,8 @@
<ClInclude Include="3rd Party\zlib\ZLIB.H">
<Filter>Header Files\3rd Party Headers\Zlib Headers</Filter>
</ClInclude>
<ClInclude Include="Plugins\Plugin Base.h">
<Filter>Header Files\Plugin Headers</Filter>
</ClInclude>
</ItemGroup>
</Project>

View File

@ -167,12 +167,12 @@ bool CMainMenu::ProcessMessage(HWND hWnd, DWORD /*FromAccelerator*/, DWORD MenuI
_makepath( SaveFile, drive, dir, fname, NULL );
}
}
g_Settings->SaveString(GameRunning_InstantSaveFile,SaveFile);
g_Settings->SaveString(GameRunning_InstantSaveFile, SaveFile);
char SaveDir[MAX_PATH];
_makepath( SaveDir, drive, dir, NULL, NULL );
g_Settings->SaveString(Directory_LastSave,SaveDir);
g_System->SaveState();
g_BaseSystem->ExternalEvent(SysEvent_SaveMachineState);
}
g_BaseSystem->ExternalEvent(SysEvent_ResumeCPU_SaveGame);
}

View File

@ -102,6 +102,7 @@ BOOL IsNextInstructionMmx(DWORD PC) {
return TRUE;
case RSP_VECTOR_VADD:
case RSP_VECTOR_VSUB:
/* Requires no accumulator write! & No flags! */
if (WriteToAccum(Low16BitAccum, CompilePC) == TRUE) {
return FALSE;
@ -1398,7 +1399,11 @@ void GetInstructionInfo(DWORD PC, OPCODE * RspOp, OPCODE_INFO * info) {
info->DestReg = RspOp->rt;
info->SourceReg0 = (DWORD)-1;
info->SourceReg1 = (DWORD)-1;
info->flags = COPO_MF_Instruction | GPR_Instruction | Load_Operation;
if (RspOp->rd == 0x4 || RspOp->rd == 0x7){
info->flags = InvalidOpcode;
} else{
info->flags = COPO_MF_Instruction | GPR_Instruction | Load_Operation;
}
break;
case RSP_COP0_MT:
@ -1421,16 +1426,25 @@ void GetInstructionInfo(DWORD PC, OPCODE * RspOp, OPCODE_INFO * info) {
break;
case RSP_VECTOR_VMULF:
case RSP_VECTOR_VMULU:
case RSP_VECTOR_VMUDL:
case RSP_VECTOR_VMUDM:
case RSP_VECTOR_VMUDN:
case RSP_VECTOR_VMUDH:
case RSP_VECTOR_VABS:
case RSP_VECTOR_VAND:
case RSP_VECTOR_VOR:
case RSP_VECTOR_VXOR:
case RSP_VECTOR_VNAND:
case RSP_VECTOR_VNOR:
case RSP_VECTOR_VNXOR:
info->DestReg = RspOp->sa;
info->SourceReg0 = RspOp->rd;
info->SourceReg1 = RspOp->rt;
info->flags = VEC_Instruction | VEC_ResetAccum | Accum_Operation;
break;
case RSP_VECTOR_VMACF:
case RSP_VECTOR_VMACU:
case RSP_VECTOR_VMADL:
case RSP_VECTOR_VMADM:
case RSP_VECTOR_VMADN:
@ -1440,23 +1454,13 @@ void GetInstructionInfo(DWORD PC, OPCODE * RspOp, OPCODE_INFO * info) {
info->SourceReg1 = RspOp->rt;
info->flags = VEC_Instruction | VEC_Accumulate | Accum_Operation;
break;
case RSP_VECTOR_VABS:
case RSP_VECTOR_VADD:
case RSP_VECTOR_VADDC:
case RSP_VECTOR_VSUB:
case RSP_VECTOR_VSUBC:
case RSP_VECTOR_VAND:
case RSP_VECTOR_VOR:
case RSP_VECTOR_VXOR:
case RSP_VECTOR_VNXOR:
case RSP_VECTOR_VCR:
case RSP_VECTOR_VCH:
case RSP_VECTOR_VCL:
case RSP_VECTOR_VRCP:
case RSP_VECTOR_VRCPL:
case RSP_VECTOR_VRCPH:
case RSP_VECTOR_VRSQL:
case RSP_VECTOR_VRSQH:
case RSP_VECTOR_VLT:
case RSP_VECTOR_VEQ:
case RSP_VECTOR_VGE:
@ -1468,19 +1472,22 @@ void GetInstructionInfo(DWORD PC, OPCODE * RspOp, OPCODE_INFO * info) {
break;
case RSP_VECTOR_VMOV:
info->flags = InvalidOpcode;
/* info->DestReg = RspOp->sa;
case RSP_VECTOR_VRCP:
case RSP_VECTOR_VRCPL:
case RSP_VECTOR_VRCPH:
case RSP_VECTOR_VRSQL:
case RSP_VECTOR_VRSQH:
info->DestReg = RspOp->sa;
info->SourceReg0 = RspOp->rt;
info->SourceReg1 = -1;
info->flags = VEC_Instruction; /* Assume reset? */
info->flags = VEC_Instruction | VEC_ResetAccum | Accum_Operation; /* Assume reset? */
break;
case RSP_VECTOR_VMRG:
info->flags = InvalidOpcode;
/* info->DestReg = RspOp->sa;
info->DestReg = RspOp->sa;
info->SourceReg0 = RspOp->rt;
info->SourceReg1 = RspOp->rd;
info->flags = VEC_Instruction; /* Assum reset? */
info->flags = VEC_Instruction | VEC_ResetAccum | Accum_Operation | Flag_Instruction; /* Assum reset? */
break;
case RSP_VECTOR_VSAW: