aboutsummaryrefslogtreecommitdiffstats
path: root/Game/Code
diff options
context:
space:
mode:
authorbrunzelchen <brunzelchen@b956fd51-792f-4845-bead-9b4dfca2ff2c>2011-01-02 20:33:36 +0000
committerbrunzelchen <brunzelchen@b956fd51-792f-4845-bead-9b4dfca2ff2c>2011-01-02 20:33:36 +0000
commit5f86f14e53b9f107ce030e6cb61efba9f5fc6a4b (patch)
treeea590adb575a3166a88c0cbf675e8c9b06f43e97 /Game/Code
parentbb64e99825121cfe68d1139fff855dd44a43674a (diff)
downloadusdx-5f86f14e53b9f107ce030e6cb61efba9f5fc6a4b.tar.gz
usdx-5f86f14e53b9f107ce030e6cb61efba9f5fc6a4b.tar.xz
usdx-5f86f14e53b9f107ce030e6cb61efba9f5fc6a4b.zip
- fix: crash at startup if no webcam connected
- some string updates git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/branches/1.0.1 Challenge MOD@2786 b956fd51-792f-4845-bead-9b4dfca2ff2c
Diffstat (limited to 'Game/Code')
-rw-r--r--Game/Code/Screens/UScreenMain.pas12
-rw-r--r--Game/Code/Screens/UScreenOptionsRecord.pas47
-rw-r--r--Game/Code/Screens/UScreenSing.pas2
-rw-r--r--Game/Code/Screens/UScreenSongMenu.pas6
-rw-r--r--Game/Code/UltraStar.bdsproj4
-rw-r--r--Game/Code/UltraStar.dpr17
-rw-r--r--Game/Code/lib/DSPack/UCaptureWDM.pas88
7 files changed, 125 insertions, 51 deletions
diff --git a/Game/Code/Screens/UScreenMain.pas b/Game/Code/Screens/UScreenMain.pas
index bc2019b9..8c03a53f 100644
--- a/Game/Code/Screens/UScreenMain.pas
+++ b/Game/Code/Screens/UScreenMain.pas
@@ -25,7 +25,6 @@ type
procedure InteractInc; override;
procedure InteractDec; override;
procedure SetAnimationProgress(Progress: real); override;
- //function Draw: boolean; override;
end;
const
@@ -314,6 +313,9 @@ begin
end;
function TScreenMain.Draw: boolean;
+var
+ txt: string;
+
begin
Result := inherited Draw;
@@ -324,6 +326,14 @@ begin
begin
StartScreenScredits;
end;
+
+ glColor4f(1,1,1,1);
+ SetFontStyle(0);
+ SetFontItalic(False);
+ SetFontSize(6);
+ txt := Language.Translate('US_VERSION_NUMBER');
+ SetFontPos(795 - glTextWidth(PChar(txt)), 580);
+ glPrint(PChar(txt));
end;
procedure TScreenMain.InteractNext;
diff --git a/Game/Code/Screens/UScreenOptionsRecord.pas b/Game/Code/Screens/UScreenOptionsRecord.pas
index 3ff73cca..807e1cfb 100644
--- a/Game/Code/Screens/UScreenOptionsRecord.pas
+++ b/Game/Code/Screens/UScreenOptionsRecord.pas
@@ -146,14 +146,22 @@ begin
if (Length(IWebCamDevice)-1 < Ini.WebCamID) then
Ini.WebCamID := 0;
- IWebCamMedia := ListMediaTypes(Ini.WebCamID);
+ ListMediaTypes(Ini.WebCamID, IWebCamMedia);
- SelectSlideWebCamDevice := AddSelectSlide(Theme.OptionsRecord.SelectSlideWebCamDevice, Ini.WebCamID, IWebCamDevice);
- SelectSlideWebCamMedia := AddSelectSlide(Theme.OptionsRecord.SelectSlideWebCamMedia, Ini.WebCamMediaID, IWebCamMedia);
+ if (Length(IWebCamMedia)=0) then
+ begin
+ Ini.EnableWebCam := 0;
+ WebCamPreviewOn := false;
+ end else
+ begin
+ SelectSlideWebCamDevice := AddSelectSlide(Theme.OptionsRecord.SelectSlideWebCamDevice, Ini.WebCamID, IWebCamDevice);
+ SelectSlideWebCamMedia := AddSelectSlide(Theme.OptionsRecord.SelectSlideWebCamMedia, Ini.WebCamMediaID, IWebCamMedia);
- WebCamPreviewOn := (Ini.EnableWebCam=1);
+ WebCamPreviewOn := (Ini.EnableWebCam=1);
+ end;
end else
WebCamPreviewOn := false;
+
AddButton(Theme.OptionsRecord.ButtonExit);
if (Length(Button[0].Text)=0) then
AddButtonText(14, 20, Theme.Options.Description[7]);
@@ -174,12 +182,18 @@ begin
if (Length(IWebCamDevice)-1 < Ini.WebCamID) then
Ini.WebCamID := 0;
- IWebCamMedia := ListMediaTypes(Ini.WebCamID);
-
- UpdateSelectSlideOptions(Theme.OptionsRecord.SelectSlideCard, SelectSlideWebCamDevice, IWebCamDevice, Ini.WebCamID);
- UpdateSelectSlideOptions(Theme.OptionsRecord.SelectSlideInput, SelectSlideWebCamMedia, IWebCamMedia, Ini.WebCamMediaID);
+ ListMediaTypes(Ini.WebCamID, IWebCamMedia);
- WebCamPreviewOn := (Ini.EnableWebCam=1);
+ if (Length(IWebCamMedia)=0) then
+ begin
+ Ini.EnableWebCam := 0;
+ WebCamPreviewOn := false;
+ end else
+ begin
+ UpdateSelectSlideOptions(Theme.OptionsRecord.SelectSlideCard, SelectSlideWebCamDevice, IWebCamDevice, Ini.WebCamID);
+ UpdateSelectSlideOptions(Theme.OptionsRecord.SelectSlideInput, SelectSlideWebCamMedia, IWebCamMedia, Ini.WebCamMediaID);
+ WebCamPreviewOn := (Ini.EnableWebCam=1);
+ end;
end else
WebCamPreviewOn := false;
@@ -237,12 +251,19 @@ begin
if (Length(IWebCamDevice)-1 < Ini.WebCamID) then
Ini.WebCamID := 0;
- IWebCamMedia := ListMediaTypes(Ini.WebCamID);
+ ListMediaTypes(Ini.WebCamID, IWebCamMedia);
- UpdateSelectSlideOptions(Theme.OptionsRecord.SelectSlideWebCamDevice, SelectSlideWebCamDevice, IWebCamDevice, Ini.WebCamID);
- UpdateSelectSlideOptions(Theme.OptionsRecord.SelectSlideWebCamMedia, SelectSlideWebCamMedia, IWebCamMedia, Ini.WebCamMediaID);
+ if (Length(IWebCamMedia)=0) then
+ begin
+ Ini.EnableWebCam := 0;
+ WebCamPreviewOn := false;
+ end else
+ begin
+ UpdateSelectSlideOptions(Theme.OptionsRecord.SelectSlideWebCamDevice, SelectSlideWebCamDevice, IWebCamDevice, Ini.WebCamID);
+ UpdateSelectSlideOptions(Theme.OptionsRecord.SelectSlideWebCamMedia, SelectSlideWebCamMedia, IWebCamMedia, Ini.WebCamMediaID);
- WebCamPreviewOn := (Ini.EnableWebCam=1);
+ WebCamPreviewOn := (Ini.EnableWebCam=1);
+ end;
end else
WebCamPreviewOn := false;
diff --git a/Game/Code/Screens/UScreenSing.pas b/Game/Code/Screens/UScreenSing.pas
index daad5d86..4d1b918c 100644
--- a/Game/Code/Screens/UScreenSing.pas
+++ b/Game/Code/Screens/UScreenSing.pas
@@ -2013,7 +2013,7 @@ begin
if ShowFinish then
begin
if (not Music.Finished) and (not medley_end or (ScreenSong.Mode <> smMedley))
- and ((AktSong.Finish = 0) or (Music.Position + Ini.LipSync*0.01 <= AktSong.Finish)) then
+ and ((AktSong.Finish = 0) or ((Music.Position + Ini.LipSync*0.01)*1000 <= AktSong.Finish)) then
begin
//Pause Mod:
if not Paused then
diff --git a/Game/Code/Screens/UScreenSongMenu.pas b/Game/Code/Screens/UScreenSongMenu.pas
index b3a77879..e209a176 100644
--- a/Game/Code/Screens/UScreenSongMenu.pas
+++ b/Game/Code/Screens/UScreenSongMenu.pas
@@ -197,7 +197,10 @@ begin
ScreenSong.ChangeMusic;
MenuShow(CurMenu);
end else if (CurMenu = SM_Playlist_Add) then
+ begin
MenuShow(CurMenu);
+ Interaction := 3;
+ end;
end;
SDLK_LEFT:
begin
@@ -223,7 +226,10 @@ begin
ScreenSong.ChangeMusic;
MenuShow(CurMenu);
end else if (CurMenu = SM_Playlist_Add) then
+ begin
MenuShow(CurMenu);
+ Interaction := 3;
+ end;
end;
SDLK_1:
diff --git a/Game/Code/UltraStar.bdsproj b/Game/Code/UltraStar.bdsproj
index 36df4a05..2f94b78a 100644
--- a/Game/Code/UltraStar.bdsproj
+++ b/Game/Code/UltraStar.bdsproj
@@ -170,7 +170,9 @@
<VersionInfoKeys Name="ProductName"></VersionInfoKeys>
<VersionInfoKeys Name="ProductVersion">1.0.0.0</VersionInfoKeys>
<VersionInfoKeys Name="Comments"></VersionInfoKeys>
- </VersionInfoKeys> <Excluded_Packages>
+ </VersionInfoKeys>
+
+ <Excluded_Packages>
<Excluded_Packages Name="c:\program files\borland\bds\4.0\Bin\dclib100.bpl">Borland InterBase Express Components</Excluded_Packages>
<Excluded_Packages Name="c:\program files\borland\bds\4.0\Bin\dclIntraweb_80_100.bpl">Intraweb 8.0 Design Package for Borland Development Studio 2006</Excluded_Packages>
<Excluded_Packages Name="c:\program files\borland\bds\4.0\Bin\dclIndyCore100.bpl">Indy 10 Core Design Time</Excluded_Packages>
diff --git a/Game/Code/UltraStar.dpr b/Game/Code/UltraStar.dpr
index adf0d8ee..ba63c085 100644
--- a/Game/Code/UltraStar.dpr
+++ b/Game/Code/UltraStar.dpr
@@ -122,15 +122,18 @@ uses
UVideo in 'Classes\UVideo.pas';
const
- Version = 'UltraStar Deluxe Challenge, Medley & Duet Edition r9.5';
+ VersionName = 'UltraStar Deluxe Challenge, Medley & Duet Edition';
+ VersionNumber = 'r9.7';
var
- WndTitle: string;
- hWnd: THandle;
- I: Integer;
+ WndTitle: string;
+ hWnd: THandle;
+ I: Integer;
+ VersionString: string;
begin
- WndTitle := Version;
+ VersionString := VersionName + ' ' + VersionNumber;
+ WndTitle := VersionString;
//------------------------------
//Start more than One Time Prevention
@@ -174,7 +177,9 @@ begin
Log.LogStatus('Initialize Paths', 'Initialization'); InitializePaths;
Log.LogStatus('Load Language', 'Initialization'); Language := TLanguage.Create;
//Add Const Values:
- Language.AddConst('US_VERSION', Version);
+ Language.AddConst('US_VERSION', VersionString);
+ Language.AddConst('US_VERSION_NUMBER', VersionNumber);
+
Log.BenchmarkEnd(1);
Log.LogBenchmark('Loading Language', 1);
diff --git a/Game/Code/lib/DSPack/UCaptureWDM.pas b/Game/Code/lib/DSPack/UCaptureWDM.pas
index c483e58a..10596d54 100644
--- a/Game/Code/lib/DSPack/UCaptureWDM.pas
+++ b/Game/Code/lib/DSPack/UCaptureWDM.pas
@@ -66,7 +66,7 @@ type
procedure Stop;
end;
- function ListMediaTypes(DeviceID: integer): TList;
+ procedure ListMediaTypes(DeviceID: integer; var types: TList);
procedure GetCapDevices(var names: TList);
implementation
@@ -98,7 +98,7 @@ begin
end;
end;
-function ListMediaTypes(DeviceID: integer): TList;
+procedure ListMediaTypes(DeviceID: integer; var types: TList);
var
PinList: TPinList;
tSysDev: TSysDevEnum;
@@ -108,40 +108,70 @@ var
k: Integer;
begin
- SetLength(Result, 0);
+ SetLength(types, 0);
- tSysDev := TSysDevEnum.Create(CLSID_VideoInputDeviceCategory);
+ try
+ tSysDev := TSysDevEnum.Create(CLSID_VideoInputDeviceCategory);
- FilterGraph := TFilterGraph.Create( nil );
- FilterGraph.Mode := gmCapture;
- FilterGraph.Active := False;
- FilterGraph.AutoCreate := False;
- FilterGraph.GraphEdit := True;
+ FilterGraph := TFilterGraph.Create( nil );
+ FilterGraph.Mode := gmCapture;
+ FilterGraph.Active := False;
+ FilterGraph.AutoCreate := False;
+ FilterGraph.GraphEdit := True;
- Filter := TFilter.Create( nil );
- Filter.FilterGraph := FilterGraph;
+ Filter := TFilter.Create( nil );
+ Filter.FilterGraph := FilterGraph;
- Filter.BaseFilter.Moniker := tSysDev.GetMoniker(DeviceID);
- Filter.FilterGraph.Active := true;
- PinList := TPinList.Create(Filter as IBaseFilter);
- VideoMediaTypes := TEnumMediaType.Create(PinList.First);
+ Filter.BaseFilter.Moniker := tSysDev.GetMoniker(DeviceID);
+ Filter.FilterGraph.Active := true;
+ PinList := TPinList.Create(Filter as IBaseFilter);
+ VideoMediaTypes := TEnumMediaType.Create(PinList.First);
- SetLength(Result, VideoMediaTypes.Count);
- for k := 0 to VideoMediaTypes.Count - 1 do
- begin
- Result[k] := VideoMediaTypes.MediaFormatDescription[k];
- //writeln(Result[k]);
- //writeln(VideoMediaTypes.MediaFormatDescription[k]);
+ SetLength(types, VideoMediaTypes.Count);
+ for k := 0 to VideoMediaTypes.Count - 1 do
+ begin
+ types[k] := VideoMediaTypes.MediaFormatDescription[k];
+ //writeln(Result[k]);
+ //writeln(VideoMediaTypes.MediaFormatDescription[k]);
+ end;
+ except
+ SetLength(types, 0);
end;
- PinList.Free;
- VideoMediaTypes.Free;
- FilterGraph.Stop;
- FilterGraph.ClearGraph;
- FilterGraph.Active := False;
- FilterGraph.Free;
- Filter.Free;
- tSysDev.Free;
+ try
+ if (PinList<>nil) then
+ PinList.Free;
+ except
+ end;
+
+ try
+ if (VideoMediaTypes<>nil) then
+ VideoMediaTypes.Free;
+ except
+ end;
+
+ try
+ if (FilterGraph<>nil) then
+ begin
+ FilterGraph.Stop;
+ FilterGraph.ClearGraph;
+ FilterGraph.Active := False;
+ FilterGraph.Free;
+ end;
+ except
+ end;
+
+ try
+ if (Filter<>nil) then
+ Filter.Free;
+ except
+ end;
+
+ try
+ if (tSysDev<>nil) then
+ tSysDev.Free;
+ except
+ end;
end;
constructor TSampleClass.Create(DeviceID, MediaTypeID: integer);