hg merge: add my own code

This commit is contained in:
Thai Pangsakulyanont
2010-12-19 17:44:39 +07:00
135 changed files with 12792 additions and 2390 deletions
+16
View File
@@ -8,6 +8,10 @@ tests/*.err
*.suo
*.obj
*.app
*.dep
*.idb
*.pdb
*.exp
.hg
.hgignore
.hgtags
@@ -16,17 +20,29 @@ tests/*.err
.DS_Store
Thumbs.db
*.pbxuser
*.user
*.mode1v3
*.exe
*.vdi
PBProject/build
Xcode/build
src/build-*
src/Release-*
src/libtomcrypt/build-*
src/libtomcrypt/Release-*
src/libtommath/build-*
src/libtommath/Release-*
ver.cpp
lib*_link.a
Data/UserPrefs
PBProject/Hardware.plist
Themes/pump
Themes/optical-release
src/version.bin
src/verstub.cpp
nsis_strings_temp.inc
Data/SpeedMods.txt
syntax: regexp
.*\#.*\#$
glob:Cache/Banners/AdditionalSongs_Airspace Preview_Derailed_Derailed bn.png
+85 -2
View File
@@ -1,7 +1,7 @@
sm-ssc Changelog
________________________________________________________________________________
The sm-ssc changelog mainly deals with source code-related changes, as theme
changes happen at a rapid pace.
The sm-ssc changelog mostly deals with source code-related changes,
as theme changes happen at a rapid pace.
Changes are grouped by date.
Not all changes are documented, for various reasons.
@@ -9,6 +9,89 @@ Not all changes are documented, for various reasons.
supported but exist anyways.)
_____________________________________________________________________________
================================================================================
sm-ssc v1.2 | 201012xx
--------------------------------------------------------------------------------
20101218
--------
* [MusicWheelItem] Add OverPart. [freem]
* [Profile] SetCharacter(sCharID) Lua binding added. [freem]
* [GameState] GetCharacter(PlayerNumber) and SetCharacter(PlayerNumber,sCharID)
Lua bindings added. [freem]
20101217
--------
* [Sprite] Added SetAllStateDelays(fDelay) Lua binding. [freem]
* [MusicWheelItem] Added metric commands to NormalPart/ColorPart. [freem]
20101215
--------
* Transplanted file download code from SM4 into sm-ssc.
sm-ssc can now handle the stepmania:// url protocol. [Chris Danford, freem]
20101214
--------
* [RollingNumbers] Added Load(sMetricsGroup) Lua binding. [freem]
* Modifications to pump mode spacing. [Daisuke Master]
* Add eval song data for songs with no banner. [Midiman]
20101213
--------
* [EditMenu] Enable the EditMenu to be themed more extensively. [freem]
Splits out the rows into Label and Value.
20101212
--------
* [MusicWheelItem] Gave NormalPart/ColorPart names, so metrics can be used to
manipulate them. [freem]
* [MusicWheelItem] add Color param to SetMessage. [freem]
* Added --with-sse2 configure flag for SSE2 heuristic optimizations. [vyhd]
* Added 03 IniFile to start building new userprefs/themeprefs API. [vyhd]
* [EditMenu] Converted old non-specific metrics to more specific metrics. [freem]
{Metric Changes}
SongBannerWidth,SongBannerHeight -> SongBannerOnCommand
GroupBannerWidth,GroupBannerHeight -> GroupBannerOnCommand
RowLabelsX -> Label#X
RowLabelOnCommand -> Label#OnCommand
RowValue#X -> Value#X
RowValueOnCommand -> Row#OnCommand
{Metric Additions}
SongBannerChangeCommand/GroupBannerChangeCommand - runs when song/group
banner is changed.
Label#GainFocus/LoseFocusCommand and Value#GainFocus/LoseFocusCommand - runs
when the Label and Value gain/lose focus.
20101128
--------
* Increased default scrolling speed. Modifies how the speed mods work. [shakesoda]
================================================================================
sm-ssc v1.1 | 20101120
--------------------------------------------------------------------------------
20100929
--------
* Fix issues with RequireStepOnHoldHeads not working properly if the W5
window is zero. [FSX]
20100925
--------
* Add SetScore Lua binding to PlayerStageStats. [FSX]
* Don't increase combo on AvoidMine if AvoidMineIncrementsCombo is false. [FSX]
* Change build.sh to use ffmpeg 0.6 under Linux. [FSX]
20100913
--------
* Attempt to fix issues with full combos occuring when checkpoints
have been missed. [FSX]
* Fix NotesLoaderKSF. [Daisuke Master]
20100912
--------
* Add a hack allowing all courses to play, regardless of missing noteskins [wolfman2000]
* Restore ITG behavior, allow survivals to be won. [wolfman2000]
================================================================================
sm-ssc v1.0 "final" | 20100910
--------------------------------------------------------------------------------
+32 -26
View File
@@ -6,8 +6,10 @@ sm-ssc credits (in no particular order)
==the spinal shark collective==
AJ Kelly
* Main programming
* UserPreferences and some other scripts
* small theme edits here and there
* UserPreferences and some other Lua scripts
* Some small theme edits here and there
* Noteskins (retro, retrobar*)
* Windows project file maintainer
Midiman
* Did most of the work on _fallback and default themes
@@ -16,8 +18,35 @@ Midiman
shakesoda
* Programming
* Noteskins (kb7 default)
* Noteskins (delta, gamma, port of orbital to kb7)
* Theme edits
* Mac OS X primary maintainer
==sm-ssc Team==
(in no particular order)
Aldo_MX
* Code (Pump it Up delays, among others), ideas, and support.
cerbo
* [SongManager] SetPreferredSongs() and SetPreferredCourses() Lua bindings
Daisuke Master
* Programming
* Pump/simple and Pump/complex noteskins
* /Docs/Themerdocs/Noteskin elements Reference.txt
* Taking advantage of sm-ssc's new features :)
FSX
* Various fixes. (see Changelog_sm-ssc.txt for more details)
Nicole Reid (okeeblow)
* Tested building sm-ssc on FreeBSD, provided fixes.
Wolfman
* [Player] PercentUntilColorCombo metric
* Mac OS X maintainer
* Various fixes/changes. (see Changelog_sm-ssc.txt for more details)
==other contributors==
(in no particular order, aside from having SM team at the top)
@@ -26,21 +55,6 @@ StepMania Team
* Keeping StepMania 5 alive with changes, and providing a nice codebase for
us to work with.
Aldo_MX
* Code (Pump it Up delays, among others), ideas, and support.
Nicole Reid (okeeblow)
* Tested building sm-ssc on FreeBSD, provided fixes.
Wolfman
* [Player] PercentUntilColorCombo metric
Daisuke Master
* Programming
* Pump/simple and Pump/complex noteskins
* /Docs/Themerdocs/Noteskin elements Reference.txt
* Taking advantage of sm-ssc's new features :)
Kaox
* Pump/default noteskin
@@ -74,11 +88,6 @@ galopin
* Pump it Up Exceed PlayStation 2 USB dance mat support patch
(stepmania-devs mailing list 20091213 11:27 -0800 [Pacific Standard Time])
FSX
* [Player] ScoreMissedHoldsAndRolls metric
* [ScoreKeeperNormal] Patch for fixing "the" combo bug (untested)
(http://www.pastie.org/868201.txt)
Henke37
* [MovieTexture_FFMpeg] Stutter fix
(http://www.pasteall.org/11353/diff)
@@ -97,9 +106,6 @@ juanelote
* [SongManager] GetSongGroupByIndex function
* [MusicWheel] JumpToNextGroup/JumpToPrevGroup logic modifications
cerbo
* [SongManager] SetPreferredSongs() and SetPreferredCourses() Lua bindings
==the beta testers==
[SSC Beta Testing Team]
KeithD
+2 -2
View File
@@ -62,8 +62,8 @@ LetGoCommand=blend,'BlendMode_Add';
HeldCommand=blend,'BlendMode_Add';diffuse,1.0,1.0,0.3,0.875;zoom,1;linear,0.06;zoom,1.1;linear,0.06;diffusealpha,0
[HoldGhostArrow]
HoldingOnCommand=hidden,0
HoldingOffCommand=hidden,1
HoldingOnCommand=visible,true
HoldingOffCommand=visible,false
[ReceptorArrow]
W3Command=stoptweening;zoom,0.85;linear,0.12;zoom,1
+2 -2
View File
@@ -65,8 +65,8 @@ LetGoCommand=blend,'BlendMode_Add';
HeldCommand=blend,'BlendMode_Add';diffuse,1.0,1.0,0.3,0.875;zoom,1;linear,0.06;zoom,1.1;linear,0.06;diffusealpha,0
[HoldGhostArrow]
HoldingOnCommand=hidden,0
HoldingOffCommand=hidden,1
HoldingOnCommand=visible,true
HoldingOffCommand=visible,false
[ReceptorArrow]
W3Command=stoptweening;zoom,1.15;linear,0.12;zoom,1
+6 -6
View File
@@ -9,12 +9,12 @@ Noteskin.ElementRedirs = {
-- button redirs (since this is a bar noteskin, it's all the same)
Noteskin.ButtonRedirs = {
-- dance
Left = "Bar";
UpLeft = "Bar";
Up = "Bar";
Down = "Bar";
UpRight = "Bar";
Right = "Bar";
Left = "Red";
UpLeft = "Red";
Up = "Red";
Down = "Red";
UpRight = "Red";
Right = "Red";
-- kb7
Key1 = "Red";
Key2 = "Red";
@@ -0,0 +1 @@
Common Normal
@@ -0,0 +1 @@
_blank
@@ -0,0 +1 @@
_blank
@@ -0,0 +1 @@
MusicWheelItem Roulette NormalPart
@@ -0,0 +1 @@
MusicWheelItem Roulette NormalPart
@@ -0,0 +1 @@
_blank
@@ -0,0 +1 @@
_blank
@@ -0,0 +1 @@
_blank
@@ -0,0 +1 @@
_blank
+10 -9
View File
@@ -51,12 +51,12 @@ Nightmare=Nightmare
HalfDouble=Half-Double
[CourseDifficulty]
Beginner=BEGINNER
Challenge=CHALLENGE
Hard=DIFFICULT
Easy=EASY
Edit=EDIT
Medium=REGULAR
Beginner=Novice
Challenge=Expert
Hard=Hard
Easy=Easy
Edit=Edit
Medium=Medium
[CourseEntryType]
Best=Players' Best
@@ -291,7 +291,7 @@ Not Supported=Mode not supported while networked.
192nd=192nd
[OptionExplanations]
Accel=Accel
Accel=Accelerate, Decelerate or otherwise adjust the arrow speed.
AllowExtraStage=When enabled (and Event Mode isn't on), allows the player to earn extra stages after completing certain requirements.
AllowW1=Enable or disable fantastic judgement. NEVER - never show Fantastic, COURSES ONLY - only during nonstop/oni modes, ALWAYS - all modes of play.
Announcer=Choose from this list of installed announcer packs.
@@ -557,8 +557,8 @@ Boost=Boost
Both=Both
Brake=Brake
Bumpy=Bumpy
C200=C200
C400=C400
C150=C150
C300=C300
CPU-Controlled=CPU-Controlled
Centered=Centered
Choose=Choose
@@ -692,6 +692,7 @@ Silent=Silent
Skip=Skip
Skippy=Skippy
Slow=Slow
SN2=Supernova 2
SongAttacks=Song Attacks
Song BGAnimation=Song BGAnimation
Song Bitmap=Song Bitmap
@@ -68,7 +68,7 @@ local function ParseSpeedModFile(path)
return mods
else
-- error; write a fallback mod file and return it
local fallbackString = "0.5x,1x,1.5x,2x,3x,4x,8x,C200,C400"
local fallbackString = "0.5x,0.75x,1x,1.75x,2x,2.25x,2.5x,C150,C300"
Trace("[CustomSpeedMods]: Could not read SpeedMods; writing fallback to "..path)
file:Open(path, 2)
file:Write(fallbackString)
@@ -0,0 +1,147 @@
-- GamePreferences: Clone of AJ's User Preferences "Module"
-- Written by AJ Kelly of KKI Labs / Version 2.11-ssc
-- (modified slightly for Cerulean Skies 2's disregard of the name of the
-- themeinfo variable lol :p)
--[[
the first released version was broken.
this version aims to be simpler, and therefore work.
[changelog]
v2.11-ssc
Remove EnvUtils references; we have it in sm-ssc.
v2.1-ssc
sm-ssc version of UserPrefs. We can now assume players have certain
functionality, like RageFile:GetError().
v2.1
Added type specific GetUserPref functions.
[usage]
First, edit PrefPath to match your theme.
If you use ThemeInfo, then you shouldn't have to edit this.
If you're not using ThemeInfo, then you can replace
".. themeInfo.Name .." with the theme's folder name.
ThemeInfo is documented at http://kki.ajworld.net/wiki/ThemeInfo.lua
After that's set up, read the docs.
]]
local PrefPath = "Data/GamePrefs/"
--[[ begin internal stuff; no need to edit below this line. ]]
-- Local internal function to write envs. ___Not for themer use.___
local function WriteEnv(envName,envValue)
return setenv(envName,envValue)
end
function ReadGamePrefFromFile(name)
local f = RageFileUtil.CreateRageFile()
local fullFilename = PrefPath..name..".cfg"
local option
if f:Open(fullFilename,1) then
option = tostring( f:Read() )
WriteEnv(name,option)
f:destroy()
return option
else
local fError = f:GetError()
Trace( "[FileUtils] Error reading ".. fullFilename ..": ".. fError )
f:ClearError()
f:destroy()
return nil
end
end
function WriteGamePrefToFile(name,value)
local f = RageFileUtil.CreateRageFile()
local fullFilename = PrefPath..name..".cfg"
if f:Open(fullFilename, 2) then
f:Write( tostring(value) )
WriteEnv(name,value)
else
local fError = f:GetError()
Trace( "[FileUtils] Error writing to ".. fullFilename ..": ".. fError )
f:ClearError()
f:destroy()
return false
end
f:destroy()
return true
end
--[[ end internal functions; still don't edit below this line ]]
function GetGamePref(name)
return ReadGamePrefFromFile(name)
end
function SetGamePref(name,value)
return WriteGamePrefToFile(name,value)
end
--[[ type specific, for when you want to be lazy ]]
-- XXX: make set funcs, since I hate dealing with colors and I know
-- other themers would too.
-- GetUserPrefB: boolean
function GetGamePrefB(name)
-- this one is a bit trickier.
local pref = ReadGamePrefFromFile(name)
if type(pref) == "string" then
pref = string.lower(pref)
if pref == "true" or cmp == "t" then
return true
elseif pref == "false" or cmp == "f" then
return false
else
Trace("Error in GetUserPrefB(".. name ..") converting from string" )
return false
end
elseif type(pref) == "number" then
-- both 0 and -1 are false; if you want to change this,
-- feel free to remove "or pref == -1".
if pref == 0 or pref == -1 then
else
return true
end
end
end
-- GetUserPrefC: color
function GetGamePrefC(name)
-- XXX: make sure it's grabbing a string that can be turned into a color
-- and also possibly handle HSV values too.
return color( ReadGamePrefFromFile(name) )
end
-- GetUserPrefN: numbers (integers, floats)
function GetGamePrefN(name)
return tonumber( ReadGamePrefFromFile(name) )
end
--[[
Copyright © 2008-2009 AJ Kelly/KKI Labs
All rights reserved.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
]]
+119
View File
@@ -0,0 +1,119 @@
--[[
IniFile: basically a Lua rewrite of SM's IniFile class that serves as the
basis for the sm-ssc UserPrefs and ThemePrefs configuration systems.
Note that this is a namespace, not a class per se.
--]]
-- TODO: move this into a more general section
-- func takes a key and a value
function foreach_ordered( tbl, func )
local keys = { }
for k,_ in pairs(tbl) do keys[#keys+1] = k end
table.sort( keys )
-- iterate in sorted order
for _,key in ipairs(keys) do func( key, tbl[key]) end
end
-- redeclared here for my sanity's sake
-- TODO: declare these as global variables
local RageFile =
{
READ = 1,
WRITE = 2,
STREAMED = 4,
SLOW_FLUSH = 8
}
-- IniFile namespace
IniFile =
{
StrToKeyVal = function( str )
local _, _, key, value = str:find( "(.+)=(.*)" )
-- key is always a string, but value may be num, bool, or nil.
-- do a few quick checks to see which one it is.
-- if it's a nil, convert it to an empty string and return
if value == nil then value = ""; return key, value; end
-- if it's a number, convert it in place and return
if tonumber(value) ~= nil then value = tonumber(value); return key, value; end
-- not a number, so let's try a boolean value
if value == "true" then value = true;
elseif value == "false" then value = false;
end
return key, value
end,
ReadFile = function( file_path )
Trace( "IniFile.ReadFile( " .. file_path .. " )" )
local file = RageFileUtil.CreateRageFile()
if not file:Open(file_path, RageFile.READ) then
Warn( string.format("ReadFile(%s): %s",file_path,file:GetError()) )
file:destroy()
return { } -- return a blank table
end
local tbl = { }
local current = tbl
while not file:AtEOF() do
local str = file:GetLine()
-- is this a section?
local _, _, sec = str:find( "%[(.+)%]" )
-- if so, set focus there; otherwise, try to
-- read a key/value pair (ignore blank lines)
if sec then
-- if this section doesn't exist, create it
tbl[sec] = tbl[sec] and tbl[sec] or { }
current = tbl[sec]
Warn( "Switching section to " .. sec )
else
local k, v = IniFile.StrToKeyVal( str )
if k and v then current[k] = v end
end
end
file:Close()
file:destroy()
return tbl
end,
WriteFile = function( file_path, tbl )
Trace( "IniFile.WriteFile( " .. file_path .. " )" )
local file = RageFileUtil.CreateRageFile()
if not file:Open(file_path, RageFile.WRITE) then
Warn( string.format("WriteFile(%s): %s",file_path.file:GetError()) )
file:destroy()
return false
end
-- declare functions so we can write with foreach_ordered
local function put_pair( k, v )
file:PutLine( string.format("%s=%s", k, tostring(v)) )
end
local function put_section( section, pair )
file:PutLine( "[" .. section .. "]" )
foreach_ordered( pair, put_pair )
file:PutLine("") -- put a blank line between sections
end
-- each base key is a section and its value is a
-- table of key-value pairs under that section.
foreach_ordered( tbl, put_section )
file:Close()
file:destroy()
return true
end
};
@@ -63,7 +63,12 @@ Condition = {
return GAMESTATE:PlayerIsUsingModifier( pnPlayer, sModifier );
end,
}
--[[ 3.9 Functions ]]
Game = {
GetStage = function()
end,
}
--[[ Aliases ]]
-- Blend Modes
@@ -236,5 +241,12 @@ function pname(pn)
return ToEnumShortString(pn)
end
function math.round(num, pre)
if pre and pre < 0 then pre = 0 end
local mult = 10^(pre or 0)
if num >= 0 then return math.floor(num*mult+.5)/mult
else return math.ceil(num*mult-.5)/mult end
end
--[[ end helper functions ]]
-- this code is in the public domain.
-- this code is in the public domain.
@@ -0,0 +1,502 @@
-- sm-ssc Default Theme Preferences Handler
function InitGamePrefs()
local Prefs =
{
{ "AutoSetStyle", false },
{ "NotePosition", true },
{ "ComboOnRolls", false },
{ "ComboUnderField", true },
{ "AdjustSpeed", false },
};
for idx,pref in ipairs(Prefs) do
if GetGamePrefB( pref[1] ) == nil then
SetGamePref( pref[1], pref[2] );
end;
end;
end
function InitUserPrefs()
if GetUserPrefB("UserPrefShowLotsaOptions") == nil then
SetUserPref("UserPrefShowLotsaOptions", true);
end;
local Prefs =
{
{ "UserPrefGameplayShowStepsDisplay", true },
{ "UserPrefGameplayShowScore", false},
--[[ { "ProTimingP1", false},
{ "ProTimingP2", false},
--]]
};
local BPrefs =
{
{ "UserPrefShowLotsaOptions", true},
{ "UserPrefLongFail", false},
{ "UserPrefProtimingP1", false},
{ "UserPrefProtimingP2", false},
{ "FlashyCombos", false},
};
for idx,pref in ipairs(Prefs) do
if GetUserPref( pref[1] ) == nil then
SetUserPref( pref[1], pref[2] );
end;
end;
-- making sure I don't screw up anything yet...
for idx,pref in ipairs(BPrefs) do
if GetUserPrefB( pref[1] ) == nil then
SetUserPref( pref[1], pref[2] );
end;
end;
end;
--[[ theme option rows ]]
-- screen cover
function GetProTiming(pn)
local pname = ToEnumShortString(pn);
if GetUserPref("ProTiming"..pname) then
return GetUserPrefB("ProTiming"..pname);
else
SetUserPref("ProTiming"..pname,false);
return false;
end;
end;
function OptionRowProTiming()
local t = {
Name = "ProTiming";
LayoutType = "ShowAllInRow";
SelectType = "SelectOne";
OneChoiceForAllPlayers = false;
ExportOnChange = false;
Choices = { 'Off','On' };
LoadSelections = function(self, list, pn)
local bShow;
if GetUserPrefB("UserPrefProtiming" .. ToEnumShortString(pn) ) then
bShow = GetUserPrefB("UserPrefProtiming" .. ToEnumShortString(pn) );
if bShow then
list[2] = true;
else
list[1] = true;
end
else
list[1] = true;
end;
--[[ local pname = ToEnumShortString(pn);
if getenv("ProTiming"..pname) == true then
list[2] = true;
else
list[1] = true;
end; --]]
end;
SaveSelections = function(self, list, pn)
local bSave;
if list[2] then
bSave = true;
else
bSave = false;
end;
SetUserPref("UserPrefProtiming" .. ToEnumShortString(pn),bSave);
--[[ local val;
if list[2] then
val = true;
else
val = false;
end;
local pname = ToEnumShortString(pn);
setenv("ProTiming"..pname, val); --]]
end;
};
setmetatable( t, t );
return t;
end;
function UserPrefGameplayShowScore()
local t = {
Name = "UserPrefGameplayShowScore";
LayoutType = "ShowAllInRow";
SelectType = "SelectOne";
OneChoiceForAllPlayers = true;
ExportOnChange = false;
Choices = { 'Off','On' };
LoadSelections = function(self, list, pn)
if ReadPrefFromFile("UserPrefGameplayShowScore") ~= nil then
if GetUserPrefB("UserPrefGameplayShowScore") then
list[2] = true;
else
list[1] = true;
end;
else
WritePrefToFile("UserPrefGameplayShowScore",false);
list[1] = true;
end;
end;
SaveSelections = function(self, list, pn)
local val;
if list[2] then
val = true;
else
val = false;
end;
WritePrefToFile("UserPrefGameplayShowScore",val);
MESSAGEMAN:Broadcast("PreferenceSet", { Message == "Set Preference" } );
THEME:ReloadMetrics();
end;
};
setmetatable( t, t );
return t;
end
function UserPrefGameplayShowStepsDisplay()
local t = {
Name = "UserPrefGameplayShowStepsDisplay";
LayoutType = "ShowAllInRow";
SelectType = "SelectOne";
OneChoiceForAllPlayers = true;
ExportOnChange = false;
Choices = { 'Off','On' };
LoadSelections = function(self, list, pn)
if ReadPrefFromFile("UserPrefGameplayShowStepsDisplay") ~= nil then
if GetUserPrefB("UserPrefGameplayShowStepsDisplay") then
list[2] = true;
else
list[1] = true;
end;
else
WritePrefToFile("UserPrefGameplayShowStepsDisplay",false);
list[1] = true;
end;
end;
SaveSelections = function(self, list, pn)
local val;
if list[2] then
val = true;
else
val = false;
end;
WritePrefToFile("UserPrefGameplayShowStepsDisplay",val);
MESSAGEMAN:Broadcast("PreferenceSet", { Message == "Set Preference" } );
THEME:ReloadMetrics();
end;
};
setmetatable( t, t );
return t;
end
function UserPrefShowLotsaOptions()
local t = {
Name = "UserPrefShowLotsaOptions";
LayoutType = "ShowAllInRow";
SelectType = "SelectOne";
OneChoiceForAllPlayers = true;
ExportOnChange = false;
Choices = { 'Many','Few' };
LoadSelections = function(self, list, pn)
if ReadPrefFromFile("UserPrefShowLotsaOptions") ~= nil then
if GetUserPrefB("UserPrefShowLotsaOptions") then
list[1] = true;
else
list[2] = true;
end;
else
WritePrefToFile("UserPrefShowLotsaOptions",false);
list[2] = true;
end;
end;
SaveSelections = function(self, list, pn)
local val;
if list[1] then
val = true;
else
val = false;
end;
WritePrefToFile("UserPrefShowLotsaOptions",val);
MESSAGEMAN:Broadcast("PreferenceSet", { Message == "Set Preference" } );
THEME:ReloadMetrics();
end;
};
setmetatable( t, t );
return t;
end
function GetDefaultOptionLines()
local LineSets = {
"1,8,14,2,3,4,5,6,R,7,9,10,11,12,13,15,16,17,18", -- All
"1,8,14,2,7,13,16,17,18", -- DDR Essentials ( no turns, fx )
};
local function IsExtra()
if GAMESTATE:IsExtraStage() or GAMESTATE:IsExtraStage2() then
return true
else
return false
end
end
if not IsExtra() then
if GetUserPrefB("UserPrefShowLotsaOptions") then
return GetUserPrefB("UserPrefShowLotsaOptions") and LineSets[1] or LineSets[2];
else
return LineSets[2]; -- Just make sure!
end
else
return "1,8,14,2,7,13,16,17,18" -- "failsafe" list
end
end;
function UserPrefLongFail()
local t = {
Name = "UserPrefLongFail";
LayoutType = "ShowAllInRow";
SelectType = "SelectOne";
OneChoiceForAllPlayers = true;
ExportOnChange = false;
Choices = { 'Short','Long' };
LoadSelections = function(self, list, pn)
if ReadPrefFromFile("UserPrefLongFail") ~= nil then
if GetUserPrefB("UserPrefLongFail") then
list[2] = true;
else
list[1] = true;
end;
else
WritePrefToFile("UserPrefLongFail",false);
list[1] = true;
end;
end;
SaveSelections = function(self, list, pn)
local val;
if list[2] then
val = true;
else
val = false;
end;
WritePrefToFile("UserPrefLongFail",val);
MESSAGEMAN:Broadcast("PreferenceSet", { Message == "Set Preference" } );
THEME:ReloadMetrics();
end;
};
setmetatable( t, t );
return t;
end
function UserPrefFlashyCombo()
local t = {
Name = "UserPrefFlashyCombo";
LayoutType = "ShowAllInRow";
SelectType = "SelectOne";
OneChoiceForAllPlayers = true;
ExportOnChange = false;
Choices = { 'Off','On' };
LoadSelections = function(self, list, pn)
if ReadPrefFromFile("UserPrefFlashyCombo") ~= nil then
if GetUserPrefB("UserPrefFlashyCombo") then
list[2] = true;
else
list[1] = true;
end;
else
WritePrefToFile("UserPrefFlashyCombo",false);
list[1] = true;
end;
end;
SaveSelections = function(self, list, pn)
local val;
if list[2] then
val = true;
else
val = false;
end;
WritePrefToFile("UserPrefFlashyCombo",val);
MESSAGEMAN:Broadcast("PreferenceSet", { Message == "Set Preference" } );
THEME:ReloadMetrics();
end;
};
setmetatable( t, t );
return t;
end
--[[ end themeoption rows ]]
--[[ game option rows ]]
function GamePrefComboOnRolls()
local t = {
Name = "GamePrefComboOnRolls";
LayoutType = "ShowAllInRow";
SelectType = "SelectOne";
OneChoiceForAllPlayers = true;
ExportOnChange = false;
Choices = { 'Off','On' };
LoadSelections = function(self, list, pn)
if ReadGamePrefFromFile("ComboOnRolls") ~= nil then
if GetGamePrefB("ComboOnRolls") then
list[2] = true;
else
list[1] = true;
end;
else
WriteGamePrefToFile("ComboOnRolls",false);
list[1] = true;
end;
end;
SaveSelections = function(self, list, pn)
local val;
if list[2] then
val = true;
else
val = false;
end;
WriteGamePrefToFile("ComboOnRolls",val);
MESSAGEMAN:Broadcast("PreferenceSet", { Message == "Set Preference" } );
THEME:ReloadMetrics();
end;
};
setmetatable( t, t );
return t;
end
function GamePrefComboUnderField()
local t = {
Name = "GamePrefComboUnderField";
LayoutType = "ShowAllInRow";
SelectType = "SelectOne";
OneChoiceForAllPlayers = true;
ExportOnChange = false;
Choices = { 'Off','On' };
LoadSelections = function(self, list, pn)
if ReadGamePrefFromFile("ComboUnderField") ~= nil then
if GetGamePrefB("ComboUnderField") then
list[2] = true;
else
list[1] = true;
end;
else
WriteGamePrefToFile("ComboUnderField",true);
list[2] = true;
end;
end;
SaveSelections = function(self, list, pn)
local val;
if list[2] then
val = true;
else
val = false;
end;
WriteGamePrefToFile("ComboUnderField",val);
MESSAGEMAN:Broadcast("PreferenceSet", { Message == "Set Preference" } );
THEME:ReloadMetrics();
end;
};
setmetatable( t, t );
return t;
end
function GetDefaultArrowSpacing()
local rates = {
64, -- Default
80, -- Pro
128, -- New
};
return GetGamePrefB("AdjustSpeed") and rates[3] or rates[1];
end;
function GamePrefAdjustSpeed()
local t = {
Name = "GamePrefAdjustSpeed";
LayoutType = "ShowAllInRow";
SelectType = "SelectOne";
OneChoiceForAllPlayers = true;
ExportOnChange = false;
Choices = { 'Normal','Fast' };
LoadSelections = function(self, list, pn)
if ReadGamePrefFromFile("AdjustSpeed") ~= nil then
if GetGamePrefB("AdjustSpeed") then
list[2] = true;
else
list[1] = true;
end;
else
WriteGamePrefToFile("AdjustSpeed",true);
list[2] = true;
end;
end;
SaveSelections = function(self, list, pn)
local val;
if list[2] then
val = true;
else
val = false;
end;
WriteGamePrefToFile("AdjustSpeed",val);
MESSAGEMAN:Broadcast("PreferenceSet", { Message == "Set Preference" } );
THEME:ReloadMetrics();
end;
};
setmetatable( t, t );
return t;
end
function GamePrefAutoSetStyle()
local t = {
Name = "GamePrefAutoSetStyle";
LayoutType = "ShowAllInRow";
SelectType = "SelectOne";
OneChoiceForAllPlayers = true;
ExportOnChange = false;
Choices = { 'Off','On' };
LoadSelections = function(self, list, pn)
if ReadGamePrefFromFile("AutoSetStyle") ~= nil then
if GetGamePrefB("AutoSetStyle") then
list[2] = true;
else
list[1] = true;
end;
else
WriteGamePrefToFile("AutoSetStyle",false);
list[1] = true;
end;
end;
SaveSelections = function(self, list, pn)
local val;
if list[2] then
val = true;
else
val = false;
end;
WriteGamePrefToFile("AutoSetStyle",val);
MESSAGEMAN:Broadcast("PreferenceSet", { Message == "Set Preference" } );
THEME:ReloadMetrics();
end;
};
setmetatable( t, t );
return t;
end
function GamePrefNotePosition()
local t = {
Name = "GamePrefNotePosition";
LayoutType = "ShowAllInRow";
SelectType = "SelectOne";
OneChoiceForAllPlayers = true;
ExportOnChange = false;
Choices = { 'Normal','Lower' };
LoadSelections = function(self, list, pn)
if ReadGamePrefFromFile("NotePosition") ~= nil then
if GetGamePrefB("NotePosition") then
list[1] = true;
else
list[2] = true;
end;
else
WriteGamePrefToFile("NotePosition",false);
list[1] = true;
end;
end;
SaveSelections = function(self, list, pn)
local val;
if list[1] then
val = true;
else
val = false;
end;
WriteGamePrefToFile("NotePosition",val);
MESSAGEMAN:Broadcast("PreferenceSet", { Message == "Set Preference" } );
THEME:ReloadMetrics();
end;
};
setmetatable( t, t );
return t;
end
@@ -0,0 +1,42 @@
-- theme library: juicy library that returns lua objects on demand.
Library = {
GrooveRadar = function(self)
local function radarSet(self,player)
local selection = nil;
if GAMESTATE:IsCourseMode() then
if GAMESTATE:GetCurrentCourse() then
selection = GAMESTATE:GetCurrentTrail(player);
end;
else
if GAMESTATE:GetCurrentSong() then
selection = GAMESTATE:GetCurrentSteps(player);
end;
end;
if selection then
self:SetFromRadarValues(player, selection:GetRadarValues(player));
else
self:SetEmpty(player);
end;
end
--
local t = Def.ActorFrame {
Name="Radar";
Def.GrooveRadar {
OnCommand=cmd(zoom,0;sleep,0.583;decelerate,0.150;zoom,1);
OffCommand=cmd(sleep,0.183;decelerate,0.167;zoom,0);
CurrentSongChangedMessageCommand=function(self)
for pn in ivalues(GAMESTATE:GetHumanPlayers()) do
radarSet(self, pn);
end;
end;
CurrentStepsP1ChangedMessageCommand=function(self) radarSet(self, PLAYER_1); end;
CurrentStepsP2ChangedMessageCommand=function(self) radarSet(self, PLAYER_2); end;
CurrentTrailP1ChangedMessageCommand=function(self) radarSet(self, PLAYER_1); end;
CurrentTrailP2ChangedMessageCommand=function(self) radarSet(self, PLAYER_2); end;
};
};
return t;
end;
}
+134
View File
@@ -0,0 +1,134 @@
--[[
ThemePrefs: handles the underlying structure for ThemePrefs, so any themes
built off of this can simply declare their prefs and default values, and
access them through this system.
v0.7: Dec. 15, 2010. Initial version.
--]]
-- If we don't have IniFile, we can't read to or write from disk
if not IniFile then
Warn( "ThemePrefs: IniFile missing. Can't read/write from disk :(" )
end
function PrintTable( tbl )
Trace( "Printing table" )
for k,v in pairs(tbl) do
Trace( ("[%s] -> %s"):format(tostring(k),tostring(v)) )
end
end
local ThemePrefsPath = "Save/ThemePrefs.ini";
local FallbackTheme = "_fallback";
-- This will be set on load.
local PrefsTable = nil;
-- Gets the name of the current theme using themeInfo
-- if available and the ThemeManager name otherwise.
local function GetThemeName()
return themeInfo and themeInfo.Name or THEME:GetThemeDisplayName()
end
-- Given a preference name, returns the table it's in. Checks the current
-- theme first, then _fallback, then all other sections, in that order.
local function ResolveTable( pref )
-- check the section for this theme
local name = GetThemeName()
local val = PrefsTable[name][pref]
if val ~= nil then
Trace( ("ResolveTable(%s): found in %s"):format(pref,name) )
return PrefsTable[name]
end
-- not in the current theme; check the fallback if it exists
if PrefsTable[FallbackTheme] then
val = PrefsTable[FallbackTheme][pref]
if val ~= nil then
Trace( ("ResolveTable(%s): found in fallback"):format(pref) )
return PrefsTable[FallbackTheme]
end
end
-- not there either. check every section.
-- XXX: we should do this less redundantly.
for section, _ in pairs(PrefsTable) do
val = PrefsTable[section][pref]
if val ~= nil then
Trace( ("ResolveTable(%s): found in section %s"):format(pref,section) )
return PrefsTable[section] end
end
-- not found at all
Trace( ("ResolveTable(%s): pref not found"):format(pref) )
return nil
end
ThemePrefs =
{
NeedsSaved = false,
-- Loads preferences from Save/ThemePrefs.ini, then adds theme
-- preferences (and default values if applicable) to PrefsTable.
-- Only read from disk once, when _fallback calls this; we just
-- need the base set once to add prefs onto.
Init = function( prefs, bLoadFromDisk )
Trace( ("ThemePrefs.Init(prefs, %s)"):format(tostring(bLoadFromDisk)) )
if bLoadFromDisk then
Trace( "ThemePrefs.Init: loading from disk" )
if not ThemePrefs.Load() then return false end
end
Trace( "ThemePrefs.Init: not loading from disk" )
-- create the section if it doesn't exist
local name = GetThemeName()
PrefsTable[name] = PrefsTable[name] and PrefsTable[name] or { }
Trace( "Using section " .. name )
-- if the key doesn't exist, add it with our default value
for k, tbl in pairs(prefs) do
if not PrefsTable[name][k] then
Trace( k .. " doesn't exist, creating" )
PrefsTable[name][k] = tbl.Default
end
end
PrintTable( PrefsTable[name] )
end,
Load = function()
if not IniFile then return false end
PrefsTable = IniFile.ReadFile( ThemePrefsPath )
return true
end,
Save = function()
Trace( "ThemePrefs.Save" )
if not IniFile then return false end
if not NeedsSaved then return end
NeedsSaved = false
IniFile.WriteFile( ThemePrefsPath, PrefsTable )
end,
Get = function( name )
Trace( ("ThemePrefs.Get(%s)"):format(name) )
local tbl = ResolveTable(name)
if tbl then return tbl[name] end
Warn( ("GetThemePref: unknown preference \"%s\""):format(name) )
return nil
end,
Set = function( name, value )
Trace( ("ThemePrefs.Set(%s, %s)"):format(name, tostring(value)) )
local tbl = ResolveTable(name)
if tbl then tbl[name] = value; NeedsSaved = true; return end
Warn( ("SetThemePref: unknown preference \"%s\""):format(name) )
end,
};
-- global aliases
GetThemePref = ThemePrefs.Get
SetThemePref = ThemePrefs.Set
@@ -0,0 +1,125 @@
--[[
ThemePrefsRows: you give it the choices, values, and params, and it'll
generate the rest; quirky behavior to be outlined below. Documentation
will be provided once this system is stabilized.
v0.5: Dec. 15, 2010. Initial version. Not very well tested.
--]]
-- unless overridden, these parameters will be used for the OptionsRow
local DefaultParams =
{
LayoutType = "ShowAllInRow",
SelectType = "SelectOne",
OneChoiceForAllPlayers = true,
ExportOnChange = false,
EnabledForPlayers = nil,
ReloadRowMessages = nil,
-- takes a function(self, list, pn);
-- if not used, we use the default
LoadSelections = nil,
SaveSelections = nil,
}
local function DefaultLoadSelections( pref, default, choices, values )
return function(self, list, pn)
local val = ThemePrefs.Get( pref )
-- if our current value is here, set focus to that
for i=1, #choices do
if values[i] == val then list[i] = true return end
end
-- try the default value
for i=1, #choices do
if values[i] == default then list[i] = true return end
end
-- set to the first value and throw a warning
Warn( ("LoadSelections: preference \"%s\"'s default not in Values"):format(pref) )
list[1] = true
end
end
local function DefaultSaveSelections( pref, choices, values )
local msg = "ThemePrefChanged"
local params = { Name = pref }
return function(self, list, pn)
for i=1, #choices do
if list[i] then ThemePrefs.Set( pref, values[i] ) break end
MESSAGEMAN:Broadcast( msg, params )
end
end
end
local function CreateThemePrefRow( pref, tbl )
Trace( "CreateThemePrefRow( " .. pref .. " )" )
-- can't make an option handler without options
if not tbl.Choices then return nil end
local Choices = tbl.Choices
local Values = tbl.Values and tbl.Values or Choices
local Params = tbl.Params and tbl.Params or { }
-- set the name and choices here; we'll do the rest below
local Handler = { Name = pref, Choices = Choices }
-- add all the keys in DefaultParams, get the value from
-- Params if it exists and DefaultParams otherwise
-- (note that we explicitly check for nil, due to bools.)
for k, _ in pairs(DefaultParams) do
Handler[k] = Params[k] ~= nil and Params[k] or DefaultParams[k]
end
-- if we don't have LoadSelections and SaveSelections, make them
if not Handler.LoadSelections then
Handler.LoadSelections = DefaultLoadSelections( pref, tbl.Default, Choices, Values )
end
if not Handler.SaveSelections then
Handler.SaveSelections = DefaultSaveSelections( pref, Choices, Values )
end
return Handler
end
-- All OptionsRows for preferences are stuck in this table, accessible
-- through GetRow('name') in the namespace or ThemePrefRow('name') in
-- the global namespace. (I like to keep pollution to a minimum.)
local Rows = { }
ThemePrefsRows =
{
IsInitted = false,
Init = function( prefs )
for pref, tbl in pairs(prefs) do
Rows[pref] = CreateThemePrefRow( pref, tbl )
end
end,
GetRow = function( pref )
Trace( ("GetRow(%s), type %s"):format(pref, type(Rows[pref])) )
return Rows[pref]
end,
}
-- Global namespace alias
ThemePrefRow = ThemePrefsRows.GetRow
-- UGLY: declare this here, even though it's in the previous namespace,
-- so we can have one call to initialize both systems (ThemePrefsRow is
-- declared after ThemePrefs, so it can't actually be in that file...)
ThemePrefs.InitAll = function( prefs )
Trace( "ThemePrefs.InitAll( prefs )" )
-- HACK: for now, don't worry about extraneous file I/O
ThemePrefs.Init( prefs, true )
ThemePrefsRows.Init( prefs )
end
+106 -42
View File
@@ -25,7 +25,8 @@ ScreenHeight=480
# Allows you to pick all available game modes for your gametype: for example,
# inserting enough coins for 1p would let you choose between solo, single
# and double before each game
AutoSetStyle=true
# AutoSetStyle=true
AutoSetStyle=GetGamePrefB("AutoSetStyle")
# Default modifiers and noteskin.
DefaultModifiers="default;1.5x;"
DefaultNoteSkinName="default"
@@ -44,9 +45,11 @@ FirstAttractScreen="ScreenDemonstration"
# First screen that pops up when you start the game. ScreenInit in particular
# shows the theme information before going to the title screen.
InitialScreen="ScreenInit"
# Music selection screen used after downloading files.
SelectMusicScreen="ScreenSelectMusic"
# Screens that show over everything else. you shouldn't worry bout this, since
# it wont matter much.
OverlayScreens="ScreenSystemLayer,ScreenSyncOverlay,ScreenStatsOverlay,ScreenDebugOverlay,ScreenConsoleOverlay"
OverlayScreens="ScreenSystemLayer,ScreenSyncOverlay,ScreenStatsOverlay,ScreenDebugOverlay,ScreenConsoleOverlay,ScreenInstallOverlay"
# Legacy metric: Percentage Scoring shows this many decimals ( 00.00% ).
PercentScoreDecimalPlaces=2
@@ -124,7 +127,7 @@ FrameWidthEffectsMinMultiplier=0.5
FrameWidthEffectsMaxMultiplier=1.2
FrameWidthLockEffectsToOverlapping=false
FrameWidthLockEffectsTweenPixels=25
ArrowSpacing=64
ArrowSpacing=128
DrawHiddenNotesAfterReceptor=true
[Background]
@@ -920,7 +923,8 @@ RequireStepOnHoldHeads=HoldHeadStep()
RequireStepOnMines=false
InitialHoldLife=InitialHoldLife()
MaxHoldLife=MaxHoldLife()
RollBodyIncrementsCombo=RollBodyIncrementsCombo()
# RollBodyIncrementsCombo=RollBodyIncrementsCombo()
RollBodyIncrementsCombo=GetGamePrefB("UserPrefComboOnRolls")
ScoreMissedHoldsAndRolls=ScoreMissedHoldsAndRolls()
PercentUntilColorCombo=0.25
@@ -1256,6 +1260,7 @@ CreditsP2PlayerJoinedMessageCommand=playcommand,"UpdateText";
CreditsP2ScreenChangedMessageCommand=playcommand,"UpdateVisible";queuecommand,"On"
CreditsP2OnCommand=horizalign,right;vertalign,bottom;zoom,0.675;shadowlength,1;
CreditsP2OffCommand=
[ScreenConsoleOverlay]
Class="ScreenSystemLayer"
Fallback="ScreenSystemLayer"
@@ -1265,6 +1270,15 @@ CreditsP1X=-9999
CreditsP2X=-9999
CreditsP1Y=-9999
CreditsP2Y=-9999
[ScreenInstallOverlay]
Class="ScreenInstallOverlay"
Fallback="Screen"
StatusX=SCREEN_LEFT+40
StatusY=SCREEN_BOTTOM-32
StatusOnCommand=align,0,1
[ScreenSyncOverlay]
Class="ScreenSyncOverlay"
Fallback="Screen"
@@ -2027,12 +2041,12 @@ Speed,2="mod,0.50x;name,x0.50"
Speed,3="mod,0.75x;name,x0.75"
Speed,4="mod,1x;name,x1"
Speed,5="mod,1.5x;name,x1.5"
Speed,6="mod,2x;name,x2"
Speed,7="mod,3x;name,x3"
Speed,8="mod,4x;name,x4"
Speed,9="mod,8x;name,x8"
Speed,10="mod,C200;name,C200"
Speed,11="mod,C400;name,C400"
Speed,6="mod,2x;name,x1.75"
Speed,7="mod,3x;name,x2"
Speed,8="mod,4x;name,x2.25"
Speed,9="mod,8x;name,x2.5"
Speed,10="mod,C150;name,C150"
Speed,11="mod,C300;name,C300"
Speed,12="mod,1x,200% randomspeed;name,Random"
Accel="5;selectmultiple"
@@ -2276,13 +2290,12 @@ BatLives,7="mod,7 lives;name,7"
BatLives,8="mod,8 lives;name,8"
BatLives,9="mod,9 lives;name,9"
BatLives,10="mod,10 lives;name,10"
Fail="5;together"
Fail="4;together"
FailDefault="mod,faildefault"
Fail,1="mod,faildefault;name,Default"
Fail,2="mod,failimmediate;name,Immediate"
Fail,3="mod,failimmediatecontinue;name,ImmediateContinue"
Fail,4="mod,failatend;name,FailAtEnd"
Fail,5="mod,failoff;name,Off"
Fail,1="mod,failimmediate;name,Immediate"
Fail,2="mod,failimmediatecontinue;name,ImmediateContinue"
Fail,3="mod,failatend;name,FailAtEnd"
Fail,4="mod,failoff;name,Off"
Assist="4;together"
AssistDefault=""
Assist,1="mod,no clap,no metronome;name,Off"
@@ -3335,37 +3348,30 @@ Line4="gamecommand;screen,ScreenOptionsManageCourses;name,Edit Courses"
[EditMenu]
EditMode="EditMode_Full"
TextBannerType="TextBannerEditMode"
ShowGroups=true
Arrows1X=SCREEN_CENTER_X-130
Arrows2X=SCREEN_CENTER_X+270
ArrowsEnabledCommand=diffuse,color("1,1,1,1");shadowlengthy,1;shadowcolor,color("#002740");
ArrowsDisabledCommand=diffuse,color("0.45,0.45,0.45,1");shadowlengthy,1;shadowcolor,color("#002740");
SongBannerX=SCREEN_CENTER_X+170
SongBannerY=SCREEN_CENTER_Y-90
SongBannerWidth=128
SongBannerHeight=40
SongTextBannerX=SCREEN_CENTER_X-64
SongTextBannerY=SCREEN_CENTER_Y-90
GroupBannerX=SCREEN_CENTER_X+170
GroupBannerY=SCREEN_CENTER_Y-140
GroupBannerWidth=128
GroupBannerHeight=40
GroupBannerOnCommand=scaletoclipped,128,40
SongBannerX=SCREEN_CENTER_X+170
SongBannerY=SCREEN_CENTER_Y-90
SongBannerOnCommand=scaletoclipped,128,40
TextBannerType="TextBannerEditMode"
SongTextBannerX=SCREEN_CENTER_X-64
SongTextBannerY=SCREEN_CENTER_Y-90
StepsDisplayX=SCREEN_CENTER_X+170
StepsDisplayY=SCREEN_CENTER_Y-0
StepsDisplaySourceX=SCREEN_CENTER_X+170
StepsDisplaySourceY=SCREEN_CENTER_Y+80
RowLabelsX=SCREEN_CENTER_X-250
RowLabelOnCommand=shadowlength,1;zoom,0.75
RowValue1X=SCREEN_CENTER_X
RowValue2X=SCREEN_CENTER_X+60
RowValue3X=SCREEN_CENTER_X+60
RowValue4X=SCREEN_CENTER_X
RowValue5X=SCREEN_CENTER_X+60
RowValue6X=SCREEN_CENTER_X
RowValue7X=SCREEN_CENTER_X+60
RowValueOnCommand=shadowlength,1;zoom,0.75;maxwidth,SCREEN_CENTER_X*0.65
Row1Y=SCREEN_CENTER_Y-140
Row2Y=SCREEN_CENTER_Y-90
Row3Y=SCREEN_CENTER_Y-40
@@ -3374,6 +3380,64 @@ Row5Y=SCREEN_CENTER_Y+40
Row6Y=SCREEN_CENTER_Y+80
Row7Y=SCREEN_CENTER_Y+120
Label1X=SCREEN_CENTER_X-250
Label1Y=THEME:GetMetric("EditMode","Row1Y")
Label1OnCommand=shadowlength,1;zoom,0.75
Label1OffCommand=
Label2X=SCREEN_CENTER_X-250
Label2Y=THEME:GetMetric("EditMode","Row2Y")
Label2OnCommand=shadowlength,1;zoom,0.75
Label2OffCommand=
Label3X=SCREEN_CENTER_X-250
Label3Y=THEME:GetMetric("EditMode","Row3Y")
Label3OnCommand=shadowlength,1;zoom,0.75
Label3OffCommand=
Label4X=SCREEN_CENTER_X-250
Label4Y=THEME:GetMetric("EditMode","Row4Y")
Label4OnCommand=shadowlength,1;zoom,0.75
Label4OffCommand=
Label5X=SCREEN_CENTER_X-250
Label5Y=THEME:GetMetric("EditMode","Row5Y")
Label5OnCommand=shadowlength,1;zoom,0.75
Label5OffCommand=
Label6X=SCREEN_CENTER_X-250
Label6Y=THEME:GetMetric("EditMode","Row6Y")
Label6OnCommand=shadowlength,1;zoom,0.75
Label6OffCommand=
Label7X=SCREEN_CENTER_X-250
Label7Y=THEME:GetMetric("EditMode","Row7Y")
Label7OnCommand=shadowlength,1;zoom,0.75
Label7OffCommand=
Value1X=SCREEN_CENTER_X
Value1Y=THEME:GetMetric("EditMode","Row1Y")
Value1OnCommand=shadowlength,1;zoom,0.75;maxwidth,SCREEN_CENTER_X*0.65
Value1OffCommand=
Value2X=SCREEN_CENTER_X+60
Value2Y=THEME:GetMetric("EditMode","Row2Y")
Value2OnCommand=shadowlength,1;zoom,0.75;maxwidth,SCREEN_CENTER_X*0.65
Value2OffCommand=
Value3X=SCREEN_CENTER_X+60
Value3Y=THEME:GetMetric("EditMode","Row3Y")
Value3OnCommand=shadowlength,1;zoom,0.75;maxwidth,SCREEN_CENTER_X*0.65
Value3OffCommand=
Value4X=SCREEN_CENTER_X
Value4Y=THEME:GetMetric("EditMode","Row4Y")
Value4OnCommand=shadowlength,1;zoom,0.75;maxwidth,SCREEN_CENTER_X*0.65
Value4OffCommand=
Value5X=SCREEN_CENTER_X+60
Value5Y=THEME:GetMetric("EditMode","Row5Y")
Value5OnCommand=shadowlength,1;zoom,0.75;maxwidth,SCREEN_CENTER_X*0.65
Value5OffCommand=
Value6X=SCREEN_CENTER_X
Value6Y=THEME:GetMetric("EditMode","Row6Y")
Value6OnCommand=shadowlength,1;zoom,0.75;maxwidth,SCREEN_CENTER_X*0.65
Value6OffCommand=
Value7X=SCREEN_CENTER_X+60
Value7Y=THEME:GetMetric("EditMode","Row7Y")
Value7OnCommand=shadowlength,1;zoom,0.75;maxwidth,SCREEN_CENTER_X*0.65
Value7OffCommand=
[TextBannerEditMode]
Fallback="TextBanner"
@@ -3654,15 +3718,15 @@ ChatOutputOffCommand=diffusealpha,1;linear,0.5;diffusealpha,0
UsersX=SCREEN_CENTER_X-265
UsersY=SCREEN_CENTER_Y+172
UsersDX=40
UsersAY=16
UserSpacingX=64
UserLine2Y=16
UsersOnCommand=draworder,2;zoom,1
UsersOffCommand=linear,0.5;zoom,0
Users0Command=draworder,2;diffuse,1.0,0.4,0.4,1.0
Users1Command=draworder,2;diffuse,1.0,1.0,1.0,1.0
Users2Command=draworder,2;diffuse,0.5,0.5,1.0,1.0
Users3Command=draworder,2;diffuse,0.5,1.0,0.5,1.0
Users4Command=draworder,2;diffuse,1.0,0.5,0.5,1.0
Users0Command=draworder,2;diffuse,color("1.0,0.4,0.4,1.0")
Users1Command=draworder,2;diffuse,color("1.0,1.0,1.0,1.0")
Users2Command=draworder,2;diffuse,color("0.5,0.5,1.0,1.0")
Users3Command=draworder,2;diffuse,color("0.5,1.0,0.5,1.0")
Users4Command=draworder,2;diffuse,color("1.0,0.5,0.5,1.0")
[ScreenNetSelectMusic]
Class="ScreenNetSelectMusic"
@@ -154,6 +154,72 @@ for pn in ivalues(PlayerNumber) do
};
end
t[#t+1] = StandardDecorationFromFileOptional("SongInformation","SongInformation") .. {
BeginCommand=function(self)
local SongOrCourse;
if GAMESTATE:GetCurrentSong() then
SongOrCourse = GAMESTATE:GetCurrentSong();
elseif GAMESTATE:GetCurrentCourse() then
SongOrCourse = GAMESTATE:GetCurrentCourse();
else
return
end
if SongOrCourse:HasBanner() then
self:visible(false);
else
self:visible(true);
end
end;
SetCommand=function(self)
local c = self:GetChildren();
local SongOrCourse;
if GAMESTATE:GetCurrentSong() then
SongOrCourse = GAMESTATE:GetCurrentSong();
c.TextTitle:settext( SongOrCourse:GetDisplayMainTitle() or nil );
c.TextSubtitle:settext( SongOrCourse:GetDisplaySubTitle() or nil );
c.TextArtist:settext( SongOrCourse:GetDisplayArtist() or nil );
if SongOrCourse:GetDisplaySubTitle() == "" then
c.TextTitle:visible(true);
c.TextTitle:y(-16.5/2);
c.Subtitle:visible(false);
c.Subtitle:y(0);
c.TextArtist:visible(true);
c.TextArtist:y(18/2);
else
c.TextTitle:visible(true);
c.TextTitle:y(-16.5);
c.Subtitle:visible(true);
c.Subtitle:y(0);
c.TextArtist:visible(true);
c.TextArtist:y(18);
end
-- self:playcommand("Tick");
elseif GAMESTATE:GetCurrentCourse() then
SongOrCourse = GAMESTATE:GetCurrentCourse();
c.TextTitle:settext( SongOrCourse:GetDisplayMainTitle() or nil );
c.TextSubtitle:settext( SongOrCourse:GetDisplaySubTitle() or nil );
c.TextArtist:settext( SongOrCourse:GetDisplayArtist() or nil );
-- self:playcommand("Tick");
else
SongOrCourse = nil;
c.TextTitle:settext("");
c.TextSubtitle:settext("");
c.TextArtist:settext("");
self:playcommand("Hide")
end
end;
-- OnCommand=cmd(playcommand,"Set");
CurrentSongChangedMessageCommand=cmd(playcommand,"Set");
CurrentCourseChangedMessageCommand=cmd(playcommand,"Set");
DisplayLanguageChangedMessageCommand=cmd(playcommand,"Set");
};
t[#t+1] = StandardDecorationFromFileOptional("LifeDifficulty","LifeDifficulty");
t[#t+1] = StandardDecorationFromFileOptional("TimingDifficulty","TimingDifficulty");
t[#t+1] = StandardDecorationFromFileOptional("GameType","GameType");
@@ -0,0 +1,6 @@
return Def.ActorFrame {
Def.Quad{
InitCommand=cmd(FullScreen;diffuse,color("1,0,0,0");blend,Blend.Multiply);
OnCommand=cmd(smooth,1;diffuse,color("0.75,0,0,0.75");decelerate,2;diffuse,color("0,0,0,1"));
};
};
@@ -0,0 +1 @@
[BGAnimation]
@@ -0,0 +1 @@
[BGAnimation]
@@ -0,0 +1 @@
[BGAnimation]
@@ -0,0 +1 @@
[BGAnimation]
@@ -5,7 +5,7 @@ local function UpdateTime(self)
local vStats = STATSMAN:GetCurStageStats():GetPlayerStageStats( pn );
local vTime;
local obj = self:GetChild( string.format("RemainingTime" .. PlayerNumberToString(pn) ) );
if vStats then
if vStats and obj then
vTime = vStats:GetLifeRemainingSeconds()
obj:settext( SecondsToMMSSMsMs( vTime ) );
end;
@@ -37,4 +37,4 @@ if GAMESTATE:GetCurrentCourse() then
end;
end; --]]
t.InitCommand=cmd(SetUpdateFunction,UpdateTime);
return t
return t
@@ -111,6 +111,10 @@ for pn in ivalues(PlayerNumber) do
end
t[#t+1] = StandardDecorationFromFileOptional("BannerFrame","BannerFrame");
t[#t+1] = StandardDecorationFromFileOptional("PaneDisplayFrameP1","PaneDisplayFrame");
t[#t+1] = StandardDecorationFromFileOptional("PaneDisplayFrameP2","PaneDisplayFrame");
t[#t+1] = StandardDecorationFromFileOptional("PaneDisplayTextP1","PaneDisplayTextP1");
t[#t+1] = StandardDecorationFromFileOptional("PaneDisplayTextP2","PaneDisplayTextP2");
t[#t+1] = StandardDecorationFromFileOptional("DifficultyList","DifficultyList");
t[#t+1] = StandardDecorationFromFileOptional("CourseContentsList","CourseContentsList");
t[#t+1] = StandardDecorationFromFileOptional("BPMDisplay","BPMDisplay");
@@ -0,0 +1,152 @@
local iPN = ...;
assert(iPN,"[Graphics/PaneDisplay text.lua] No PlayerNumber Provided.");
local t = Def.ActorFrame {};
local function GetRadarData( pnPlayer, rcRadarCategory )
local tRadarValues;
local StepsOrTrail;
local fDesiredValue = 0;
if GAMESTATE:GetCurrentSteps( pnPlayer ) then
StepsOrTrail = GAMESTATE:GetCurrentSteps( pnPlayer );
fDesiredValue = StepsOrTrail:GetRadarValues( pnPlayer ):GetValue( rcRadarCategory );
elseif GAMESTATE:GetCurrentTrail( pnPlayer ) then
StepsOrTrail = GAMESTATE:GetCurrentTrail( pnPlayer );
fDesiredValue = StepsOrTrail:GetRadarValues( pnPlayer ):GetValue( rcRadarCategory );
else
StepsOrTrail = nil;
end;
return fDesiredValue;
end;
local function CreatePaneDisplayItem( _pnPlayer, _sLabel, _rcRadarCategory )
return Def.ActorFrame {
LoadFont("Common Normal") .. {
Text=_sLabel;
InitCommand=cmd(horizalign,left);
OnCommand=cmd(zoom,0.5;diffuse,color("0.9,0.9,0.9");shadowlength,1);
};
LoadFont("Common Normal") .. {
Text="000";
InitCommand=cmd(x,32+8+4;horizalign,left);
OnCommand=cmd(zoom,0.5;shadowlength,1);
CurrentSongChangedMessageCommand=cmd(playcommand,"Set");
CurrentStepsP1ChangedMessageCommand=cmd(playcommand,"Set");
CurrentStepsP2ChangedMessageCommand=cmd(playcommand,"Set");
CurrentTrailP1ChangedMessageCommand=cmd(playcommand,"Set");
CurrentTrailP2ChangedMessageCommand=cmd(playcommand,"Set");
CurrentCourseChangedMessageCommand=cmd(playcommand,"Set");
SetCommand=function(self)
local song = GAMESTATE:GetCurrentSong()
local course = GAMESTATE:GetCurrentCourse()
if not song and not course then
self:settext("000")
else
self:settextf("%03i", GetRadarData( _pnPlayer, _rcRadarCategory ) );
end
end;
};
};
end;
local function CreatePaneDisplayGraph( _pnPlayer, _sLabel, _rcRadarCategory )
return Def.ActorFrame {
LoadFont("Common Normal") .. {
Text=_sLabel;
InitCommand=cmd(horizalign,left);
OnCommand=cmd(zoom,0.5;shadowlength,1);
};
Def.Quad {
InitCommand=cmd(x,12;zoomto,50,10;horizalign,left);
OnCommand=cmd(diffuse,Color("Black");shadowlength,1;diffusealpha,0.5);
};
Def.Quad {
InitCommand=cmd(x,12;zoomto,50,10;horizalign,left);
OnCommand=cmd(shadowlength,0;diffuse,Color("Green");diffusebottomedge,ColorLightTone(Color("Green")));
CurrentSongChangedMessageCommand=cmd(playcommand,"Set");
CurrentStepsP1ChangedMessageCommand=cmd(playcommand,"Set");
CurrentStepsP2ChangedMessageCommand=cmd(playcommand,"Set");
CurrentTrailP1ChangedMessageCommand=cmd(playcommand,"Set");
CurrentTrailP2ChangedMessageCommand=cmd(playcommand,"Set");
CurrentCourseChangedMessageCommand=cmd(playcommand,"Set");
SetCommand=function(self)
local song = GAMESTATE:GetCurrentSong()
local course = GAMESTATE:GetCurrentCourse()
if not song and not course then
self:stoptweening();
self:decelerate(0.2);
self:zoomtowidth(0);
else
self:stoptweening();
self:decelerate(0.2);
self:zoomtowidth( clamp(GetRadarData( _pnPlayer, _rcRadarCategory ) * 50,0,50) );
end
end;
};
LoadFont("Common Normal") .. {
InitCommand=cmd(x,40;zoom,0.5;);
OnCommand=cmd(shadowlength,1;);
CurrentSongChangedMessageCommand=cmd(playcommand,"Set");
CurrentStepsP1ChangedMessageCommand=cmd(playcommand,"Set");
CurrentStepsP2ChangedMessageCommand=cmd(playcommand,"Set");
CurrentTrailP1ChangedMessageCommand=cmd(playcommand,"Set");
CurrentTrailP2ChangedMessageCommand=cmd(playcommand,"Set");
CurrentCourseChangedMessageCommand=cmd(playcommand,"Set");
SetCommand=function(self)
local song = GAMESTATE:GetCurrentSong()
local course = GAMESTATE:GetCurrentCourse()
if not song and not course then
self:settext("")
else
self:settextf("%i%%", GetRadarData( _pnPlayer, _rcRadarCategory ) * 100 );
end
end;
};
};
end;
--[[ Numbers ]]
t[#t+1] = Def.ActorFrame {
-- Left
CreatePaneDisplayItem( iPN, "TAPS", 'RadarCategory_TapsAndHolds' ) .. {
InitCommand=cmd(x,-128+16+8;y,-14);
};
CreatePaneDisplayItem( iPN, "JUMPS", 'RadarCategory_Jumps' ) .. {
InitCommand=cmd(x,-128+16+8;y,-14+16);
};
CreatePaneDisplayItem( iPN, "HOLDS", 'RadarCategory_Holds' ) .. {
InitCommand=cmd(x,-128+16+8;y,-14+16*2);
};
CreatePaneDisplayItem( iPN, "MINES", 'RadarCategory_Mines' ) .. {
InitCommand=cmd(x,-128+16+8;y,-14+16*3);
};
-- Center
CreatePaneDisplayItem( iPN, "MINES", 'RadarCategory_Mines' ) .. {
InitCommand=cmd(x,-128+16+8+74;y,-14);
};
CreatePaneDisplayItem( iPN, "HANDS", 'RadarCategory_Hands' ) .. {
InitCommand=cmd(x,-128+16+8+74;y,-14+16);
};
CreatePaneDisplayItem( iPN, "ROLLS", 'RadarCategory_Rolls' ) .. {
InitCommand=cmd(x,-128+16+8+74;y,-14+16*2);
};
CreatePaneDisplayItem( iPN, "LIFTS", 'RadarCategory_Lifts' ) .. {
InitCommand=cmd(x,-128+16+8+74;y,-14+16*3);
};
-- Right
CreatePaneDisplayGraph( iPN, "S", 'RadarCategory_Stream' ) .. {
InitCommand=cmd(x,-128+16+8+74*2;y,-14);
};
CreatePaneDisplayGraph( iPN, "V", 'RadarCategory_Voltage' ) .. {
InitCommand=cmd(x,-128+16+8+74*2;y,-14+12);
};
CreatePaneDisplayGraph( iPN, "A", 'RadarCategory_Air' ) .. {
InitCommand=cmd(x,-128+16+8+74*2;y,-14+12*2);
};
CreatePaneDisplayGraph( iPN, "F", 'RadarCategory_Freeze' ) .. {
InitCommand=cmd(x,-128+16+8+74*2;y,-14+12*3);
};
CreatePaneDisplayGraph( iPN, "C", 'RadarCategory_Chaos' ) .. {
InitCommand=cmd(x,-128+16+8+74*2;y,-14+12*4);
};
};
return t;
@@ -0,0 +1,2 @@
return LoadFont("Common Normal") .. {
};
@@ -16,7 +16,7 @@ return Def.ActorFrame {
OnCommand=cmd(diffuse,Color("Black");diffusealpha,0;linear,0.35;diffusealpha,0.5);
};
Def.Quad {
InitCommand=cmd(y,24*(GetUserPrefB("UserPrefAutoSetStyle") and 8 or 5)-10;zoomto,164,2;fadeleft,8/164;faderight,8/164);
InitCommand=cmd(y,24*(5)-10;zoomto,164,2;fadeleft,8/164;faderight,8/164);
OnCommand=cmd(diffuse,Color("Black");diffusealpha,0;linear,0.35;diffusealpha,0.5);
};
Def.StepsDisplayList {
Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

@@ -0,0 +1 @@
return LoadActor(THEME:GetPathG("PaneDisplay","Text"),PLAYER_1);
@@ -0,0 +1 @@
return LoadActor(THEME:GetPathG("PaneDisplay","Text"),PLAYER_2);
+12 -8
View File
@@ -59,25 +59,29 @@ HelpText=&BACK; Exit &START; Move On &MENULEFT;+&MENURIGHT; or &SELECT; Snapshot
LifeDifficulty=Life Difficulty: %s
TimingDifficulty=Timing Difficulty: %s
[OptionTitles]
UserPrefNotePosition=Note Positions
GamePrefAutoSetStyle=Auto Set Style
GamePrefNotePosition=Note Positions
GamePrefComboOnRolls=Rolls Increment Combo
GamePrefComboUnderField=Combo Under Field
GamePrefAdjustSpeed=Adjust Speed
UserPrefGameplayShowScore=Show Score
UserPrefGameplayShowStepsDisplay=Show Steps
UserPrefShowLotsaOptions=Options Density
UserPrefAutoSetStyle=Auto Set Style
UserPrefLongFail=Fail Length
UserPrefComboOnRolls=Rolls Increment Combo
UserPrefFlashyCombo=Flashy Combo
UserPrefComboUnderField=Combo Under Field
[OptionExplanations]
UserPrefNotePosition=Determines where the arrow receptors are placed in gameplay.
GamePrefAutoSetStyle=Allow the game to list all one player and two player modes at once instead of one style only. This might require a restart of StepMania\n( or alternatively hit F2! )
GamePrefNotePosition=Determines where the arrow receptors are placed in gameplay.
GamePrefComboOnRolls=Choose if rolls should increment the combo or not.
GamePrefComboUnderField=Determine if the combo should display under the notes or not.
GamePrefAdjustSpeed=Adjust the default scale for speed modifiers. Normal corresponds to the original StepMania 3.9 speed, Fast is twice that rate.
UserPrefGameplayShowScore=Show or Hide the score display in gameplay.
UserPrefGameplayShowStepsDisplay=Show or Hide the step information display in gameplay.
UserPrefShowLotsaOptions=Choose how many lines/rows of options to choose from. &oq;Few&cq; keeps the list to a minimum. &oq;Many&cq; adds various show-off mods.
UserPrefAutoSetStyle=Allow the game to list all one player and two player modes at once instead of one style only. This might require a restart of StepMania\n( or alternatively hit F2! )
UserPrefLongFail=Choose between the original sm-ssc fail (Long) or the new sm-ssc fail (Short).
UserPrefComboOnRolls=Choose if rolls should increment the combo or not.
UserPrefFlashyCombo=Determine if combo flashes should be shown or not.
UserPrefComboUnderField=Determine if the combo should display under the notes or not.
[StepsListDisplayRow StepsType]
Dance_Single=4
Dance_Double=8
+63 -1
View File
@@ -1,5 +1,19 @@
-- sm-ssc Default Theme Preferences Handler
-- Example usage of new system (not really implemented yet)
local Prefs =
{
AutoSetStyle =
{
Default = false,
Choices = { "ON", "OFF" },
Values = { true, false }
},
};
ThemePrefs.InitAll( Prefs )
function InitUserPrefs()
if GetUserPref("UserPrefGameplayShowStepsDisplay") == nil then
SetUserPref("UserPrefGameplayShowStepsDisplay", true);
@@ -34,6 +48,9 @@ function InitUserPrefs()
if GetUserPrefB("UserPrefComboUnderField") == nil then
SetUserPref("UserPrefComboUnderField", true);
end;
if GetUserPrefB("UserPrefAdjustSpeed") == nil then
SetUserPref("UserPrefAdjustSpeed", false);
end;
--[[ if GetUserPref("ProTimingP1") == nil then
SetUserPref("ProTimingP1", false);
end;
@@ -452,4 +469,49 @@ function UserPrefComboUnderField()
setmetatable( t, t );
return t;
end
--[[ end option rows ]]
function GetDefaultArrowSpacing()
local rates = {
64, -- Default
80, -- Pro
128, -- New
};
return GetUserPrefB("UserPrefAdjustSpeed") and rates[3] or rates[1];
end;
function UserPrefAdjustSpeed()
local t = {
Name = "UserPrefAdjustSpeed";
LayoutType = "ShowAllInRow";
SelectType = "SelectOne";
OneChoiceForAllPlayers = true;
ExportOnChange = false;
Choices = { 'Slow','Fast' };
LoadSelections = function(self, list, pn)
if ReadPrefFromFile("UserPrefAdjustSpeed") ~= nil then
if GetUserPrefB("UserPrefAdjustSpeed") then
list[2] = true;
else
list[1] = true;
end;
else
WritePrefToFile("UserPrefAdjustSpeed",true);
list[2] = true;
end;
end;
SaveSelections = function(self, list, pn)
local val;
if list[2] then
val = true;
else
val = false;
end;
WritePrefToFile("UserPrefAdjustSpeed",val);
MESSAGEMAN:Broadcast("PreferenceSet", { Message == "Set Preference" } );
THEME:ReloadMetrics();
end;
};
setmetatable( t, t );
return t;
end
--[[ end option rows ]]
+93 -49
View File
@@ -5,17 +5,17 @@ FallbackTheme=_fallback
FirstAttractScreen=""
InitialScreen="ScreenInit"
AutoSetStyle=GetUserPrefB("UserPrefAutoSetStyle")
# AutoSetStyle=GetUserPrefB("UserPrefAutoSetStyle")
[BitmapText]
NumRainbowColors=1
RainbowColor1=Color("Black");
[BPMDisplay]
SetNoBpmCommand=stoptweening;linear,0.2;diffuse,Color("White");diffusebottomedge,BoostColor(Color("White"),0.875);
SetNormalCommand=stoptweening;linear,0.2;diffuse,Color("White");diffusebottomedge,BoostColor(Color("White"),0.875);
SetChangeCommand=stoptweening;linear,0.2;diffuse,Color("Orange");diffusetopedge,BoostColor(Color("Orange"),1.5);
SetRandomCommand=stoptweening;linear,0.2;diffuse,Color("Blue");diffusetopedge,BoostColor(Color("Blue"),1.5);
SetExtraCommand=stoptweening;linear,0.2;diffuse,Color("Red");diffusebottomedge,BoostColor(Color("Red"),0.5);
SetNoBpmCommand=stoptweening;maxwidth,128;linear,0.2;diffuse,Color("White");diffusebottomedge,BoostColor(Color("White"),0.875);
SetNormalCommand=stoptweening;maxwidth,128;linear,0.2;diffuse,Color("White");diffusebottomedge,BoostColor(Color("White"),0.875);
SetChangeCommand=stoptweening;maxwidth,128;linear,0.2;diffuse,Color("Orange");diffusetopedge,BoostColor(Color("Orange"),1.5);
SetRandomCommand=stoptweening;maxwidth,128;linear,0.2;diffuse,Color("Blue");diffusetopedge,BoostColor(Color("Blue"),1.5);
SetExtraCommand=stoptweening;maxwidth,128;linear,0.2;diffuse,Color("Red");diffusebottomedge,BoostColor(Color("Red"),0.5);
Cycle=true
NoBpmText="000"
RandomCycleSpeed=0.2 -- smaller numbers mean the bpm cycles faster
@@ -83,16 +83,17 @@ HoldJudgmentHeldCommand=finishtweening;shadowlength,0;diffusealpha,1;zoom,1.25;l
[Judgment]
# New #
JudgmentOnCommand=
# !!! #
JudgmentW1Command=finishtweening;shadowlength,0;y,0;diffusealpha,1;zoom,1.3;linear,0.05;zoom,1;sleep,0.8;linear,0.1;zoomy,0.5;zoomx,2;diffusealpha,0;glowblink;effectperiod,0.05;effectcolor1,1,1,1,0;effectcolor2,1,1,1,0.8
JudgmentW2Command=finishtweening;y,0;shadowlength,0;diffusealpha,1;zoom,1.3;linear,0.05;zoom,1;sleep,0.5;linear,0.1;zoomy,0.5;zoomx,2;diffusealpha,0
JudgmentW3Command=finishtweening;y,0;shadowlength,0;diffusealpha,1;zoom,1.2;linear,0.05;zoom,1;sleep,0.5;linear,0.1;zoomy,0.5;zoomx,2;diffusealpha,0;
JudgmentW4Command=finishtweening;y,0;shadowlength,0;diffusealpha,1;zoom,1.1;linear,0.05;zoom,1;sleep,0.5;linear,0.1;zoomy,0.5;zoomx,2;diffusealpha,0;
JudgmentW5Command=finishtweening;y,0;shadowlength,0;diffusealpha,1;zoom,1.0;vibrate;effectmagnitude,1,2,2;sleep,0.5;linear,0.1;zoomy,0.5;zoomx,2;diffusealpha,0
JudgmentMissCommand=finishtweening;y,0;shadowlength,0;diffusealpha,1;zoom,1;y,-20;linear,0.8;y,20;sleep,0.5;linear,0.1;zoomy,0.5;zoomx,2;diffusealpha,0
# Late/Early
OffsetOnCommand=
OffsetLateCommand=
OffsetEarlyCommand=
[LifeMeterBar]
OverOnCommand=diffuse,Color("Orange");diffuserightedge,BoostColor(Color("Orange"),1.5)
@@ -316,9 +317,12 @@ ProtimingMissCommand=finishtweening;diffusealpha,1;zoom,1.15;glow,GameColor.Judg
#
AveragePulseCommand=finishtweening;diffusealpha,1;zoom,0.75*1.25;decelerate,0.05;zoom,0.75;sleep,2;linear,0.5;diffusealpha,0;
[Player]
ReceptorArrowsYStandard=GetTapPosition('Standard')
ReceptorArrowsYReverse=GetTapPosition('Reverse')
RollBodyIncrementsCombo=GetUserPrefB("UserPrefComboOnRolls")
# ReceptorArrowsYStandard=GetTapPosition('Standard')
# ReceptorArrowsYReverse=GetTapPosition('Reverse')
# RollBodyIncrementsCombo=GetUserPrefB("UserPrefComboOnRolls")
[ArrowEffects]
ArrowSpacing=GetDefaultArrowSpacing()
[ScoreDisplayNormal]
FrameX=
@@ -506,12 +510,12 @@ MeterSetCommand=%function(self,param) \
self:stopeffect(); \
end; \
end; \
(cmd(finishtweening;zoomx,1.5;diffusealpha,0;smooth,0.125;zoom,1;diffusealpha,1))(self); \
end;
#
ShowDescription=true
DescriptionX=-20-32
DescriptionY=GetUserPrefB("UserPrefAutoSetStyle") and -5 or 0
DescriptionY=GetGamePrefB("AutoSetStyle") and -5 or 0
# DescriptionY=GetUserPrefB("UserPrefAutoSetStyle") and -5 or 0
DescriptionOnCommand=shadowlength,1;uppercase,true;zoom,0.75;maxwidth,128+8
DescriptionSetCommand=%function(self,param) \
if self:GetText() == "" then \
@@ -521,7 +525,6 @@ DescriptionSetCommand=%function(self,param) \
self:diffuse(CustomDifficultyToColor(param.CustomDifficulty)); \
self:shadowcolor(CustomDifficultyToDarkColor(param.CustomDifficulty)); \
end; \
(cmd(finishtweening;diffusealpha,0;addx,-4;smooth,0.125;addx,4;diffusealpha,1))(self); \
end;
#
ShowAutogen=false
@@ -530,7 +533,8 @@ AutogenY=0
AutogenOnCommand=
AutogenSetCommand=%function(self,param) if param.Difficulty then self:diffuse(CustomDifficultyToLightColor(param.Difficulty)); self:strokecolor(CustomDifficultyToDarkColor(param.Difficulty)); end end
#
ShowStepsType=GetUserPrefB("UserPrefAutoSetStyle")
ShowStepsType=GetGamePrefB("AutoSetStyle")
# ShowStepsType=GetUserPrefB("UserPrefAutoSetStyle")
StepsTypeX=-20-32
StepsTypeY=7
StepsTypeOnCommand=zoom,0.45
@@ -580,7 +584,8 @@ end;
#
ShowDescription=true
DescriptionX=-20
DescriptionY=GetUserPrefB("UserPrefAutoSetStyle") and -5 or 0
DescriptionY=GetGamePrefB("AutoSetStyle") and -5 or 0
# DescriptionY=GetUserPrefB("UserPrefAutoSetStyle") and -5 or 0
DescriptionOnCommand=shadowlength,1;uppercase,true;zoom,0.75;maxwidth,128+8
DescriptionSetCommand=%function(self,param) \
if self:GetText() == "" then \
@@ -599,7 +604,8 @@ AutogenY=0
AutogenOnCommand=
AutogenSetCommand=%function(self,param) if param.Difficulty then self:diffuse(CustomDifficultyToLightColor(param.Difficulty)); self:strokecolor(CustomDifficultyToDarkColor(param.Difficulty)); end end
#
ShowStepsType=GetUserPrefB("UserPrefAutoSetStyle")
ShowStepsType=GetGamePrefB("AutoSetStyle")
# ShowStepsType=GetUserPrefB("UserPrefAutoSetStyle")
StepsTypeX=-20
StepsTypeY=7
StepsTypeOnCommand=zoom,0.45
@@ -610,7 +616,7 @@ Fallback="StepsDisplay"
[StepsDisplayListRow]
#
CapitalizeDifficultyNames=false
NumShownItems=GetUserPrefB("UserPrefAutoSetStyle") and 8 or 5
NumShownItems=5
ItemsSpacingY=24
MoveCommand=decelerate,0.3
#
@@ -652,7 +658,8 @@ MeterSetCommand=%function(self,param) \
end;
#
ShowDescription=true
DescriptionX=GetUserPrefB("UserPrefAutoSetStyle") and (-64-8+20) or (-64-8)
DescriptionX=GetGamePrefB("AutoSetStyle") and (-64-8+20) or (-64-8)
# DescriptionX=GetUserPrefB("UserPrefAutoSetStyle") and (-64-8+20) or (-64-8)
DescriptionY=0
DescriptionOnCommand=shadowlength,1;horizalign,left;zoom,0.65;maxwidth,128+8-20;uppercase,true;
DescriptionOffCommand=
@@ -673,7 +680,8 @@ AutogenY=0
AutogenOnCommand=blend,Blend.Add;diffuseshift;effectcolor1,color("#FFCC00FF");effectcolor2,color("#FFCC0088");
AutogenSetCommand=
#
ShowStepsType=GetUserPrefB("UserPrefAutoSetStyle")
ShowStepsType=GetGamePrefB("AutoSetStyle")
# ShowStepsType=GetUserPrefB("UserPrefAutoSetStyle")
StepsTypeX=-64-8
StepsTypeY=0
StepsTypeOnCommand=
@@ -819,25 +827,25 @@ ItemsLongRowSharedX=SCREEN_CENTER_X
[ScreenOptionsTheme]
Fallback="ScreenOptionsServiceChild"
LineNames="gNotePos,gAuto,gScore,gSDisp,gOpts,gLongFail,gComboUnderField,FlashyCombo"
LineNames="gNotePos,gAuto,gScore,gSDisp,gOpts,gLongFail,gComboUnderField,FlashyCombo,AdjustSpeed"
#,gAuto
LinegNotePos="lua,UserPrefNotePosition()"
LinegNotePos="lua,GamePrefNotePosition()"
LinegScore="lua,UserPrefGameplayShowScore()"
LinegSDisp="lua,UserPrefGameplayShowStepsDisplay()"
LinegOpts="lua,UserPrefShowLotsaOptions()"
LinegAuto="lua,UserPrefAutoSetStyle()"
LinegAuto="lua,GamePrefAutoSetStyle()"
LinegLongFail="lua,UserPrefLongFail()"
LinegComboUnderField="lua,UserPrefComboUnderField()"
LinegComboUnderField="lua,GamePrefComboUnderField()"
LineFlashyCombo="lua,UserPrefFlashyCombo()"
LineAdjustSpeed="lua,GamePrefAdjustSpeed()"
[ScreenOptionsSystemDirection]
LineNames="1,2,3,4,5,6,7,8,9,FlashyCombo,RollCombo,10,11,12,13,14,15,16,LF,17,18,19,20,21,22"
LineLF="lua,UserPrefLongFail()"
LineRollCombo="lua,UserPrefComboOnRolls()"
LineRollCombo="lua,GamePrefComboOnRolls()"
LineFlashyCombo="lua,UserPrefFlashyCombo()"
[ScreenOptionsAdvanced]
LineNames="2,3,4,8,11,13,14,15,16,28,29,30,RollCombo"
LineRollCombo="lua,UserPrefComboOnRolls()"
LineRollCombo="lua,GamePrefComboOnRolls()"
[ScreenOptionsService]
ShowHeader=false
@@ -1157,7 +1165,8 @@ StageDisplayY=SCREEN_TOP+160-96+4
StageDisplayOnCommand=draworder,105;fov,90;zoom,0.75;zoomy,0;sleep,0.35;smooth,0.35;zoomy,0.75
StageDisplayOffCommand=linear,0.25;zoomy,0;
#
ShowDifficultyDisplay=not GetUserPrefB("UserPrefAutoSetStyle") and not GAMESTATE:IsCourseMode()
ShowDifficultyDisplay=not GetGamePrefB("AutoSetStyle") and not GAMESTATE:IsCourseMode()
# ShowDifficultyDisplay=not GetUserPrefB("UserPrefAutoSetStyle") and not GAMESTATE:IsCourseMode()
DifficultyDisplayX=SCREEN_CENTER_X-160+64
DifficultyDisplayY=SCREEN_TOP+160-96+4
DifficultyDisplayOnCommand=draworder,105;fov,90;zoom,1;zoomy,0;sleep,0.35;smooth,0.35;zoomy,1
@@ -1177,7 +1186,7 @@ BannerFrameOffCommand=bouncebegin,0.15;zoomx,0;
ShowBPMDisplay=true
BPMDisplayX=SCREEN_CENTER_X-160-90+2
BPMDisplayY=SCREEN_TOP+160+(36/2)+8
BPMDisplayOnCommand=finishtweening;horizalign,left;strokecolor,Color("Outline");maxwidth,128;addx,320;zoomx,0;decelerate,0.35;addx,-320;zoomx,1
BPMDisplayOnCommand=finishtweening;maxwidth,128;horizalign,left;strokecolor,Color("Outline");addx,320;zoomx,0;decelerate,0.35;addx,-320;zoomx,1
BPMDisplayOffCommand=bouncebegin,0.15;zoomx,0;
#
ShowBPMLabel=true
@@ -1198,6 +1207,30 @@ DifficultyListTweenOffCommand=stoptweening;bouncebegin,0.135;zoomx,0
# DifficultyListSelectMenuOpenedMessageCommand=stoptweening;decelerate,0.125;zoom,0.5;
# DifficultyListSelectMenuClosedMessageCommand=stoptweening;accelerate,0.0725;zoom,1;
#
ShowPaneDisplayFrameP1=true
PaneDisplayFrameP1X=SCREEN_CENTER_X-160
PaneDisplayFrameP1Y=SCREEN_BOTTOM-112-2
PaneDisplayFrameP1OnCommand=player,PLAYER_1;diffuse,Color("Orange");zoomy,0;sleep,0.5;decelerate,0.25;zoomy,1
PaneDisplayFrameP1OffCommand=bouncebegin,0.15;zoomx,0;
#
ShowPaneDisplayTextP1=true
PaneDisplayTextP1X=SCREEN_CENTER_X-160
PaneDisplayTextP1Y=SCREEN_BOTTOM-122-2
PaneDisplayTextP1OnCommand=player,PLAYER_1;zoomy,0;sleep,0.5;decelerate,0.25;zoomy,1
PaneDisplayTextP1OffCommand=bouncebegin,0.15;zoomx,0;
#
ShowPaneDisplayFrameP2=true
PaneDisplayFrameP2X=SCREEN_CENTER_X+160
PaneDisplayFrameP2Y=SCREEN_BOTTOM-112-2
PaneDisplayFrameP2OnCommand=player,PLAYER_2;diffuse,Color("Orange");zoomy,0;sleep,0.5;decelerate,0.25;zoomy,1
PaneDisplayFrameP2OffCommand=bouncebegin,0.15;zoomx,0;
#
ShowPaneDisplayTextP2=true
PaneDisplayTextP2X=SCREEN_CENTER_X+160
PaneDisplayTextP2Y=SCREEN_BOTTOM-122-2
PaneDisplayTextP2OnCommand=player,PLAYER_2;zoomy,0;sleep,0.5;decelerate,0.25;zoomy,1
PaneDisplayTextP2OffCommand=bouncebegin,0.15;zoomx,0;
#
ShowCourseContentsList=false
CourseContentsListX=SCREEN_CENTER_X-160
CourseContentsListY=SCREEN_TOP+216+6
@@ -1234,7 +1267,7 @@ CDTitleX=SCREEN_CENTER_X-160+90
CDTitleY=SCREEN_TOP+160+(36/2)+8
CDTitleFrontCommand=diffuse,color('0.5,0.5,0.5,1');cullmode,'CullMode_Front'
CDTitleBackCommand=cullmode,'CullMode_Back'
CDTitleOnCommand=draworder,106;zoom,0.75;diffusealpha,1;zoom,0;bounceend,0.35;zoom,0.75;spin;effectmagnitude,0,180,0;
CDTitleOnCommand=draworder,106;shadowlength,1;zoom,0.75;diffusealpha,1;zoom,0;bounceend,0.35;zoom,0.75;spin;effectmagnitude,0,180,0;
CDTitleOffCommand=bouncebegin,0.15;zoomx,0;
#
ScoreFrameP1X=
@@ -1274,16 +1307,16 @@ StepsDisplayP2OnCommand=visible,THEME:GetMetric(Var "LoadingScreen","ShowStepsDi
StepsDisplayP2OffCommand=bouncebegin,0.15;zoomx,0;
# StepsDisplayP2CurrentStepsP2ChangedMessageCommand=stoptweening;zoom,1.2;decelerate,0.1;zoom,1
#
ShowPercentScoreP1=GAMESTATE:IsHumanPlayer(PLAYER_1)
ShowPercentScoreP1=true
PercentScoreP1X=SCREEN_CENTER_X-80-1
PercentScoreP1Y=SCREEN_BOTTOM-60
PercentScoreP1OnCommand=visible,THEME:GetMetric(Var "LoadingScreen","ShowPercentScoreP1");addy,SCREEN_CENTER_Y;decelerate,0.35;addy,-SCREEN_CENTER_Y
PercentScoreP1OnCommand=player,PLAYER_1;addy,SCREEN_CENTER_Y;decelerate,0.35;addy,-SCREEN_CENTER_Y
PercentScoreP1OffCommand=bouncebegin,0.15;zoomx,0;
#
ShowPercentScoreP2=GAMESTATE:IsHumanPlayer(PLAYER_2)
ShowPercentScoreP2=true
PercentScoreP2X=SCREEN_CENTER_X+240-1
PercentScoreP2Y=SCREEN_BOTTOM-60
PercentScoreP2OnCommand=visible,THEME:GetMetric(Var "LoadingScreen","ShowPercentScoreP2");addy,SCREEN_CENTER_Y;decelerate,0.35;addy,-SCREEN_CENTER_Y
PercentScoreP2OnCommand=player,PLAYER_2;addy,SCREEN_CENTER_Y;decelerate,0.35;addy,-SCREEN_CENTER_Y
PercentScoreP2OffCommand=bouncebegin,0.15;zoomx,0;
[ScreenSelectCourse]
#~ ScreenInitCommand=%function(self) \
@@ -1299,6 +1332,11 @@ ShowNumCourseSongs=true
#
UsePlayerSelectMenu=false
SelectMenuAvailable=false
#
ShowPaneDisplayFrameP1=false
ShowPaneDisplayTextP1=false
ShowPaneDisplayFrameP2=false
ShowPaneDisplayTextP2=false
[ScreenNetSelectMusic]
StepsDisplayP1X=SCREEN_CENTER_X-240
StepsDisplayP1Y=SCREEN_CENTER_Y+185
@@ -1695,11 +1733,11 @@ ScoreLabelOffCommand=
#
ScoreNumberP1X=SCREEN_CENTER_X-160
ScoreNumberP1Y=SCREEN_TOP+320
ScoreNumberP1OnCommand=visible,not PREFSMAN:GetPreference("PercentageScoring");diffuse,PlayerColor(PLAYER_1);diffusetopedge,BoostColor(PlayerColor(PLAYER_1),1.5);strokecolor,ColorDarkTone( PlayerColor(PLAYER_1) );shadowlength,1;zoom,0.775
ScoreNumberP1OnCommand=diffuse,PlayerColor(PLAYER_1);diffusetopedge,BoostColor(PlayerColor(PLAYER_1),1.5);strokecolor,ColorDarkTone( PlayerColor(PLAYER_1) );shadowlength,1;zoom,0.775
ScoreNumberP1OffCommand=
ScoreNumberP2X=SCREEN_CENTER_X+160
ScoreNumberP2Y=SCREEN_TOP+320
ScoreNumberP2OnCommand=visible,not PREFSMAN:GetPreference("PercentageScoring");diffuse,PlayerColor(PLAYER_2);diffusetopedge,BoostColor(PlayerColor(PLAYER_2),1.5);strokecolor,ColorDarkTone( PlayerColor(PLAYER_2) );shadowlength,1;zoom,0.775
ScoreNumberP2OnCommand=diffuse,PlayerColor(PLAYER_2);diffusetopedge,BoostColor(PlayerColor(PLAYER_2),1.5);strokecolor,ColorDarkTone( PlayerColor(PLAYER_2) );shadowlength,1;zoom,0.775
ScoreNumberP2OffCommand=
#
PercentFrameP1X=SCREEN_CENTER_X-160
@@ -1714,12 +1752,12 @@ PercentFrameP2OffCommand=
#
PercentP1X=SCREEN_CENTER_X-160
PercentP1Y=SCREEN_TOP+320
PercentP1OnCommand=visible,PREFSMAN:GetPreference("PercentageScoring");
PercentP1OnCommand=visible,false
PercentP1OffCommand=
#
PercentP2X=SCREEN_CENTER_X-160
PercentP2Y=SCREEN_TOP+320
PercentP2OnCommand=visible,PREFSMAN:GetPreference("PercentageScoring");
PercentP2OnCommand=visible,false
PercentP2OffCommand=
#
LargeBannerX=SCREEN_CENTER_X
@@ -1751,12 +1789,12 @@ GradeP2OffCommand=
#
PlayerOptionsP1X=SCREEN_CENTER_X-160
PlayerOptionsP1Y=SCREEN_TOP+352
PlayerOptionsP1OnCommand=zoom,0.5
PlayerOptionsP1OnCommand=zoom,0.5;shadowlength,1
PlayerOptionsP1OffCommand=
##
PlayerOptionsP2X=SCREEN_CENTER_X+160
PlayerOptionsP2Y=SCREEN_TOP+352
PlayerOptionsP2OnCommand=zoom,0.5
PlayerOptionsP2OnCommand=zoom,0.5;shadowlength,1
PlayerOptionsP2OffCommand=
#
SongOptionsX=SCREEN_CENTER_X
@@ -1858,20 +1896,26 @@ PercentScoreP2OffCommand=bouncebegin,0.15;zoomx,0;
ShowGameType=true
GameTypeX=SCREEN_CENTER_X
GameTypeY=SCREEN_BOTTOM-48
GameTypeOnCommand=addy,SCREEN_CENTER_Y;decelerate,0.35;addy,-SCREEN_CENTER_Y;zoom,0.5;shadowlength,1;shadowcolor,color("#22222266")
GameTypeOnCommand=addy,SCREEN_CENTER_Y;decelerate,0.35;addy,-SCREEN_CENTER_Y;zoom,0.675;shadowlength,1;shadowcolor,color("#22222266")
GameTypeOffCommand=bouncebegin,0.15;addy,SCREEN_CENTER_Y;
#
ShowTimingDifficulty=true
TimingDifficultyX=SCREEN_CENTER_X
TimingDifficultyY=SCREEN_TOP+16
TimingDifficultyOnCommand=zoom,0.675;draworder,105
TimingDifficultyOffCommand=
#
ShowLifeDifficulty=true
LifeDifficultyX=SCREEN_CENTER_X
LifeDifficultyY=SCREEN_TOP+32
LifeDifficultyOnCommand=zoom,0.5;draworder,105
LifeDifficultyOffCommand=linear,0.5;cropright,1
LifeDifficultyOnCommand=zoom,0.675;draworder,105
LifeDifficultyOffCommand=
#
ShowTimingDifficulty=true
TimingDifficultyX=SCREEN_CENTER_X
TimingDifficultyY=SCREEN_TOP+20
TimingDifficultyOnCommand=zoom,0.5;draworder,105
TimingDifficultyOffCommand=linear,0.5;cropright,1
ShowSongInformation=true
SongInformationX=SCREEN_CENTER_X
SongInformationY=SCREEN_TOP+100
SongInformationOnCommand=playcommand,"Set";draworder,105
SongInformationOffCommand=
[ScreenEvaluationNormal]
Fallback="ScreenEvaluation"
#
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Regular → Executable
+3 -3
View File
@@ -64,7 +64,7 @@ usage () {
}
version () {
echo 'build.sh (StepMania) 2.61'
echo 'build.sh (StepMania) 2.61a'
echo 'Copyright (C) 2006-2009 Steve Checkoway'
echo 'StepMania is Copyright (C) 2001-2009 Chris Danford et al.'
echo 'sm-ssc is Copyright (C) 2009-2010 the spinal shark collective'
@@ -111,7 +111,7 @@ if [ ! -d $ffmpeg ]; then
if which bzip2 &>/dev/null; then
zipcommand=jxf
ffmarc=ffmpeg-$version.tar.bz2
elif which gzip &>/dev/null
elif which gzip &>/dev/null; then
zipcommand=zxf
ffmarc=ffmpeg-$version.tar.gz
else
@@ -132,7 +132,7 @@ if [ ! -d $ffmpeg ]; then
fi
if [ -n "$s_download" ]; then exit 0; fi
args='--disable-shared --enable-static --disable-debug --disable-vhook
args='--disable-shared --enable-static --disable-debug
--enable-memalign-hack --disable-network --enable-small
--disable-encoders --disable-ffmpeg --disable-ffserver
--disable-ffplay --disable-muxers --enable-demuxer=avi
Regular → Executable
View File
+11
View File
@@ -122,6 +122,17 @@ AC_C_BIGENDIAN(
AC_DEFINE(ENDIAN_LITTLE, 1, [Little endian]),
AC_MSG_ERROR([Can't determine endianness]) )
# If we're compiling with the SSE2 build flag, add that flag to CFLAGS and CXXFLAGS.
# (Handwritten SSE/SSE2 code isn't in the binary, but GCC's heuristics optimize enough
# vector arithmetic in Rage that this produces a noticeable speedup on SSE2 processors.)
AC_ARG_WITH(sse2, AC_HELP_STRING([--with-sse2], [Enable SSE2 optimization]), with_sse2=$withval, with_sse2=no)
if test "$with_sse2" = "yes"; then
CFLAGS="$CFLAGS -msse2"
CXXFLAGS="$CXXFLAGS -msse2"
fi
AC_ARG_WITH(prof, AS_HELP_STRING([--with-prof],[Enable profiling]), with_prof=$withval, with_prof=no)
if test "$with_prof" = "yes"; then
test "$DEFAULT_CFLAGS" = "yes" && CFLAGS="$CFLAGS -pg"
+17
View File
@@ -227,6 +227,13 @@ Section "Main Section" SecMain
WriteRegStr HKEY_LOCAL_MACHINE "SOFTWARE\Classes\.smzip" "" "smzipfile"
!endif
!ifdef ASSOCIATE_SMURL
WriteRegStr HKEY_LOCAL_MACHINE "SOFTWARE\Classes\stepmania" "" "StepMania protocol handler"
WriteRegStr HKEY_LOCAL_MACHINE "SOFTWARE\Classes\stepmania" "URL Protocol" ""
WriteRegStr HKEY_LOCAL_MACHINE "SOFTWARE\Classes\stepmania\DefaultIcon" "" "$INSTDIR\Program\StepMania.exe"
WriteRegStr HKEY_LOCAL_MACHINE "SOFTWARE\Classes\stepmania\shell\open\command" "" '"$INSTDIR\Program\StepMania.exe" "%1"'
!endif
!ifdef INSTALL_NON_PCK_FILES
CreateDirectory "$INSTDIR\Announcers"
SetOutPath "$INSTDIR\Announcers"
@@ -389,6 +396,9 @@ Section "Main Section" SecMain
!ifdef ASSOCIATE_SMZIP
Call RefreshShellIcons
!endif
!ifdef ASSOCIATE_SMURL
Call RefreshShellIcons
!endif
!ifdef INSTALL_PROGRAM_LIBRARIES
; microsoft!
; xxx: how many of these do we really need?
@@ -674,6 +684,10 @@ Section "Uninstall"
DeleteRegKey HKEY_LOCAL_MACHINE "SOFTWARE\Classes\.smzip"
!endif
!ifdef ASSOCIATE_SMURL
DeleteRegKey HKEY_LOCAL_MACHINE "SOFTWARE\Classes\stepmania"
!endif
!ifdef INSTALL_NON_PCK_FILES
Delete "$INSTDIR\Announcers\instructions.txt"
RMDir "$INSTDIR\Announcers"
@@ -765,6 +779,9 @@ Section "Uninstall"
!ifdef ASSOCIATE_SMZIP
Call un.RefreshShellIcons
!endif
!ifdef ASSOCIATE_SMURL
Call un.RefreshShellIcons
!endif
!ifdef INSTALL_PROGRAM_LIBRARIES
Delete "$INSTDIR\Program\mfc71.dll"
Delete "$INSTDIR\Program\msvcr71.dll"
+63 -133
View File
@@ -12,6 +12,11 @@
#include "arch/Dialog/Dialog.h"
#include "RageFileManager.h"
#include "SpecialFiles.h"
#include "FileDownload.h"
#include "arch/LoadingWindow/LoadingWindow.h"
#include "Preference.h"
#include "JsonUtil.h"
#include "ScreenInstallOverlay.h"
// only used for Version()
#if defined(_WINDOWS)
@@ -21,154 +26,52 @@
const RString INSTALLER_LANGUAGES_DIR = "Themes/_Installer/Languages/";
static const RString TEMP_ZIP_MOUNT_POINT = "/@temp-zip/";
vector<CommandLineActions::CommandLineArgs> CommandLineActions::ToProcess;
static bool IsPackageFile( RString sFile )
{
RString sOsDir, sFilename, sExt;
splitpath( sFile, sOsDir, sFilename, sExt );
return sExt.EqualsNoCase(".smzip") || sExt.EqualsNoCase(".zip");
}
static void GetPackageFilesToInstall( vector<RString> &vs )
{
int argc;
char **argv;
GetCommandLineArguments( argc, argv );
for( int i = 1; i<argc; ++i )
vs.push_back( argv[i] );
bool bFoundOne = false;
FOREACH( RString, vs, s )
{
if( IsPackageFile(*s) )
{
bFoundOne = true;
break;
}
}
if( !bFoundOne )
vs.clear();
}
bool CommandLineActions::AnyPackageFilesInCommandLine()
{
vector<RString> vs;
GetPackageFilesToInstall( vs );
return !vs.empty();
}
struct FileCopyResult
{
FileCopyResult( RString _sFile, RString _sComment ) : sFile(_sFile), sComment(_sComment) {}
RString sFile, sComment;
};
void CommandLineActions::Install()
{
vector<FileCopyResult> vSucceeded;
vector<FileCopyResult> vFailed;
vector<RString> vs;
GetPackageFilesToInstall( vs );
FOREACH_CONST( RString, vs, s )
{
if( !IsPackageFile(*s) )
{
vFailed.push_back( FileCopyResult(*s,"wrong file extension") );
continue;
}
RString sOsDir, sFilename, sExt;
splitpath( *s, sOsDir, sFilename, sExt );
FILEMAN->Mount( "dir", sOsDir, TEMP_ZIP_MOUNT_POINT );
// TODO: Validate that this zip contains files for this version of StepMania
bool bFileExists = DoesFileExist( SpecialFiles::USER_PACKAGES_DIR + sFilename + sExt );
if( FileCopy( TEMP_ZIP_MOUNT_POINT + sFilename + sExt, SpecialFiles::USER_PACKAGES_DIR + sFilename + sExt ) )
vSucceeded.push_back( FileCopyResult(*s,bFileExists ? "overwrote existing file" : "") );
else
vFailed.push_back( FileCopyResult(*s,ssprintf("error copying file to '%s'",sOsDir.c_str())) );
FILEMAN->Unmount( "dir", sOsDir, TEMP_ZIP_MOUNT_POINT );
}
if( vSucceeded.empty() && vFailed.empty() )
{
Dialog::OK( "Install: no files specified" );
return;
}
RString sMessage;
for( int i=0; i<2; i++ )
{
const vector<FileCopyResult> &v = (i==0) ? vSucceeded : vFailed;
if( !v.empty() )
{
sMessage += (i==0) ? "Install succeeded for:\n" : "Install failed for:\n";
FOREACH_CONST( FileCopyResult, v, iter )
{
sMessage += " - " + iter->sFile;
if( !iter->sComment.empty() )
sMessage += " : " + iter->sComment;
sMessage += "\n";
}
sMessage += "\n";
}
}
Dialog::OK( sMessage );
}
void CommandLineActions::Nsis()
static void Nsis()
{
RageFile out;
if( !out.Open( "nsis_strings_temp.inc", RageFile::WRITE ) )
RageException::Throw( "Error opening file for write." );
if(!out.Open("nsis_strings_temp.inc", RageFile::WRITE))
RageException::Throw("Error opening file for write.");
vector<RString> vs;
GetDirListing( INSTALLER_LANGUAGES_DIR + "*.ini", vs, false, false );
FOREACH_CONST( RString, vs, s )
GetDirListing(INSTALLER_LANGUAGES_DIR + "*.ini", vs, false, false);
FOREACH_CONST(RString, vs, s)
{
RString sThrowAway, sLangCode;
splitpath( *s, sThrowAway, sLangCode, sThrowAway );
const LanguageInfo *pLI = GetLanguageInfo( sLangCode );
splitpath(*s, sThrowAway, sLangCode, sThrowAway);
const LanguageInfo *pLI = GetLanguageInfo(sLangCode);
RString sLangNameUpper = pLI->szEnglishName;
sLangNameUpper.MakeUpper();
IniFile ini;
if( !ini.ReadFile( INSTALLER_LANGUAGES_DIR + *s ) )
RageException::Throw( "Error opening file for read." );
FOREACH_CONST_Child( &ini, child )
if(!ini.ReadFile(INSTALLER_LANGUAGES_DIR + *s))
RageException::Throw("Error opening file for read.");
FOREACH_CONST_Child(&ini, child)
{
FOREACH_CONST_Attr( child, attr )
FOREACH_CONST_Attr(child, attr)
{
RString sName = attr->first;
RString sValue = attr->second->GetValue<RString>();
sValue.Replace( "\\n", "$\\n" );
RString sLine = ssprintf( "LangString %s ${LANG_%s} \"%s\"", sName.c_str(), sLangNameUpper.c_str(), sValue.c_str() );
out.PutLine( sLine );
sValue.Replace("\\n", "$\\n");
RString sLine = ssprintf("LangString %s ${LANG_%s} \"%s\"", sName.c_str(), sLangNameUpper.c_str(), sValue.c_str());
out.PutLine(sLine);
}
}
}
}
void CommandLineActions::LuaInformation()
static void LuaInformation()
{
XNode *pNode = LuaHelpers::GetLuaInformation();
pNode->AppendAttr( "xmlns", "http://www.stepmania.com" );
pNode->AppendAttr( "xmlns:xsi", "http://www.w3.org/2001/XMLSchema-instance" );
pNode->AppendAttr( "xsi:schemaLocation", "http://www.stepmania.com Lua.xsd" );
pNode->AppendAttr("xmlns", "http://www.stepmania.com");
pNode->AppendAttr("xmlns:xsi", "http://www.w3.org/2001/XMLSchema-instance");
pNode->AppendAttr("xsi:schemaLocation", "http://www.stepmania.com Lua.xsd");
pNode->AppendChild( "Version", PRODUCT_ID_VER );
pNode->AppendChild( "Date", DateTime::GetNowDate().GetString() );
pNode->AppendChild("Version", PRODUCT_ID_VER);
pNode->AppendChild("Date", DateTime::GetNowDate().GetString());
XmlFileUtil::SaveToFile( pNode, "Lua.xml", "Lua.xsl" );
XmlFileUtil::SaveToFile(pNode, "Lua.xml", "Lua.xsl");
delete pNode;
}
@@ -179,26 +82,53 @@ extern const char *const version_date;
extern const char *const version_time;
#endif
void CommandLineActions::Version()
static void Version()
{
/* HACK: This is only needed on Windows.
Mac and Linux print out version information on the command line regardless
of any preferences (tested by shakesoda on Mac). -aj */
#if defined(WIN32) && !defined(_XBOX)
RString sProductID = ssprintf( "%s", PRODUCT_ID_VER );
#if defined(WIN32)
RString sProductID = ssprintf("%s", PRODUCT_ID_VER);
RString sVersion = "(sm-ssc was built without HAVE_VERSION_INFO)";
#if defined(HAVE_VERSION_INFO)
sVersion = ssprintf( "build %lu\nCompile Date: %s @ %s", version_num, version_date, version_time );
sVersion = ssprintf("build %lu\nCompile Date: %s @ %s", version_num, version_date, version_time);
#endif // HAVE_VERSION_INFO
AllocConsole();
freopen( "CONOUT$","wb", stdout );
freopen( "CONOUT$","wb", stderr );
freopen("CONOUT$","wb", stdout);
freopen("CONOUT$","wb", stderr);
fprintf(stdout, "Version Information:\n%s %s\n", sProductID.c_str(), sVersion.c_str() );
fprintf(stdout, "Press any key to exit." );
fprintf(stdout, "Version Information:\n%s %s\n", sProductID.c_str(), sVersion.c_str());
fprintf(stdout, "Press any key to exit.");
_getch();
#endif // WIN32 && !_XBOX
#endif // WIN32
}
void CommandLineActions::Handle(LoadingWindow* pLW)
{
CommandLineArgs args;
for(int i=0; i<g_argc; ++i)
args.argv.push_back(g_argv[i]);
ToProcess.push_back(args);
bool bExitAfter = false;
if( GetCommandlineArgument("ExportNsisStrings") )
{
Nsis();
bExitAfter = true;
}
if( GetCommandlineArgument("ExportLuaInformation") )
{
LuaInformation();
bExitAfter = true;
}
if( GetCommandlineArgument("version") )
{
Version();
bExitAfter = true;
}
if( bExitAfter )
exit(0);
}
/*
+13 -5
View File
@@ -1,13 +1,21 @@
#ifndef CommandLineActions_H
#define CommandLineActions_H
class LoadingWindow;
namespace CommandLineActions
{
bool AnyPackageFilesInCommandLine();
void Install();
void Nsis();
void LuaInformation();
void Version();
void Handle(LoadingWindow* pLW); // perform a utility action, then exit
class CommandLineArgs
{
public:
vector<RString> argv;
};
// a list of command line arguemnts to process while the game is running.
// These args could have come from this process or passed to this process
// from another process.
extern vector<CommandLineArgs> ToProcess;
}
#endif
+24 -35
View File
@@ -14,7 +14,6 @@
#include "UnlockManager.h"
#include "SongUtil.h"
static const char *EditMenuRowNames[] = {
"Group",
"Song",
@@ -38,10 +37,8 @@ XToLocalizedString( EditMenuAction );
StringToX( EditMenuAction );
static RString ARROWS_X_NAME( size_t i ) { return ssprintf("Arrows%dX",int(i+1)); }
static RString ROW_VALUE_X_NAME( size_t i ) { return ssprintf("RowValue%dX",int(i+1)); }
static RString ROW_Y_NAME( size_t i ) { return ssprintf("Row%dY",int(i+1)); }
void EditMenu::StripLockedStepsAndDifficulty( vector<StepsAndDifficulty> &v )
{
const Song *pSong = GetSelectedSong();
@@ -110,14 +107,6 @@ void EditMenu::Load( const RString &sType )
ARROWS_X.Load(sType,ARROWS_X_NAME,NUM_ARROWS);
ARROWS_ENABLED_COMMAND.Load(sType,"ArrowsEnabledCommand");
ARROWS_DISABLED_COMMAND.Load(sType,"ArrowsDisabledCommand");
SONG_BANNER_WIDTH.Load(sType,"SongBannerWidth");
SONG_BANNER_HEIGHT.Load(sType,"SongBannerHeight");
GROUP_BANNER_WIDTH.Load(sType,"GroupBannerWidth");
GROUP_BANNER_HEIGHT.Load(sType,"GroupBannerHeight");
ROW_LABELS_X.Load(sType,"RowLabelsX");
ROW_LABEL_ON_COMMAND.Load(sType,"RowLabelOnCommand");
ROW_VALUE_X.Load(sType,ROW_VALUE_X_NAME,NUM_EditMenuRow);
ROW_VALUE_ON_COMMAND.Load(sType,"RowValueOnCommand");
ROW_Y.Load(sType,ROW_Y_NAME,NUM_EditMenuRow);
EDIT_MODE.Load(sType,"EditMode");
TEXT_BANNER_TYPE.Load( m_sName, "TextBannerType" );
@@ -133,39 +122,39 @@ void EditMenu::Load( const RString &sType )
ZERO( m_iSelection );
FOREACH_EditMenuRow( r )
{
m_textLabel[r].SetName(ssprintf("Label%i",r+1));
m_textLabel[r].LoadFromFont( THEME->GetPathF(sType,"title") );
m_textLabel[r].SetXY( ROW_LABELS_X, ROW_Y.GetValue(r) );
m_textLabel[r].SetText( EditMenuRowToLocalizedString(r) );
m_textLabel[r].RunCommands( ROW_LABEL_ON_COMMAND );
m_textLabel[r].SetHorizAlign( align_left );
ActorUtil::LoadAllCommandsAndSetXY( m_textLabel[r], sType );
//m_textLabel[r].SetHorizAlign( align_left );
this->AddChild( &m_textLabel[r] );
m_textValue[r].SetName(ssprintf("Value%i",r+1));
m_textValue[r].LoadFromFont( THEME->GetPathF(sType,"value") );
m_textValue[r].SetXY( ROW_VALUE_X.GetValue(r), ROW_Y.GetValue(r) );
m_textValue[r].SetText( "blah" );
m_textValue[r].RunCommands( ROW_VALUE_ON_COMMAND );
ActorUtil::LoadAllCommandsAndSetXY( m_textValue[r], sType );
this->AddChild( &m_textValue[r] );
}
m_textLabel[ROW_GROUP].SetVisible( SHOW_GROUPS.GetValue() );
m_textValue[ROW_GROUP].SetVisible( SHOW_GROUPS.GetValue() );
/* Load low-res banners, if needed. */
// Load low-res banners, if needed.
BANNERCACHE->Demand();
if( SHOW_GROUPS.GetValue() )
{
m_GroupBanner.SetName( "GroupBanner" );
ActorUtil::SetXY( m_GroupBanner, sType );
ActorUtil::LoadAllCommands( m_GroupBanner, sType );
this->AddChild( &m_GroupBanner );
}
m_SongBanner.SetName( "SongBanner" );
ActorUtil::SetXY( m_SongBanner, sType );
ActorUtil::LoadAllCommands( m_SongBanner, sType );
this->AddChild( &m_SongBanner );
m_SongTextBanner.SetName( "SongTextBanner" );
@@ -173,12 +162,12 @@ void EditMenu::Load( const RString &sType )
ActorUtil::SetXY( m_SongTextBanner, sType );
ActorUtil::LoadAllCommands( m_SongTextBanner, sType );
this->AddChild( &m_SongTextBanner );
m_StepsDisplay.SetName( "StepsDisplay" );
m_StepsDisplay.Load( "StepsDisplayEdit", NULL );
ActorUtil::SetXY( m_StepsDisplay, sType );
this->AddChild( &m_StepsDisplay );
m_StepsDisplaySource.SetName( "StepsDisplaySource" );
m_StepsDisplaySource.Load( "StepsDisplayEdit", NULL );
ActorUtil::SetXY( m_StepsDisplaySource, sType );
@@ -187,13 +176,10 @@ void EditMenu::Load( const RString &sType )
m_soundChangeRow.Load( THEME->GetPathS(sType,"row"), true );
m_soundChangeValue.Load( THEME->GetPathS(sType,"value"), true );
//
// fill in data structures
//
GetGroupsToShow( m_sGroups );
m_StepsTypes = CommonMetrics::STEPS_TYPES_TO_SHOW.GetValue();
RefreshAll();
}
@@ -253,7 +239,7 @@ bool EditMenu::CanGoDown()
bool EditMenu::CanGoLeft()
{
if( m_SelectedRow == ROW_SONG || m_SelectedRow == ROW_GROUP )
return true; /* wraps */
return true; // wraps
return m_iSelection[m_SelectedRow] != 0;
}
@@ -261,12 +247,12 @@ int EditMenu::GetRowSize( EditMenuRow er ) const
{
switch( er )
{
case ROW_GROUP: return m_sGroups.size();
case ROW_GROUP: return m_sGroups.size();
case ROW_SONG: return m_pSongs.size();
case ROW_STEPS_TYPE: return m_StepsTypes.size();
case ROW_STEPS: return m_vpSteps.size();
case ROW_STEPS_TYPE: return m_StepsTypes.size();
case ROW_STEPS: return m_vpSteps.size();
case ROW_SOURCE_STEPS_TYPE: return m_StepsTypes.size();
case ROW_SOURCE_STEPS: return m_vpSourceSteps.size();
case ROW_SOURCE_STEPS: return m_vpSourceSteps.size();
case ROW_ACTION: return m_Actions.size();
default: FAIL_M( ssprintf("%i", er) );
}
@@ -276,7 +262,7 @@ int EditMenu::GetRowSize( EditMenuRow er ) const
bool EditMenu::CanGoRight()
{
if( m_SelectedRow == ROW_SONG || m_SelectedRow == ROW_GROUP )
return true; /* wraps */
return true; // wraps
return m_iSelection[m_SelectedRow] != GetRowSize(m_SelectedRow)-1;
}
@@ -344,9 +330,13 @@ void EditMenu::Right()
}
}
void EditMenu::ChangeToRow( EditMenuRow newRow )
{
m_textLabel[newRow].PlayCommand("GainFocus");
m_textValue[newRow].PlayCommand("GainFocus");
m_textLabel[m_SelectedRow].PlayCommand("LoseFocus");
m_textValue[m_SelectedRow].PlayCommand("LoseFocus");
m_SelectedRow = newRow;
for( int i=0; i<2; i++ )
@@ -374,7 +364,7 @@ void EditMenu::OnRowValueChanged( EditMenuRow row )
if( SHOW_GROUPS.GetValue() )
{
m_GroupBanner.LoadFromSongGroup( GetSelectedGroup() );
m_GroupBanner.ScaleToClipped( GROUP_BANNER_WIDTH, GROUP_BANNER_HEIGHT );
m_GroupBanner.PlayCommand("Changed");
}
m_pSongs.clear();
GetSongsToShowForGroup( GetSelectedGroup(), m_pSongs );
@@ -383,7 +373,7 @@ void EditMenu::OnRowValueChanged( EditMenuRow row )
case ROW_SONG:
m_textValue[ROW_SONG].SetText( "" );
m_SongBanner.LoadFromSong( GetSelectedSong() );
m_SongBanner.ScaleToClipped( SONG_BANNER_WIDTH, SONG_BANNER_HEIGHT );
m_SongBanner.PlayCommand("Changed");
m_SongTextBanner.SetFromSong( GetSelectedSong() );
// fall through
@@ -461,7 +451,7 @@ void EditMenu::OnRowValueChanged( EditMenuRow row )
}
}
StripLockedStepsAndDifficulty( m_vpSteps );
FOREACH( StepsAndDifficulty, m_vpSteps, s )
{
if( s->dc == dcOld )
@@ -572,7 +562,6 @@ void EditMenu::OnRowValueChanged( EditMenuRow row )
}
}
/*
* (c) 2001-2004 Chris Danford
* All rights reserved.
-11
View File
@@ -97,7 +97,6 @@ private:
StepsDisplay m_StepsDisplay;
StepsDisplay m_StepsDisplaySource;
struct StepsAndDifficulty
{
StepsAndDifficulty( Steps *s, Difficulty d ) { pSteps = s; dc = d; }
@@ -122,16 +121,6 @@ private:
ThemeMetric1D<float> ARROWS_X;
ThemeMetric<apActorCommands> ARROWS_ENABLED_COMMAND;
ThemeMetric<apActorCommands> ARROWS_DISABLED_COMMAND;
// todo: remove these next 4 metrics in favor of commands -aj
ThemeMetric<float> SONG_BANNER_WIDTH;
ThemeMetric<float> SONG_BANNER_HEIGHT;
ThemeMetric<float> GROUP_BANNER_WIDTH;
ThemeMetric<float> GROUP_BANNER_HEIGHT;
// </todo>
ThemeMetric<float> ROW_LABELS_X;
ThemeMetric<apActorCommands> ROW_LABEL_ON_COMMAND;
ThemeMetric1D<float> ROW_VALUE_X;
ThemeMetric<apActorCommands> ROW_VALUE_ON_COMMAND;
ThemeMetric1D<float> ROW_Y;
public:
ThemeMetric<EditMode> EDIT_MODE;
+111 -58
View File
@@ -6,8 +6,10 @@
#include "RageFileManager.h"
#include "SpecialFiles.h"
#include "RageLog.h"
#include "Preference.h"
#include "Foreach.h"
FileDownload::FileDownload()
FileTransfer::FileTransfer()
{
m_iPackagesPos = 0;
m_iLinksPos = 0;
@@ -21,31 +23,28 @@ FileDownload::FileDownload()
UpdateProgress();
// Workaround: For some reason, the first download sometimes corrupts;
// by opening and closing the RageFile, this problem does not occur.
// by opening and closing the RageFile, this problem does not occur.
// Go figure?
// XXX: This is a really dirty work around! Why does RageFile do this?
// It's always some strange number of bytes at the end of the
// file when it corrupts.
m_fOutputFile.Open( "Packages/dummy.txt", RageFile::WRITE );
// It's always some strange number of bytes at the end of the file when it corrupts.
m_fOutputFile.Open("Packages/dummy.txt", RageFile::WRITE);
m_fOutputFile.Close();
}
FileDownload::~FileDownload()
FileTransfer::~FileTransfer()
{
m_fOutputFile.Close();
}
RString FileDownload::Update( float fDeltaTime )
RString FileTransfer::Update( float fDeltaTime )
{
HTTPUpdate();
m_fLastUpdate += fDeltaTime;
if ( m_fLastUpdate >= 1.0 )
if (m_fLastUpdate >= 1.0)
{
if ( m_bIsDownloading && m_bGotHeader )
m_sStatus = ssprintf( "DL @ %d KB/s", int((m_iDownloaded-m_bytesLastUpdate)/1024) );
if (m_bIsDownloading && m_bGotHeader)
m_sStatus = ssprintf("DL @ %d KB/s", int((m_iDownloaded-m_bytesLastUpdate)/1024));
m_bytesLastUpdate = m_iDownloaded;
UpdateProgress();
@@ -55,7 +54,7 @@ RString FileDownload::Update( float fDeltaTime )
return m_sStatus;
}
void FileDownload::UpdateProgress()
void FileTransfer::UpdateProgress()
{
float DownloadedRatio;
@@ -65,7 +64,7 @@ void FileDownload::UpdateProgress()
DownloadedRatio = float(m_iDownloaded) / float(m_iTotalBytes);
}
void FileDownload::CancelDownload( )
void FileTransfer::Cancel()
{
m_wSocket.close();
m_bIsDownloading = false;
@@ -74,10 +73,22 @@ void FileDownload::CancelDownload( )
m_fOutputFile.Close();
m_sStatus = "Failed.";
m_sBUFFER = "";
FILEMAN->Remove( "Packages/" + m_sEndName );
FILEMAN->Remove("Packages/" + m_sEndName);
}
void FileDownload::StartDownload( const RString &sURL, const RString &sDestFile )
void FileTransfer::StartDownload( const RString &sURL, const RString &sDestFile )
{
StartTransfer( download, sURL, "", sDestFile );
}
void FileTransfer::StartUpload( const RString &sURL, const RString &sSrcFile, const RString &sDestFile )
{
StartTransfer( upload, sURL, sSrcFile, sDestFile );
}
extern Preference<RString> g_sCookie;
void FileTransfer::StartTransfer( TransferType type, const RString &sURL, const RString &sSrcFile, const RString &sDestFile )
{
RString Proto;
RString Server;
@@ -87,16 +98,12 @@ void FileDownload::StartDownload( const RString &sURL, const RString &sDestFile
if( !ParseHTTPAddress( sURL, Proto, Server, Port, sAddress ) )
{
m_sStatus = "Invalid URL.";
m_bFinished = true;
UpdateProgress();
return;
}
//Determine if this is a website, or a package?
//Criteria: does it end with *zip?
if( sAddress.Right(3).CompareNoCase("zip") == 0 )
m_bIsPackage=true;
else
m_bIsPackage = false;
m_bSavingFile = sDestFile != "";
m_sBaseAddress = "http://" + Server;
if( Port != 80 )
@@ -113,24 +120,15 @@ void FileDownload::StartDownload( const RString &sURL, const RString &sDestFile
m_sEndName = "";
}
//Open the file...
// Open the file...
//First find out if a file by this name already exists
//if so, then we gotta ditch out.
//XXX: This should be fixed by a prompt or something?
// First find out if a file by this name already exists if so, then we gotta
// ditch out.
// XXX: This should be fixed by a prompt or something?
//if we are not talking about a file, let's not worry
if( m_sEndName != "" && m_bIsPackage )
// if we are not talking about a file, let's not worry
if( m_sEndName != "" && m_bSavingFile )
{
vector<RString> AddTo;
GetDirListing( "Packages/"+m_sEndName, AddTo, false, false );
if ( AddTo.size() > 0 )
{
m_sStatus = "File Already Exists";
UpdateProgress();
return;
}
if( !m_fOutputFile.Open( sDestFile, RageFile::WRITE | RageFile::STREAMED ) )
{
m_sStatus = m_fOutputFile.GetError();
@@ -138,7 +136,7 @@ void FileDownload::StartDownload( const RString &sURL, const RString &sDestFile
return;
}
}
//Continue...
// Continue...
sAddress = URLEncode( sAddress );
@@ -157,15 +155,64 @@ void FileDownload::StartDownload( const RString &sURL, const RString &sDestFile
return;
}
//Produce HTTP header
// Produce HTTP header
RString sAction;
switch( type )
{
case upload: sAction = "POST"; break;
case download: sAction = "GET"; break;
}
RString Header="";
vector<RString> vsHeaders;
vsHeaders.push_back( sAction+" "+sAddress+" HTTP/1.0" );
vsHeaders.push_back( "Host: " + Server );
vsHeaders.push_back( "Cookie: " + g_sCookie.Get() );
vsHeaders.push_back( "Connection: closed" );
string sBoundary = "--ZzAaB03x";
vsHeaders.push_back( "Content-Type: multipart/form-data; boundary=" + sBoundary );
RString sRequestPayload;
if( type == upload )
{
RageFile f;
if( !f.Open( sSrcFile ) )
FAIL_M( f.GetError() );
sRequestPayload.reserve( f.GetFileSize() );
int iBytesRead = f.Read( sRequestPayload );
if( iBytesRead == -1 )
FAIL_M( f.GetError() );
Header = "GET "+sAddress+" HTTP/1.0\r\n";
Header+= "Host: " + Server + "\r\n";
Header+= "Connection: closed\r\n\r\n";
sRequestPayload = "--" + sBoundary + "\r\n" +
"Content-Disposition: form-data; name=\"name\"\r\n" +
"\r\n" +
"Chris\r\n" +
"--" + sBoundary + "\r\n" +
"Content-Disposition: form-data; name=\"userfile\"; filename=\"" + Basename(sSrcFile) + "\"\r\n" +
"Content-Type: application/zip\r\n" +
"\r\n" +
sRequestPayload + "\r\n" +
"--" + sBoundary + "--";
}
/*
if( sRequestPayload.size() > 0 )
{
sHeader += "Content-Type: application/octet-stream\r\n";
sHeader += "Content-Length: multipart/form-data; boundary=" + sBoundary + "\r\n";
//sHeader += "Content-Length: " + ssprintf("%d",sRequestPayload.size()) + "\r\n";
}
*/
vsHeaders.push_back( "Content-Length: " + ssprintf("%d",sRequestPayload.size()) );
RString sHeader;
FOREACH_CONST( RString, vsHeaders, h )
sHeader += *h + "\r\n";
sHeader += "\r\n";
m_wSocket.SendData( sHeader.c_str(), sHeader.length() );
m_wSocket.SendData( "\r\n" );
m_wSocket.SendData( sRequestPayload.GetBuffer(), sRequestPayload.size() );
m_wSocket.SendData( Header.c_str(), Header.length() );
m_sStatus = "Header Sent.";
m_wSocket.blocking = false;
m_bIsDownloading = true;
@@ -187,14 +234,13 @@ static size_t FindEndOfHeaders( const RString &buf )
return string::npos;
}
void FileDownload::HTTPUpdate()
void FileTransfer::HTTPUpdate()
{
if( !m_bIsDownloading )
return;
int BytesGot=0;
//Keep this as a code block
//as there may be need to "if" it out some time.
// Keep this as a code block, as there may be need to "if" it out some time.
/* If you need a conditional for a large block of code, stick it in
* a function and return. */
while(1)
@@ -211,7 +257,7 @@ void FileDownload::HTTPUpdate()
if( !m_bGotHeader )
{
m_sStatus = "Waiting for header.";
//We don't know if we are using unix-style or dos-style
// We don't know if we are using unix-style or dos-style
size_t iHeaderEnd = FindEndOfHeaders( m_sBUFFER );
if( iHeaderEnd == m_sBUFFER.npos )
return;
@@ -235,20 +281,20 @@ void FileDownload::HTTPUpdate()
if( i != string::npos )
m_iTotalBytes = atoi(m_sBUFFER.substr(i+16,j-i).c_str());
else
m_iTotalBytes = -1; //We don't know, so go until disconnect
m_iTotalBytes = -1; // We don't know, so go until disconnect
m_bGotHeader = true;
m_sBUFFER.erase( 0, iHeaderEnd );
}
if( m_bIsPackage )
if( m_bSavingFile )
{
m_iDownloaded += m_sBUFFER.length();
m_fOutputFile.Write( m_sBUFFER );
// HACK: We're ending up with incomplete files after close() if we don't flush here. Why?
// HACK: We're ending up with incomplete files after close() if we don't flush here. Why?
m_fOutputFile.Flush();
m_sBUFFER = "";
}
else
@@ -260,8 +306,8 @@ void FileDownload::HTTPUpdate()
//We have the full doc. (And we knew how big it was)
( m_iTotalBytes == -1 &&
( m_wSocket.state == EzSockets::skERROR || m_wSocket.state == EzSockets::skDISCONNECTED ) ) )
//We didn't know how big it was, and were disconnected
//So that means we have it all.
// We didn't know how big it was, and were disconnected
// So that means we have it all.
{
m_wSocket.close();
m_bIsDownloading = false;
@@ -275,7 +321,7 @@ void FileDownload::HTTPUpdate()
}
else
{
if( m_bIsPackage && m_iResponseCode < 300 )
if( m_bSavingFile && m_iResponseCode < 300 )
{
RString sZipFile = m_fOutputFile.GetRealPath();
m_fOutputFile.Close();
@@ -286,7 +332,7 @@ void FileDownload::HTTPUpdate()
}
}
bool FileDownload::ParseHTTPAddress( const RString &URL, RString &sProto, RString &sServer, int &iPort, RString &sAddress )
bool FileTransfer::ParseHTTPAddress( const RString &URL, RString &sProto, RString &sServer, int &iPort, RString &sAddress )
{
// [PROTO://]SERVER[:PORT][/URL]
@@ -316,9 +362,16 @@ bool FileDownload::ParseHTTPAddress( const RString &URL, RString &sProto, RStrin
return true;
}
bool FileDownload::IsFinished()
void FileTransfer::Finish()
{
return m_bFinished;
while( true )
{
float fSleepSeconds = 0.1f;
this->Update( fSleepSeconds );
usleep( int( fSleepSeconds * 1000000.0 ) );
if( this->IsFinished() )
break;
}
}
#endif
+21 -14
View File
@@ -1,33 +1,40 @@
/* FileDownload - Downloads a file from the Internet. */
#ifndef ScreenPackages_H
#define ScreenPackages_H
#ifndef FileTransfer_H
#define FileTransfer_H
#if !defined(WITHOUT_NETWORKING)
#include "EzSockets.h"
#include "ezsockets.h"
#include "RageFile.h"
class FileDownload
class FileTransfer
{
public:
FileDownload();
~FileDownload();
FileTransfer();
~FileTransfer();
void StartDownload( const RString &sURL, const RString &sDestFile );
void CancelDownload( );
void StartDownload(const RString &sURL, const RString &sDestFile);
void StartUpload(const RString &sURL, const RString &sSrcFile, const RString &sDestFile);
void Cancel();
RString Update(float fDeltaTime);
bool IsFinished();
bool IsFinished() const { return m_bFinished; }
void Finish();
int GetResponseCode() const { return m_iResponseCode; }
RString GetResponse() const { return m_sBUFFER; }
RString GetStatus() const { return m_sStatus; }
private:
enum TransferType { download, upload };
void StartTransfer(TransferType type, const RString &sURL, const RString &sSrcFile, const RString &sDestFile);
int m_iPackagesPos;
int m_iLinksPos;
int m_iDLorLST;
// HTTP portion
void HTTPUpdate( );
void HTTPUpdate();
// True if proper string, false if improper
bool ParseHTTPAddress( const RString & URL, RString & Proto, RString & Server, int & Port, RString & Addy );
bool ParseHTTPAddress(const RString & URL, RString & Proto, RString & Server, int & Port, RString & Addy);
void UpdateProgress();
@@ -43,10 +50,10 @@ private:
RageFile m_fOutputFile;
RString m_sEndName;
bool m_bIsPackage;
bool m_bSavingFile;
RString m_sBaseAddress;
// HTTP Header information response
// HTTP Header information responce
long m_iTotalBytes;
long m_iDownloaded;
+1 -1
View File
@@ -195,7 +195,7 @@ static const wchar_t map_korean_jamo[] =
0
};
/* 5x3 Numbers. "0123456789%. :x" */
/* 5x3 Numbers. "01234 56789 %. :x" */
static const wchar_t map_numbers[] = {
0x0030, 0x0031, 0x0032, 0x0033, 0x0034,
0x0035, 0x0036, 0x0037, 0x0038, 0x0039,
+62 -62
View File
@@ -645,20 +645,20 @@ static const Style g_Style_Pump_HalfDouble =
6, // m_iColsPerPlayer
{ // m_ColumnInfo[NUM_PLAYERS][MAX_COLS_PER_PLAYER];
{ // PLAYER_1
{ TRACK_1, -PUMP_COL_SPACING*2.5f-5, NULL },
{ TRACK_2, -PUMP_COL_SPACING*1.5f-5, NULL },
{ TRACK_3, -PUMP_COL_SPACING*0.5f-5, NULL },
{ TRACK_4, +PUMP_COL_SPACING*0.5f+5, NULL },
{ TRACK_5, +PUMP_COL_SPACING*1.5f+5, NULL },
{ TRACK_6, +PUMP_COL_SPACING*2.5f+5, NULL },
{ TRACK_1, -PUMP_COL_SPACING*2.5f-4, NULL },
{ TRACK_2, -PUMP_COL_SPACING*1.5f-4, NULL },
{ TRACK_3, -PUMP_COL_SPACING*0.5f-4, NULL },
{ TRACK_4, +PUMP_COL_SPACING*0.5f+4, NULL },
{ TRACK_5, +PUMP_COL_SPACING*1.5f+4, NULL },
{ TRACK_6, +PUMP_COL_SPACING*2.5f+4, NULL },
},
{ // PLAYER_2
{ TRACK_1, -PUMP_COL_SPACING*2.5f-5, NULL },
{ TRACK_2, -PUMP_COL_SPACING*1.5f-5, NULL },
{ TRACK_3, -PUMP_COL_SPACING*0.5f-5, NULL },
{ TRACK_4, +PUMP_COL_SPACING*0.5f+5, NULL },
{ TRACK_5, +PUMP_COL_SPACING*1.5f+5, NULL },
{ TRACK_6, +PUMP_COL_SPACING*2.5f+5, NULL },
{ TRACK_1, -PUMP_COL_SPACING*2.5f-4, NULL },
{ TRACK_2, -PUMP_COL_SPACING*1.5f-4, NULL },
{ TRACK_3, -PUMP_COL_SPACING*0.5f-4, NULL },
{ TRACK_4, +PUMP_COL_SPACING*0.5f+4, NULL },
{ TRACK_5, +PUMP_COL_SPACING*1.5f+4, NULL },
{ TRACK_6, +PUMP_COL_SPACING*2.5f+4, NULL },
},
},
{ // m_iInputColumn[NUM_GameController][NUM_GameButton]
@@ -685,28 +685,28 @@ static const Style g_Style_Pump_Double =
10, // m_iColsPerPlayer
{ // m_ColumnInfo[NUM_PLAYERS][MAX_COLS_PER_PLAYER];
{ // PLAYER_1
{ TRACK_1, -PUMP_COL_SPACING*4.5f-5, NULL },
{ TRACK_2, -PUMP_COL_SPACING*3.5f-5, NULL },
{ TRACK_3, -PUMP_COL_SPACING*2.5f-5, NULL },
{ TRACK_4, -PUMP_COL_SPACING*1.5f-5, NULL },
{ TRACK_5, -PUMP_COL_SPACING*0.5f-5, NULL },
{ TRACK_6, +PUMP_COL_SPACING*0.5f+5, NULL },
{ TRACK_7, +PUMP_COL_SPACING*1.5f+5, NULL },
{ TRACK_8, +PUMP_COL_SPACING*2.5f+5, NULL },
{ TRACK_9, +PUMP_COL_SPACING*3.5f+5, NULL },
{ TRACK_10, +PUMP_COL_SPACING*4.5f+5, NULL },
{ TRACK_1, -PUMP_COL_SPACING*4.5f-4, NULL },
{ TRACK_2, -PUMP_COL_SPACING*3.5f-4, NULL },
{ TRACK_3, -PUMP_COL_SPACING*2.5f-4, NULL },
{ TRACK_4, -PUMP_COL_SPACING*1.5f-4, NULL },
{ TRACK_5, -PUMP_COL_SPACING*0.5f-4, NULL },
{ TRACK_6, +PUMP_COL_SPACING*0.5f+4, NULL },
{ TRACK_7, +PUMP_COL_SPACING*1.5f+4, NULL },
{ TRACK_8, +PUMP_COL_SPACING*2.5f+4, NULL },
{ TRACK_9, +PUMP_COL_SPACING*3.5f+4, NULL },
{ TRACK_10, +PUMP_COL_SPACING*4.5f+4, NULL },
},
{ // PLAYER_2
{ TRACK_1, -PUMP_COL_SPACING*4.5f-5, NULL },
{ TRACK_2, -PUMP_COL_SPACING*3.5f-5, NULL },
{ TRACK_3, -PUMP_COL_SPACING*2.5f-5, NULL },
{ TRACK_4, -PUMP_COL_SPACING*1.5f-5, NULL },
{ TRACK_5, -PUMP_COL_SPACING*0.5f-5, NULL },
{ TRACK_6, +PUMP_COL_SPACING*0.5f+5, NULL },
{ TRACK_7, +PUMP_COL_SPACING*1.5f+5, NULL },
{ TRACK_8, +PUMP_COL_SPACING*2.5f+5, NULL },
{ TRACK_9, +PUMP_COL_SPACING*3.5f+5, NULL },
{ TRACK_10, +PUMP_COL_SPACING*4.5f+5, NULL },
{ TRACK_1, -PUMP_COL_SPACING*4.5f-4, NULL },
{ TRACK_2, -PUMP_COL_SPACING*3.5f-4, NULL },
{ TRACK_3, -PUMP_COL_SPACING*2.5f-4, NULL },
{ TRACK_4, -PUMP_COL_SPACING*1.5f-4, NULL },
{ TRACK_5, -PUMP_COL_SPACING*0.5f-4, NULL },
{ TRACK_6, +PUMP_COL_SPACING*0.5f+4, NULL },
{ TRACK_7, +PUMP_COL_SPACING*1.5f+4, NULL },
{ TRACK_8, +PUMP_COL_SPACING*2.5f+4, NULL },
{ TRACK_9, +PUMP_COL_SPACING*3.5f+4, NULL },
{ TRACK_10, +PUMP_COL_SPACING*4.5f+4, NULL },
},
},
{ // m_iInputColumn[NUM_GameController][NUM_GameButton]
@@ -771,16 +771,16 @@ static const Style g_Style_Pump_Couple_Edit =
10, // m_iColsPerPlayer
{ // m_ColumnInfo[NUM_PLAYERS][MAX_COLS_PER_PLAYER];
{ // PLAYER_1
{ TRACK_1, -PUMP_COL_SPACING*5.0f-5, NULL },
{ TRACK_2, -PUMP_COL_SPACING*4.0f-5, NULL },
{ TRACK_3, -PUMP_COL_SPACING*3.0f-5, NULL },
{ TRACK_4, -PUMP_COL_SPACING*2.0f-5, NULL },
{ TRACK_5, -PUMP_COL_SPACING*1.0f-5, NULL },
{ TRACK_6, +PUMP_COL_SPACING*1.0f+5, NULL },
{ TRACK_7, +PUMP_COL_SPACING*2.0f+5, NULL },
{ TRACK_8, +PUMP_COL_SPACING*3.0f+5, NULL },
{ TRACK_9, +PUMP_COL_SPACING*4.0f+5, NULL },
{ TRACK_10, +PUMP_COL_SPACING*5.0f+5, NULL },
{ TRACK_1, -PUMP_COL_SPACING*5.0f-4, NULL },
{ TRACK_2, -PUMP_COL_SPACING*4.0f-4, NULL },
{ TRACK_3, -PUMP_COL_SPACING*3.0f-4, NULL },
{ TRACK_4, -PUMP_COL_SPACING*2.0f-4, NULL },
{ TRACK_5, -PUMP_COL_SPACING*1.0f-4, NULL },
{ TRACK_6, +PUMP_COL_SPACING*1.0f+4, NULL },
{ TRACK_7, +PUMP_COL_SPACING*2.0f+4, NULL },
{ TRACK_8, +PUMP_COL_SPACING*3.0f+4, NULL },
{ TRACK_9, +PUMP_COL_SPACING*4.0f+4, NULL },
{ TRACK_10, +PUMP_COL_SPACING*5.0f+4, NULL },
},
{ // PLAYER_2
{ TRACK_1, -PUMP_COL_SPACING*2.0f, NULL },
@@ -814,28 +814,28 @@ static const Style g_Style_Pump_Routine =
10, // m_iColsPerPlayer
{ // m_ColumnInfo[NUM_PLAYERS][MAX_COLS_PER_PLAYER];
{ // PLAYER_1
{ TRACK_1, -PUMP_COL_SPACING*4.6f-5, NULL },
{ TRACK_2, -PUMP_COL_SPACING*3.6f-5, NULL },
{ TRACK_3, -PUMP_COL_SPACING*2.6f-5, NULL },
{ TRACK_4, -PUMP_COL_SPACING*1.6f-5, NULL },
{ TRACK_5, -PUMP_COL_SPACING*0.6f-5, NULL },
{ TRACK_6, +PUMP_COL_SPACING*0.6f+5, NULL },
{ TRACK_7, +PUMP_COL_SPACING*1.6f+5, NULL },
{ TRACK_8, +PUMP_COL_SPACING*2.6f+5, NULL },
{ TRACK_9, +PUMP_COL_SPACING*3.6f+5, NULL },
{ TRACK_10, +PUMP_COL_SPACING*4.6f+5, NULL },
{ TRACK_1, -PUMP_COL_SPACING*4.6f-4, NULL },
{ TRACK_2, -PUMP_COL_SPACING*3.6f-4, NULL },
{ TRACK_3, -PUMP_COL_SPACING*2.6f-4, NULL },
{ TRACK_4, -PUMP_COL_SPACING*1.6f-4, NULL },
{ TRACK_5, -PUMP_COL_SPACING*0.6f-4, NULL },
{ TRACK_6, +PUMP_COL_SPACING*0.6f+4, NULL },
{ TRACK_7, +PUMP_COL_SPACING*1.6f+4, NULL },
{ TRACK_8, +PUMP_COL_SPACING*2.6f+4, NULL },
{ TRACK_9, +PUMP_COL_SPACING*3.6f+4, NULL },
{ TRACK_10, +PUMP_COL_SPACING*4.6f+4, NULL },
},
{ // PLAYER_2
{ TRACK_1, -PUMP_COL_SPACING*4.6f-5, NULL },
{ TRACK_2, -PUMP_COL_SPACING*3.6f-5, NULL },
{ TRACK_3, -PUMP_COL_SPACING*2.6f-5, NULL },
{ TRACK_4, -PUMP_COL_SPACING*1.6f-5, NULL },
{ TRACK_5, -PUMP_COL_SPACING*0.6f-5, NULL },
{ TRACK_6, +PUMP_COL_SPACING*0.6f+5, NULL },
{ TRACK_7, +PUMP_COL_SPACING*1.6f+5, NULL },
{ TRACK_8, +PUMP_COL_SPACING*2.6f+5, NULL },
{ TRACK_9, +PUMP_COL_SPACING*3.6f+5, NULL },
{ TRACK_10, +PUMP_COL_SPACING*4.6f+5, NULL },
{ TRACK_1, -PUMP_COL_SPACING*4.6f-4, NULL },
{ TRACK_2, -PUMP_COL_SPACING*3.6f-4, NULL },
{ TRACK_3, -PUMP_COL_SPACING*2.6f-4, NULL },
{ TRACK_4, -PUMP_COL_SPACING*1.6f-4, NULL },
{ TRACK_5, -PUMP_COL_SPACING*0.6f-4, NULL },
{ TRACK_6, +PUMP_COL_SPACING*0.6f+4, NULL },
{ TRACK_7, +PUMP_COL_SPACING*1.6f+4, NULL },
{ TRACK_8, +PUMP_COL_SPACING*2.6f+4, NULL },
{ TRACK_9, +PUMP_COL_SPACING*3.6f+4, NULL },
{ TRACK_10, +PUMP_COL_SPACING*4.6f+4, NULL },
},
},
{ // m_iInputColumn[NUM_GameController][NUM_GameButton]
+9
View File
@@ -2448,6 +2448,13 @@ public:
DEFINE_METHOD( GetCurMusicSeconds, m_fMusicSeconds )
DEFINE_METHOD( GetWorkoutGoalComplete, m_bWorkoutGoalComplete )
static int GetCharacter( T* p, lua_State *L ) { p->m_pCurCharacters[Enum::Check<PlayerNumber>(L, 1)]->PushSelf(L); return 1; }
static int SetCharacter( T* p, lua_State *L ){
Character* c = CHARMAN->GetCharacterFromID(SArg(2));
if (c)
p->m_pCurCharacters[Enum::Check<PlayerNumber>(L, 1)] = c;
return 0;
}
LunaGameState()
{
@@ -2543,6 +2550,8 @@ public:
ADD_METHOD( UnjoinPlayer );
ADD_METHOD( GetSongPercent );
ADD_METHOD( GetCurMusicSeconds );
ADD_METHOD( GetCharacter );
ADD_METHOD( SetCharacter );
}
};
+102
View File
@@ -0,0 +1,102 @@
#include "global.h"
#include "JsonUtil.h"
#include "RageFile.h"
#include "RageUtil.h"
#include "RageLog.h"
#include "arch/Dialog/Dialog.h"
#include "jsoncpp/include/json/reader.h"
#include "jsoncpp/include/json/writer.h"
bool JsonUtil::LoadFromString(Json::Value &root, RString sData, RString &sErrorOut)
{
Json::Reader reader;
bool parsingSuccessful = reader.parse(sData, root);
if (!parsingSuccessful)
{
RString err = reader.getFormatedErrorMessages();
sErrorOut = ssprintf("JSON: LoadFromFileShowErrors failed: %s", err.c_str());
LOG->Warn(sErrorOut);
return false;
}
return true;
}
bool JsonUtil::LoadFromFileShowErrors(Json::Value &root, RageFileBasic &f)
{
// Optimization opportunity: read this streaming instead of at once
RString sData;
f.Read(sData, f.GetFileSize());
return LoadFromStringShowErrors(root, sData);
}
bool JsonUtil::LoadFromFileShowErrors(Json::Value &root, const RString &sFile)
{
RageFile f;
if(!f.Open(sFile, RageFile::READ))
{
LOG->Warn("Couldn't open %s for reading: %s", sFile.c_str(), f.GetError().c_str());
return false;
}
return LoadFromFileShowErrors(root, f);
}
bool JsonUtil::LoadFromStringShowErrors(Json::Value &root, RString sData)
{
RString sError;
if(!LoadFromString(root, sData, sError))
{
Dialog::OK(sError, "JSON_PARSE_ERROR");
return false;
}
return true;
}
bool JsonUtil::WriteFile(const Json::Value &root, const RString &sFile, bool bMinified)
{
std::string s;
if(!bMinified)
{
Json::StyledWriter writer;
s = writer.write(root);
}
else
{
Json::FastWriter writer;
s = writer.write(root);
}
RageFile f;
if(!f.Open(sFile, RageFile::WRITE))
{
LOG->Warn("Couldn't open %s for reading: %s", sFile.c_str(), f.GetError().c_str());
return false;
}
f.Write(s);
return true;
}
/*
* (c) 2001-2004 Chris Danford
* All rights reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, and/or sell copies of the Software, and to permit persons to
* whom the Software is furnished to do so, provided that the above
* copyright notice(s) and this permission notice appear in all copies of
* the Software and that both the above copyright notice(s) and this
* permission notice appear in supporting documentation.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF
* THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS
* INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT
* OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
* OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
* OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
+100
View File
@@ -0,0 +1,100 @@
/* JsonUtil - Utilities for handling JSON data. */
#ifndef JsonUtil_H
#define JsonUtil_H
class RageFileBasic;
#include "jsoncpp/include/json/value.h"
namespace JsonUtil
{
bool LoadFromString( Json::Value &root, RString sData, RString &sErrorOut );
bool LoadFromStringShowErrors(Json::Value &root, const RString sData);
bool LoadFromFileShowErrors(Json::Value &root, const RString &sFile);
bool LoadFromFileShowErrors(Json::Value &root, RageFileBasic &f);
bool WriteFile(const Json::Value &root, const RString &sFile, bool bMinified);
template<class T>
static void SerializeVectorObjects(const vector<T> &v, void fn(const T &, Json::Value &), Json::Value &root)
{
root = Json::Value(Json::arrayValue);
root.resize(v.size());
for(unsigned i=0; i<v.size(); i++)
fn(v[i], root[i]);
}
template<class T>
static void SerializeVectorPointers(const vector<const T*> &v, void fn(const T &, Json::Value &), Json::Value &root)
{
root = Json::Value(Json::arrayValue);
root.resize(v.size());
for(unsigned i=0; i<v.size(); i++)
fn(*v[i], root[i]);
}
template<class T>
static void SerializeVectorValues(const vector<T> &v, Json::Value &root)
{
root = Json::Value(Json::arrayValue);
root.resize(v.size());
for(unsigned i=0; i<v.size(); i++)
root[i] = v[i];
}
template<class T>
static void DeserializeVectorObjects(vector<T> &v, void fn(T &, const Json::Value &), const Json::Value &root)
{
v.resize(root.size());
for(unsigned i=0; i<v.size(); i++)
fn(v[i], root[i]);
}
template<class T>
static void DeserializeVectorPointers(vector<T*> &v, void fn(T &, const Json::Value &), const Json::Value &root)
{
for(unsigned i=0; i<v.size(); i++)
SAFE_DELETE(v[i]);
v.resize(root.size());
for(unsigned i=0; i<v.size(); i++)
{
v[i] = new T;
fn(*v[i], root[i]);
}
}
template<class T>
static void DeserializeVectorValues(vector<T> &v, const Json::Value &root)
{
v.resize(root.size());
for(unsigned i=0; i<v.size(); i++)
v[i] = root[i].asString();
}
}
#endif
/*
* (c) 2010 Chris Danford
* All rights reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, and/or sell copies of the Software, and to permit persons to
* whom the Software is furnished to do so, provided that the above
* copyright notice(s) and this permission notice appear in all copies of
* the Software and that both the above copyright notice(s) and this
* permission notice appear in supporting documentation.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF
* THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS
* INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT
* OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
* OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
* OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
+699 -693
View File
File diff suppressed because it is too large Load Diff
+4 -4
View File
@@ -85,7 +85,7 @@ void MusicWheel::Load( RString sType )
split( MODE_MENU_CHOICE_NAMES, ",", vsModeChoiceNames );
CHOICE .Load(sType,CHOICE_NAME,vsModeChoiceNames);
SECTION_COLORS .Load(sType,SECTION_COLORS_NAME,NUM_SECTION_COLORS);
WheelBase::Load( sType );
SONGMAN->UpdateRankingCourses();
@@ -93,7 +93,7 @@ void MusicWheel::Load( RString sType )
m_soundChangeSort.Load( THEME->GetPathS(sType,"sort") );
m_soundExpand.Load( THEME->GetPathS(sType,"expand"), true );
/* Update for SORT_MOST_PLAYED. */
// Update for SORT_MOST_PLAYED.
SONGMAN->UpdatePopular();
/* Sort SONGMAN's songs by CompareSongPointersByTitle, so we can do other sorts (with
@@ -106,8 +106,8 @@ void MusicWheel::BeginScreen()
{
RageTimer timer;
RString times;
/* Build all of the wheel item data. Do this after selecting
* the extra stage, so it knows to always display it. */
/* Build all of the wheel item data. Do this after selecting the extra stage,
* so it knows to always display it. */
FOREACH_ENUM( SortOrder, so )
{
BuildWheelItemDatas( m_WheelItemDatas[so], so );
+21
View File
@@ -49,9 +49,13 @@ MusicWheelItem::MusicWheelItem( RString sType ):
FOREACH_ENUM( MusicWheelItemType, i )
{
m_sprColorPart[i].Load( THEME->GetPathG(sType,MusicWheelItemTypeToString(i)+" ColorPart") );
m_sprColorPart[i]->SetName( MusicWheelItemTypeToString(i)+"ColorPart" );
ActorUtil::LoadAllCommands(m_sprColorPart[i],"MusicWheelItem");
this->AddChild( m_sprColorPart[i] );
m_sprNormalPart[i].Load( THEME->GetPathG(sType,MusicWheelItemTypeToString(i)+" NormalPart") );
m_sprNormalPart[i]->SetName( MusicWheelItemTypeToString(i)+"NormalPart" );
ActorUtil::LoadAllCommands(m_sprNormalPart[i],"MusicWheelItem");
this->AddChild( m_sprNormalPart[i] );
}
@@ -62,6 +66,14 @@ MusicWheelItem::MusicWheelItem( RString sType ):
m_TextBanner.PlayCommand( "On" );
this->AddChild( &m_TextBanner );
FOREACH_ENUM( MusicWheelItemType, i )
{
m_sprOverPart[i].Load( THEME->GetPathG(sType,MusicWheelItemTypeToString(i)+" OverPart") );
m_sprOverPart[i]->SetName( MusicWheelItemTypeToString(i)+"OverPart" );
ActorUtil::LoadAllCommands(m_sprOverPart[i],"MusicWheelItem");
this->AddChild( m_sprOverPart[i] );
}
FOREACH_ENUM( MusicWheelItemType, i )
{
m_pText[i] = NULL;
@@ -126,6 +138,12 @@ MusicWheelItem::MusicWheelItem( const MusicWheelItem &cpy ):
this->AddChild( &m_TextBanner );
FOREACH_ENUM( MusicWheelItemType, i )
{
m_sprOverPart[i] = cpy.m_sprOverPart[i];
this->AddChild( m_sprOverPart[i] );
}
FOREACH_ENUM( MusicWheelItemType, i )
{
if( cpy.m_pText[i] == NULL )
@@ -166,6 +184,7 @@ void MusicWheelItem::LoadFromWheelItemData( const WheelItemBaseData *pData, int
{
m_sprColorPart[i]->SetVisible( false );
m_sprNormalPart[i]->SetVisible( false );
m_sprOverPart[i]->SetVisible( false );
}
m_TextBanner.SetVisible( false );
FOREACH_ENUM( MusicWheelItemType, i )
@@ -242,6 +261,7 @@ void MusicWheelItem::LoadFromWheelItemData( const WheelItemBaseData *pData, int
m_sprColorPart[type]->SetVisible( true );
m_sprColorPart[type]->SetDiffuse( pWID->m_color );
m_sprNormalPart[type]->SetVisible( true );
m_sprOverPart[type]->SetVisible( true );
BitmapText *bt = m_pText[type];
if( bt )
{
@@ -269,6 +289,7 @@ void MusicWheelItem::LoadFromWheelItemData( const WheelItemBaseData *pData, int
msg.SetParam( "SongGroup", pWID->m_sText );
msg.SetParam( "DrawIndex", iDrawIndex );
msg.SetParam( "Type", MusicWheelItemTypeToString(type) );
msg.SetParam( "Color", pWID->m_color );
this->HandleMessage( msg );
}
+1
View File
@@ -51,6 +51,7 @@ private:
AutoActor m_sprColorPart[NUM_MusicWheelItemType];
AutoActor m_sprNormalPart[NUM_MusicWheelItemType];
AutoActor m_sprOverPart[NUM_MusicWheelItemType];
TextBanner m_TextBanner; // used by Type_Song instead of m_pText
BitmapText *m_pText[NUM_MusicWheelItemType];
+4
View File
@@ -237,11 +237,15 @@ void SMLoader::LoadTimingFromSMFile( const MsdFile &msd, TimingData &out )
fDeltaBeat,(fNextPositiveBPM/60.0f),abs(fNewBPM/60.0f),BeatToNoteRow(fNextPositiveBeat),BeatToNoteRow(fBeat))
);
*/
out.AddBPMSegment( BPMSegment(BeatToNoteRow(fBeat), fNewBPM) );
continue;
}
else
{
// last BPM is a negative one? ugh. -aj (MAX_NOTE_ROW exists btw)
out.AddBPMSegment( BPMSegment(BeatToNoteRow(fBeat), fNewBPM) );
}
}
+1 -1
View File
@@ -188,7 +188,7 @@ PrefsManager::PrefsManager() :
m_bOnlyDedicatedMenuButtons ( "OnlyDedicatedMenuButtons", false ),
m_bMenuTimer ( "MenuTimer", false ),
m_fLifeDifficultyScale ( "LifeDifficultyScale", 1.0f ),
m_fLifeDifficultyScale ( "LifeDifficultyScale", .0f ),
m_iRegenComboAfterMiss ( "RegenComboAfterMiss", 5 ),
+1 -1
View File
@@ -21,7 +21,7 @@
* "v0.0": Final Releases
*/
#ifndef PRODUCT_VER_BARE
#define PRODUCT_VER_BARE v1.0
#define PRODUCT_VER_BARE v1.1
#endif
// A unique ID for a build of an application. This is used in crash reports and in the network code's version handling
+3 -2
View File
@@ -5,7 +5,7 @@
; see ProductInfo.h for use descriptions
!define PRODUCT_ID "sm-ssc"
!define PRODUCT_VER "v1.0"
!define PRODUCT_VER "v1.1"
!define PRODUCT_DISPLAY "${PRODUCT_ID} ${PRODUCT_VER}"
!define PRODUCT_BITMAP "ssc"
@@ -17,7 +17,8 @@
!define INSTALL_PROGRAM_LIBRARIES
!define INSTALL_EXECUTABLES
!define INSTALL_NON_PCK_FILES
;!define ASSOCIATE_SMZIP
!define ASSOCIATE_SMZIP
!define ASSOCIATE_SMURL
;!define SHOW_AUTORUN
!define MAKE_OPEN_PROGRAM_FOLDER_SHORTCUT
!define MAKE_OPEN_SETTINGS_FOLDER_SHORTCUT
+8
View File
@@ -201,6 +201,12 @@ Character *Profile::GetCharacter() const
return CHARMAN->GetDefaultCharacter();
}
void Profile::SetCharacter(const RString sCharacterID)
{
if(CHARMAN->GetCharacterFromID(sCharacterID))
m_sCharacterID = sCharacterID;
}
static RString FormatCalories( float fCals )
{
return Commify((int)fCals) + " Cal";
@@ -1957,6 +1963,7 @@ public:
}
static int GetCharacter( T* p, lua_State *L ) { p->GetCharacter()->PushSelf(L); return 1; }
static int SetCharacter( T* p, lua_State *L ) { p->SetCharacter(SArg(1)); return 0; }
static int GetWeightPounds( T* p, lua_State *L ) { lua_pushnumber(L, p->m_iWeightPounds ); return 1; }
static int SetWeightPounds( T* p, lua_State *L ) { p->m_iWeightPounds = IArg(1); return 0; }
static int GetGoalType( T* p, lua_State *L ) { lua_pushnumber(L, p->m_GoalType ); return 1; }
@@ -2030,6 +2037,7 @@ public:
ADD_METHOD( GetDisplayName );
ADD_METHOD( GetHighScoreList );
ADD_METHOD( GetCharacter );
ADD_METHOD( SetCharacter );
ADD_METHOD( GetWeightPounds );
ADD_METHOD( SetWeightPounds );
ADD_METHOD( GetGoalType );
+1
View File
@@ -67,6 +67,7 @@ public:
// smart accessors
RString GetDisplayNameOrHighScoreName() const;
Character *GetCharacter() const;
void SetCharacter(const RString sCharacterID);
RString GetDisplayTotalCaloriesBurned() const; // remove me and use Lua instead
RString GetDisplayTotalCaloriesBurnedToday() const; // remove me and use Lua instead
int GetCalculatedWeightPounds() const; // returns a default value if m_iWeightPounds isn't set
+3 -1
View File
@@ -82,7 +82,7 @@ void RollingNumbers::Update( float fDeltaTime )
void RollingNumbers::SetTargetNumber( float fTargetNumber )
{
if( fTargetNumber == m_fTargetNumber ) // no change
if( fTargetNumber == m_fTargetNumber ) // no change
return;
m_fTargetNumber = fTargetNumber;
m_fScoreVelocity = (m_fTargetNumber-m_fCurrentNumber) / APPROACH_SECONDS.GetValue();
@@ -102,10 +102,12 @@ void RollingNumbers::UpdateText()
class LunaRollingNumbers: public Luna<RollingNumbers>
{
public:
static int Load( T* p, lua_State *L ) { p->Load(SArg(1)); return 0; }
static int targetnumber( T* p, lua_State *L ) { p->SetTargetNumber( FArg(1) ); return 0; }
LunaRollingNumbers()
{
ADD_METHOD( Load );
ADD_METHOD( targetnumber );
}
};
+3
View File
@@ -184,7 +184,10 @@ void Screen::Input( const InputEventPlus &input )
{
Message msg("");
if( m_Codes.InputMessage(input, msg) )
{
this->HandleMessage( msg );
return;
}
// Don't send release messages with the default handler.
switch( input.type )
+1 -2
View File
@@ -2174,8 +2174,7 @@ void ScreenGameplay::Input( const InputEventPlus &input )
if( m_PauseController == GameController_Invalid || m_PauseController == input.GameI.controller )
{
// IMO, it's better to have this configurable. -DaisuMaster
if( UNPAUSE_WITH_START )
this->PauseGame( false );
if( UNPAUSE_WITH_START ) this->PauseGame( false );
}
}
return;
+400
View File
@@ -0,0 +1,400 @@
#include "global.h"
#include "ScreenInstallOverlay.h"
#include "RageFileManager.h"
#include "ScreenManager.h"
#include "Preference.h"
#include "RageLog.h"
#include "FileDownload.h"
#include "jsoncpp/include/json/value.h"
#include "JsonUtil.h"
#include "SpecialFiles.h"
class Song;
#include "SongManager.h"
#include "GameState.h"
#include "GameManager.h"
#include "CommonMetrics.h"
#include "SongManager.h"
#include "CommandLineActions.h"
#include "ScreenDimensions.h"
#include "StepMania.h"
#include "ActorUtil.h"
struct PlayAfterLaunchInfo
{
RString sSongDir;
RString sTheme;
bool bAnySongChanged;
bool bAnyThemeChanged;
PlayAfterLaunchInfo()
{
bAnySongChanged = false;
bAnyThemeChanged = false;
}
void OverlayWith( const PlayAfterLaunchInfo &other )
{
if( !other.sSongDir.empty() ) sSongDir = other.sSongDir;
if( !other.sTheme.empty() ) sTheme = other.sTheme;
bAnySongChanged |= other.bAnySongChanged;
bAnyThemeChanged |= other.bAnyThemeChanged;
}
};
static void Parse( const RString &sDir, PlayAfterLaunchInfo &out )
{
vector<RString> vsDirParts;
split( sDir, "/", vsDirParts, true );
if( vsDirParts.size() == 3 && vsDirParts[0].EqualsNoCase("Songs") )
out.sSongDir = "/" + sDir;
else if( vsDirParts.size() == 2 && vsDirParts[0].EqualsNoCase("Themes") )
out.sTheme = vsDirParts[1];
}
static const RString TEMP_ZIP_MOUNT_POINT = "/@temp-zip/";
const RString TEMP_OS_MOUNT_POINT = "/@temp-os/";
static void InstallSmzip( const RString &sZipFile, PlayAfterLaunchInfo &out )
{
if( !FILEMAN->Mount( "zip", sZipFile, TEMP_ZIP_MOUNT_POINT ) )
FAIL_M("Failed to mount " + sZipFile );
vector<RString> vsFiles;
{
vector<RString> vsRawFiles;
GetDirListingRecursive( TEMP_ZIP_MOUNT_POINT, "*", vsRawFiles);
vector<RString> vsPrettyFiles;
FOREACH_CONST( RString, vsRawFiles, s )
{
if( GetExtension(*s).EqualsNoCase("ctl") )
continue;
vsFiles.push_back( *s);
RString s2 = s->Right( s->length() - TEMP_ZIP_MOUNT_POINT.length() );
vsPrettyFiles.push_back( s2 );
}
sort( vsPrettyFiles.begin(), vsPrettyFiles.end() );
}
RString sResult = "Success installing " + sZipFile;
FOREACH_CONST( RString, vsFiles, sSrcFile )
{
RString sDestFile = *sSrcFile;
sDestFile = sDestFile.Right( sDestFile.length() - TEMP_ZIP_MOUNT_POINT.length() );
RString sDir, sThrowAway;
splitpath( sDestFile, sDir, sThrowAway, sThrowAway );
Parse( sDir, out );
out.bAnySongChanged = true;
FILEMAN->CreateDir( sDir );
if( !FileCopy( *sSrcFile, sDestFile ) )
{
sResult = "Error extracting " + sDestFile;
break;
}
}
FILEMAN->Unmount( "zip", sZipFile, TEMP_ZIP_MOUNT_POINT );
SCREENMAN->SystemMessage( sResult );
}
void InstallSmzipOsArg( const RString &sOsZipFile, PlayAfterLaunchInfo &out )
{
SCREENMAN->SystemMessage("Installing " + sOsZipFile );
RString sOsDir, sFilename, sExt;
splitpath( sOsZipFile, sOsDir, sFilename, sExt );
if( !FILEMAN->Mount( "dir", sOsDir, TEMP_OS_MOUNT_POINT ) )
FAIL_M("Failed to mount " + sOsDir );
InstallSmzip( TEMP_OS_MOUNT_POINT + sFilename + sExt, out );
FILEMAN->Unmount( "dir", sOsDir, TEMP_OS_MOUNT_POINT );
}
struct FileCopyResult
{
FileCopyResult( RString _sFile, RString _sComment ) : sFile(_sFile), sComment(_sComment) {}
RString sFile, sComment;
};
Preference<RString> g_sCookie( "Cookie", "" );
class DownloadTask
{
FileTransfer *m_pTransfer;
vector<RString> m_vsQueuedPackageUrls;
RString m_sCurrentPackageTempFile;
enum
{
control,
packages
} m_DownloadState;
PlayAfterLaunchInfo m_playAfterLaunchInfo;
public:
DownloadTask(const RString &sControlFileUri)
{
//SCREENMAN->SystemMessage( "Downloading control file." );
m_pTransfer = new FileTransfer();
m_pTransfer->StartDownload( sControlFileUri, "" );
m_DownloadState = control;
}
~DownloadTask()
{
SAFE_DELETE(m_pTransfer);
}
RString GetStatus()
{
if( m_pTransfer == NULL )
return "";
else
return m_pTransfer->GetStatus();
}
bool UpdateAndIsFinished( float fDeltaSeconds, PlayAfterLaunchInfo &playAfterLaunchInfo )
{
m_pTransfer->Update( fDeltaSeconds );
switch( m_DownloadState )
{
case control:
if( m_pTransfer->IsFinished() )
{
SCREENMAN->SystemMessage( "Downloading required .smzip" );
RString sResponse = m_pTransfer->GetResponse();
SAFE_DELETE( m_pTransfer );
Json::Value root;
RString sError;
if( !JsonUtil::LoadFromString(root, sResponse, sError) )
{
SCREENMAN->SystemMessage( sError );
return true;
}
// Parse the JSON response, make a list of all packages need to be downloaded.
{
if( root["Cookie"].isString() )
g_sCookie.Set( root["Cookie"].asString() );
Json::Value require = root["Require"];
if( require.isArray() )
{
for( unsigned i=0; i<require.size(); i++)
{
Json::Value iter = require[i];
if( iter["Dir"].isString() )
{
RString sDir = iter["Dir"].asString();
Parse( sDir, m_playAfterLaunchInfo );
if( DoesFileExist( sDir ) )
continue;
}
RString sUri;
if( iter["Uri"].isString() )
{
sUri = iter["Uri"].asString();
m_vsQueuedPackageUrls.push_back( sUri );
}
}
}
}
/*
{
// TODO: Validate that this zip contains files for this version of StepMania
bool bFileExists = DoesFileExist( SpecialFiles::PACKAGES_DIR + sFilename + sExt );
if( FileCopy( TEMP_MOUNT_POINT + sFilename + sExt, SpecialFiles::PACKAGES_DIR + sFilename + sExt ) )
vSucceeded.push_back( FileCopyResult(*s,bFileExists ? "overwrote existing file" : "") );
else
vFailed.push_back( FileCopyResult(*s,ssprintf("error copying file to '%s'",sOsDir.c_str())) );
}
*/
m_DownloadState = packages;
if( !m_vsQueuedPackageUrls.empty() )
{
RString sUrl = m_vsQueuedPackageUrls.back();
m_vsQueuedPackageUrls.pop_back();
m_sCurrentPackageTempFile = MakeTempFileName(sUrl);
ASSERT(m_pTransfer == NULL);
m_pTransfer = new FileTransfer();
m_pTransfer->StartDownload( sUrl, m_sCurrentPackageTempFile );
}
}
break;
case packages:
{
if( m_pTransfer->IsFinished() )
{
SAFE_DELETE( m_pTransfer );
InstallSmzip( m_sCurrentPackageTempFile, m_playAfterLaunchInfo );
FILEMAN->Remove( m_sCurrentPackageTempFile ); // Harmless if this fails because download didn't finish
}
if( !m_vsQueuedPackageUrls.empty() )
{
RString sUrl = m_vsQueuedPackageUrls.back();
m_vsQueuedPackageUrls.pop_back();
m_sCurrentPackageTempFile = MakeTempFileName(sUrl);
ASSERT(m_pTransfer == NULL);
m_pTransfer = new FileTransfer();
m_pTransfer->StartDownload( sUrl, m_sCurrentPackageTempFile );
}
}
break;
}
bool bFinsihed = m_DownloadState == packages &&
m_vsQueuedPackageUrls.empty() &&
m_pTransfer == NULL;
if( bFinsihed )
{
playAfterLaunchInfo = m_playAfterLaunchInfo;
return true;
}
else
{
return false;
}
}
static RString MakeTempFileName( RString s )
{
return SpecialFiles::CACHE_DIR + "Downloads/" + Basename(s);
}
};
static vector<DownloadTask*> g_pDownloadTasks;
static bool IsStepManiaProtocol(const RString &arg)
{
// for now, only load from the StepMania domain until the security implications of this feature are better understood.
//return BeginsWith(arg,"stepmania://beta.stepmania.com/");
return BeginsWith(arg,"stepmania://");
}
static bool IsPackageFile(const RString &arg)
{
RString ext = GetExtension(arg);
return ext.EqualsNoCase("smzip") || ext.EqualsNoCase("zip");
}
PlayAfterLaunchInfo DoInstalls( CommandLineActions::CommandLineArgs args )
{
PlayAfterLaunchInfo ret;
for( int i = 0; i<(int)args.argv.size(); i++ )
{
RString s = args.argv[i];
if( IsStepManiaProtocol(s) )
g_pDownloadTasks.push_back( new DownloadTask(s) );
else if( IsPackageFile(s) )
InstallSmzipOsArg(s, ret);
}
return ret;
}
REGISTER_SCREEN_CLASS( ScreenInstallOverlay );
ScreenInstallOverlay::~ScreenInstallOverlay()
{
}
void ScreenInstallOverlay::Init()
{
Screen::Init();
m_textStatus.LoadFromFont( THEME->GetPathF("ScreenInstallOverlay", "status") );
m_textStatus.SetName("Status");
ActorUtil::LoadAllCommandsAndSetXY(m_textStatus,"ScreenInstallOverlay");
this->AddChild( &m_textStatus );
}
void ScreenInstallOverlay::Update( float fDeltaTime )
{
Screen::Update(fDeltaTime);
PlayAfterLaunchInfo playAfterLaunchInfo;
while( CommandLineActions::ToProcess.size() > 0 )
{
CommandLineActions::CommandLineArgs args = CommandLineActions::ToProcess.back();
CommandLineActions::ToProcess.pop_back();
PlayAfterLaunchInfo pali2 = DoInstalls( args );
playAfterLaunchInfo.OverlayWith( pali2 );
}
for(int i=g_pDownloadTasks.size()-1; i>=0; --i)
{
DownloadTask *p = g_pDownloadTasks[i];
PlayAfterLaunchInfo pali;
if( p->UpdateAndIsFinished( fDeltaTime, pali) )
{
playAfterLaunchInfo.OverlayWith(pali);
SAFE_DELETE(p);
g_pDownloadTasks.erase( g_pDownloadTasks.begin()+i );
}
}
{
vector<RString> vsMessages;
FOREACH_CONST( DownloadTask*, g_pDownloadTasks, pDT )
{
vsMessages.push_back( (*pDT)->GetStatus() );
}
m_textStatus.SetText( join("\n", vsMessages) );
}
if( playAfterLaunchInfo.bAnySongChanged )
SONGMAN->Reload( false, NULL );
if( !playAfterLaunchInfo.sSongDir.empty() )
{
Song* pSong = NULL;
GAMESTATE->Reset();
RString sInitialScreen;
if( playAfterLaunchInfo.sSongDir.length() > 0 )
pSong = SONGMAN->GetSongFromDir( playAfterLaunchInfo.sSongDir );
if( pSong )
{
vector<const Style*> vpStyle;
GAMEMAN->GetStylesForGame( GAMESTATE->m_pCurGame, vpStyle, false );
GAMESTATE->m_PlayMode.Set( PLAY_MODE_REGULAR );
GAMESTATE->m_bSideIsJoined[0] = true;
GAMESTATE->m_MasterPlayerNumber = PLAYER_1;
GAMESTATE->m_pCurStyle.Set( vpStyle[0] );
GAMESTATE->m_pCurSong.Set( pSong );
GAMESTATE->m_pPreferredSong = pSong;
sInitialScreen = StepMania::GetSelectMusicScreen();
}
else
{
sInitialScreen = StepMania::GetInitialScreen();
}
SCREENMAN->SetNewScreen( sInitialScreen );
}
}
/*
* (c) 2001-2005 Chris Danford, Glenn Maynard
* All rights reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, and/or sell copies of the Software, and to permit persons to
* whom the Software is furnished to do so, provided that the above
* copyright notice(s) and this permission notice appear in all copies of
* the Software and that both the above copyright notice(s) and this
* permission notice appear in supporting documentation.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF
* THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS
* INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT
* OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
* OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
* OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
+48
View File
@@ -0,0 +1,48 @@
/* ScreenInstallOverlay - package installation processing and messaging. */
#ifndef ScreenInstallOverlay_H
#define ScreenInstallOverlay_H
#include "Screen.h"
#include "BitmapText.h"
class ScreenInstallOverlay : public Screen
{
public:
virtual ~ScreenInstallOverlay();
virtual void Init();
void Update( float fDeltaTime );
private:
void UpdateText();
BitmapText m_textStatus;
};
#endif
/*
* (c) 2001-2005 Chris Danford, Glenn Maynard
* All rights reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, and/or sell copies of the Software, and to permit persons to
* whom the Software is furnished to do so, provided that the above
* copyright notice(s) and this permission notice appear in all copies of
* the Software and that both the above copyright notice(s) and this
* permission notice appear in supporting documentation.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF
* THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS
* INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT
* OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
* OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
* OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
+2
View File
@@ -1152,6 +1152,7 @@ public:
return 0;
}
static int GetNumStates( T* p, lua_State *L ) { lua_pushnumber( L, p->GetNumStates() ); return 1; }
static int SetAllStateDelays( T* p, lua_State *L ) { p->SetAllStateDelays(FArg(1)); return 0; }
LunaSprite()
{
@@ -1172,6 +1173,7 @@ public:
ADD_METHOD( GetTexture );
ADD_METHOD( SetEffectMode );
ADD_METHOD( GetNumStates );
ADD_METHOD( SetAllStateDelays );
}
};
+152 -4
View File
@@ -50,7 +50,7 @@
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=".;vorbis;libjpeg;&quot;lua-5.1\include&quot;;ffmpeg\modern_working\include;BaseClasses"
AdditionalIncludeDirectories=".;vorbis;libjpeg;&quot;lua-5.1\include&quot;;ffmpeg\modern_working\include;BaseClasses;jsoncpp/include"
PreprocessorDefinitions="WIN32,_DEBUG,_WINDOWS,WINDOWS,DEBUG"
ExceptionHandling="0"
BasicRuntimeChecks="3"
@@ -157,7 +157,7 @@
InlineFunctionExpansion="2"
EnableIntrinsicFunctions="true"
FavorSizeOrSpeed="2"
AdditionalIncludeDirectories=".;vorbis;libjpeg;&quot;lua-5.1\include&quot;;ffmpeg\modern_working\include;BaseClasses"
AdditionalIncludeDirectories=".;vorbis;libjpeg;&quot;lua-5.1\include&quot;;ffmpeg\modern_working\include;BaseClasses;jsoncpp/include"
PreprocessorDefinitions="WIN32,NDEBUG,_WINDOWS,WINDOWS,RELEASE"
StringPooling="true"
MinimalRebuild="false"
@@ -261,7 +261,7 @@
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=".;vorbis;libjpeg;&quot;lua-5.1\include&quot;;ffmpeg\modern_working\include;BaseClasses"
AdditionalIncludeDirectories=".;vorbis;libjpeg;&quot;lua-5.1\include&quot;;ffmpeg\modern_working\include;BaseClasses;jsoncpp/include"
PreprocessorDefinitions="WIN32,_DEBUG,_WINDOWS,WINDOWS,DEBUG"
ExceptionHandling="0"
BasicRuntimeChecks="0"
@@ -368,7 +368,7 @@
InlineFunctionExpansion="2"
EnableIntrinsicFunctions="true"
FavorSizeOrSpeed="1"
AdditionalIncludeDirectories=".;vorbis;libjpeg;&quot;lua-5.1\include&quot;;ffmpeg\modern_working\include;BaseClasses"
AdditionalIncludeDirectories=".;vorbis;libjpeg;&quot;lua-5.1\include&quot;;ffmpeg\modern_working\include;BaseClasses;jsoncpp/include"
PreprocessorDefinitions="WIN32,NDEBUG,_WINDOWS,WINDOWS,RELEASE"
StringPooling="true"
MinimalRebuild="false"
@@ -588,6 +588,14 @@
RelativePath="ScreenHowToPlay.h"
>
</File>
<File
RelativePath=".\ScreenInstallOverlay.cpp"
>
</File>
<File
RelativePath=".\ScreenInstallOverlay.h"
>
</File>
<File
RelativePath="ScreenInstructions.cpp"
>
@@ -1200,6 +1208,14 @@
RelativePath="EnumHelper.h"
>
</File>
<File
RelativePath=".\FileDownload.cpp"
>
</File>
<File
RelativePath=".\FileDownload.h"
>
</File>
<File
RelativePath=".\Font.cpp"
>
@@ -1304,6 +1320,14 @@
RelativePath="Inventory.h"
>
</File>
<File
RelativePath=".\JsonUtil.cpp"
>
</File>
<File
RelativePath=".\JsonUtil.h"
>
</File>
<File
RelativePath=".\LocalizedString.cpp"
>
@@ -1843,10 +1867,18 @@
<Filter
Name="arch"
>
<File
RelativePath=".\arch\arch.h"
>
</File>
<File
RelativePath="arch\arch_default.h"
>
</File>
<File
RelativePath=".\arch\arch_platform.h"
>
</File>
<File
RelativePath=".\arch\RageDriver.cpp"
>
@@ -2278,6 +2310,10 @@
RelativePath="arch\Dialog\DialogDriver_Win32.h"
>
</File>
<File
RelativePath=".\arch\Dialog\Selector_Dialog.h"
>
</File>
</Filter>
<Filter
Name="Threads"
@@ -5047,6 +5083,118 @@
>
</File>
</Filter>
<Filter
Name="jsoncpp"
>
<File
RelativePath=".\jsoncpp\src\lib_json\json_reader.cpp"
>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCLCompilerTool"
UsePrecompiledHeader="0"
/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
UsePrecompiledHeader="0"
/>
</FileConfiguration>
<FileConfiguration
Name="FastDebug|Win32"
>
<Tool
Name="VCCLCompilerTool"
UsePrecompiledHeader="0"
/>
</FileConfiguration>
<FileConfiguration
Name="Release-SSE2|Win32"
>
<Tool
Name="VCCLCompilerTool"
UsePrecompiledHeader="0"
/>
</FileConfiguration>
</File>
<File
RelativePath=".\jsoncpp\src\lib_json\json_value.cpp"
>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCLCompilerTool"
UsePrecompiledHeader="0"
/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
UsePrecompiledHeader="0"
/>
</FileConfiguration>
<FileConfiguration
Name="FastDebug|Win32"
>
<Tool
Name="VCCLCompilerTool"
UsePrecompiledHeader="0"
/>
</FileConfiguration>
<FileConfiguration
Name="Release-SSE2|Win32"
>
<Tool
Name="VCCLCompilerTool"
UsePrecompiledHeader="0"
/>
</FileConfiguration>
</File>
<File
RelativePath=".\jsoncpp\src\lib_json\json_writer.cpp"
>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCLCompilerTool"
UsePrecompiledHeader="0"
/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
UsePrecompiledHeader="0"
/>
</FileConfiguration>
<FileConfiguration
Name="FastDebug|Win32"
>
<Tool
Name="VCCLCompilerTool"
UsePrecompiledHeader="0"
/>
</FileConfiguration>
<FileConfiguration
Name="Release-SSE2|Win32"
>
<Tool
Name="VCCLCompilerTool"
UsePrecompiledHeader="0"
/>
</FileConfiguration>
</File>
</Filter>
</Filter>
</Filter>
<Filter
+10 -62
View File
@@ -369,6 +369,11 @@ RString StepMania::GetInitialScreen()
return PREFSMAN->m_sTestInitialScreen;
return INITIAL_SCREEN.GetValue();
}
ThemeMetric<RString> SELECT_MUSIC_SCREEN ("Common","SelectMusicScreen");
RString StepMania::GetSelectMusicScreen()
{
return SELECT_MUSIC_SCREEN.GetValue();
}
#if defined(WIN32)
static Preference<int> g_iLastSeenMemory( "LastSeenMemory", 0 );
@@ -959,25 +964,6 @@ int main(int argc, char* argv[])
SetCommandlineArguments( argc, argv );
enum RunMode
{
RunMode_Normal,
RunMode_Install,
RunMode_ExportNsisStrings,
RunMode_ExportLuaInformation,
RunMode_DisplayVersion,
};
RunMode runmode = RunMode_Normal;
if( CommandLineActions::AnyPackageFilesInCommandLine() )
runmode = RunMode_Install;
else if( GetCommandlineArgument("ExportNsisStrings") )
runmode = RunMode_ExportNsisStrings;
else if( GetCommandlineArgument("ExportLuaInformation") )
runmode = RunMode_ExportLuaInformation;
else if( GetCommandlineArgument("version") )
runmode = RunMode_DisplayVersion;
// Set up arch hooks first. This may set up crash handling.
HOOKS = ArchHooks::Create();
HOOKS->Init();
@@ -991,7 +977,6 @@ int main(int argc, char* argv[])
if( !bPortable )
FILEMAN->MountUserFilesystems();
// Set this up next. Do this early, since it's needed for RageException::Throw.
LOG = new RageLog;
@@ -1004,7 +989,7 @@ int main(int argc, char* argv[])
* so ArchHooks can use a preference to turn this off. We want to do this before ApplyLogPreferences,
* so if we exit because of another instance, we don't try to clobber its log. We also want to
* do this before opening the loading window, so if we give focus away, we don't flash the window. */
if( !g_bAllowMultipleInstances.Get() && HOOKS->CheckForMultipleInstances() )
if(!g_bAllowMultipleInstances.Get() && HOOKS->CheckForMultipleInstances(argc, argv))
{
ShutdownGame();
return 0;
@@ -1057,17 +1042,9 @@ int main(int argc, char* argv[])
GAMESTATE = new GameState;
// This requires PREFSMAN, for PREFSMAN->m_bShowLoadingWindow.
LoadingWindow *pLoadingWindow = NULL;
switch( runmode )
{
case RunMode_Normal:
pLoadingWindow = LoadingWindow::Create();
if( pLoadingWindow == NULL )
RageException::Throw( "%s", COULDNT_OPEN_LOADING_WINDOW.GetValue().c_str() );
break;
default:
; // no loading window for other RunModes
}
LoadingWindow *pLoadingWindow = LoadingWindow::Create();
if(pLoadingWindow == NULL)
RageException::Throw("%s", COULDNT_OPEN_LOADING_WINDOW.GetValue().c_str());
srand( time(NULL) ); // seed number generator
@@ -1091,36 +1068,7 @@ int main(int argc, char* argv[])
// Switch to the last used game type, and set up the theme and announcer.
SwitchToLastPlayedGame();
// Handle special RunModes. Some of these depend on ThemeManager being loaded above in SwitchToLastPlayedGame.
switch( runmode )
{
DEFAULT_FAIL( runmode );
case RunMode_Normal:
break;
case RunMode_Install:
case RunMode_ExportNsisStrings:
case RunMode_ExportLuaInformation:
case RunMode_DisplayVersion:
THEME->SwitchThemeAndLanguage( "default", PREFSMAN->m_sLanguage, PREFSMAN->m_bPseudoLocalize );
switch( runmode )
{
DEFAULT_FAIL( runmode );
case RunMode_Install:
CommandLineActions::Install();
break;
case RunMode_ExportNsisStrings:
CommandLineActions::Nsis();
break;
case RunMode_ExportLuaInformation:
CommandLineActions::LuaInformation();
break;
case RunMode_DisplayVersion:
CommandLineActions::Version();
break;
};
exit(0);
}
CommandLineActions::Handle(pLoadingWindow);
{
/* Now that THEME is loaded, load the icon for the current theme into
+1
View File
@@ -13,6 +13,7 @@ namespace StepMania
void ResetPreferences();
void ResetGame();
RString GetInitialScreen();
RString GetSelectMusicScreen();
void ChangeCurrentGame( const Game* g );
// If successful, return filename of screenshot in sDir, else return ""
+3 -5
View File
@@ -32,11 +32,9 @@ public:
*/
virtual RString GetMachineId() const { return RString(); }
/*
* If this is a second instance, return true. Optionally, give focus to the existing
* window.
*/
virtual bool CheckForMultipleInstances() { return false; }
/* If this is a second instance, return true.
* Optionally, give focus to the existing window. */
virtual bool CheckForMultipleInstances(int argc, char* argv[]) { return false; }
virtual void SetTime( tm newtime ) { }
+16 -1
View File
@@ -92,7 +92,7 @@ RString ArchHooks_Win32::GetMachineId() const
return RString();
}
bool ArchHooks_Win32::CheckForMultipleInstances()
bool ArchHooks_Win32::CheckForMultipleInstances(int argc, char* argv[])
{
if( !g_bIsMultipleInstance )
return false;
@@ -117,6 +117,21 @@ bool ArchHooks_Win32::CheckForMultipleInstances()
SetForegroundWindow( data.hResult );
else
SetForegroundWindow( hWnd );
// Send the command line to the existing window.
vector<RString> vsArgs;
for( int i=0; i<argc; i++ )
vsArgs.push_back( argv[i] );
RString sAllArgs = join("|", vsArgs);
COPYDATASTRUCT cds;
cds.dwData = 0;
cds.cbData = sAllArgs.size();
cds.lpData = (void*)sAllArgs.data();
SendMessage(
(HWND)hWnd, // HWND hWnd = handle of destination window
WM_COPYDATA,
(WPARAM)NULL, // HANDLE OF SENDING WINDOW
(LPARAM)&cds ); // 2nd msg parameter = pointer to COPYDATASTRUCT
}
return true;
+1 -1
View File
@@ -13,7 +13,7 @@ public:
void DumpDebugInfo();
void RestartProgram();
RString GetMachineId() const;
bool CheckForMultipleInstances();
bool CheckForMultipleInstances(int argc, char* argv[]);
void SetTime( tm newtime );
+71 -3
View File
@@ -6,15 +6,59 @@
#endif
#include "RageUtil.h"
#include "RageLog.h"
#include "arch/arch.h"
#include "RageThreads.h"
#if !defined(SMPACKAGE)
static Preference<RString> g_sIgnoredDialogs( "IgnoredDialogs", "" );
#endif
#include "Selector_Dialog.h"
DialogDriver *MakeDialogDriver()
{
RString sDrivers = "win32,cocoa,null";
vector<RString> asDriversToTry;
split( sDrivers, ",", asDriversToTry, true );
ASSERT( asDriversToTry.size() != 0 );
RString sDriver;
DialogDriver *pRet = NULL;
for( unsigned i = 0; pRet == NULL && i < asDriversToTry.size(); ++i )
{
sDriver = asDriversToTry[i];
#ifdef USE_DIALOG_DRIVER_COCOA
if( !asDriversToTry[i].CompareNoCase("Cocoa") ) pRet = new DialogDriver_Cocoa;
#endif
#ifdef USE_DIALOG_DRIVER_WIN32
if( !asDriversToTry[i].CompareNoCase("Win32") ) pRet = new DialogDriver_Win32;
#endif
#ifdef USE_DIALOG_DRIVER_NULL
if( !asDriversToTry[i].CompareNoCase("Null") ) pRet = new DialogDriver_Null;
#endif
if( pRet == NULL )
{
continue;
}
RString sError = pRet->Init();
if( sError != "" )
{
if( LOG )
LOG->Info( "Couldn't load driver %s: %s", asDriversToTry[i].c_str(), sError.c_str() );
SAFE_DELETE( pRet );
}
}
return pRet;
}
static DialogDriver *g_pImpl = NULL;
static DialogDriver_Null g_NullDriver;
static bool g_bWindowed = true; // Start out true so that we'll show errors before DISPLAY is init'd.
static bool g_bWindowed = true; // Start out true so that we'll show errors before DISPLAY is init'd.
static bool DialogsEnabled()
{
@@ -28,7 +72,7 @@ void Dialog::Init()
g_pImpl = DialogDriver::Create();
/* DialogDriver_Null should have worked, at least. */
// DialogDriver_Null should have worked, at least.
ASSERT( g_pImpl != NULL );
}
@@ -52,7 +96,7 @@ static bool MessageIsIgnored( RString sID )
void Dialog::IgnoreMessage( RString sID )
{
/* We can't ignore messages before PREFSMAN is around. */
// We can't ignore messages before PREFSMAN is around.
#if !defined(SMPACKAGE)
if( PREFSMAN == NULL )
{
@@ -118,6 +162,30 @@ void Dialog::OK( RString sMessage, RString sID )
RageThread::SetIsShowingDialog( false );
}
Dialog::Result Dialog::OKCancel( RString sMessage, RString sID )
{
Dialog::Init();
if( LOG )
LOG->Trace( "Dialog: \"%s\" [%s]", sMessage.c_str(), sID.c_str() );
if( sID != "" && MessageIsIgnored(sID) )
return g_NullDriver.OKCancel( sMessage, sID );
RageThread::SetIsShowingDialog( true );
// only show Dialog if windowed
Dialog::Result ret;
if( DialogsEnabled() )
ret = g_pImpl->OKCancel( sMessage, sID ); // call derived version
else
ret = g_NullDriver.OKCancel( sMessage, sID );
RageThread::SetIsShowingDialog( false );
return ret;
}
Dialog::Result Dialog::AbortRetryIgnore( RString sMessage, RString sID )
{
Dialog::Init();
+2 -1
View File
@@ -10,9 +10,10 @@ namespace Dialog
void SetWindowed( bool bWindowed );
enum Result { abort, retry, ignore };
enum Result { ok, cancel, abort, retry, ignore };
void Error( RString sError, RString sID = "" );
void OK( RString sMessage, RString sID = "" );
Result OKCancel( RString sMessage, RString sID = "" );
Result AbortRetryIgnore( RString sMessage, RString sID = "" );
Result AbortRetry( RString sMessage, RString sID = "" );
+6 -6
View File
@@ -8,7 +8,7 @@ RegisterDialogDriver::RegisterDialogDriver( const istring &sName, CreateDialogDr
{
if( g_pRegistrees == NULL )
g_pRegistrees = new map<istring, CreateDialogDriverFn>;
ASSERT( g_pRegistrees->find(sName) == g_pRegistrees->end() );
(*g_pRegistrees)[sName] = pfn;
}
@@ -20,20 +20,20 @@ DialogDriver *DialogDriver::Create()
RString sDrivers = "win32,macosx,null";
vector<RString> asDriversToTry;
split( sDrivers, ",", asDriversToTry, true );
ASSERT( asDriversToTry.size() != 0 );
FOREACH_CONST( RString, asDriversToTry, Driver )
{
map<istring, CreateDialogDriverFn>::const_iterator iter = RegisterDialogDriver::g_pRegistrees->find( istring(*Driver) );
if( iter == RegisterDialogDriver::g_pRegistrees->end() )
continue;
DialogDriver *pRet = (iter->second)();
DEBUG_ASSERT( pRet );
const RString sError = pRet->Init();
if( sError.empty() )
return pRet;
if( LOG )
+2 -1
View File
@@ -11,6 +11,7 @@ public:
virtual void Error( RString sMessage, RString sID ) { printf("Error: %s\n", sMessage.c_str()); }
virtual void OK( RString sMessage, RString sID ) {}
virtual Dialog::Result OKCancel( RString sMessage, RString sID ) { return Dialog::ok; }
virtual Dialog::Result AbortRetryIgnore( RString sMessage, RString sID ) { return Dialog::ignore; }
virtual Dialog::Result AbortRetry( RString sMessage, RString sID ) { return Dialog::abort; }
@@ -18,6 +19,7 @@ public:
virtual ~DialogDriver() { }
};
class DialogDriver_Null : public DialogDriver { };
#define USE_DIALOG_DRIVER_NULL
typedef DialogDriver *(*CreateDialogDriverFn)();
struct RegisterDialogDriver
@@ -28,7 +30,6 @@ struct RegisterDialogDriver
#define REGISTER_DIALOG_DRIVER_CLASS( name ) \
static RegisterDialogDriver register_##name( #name, CreateClass<DialogDriver_##name, DialogDriver> )
#endif
/*
+1
View File
@@ -11,6 +11,7 @@ public:
Dialog::Result AbortRetryIgnore( RString sMessage, RString sID );
Dialog::Result AbortRetry( RString sMessage, RString sID );
};
#define USE_DIALOG_DRIVER_COCOA
#endif
+27 -3
View File
@@ -57,7 +57,7 @@ static BOOL CALLBACK OKWndProc( HWND hWnd, UINT msg, WPARAM wParam, LPARAM lPara
SetWindowText( GetDlgItem(hWnd, IDC_MESSAGE), sMessage );
// Focus is on any of the controls in the dialog by default.
// I'm not sure why. Set focus to the button manually. -Chris
// I'm not sure why. Set focus to the button manually. -Chris
SetFocus( GetDlgItem(hWnd, IDOK) );
}
break;
@@ -72,7 +72,7 @@ static BOOL CALLBACK OKWndProc( HWND hWnd, UINT msg, WPARAM wParam, LPARAM lPara
{
case IDOK:
g_bHush = !!IsDlgButtonChecked( hWnd, IDC_HUSH );
/* fall through */
// fall through
case IDCANCEL:
EndDialog( hWnd, 0 );
break;
@@ -112,6 +112,30 @@ void DialogDriver_Win32::OK( RString sMessage, RString sID )
Dialog::IgnoreMessage( sID );
}
Dialog::Result DialogDriver_Win32::OKCancel( RString sMessage, RString sID )
{
g_bAllowHush = sID != "";
g_sMessage = sMessage;
AppInstance handle;
#if !defined(SMPACKAGE)
//DialogBox( handle.Get(), MAKEINTRESOURCE(IDD_OK), ::GetHwnd(), OKWndProc );
int result = ::MessageBox( NULL, sMessage, GetWindowTitle(), MB_OKCANCEL );
#else
int result = ::AfxMessageBox( ConvertUTF8ToACP(sMessage).c_str(), MB_OKCANCEL, 0 );
#endif
if( g_bAllowHush && g_bHush )
Dialog::IgnoreMessage( sID );
switch( result )
{
case IDOK:
return Dialog::ok;
default:
return Dialog::cancel;
}
}
#if !defined(SMPACKAGE)
static RString g_sErrorString;
@@ -159,7 +183,7 @@ static BOOL CALLBACK ErrorWndProc( HWND hWnd, UINT msg, WPARAM wParam, LPARAM lP
break;
case IDC_BUTTON_RESTART:
Win32RestartProgram();
/* not reached */
// not reached
ASSERT( 0 );
EndDialog( hWnd, 0 );
break;
+1
View File
@@ -8,6 +8,7 @@ class DialogDriver_Win32: public DialogDriver
public:
void Error( RString sMessage, RString sID );
void OK( RString sMessage, RString sID );
Dialog::Result OKCancel( RString sMessage, RString sID );
Dialog::Result AbortRetryIgnore( RString sMessage, RString sID );
Dialog::Result AbortRetry( RString sMessage, RString sID );
};
+41
View File
@@ -0,0 +1,41 @@
#ifndef SELECTOR_DIALOG
#define SELECTOR_DIALOG
#include "arch/arch_platform.h"
// Dialog drivers selector.
#if defined(WIN32)
#include "DialogDriver_Win32.h"
#elif defined(MACOSX)
#include "DialogDriver_Cocoa.h"
#endif
#include "DialogDriver.h" // DialogDriver_Null is in here
#endif
/*
* (c) 2005 Ben Anderson.
* All rights reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, and/or sell copies of the Software, and to permit persons to
* whom the Software is furnished to do so, provided that the above
* copyright notice(s) and this permission notice appear in all copies of
* the Software and that both the above copyright notice(s) and this
* permission notice appear in supporting documentation.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF
* THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS
* INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT
* OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
* OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
* OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
+3 -4
View File
@@ -11,7 +11,7 @@ LoadingWindow *LoadingWindow::Create()
#if defined(UNIX) && !defined(HAVE_GTK)
return new LoadingWindow_Null;
#endif
/* Don't load NULL by default. */
// Don't load NULL by default.
const RString drivers = "xbox,win32,macosx,gtk";
vector<RString> DriversToTry;
split( drivers, ",", DriversToTry, true );
@@ -39,7 +39,6 @@ LoadingWindow *LoadingWindow::Create()
#endif
if( !DriversToTry[i].CompareNoCase("Null") ) ret = new LoadingWindow_Null;
if( ret == NULL )
continue;
@@ -50,10 +49,10 @@ LoadingWindow *LoadingWindow::Create()
SAFE_DELETE( ret );
}
}
if( ret )
LOG->Info( "Loading window: %s", Driver.c_str() );
return ret;
}
@@ -7,7 +7,7 @@
#import "arch/ArchHooks/ArchHooks.h"
#import <Cocoa/Cocoa.h>
#import <OpenGl/OpenGl.h>
#import <OpenGL/OpenGL.h>
#import <OpenGL/gl.h>
#import <mach-o/dyld.h>
+4 -45
View File
@@ -22,7 +22,6 @@ BOOL CALLBACK DSound::EnumCallback( LPGUID lpGuid, LPCSTR lpcstrDescription, LPC
{
sLine += ssprintf( " %s", lpcstrModule );
#ifndef _XBOX
RString sPath = FindSystemFile( lpcstrModule );
if( sPath != "" )
{
@@ -30,7 +29,6 @@ BOOL CALLBACK DSound::EnumCallback( LPGUID lpGuid, LPCSTR lpcstrDescription, LPC
if( GetFileVersion(sPath, sVersion) )
sLine += ssprintf( " %s", sVersion.c_str() );
}
#endif
}
LOG->Info( "%s", sLine.c_str() );
@@ -40,7 +38,6 @@ BOOL CALLBACK DSound::EnumCallback( LPGUID lpGuid, LPCSTR lpcstrDescription, LPC
void DSound::SetPrimaryBufferMode()
{
#ifndef _XBOX
DSBUFFERDESC format;
memset( &format, 0, sizeof(format) );
format.dwSize = sizeof(format);
@@ -96,7 +93,6 @@ void DSound::SetPrimaryBufferMode()
// pBuffer->Play( 0, 0, DSBPLAY_LOOPING );
pBuffer->Release();
#endif
}
DSound::DSound()
@@ -113,7 +109,6 @@ RString DSound::Init()
if( FAILED( hr = DirectSoundCreate(NULL, &m_pDS, NULL) ) )
return hr_ssprintf( hr, "DirectSoundCreate" );
#ifndef _XBOX
static bool bShownInfo = false;
if( !bShownInfo )
{
@@ -136,7 +131,6 @@ RString DSound::Init()
/* Try to set primary mixing privileges */
hr = m_pDS->SetCooperativeLevel( GetDesktopWindow(), DSSCL_PRIORITY );
#endif
SetPrimaryBufferMode();
@@ -152,7 +146,6 @@ DSound::~DSound()
bool DSound::IsEmulated() const
{
#ifndef _XBOX
/* Don't bother wasting time trying to create buffers if we're
* emulated. This also gives us better diagnostic information. */
DSCAPS Caps;
@@ -166,9 +159,6 @@ bool DSound::IsEmulated() const
}
return !!(Caps.dwFlags & DSCAPS_EMULDRIVER);
#else
return false;
#endif
}
DSoundBuf::DSoundBuf()
@@ -220,45 +210,21 @@ RString DSoundBuf::Init( DSound &ds, DSoundBuf::hw hardware,
DSBUFFERDESC format;
memset( &format, 0, sizeof(format) );
format.dwSize = sizeof(format);
#ifdef _XBOX
format.dwFlags = 0;
#else
format.dwFlags = DSBCAPS_GETCURRENTPOSITION2 | DSBCAPS_GLOBALFOCUS | DSBCAPS_CTRLVOLUME;
#endif
#ifndef _XBOX
/* Don't use DSBCAPS_STATIC. It's meant for static buffers, and we
* only use streaming buffers. */
if( hardware == HW_HARDWARE )
format.dwFlags |= DSBCAPS_LOCHARDWARE;
else
format.dwFlags |= DSBCAPS_LOCSOFTWARE;
#endif
if( bNeedCtrlFrequency )
format.dwFlags |= DSBCAPS_CTRLFREQUENCY;
format.dwBufferBytes = m_iBufferSize;
#ifndef _XBOX
format.dwReserved = 0;
#else
DSMIXBINVOLUMEPAIR dsmbvp[8] =
{
{ DSMIXBIN_FRONT_LEFT, DSBVOLUME_MAX }, // left channel
{ DSMIXBIN_FRONT_RIGHT, DSBVOLUME_MAX }, // right channel
{ DSMIXBIN_FRONT_CENTER, DSBVOLUME_MAX }, // left channel
{ DSMIXBIN_FRONT_CENTER, DSBVOLUME_MAX }, // right channel
{ DSMIXBIN_BACK_LEFT, DSBVOLUME_MAX }, // left channel
{ DSMIXBIN_BACK_RIGHT, DSBVOLUME_MAX }, // right channel
{ DSMIXBIN_LOW_FREQUENCY, DSBVOLUME_MAX }, // left channel
{ DSMIXBIN_LOW_FREQUENCY, DSBVOLUME_MAX } // right channel
};
DSMIXBINS dsmb;
dsmb.dwMixBinCount = 8;
dsmb.lpMixBinVolumePairs = dsmbvp;
format.lpMixBins = &dsmb;
#endif
format.dwReserved = 0;
format.lpwfxFormat = &waveformat;
@@ -266,7 +232,6 @@ RString DSoundBuf::Init( DSound &ds, DSoundBuf::hw hardware,
if( FAILED(hr) )
return hr_ssprintf( hr, "CreateSoundBuffer failed (%i hz)", m_iSampleBits );
#ifndef _XBOX
/* I'm not sure this should ever be needed, but ... */
DSBCAPS bcaps;
bcaps.dwSize=sizeof(bcaps);
@@ -291,8 +256,7 @@ RString DSoundBuf::Init( DSound &ds, DSoundBuf::hw hardware,
LOG->Warn( hr_ssprintf(hr, "GetFormat on secondary buffer") );
else if( (int) waveformat.nSamplesPerSec != m_iSampleRate )
LOG->Warn( "Secondary buffer set to %i instead of %i", waveformat.nSamplesPerSec, m_iSampleRate );
#endif
m_pTempBuffer = new char[m_iBufferSize];
return RString();
@@ -456,7 +420,6 @@ bool DSoundBuf::get_output_buf( char **pBuffer, unsigned *pBufferSize, int iChun
/* It's easiest to think of the cursor as a block, starting and ending at
* the two values returned by GetCurrentPosition, that we can't write to. */
result = m_pBuffer->GetCurrentPosition( &iCursorStart, &iCursorEnd );
#ifndef _XBOX
if( result == DSERR_BUFFERLOST )
{
m_pBuffer->Restore();
@@ -467,7 +430,6 @@ bool DSoundBuf::get_output_buf( char **pBuffer, unsigned *pBufferSize, int iChun
LOG->Warn( hr_ssprintf(result, "DirectSound::GetCurrentPosition failed") );
return false;
}
#endif
memmove( &m_iLastCursors[0][0], &m_iLastCursors[1][0], sizeof(int)*6 );
m_iLastCursors[3][0] = iCursorStart;
@@ -552,13 +514,12 @@ bool DSoundBuf::get_output_buf( char **pBuffer, unsigned *pBufferSize, int iChun
/* Lock the audio buffer. */
result = m_pBuffer->Lock( m_iWriteCursor, iNumBytesEmpty, (LPVOID *) &m_pLockedBuf1, (DWORD *) &m_iLockedSize1, (LPVOID *) &m_pLockedBuf2, (DWORD *) &m_iLockedSize2, 0 );
#ifndef _XBOX
if( result == DSERR_BUFFERLOST )
{
m_pBuffer->Restore();
result = m_pBuffer->Lock( m_iWriteCursor, iNumBytesEmpty, (LPVOID *) &m_pLockedBuf1, (DWORD *) &m_iLockedSize1, (LPVOID *) &m_pLockedBuf2, (DWORD *) &m_iLockedSize2, 0 );
}
#endif
if( result != DS_OK )
{
LOG->Warn( hr_ssprintf(result, "Couldn't lock the DirectSound buffer.") );
@@ -593,7 +554,6 @@ int64_t DSoundBuf::GetPosition() const
DWORD iCursor, iJunk;
HRESULT hr = m_pBuffer->GetCurrentPosition( &iCursor, &iJunk );
#ifndef _XBOX
if( hr == DSERR_BUFFERLOST )
{
m_pBuffer->Restore();
@@ -604,7 +564,6 @@ int64_t DSoundBuf::GetPosition() const
LOG->Warn( hr_ssprintf(hr, "DirectSound::GetPosition failed") );
iCursor = 0;
}
#endif
/* This happens occasionally on "Realtek AC97 Audio". */
if( (int) iCursor == m_iBufferSize )
+334
View File
@@ -0,0 +1,334 @@
/*
* This file provides functions to create driver objects.
*/
#include "global.h"
#include "RageLog.h"
#include "RageUtil.h"
#include "PrefsManager.h"
#include "arch.h"
#include "arch_platform.h"
#include "Foreach.h"
#include "LocalizedString.h"
#include "arch/arch_default.h"
#include "InputHandler/Selector_InputHandler.h"
static LocalizedString INPUT_HANDLERS_EMPTY( "Arch", "Input Handlers cannot be empty." );
void MakeInputHandlers( const RString &drivers, vector<InputHandler *> &Add )
{
vector<RString> DriversToTry;
split( drivers, ",", DriversToTry, true );
if( DriversToTry.empty() )
RageException::Throw( INPUT_HANDLERS_EMPTY.GetValue() );
RString Driver;
FOREACH_CONST( RString, DriversToTry, s )
{
InputHandler *ret = NULL;
#ifdef USE_INPUT_HANDLER_DIRECTINPUT
if( !s->CompareNoCase("DirectInput") ) ret = new InputHandler_DInput;
#endif
#ifdef USE_INPUT_HANDLER_LINUX_JOYSTICK
if( !s->CompareNoCase("Joystick") ) ret = new InputHandler_Linux_Joystick;
#endif
#ifdef USE_INPUT_HANDLER_LINUX_TTY
if( !s->CompareNoCase("tty") ) ret = new InputHandler_Linux_tty;
#endif
#ifdef USE_INPUT_HANDLER_SDL
if( !s->CompareNoCase("SDL") ) ret = new InputHandler_SDL;
#endif
#ifdef USE_INPUT_HANDLER_WIN32_PARA
if( !s->CompareNoCase("Para") ) ret = new InputHandler_Win32_Para;
#endif
#ifdef USE_INPUT_HANDLER_WIN32_PUMP
if( !s->CompareNoCase("Pump") ) ret = new InputHandler_Win32_Pump;
#endif
#ifdef USE_INPUT_HANDLER_WIN32_MIDI
if( !s->CompareNoCase("MIDI") ) ret = new InputHandler_Win32_MIDI;
#endif
#ifdef USE_INPUT_HANDLER_X11
if( !s->CompareNoCase("X11") ) ret = new InputHandler_X11;
#endif
#ifdef USE_INPUT_HANDLER_XBOX
if( !s->CompareNoCase("Xbox") ) ret = new InputHandler_Xbox;
#endif
#ifdef USE_INPUT_HANDLER_MACOSX_HID
if( !s->CompareNoCase("MacOSX") ) ret = new InputHandler_MacOSX_HID;
#endif
if( ret == NULL )
LOG->Trace( "Unknown Input Handler name: %s", s->c_str() );
else
Add.push_back( ret );
}
// Always add
Add.push_back( new InputHandler_MonkeyKeyboard );
}
#include "Lights/Selector_LightsDriver.h"
void MakeLightsDrivers( const RString &driver, vector<LightsDriver *> &Add )
{
LOG->Trace( "Initializing lights driver: %s", driver.c_str() );
LightsDriver *ret = NULL;
#ifdef USE_LIGHTS_DRIVER_LINUX_PARALLEL
if( !driver.CompareNoCase("LinuxParallel") ) ret = new LightsDriver_LinuxParallel;
#endif
#ifdef USE_LIGHTS_DRIVER_LINUX_WEEDTECH
if( !driver.CompareNoCase("WeedTech") ) ret = new LightsDriver_LinuxWeedTech;
#endif
#ifdef USE_LIGHTS_DRIVER_WIN32_PARALLEL
if( !driver.CompareNoCase("Parallel") ) ret = new LightsDriver_Win32Parallel;
#endif
if( ret == NULL && driver.CompareNoCase("Null") )
LOG->Trace( "Unknown lights driver name: %s", driver.c_str() );
else if( ret != NULL )
Add.push_back( ret );
Add.push_back( new LightsDriver_SystemMessage );
}
#include "LoadingWindow/Selector_LoadingWindow.h"
LoadingWindow *MakeLoadingWindow()
{
if( !PREFSMAN->m_bShowLoadingWindow )
return new LoadingWindow_Null;
#if defined(LINUX) && !defined(HAVE_GTK)
return new LoadingWindow_Null;
#endif
// Don't load NULL by default.
const RString drivers = "xbox,win32,cocoa,gtk";
vector<RString> DriversToTry;
split( drivers, ",", DriversToTry, true );
ASSERT( DriversToTry.size() != 0 );
RString Driver;
LoadingWindow *ret = NULL;
for( unsigned i = 0; ret == NULL && i < DriversToTry.size(); ++i )
{
Driver = DriversToTry[i];
#ifdef USE_LOADING_WINDOW_COCOA
if( !DriversToTry[i].CompareNoCase("Cocoa") ) ret = new LoadingWindow_Cocoa;
#endif
#ifdef USE_LOADING_WINDOW_GTK
if( !DriversToTry[i].CompareNoCase("Gtk") ) ret = new LoadingWindow_Gtk;
#endif
#ifdef USE_LOADING_WINDOW_NULL
if( !DriversToTry[i].CompareNoCase("Null") ) ret = new LoadingWindow_Null;
#endif
#ifdef USE_LOADING_WINDOW_WIN32
if( !DriversToTry[i].CompareNoCase("Win32") ) ret = new LoadingWindow_Win32;
#endif
#ifdef USE_LOADING_WINDOW_XBOX
if( !DriversToTry[i].CompareNoCase("Xbox") ) ret = new LoadingWindow_Xbox;
#endif
if( ret == NULL )
continue;
RString sError = ret->Init();
if( sError != "" )
{
LOG->Info( "Couldn't load driver %s: %s", DriversToTry[i].c_str(), sError.c_str() );
SAFE_DELETE( ret );
}
}
if(ret)
LOG->Info( "Loading window: %s", Driver.c_str() );
return ret;
}
#if defined(SUPPORT_OPENGL)
#include "LowLevelWindow/Selector_LowLevelWindow.h"
LowLevelWindow *MakeLowLevelWindow()
{
return new ARCH_LOW_LEVEL_WINDOW;
}
#endif
#include "MemoryCard/MemoryCardDriver_Null.h"
#include "MemoryCard/Selector_MemoryCardDriver.h"
MemoryCardDriver *MakeMemoryCardDriver()
{
MemoryCardDriver *ret = NULL;
#ifdef ARCH_MEMORY_CARD_DRIVER
ret = new ARCH_MEMORY_CARD_DRIVER;
#endif
if( !ret )
ret = new MemoryCardDriver_Null;
return ret;
}
static Preference<RString> g_sMovieDrivers( "MovieDrivers", "" ); // "" == default
#include "MovieTexture/Selector_MovieTexture.h"
static void DumpAVIDebugInfo( const RString& fn );
// Try drivers in order of preference until we find one that works.
static LocalizedString MOVIE_DRIVERS_EMPTY ( "Arch", "Movie Drivers cannot be empty." );
static LocalizedString COULDNT_CREATE_MOVIE_DRIVER ( "Arch", "Couldn't create a movie driver." );
RageMovieTexture *MakeRageMovieTexture( RageTextureID ID )
{
DumpAVIDebugInfo( ID.filename );
RString sDrivers = g_sMovieDrivers;
if( sDrivers.empty() )
sDrivers = DEFAULT_MOVIE_DRIVER_LIST;
vector<RString> DriversToTry;
split( sDrivers, ",", DriversToTry, true );
if( DriversToTry.empty() )
RageException::Throw( MOVIE_DRIVERS_EMPTY.GetValue() );
RString Driver;
RageMovieTexture *ret = NULL;
for( unsigned i=0; ret==NULL && i<DriversToTry.size(); ++i )
{
Driver = DriversToTry[i];
LOG->Trace( "Initializing driver: %s", Driver.c_str() );
#ifdef USE_MOVIE_TEXTURE_THEORA
if( !Driver.CompareNoCase("Theora") ) ret = new MovieTexture_Theora(ID);
#endif
#ifdef USE_MOVIE_TEXTURE_DSHOW
if( !Driver.CompareNoCase("DShow") ) ret = new MovieTexture_DShow(ID);
#endif
#ifdef USE_MOVIE_TEXTURE_FFMPEG
if( !Driver.CompareNoCase("FFMpeg") ) ret = new MovieTexture_FFMpeg(ID);
#endif
#ifdef USE_MOVIE_TEXTURE_NULL
if( !Driver.CompareNoCase("Null") ) ret = new MovieTexture_Null(ID);
#endif
if( ret == NULL )
{
LOG->Trace( "Unknown movie driver name: %s", Driver.c_str() );
continue;
}
RString sError = ret->Init();
if( sError != "" )
{
LOG->Info( "Couldn't load driver %s: %s", Driver.c_str(), sError.c_str() );
SAFE_DELETE( ret );
}
}
if ( !ret )
RageException::Throw( COULDNT_CREATE_MOVIE_DRIVER.GetValue() );
LOG->Trace( "Created movie texture \"%s\" with driver \"%s\"",
ID.filename.c_str(), Driver.c_str() );
return ret;
}
#include "Sound/Selector_RageSoundDriver.h"
static LocalizedString SOUND_DRIVERS_CANNOT_EMPTY( "Arch", "Sound Drivers cannot be empty." );
RageSoundDriver *MakeRageSoundDriver( const RString &drivers )
{
vector<RString> DriversToTry;
split( drivers, ",", DriversToTry, true );
if( DriversToTry.empty() )
RageException::Throw( SOUND_DRIVERS_CANNOT_EMPTY.GetValue() );
RString Driver;
RageSoundDriver *ret = NULL;
for( unsigned i = 0; ret == NULL && i < DriversToTry.size(); ++i )
{
Driver = DriversToTry[i];
LOG->Trace( "Initializing driver: %s", DriversToTry[i].c_str() );
#ifdef USE_RAGE_SOUND_ALSA9
if( !DriversToTry[i].CompareNoCase("ALSA") ) ret = new RageSound_ALSA9;
#endif
#ifdef USE_RAGE_SOUND_ALSA9_SOFTWARE
if( !DriversToTry[i].CompareNoCase("ALSA-sw") ) ret = new RageSound_ALSA9_Software;
#endif
#ifdef USE_RAGE_SOUND_AU
if( !DriversToTry[i].CompareNoCase("AudioUnit") ) ret = new RageSoundDriver_AU;
#endif
#ifdef USE_RAGE_SOUND_DSOUND
if( !DriversToTry[i].CompareNoCase("DirectSound") ) ret = new RageSound_DSound;
#endif
#ifdef USE_RAGE_SOUND_DSOUND_SOFTWARE
if( !DriversToTry[i].CompareNoCase("DirectSound-sw") ) ret = new RageSound_DSound_Software;
#endif
#ifdef USE_RAGE_SOUND_NULL
if( !DriversToTry[i].CompareNoCase("Null") ) ret = new RageSound_Null;
#endif
#ifdef USE_RAGE_SOUND_OSS
if( !DriversToTry[i].CompareNoCase("OSS") ) ret = new RageSound_OSS;
#endif
#ifdef USE_RAGE_SOUND_WAVE_OUT
if( !DriversToTry[i].CompareNoCase("WaveOut") ) ret = new RageSound_WaveOut;
#endif
if( ret == NULL )
{
LOG->Trace( "Unknown sound driver name: %s", DriversToTry[i].c_str() );
continue;
}
RString sError = ret->Init();
if( sError != "" )
{
LOG->Info( "Couldn't load driver %s: %s", DriversToTry[i].c_str(), sError.c_str() );
SAFE_DELETE( ret );
}
}
if( ret )
LOG->Info( "Sound driver: %s", Driver.c_str() );
return ret;
}
// Helper for MakeRageMovieTexture()
static void DumpAVIDebugInfo( const RString& fn )
{
RString type, handler;
if( !RageMovieTexture::GetFourCC( fn, handler, type ) )
return;
LOG->Trace( "Movie %s has handler '%s', type '%s'", fn.c_str(), handler.c_str(), type.c_str() );
}
/*
* (c) 2002-2005 Glenn Maynard, Ben Anderson
* All rights reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, and/or sell copies of the Software, and to permit persons to
* whom the Software is furnished to do so, provided that the above
* copyright notice(s) and this permission notice appear in all copies of
* the Software and that both the above copyright notice(s) and this
* permission notice appear in supporting documentation.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF
* THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS
* INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT
* OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
* OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
* OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
+71
View File
@@ -0,0 +1,71 @@
#ifndef ARCH_H
#define ARCH_H
#include "RageTextureID.h"
// Put renderers switch here, makes things cleaner
#if defined(_WINDOWS)
#define SUPPORT_OPENGL
#define SUPPORT_D3D
#elif defined(_XBOX)
#define SUPPORT_D3D
#else
#define SUPPORT_OPENGL
#endif
// Include this file if you need to create an instance of a driver object.
class ArchHooks;
ArchHooks *MakeArchHooks();
class DialogDriver;
DialogDriver *MakeDialogDriver();
class InputHandler;
void MakeInputHandlers( const RString &drivers, vector<InputHandler *> &Add );
class LightsDriver;
void MakeLightsDrivers( const RString &drivers, vector<LightsDriver *> &Add );
class LoadingWindow;
LoadingWindow *MakeLoadingWindow();
#if defined(SUPPORT_OPENGL)
class LowLevelWindow;
LowLevelWindow *MakeLowLevelWindow();
#endif
class MemoryCardDriver;
MemoryCardDriver *MakeMemoryCardDriver();
class RageMovieTexture;
RageMovieTexture *MakeRageMovieTexture( RageTextureID ID );
class RageSoundDriver;
RageSoundDriver *MakeRageSoundDriver( const RString &drivers );
#endif
/*
* (c) 2002-2005 Glenn Maynard, Ben Anderson
* All rights reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, and/or sell copies of the Software, and to permit persons to
* whom the Software is furnished to do so, provided that the above
* copyright notice(s) and this permission notice appear in all copies of
* the Software and that both the above copyright notice(s) and this
* permission notice appear in supporting documentation.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF
* THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS
* INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT
* OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
* OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
* OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
+36
View File
@@ -0,0 +1,36 @@
#ifndef ARCH_PLATFORM_H
#define ARCH_PLATFORM_H
// In here, you define which APIs are guaranteed to be available on which OSes.
// Don't ever actually #include anything here -- that's for */Selector_*.h.
#if defined(_WINDOWS)
#define HAVE_DIRECTX
#define HAVE_FFMPEG
#endif
#endif
/*
* (c) 2002-2005 Glenn Maynard, Ben Anderson
* All rights reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, and/or sell copies of the Software, and to permit persons to
* whom the Software is furnished to do so, provided that the above
* copyright notice(s) and this permission notice appear in all copies of
* the Software and that both the above copyright notice(s) and this
* permission notice appear in supporting documentation.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF
* THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS
* INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT
* OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
* OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
* OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
+25
View File
@@ -1,6 +1,8 @@
#include "global.h"
#include "RageUtil.h"
#include "RageThreads.h"
#include "RageLog.h"
#include "CommandLineActions.h"
#import <Cocoa/Cocoa.h>
#include "ProductInfo.h"
@@ -69,11 +71,34 @@
exit( SM_main(m_iArgc, m_pArgv) );
}
/* From here:
* http://www.cocoadev.com/index.pl?HowToRegisterURLHandler */
- (void) getUrl:(NSAppleEventDescriptor *)event withReplyEvent:(NSAppleEventDescriptor *)replyEvent
{
const char *url = [[[event paramDescriptorForKeyword:keyDirectObject] stringValue] UTF8String];
LOG->Info("Parsing URL: %s", url);
// I'm not sure this handles everything it needs to. - Colby
CommandLineActions::CommandLineArgs args;
args.argv.push_back(url);
CommandLineActions::ToProcess.push_back(args);
}
// Called when the internal event loop has just started running.
- (void) applicationDidFinishLaunching:(NSNotification *)note
{
m_bApplicationLaunched = YES;
[NSThread detachNewThreadSelector:@selector(startGame:) toTarget:self withObject:nil];
// Register ourselves as a URL handler.
[
[NSAppleEventManager sharedAppleEventManager] setEventHandler:self
andSelector:@selector(getUrl:withReplyEvent:)
forEventClass:kInternetEventClass
andEventID:kAEGetURL
];
}
- (BOOL) application:(NSApplication *)app openFile:(NSString *)file
+32 -34
View File
@@ -311,8 +311,8 @@ namespace SymbolLookup
if( obuf[0] == '_' )
{
strcat( obuf, "()" ); /* _main -> _main() */
return obuf+1; /* _main -> main */
strcat( obuf, "()" ); // _main -> _main()
return obuf+1; // _main -> main
}
return obuf;
@@ -487,7 +487,7 @@ static void DoSave( const RString &sReport )
fclose( pFile );
/* Discourage changing crashinfo.txt. */
// Discourage changing crashinfo.txt.
SetFileAttributes( sName, FILE_ATTRIBUTE_READONLY );
}
@@ -522,15 +522,15 @@ bool ReadCrashDataFromParent( int iFD, CompleteCrashData &Data )
{
_setmode( _fileno(stdin), O_BINARY );
/* 0. Read the parent handle. */
// 0. Read the parent handle.
if( !ReadFromParent(iFD, &SymbolLookup::g_hParent, sizeof(SymbolLookup::g_hParent)) )
return false;
/* 1. Read the CrashData. */
// 1. Read the CrashData.
if( !ReadFromParent(iFD, &Data.m_CrashInfo, sizeof(Data.m_CrashInfo)) )
return false;
/* 2. Read info. */
// 2. Read info.
int iSize;
if( !ReadFromParent(iFD, &iSize, sizeof(iSize)) )
return false;
@@ -540,7 +540,7 @@ bool ReadCrashDataFromParent( int iFD, CompleteCrashData &Data )
return false;
Data.m_sInfo.ReleaseBuffer( iSize );
/* 3. Read AdditionalLog. */
// 3. Read AdditionalLog.
if( !ReadFromParent(iFD, &iSize, sizeof(iSize)) )
return false;
@@ -549,7 +549,7 @@ bool ReadCrashDataFromParent( int iFD, CompleteCrashData &Data )
return false;
Data.m_sAdditionalLog.ReleaseBuffer( iSize );
/* 4. Read RecentLogs. */
// 4. Read RecentLogs.
int iCnt = 0;
if( !ReadFromParent(iFD, &iCnt, sizeof(iCnt)) )
return false;
@@ -565,7 +565,7 @@ bool ReadCrashDataFromParent( int iFD, CompleteCrashData &Data )
sBuf.ReleaseBuffer( iSize );
}
/* 5. Read CHECKPOINTs. */
// 5. Read CHECKPOINTs.
if( !ReadFromParent(iFD, &iSize, sizeof(iSize)) )
return false;
@@ -577,7 +577,7 @@ bool ReadCrashDataFromParent( int iFD, CompleteCrashData &Data )
split( sBuf, "$$", Data.m_asCheckpoints );
sBuf.ReleaseBuffer( iSize );
/* 6. Read the crashed thread's name. */
// 6. Read the crashed thread's name.
if( !ReadFromParent(iFD, &iSize, sizeof(iSize)) )
return false;
pBuf = Data.m_sCrashedThread.GetBuffer( iSize );
@@ -588,13 +588,11 @@ bool ReadCrashDataFromParent( int iFD, CompleteCrashData &Data )
return true;
}
/*
* Localization for the crash handler is different, and a little tricky. We don't
* have ThemeManager loaded, so we have to localize it ourself. We can supply
* translations with our own substitution function. We need to figure out which
* language to use. Since these strings won't be pulled from the theme, defer
* loading them until we use them. XXX
*/
/* Localization for the crash handler is different, and a little tricky. We don't
* have ThemeManager loaded, so we have to localize it ourself. We can supply
* translations with our own substitution function. We need to figure out which
* language to use. Since these strings won't be pulled from the theme, defer
* loading them until we use them. XXX */
static LocalizedString A_CRASH_HAS_OCCURRED;
static LocalizedString REPORTING_THE_PROBLEM;
static LocalizedString CLOSE;
@@ -688,7 +686,7 @@ BOOL CrashDialog::HandleMessage( UINT msg, WPARAM wParam, LPARAM lParam )
HWND hwndStatic = (HWND)lParam;
HBRUSH hbr = NULL;
// TODO: Change any attributes of the DC here
// TODO: Change any attributes of the DC here
switch( GetDlgCtrlID(hwndStatic) )
{
case IDC_STATIC_HEADER_TEXT:
@@ -699,7 +697,7 @@ BOOL CrashDialog::HandleMessage( UINT msg, WPARAM wParam, LPARAM lParam )
break;
}
// TODO: Return a different brush if the default is not desired
// TODO: Return a different brush if the default is not desired
return (BOOL)hbr;
}
@@ -709,7 +707,7 @@ BOOL CrashDialog::HandleMessage( UINT msg, WPARAM wParam, LPARAM lParam )
case IDC_BUTTON_CLOSE:
if( m_pPost != NULL )
{
/* Cancel reporting, and revert the dialog as if "report" had not been pressed. */
// Cancel reporting, and revert the dialog as if "report" had not been pressed.
m_pPost->Cancel();
KillTimer( hDlg, 0 );
@@ -718,11 +716,11 @@ BOOL CrashDialog::HandleMessage( UINT msg, WPARAM wParam, LPARAM lParam )
return TRUE;
}
/* Close the dialog. */
// Close the dialog.
EndDialog(hDlg, FALSE);
return TRUE;
case IDOK:
// EndDialog(hDlg, TRUE); /* don't always exit on ENTER */
// EndDialog(hDlg, TRUE); // don't always exit on ENTER
return TRUE;
case IDC_VIEW_LOG:
ViewWithNotepad("../log.txt");
@@ -740,8 +738,8 @@ BOOL CrashDialog::HandleMessage( UINT msg, WPARAM wParam, LPARAM lParam )
case IDC_BUTTON_AUTO_REPORT:
if( !m_sUpdateURL.empty() )
{
/* We already sent the report, were told that there's an update, and
* substituted the URL. */
/* We already sent the report, were told that there's an update,
* and substituted the URL. */
GotoURL( m_sUpdateURL );
break;
}
@@ -753,7 +751,7 @@ BOOL CrashDialog::HandleMessage( UINT msg, WPARAM wParam, LPARAM lParam )
SendDlgItemMessage( hDlg, IDC_PROGRESS, PBM_SETRANGE, 0, MAKELPARAM(0,100) );
SendDlgItemMessage( hDlg, IDC_PROGRESS, PBM_SETPOS, 0, 0 );
/* Create the form data to send. */
// Create the form data to send.
m_pPost = new NetworkPostData;
m_pPost->SetData( "Product", PRODUCT_ID );
m_pPost->SetData( "Version", PRODUCT_VER );
@@ -779,8 +777,8 @@ BOOL CrashDialog::HandleMessage( UINT msg, WPARAM wParam, LPARAM lParam )
{
KillTimer( hDlg, 0 );
/* Grab the result, which is the data output from the HTTP request. It's
* simple XML. */
/* Grab the result, which is the data output from the HTTP request.
* It's simple XML. */
RString sResult = m_pPost->GetResult();
RString sError = m_pPost->GetError();
if( sError.empty() && sResult.empty() )
@@ -803,18 +801,18 @@ BOOL CrashDialog::HandleMessage( UINT msg, WPARAM wParam, LPARAM lParam )
int iID;
if( !sError.empty() )
{
/* On error, don't show the "report" button again. If the submission was actually
/* On error, don't show the "report" button again. If the submission was actually
* successful, then it'd be too easy to accidentally spam the server by holding
* down the button. */
SetWindowText( GetDlgItem(hDlg, IDC_MAIN_TEXT), ERROR_SENDING_REPORT.GetValue() );
}
else if( xml.GetAttrValue("UpdateAvailable", m_sUpdateURL) )
else if( xml.GetChildValue("UpdateAvailable", m_sUpdateURL) )
{
SetWindowText( GetDlgItem(hDlg, IDC_MAIN_TEXT), UPDATE_IS_AVAILABLE.GetValue() );
SetWindowText( GetDlgItem(hDlg, IDC_BUTTON_AUTO_REPORT), VIEW_UPDATE.GetValue() );
ShowWindow( GetDlgItem(hDlg, IDC_BUTTON_AUTO_REPORT), true );
}
else if( xml.GetAttrValue("ReportId", iID) )
else if( xml.GetChildValue("ReportId", iID) )
{
SetWindowText( GetDlgItem(hDlg, IDC_MAIN_TEXT), UPDATE_IS_NOT_AVAILABLE.GetValue() );
}
@@ -823,7 +821,7 @@ BOOL CrashDialog::HandleMessage( UINT msg, WPARAM wParam, LPARAM lParam )
SetWindowText( GetDlgItem(hDlg, IDC_MAIN_TEXT), ERROR_SENDING_REPORT.GetValue() );
}
if( xml.GetAttrValue("ReportId", iID) )
if( xml.GetChildValue("ReportId", iID) )
{
char sBuf[1024];
GetWindowText( hDlg, sBuf, 1024 );
@@ -841,7 +839,7 @@ BOOL CrashDialog::HandleMessage( UINT msg, WPARAM wParam, LPARAM lParam )
void ChildProcess()
{
/* Read the crash data from the crashed parent. */
// Read the crash data from the crashed parent.
CompleteCrashData Data;
ReadCrashDataFromParent( fileno(stdin), Data );
@@ -852,10 +850,10 @@ void ChildProcess()
DoSave( sCrashReport );
/* Tell the crashing process that it can exit. Be sure to write crashinfo.txt first. */
// Tell the crashing process that it can exit. Be sure to write crashinfo.txt first.
fclose( stdout );
/* Now that we've done that, the process is gone. Don't use g_hParent. */
// Now that we've done that, the process is gone. Don't use g_hParent.
CloseHandle( SymbolLookup::g_hParent );
SymbolLookup::g_hParent = NULL;

Some files were not shown because too many files have changed in this diff Show More