This commit is contained in:
ramapcsx2 2014-07-15 11:56:55 +02:00
commit 3daff15f34
13 changed files with 67 additions and 73 deletions

View File

@ -185,19 +185,20 @@ set(CMAKE_SHARED_LIBRARY_CXX_FLAGS "")
#------------------------------------------------------------------------------- #-------------------------------------------------------------------------------
# Set some default compiler flags # Set some default compiler flags
#------------------------------------------------------------------------------- #-------------------------------------------------------------------------------
set(COMMON_FLAG "-pipe -std=c++0x -fvisibility=hidden -pthread")
set(HARDENING_FLAG "-D_FORTIFY_SOURCE=2 -Wformat -Wformat-security")
# -Wno-attributes: "always_inline function might not be inlinable" <= real spam (thousand of warnings!!!) # -Wno-attributes: "always_inline function might not be inlinable" <= real spam (thousand of warnings!!!)
# -Wstrict-aliasing: to fix one day aliasing issue # -Wstrict-aliasing: to fix one day aliasing issue
# -Wno-missing-field-initializers: standard allow to init only the begin of struct/array in static init. Just a silly warning. # -Wno-missing-field-initializers: standard allow to init only the begin of struct/array in static init. Just a silly warning.
# -Wno-unused-function: warn for function not used in release build # -Wno-unused-function: warn for function not used in release build
# -Wno-unused-variable: just annoying to manage different level of logging, a couple of extra var won't kill any serious compiler. # -Wno-unused-variable: just annoying to manage different level of logging, a couple of extra var won't kill any serious compiler.
# -Wno-deprecated-register: glib issue...
set(DEFAULT_WARNINGS "-Wall -Wno-attributes -Wstrict-aliasing -Wno-missing-field-initializers -Wno-unused-function -Wno-unused-parameter -Wno-unused-variable") set(DEFAULT_WARNINGS "-Wall -Wno-attributes -Wstrict-aliasing -Wno-missing-field-initializers -Wno-unused-function -Wno-unused-parameter -Wno-unused-variable")
if (USE_CLANG)
set(DEFAULT_WARNINGS "${DEFAULT_WARNINGS} -Wno-deprecated-register")
endif()
set(HARDENING_FLAG "-D_FORTIFY_SOURCE=2 -Wformat -Wformat-security") if (USE_CLANG)
set(COMMON_FLAG "-pipe -std=c++0x -fvisibility=hidden -pthread") # -Wno-deprecated-register: glib issue...
set(DEFAULT_WARNINGS "${DEFAULT_WARNINGS} -Wno-deprecated-register")
set(COMMON_FLAG "${COMMON_FLAG} -no-integrated-as")
endif()
if(CMAKE_BUILD_TYPE MATCHES "Debug|Devel") if(CMAKE_BUILD_TYPE MATCHES "Debug|Devel")
set(DEBUG_FLAG "-g") set(DEBUG_FLAG "-g")

View File

@ -11,10 +11,7 @@ set(Output Utilities)
# set common flags # set common flags
set(CommonFlags set(CommonFlags
-fno-dse
-fno-guess-branch-probability
-fno-strict-aliasing -fno-strict-aliasing
-fno-tree-dse
) )
# set optimization flags # set optimization flags
@ -58,6 +55,11 @@ set(OptimizationFlags
-ftree-vrp -ftree-vrp
-funit-at-a-time) -funit-at-a-time)
#Clang doesn't support a few common flags that GCC does.
if(NOT USE_CLANG)
add_definitions(${CommonFlags} -fno-guess-branch-probability -fno-dse -fno-tree-dse)
endif(NOT USE_CLANG)
# Debug - Build # Debug - Build
if(CMAKE_BUILD_TYPE STREQUAL Debug) if(CMAKE_BUILD_TYPE STREQUAL Debug)

View File

@ -11,9 +11,6 @@ set(Output x86emitter)
# set common flags # set common flags
set(CommonFlags set(CommonFlags
-fno-guess-branch-probability
-fno-dse
-fno-tree-dse
-fno-strict-aliasing -fno-strict-aliasing
) )
@ -58,6 +55,11 @@ set(OptimizationFlags
-ftree-vrp -ftree-vrp
-funit-at-a-time) -funit-at-a-time)
#Clang doesn't support a few common flags that GCC does.
if(NOT USE_CLANG)
add_definitions(${CommonFlags} -fno-guess-branch-probability -fno-dse -fno-tree-dse)
endif(NOT USE_CLANG)
# Debug - Build # Debug - Build
if(CMAKE_BUILD_TYPE STREQUAL Debug) if(CMAKE_BUILD_TYPE STREQUAL Debug)

View File

@ -12,14 +12,12 @@ set(CommonFlags
# Disable this optimization for the moment # Disable this optimization for the moment
-fno-omit-frame-pointer -fno-omit-frame-pointer
# END GCC-4.6 # END GCC-4.6
-fno-guess-branch-probability -fno-strict-aliasing
-fno-dse
-fno-tree-dse
-fno-strict-aliasing
-Wno-parentheses -Wno-parentheses
-Wstrict-aliasing # Allow to track strict aliasing issue. -Wstrict-aliasing # Allow to track strict aliasing issue.
-Wno-char-subscripts # only impact svu which is deprecated -Wno-char-subscripts # only impact svu which is deprecated
-Wno-missing-braces -Wno-missing-braces
-Wno-ignored-attributes
) )
# set optimization flags # set optimization flags
@ -63,6 +61,11 @@ set(OptimizationFlags
-ftree-vrp -ftree-vrp
-funit-at-a-time) -funit-at-a-time)
#Clang doesn't support a few common flags that GCC does.
if(NOT USE_CLANG)
add_definitions(${CommonFlags} -fno-guess-branch-probability -fno-dse -fno-tree-dse)
endif(NOT USE_CLANG)
# Debug - Build # Debug - Build
if(CMAKE_BUILD_TYPE STREQUAL Debug) if(CMAKE_BUILD_TYPE STREQUAL Debug)
set(Output pcsx2-dbg) set(Output pcsx2-dbg)

View File

@ -12,7 +12,6 @@ set(Output GSdx-0.1.16)
set(CommonFlags set(CommonFlags
-D_LINUX -D_LINUX
-fno-operator-names # because Xbyak uses and()/xor()/or()/not() function -fno-operator-names # because Xbyak uses and()/xor()/or()/not() function
-mpreferred-stack-boundary=2
-mfpmath=sse -mfpmath=sse
#-Wstrict-aliasing # Allow to track strict aliasing issue. #-Wstrict-aliasing # Allow to track strict aliasing issue.
-std=c++0x -std=c++0x
@ -27,6 +26,11 @@ set(OptimizationFlags
-DNDEBUG -DNDEBUG
) )
#Clang doesn't support a few common flags that GCC does.
if(NOT USE_CLANG)
add_definitions(${CommonFlags} -mpreferred-stack-boundary=2)
endif(NOT USE_CLANG)
# Debug - Build # Debug - Build
if(CMAKE_BUILD_TYPE STREQUAL Debug) if(CMAKE_BUILD_TYPE STREQUAL Debug)
add_definitions(${CommonFlags} -D_DEBUG -g -Wall) add_definitions(${CommonFlags} -D_DEBUG -g -Wall)

View File

@ -98,20 +98,17 @@ int FileStream::read(byte* b, int len)
string FileStream::readLine() string FileStream::readLine()
{ {
string s; string s;
char c;
s.clear(); s.clear();
do { while (!eof())
if(eof()) {
char c = read();
if ((c == '\n') || (c == '\r') || (c == '\0'))
break; break;
c = read(); s.append(1, c);
}
if((c=='\n')||(c=='\r')||(c==0))
break;
s.append(1,c);
} while(true);
return s; return s;
} }
@ -119,20 +116,17 @@ string FileStream::readLine()
wstring FileStream::readLineW() wstring FileStream::readLineW()
{ {
wstring s; wstring s;
wchar_t c;
s.clear(); s.clear();
do { while (!eof())
if(eof()) {
wchar_t c = read<wchar_t>();
if ((c == L'\n') || (c == L'\r') || (c == L'\0'))
break; break;
c = read<wchar_t>(); s.append(1, c);
}
if((c==L'\n')||(c==L'\r')||(c==0))
break;
s.append(1,c);
} while(true);
return s; return s;
} }

View File

@ -37,12 +37,12 @@ s32 cdvdParseTOC()
return 0; return 0;
} }
s32 lastaddr = src->GetLayerBreakAddress(); s32 lastaddr = src->GetLayerBreakAddress();
if(lastaddr>=0) if(lastaddr>=0)
{ {
if((lastaddr > 0)&&(tracks[0].length>lastaddr)) if((lastaddr > 0)&&(tracks[0].length>lastaddr))
{ {
tracks[1].length=lastaddr+1; tracks[1].length=lastaddr+1;
tracks[1].type=0; tracks[1].type=0;
@ -54,14 +54,14 @@ s32 cdvdParseTOC()
strack=1; strack=1;
etrack=2; etrack=2;
} }
else else
{ {
tracks[1].length=tracks[0].length; tracks[1].length=tracks[0].length;
tracks[1].type=0; tracks[1].type=0;
strack=1; strack=1;
etrack=1; etrack=1;
} }
} }
else else
{ {
@ -136,7 +136,7 @@ s32 cdvdParseTOC()
if((cdtoc.Descriptors[i].Control&4)==0) if((cdtoc.Descriptors[i].Control&4)==0)
{ {
tracks[tn].type = 1; tracks[tn].type = CDVD_AUDIO_TRACK;
} }
else if((cdtoc.Descriptors[i].Control&0xE)==4) else if((cdtoc.Descriptors[i].Control&0xE)==4)
{ {

View File

@ -60,7 +60,7 @@ void OnInitDialog(HWND hW) {
} }
} }
vector<tap_adapter> * al=GetTapAdapters(); vector<tap_adapter> * al=GetTapAdapters();
for (int i=0; i<al->size(); i++) { for (size_t i=0; i<al->size(); i++) {
int itm=ComboBox_AddString(GetDlgItem(hW, IDC_ETHDEV), al[0][i].name.c_str()); int itm=ComboBox_AddString(GetDlgItem(hW, IDC_ETHDEV), al[0][i].name.c_str());
ComboBox_SetItemData(GetDlgItem(hW, IDC_ETHDEV),itm,strdup( al[0][i].guid.c_str())); ComboBox_SetItemData(GetDlgItem(hW, IDC_ETHDEV),itm,strdup( al[0][i].guid.c_str()));

View File

@ -131,10 +131,10 @@ void tx_process()
{ {
//we loop based on count ? or just *use* it ? //we loop based on count ? or just *use* it ?
u32 cnt=dev9Ru8(SMAP_R_TXFIFO_FRAME_CNT); u32 cnt=dev9Ru8(SMAP_R_TXFIFO_FRAME_CNT);
//spams// printf("tx_process : %d cnt frames !\n",cnt); //spams// printf("tx_process : %u cnt frames !\n",cnt);
NetPacket pk; NetPacket pk;
int fc=0; u32 fc=0;
for (fc=0;fc<cnt;fc++) for (fc=0;fc<cnt;fc++)
{ {
smap_bd_t *pbd= ((smap_bd_t *)&dev9.dev9R[SMAP_BD_TX_BASE & 0xffff])+dev9.txbdi; smap_bd_t *pbd= ((smap_bd_t *)&dev9.dev9R[SMAP_BD_TX_BASE & 0xffff])+dev9.txbdi;
@ -146,7 +146,7 @@ void tx_process()
} }
if (pbd->length&3) if (pbd->length&3)
{ {
//spams// emu_printf("WARN : pbd->length not alligned %d\n",pbd->length); //spams// emu_printf("WARN : pbd->length not aligned %u\n",pbd->length);
} }
if(pbd->length>1514) if(pbd->length>1514)
@ -157,13 +157,13 @@ void tx_process()
{ {
u32 base=(pbd->pointer-0x1000)&16383; u32 base=(pbd->pointer-0x1000)&16383;
DEV9_LOG("Sending Packet from base %x, size %d\n", base, pbd->length); DEV9_LOG("Sending Packet from base %x, size %d\n", base, pbd->length);
//spams// emu_printf("Sending Packet from base %x, size %d\n", base, pbd->length); //spams// emu_printf("Sending Packet from base %x, size %u\n", base, pbd->length);
pk.size=pbd->length; pk.size=pbd->length;
if (!(pbd->pointer>=0x1000)) if (!(pbd->pointer>=0x1000))
{ {
emu_printf("ERROR: odd , !pbd->pointer>0x1000 | 0x%X %d\n", pbd->pointer, pbd->length); emu_printf("ERROR: odd , !pbd->pointer>0x1000 | 0x%X %u\n", pbd->pointer, pbd->length);
} }
//increase fifo pointer(s) //increase fifo pointer(s)
//uh does that even exist on real h/w ? //uh does that even exist on real h/w ?
@ -205,7 +205,7 @@ void tx_process()
u32 was=16384-base; u32 was=16384-base;
memcpy(pk.buffer,dev9.txfifo+base,was); memcpy(pk.buffer,dev9.txfifo+base,was);
memcpy(pk.buffer,dev9.txfifo,pbd->length-was); memcpy(pk.buffer,dev9.txfifo,pbd->length-was);
printf("Warped read, was=%d, sz=%d, sz-was=%d\n",was,pbd->length,pbd->length-was); printf("Warped read, was=%u, sz=%u, sz-was=%u\n", was, pbd->length, pbd->length-was);
} }
else else
{ {
@ -225,7 +225,7 @@ void tx_process()
dev9Ru8(SMAP_R_TXFIFO_FRAME_CNT)--; dev9Ru8(SMAP_R_TXFIFO_FRAME_CNT)--;
} }
//spams// emu_printf("processed %d frames, %d count, cnt = %d\n",fc,dev9Ru8(SMAP_R_TXFIFO_FRAME_CNT),cnt); //spams// emu_printf("processed %u frames, %u count, cnt = %u\n",fc,dev9Ru8(SMAP_R_TXFIFO_FRAME_CNT),cnt);
//if some error/early exit signal TXDNV //if some error/early exit signal TXDNV
if (fc!=cnt || cnt==0) if (fc!=cnt || cnt==0)
{ {
@ -252,7 +252,7 @@ void emac3_write(u32 addr)
DEV9_LOG("SMAP: SMAP_R_EMAC3_TxMODE0_L write %x\n", value); DEV9_LOG("SMAP: SMAP_R_EMAC3_TxMODE0_L write %x\n", value);
//spams// emu_printf("SMAP: SMAP_R_EMAC3_TxMODE0_L write %x\n", value); //spams// emu_printf("SMAP: SMAP_R_EMAC3_TxMODE0_L write %x\n", value);
//Process TX here ? //Process TX here ?
if (!value&SMAP_E3_TX_GNP_0) if (!(value & SMAP_E3_TX_GNP_0))
emu_printf("SMAP_R_EMAC3_TxMODE0_L: SMAP_E3_TX_GNP_0 not set\n"); emu_printf("SMAP_R_EMAC3_TxMODE0_L: SMAP_E3_TX_GNP_0 not set\n");
tx_process(); tx_process();
@ -486,10 +486,6 @@ u16 CALLBACK smap_read16(u32 addr)
DEV9_LOG("SMAP : Unknown 16 bit read @ %X,v=%X\n",addr,dev9Ru16(addr)); DEV9_LOG("SMAP : Unknown 16 bit read @ %X,v=%X\n",addr,dev9Ru16(addr));
return dev9Ru16(addr); return dev9Ru16(addr);
} }
DEV9_LOG("SMAP : error , 16 bit read @ %X,v=%X\n",addr,dev9Ru16(addr));
return dev9Ru16(addr);
} }
u32 CALLBACK smap_read32(u32 addr) u32 CALLBACK smap_read32(u32 addr)
{ {
@ -529,9 +525,6 @@ u32 CALLBACK smap_read32(u32 addr)
DEV9_LOG("SMAP : Unknown 32 bit read @ %X,v=%X\n",addr,dev9Ru32(addr)); DEV9_LOG("SMAP : Unknown 32 bit read @ %X,v=%X\n",addr,dev9Ru32(addr));
return dev9Ru32(addr); return dev9Ru32(addr);
} }
DEV9_LOG("SMAP : error , 32 bit read @ %X,v=%X\n",addr,dev9Ru32(addr));
return dev9Ru32(addr);
} }
void CALLBACK smap_write8(u32 addr, u8 value) void CALLBACK smap_write8(u32 addr, u8 value)
{ {
@ -599,9 +592,6 @@ void CALLBACK smap_write8(u32 addr, u8 value)
dev9Ru8(addr) = value; dev9Ru8(addr) = value;
return; return;
} }
DEV9_LOG("SMAP : error , 8 bit write @ %X,v=%X\n",addr,value);
dev9Ru8(addr) = value;
} }
void CALLBACK smap_write16(u32 addr, u16 value) void CALLBACK smap_write16(u32 addr, u16 value)
{ {
@ -782,9 +772,6 @@ void CALLBACK smap_write16(u32 addr, u16 value)
dev9Ru16(addr) = value; dev9Ru16(addr) = value;
return; return;
} }
DEV9_LOG("SMAP : error , 16 bit write @ %X,v=%X\n",addr,value);
dev9Ru16(addr) = value;
} }
void CALLBACK smap_write32(u32 addr, u32 value) void CALLBACK smap_write32(u32 addr, u32 value)
{ {
@ -809,9 +796,6 @@ void CALLBACK smap_write32(u32 addr, u32 value)
dev9Ru32(addr) = value; dev9Ru32(addr) = value;
return; return;
} }
DEV9_LOG("SMAP : error , 32 bit write @ %X,v=%X\n",addr,value);
dev9Ru32(addr) = value;
} }
void CALLBACK smap_readDMA8Mem(u32 *pMem, int size) void CALLBACK smap_readDMA8Mem(u32 *pMem, int size)
{ {

View File

@ -116,7 +116,7 @@ static void __forceinline IncrementNextA(V_Core& thiscore, uint voiceidx)
// Important! Both cores signal IRQ when an address is read, regardless of // Important! Both cores signal IRQ when an address is read, regardless of
// which core actually reads the address. // which core actually reads the address.
for( uint i=0; i<2; i++ ) for( int i=0; i<2; i++ )
{ {
if( Cores[i].IRQEnable && (vc.NextA==Cores[i].IRQA ) ) if( Cores[i].IRQEnable && (vc.NextA==Cores[i].IRQA ) )
{ {
@ -522,7 +522,7 @@ static __forceinline s32 GetNoiseValues( V_Core& thiscore, uint voiceidx )
static __forceinline void spu2M_WriteFast( u32 addr, s16 value ) static __forceinline void spu2M_WriteFast( u32 addr, s16 value )
{ {
// Fixes some of the oldest hangs in pcsx2's history! :p // Fixes some of the oldest hangs in pcsx2's history! :p
for( uint i=0; i<2; i++ ) for( int i=0; i<2; i++ )
{ {
if( Cores[i].IRQEnable && Cores[i].IRQA == addr ) if( Cores[i].IRQEnable && Cores[i].IRQA == addr )
{ {

View File

@ -140,7 +140,7 @@ StereoOut32 V_Core::DoReverb( const StereoOut32& Input )
// within that zone then the "bulk" of the test is skipped, so this should only // within that zone then the "bulk" of the test is skipped, so this should only
// be a slowdown on a few evil games. // be a slowdown on a few evil games.
for( uint i=0; i<2; i++ ) for( int i=0; i<2; i++ )
{ {
if( Cores[i].IRQEnable && ((Cores[i].IRQA >= EffectsStartA) && (Cores[i].IRQA <= EffectsEndA)) ) if( Cores[i].IRQEnable && ((Cores[i].IRQA >= EffectsStartA) && (Cores[i].IRQA <= EffectsEndA)) )
{ {

View File

@ -189,9 +189,9 @@ void SndBuffer::UpdateTempoChangeSoundTouch2()
#endif #endif
//Algorithm params: (threshold params (hysteresis), etc) //Algorithm params: (threshold params (hysteresis), etc)
const float hys_ok_factor=1.04; const float hys_ok_factor = 1.04f;
const float hys_bad_factor = 1.2f;
int hys_min_ok_count = GetClamped((int)(50.0 *(float)targetIPS/750.0), 2, 100); //consecutive iterations within hys_ok before going to 1:1 mode int hys_min_ok_count = GetClamped((int)(50.0 *(float)targetIPS/750.0), 2, 100); //consecutive iterations within hys_ok before going to 1:1 mode
const float hys_bad_factor=1.2;
int compensationDivider = GetClamped((int)(100.0 *(float)targetIPS/750), 15, 150); int compensationDivider = GetClamped((int)(100.0 *(float)targetIPS/750), 15, 150);
float tempoAdjust=bufferFullness/dynamicTargetFullness; float tempoAdjust=bufferFullness/dynamicTargetFullness;

View File

@ -16,7 +16,6 @@ set(Output zzogl-0.4.0)
set(CommonFlags set(CommonFlags
-pthread -pthread
-DZEROGS_SSE2 -DZEROGS_SSE2
-fno-regmove
-fno-strict-aliasing -fno-strict-aliasing
-Wstrict-aliasing # Allow to track strict aliasing issue. -Wstrict-aliasing # Allow to track strict aliasing issue.
-Wunused-variable -Wunused-variable
@ -27,6 +26,11 @@ set(OptimizationFlags
-DNDEBUG -DNDEBUG
) )
#Clang doesn't support a few common flags that GCC does.
if(NOT USE_CLANG)
add_definitions(${CommonFlags} -fno-regmove)
endif(NOT USE_CLANG)
# Debug - Build # Debug - Build
if(CMAKE_BUILD_TYPE STREQUAL Debug) if(CMAKE_BUILD_TYPE STREQUAL Debug)
# add defines # add defines