all: gcc warning clean round 4

* remove unused variable
* move static function from h into cpp
* Initialized hw_by_page to 0xFFFFFFFF instead of -1 (number must be a positive integer)
* Use a s32 fore m_current_lsn instead of u32 (use -1 as error code)
Bonus: a couple of fix for clang compiler (doesn't mean that it fully compile with clang)
* remove useless __debugbreak on linux
* use short for 16bits atomic function


git-svn-id: http://pcsx2.googlecode.com/svn/trunk@5695 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
gregory.hainaut 2013-07-03 18:42:05 +00:00
parent 811a3d96cc
commit ba2ec6fe59
13 changed files with 155 additions and 172 deletions

View File

@ -272,7 +272,7 @@ void operator+=( wxSizer& target, const pxWindowAndFlags<WinType>& src )
// ----------------------------------------------------------------------------
// Pointer Versions! (note that C++ requires one of the two operator params be a
// "poper" object type (non-pointer), so that's why some of these are missing.
// "proper" object type (non-pointer), so that's why some of these are missing.
template< typename WinType >
void operator+=( wxWindow* target, WinType& src )

View File

@ -852,10 +852,12 @@ static __inline__ __attribute__((always_inline)) unsigned long long __rdtsc(void
/*** Interrupts ***/
#ifndef __LINUX__
static __inline__ __attribute__((always_inline)) void __debugbreak(void)
{
__asm__("int $3");
}
#endif
static __inline__ __attribute__((always_inline)) void __int2c(void)
{

View File

@ -46,7 +46,7 @@ protected:
wxString m_filename;
AsyncFileReader* m_reader;
uint m_current_lsn;
s32 m_current_lsn;
uint m_current_count;
isoType m_type;

View File

@ -213,7 +213,7 @@ __ri void mpeg2_idct_add (const int last, s16 * block, s16 * dest, const int str
}
else
{
s16 DC = (block[0] + 4) >> 3;
s16 DC = ((int)block[0] + 4) >> 3;
s16 dcf[2] = { DC, DC };
block[0] = block[63] = 0;

View File

@ -105,7 +105,7 @@ static vtlbHandler
vu1_micro_mem,
vu1_data_mem,
hw_by_page[0x10] = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 },
hw_by_page[0x10] = { 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF},
gs_page_0,
gs_page_1,
@ -665,7 +665,7 @@ __pagealigned u8 eeHw[Ps2MemSize::Hardware];
void memBindConditionalHandlers()
{
if( hw_by_page[0xf] == -1 ) return;
if( hw_by_page[0xf] == 0xFFFFFFFF ) return;
if (EmuConfig.Speedhacks.IntcStat)
{

View File

@ -578,7 +578,7 @@ void GSDeviceOGL::DrawIndexedPrimitive()
void GSDeviceOGL::DrawIndexedPrimitive(int offset, int count)
{
ASSERT(offset + count <= m_index.count);
ASSERT(offset + count <= (int)m_index.count);
BeforeDraw();
m_state.vb->DrawIndexedPrimitive(offset, count);

View File

@ -408,9 +408,9 @@ struct aligned_free_second {template<class T> void operator()(T& p) {_aligned_fr
return retval;
}
__forceinline long _InterlockedExchangeAdd16(volatile short* const Addend, const short Value)
__forceinline short _InterlockedExchangeAdd16(volatile short* const Addend, const short Value)
{
long retval = Value;
short retval = Value;
__asm__("lock; xaddw %[retval], %[Addend]" : [retval] "+r" (retval) : [Addend] "m" (*Addend) : "memory");

View File

@ -86,26 +86,9 @@ extern int SynchMode;
namespace SoundtouchCfg
{
// Timestretch Slider Bounds, Min/Max
static const int SequenceLen_Min = 20;
static const int SequenceLen_Max = 100;
static const int SeekWindow_Min = 10;
static const int SeekWindow_Max = 30;
static const int Overlap_Min = 5;
static const int Overlap_Max = 15;
static int SequenceLenMS = 30;
static int SeekWindowMS = 20;
static int OverlapMS = 10;
void ReadSettings();
void WriteSettings();
void DisplayDialog();
static void ClampValues();
};
void ReadSettings();

View File

@ -26,112 +26,126 @@
namespace SoundtouchCfg
{
void ClampValues()
{
Clampify( SequenceLenMS, SequenceLen_Min, SequenceLen_Max );
Clampify( SeekWindowMS, SeekWindow_Min, SeekWindow_Max );
Clampify( OverlapMS, Overlap_Min, Overlap_Max );
}
void ApplySettings( soundtouch::SoundTouch& sndtouch )
{
sndtouch.setSetting( SETTING_SEQUENCE_MS, SequenceLenMS );
sndtouch.setSetting( SETTING_SEEKWINDOW_MS, SeekWindowMS );
sndtouch.setSetting( SETTING_OVERLAP_MS, OverlapMS );
}
void ReadSettings()
{
SequenceLenMS = CfgReadInt( L"SOUNDTOUCH", L"SequenceLengthMS", 30 );
SeekWindowMS = CfgReadInt( L"SOUNDTOUCH", L"SeekWindowMS", 20 );
OverlapMS = CfgReadInt( L"SOUNDTOUCH", L"OverlapMS", 10 );
ClampValues();
WriteSettings();
}
void WriteSettings()
{
CfgWriteInt( L"SOUNDTOUCH", L"SequenceLengthMS", SequenceLenMS );
CfgWriteInt( L"SOUNDTOUCH", L"SeekWindowMS", SeekWindowMS );
CfgWriteInt( L"SOUNDTOUCH", L"OverlapMS", OverlapMS );
}
static GtkWidget *seq_label, *seek_label, *over_label;
static GtkWidget *seq_slide, *seek_slide, *over_slide;
void restore_defaults()
{
gtk_range_set_value(GTK_RANGE(seq_slide), 30);
gtk_range_set_value(GTK_RANGE(seek_slide), 20);
gtk_range_set_value(GTK_RANGE(over_slide), 10);
}
void DisplayDialog()
{
int return_value;
GtkWidget *dialog, *main_label, *main_frame, *main_box;
GtkWidget *default_button;
ReadSettings();
/* Create the widgets */
dialog = gtk_dialog_new_with_buttons (
"Advanced Settings",
NULL, /* parent window*/
(GtkDialogFlags)(GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT),
GTK_STOCK_OK,
GTK_RESPONSE_ACCEPT,
GTK_STOCK_CANCEL,
GTK_RESPONSE_REJECT,
NULL);
main_label = gtk_label_new ("These are advanced configuration options fine tuning time stretching behavior. Larger values are better for slowdown, while smaller values are better for speedup (more then 60 fps.). All options are in microseconds.");
gtk_label_set_line_wrap (GTK_LABEL(main_label), true);
default_button = gtk_button_new_with_label("Reset to Defaults");
seq_label = gtk_label_new("Sequence Length");
seq_slide = gtk_hscale_new_with_range(SequenceLen_Min, SequenceLen_Max, 2);
gtk_range_set_value(GTK_RANGE(seq_slide), SequenceLenMS);
seek_label = gtk_label_new("Seek Window Size");
seek_slide = gtk_hscale_new_with_range(SeekWindow_Min, SeekWindow_Max, 1);
gtk_range_set_value(GTK_RANGE(seek_slide), SeekWindowMS);
over_label = gtk_label_new("Overlap");
over_slide = gtk_hscale_new_with_range(Overlap_Min, Overlap_Max, 1);
gtk_range_set_value(GTK_RANGE(over_slide), OverlapMS);
main_box = gtk_vbox_new(false, 5);
main_frame = gtk_frame_new ("Spu2-X Config");
gtk_container_add(GTK_CONTAINER (main_box), default_button);
gtk_container_add(GTK_CONTAINER (main_box), seq_label);
gtk_container_add(GTK_CONTAINER (main_box), seq_slide);
gtk_container_add(GTK_CONTAINER (main_box), seek_label);
gtk_container_add(GTK_CONTAINER (main_box), seek_slide);
gtk_container_add(GTK_CONTAINER (main_box), over_label);
gtk_container_add(GTK_CONTAINER (main_box), over_slide);
gtk_container_add(GTK_CONTAINER(main_frame), main_box);
gtk_container_add(GTK_CONTAINER(gtk_dialog_get_content_area(GTK_DIALOG(dialog))), main_label);
gtk_container_add (GTK_CONTAINER(gtk_dialog_get_content_area(GTK_DIALOG(dialog))), main_frame);
gtk_widget_show_all (dialog);
g_signal_connect_swapped(GTK_OBJECT (default_button), "clicked", G_CALLBACK(restore_defaults), default_button);
return_value = gtk_dialog_run (GTK_DIALOG (dialog));
if (return_value == GTK_RESPONSE_ACCEPT)
{
SequenceLenMS = gtk_range_get_value(GTK_RANGE(seq_slide));;
SeekWindowMS = gtk_range_get_value(GTK_RANGE(seek_slide));;
OverlapMS = gtk_range_get_value(GTK_RANGE(over_slide));;
}
gtk_widget_destroy (dialog);
WriteSettings();
}
// Timestretch Slider Bounds, Min/Max
static const int SequenceLen_Min = 20;
static const int SequenceLen_Max = 100;
static const int SeekWindow_Min = 10;
static const int SeekWindow_Max = 30;
static const int Overlap_Min = 5;
static const int Overlap_Max = 15;
static int SequenceLenMS = 30;
static int SeekWindowMS = 20;
static int OverlapMS = 10;
static void ClampValues()
{
Clampify( SequenceLenMS, SequenceLen_Min, SequenceLen_Max );
Clampify( SeekWindowMS, SeekWindow_Min, SeekWindow_Max );
Clampify( OverlapMS, Overlap_Min, Overlap_Max );
}
void ApplySettings( soundtouch::SoundTouch& sndtouch )
{
sndtouch.setSetting( SETTING_SEQUENCE_MS, SequenceLenMS );
sndtouch.setSetting( SETTING_SEEKWINDOW_MS, SeekWindowMS );
sndtouch.setSetting( SETTING_OVERLAP_MS, OverlapMS );
}
void ReadSettings()
{
SequenceLenMS = CfgReadInt( L"SOUNDTOUCH", L"SequenceLengthMS", 30 );
SeekWindowMS = CfgReadInt( L"SOUNDTOUCH", L"SeekWindowMS", 20 );
OverlapMS = CfgReadInt( L"SOUNDTOUCH", L"OverlapMS", 10 );
ClampValues();
WriteSettings();
}
void WriteSettings()
{
CfgWriteInt( L"SOUNDTOUCH", L"SequenceLengthMS", SequenceLenMS );
CfgWriteInt( L"SOUNDTOUCH", L"SeekWindowMS", SeekWindowMS );
CfgWriteInt( L"SOUNDTOUCH", L"OverlapMS", OverlapMS );
}
static GtkWidget *seq_label, *seek_label, *over_label;
static GtkWidget *seq_slide, *seek_slide, *over_slide;
void restore_defaults()
{
gtk_range_set_value(GTK_RANGE(seq_slide), 30);
gtk_range_set_value(GTK_RANGE(seek_slide), 20);
gtk_range_set_value(GTK_RANGE(over_slide), 10);
}
void DisplayDialog()
{
int return_value;
GtkWidget *dialog, *main_label, *main_frame, *main_box;
GtkWidget *default_button;
ReadSettings();
/* Create the widgets */
dialog = gtk_dialog_new_with_buttons (
"Advanced Settings",
NULL, /* parent window*/
(GtkDialogFlags)(GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT),
GTK_STOCK_OK,
GTK_RESPONSE_ACCEPT,
GTK_STOCK_CANCEL,
GTK_RESPONSE_REJECT,
NULL);
main_label = gtk_label_new ("These are advanced configuration options fine tuning time stretching behavior. Larger values are better for slowdown, while smaller values are better for speedup (more then 60 fps.). All options are in microseconds.");
gtk_label_set_line_wrap (GTK_LABEL(main_label), true);
default_button = gtk_button_new_with_label("Reset to Defaults");
seq_label = gtk_label_new("Sequence Length");
seq_slide = gtk_hscale_new_with_range(SequenceLen_Min, SequenceLen_Max, 2);
gtk_range_set_value(GTK_RANGE(seq_slide), SequenceLenMS);
seek_label = gtk_label_new("Seek Window Size");
seek_slide = gtk_hscale_new_with_range(SeekWindow_Min, SeekWindow_Max, 1);
gtk_range_set_value(GTK_RANGE(seek_slide), SeekWindowMS);
over_label = gtk_label_new("Overlap");
over_slide = gtk_hscale_new_with_range(Overlap_Min, Overlap_Max, 1);
gtk_range_set_value(GTK_RANGE(over_slide), OverlapMS);
main_box = gtk_vbox_new(false, 5);
main_frame = gtk_frame_new ("Spu2-X Config");
gtk_container_add(GTK_CONTAINER (main_box), default_button);
gtk_container_add(GTK_CONTAINER (main_box), seq_label);
gtk_container_add(GTK_CONTAINER (main_box), seq_slide);
gtk_container_add(GTK_CONTAINER (main_box), seek_label);
gtk_container_add(GTK_CONTAINER (main_box), seek_slide);
gtk_container_add(GTK_CONTAINER (main_box), over_label);
gtk_container_add(GTK_CONTAINER (main_box), over_slide);
gtk_container_add(GTK_CONTAINER(main_frame), main_box);
gtk_container_add(GTK_CONTAINER(gtk_dialog_get_content_area(GTK_DIALOG(dialog))), main_label);
gtk_container_add (GTK_CONTAINER(gtk_dialog_get_content_area(GTK_DIALOG(dialog))), main_frame);
gtk_widget_show_all (dialog);
g_signal_connect_swapped(GTK_OBJECT (default_button), "clicked", G_CALLBACK(restore_defaults), default_button);
return_value = gtk_dialog_run (GTK_DIALOG (dialog));
if (return_value == GTK_RESPONSE_ACCEPT)
{
SequenceLenMS = gtk_range_get_value(GTK_RANGE(seq_slide));;
SeekWindowMS = gtk_range_get_value(GTK_RANGE(seek_slide));;
OverlapMS = gtk_range_get_value(GTK_RANGE(over_slide));;
}
gtk_widget_destroy (dialog);
WriteSettings();
}
}

View File

@ -37,8 +37,6 @@ static gameHacks tempHacks;
EXPORT_C_(void) GSkeyEvent(keyEvent *ev)
{
static bool bAlt = false;
switch (ev->evt)
{
case KEYPRESS:
@ -61,10 +59,6 @@ EXPORT_C_(void) GSkeyEvent(keyEvent *ev)
THR_bCtrl = true;
break;
case XK_Alt_L:
case XK_Alt_R:
bAlt = true;
break;
}
break;
@ -81,10 +75,6 @@ EXPORT_C_(void) GSkeyEvent(keyEvent *ev)
THR_bCtrl = false;
break;
case XK_Alt_L:
case XK_Alt_R:
bAlt = false;
break;
}
}
}

View File

@ -251,7 +251,7 @@ inline void RenderStartHelper()
// on image y coords. So if we write valpha.z * F + valpha.w + 0.5, it would be switching odd
// and even strings at each frame.
// valpha.x and y are used for image blending.
inline float4 RenderGetForClip(int psm, CRTC_TYPE render_type)
inline void RenderGetForClip(int psm, CRTC_TYPE render_type)
{
SetShaderCaller("RenderGetForClip");
FRAGMENTSHADER* prog = curr_pps(render_type);
@ -292,8 +292,6 @@ inline float4 RenderGetForClip(int psm, CRTC_TYPE render_type)
}
ZZshSetParameter4fv(prog->prog, prog->sOneColor, valpha, "g_fOneColor");
return valpha;
}
// Put interlaced texture in use for shader prog.
@ -577,7 +575,7 @@ inline void RenderCheckForTargets(tex0Info& texframe, list<CRenderTarget*>& list
v = RenderSetTargetBitTrans(ptarg->fbh);
v = RenderSetTargetInvTex(texframe.tbw, ptarg->fbh, CRTC_RENDER_TARG); // FIXME. This is no use
float4 valpha = RenderGetForClip(texframe.psm, CRTC_RENDER_TARG);
RenderGetForClip(texframe.psm, CRTC_RENDER_TARG);
pps = curr_ppsCRTCTarg();
// inside vb[0]'s target area, so render that region only
@ -654,7 +652,7 @@ inline void RenderCheckForMemory(tex0Info& texframe, list<CRenderTarget*>& listT
v = RenderSetTargetBitPos(1, 1, 0);
v = RenderSetTargetBitTrans(texframe.th);
v = RenderSetTargetInvTex(texframe.tw, texframe.th, CRTC_RENDER);
float4 valpha = RenderGetForClip(texframe.psm, CRTC_RENDER);
RenderGetForClip(texframe.psm, CRTC_RENDER);
ZZshGLSetTextureParameter(curr_ppsCRTC()->prog, curr_ppsCRTC()->sMemory, vb[0].pmemtarg->ptex->tex, "CRTC memory");
RenderCreateInterlaceTex(texframe.th, CRTC_RENDER);

View File

@ -664,7 +664,7 @@ inline int FlushGetShaderType(VB& curvb, CRenderTarget* ptextarg, GLuint& ptexcl
//Set page offsets depends on shader type.
inline float4 FlushSetPageOffset(FRAGMENTSHADER* pfragment, int shadertype, CRenderTarget* ptextarg)
inline void FlushSetPageOffset(FRAGMENTSHADER* pfragment, int shadertype, CRenderTarget* ptextarg)
{
SetShaderCaller("FlushSetPageOffset");
@ -692,12 +692,10 @@ inline float4 FlushSetPageOffset(FRAGMENTSHADER* pfragment, int shadertype, CRen
if (PSMT_ISZTEX(ptextarg->psm)) vpageoffset.w = -1.0f;
ZZshSetParameter4fv(pfragment->prog, pfragment->fPageOffset, vpageoffset, "g_fPageOffset");
return vpageoffset;
}
//Setting texture offsets depends on shader type.
inline float4 FlushSetTexOffset(FRAGMENTSHADER* pfragment, int shadertype, VB& curvb, CRenderTarget* ptextarg)
inline void FlushSetTexOffset(FRAGMENTSHADER* pfragment, int shadertype, VB& curvb, CRenderTarget* ptextarg)
{
SetShaderCaller("FlushSetTexOffset");
float4 v;
@ -720,12 +718,10 @@ inline float4 FlushSetTexOffset(FRAGMENTSHADER* pfragment, int shadertype, VB& c
v.w = 8.0f / (float)ptextarg->fbh;
ZZshSetParameter4fv(pfragment->prog, pfragment->fTexOffset, v, "g_fTexOffset");
}
return v;
}
// Set dimension (Real!) of texture. z and w
inline float4 FlushTextureDims(FRAGMENTSHADER* pfragment, int shadertype, VB& curvb, CRenderTarget* ptextarg)
inline void FlushTextureDims(FRAGMENTSHADER* pfragment, int shadertype, VB& curvb, CRenderTarget* ptextarg)
{
SetShaderCaller("FlushTextureDims");
float4 vTexDims;
@ -753,8 +749,6 @@ inline float4 FlushTextureDims(FRAGMENTSHADER* pfragment, int shadertype, VB& cu
vTexDims.z += 8.0f;
ZZshSetParameter4fv(pfragment->prog, pfragment->fTexDims, vTexDims, "g_fTexDims");
return vTexDims;
}
// Apply TEX1 mmag and mmin -- filter for expanding/reducing texture
@ -795,11 +789,11 @@ inline FRAGMENTSHADER* FlushUseExistRenderTarget(VB& curvb, CRenderTarget* ptext
FRAGMENTSHADER* pfragment = ZZshLoadShadeEffect(shadertype, 0, curvb.curprim.fge,
IsAlphaTestExpansion(curvb.tex0), exactcolor, curvb.clamp, context, NULL);
float4 vpageoffset = FlushSetPageOffset(pfragment, shadertype, ptextarg);
FlushSetPageOffset(pfragment, shadertype, ptextarg);
float4 v = FlushSetTexOffset(pfragment, shadertype, curvb, ptextarg);
FlushSetTexOffset(pfragment, shadertype, curvb, ptextarg);
float4 vTexDims = FlushTextureDims(pfragment, shadertype, curvb, ptextarg);
FlushTextureDims(pfragment, shadertype, curvb, ptextarg);
if (pfragment->sCLUT != NULL && ptexclut != 0)
ZZshGLSetTextureParameter(pfragment->prog, pfragment->sCLUT, ptexclut, "CLUT");
@ -1683,7 +1677,7 @@ void SetContextTarget(int context)
}
}
bool bSetTarg = 1;
//bool bSetTarg = 1;
if (curvb.pdepth->status & CRenderTarget::TS_NeedUpdate)
{
@ -1691,7 +1685,7 @@ void SetContextTarget(int context)
// don't update if virtual
curvb.pdepth->Update(context, curvb.prndr);
bSetTarg = 0;
//bSetTarg = 0;
}
GL_REPORT_ERRORD();
@ -2112,13 +2106,16 @@ void SetTexVariablesInt(int context, int bilinear, const tex0Info& tex0, bool Ch
} \
}
//if( a.fix <= 0x80 ) { \
// dwTemp = (a.fix*2)>255?255:(a.fix*2); \
// dwTemp = dwTemp|(dwTemp<<8)|(dwTemp<<16)|0x80000000; \
// ZZLog::Debug_Log("bfactor: %8.8x", dwTemp); \
// glBlendColorEXT(dwTemp); \
// } \
// else { \
#if 0
if( a.fix <= 0x80 ) { \
dwTemp = (a.fix*2)>255?255:(a.fix*2); \
dwTemp = dwTemp|(dwTemp<<8)|(dwTemp<<16)|0x80000000; \
ZZLog::Debug_Log("bfactor: %8.8x", dwTemp); \
glBlendColorEXT(dwTemp); \
} \
else { \
#endif
//void ResetAlphaVariables() {
// FUNCLOG

View File

@ -302,7 +302,6 @@ __attribute__((packed));
// Save image as TGA
bool SaveTGA(const char* filename, int width, int height, void* pdata)
{
int err = 0;
TGA_HEADER hdr;
FILE* f = fopen(filename, "wb");
@ -318,8 +317,8 @@ bool SaveTGA(const char* filename, int width, int height, void* pdata)
hdr.height = height;
hdr.descriptor |= 8 | (1 << 5); // 8bit alpha, flip vertical
err = fwrite(&hdr, sizeof(hdr), 1, f);
err = fwrite(pdata, width * height * 4, 1, f);
fwrite(&hdr, sizeof(hdr), 1, f);
fwrite(pdata, width * height * 4, 1, f);
fclose(f);