wxgui: fixed up linux size (and omg it was easy for once!)

git-svn-id: http://pcsx2.googlecode.com/svn/branches/wxgui@1507 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
Jake.Stine 2009-07-14 14:22:40 +00:00
parent 8505e4a7e7
commit 94a4897624
3 changed files with 26 additions and 141 deletions

View File

@ -97,7 +97,7 @@ static void SetSingleAffinity()
} }
HANDLE s_threadId = GetCurrentThread(); HANDLE s_threadId = GetCurrentThread();
DWORD s_oldmask = SetThreadAffinityMask( s_threadId, (1UL<<i) ); s_oldmask = SetThreadAffinityMask( s_threadId, (1UL<<i) );
if( s_oldmask == ERROR_INVALID_PARAMETER ) if( s_oldmask == ERROR_INVALID_PARAMETER )
{ {

View File

@ -1,114 +0,0 @@
/* Pcsx2 - Pc Ps2 Emulator
* Copyright (C) 2002-2009 Pcsx2 Team
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include "PrecompiledHeader.h"
#include <sys/mman.h>
#include <signal.h>
#include "Common.h"
extern void SysPageFaultExceptionFilter( int signal, siginfo_t *info, void * );
extern void __fastcall InstallLinuxExceptionHandler();
extern void __fastcall ReleaseLinuxExceptionHandler();
#define PCSX2_MEM_PROTECT_BEGIN() InstallLinuxExceptionHandler()
#define PCSX2_MEM_PROTECT_END() ReleaseLinuxExceptionHandler()
extern void SignalExit(int sig);
static const uptr m_pagemask = getpagesize()-1;
namespace HostSys
{
void *Mmap(uptr base, u32 size)
{
u8 *Mem;
Mem = (u8*)mmap((uptr*)base, size, PROT_EXEC | PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, 0, 0);
if (Mem == MAP_FAILED) Console::Notice("Mmap Failed!");
return Mem;
}
void Munmap(uptr base, u32 size)
{
munmap((uptr*)base, size);
}
void MemProtect( void* baseaddr, size_t size, PageProtectionMode mode, bool allowExecution )
{
// Breakpoint this to trap potentially inappropriate use of page protection, which would
// be caused by failed aligned directives on global vars.
if( ((uptr)baseaddr & m_pagemask) != 0 )
{
Console::Error(
"*PCSX2/Linux Warning* Inappropriate use of page protection detected.\n"
"\tbaseaddr not page aligned: 0x%08X", params (uptr)baseaddr
);
}
int lnxmode = 0;
// make sure base and size are aligned to the system page size:
size = (size + m_pagemask) & ~m_pagemask;
baseaddr = (void*)( ((uptr)baseaddr) & ~m_pagemask );
switch( mode )
{
case Protect_NoAccess: break;
case Protect_ReadOnly: lnxmode = PROT_READ; break;
case Protect_ReadWrite: lnxmode = PROT_READ | PROT_WRITE; break;
}
if( allowExecution ) lnxmode |= PROT_EXEC;
mprotect( baseaddr, size, lnxmode );
}
}
void InstallLinuxExceptionHandler()
{
struct sigaction sa;
sigemptyset(&sa.sa_mask);
sa.sa_flags = SA_SIGINFO;
sa.sa_sigaction = &SysPageFaultExceptionFilter;
sigaction(SIGSEGV, &sa, NULL);
}
void ReleaseLinuxExceptionHandler()
{
// Code this later.
}
// Linux implementation of SIGSEGV handler. Bind it using sigaction().
void SysPageFaultExceptionFilter( int signal, siginfo_t *info, void * )
{
// get bad virtual address
uptr offset = (u8*)info->si_addr - psM;
DevCon::Status( "Protected memory cleanup. Offset 0x%x", params offset );
if (offset>=Ps2MemSize::Base)
{
// Bad mojo! Completely invalid address.
// Instigate a crash or abort emulation or something.
assert( false );
}
mmap_ClearCpuBlock( offset & ~m_pagemask );
}

View File

@ -120,7 +120,7 @@ public:
if ( ((version >> 16)&0xff) == tbl_PluginInfo[pluginTypeIndex].version ) if ( ((version >> 16)&0xff) == tbl_PluginInfo[pluginTypeIndex].version )
return true; return true;
Console::Notice("%s Plugin %s: Version %x != %x", params info.shortname, m_plugpath, 0xff&(version >> 16), info.version); Console::Notice("%s Plugin %s: Version %x != %x", params info.shortname, m_plugpath.c_str(), 0xff&(version >> 16), info.version);
} }
return false; return false;
} }
@ -331,11 +331,16 @@ void Panels::PluginSelectorPanel::OnProgress( wxCommandEvent& evt )
{ {
size_t evtidx = evt.GetExtraLong(); size_t evtidx = evt.GetExtraLong();
m_StatusPanel.AdvanceProgress( (evtidx < m_FileList.Count()-1) ? m_StatusPanel.AdvanceProgress( (evtidx < m_FileList.Count()-1) ?
m_FileList[evtidx + 1] : _("Completing tasks...") m_FileList[evtidx + 1] : wxString(_("Completing tasks..."))
); );
EnumeratedPluginInfo& result( m_EnumeratorThread->Results[evtidx] ); EnumeratedPluginInfo& result( m_EnumeratorThread->Results[evtidx] );
if( result.TypeMask == 0 )
{
Console::Error( L"Some kinda plugin failure: " + m_FileList[evtidx] );
}
for( int i=0; i<NumPluginTypes; ++i ) for( int i=0; i<NumPluginTypes; ++i )
{ {
if( result.TypeMask & tbl_PluginInfo[i].typemask ) if( result.TypeMask & tbl_PluginInfo[i].typemask )
@ -353,16 +358,9 @@ void Panels::PluginSelectorPanel::OnProgress( wxCommandEvent& evt )
left.MakeRelativeTo( g_Conf.Folders.Plugins.ToString() ); left.MakeRelativeTo( g_Conf.Folders.Plugins.ToString() );
right.MakeRelativeTo( g_Conf.Folders.Plugins.ToString() ); right.MakeRelativeTo( g_Conf.Folders.Plugins.ToString() );
Console::WriteLn( left.GetFullPath() );
Console::WriteLn( right.GetFullPath() );
if( left == right ) if( left == right )
m_ComboBoxes.Get(i).SetSelection( sel ); m_ComboBoxes.Get(i).SetSelection( sel );
} }
else
{
// plugin failed the test.
}
} }
} }
} }
@ -426,7 +424,8 @@ int Panels::PluginSelectorPanel::EnumThread::Callback()
m_master.GetEventHandler()->AddPendingEvent( yay ); m_master.GetEventHandler()->AddPendingEvent( yay );
} }
m_master.GetEventHandler()->AddPendingEvent( wxCommandEvent( wxEVT_EnumerationFinished ) ); wxCommandEvent done( wxEVT_EnumerationFinished );
m_master.GetEventHandler()->AddPendingEvent( done );
return 0; return 0;
} }