[default -> Xcode4] Lion is approaching.

This commit is contained in:
Jason Felds
2011-07-20 10:12:21 -04:00
400 changed files with 29179 additions and 6031 deletions
+1 -1
View File
@@ -278,7 +278,7 @@ void ArchHooks::MountInitialFilesystems( const RString &sDirOfExecutable )
const char *szHome = getenv( "HOME" );
RString sProductId = PRODUCT_ID;
sProductId.MakeLower();
RString sUserDataPath = ssprintf( "%s/.%s", szHome? szHome:".", sProductId.c_str() );
RString sUserDataPath = ssprintf( "%s/.%s", szHome? szHome:".", "stepmania5" );
FILEMAN->Mount( "dir", sUserDataPath + "/Cache", "/Cache" );
FILEMAN->Mount( "dir", sUserDataPath + "/Logs", "/Logs" );
FILEMAN->Mount( "dir", sUserDataPath + "/Save", "/Save" );
+4 -3
View File
@@ -55,14 +55,13 @@ static RString GetMountDir( const RString &sDirOfExecutable )
void ArchHooks::MountInitialFilesystems( const RString &sDirOfExecutable )
{
RString sDir = GetMountDir( sDirOfExecutable );
RString sCommonAppDataDir = SpecialDirs::GetCommonAppDataDir() + PRODUCT_ID;
FILEMAN->Mount( "dir", sDir, "/" );
FILEMAN->Mount( "dir", sCommonAppDataDir, "/" );
FILEMAN->Mount( "dir", sCommonAppDataDir + "/Cache", "/Cache" );
}
void ArchHooks::MountUserFilesystems( const RString &sDirOfExecutable )
{
RString sCommonAppDataDir = SpecialDirs::GetCommonAppDataDir() + PRODUCT_ID;
RString sAppDataDir = SpecialDirs::GetAppDataDir() + PRODUCT_ID;
RString sLocalAppDataDir = SpecialDirs::GetLocalAppDataDir() + PRODUCT_ID;
RString sPicturesDir = SpecialDirs::GetPicturesDir() + PRODUCT_ID;
@@ -70,6 +69,8 @@ void ArchHooks::MountUserFilesystems( const RString &sDirOfExecutable )
FILEMAN->Mount( "dir", sAppDataDir + "/Logs", "/Logs" );
FILEMAN->Mount( "dir", sAppDataDir + "/Save", "/Save" );
FILEMAN->Mount( "dir", sPicturesDir + " Screenshots", "/Screenshots" );
FILEMAN->Mount( "dir", sCommonAppDataDir, "/" );
FILEMAN->Mount( "dir", sCommonAppDataDir + "/Cache", "/Cache" );
FILEMAN->Mount( "dir", sAppDataDir + "/Packages", "/" + SpecialFiles::USER_PACKAGES_DIR );
}
@@ -384,6 +384,10 @@ void InputHandler_DInput::UpdatePolled( DIDevice &device, const RageTimer &tm )
if( hr == DIERR_INPUTLOST || hr == DIERR_NOTACQUIRED )
return;
// reset mousewheel
ButtonPressed( DeviceInput(device.dev, MOUSE_WHEELUP, 0, tm) );
ButtonPressed( DeviceInput(device.dev, MOUSE_WHEELDOWN, 0, tm) );
for( unsigned i = 0; i < device.Inputs.size(); ++i )
{
const input_t &in = device.Inputs[i];
@@ -476,6 +480,12 @@ void InputHandler_DInput::UpdateBuffered( DIDevice &device, const RageTimer &tm
return;
}
// reset mousewheel
DeviceInput diUp = DeviceInput(device.dev, MOUSE_WHEELUP, 0.0f, tm);
ButtonPressed( diUp );
DeviceInput diDown = DeviceInput(device.dev, MOUSE_WHEELDOWN, 0.0f, tm);
ButtonPressed( diDown );
for( int i = 0; i < (int) numevents; ++i )
{
for(unsigned j = 0; j < device.Inputs.size(); ++j)
@@ -522,6 +532,7 @@ void InputHandler_DInput::UpdateBuffered( DIDevice &device, const RageTimer &tm
GetCursorPos(&cursorPos);
// convert screen coordinates to client
ScreenToClient(GraphicsWindow::GetHwnd(), &cursorPos);
switch(in.ofs)
{
case DIMOFS_X:
+6 -1
View File
@@ -47,12 +47,17 @@ LoadingWindow *LoadingWindow::Create()
}
}
if( ret )
if( ret ) {
LOG->Info( "Loading window: %s", Driver.c_str() );
ret->SetIndeterminate(true);
}
return ret;
}
LoadingWindow *pLoadingWindow;
/*
* (c) 2002-2005 Glenn Maynard
* All rights reserved.
+11 -1
View File
@@ -11,11 +11,21 @@ public:
virtual RString Init() { return RString(); }
virtual ~LoadingWindow() { }
virtual void Paint() { }
virtual void SetText( RString str ) = 0;
virtual void SetIcon( const RageSurface *pIcon ) { }
virtual void SetSplash( const RString sPath ) { }
virtual void SetProgress( const int progress ) { m_progress=progress; }
virtual void SetTotalWork( const int totalWork ) { m_totalWork=totalWork; }
virtual void SetIndeterminate( bool indeterminate ) { m_indeterminate=indeterminate; }
protected:
int m_progress;
int m_totalWork;
bool m_indeterminate;
};
extern LoadingWindow *pLoadingWindow;
#endif
/**
@@ -11,6 +11,8 @@ static void *Handle = NULL;
static INIT Module_Init;
static SHUTDOWN Module_Shutdown;
static SETTEXT Module_SetText;
static SETPROGRESS Module_SetProgress;
static SETINDETERMINATE Module_SetIndeterminate;
LoadingWindow_Gtk::LoadingWindow_Gtk()
{
@@ -33,6 +35,12 @@ RString LoadingWindow_Gtk::Init()
Module_SetText = (SETTEXT) dlsym(Handle, "SetText");
if( !Module_SetText )
return "Couldn't load symbol Module_SetText";
Module_SetProgress = (SETPROGRESS) dlsym(Handle, "SetProgress");
if( !Module_SetProgress )
return "Couldn't load symbol Module_SetProgress";
Module_SetIndeterminate = (SETINDETERMINATE) dlsym(Handle, "SetIndeterminate");
if( !Module_SetIndeterminate )
return "Couldn't load symbol Module_SetIndeterminate";
const char *ret = Module_Init( &g_argc, &g_argv );
if( ret != NULL )
@@ -56,6 +64,24 @@ void LoadingWindow_Gtk::SetText( RString s )
Module_SetText( s );
}
void LoadingWindow_Gtk::SetProgress( const int progress )
{
LoadingWindow::SetProgress( progress );
Module_SetProgress( m_progress, m_totalWork );
}
void LoadingWindow_Gtk::SetTotalWork( const int totalWork )
{
LoadingWindow::SetTotalWork( totalWork );
Module_SetProgress( m_progress, m_totalWork );
}
void LoadingWindow_Gtk::SetIndeterminate( bool indeterminate )
{
LoadingWindow::SetIndeterminate( indeterminate );
Module_SetIndeterminate( m_indeterminate );
}
/*
* (c) 2003-2004 Glenn Maynard, Sean Burke
* All rights reserved.
+4 -1
View File
@@ -11,8 +11,11 @@ public:
LoadingWindow_Gtk();
RString Init();
~LoadingWindow_Gtk();
void SetText( RString str );
void SetSplash( const RString str ) {}
void SetProgress( const int progress );
void SetTotalWork( const int totalWork );
void SetIndeterminate( bool indeterminate );
};
#define USE_LOADING_WINDOW_GTK
@@ -5,6 +5,7 @@
static GtkWidget *label;
static GtkWidget *window;
static GtkWidget *progressBar;
extern "C" const char *Init( int *argc, char ***argv )
{
@@ -22,9 +23,12 @@ extern "C" const char *Init( int *argc, char ***argv )
loadimage = gtk_image_new_from_file(splash_image_path);
label = gtk_label_new(NULL);
gtk_label_set_justify(GTK_LABEL(label),GTK_JUSTIFY_CENTER);
progressBar = gtk_progress_bar_new();
gtk_progress_bar_set_fraction( GTK_PROGRESS_BAR(progressBar), 0.0 );
vbox = gtk_vbox_new(FALSE,5);
gtk_container_add(GTK_CONTAINER(window),vbox);
gtk_box_pack_start(GTK_BOX(vbox),loadimage,FALSE,FALSE,0);
gtk_box_pack_end(GTK_BOX(vbox),progressBar,TRUE,TRUE,0);
gtk_box_pack_end(GTK_BOX(vbox),label,TRUE,TRUE,0);
gtk_widget_show_all(window);
@@ -47,6 +51,21 @@ extern "C" void SetText( const char *s )
gtk_main_iteration_do(FALSE);
}
extern "C" void SetProgress( int progress, int totalWork )
{
gdouble fraction = ( totalWork > 0 ? progress / (gdouble)totalWork : 0 );
if( fraction > 1.0 ) fraction = 1.0;
if( fraction < 0.0 ) fraction = 0.0;
gtk_progress_bar_set_fraction( GTK_PROGRESS_BAR(progressBar), fraction );
gtk_main_iteration_do(FALSE);
}
extern "C" void SetIndeterminate( bool indeterminate )
{
gtk_progress_bar_pulse(GTK_PROGRESS_BAR(progressBar));
gtk_main_iteration_do(FALSE);
}
/*
* (c) 2003-2004 Glenn Maynard, Sean Burke
* All rights reserved.
@@ -4,6 +4,8 @@
typedef const char *(*INIT)(int *argc, char ***argv);
typedef void (*SHUTDOWN)();
typedef void (*SETTEXT)( const char *s );
typedef void (*SETPROGRESS)( int progress, int totalWork );
typedef void (*SETINDETERMINATE)( bool indeterminate );
#endif
@@ -9,6 +9,10 @@ public:
LoadingWindow_MacOSX();
~LoadingWindow_MacOSX();
void SetText( RString str );
void SetSplash( const RString path ) {}
void SetProgress( const int progress );
void SetTotalWork( const int totalWork );
void SetIndeterminate( bool indeterminate );
};
#define USE_LOADING_WINDOW_MACOSX
+52 -4
View File
@@ -10,8 +10,12 @@
NSWindow *m_Window;
NSTextView *m_Text;
NSAutoreleasePool *m_Pool;
NSProgressIndicator *m_ProgressIndicator;
}
- (void) setupWindow:(NSImage *)image;
- (void) setProgress:(NSNumber *)progress;
- (void) setTotalWork:(NSNumber *)totalWork;
- (void) setIndeterminate:(NSNumber *)indeterminate;
@end
@implementation LoadingWindowHelper
@@ -21,14 +25,25 @@
NSRect viewRect, windowRect;
float height = 0.0f;
NSRect progressIndicatorRect;
progressIndicatorRect = NSMakeRect(0, 0, size.width, 0);
m_ProgressIndicator = [[NSProgressIndicator alloc] initWithFrame:progressIndicatorRect];
[m_ProgressIndicator sizeToFit];
[m_ProgressIndicator setIndeterminate:YES];
[m_ProgressIndicator setMinValue:0];
[m_ProgressIndicator setMaxValue:1];
[m_ProgressIndicator setDoubleValue:0];
progressIndicatorRect = [m_ProgressIndicator frame];
float progressHeight = progressIndicatorRect.size.height;
NSFont *font = [NSFont systemFontOfSize:0.0f];
NSRect textRect;
// Just give it a size until it is created.
textRect = NSMakeRect( 0, 0, size.width, size.height );
textRect = NSMakeRect( 0, progressHeight, size.width, size.height );
m_Text = [[NSTextView alloc] initWithFrame:textRect];
[m_Text setFont:font];
height = [[m_Text layoutManager] defaultLineHeightForFont:font]*3 + 4;
textRect = NSMakeRect( 0, 0, size.width, height );
textRect = NSMakeRect( 0, progressHeight, size.width, height );
[m_Text setFrame:textRect];
[m_Text setEditable:NO];
@@ -40,12 +55,12 @@
[m_Text setVerticallyResizable:NO];
[m_Text setString:@"Initializing Hardware..."];
viewRect = NSMakeRect( 0, height, size.width, size.height );
viewRect = NSMakeRect( 0, height + progressHeight, size.width, size.height );
NSImageView *iView = [[NSImageView alloc] initWithFrame:viewRect];
[iView setImage:image];
[iView setImageFrameStyle:NSImageFrameNone];
windowRect = NSMakeRect( 0, 0, size.width, size.height + height );
windowRect = NSMakeRect( 0, 0, size.width, size.height + height + progressHeight);
m_Window = [[NSWindow alloc] initWithContentRect:windowRect
styleMask:NSTitledWindowMask
backing:NSBackingStoreBuffered
@@ -66,10 +81,27 @@
[view addSubview:iView];
[m_Text release];
[iView release];
[view addSubview:m_ProgressIndicator];
// Display the window.
[m_Window makeKeyAndOrderFront:nil];
}
- (void) setProgress:(NSNumber *)progress
{
[m_ProgressIndicator setDoubleValue:[progress doubleValue]];
}
- (void) setTotalWork:(NSNumber *)totalWork
{
[m_ProgressIndicator setMaxValue:[totalWork doubleValue]];
}
- (void) setIndeterminate:(NSNumber *)indeterminate
{
[m_ProgressIndicator setIndeterminate:([indeterminate doubleValue] > 0 ? YES : NO)];
}
@end
static LoadingWindowHelper *g_Helper = nil;
@@ -124,6 +156,22 @@ void LoadingWindow_MacOSX::SetText( RString str )
[s release];
}
void LoadingWindow_MacOSX::SetProgress( const int progress )
{
[g_Helper performSelectorOnMainThread:@selector(setProgress:) withObject:[NSNumber numberWithDouble:(double)progress] waitUntilDone:NO];
}
void LoadingWindow_MacOSX::SetTotalWork( const int totalWork )
{
[g_Helper performSelectorOnMainThread:@selector(setTotalWork:) withObject:[NSNumber numberWithDouble:(double)totalWork] waitUntilDone:NO];
}
void LoadingWindow_MacOSX::SetIndeterminate( bool indeterminate )
{
double tmp = indeterminate ? 1 : 0;
[g_Helper performSelectorOnMainThread:@selector(setIndeterminate:) withObject:[NSNumber numberWithDouble:tmp] waitUntilDone:NO];
}
/*
* (c) 2003-2006, 2008 Steve Checkoway
* All rights reserved.
@@ -7,6 +7,7 @@ class LoadingWindow_Null: public LoadingWindow
{
public:
void SetText( RString str ) { }
void SetSplash( RString str ) { }
};
#define USE_LOADING_WINDOW_NULL
+111 -16
View File
@@ -7,6 +7,7 @@
#include "archutils/win32/WindowIcon.h"
#include "archutils/win32/ErrorStrings.h"
#include <windows.h>
#include "CommCtrl.h"
#include "RageSurface_Load.h"
#include "RageSurface.h"
#include "RageSurfaceUtils.h"
@@ -17,7 +18,9 @@
#include "RageSurfaceUtils_Zoom.h"
static HBITMAP g_hBitmap = NULL;
/* Load a RageSurface into a GDI surface. */
#pragma comment(linker,"\"/manifestdependency:type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"")
// Load a RageSurface into a GDI surface.
static HBITMAP LoadWin32Surface( RageSurface *&s )
{
RageSurfaceUtils::ConvertSurface( s, s->w, s->h, 32, 0xFF000000, 0x00FF0000, 0x0000FF00, 0 );
@@ -31,14 +34,14 @@ static HBITMAP LoadWin32Surface( RageSurface *&s )
HDC BitmapDC = CreateCompatibleDC( hScreen );
SelectObject( BitmapDC, bitmap );
/* This is silly, but simple. We only do this once, on a small image. */
// This is silly, but simple. We only do this once, on a small image.
for( int y = 0; y < s->h; ++y )
{
unsigned const char *line = ((unsigned char *) s->pixels) + (y * s->pitch);
for( int x = 0; x < s->w; ++x )
{
unsigned const char *data = line + (x*s->format->BytesPerPixel);
SetPixelV( BitmapDC, x, y, RGB( data[3], data[2], data[1] ) );
}
}
@@ -58,7 +61,7 @@ static HBITMAP LoadWin32Surface( RString sFile, HWND hWnd )
if( pSurface == NULL )
return NULL;
/* Resize the splash image to fit the dialog. Stretch to fit horizontally,
/* Resize the splash image to fit the dialog. Stretch to fit horizontally,
* maintaining aspect ratio. */
{
RECT r;
@@ -76,8 +79,17 @@ static HBITMAP LoadWin32Surface( RString sFile, HWND hWnd )
return ret;
}
BOOL CALLBACK LoadingWindow_Win32::WndProc( HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam )
INT_PTR CALLBACK LoadingWindow_Win32::DlgProc( HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam )
{
LoadingWindow_Win32 *self;
if(msg==WM_INITDIALOG) {
self=(LoadingWindow_Win32 *)lParam;
SetWindowLong(hWnd,DWL_USER,(LONG)self);
} else {
self=(LoadingWindow_Win32 *)GetWindowLong(hWnd,DWL_USER);
}
switch( msg )
{
case WM_INITDIALOG:
@@ -95,11 +107,25 @@ BOOL CALLBACK LoadingWindow_Win32::WndProc( HWND hWnd, UINT msg, WPARAM wParam,
(WPARAM) IMAGE_BITMAP,
(LPARAM) (HANDLE) g_hBitmap );
SetWindowTextA( hWnd, PRODUCT_ID );
break;
case WM_CLOSE:
return FALSE;
case WM_DESTROY:
DeleteObject( g_hBitmap );
g_hBitmap = NULL;
self->runMessageLoop=false;
self->hwnd=NULL;
return TRUE;
break;
case WM_APP:
DestroyWindow(hWnd);
self->runMessageLoop=false;
ExitThread(0);
return TRUE;
break;
}
@@ -108,7 +134,7 @@ BOOL CALLBACK LoadingWindow_Win32::WndProc( HWND hWnd, UINT msg, WPARAM wParam,
void LoadingWindow_Win32::SetIcon( const RageSurface *pIcon )
{
if( m_hIcon != NULL )
if( g_hBitmap != NULL )
DestroyIcon( m_hIcon );
m_hIcon = IconFromSurface( pIcon );
@@ -116,36 +142,76 @@ void LoadingWindow_Win32::SetIcon( const RageSurface *pIcon )
SetClassLong( hwnd, GCL_HICON, (LONG) m_hIcon );
}
void LoadingWindow_Win32::SetSplash( const RString sPath )
{
if( g_hBitmap != NULL )
{
DeleteObject( g_hBitmap );
g_hBitmap = NULL;
}
g_hBitmap = LoadWin32Surface( sPath, hwnd );
if( g_hBitmap != NULL )
{
SendDlgItemMessage(
hwnd, IDC_SPLASH,
STM_SETIMAGE,
(WPARAM) IMAGE_BITMAP,
(LPARAM) (HANDLE) g_hBitmap
);
}
}
LoadingWindow_Win32::LoadingWindow_Win32()
{
INITCOMMONCONTROLSEX cceData;
cceData.dwSize=sizeof(INITCOMMONCONTROLSEX);
cceData.dwICC=ICC_PROGRESS_CLASS;
InitCommonControlsEx(&cceData);
m_hIcon = NULL;
hwnd = CreateDialog( handle.Get(), MAKEINTRESOURCE(IDD_LOADING_DIALOG), NULL, WndProc );
runMessageLoop=true;
guiReadyEvent=CreateEvent(NULL,FALSE,FALSE,NULL);
pumpThread=CreateThread(NULL, NULL, MessagePump, (void *)this, 0, &pumpThreadId);
WaitForSingleObject(guiReadyEvent,INFINITE);
for( unsigned i = 0; i < 3; ++i )
text[i] = "ABC"; /* always set on first call */
SetText( "" );
Paint();
}
LoadingWindow_Win32::~LoadingWindow_Win32()
{
if( hwnd )
DestroyWindow( hwnd );
SendMessage(hwnd,WM_APP,0,0);
//SendMessage(hwnd,WM_NULL,0,0);
WaitForSingleObject(pumpThread,INFINITE);
if(guiReadyEvent)
CloseHandle(guiReadyEvent);
if( m_hIcon != NULL )
DestroyIcon( m_hIcon );
}
void LoadingWindow_Win32::Paint()
DWORD WINAPI LoadingWindow_Win32::MessagePump(LPVOID thisAsVoidPtr)
{
SendMessage( hwnd, WM_PAINT, 0, 0 );
LoadingWindow_Win32 *self=(LoadingWindow_Win32 *)thisAsVoidPtr;
/* Process all queued messages since the last paint. This allows the window to
* come back if it loses focus during load. */
self->hwnd = CreateDialogParam( self->handle.Get(), MAKEINTRESOURCE(IDD_LOADING_DIALOG), NULL, DlgProc, (LPARAM)thisAsVoidPtr);
SetEvent(self->guiReadyEvent);
// Run the message loop in a separate thread to keep the gui responsive during the loading
MSG msg;
while( PeekMessage( &msg, hwnd, 0, 0, PM_NOREMOVE ) )
while(self->runMessageLoop && GetMessage(&msg, self->hwnd, 0, 0 ) )
{
GetMessage(&msg, hwnd, 0, 0 );
if(IsDialogMessage(self->hwnd,&msg)) continue;
DispatchMessage( &msg );
}
return msg.wParam;
}
void LoadingWindow_Win32::SetText( RString sText )
@@ -168,6 +234,35 @@ void LoadingWindow_Win32::SetText( RString sText )
}
}
void LoadingWindow_Win32::SetProgress(const int progress)
{
m_progress=progress;
HWND hwndItem = ::GetDlgItem( hwnd, IDC_PROGRESS );
::SendMessage(hwndItem,PBM_SETPOS,progress,0);
}
void LoadingWindow_Win32::SetTotalWork(const int totalWork)
{
m_totalWork=totalWork;
HWND hwndItem = ::GetDlgItem( hwnd, IDC_PROGRESS );
SendMessage(hwndItem,PBM_SETRANGE32,0,totalWork);
}
void LoadingWindow_Win32::SetIndeterminate(bool indeterminate) {
m_indeterminate=indeterminate;
HWND hwndItem = ::GetDlgItem( hwnd, IDC_PROGRESS );
if(indeterminate) {
SetWindowLong(hwndItem,GWL_STYLE, PBS_MARQUEE | GetWindowLong(hwndItem,GWL_STYLE));
SendMessage(hwndItem,PBM_SETMARQUEE,1,0);
} else {
SendMessage(hwndItem,PBM_SETMARQUEE,0,0);
SetWindowLong(hwndItem,GWL_STYLE, (~PBS_MARQUEE) & GetWindowLong(hwndItem,GWL_STYLE));
}
}
/*
* (c) 2001-2004 Chris Danford, Glenn Maynard
* All rights reserved.
+12 -2
View File
@@ -14,16 +14,26 @@ public:
~LoadingWindow_Win32();
void SetText( RString sText );
void Paint();
void SetIcon( const RageSurface *pIcon );
void SetSplash( const RString sPath );
void SetProgress( const int progress );
void SetTotalWork( const int totalWork );
void SetIndeterminate( bool indeterminate );
private:
AppInstance handle;
HWND hwnd;
RString text[3];
HICON m_hIcon;
HANDLE pumpThread;
DWORD pumpThreadId;
HANDLE guiReadyEvent;
static BOOL CALLBACK WndProc( HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam );
volatile bool runMessageLoop;
static DWORD WINAPI MessagePump(LPVOID thisAsVoidPtr);
static INT_PTR CALLBACK DlgProc( HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam );
};
#define USE_LOADING_WINDOW_WIN32
+2
View File
@@ -5,6 +5,8 @@
#include "arch/RageDriver.h"
#include <map>
void ForceToAscii( RString &str );
class RageMovieTexture : public RageTexture
{
public:
@@ -28,6 +28,10 @@ namespace avcodec
#endif
};
int URLRageFile_open( avcodec::URLContext *h, const char *filename, int flags );
int URLRageFile_read( avcodec::URLContext *h, unsigned char *buf, int size );
int URLRageFile_close( avcodec::URLContext *h );
/*
#if defined(_MSC_VER)
#pragma comment(lib, "ffmpeg/lib/avcodec.lib")