From 37f6c81862aa8537f93ace7ca308df097bca8da6 Mon Sep 17 00:00:00 2001 From: Chris Danford Date: Fri, 20 Aug 2004 05:22:46 +0000 Subject: [PATCH] add XSL for Catalog.xml fold CSS into XML --- .../Themes/default/Other/Profile Catalog.xsl | 582 +++++ .../Themes/default/Other/Profile Common.xsl | 364 ++++ .../Themes/default/Other/Profile Stats.xsl | 1875 +++++++++++++++++ stepmania/Themes/default/metrics.ini | 35 +- stepmania/src/CatalogXml.cpp | 154 +- stepmania/src/CatalogXml.h | 1 + stepmania/src/Profile.cpp | 11 +- 7 files changed, 2946 insertions(+), 76 deletions(-) create mode 100644 stepmania/Themes/default/Other/Profile Catalog.xsl create mode 100644 stepmania/Themes/default/Other/Profile Common.xsl create mode 100644 stepmania/Themes/default/Other/Profile Stats.xsl diff --git a/stepmania/Themes/default/Other/Profile Catalog.xsl b/stepmania/Themes/default/Other/Profile Catalog.xsl new file mode 100644 index 0000000000..7374e5539e --- /dev/null +++ b/stepmania/Themes/default/Other/Profile Catalog.xsl @@ -0,0 +1,582 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + Steps + Trail + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + +
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + Details + + + + +

+ Tap Scores + Hold Scores + Stats +

+ + + + + + + +
+
+
+ +
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + , + + + + + + + + + + + + + + + + + + + % + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + true + + + false + + + + + + + + ?Guid= + + + _new + + + + + + + + + + + + + + + + + + + + + valuename + + nowrap + + + +   + + dyndata + + nowrap + + + +     + + + + + + + + + + + + + + + + + + + + + + valuename + + +    + + dyndata + + + + + + + + + + + + + + + + + + + + + + + + + + + + valuename + + +    + + + valuename + + + +    + + dyndata + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +   + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + main + + + + + + + + + + + + + + + + + + + main + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ diff --git a/stepmania/Themes/default/Other/Profile Common.xsl b/stepmania/Themes/default/Other/Profile Common.xsl new file mode 100644 index 0000000000..b1aab501e0 --- /dev/null +++ b/stepmania/Themes/default/Other/Profile Common.xsl @@ -0,0 +1,364 @@ + + + + + + + + + + + + 4 + 1 + 0 + 100% + + + + 2 + 0 + 0 + + + + 3 + 1 + 0 + + + + 0 + 0 + 0 + + + + JavaScript: toggleLinkClicked(event); + JavaScript: return false; + JavaScript: toggleLinkOnMouseOver(event); + JavaScript: toggleLinkOnMouseOut(event); + cursor: hand; + + + + + + + + + + + + + + + + + + + + + + <xsl:value-of select="$Catalog/ProductTitle" /><xsl:text> </xsl:text><xsl:value-of select="$DocName" /> + + + + + + + + + + + + + + + + + + + + + + +
+
+ + + + + + + + + + +
+ + + + + + + button + Internet Ranking + navButton + JavaScript: window.location = ''; + + + + + + button + Upload Stats + navButton + JavaScript: window.location = '&stats_xml=' + window.location; + + + + + Machine: + + + Name: + +
+ Last Played: +
+ +
+ +
+ + +
+ + + +
+ diff --git a/stepmania/Themes/default/Other/Profile Stats.xsl b/stepmania/Themes/default/Other/Profile Stats.xsl new file mode 100644 index 0000000000..dc134cca88 --- /dev/null +++ b/stepmania/Themes/default/Other/Profile Stats.xsl @@ -0,0 +1,1875 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Instructions + + + +

Overview

+ + + + This file contains all your game profile data. Please read the instructions below before modifying or moving any files on your memory card. Modifying files may result in irreversible loss of your data. + + + + +
+ +

Description of Files

+ + + Edits/ + + This directory contains edit step files that you've created yourself or downloaded from the internet. + + More Info + + You can place up to 200 .edit files in this directory. The edit file format is similar to an .sm file, except that it has only two tags: +
+ #SONG:<SongDirectory>; +
+ #NOTES:<StepsType>:<Description>:<Difficulty>:<Meter>:<RadarValues>:<NoteData>; +
+
+ + + + Screenshots/ + + All screenshots that you take are saved in this directory. + + More Info + + This directory contains all screenshots that you've captured while playing the game. The Screenshots section of Stats.xml shows thumbnails score details for all screens you've captured. +
+ The MD5 hash for a screenshot file can be used to verify that the screenshot has not been modified since it was first saved. +
+ If your memory card is full, you can free space by deleting some of the screenshot .jpg files or moving them to another disk. +
+
+ + + + Catalog.xml + Contains game data used by Stats.xml. + + + DontShare.sig + + DontShare.sig is a digital signature that's required by the game when it loads your memory card data. This is a secret file that you shouldn't share with anyone else. + + More Info + + You can freely share Stats.xml and Stats.xml.sig with other players or submit these files for internet ranking. However, you should always keep DontShare.sig private. + Without the DontShare.sig, another player will not be able to load your saved data and pass it off as their own. + + + + + + Editable.ini + + Holds preferences that you can edit using your home computer. You can open this file using any text editor program and save changes. + + + + Stats.xml + You're looking at this file now. It contains all of your saved scores, statistics, and preferences. The game reads this data when you insert your memory card. + + + Stats.xml.sig + + This is the digital signature for Stats.xml. + + More Info + + Digital signatures are used to verify that your data hasn't been modified outside of the game. This prevents cheaters from changing their score data and passing it off as real. +
+ If any of Stats.xml, Stats.xml.sig, or DontShare.sig have been modified outside of the game, your memory card data will be ignores and overridden after the next save. It's important that you don't modify any of these three files because doing so will render your data permanently unusable. +
+
+ + +
+ +
+
+
+ + + + + + + + + + + General Data + + + + + + + + + + +
+ + + Song Count by PlayMode + + + + + + + + + + + + + + + + + + + + + + Song Count by Style + + + + + + + + + + + + + + + + + + + + + + Song Count by Difficulty + + + + + + + + + + + + + + + + + + + + + + Song Count by Meter + + + + + + + + + + + + + + + + + + + + + + Passed Count by Grade + + + + + + + + + + + + + + + + + + + + + + Passed Count by PlayMode + + + + + + + + + + + + + + + + + + + + +
+
+ +
+ + + + + + + + + + + Steps + Trail + + + + + + Popularity + + + + + Ranking + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Unplayed + + + + + + + + + + + + + + + + + + + + + + + + + Ranking + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Steps + Trail + + + + Top Scores + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Details + + + + +

+ Tap Scores + Hold Scores + Stats +

+ + + + + + + +
+
+
+ +
+
+
+
+
+ + + + + + + + + + + Steps + Trail + + + Difficulty + CourseDifficulty + + + + Completeness + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +

Breakdown

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
Actual + + + + + +
Possible + + + + + +
Percentage + + + + + + + + + + + + +
+ + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + +
+ +
+
+
+
+
+
+ + + + + + + + + + + + Recent Scores + + + + + + +
+
+
+
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Screenshots + + + + + + + + + + + + + + + + + _new + + + 160 + 120 + border-width: 0 + + + + + + + + + + + + + + + + + + + + + + + + + Coin Counts + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + _new + + + 160 + 120 + border-width: 0 + + + + + + + + + + + + + + + + + + + + + + + + + + Calories + + + + + + + + + + + All time + + + + + + + + Per Song + + + + + + + + Per Minute of Gameplay + + + + + + + + + +
+ +

By Week

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
SunMonTueWedThuFriSat
+ +
+
+
+ + + + + + + + Week of + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Sunday + Monday + Tuesday + Wednesday + Thursday + Friday + Saturday + error: + + + + + + + + + + + Sun + Mon + Tue + Wed + Thu + Fri + Sat + error: + + + + + + + + + + + Jan + Feb + Mar + Apr + May + Jun + Jul + Aug + Sep + Oct + Nov + Dec + error: + + + + + + + + + + + January + February + March + April + May + June + July + August + September + October + November + December + error: + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + [not implemented] + + + + + 0 + + + + + + 0 + + + + + + + 12 + 0 + + 0 + + + + + + + [not implemented] + + + + + 0 + + + + + + 0 + + + + + + + AM + PM + + + + + + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + [not implemented] + + + + + [not implemented] + + + + + [not implemented] + + + + + + + + + + + + + + + % + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + , + + + + + + + + + + + + + + + + + + + % + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + true + + + false + + + + + + + + ?Guid= + + + _new + + + + + + + + + + + + + + + + + + + + + valuename + + nowrap + + + +   + + dyndata + + nowrap + + + +     + + + + + + + + + + + + + + + + + + + + + + valuename + + +    + + dyndata + + + + + + + + + + + + + + + + + + + + + + + + + + + + valuename + + +    + + + valuename + + + +    + + dyndata + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +   + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + main + + + + + + + + + + + + + + + + + + + main + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ diff --git a/stepmania/Themes/default/metrics.ini b/stepmania/Themes/default/metrics.ini index 99cbeeebaa..264734027c 100644 --- a/stepmania/Themes/default/metrics.ini +++ b/stepmania/Themes/default/metrics.ini @@ -4568,10 +4568,37 @@ ShowStepsTypeDance-single=1 ShowStepsTypeDance-double=1 ShowStepsTypeDance-couple=1 ShowStepsTypeDance-solo=1 +ShowStepsTypeDance-couple=1 +ShowStepsTypeDance-solo=1 +ShowStepsTypePump-single=1 +ShowStepsTypePump-halfdouble=1 +ShowStepsTypePump-double=1 +ShowStepsTypePump-couple=1 +ShowStepsTypeEz2-single=1 +ShowStepsTypeEz2-double=1 +ShowStepsTypeEz2-real=1 +ShowStepsTypePara-single=1 +ShowStepsTypePara-versus=1 +ShowStepsTypeDs3ddx-single=1 +ShowStepsTypeBm-single=1 +ShowStepsTypeBm-double=1 +ShowStepsTypeIidx-single7=1 +ShowStepsTypeIidx-double7=1 +ShowStepsTypeIidx-single5=1 +ShowStepsTypeIidx-double5=1 +ShowStepsTypeManiax-single=1 +ShowStepsTypeManiax-double=1 +ShowStepsTypeTechno-single4=1 +ShowStepsTypeTechno-single5=1 +ShowStepsTypeTechno-single8=1 +ShowStepsTypeTechno-double4=1 +ShowStepsTypeTechno-double5=1 +ShowStepsTypePnm-five=1 +ShowStepsTypePnm-nine=1 +ShowStepsTypeLights-cabinet=1 InternetRankingHomeUrl= InternetRankingUploadUrl= InternetRankingViewGuidUrl= -StatsTitle=StepMania Stats -StatsHeader=StepMania Stats -StatsFooterText=generated by StepMania -StatsFooterLink=http://www.stepmania.com +ProductTitle=StepMania +FooterText=generated by StepMania +FooterLink=http://www.stepmania.com diff --git a/stepmania/src/CatalogXml.cpp b/stepmania/src/CatalogXml.cpp index 686f051495..b5b13488a6 100644 --- a/stepmania/src/CatalogXml.cpp +++ b/stepmania/src/CatalogXml.cpp @@ -24,10 +24,9 @@ #define INTERNET_RANKING_HOME_URL THEME->GetMetric ("CatalogXml","InternetRankingHomeUrl") #define INTERNET_RANKING_UPLOAD_URL THEME->GetMetric ("CatalogXml","InternetRankingUploadUrl") #define INTERNET_RANKING_VIEW_GUID_URL THEME->GetMetric ("CatalogXml","InternetRankingViewGuidUrl") -#define STATS_TITLE THEME->GetMetric ("CatalogXml","StatsTitle") -#define STATS_HEADER THEME->GetMetric ("CatalogXml","StatsHeader") -#define STATS_FOOTER_TEXT THEME->GetMetric ("CatalogXml","StatsFooterText") -#define STATS_FOOTER_LINK THEME->GetMetric ("CatalogXml","StatsFooterLink") +#define PRODUCT_TITLE THEME->GetMetric ("CatalogXml","ProductTitle") +#define FOOTER_TEXT THEME->GetMetric ("CatalogXml","FooterText") +#define FOOTER_LINK THEME->GetMetric ("CatalogXml","FooterLink") void SaveCatalogXml() { @@ -38,80 +37,100 @@ void SaveCatalogXml() XNode xml; xml.name = "Catalog"; - vector vpSongs = SONGMAN->GetAllSongs(); - for( unsigned i=0; iIsTutorial() ) - continue; // skip + XNode* pNode = xml.AppendChild( "Songs" ); - SongID songID; - songID.FromSong( pSong ); - - XNode* pSongNode = songID.CreateNode(); - - xml.AppendChild( pSongNode ); - - pSongNode->AppendChild( "MainTitle", pSong->GetDisplayMainTitle() ); - pSongNode->AppendChild( "SubTitle", pSong->GetDisplaySubTitle() ); - - FOREACH_StepsType( st ) + vector vpSongs = SONGMAN->GetAllSongs(); + for( unsigned i=0; iIsTutorial() ) + continue; // skip + + SongID songID; + songID.FromSong( pSong ); + + XNode* pSongNode = songID.CreateNode(); + + pNode->AppendChild( pSongNode ); + + pSongNode->AppendChild( "MainTitle", pSong->GetDisplayMainTitle() ); + pSongNode->AppendChild( "SubTitle", pSong->GetDisplaySubTitle() ); + + set vDiffs; + GAMESTATE->GetDifficultiesToShow( vDiffs ); + + FOREACH_StepsType( st ) { - Steps* pSteps = pSong->GetStepsByDifficulty( st, dc, false ); // no autogen - if( pSteps == NULL ) + if( !SHOW_STEPS_TYPE(st) ) continue; // skip - StepsID stepsID; - stepsID.FromSteps( pSteps ); + for( set::const_iterator iter = vDiffs.begin(); iter != vDiffs.end(); iter++ ) + { + Steps* pSteps = pSong->GetStepsByDifficulty( st, *iter, false ); // no autogen + if( pSteps == NULL ) + continue; // skip - XNode* pStepsIDNode = stepsID.CreateNode(); - pSongNode->AppendChild( pStepsIDNode ); - - pStepsIDNode->AppendChild( "Meter", pSteps->GetMeter() ); - pStepsIDNode->AppendChild( pSteps->GetRadarValues().CreateNode() ); + StepsID stepsID; + stepsID.FromSteps( pSteps ); + + XNode* pStepsIDNode = stepsID.CreateNode(); + pSongNode->AppendChild( pStepsIDNode ); + + pStepsIDNode->AppendChild( "Meter", pSteps->GetMeter() ); + pStepsIDNode->AppendChild( pSteps->GetRadarValues().CreateNode() ); + } } } } - vector vpCourses; - SONGMAN->GetAllCourses( vpCourses, false ); - for( unsigned i=0; iAppendChild( "MainTitle", pCourse->GetDisplayMainTitle() ); - pCourseNode->AppendChild( "SubTitle", pCourse->GetDisplaySubTitle() ); - pCourseNode->AppendChild( "HasMods", pCourse->HasMods() ); - - FOREACH_StepsType( st ) + vector vpCourses; + SONGMAN->GetAllCourses( vpCourses, false ); + for( unsigned i=0; iGetTrail( st, cd ); - if( pTrail == NULL ) - continue; - if( !pTrail->m_vEntries.size() ) - continue; - - TrailID trailID; - trailID.FromTrail( pTrail ); + Course* pCourse = vpCourses[i]; - XNode* pTrailIDNode = trailID.CreateNode(); - pCourseNode->AppendChild( pTrailIDNode ); - - pTrailIDNode->AppendChild( "Meter", pTrail->GetMeter() ); - pTrailIDNode->AppendChild( pTrail->GetRadarValues().CreateNode() ); + CourseID courseID; + courseID.FromCourse( pCourse ); + + XNode* pCourseNode = courseID.CreateNode(); + + pNode->AppendChild( pCourseNode ); + + pCourseNode->AppendChild( "MainTitle", pCourse->GetDisplayMainTitle() ); + pCourseNode->AppendChild( "SubTitle", pCourse->GetDisplaySubTitle() ); + pCourseNode->AppendChild( "HasMods", pCourse->HasMods() ); + + set vDiffs; + GAMESTATE->GetCourseDifficultiesToShow( vDiffs ); + + FOREACH_StepsType( st ) + { + if( !SHOW_STEPS_TYPE(st) ) + continue; // skip + + for( set::const_iterator iter = vDiffs.begin(); iter != vDiffs.end(); iter++ ) + { + Trail *pTrail = pCourse->GetTrail( st, *iter ); + if( pTrail == NULL ) + continue; + if( !pTrail->m_vEntries.size() ) + continue; + + TrailID trailID; + trailID.FromTrail( pTrail ); + + XNode* pTrailIDNode = trailID.CreateNode(); + pCourseNode->AppendChild( pTrailIDNode ); + + pTrailIDNode->AppendChild( "Meter", pTrail->GetMeter() ); + pTrailIDNode->AppendChild( pTrail->GetRadarValues().CreateNode() ); + } } } } @@ -229,12 +248,13 @@ void SaveCatalogXml() xml.AppendChild( "InternetRankingHomeUrl", INTERNET_RANKING_HOME_URL ); xml.AppendChild( "InternetRankingUploadUrl", INTERNET_RANKING_UPLOAD_URL ); xml.AppendChild( "InternetRankingViewGuidUrl", INTERNET_RANKING_VIEW_GUID_URL ); - xml.AppendChild( "StatsTitle", STATS_TITLE ); - xml.AppendChild( "StatsHeader", STATS_HEADER ); - xml.AppendChild( "StatsFooterText", STATS_FOOTER_TEXT ); - xml.AppendChild( "StatsFooterLink", STATS_FOOTER_LINK ); + xml.AppendChild( "ProductTitle", PRODUCT_TITLE ); + xml.AppendChild( "FooterText", FOOTER_TEXT ); + xml.AppendChild( "FooterLink", FOOTER_LINK ); - xml.SaveToFile(fn); + DISP_OPT opts = optDefault; + opts.stylesheet = CATALOG_XSL; + xml.SaveToFile(fn, &opts); LOG->Trace( "Done." ); } diff --git a/stepmania/src/CatalogXml.h b/stepmania/src/CatalogXml.h index e8dc9a972d..64e17c2ee7 100644 --- a/stepmania/src/CatalogXml.h +++ b/stepmania/src/CatalogXml.h @@ -6,6 +6,7 @@ #include "GameConstantsAndTypes.h" const CString CATALOG_XML = "Catalog.xml"; +const CString CATALOG_XSL = "Catalog.xsl"; const CString CATALOG_XML_FILE = DATA_DIR + "Catalog.xml"; void SaveCatalogXml(); diff --git a/stepmania/src/Profile.cpp b/stepmania/src/Profile.cpp index 8f0ad711c1..502cd653de 100644 --- a/stepmania/src/Profile.cpp +++ b/stepmania/src/Profile.cpp @@ -26,8 +26,8 @@ // // Old file versions for backward compatibility // -const CString STYLE_XSL = "Style.xsl"; -const CString STYLE_CSS = "Style.css"; +const CString STATS_XSL = "Stats.xsl"; +const CString COMMON_XSL = "Common.xsl"; #define GUID_SIZE_BYTES 8 @@ -670,7 +670,7 @@ bool Profile::SaveAllToDir( CString sDir, bool bSignData ) const xml.AppendChild( SaveCoinDataCreateNode() ); DISP_OPT opts = optDefault; - opts.stylesheet = STYLE_XSL; + opts.stylesheet = STATS_XSL; bool bSaved = xml.SaveToFile(fn, &opts); // Update file cache, or else IsAFile in CryptManager won't see this new file. @@ -1233,8 +1233,9 @@ void Profile::SaveStatsWebPageToDir( CString sDir ) const { ASSERT( PROFILEMAN ); - FileCopy( THEME->GetPathO("Profile",STYLE_XSL), sDir+STYLE_XSL ); - FileCopy( THEME->GetPathO("Profile",STYLE_CSS), sDir+STYLE_CSS ); + FileCopy( THEME->GetPathO("Profile",STATS_XSL), sDir+STATS_XSL ); + FileCopy( THEME->GetPathO("Profile",CATALOG_XSL), sDir+CATALOG_XSL ); + FileCopy( THEME->GetPathO("Profile",COMMON_XSL), sDir+COMMON_XSL ); FileCopy( CATALOG_XML_FILE, sDir+CATALOG_XML ); }