From de0442321fd892b719b0f1dda2483a2317fb2b13 Mon Sep 17 00:00:00 2001 From: "Jake.Stine" Date: Sun, 13 Sep 2009 20:56:22 +0000 Subject: [PATCH] Linux: Fixed compiler errors from my prev commit, along with a few verbose warnings and a compile error in SPU2-X. (note, moved Linux's define of SVN_REV macro to PrecompiledHeader.h for now, until a proper solution is implemented) git-svn-id: http://pcsx2.googlecode.com/svn/trunk@1819 96395faa-99c1-11dd-bbfe-3dabce05a288 --- common/build/Utilities/Utilities.cbp | 1 + common/build/x86emitter/x86emitter.cbp | 1 + common/include/Utilities/Exceptions.h | 28 +++++++++++++++---------- pcsx2-codeblocks.workspace | 7 ++++++- pcsx2/Linux/pcsx2.cbp | 8 +++++-- pcsx2/PluginManager.cpp | 19 ++++++++--------- pcsx2/Plugins.h | 16 +++++++------- pcsx2/PrecompiledHeader.h | 6 ++++++ pcsx2/gui/MainFrame.cpp | 14 ++----------- plugins/spu2-x/src/BaseTypes.h | 19 +++++++++-------- plugins/spu2-x/src/SndOut.h | 18 ++++++++-------- plugins/spu2-x/src/Spu2.h | 12 +++++------ tools/bin2cpp/bin2cpp.cbp | 29 ++++++++++++++++++++++++++ 13 files changed, 110 insertions(+), 68 deletions(-) diff --git a/common/build/Utilities/Utilities.cbp b/common/build/Utilities/Utilities.cbp index ba2862ca5b..3ea9adee66 100644 --- a/common/build/Utilities/Utilities.cbp +++ b/common/build/Utilities/Utilities.cbp @@ -50,6 +50,7 @@ + diff --git a/common/build/x86emitter/x86emitter.cbp b/common/build/x86emitter/x86emitter.cbp index 2f0a96e3a7..b0e67fca0a 100644 --- a/common/build/x86emitter/x86emitter.cbp +++ b/common/build/x86emitter/x86emitter.cbp @@ -50,6 +50,7 @@ + diff --git a/common/include/Utilities/Exceptions.h b/common/include/Utilities/Exceptions.h index 1acbdd2198..cb82652473 100644 --- a/common/include/Utilities/Exceptions.h +++ b/common/include/Utilities/Exceptions.h @@ -1,6 +1,6 @@ /* PCSX2 - PS2 Emulator for PCs * Copyright (C) 2002-2009 PCSX2 Dev Team - * + * * PCSX2 is free software: you can redistribute it and/or modify it under the terms * of the GNU Lesser General Public License as published by the Free Software Found- * ation, either version 3 of the License, or (at your option) any later version. @@ -27,17 +27,23 @@ extern void DevAssert( bool condition, const char* msg ); // exception. Use this macro to dispose of these dangerous exceptions, and generate a // friendly error log in their wake. // -#define DESTRUCTOR_CATCHALL \ +#define __DESTRUCTOR_CATCHALL( funcname ) \ catch( Exception::BaseException& ex ) \ { \ - Console::Error( "Unhandled BaseException in " __FUNCTION__ " (ignored!):" ); \ + Console::Error( "Unhandled BaseException in %s (ignored!):", funcname ); \ Console::Error( ex.FormatDiagnosticMessage() ); \ } \ catch( std::exception& ex ) \ { \ - Console::Error( "Unhandled std::exception in " __FUNCTION__ " (ignored!):" ); \ + Console::Error( "Unhandled std::exception in %s (ignored!):", funcname ); \ Console::Error( ex.what() ); \ - } + } + +#ifdef __GNUC__ +# define DESTRUCTOR_CATCHALL __DESTRUCTOR_CATCHALL( __PRETTY_FUNCTION__ ) +#else +# define DESTRUCTOR_CATCHALL __DESTRUCTOR_CATCHALL( __FUNCTION__ ) +#endif namespace Exception { @@ -89,7 +95,7 @@ namespace Exception // Construction using one translation key. void InitBaseEx( const char* msg_eng ); }; - + // -------------------------------------------------------------------------------------- // Ps2Generic Exception // -------------------------------------------------------------------------------------- @@ -195,7 +201,7 @@ namespace Exception public: DEFINE_EXCEPTION_COPYTORS( IndexBoundsFault ) - + IndexBoundsFault( const wxString& objname, int index, int arrsize ) { BaseException::InitBaseEx( "Index is outside the bounds of an array." ); @@ -208,12 +214,12 @@ namespace Exception virtual wxString FormatDiagnosticMessage() const; virtual wxString FormatDisplayMessage() const; }; - + class ParseError : public RuntimeError { public: DEFINE_RUNTIME_EXCEPTION( ParseError, "Parse error" ); - }; + }; // --------------------------------------------------------------------------------------- // Hardware/OS Exceptions: @@ -344,7 +350,7 @@ namespace Exception }; // Exception thrown by SaveState class when a plugin returns an error during state - // load or save. + // load or save. // class FreezePluginFailure : public virtual RuntimeError { @@ -374,7 +380,7 @@ namespace Exception public: DEFINE_EXCEPTION_COPYTORS( UnsupportedStateVersion ) - + explicit UnsupportedStateVersion( int version, const wxString& objname=wxEmptyString ) { StreamName = objname; diff --git a/pcsx2-codeblocks.workspace b/pcsx2-codeblocks.workspace index 0f78b59918..1268984b69 100644 --- a/pcsx2-codeblocks.workspace +++ b/pcsx2-codeblocks.workspace @@ -1,7 +1,12 @@ - + + + + + + diff --git a/pcsx2/Linux/pcsx2.cbp b/pcsx2/Linux/pcsx2.cbp index 1adab0db7a..151eef722c 100644 --- a/pcsx2/Linux/pcsx2.cbp +++ b/pcsx2/Linux/pcsx2.cbp @@ -45,6 +45,7 @@ + @@ -287,8 +288,8 @@ - - + + @@ -303,16 +304,19 @@ diff --git a/pcsx2/PluginManager.cpp b/pcsx2/PluginManager.cpp index 02ad59a4dc..88ab7dcb61 100644 --- a/pcsx2/PluginManager.cpp +++ b/pcsx2/PluginManager.cpp @@ -1,6 +1,6 @@ /* PCSX2 - PS2 Emulator for PCs * Copyright (C) 2002-2009 PCSX2 Dev Team - * + * * PCSX2 is free software: you can redistribute it and/or modify it under the terms * of the GNU Lesser General Public License as published by the Free Software Found- * ation, either version 3 of the License, or (at your option) any later version. @@ -632,7 +632,7 @@ static void PS2E_CALLBACK pcsx2_OSD_WriteLn( int icon, const char* msg ) PluginManager::PluginManager( const wxString (&folders)[PluginId_Count] ) { Console::Status( "Loading plugins..." ); - + const PluginInfo* pi = tbl_PluginInfo-1; while( ++pi, pi->shortname != NULL ) { @@ -674,21 +674,21 @@ PluginManager::PluginManager( const wxString (&folders)[PluginId_Count] ) // Hack for PAD's stupid parameter passed on Init PADinit = (_PADinit)m_info[PluginId_PAD].CommonBindings.Init; m_info[PluginId_PAD].CommonBindings.Init = _hack_PADinit; - + Console::Status( "Plugins loaded successfully.\n" ); - + // HACK! Manually bind the Internal MemoryCard plugin for now, until // we get things more completed in the new plugin api. - + static const PS2E_EmulatorInfo myself = { "PCSX2", { 0, PCSX2_VersionHi, PCSX2_VersionLo, SVN_REV }, - + x86caps.PhysicalCores, x86caps.LogicalCores, - + pcsx2_GetInt, pcsx2_GetBoolean, pcsx2_GetString, @@ -712,7 +712,6 @@ PluginManager::~PluginManager() Shutdown(); } DESTRUCTOR_CATCHALL - // All library unloading done automatically. } @@ -988,9 +987,9 @@ void PluginManager::Shutdown() m_info[pid].IsInitialized = false; m_info[pid].CommonBindings.Shutdown(); } - + // More memorycard hacks!! - + if( EmuPlugins.Mcd != NULL && m_mcdPlugin != NULL ) { m_mcdPlugin->DeleteComponentInstance( (PS2E_THISPTR)EmuPlugins.Mcd ); diff --git a/pcsx2/Plugins.h b/pcsx2/Plugins.h index e6ad565140..3d28dca955 100644 --- a/pcsx2/Plugins.h +++ b/pcsx2/Plugins.h @@ -1,6 +1,6 @@ /* PCSX2 - PS2 Emulator for PCs * Copyright (C) 2002-2009 PCSX2 Dev Team - * + * * PCSX2 is free software: you can redistribute it and/or modify it under the terms * of the GNU Lesser General Public License as published by the Free Software Found- * ation, either version 3 of the License, or (at your option) any later version. @@ -29,7 +29,7 @@ struct PluginInfo PluginsEnum_t id; int typemask; int version; // minimum version required / supported - + wxString GetShortname() const { return wxString::FromUTF8( shortname ); @@ -127,7 +127,7 @@ struct LegacyPluginAPI_Common s32 (CALLBACK* Test)(); void (CALLBACK* Configure)(); void (CALLBACK* About)(); - + LegacyPluginAPI_Common() : Init ( NULL ) , Close ( NULL ) @@ -154,7 +154,7 @@ class EmuPluginBindings { protected: PS2E_ComponentAPI_Mcd* Mcd; - + public: EmuPluginBindings() : Mcd( NULL ) @@ -204,7 +204,7 @@ public: virtual void Freeze( PluginsEnum_t pid, int mode, freezeData* data ) { wxASSERT_MSG( false, L"Null PluginManager!" ); } virtual void Freeze( PluginsEnum_t pid, SaveState& state ) { wxASSERT_MSG( false, L"Null PluginManager!" ); } virtual void Freeze( SaveState& state ) { wxASSERT_MSG( false, L"Null PluginManager!" ); } - + virtual bool KeyEvent( const keyEvent& evt ) { return false; } }; @@ -225,7 +225,7 @@ protected: LegacyPluginAPI_Common CommonBindings; wxDynamicLibrary Lib; - + PluginStatus_t() : IsInitialized( false ) , IsOpened( false ) @@ -268,7 +268,7 @@ protected: void BindCommon( PluginsEnum_t pid ); void BindRequired( PluginsEnum_t pid ); void BindOptional( PluginsEnum_t pid ); - + friend class mtgsThreadObject; }; @@ -282,7 +282,7 @@ extern PluginManagerBase& GetPluginManager(); // Hack to expose internal MemoryCard plugin: -extern "C" extern const PS2E_LibraryAPI* FileMcd_InitAPI( const PS2E_EmulatorInfo* emuinfo ); +extern "C" const PS2E_LibraryAPI* FileMcd_InitAPI( const PS2E_EmulatorInfo* emuinfo ); // Per ChickenLiver, this is being used to pass the GS plugins window handle to the Pad plugins. // So a rename to pDisplay is in the works, but it will not, in fact, be removed. diff --git a/pcsx2/PrecompiledHeader.h b/pcsx2/PrecompiledHeader.h index c7d65c98cf..8241c83ea2 100644 --- a/pcsx2/PrecompiledHeader.h +++ b/pcsx2/PrecompiledHeader.h @@ -90,6 +90,12 @@ typedef int BOOL; #include "Utilities/General.h" #include "x86emitter/tools.h" +// Linux isn't set up for svn version numbers yet. +#ifdef __LINUX__ +# define SVN_REV 0 +# define SVN_MODS 0 +#endif + ////////////////////////////////////////////////////////////////////////////////////////// // Compiler/OS specific macros and defines -- Begin Section diff --git a/pcsx2/gui/MainFrame.cpp b/pcsx2/gui/MainFrame.cpp index 0bd35316f3..c91b2910d0 100644 --- a/pcsx2/gui/MainFrame.cpp +++ b/pcsx2/gui/MainFrame.cpp @@ -279,26 +279,16 @@ MainEmuFrame::MainEmuFrame(wxWindow* parent, const wxString& title): wxString wintitle; if( PCSX2_VersionLo & 1 ) { -#ifdef __LINUX__ - // Linux isn't set up for svn version numbers yet. - wintitle.Printf( _("PCSX2 %d.%d.%d (svn) %s"), PCSX2_VersionHi, PCSX2_VersionMid, PCSX2_VersionLo, - wxString::FromUTF8(__DATE__).c_str() ); -#else // Odd versions: beta / development editions, which feature revision number and compile date. wintitle.Printf( _("PCSX2 %d.%d.%d.%d%s (svn) %s"), PCSX2_VersionHi, PCSX2_VersionMid, PCSX2_VersionLo, SVN_REV, SVN_MODS ? L"m" : wxEmptyString, wxString::FromUTF8(__DATE__).c_str() ); -#endif } else { -#ifdef __LINUX__ - wintitle.Printf( _("PCSX2 %d.%d.%d"), PCSX2_VersionHi, PCSX2_VersionMid, PCSX2_VersionLo); -#else // evens: stable releases, with a simpler title. wintitle.Printf( _("PCSX2 %d.%d.%d %s"), PCSX2_VersionHi, PCSX2_VersionMid, PCSX2_VersionLo, SVN_MODS ? _("(modded)") : wxEmptyString ); -#endif } SetTitle( wintitle ); @@ -306,13 +296,13 @@ MainEmuFrame::MainEmuFrame(wxWindow* parent, const wxString& title): // Ideally the __WXMSW__ port should use the embedded IDI_ICON2 icon, because wxWidgets sucks and // loses the transparency information when loading bitmaps into icons. But for some reason // I cannot get it to work despite following various examples to the letter. - + wxIconBundle bundle; bundle.AddIcon( EmbeddedImage().GetIcon() ); bundle.AddIcon( EmbeddedImage().GetIcon() ); bundle.AddIcon( EmbeddedImage().GetIcon() ); SetIcons( bundle ); - + int m_statusbar_widths[] = { (int)(backsize.GetWidth()*0.73), (int)(backsize.GetWidth()*0.25) }; m_statusbar.SetStatusWidths(2, m_statusbar_widths); m_statusbar.SetStatusText( L"The Status is Good!", 0); diff --git a/plugins/spu2-x/src/BaseTypes.h b/plugins/spu2-x/src/BaseTypes.h index 0ff1667d34..cb72ed104f 100644 --- a/plugins/spu2-x/src/BaseTypes.h +++ b/plugins/spu2-x/src/BaseTypes.h @@ -2,9 +2,12 @@ #ifndef _BASETYPES_H_ #define _BASETYPES_H_ +#include "PS2Edefs.h" + //system defines #ifdef __LINUX__ -#include +# undef __LINUX__ // supress gtk's warnings on redefinition +# include #else # define WINVER 0x0501 # define _WIN32_WINNT 0x0501 @@ -27,8 +30,6 @@ using std::string; using std::wstring; -#include "PS2Edefs.h" - ////////////////////////////////////////////////////////////////////////// // Override Win32 min/max macros with the STL's type safe and macro // free varieties (much safer!) @@ -65,7 +66,7 @@ extern void SysMessage(const char *fmt, ...); # define DevMsg MsgBox #else # define DevCon 0&&Console -# define DevMsg +# define DevMsg #endif #ifdef PCSX2_DEBUG @@ -83,7 +84,7 @@ struct StereoOut32 s32 Left; s32 Right; - + StereoOut32() : Left( 0 ), Right( 0 ) @@ -95,12 +96,12 @@ struct StereoOut32 Right( right ) { } - + StereoOut32( const StereoOut16& src ); explicit StereoOut32( const StereoOutFloat& src ); - + StereoOut16 DownSample() const; - + StereoOut32 operator+( const StereoOut32& right ) const { return StereoOut32( @@ -109,7 +110,7 @@ struct StereoOut32 ); } - StereoOut32 operator/( int src ) const + StereoOut32 operator/( int src ) const { return StereoOut32( Left / src, Right / src ); } diff --git a/plugins/spu2-x/src/SndOut.h b/plugins/spu2-x/src/SndOut.h index 2c3e26e9f9..9014323ef5 100644 --- a/plugins/spu2-x/src/SndOut.h +++ b/plugins/spu2-x/src/SndOut.h @@ -59,7 +59,7 @@ struct StereoOut16 Right( right ) { } - + StereoOut32 UpSample() const; void ResampleFrom( const StereoOut32& src ) @@ -214,7 +214,7 @@ struct Stereo51Out16DplII s32 XL = abs(ValL>>8); s32 XR = abs(ValR>>8); - + if(XL>LMax) LMax = XL; if(XR>RMax) RMax = XR; @@ -264,7 +264,7 @@ struct Stereo51Out16DplII s32 VL=(ValL>>4) * Cfl; //16.12 s32 VR=(ValR>>4) * Cfr; - s32 SC = (VL-VR)>>15; + //s32 SC = (VL-VR)>>15; SL = (((VR/148 - VL/209)>>4)*Cfr)>>8; SR = (((VR/209 - VL/148)>>4)*Cfl)>>8; @@ -283,7 +283,7 @@ struct Stereo51Out16DplII int AddCX = (C * AddCLR)>>8; Left = (((L * GainL ))>>8) + AddCX; - Right = (((R * GainL ))>>8) + AddCX; + Right = (((R * GainR ))>>8) + AddCX; Center = (((C * GainC ))>>8); LFE = (((SUB * GainLFE))>>8); LeftBack = (((SL * GainSL ))>>8); @@ -310,7 +310,7 @@ struct Stereo71Out16 LFE = Center; LeftBack = src.Left >> SndOutVolumeShift; RightBack = src.Right >> SndOutVolumeShift; - + LeftSide = src.Left >> (SndOutVolumeShift+1); RightSide = src.Right >> (SndOutVolumeShift+1); } @@ -352,7 +352,7 @@ private: static StereoOut32* sndTempBuffer; static StereoOut16* sndTempBuffer16; - + static int sndTempProgress; static int m_dsp_progress; @@ -381,7 +381,7 @@ private: static void timeStretchWrite(); static void timeStretchUnderrun(); static s32 timeStretchOverrun(); - + static void PredictDataWrite( int samples ); static float GetStatusPct(); static void UpdateTempoChange(); @@ -392,13 +392,13 @@ public: static void Write( const StereoOut32& Sample ); static s32 Test(); static void ClearContents(); - + #ifdef _MSC_VER static void Configure(HWND parent, u32 module ); #else static void Configure(uptr parent, u32 module ); #endif - + // Note: When using with 32 bit output buffers, the user of this function is responsible // for shifting the values to where they need to be manually. The fixed point depth of // the sample output is determined by the SndOutVolumeShift, which is the number of bits diff --git a/plugins/spu2-x/src/Spu2.h b/plugins/spu2-x/src/Spu2.h index c9b3aadb74..b3432b7695 100644 --- a/plugins/spu2-x/src/Spu2.h +++ b/plugins/spu2-x/src/Spu2.h @@ -1,6 +1,6 @@ /* SPU2-X, A plugin for Emulating the Sound Processing Unit of the Playstation 2 * Developed and maintained by the Pcsx2 Development Team. - * + * * SPU2-X is free software: you can redistribute it and/or modify it under the terms * of the GNU Lesser General Public License as published by the Free Software Found- * ation, either version 3 of the License, or (at your option) any later version. @@ -130,7 +130,7 @@ static const int pcm_DecodedSamplesPerBlock = 28; struct PcmCacheEntry { - bool Validated; + bool Validated; s16 Sampledata[pcm_DecodedSamplesPerBlock]; }; @@ -144,10 +144,10 @@ extern short *_spu2mem; extern PcmCacheEntry* pcm_cache_data; -extern s16 __forceinline * __fastcall GetMemPtr(u32 addr); -extern s16 __forceinline __fastcall spu2M_Read( u32 addr ); -extern void __inline __fastcall spu2M_Write( u32 addr, s16 value ); -extern void __inline __fastcall spu2M_Write( u32 addr, u16 value ); +extern s16* __fastcall GetMemPtr(u32 addr); +extern s16 __fastcall spu2M_Read( u32 addr ); +extern void __fastcall spu2M_Write( u32 addr, s16 value ); +extern void __fastcall spu2M_Write( u32 addr, u16 value ); #define spu2Rs16(mmem) (*(s16 *)((s8 *)spu2regs + ((mmem) & 0x1fff))) #define spu2Ru16(mmem) (*(u16 *)((s8 *)spu2regs + ((mmem) & 0x1fff))) diff --git a/tools/bin2cpp/bin2cpp.cbp b/tools/bin2cpp/bin2cpp.cbp index 7f215c772a..59852c207a 100644 --- a/tools/bin2cpp/bin2cpp.cbp +++ b/tools/bin2cpp/bin2cpp.cbp @@ -5,6 +5,11 @@ + + + +