write Catalog.xml that contains song and course metadata - useful for importing into other tools
This commit is contained in:
@@ -0,0 +1,55 @@
|
||||
#include "global.h"
|
||||
/*
|
||||
-----------------------------------------------------------------------------
|
||||
Class: CatalogXml
|
||||
|
||||
Desc: See header.
|
||||
|
||||
Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved.
|
||||
Chris Danford
|
||||
-----------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#include "CatalogXml.h"
|
||||
#include "SongManager.h"
|
||||
#include "song.h"
|
||||
#include "Steps.h"
|
||||
|
||||
const CString CATALOG_XML = "Catalog.xml";
|
||||
|
||||
void SaveCatalogXml( CString sDir )
|
||||
{
|
||||
CString fn = sDir + CATALOG_XML;
|
||||
|
||||
XNode xml;
|
||||
xml.name = "Catalog";
|
||||
|
||||
vector<Song*> vpSongs = SONGMAN->GetAllSongs();
|
||||
for( unsigned i=0; i<vpSongs.size(); i++ )
|
||||
{
|
||||
Song* pSong = vpSongs[i];
|
||||
|
||||
SongID songID;
|
||||
songID.FromSong( pSong );
|
||||
|
||||
XNode* pSongNode = songID.CreateNode();
|
||||
|
||||
xml.AppendChild( pSongNode );
|
||||
|
||||
vector<Steps*> vpSteps = pSong->GetAllSteps();
|
||||
for( unsigned j=0; j<vpSteps.size(); j++ )
|
||||
{
|
||||
Steps* pSteps = vpSteps[j];
|
||||
|
||||
if( pSteps->IsAutogen() )
|
||||
continue;
|
||||
|
||||
StepsID stepsID;
|
||||
stepsID.FromSteps( pSteps );
|
||||
|
||||
pSongNode->AppendChild( stepsID.CreateNode() );
|
||||
}
|
||||
}
|
||||
|
||||
bool bSaved = xml.SaveToFile(fn);
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
#ifndef CatalogXml_H
|
||||
#define CatalogXml_H
|
||||
/*
|
||||
-----------------------------------------------------------------------------
|
||||
Class: CatalogXml
|
||||
|
||||
Desc: Helpers for generating an HTML web page based on Profile data.
|
||||
|
||||
Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved.
|
||||
Chris Danford
|
||||
-----------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#include "Profile.h"
|
||||
|
||||
void SaveCatalogXml( CString sDir );
|
||||
|
||||
#endif
|
||||
@@ -48,7 +48,8 @@ ScreenTestLights.cpp ScreenTestLights.h ScreenTestSound.cpp ScreenTestSound.h Sc
|
||||
ScreenTitleMenu.cpp ScreenTitleMenu.h ScreenUnlock.cpp ScreenUnlock.h ScreenWithMenuElements.cpp ScreenWithMenuElements.h
|
||||
|
||||
DataStructures = \
|
||||
Attack.cpp Attack.h BannerCache.cpp BannerCache.h Character.cpp Character.h CharacterHead.cpp CharacterHead.h \
|
||||
Attack.cpp Attack.h BannerCache.cpp BannerCache.h CatalogXml.cpp CatalogXml.h \
|
||||
Character.cpp Character.h CharacterHead.cpp CharacterHead.h \
|
||||
CodeDetector.cpp CodeDetector.h EnumHelper.cpp EnumHelper.h Course.cpp Course.h CourseUtil.cpp CourseUtil.h \
|
||||
Font.cpp Font.h FontCharAliases.cpp FontCharAliases.h \
|
||||
FontCharmaps.cpp FontCharmaps.h Game.h GameConstantsAndTypes.cpp GameConstantsAndTypes.h GameDef.cpp GameDef.h \
|
||||
|
||||
@@ -31,6 +31,7 @@
|
||||
#include "ScoreKeeperMAX2.h"
|
||||
#include "crypto/CryptRand.h"
|
||||
#include "UnlockSystem.h"
|
||||
#include "CatalogXml.h"
|
||||
|
||||
//
|
||||
// Old file versions for backward compatibility
|
||||
@@ -1656,6 +1657,8 @@ void Profile::SaveStatsWebPageToDir( CString sDir ) const
|
||||
PROFILEMAN->GetMachineProfile(),
|
||||
bThisIsMachineProfile ? HTML_TYPE_MACHINE : HTML_TYPE_PLAYER
|
||||
);
|
||||
if( bThisIsMachineProfile )
|
||||
SaveCatalogXml( sDir );
|
||||
}
|
||||
|
||||
void Profile::SaveMachinePublicKeyToDir( CString sDir ) const
|
||||
|
||||
@@ -947,7 +947,7 @@ bool PrintRecentScores( RageFile &f, const Profile *pProfile, CString sTitle, ve
|
||||
return true;
|
||||
}
|
||||
|
||||
bool PrintInventoryForSong( RageFile &f, const Profile *pProfile, Song* pSong )
|
||||
bool PrintCatalogForSong( RageFile &f, const Profile *pProfile, Song* pSong )
|
||||
{
|
||||
if( pSong->NeverDisplayed() || UNLOCKMAN->SongIsLocked(pSong) )
|
||||
return false; // skip
|
||||
@@ -1019,14 +1019,14 @@ bool PrintInventoryForSong( RageFile &f, const Profile *pProfile, Song* pSong )
|
||||
return true;
|
||||
}
|
||||
|
||||
bool PrintInventoryForGroup( RageFile &f, const Profile *pProfile, CString sGroup )
|
||||
bool PrintCatalogForGroup( RageFile &f, const Profile *pProfile, CString sGroup )
|
||||
{
|
||||
return PrintSongsInGroup( f, pProfile, sGroup, PrintInventoryForSong );
|
||||
return PrintSongsInGroup( f, pProfile, sGroup, PrintCatalogForSong );
|
||||
}
|
||||
|
||||
void PrintInventoryList( RageFile &f, const Profile *pProfile, CString sTitle, vector<Song*> &vpSongs, vector<Steps*> &vpAllSteps, vector<StepsType> &vStepsTypesToShow, map<Steps*,Song*> mapStepsToSong, vector<Course*> vpCourses )
|
||||
void PrintCatalogList( RageFile &f, const Profile *pProfile, CString sTitle, vector<Song*> &vpSongs, vector<Steps*> &vpAllSteps, vector<StepsType> &vStepsTypesToShow, map<Steps*,Song*> mapStepsToSong, vector<Course*> vpCourses )
|
||||
{
|
||||
PrintGroups( f, pProfile, sTitle, PrintInventoryForGroup );
|
||||
PrintGroups( f, pProfile, sTitle, PrintCatalogForGroup );
|
||||
}
|
||||
|
||||
void PrintBookkeeping( RageFile &f, const Profile *pProfile, CString sTitle, vector<Song*> &vpSongs, vector<Steps*> &vpAllSteps, vector<StepsType> &vStepsTypesToShow, map<Steps*,Song*> mapStepsToSong, vector<Course*> vpCourses)
|
||||
@@ -1280,19 +1280,17 @@ void SaveStatsWebPage(
|
||||
vector<Song*> vpSongs = SONGMAN->GetAllSongs();
|
||||
vector<Steps*> vpAllSteps;
|
||||
map<Steps*,Song*> mapStepsToSong;
|
||||
for( unsigned i=0; i<vpSongs.size(); i++ )
|
||||
{
|
||||
for( unsigned i=0; i<vpSongs.size(); i++ )
|
||||
Song* pSong = vpSongs[i];
|
||||
vector<Steps*> vpSteps = pSong->GetAllSteps();
|
||||
for( unsigned j=0; j<vpSteps.size(); j++ )
|
||||
{
|
||||
Song* pSong = vpSongs[i];
|
||||
vector<Steps*> vpSteps = pSong->GetAllSteps();
|
||||
for( unsigned j=0; j<vpSteps.size(); j++ )
|
||||
{
|
||||
Steps* pSteps = vpSteps[j];
|
||||
if( pSteps->IsAutogen() )
|
||||
continue; // skip
|
||||
vpAllSteps.push_back( pSteps );
|
||||
mapStepsToSong[pSteps] = pSong;
|
||||
}
|
||||
Steps* pSteps = vpSteps[j];
|
||||
if( pSteps->IsAutogen() )
|
||||
continue; // skip
|
||||
vpAllSteps.push_back( pSteps );
|
||||
mapStepsToSong[pSteps] = pSong;
|
||||
}
|
||||
}
|
||||
vector<Course*> vpCourses;
|
||||
@@ -1302,28 +1300,26 @@ void SaveStatsWebPage(
|
||||
// Calculate which StepTypes to show
|
||||
//
|
||||
vector<StepsType> vStepsTypesToShow;
|
||||
for( StepsType st=(StepsType)0; st<NUM_STEPS_TYPES; st=(StepsType)(st+1) )
|
||||
{
|
||||
for( StepsType st=(StepsType)0; st<NUM_STEPS_TYPES; st=(StepsType)(st+1) )
|
||||
// don't show if there are no Steps of this StepsType
|
||||
bool bOneSongHasStepsForThisStepsType = false;
|
||||
for( unsigned i=0; i<vpSongs.size(); i++ )
|
||||
{
|
||||
// don't show if there are no Steps of this StepsType
|
||||
bool bOneSongHasStepsForThisStepsType = false;
|
||||
for( unsigned i=0; i<vpSongs.size(); i++ )
|
||||
Song* pSong = vpSongs[i];
|
||||
vector<Steps*> vpSteps;
|
||||
pSong->GetSteps( vpSteps, st, DIFFICULTY_INVALID, -1, -1, "", false );
|
||||
if( !vpSteps.empty() )
|
||||
{
|
||||
Song* pSong = vpSongs[i];
|
||||
vector<Steps*> vpSteps;
|
||||
pSong->GetSteps( vpSteps, st, DIFFICULTY_INVALID, -1, -1, "", false );
|
||||
if( !vpSteps.empty() )
|
||||
{
|
||||
bOneSongHasStepsForThisStepsType = true;
|
||||
break;
|
||||
}
|
||||
bOneSongHasStepsForThisStepsType = true;
|
||||
break;
|
||||
}
|
||||
if( !bOneSongHasStepsForThisStepsType )
|
||||
continue;
|
||||
if( !SHOW_STEPS_TYPE(st) )
|
||||
continue;
|
||||
vStepsTypesToShow.push_back( st );
|
||||
}
|
||||
if( !bOneSongHasStepsForThisStepsType )
|
||||
continue;
|
||||
if( !SHOW_STEPS_TYPE(st) )
|
||||
continue;
|
||||
vStepsTypesToShow.push_back( st );
|
||||
}
|
||||
|
||||
//
|
||||
@@ -1420,7 +1416,7 @@ TITLE.c_str(), STYLE_CSS.c_str() ) );
|
||||
PrintCaloriesBurned( f, pProfile, "Calories Burned", sDir );
|
||||
PrintPercentComplete( f, pProfile, "Percent Complete", vpSongs, vpAllSteps, vStepsTypesToShow, mapStepsToSong, vpCourses );
|
||||
PrintRecentScores( f, pProfile, "Most Scores", vpSongs, vpAllSteps, vStepsTypesToShow, mapStepsToSong, vpCourses );
|
||||
PrintInventoryList( f, pProfile, "Song Information", vpSongs, vpAllSteps, vStepsTypesToShow, mapStepsToSong, vpCourses );
|
||||
PrintCatalogList( f, pProfile, "Song Information", vpSongs, vpAllSteps, vStepsTypesToShow, mapStepsToSong, vpCourses );
|
||||
PrintBookkeeping( f, pProfile, "Bookkeeping", vpSongs, vpAllSteps, vStepsTypesToShow, mapStepsToSong, vpCourses );
|
||||
break;
|
||||
default:
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# Microsoft Developer Studio Project File - Name="StepMania" - Package Owner=<4>
|
||||
# Microsoft Developer Studio Generated Build File, Format Version 6.00
|
||||
# Microsoft Developer Studio Generated Build File, Format Version 60000
|
||||
# ** DO NOT EDIT **
|
||||
|
||||
# TARGTYPE "Win32 (x86) Application" 0x0101
|
||||
@@ -58,14 +58,14 @@ BSC32=bscmake.exe
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 $(intdir)\verstub.obj kernel32.lib shell32.lib user32.lib gdi32.lib advapi32.lib winmm.lib /nologo /subsystem:windows /pdb:"../debug6/StepMania-debug.pdb" /map /debug /machine:I386 /nodefaultlib:"libcmtd.lib" /out:"../StepMania-debug.exe"
|
||||
# SUBTRACT BASE LINK32 /verbose /profile /pdb:none /incremental:no /nodefaultlib
|
||||
# ADD LINK32 $(intdir)\verstub.obj kernel32.lib gdi32.lib shell32.lib user32.lib advapi32.lib winmm.lib /nologo /subsystem:windows /map /debug /machine:I386 /nodefaultlib:"msvcrt.lib" /out:"../Program/StepMania-debug.exe"
|
||||
# ADD LINK32 $(intdir)\verstub.obj kernel32.lib gdi32.lib shell32.lib user32.lib advapi32.lib winmm.lib /nologo /subsystem:windows /map /debug /machine:I386 /nodefaultlib:"msvcrt.lib" /out:"../../itg/itg/Program/StepMania-debug.exe"
|
||||
# SUBTRACT LINK32 /verbose /profile /pdb:none /incremental:no /nodefaultlib
|
||||
# Begin Special Build Tool
|
||||
IntDir=.\../Debug6
|
||||
TargetDir=\temp\stepmania\Program
|
||||
TargetDir=\stepmania\itg\itg\Program
|
||||
TargetName=StepMania-debug
|
||||
SOURCE="$(InputPath)"
|
||||
PreLink_Cmds=disasm\verinc cl /Zl /nologo /c verstub.cpp /Fo$(IntDir)\
|
||||
PreLink_Cmds=disasm\verinc cl /Zl /nologo /c verstub.cpp /Fo$(IntDir)\
|
||||
PostBuild_Cmds=disasm\mapconv $(IntDir)\$(TargetName).map $(TargetDir)\StepMania.vdi
|
||||
# End Special Build Tool
|
||||
|
||||
@@ -99,6 +99,10 @@ XBCP=xbecopy.exe
|
||||
# ADD BASE XBCP /NOLOGO
|
||||
# ADD XBCP /NOLOGO
|
||||
# Begin Special Build Tool
|
||||
IntDir=.\../Debug_Xbox
|
||||
TargetDir=\stepmania\stepmania
|
||||
TargetName=default
|
||||
SOURCE="$(InputPath)"
|
||||
PreLink_Cmds=disasm\verinc cl /Zl /nologo /c PostBuild_Cmds=disasm\mapconv $(IntDir)\$(TargetName).map $(TargetDir)\StepMania.vdi ia32.vdi
|
||||
# End Special Build Tool
|
||||
|
||||
@@ -135,10 +139,10 @@ LINK32=link.exe
|
||||
# SUBTRACT LINK32 /verbose /pdb:none /debug
|
||||
# Begin Special Build Tool
|
||||
IntDir=.\../Release6
|
||||
TargetDir=\temp\stepmania\Program
|
||||
TargetDir=\stepmania\stepmania\Program
|
||||
TargetName=StepMania
|
||||
SOURCE="$(InputPath)"
|
||||
PreLink_Cmds=disasm\verinc cl /Zl /nologo /c verstub.cpp /Fo$(IntDir)\
|
||||
PreLink_Cmds=disasm\verinc cl /Zl /nologo /c verstub.cpp /Fo$(IntDir)\
|
||||
PostBuild_Cmds=disasm\mapconv $(IntDir)\$(TargetName).map $(TargetDir)\StepMania.vdi
|
||||
# End Special Build Tool
|
||||
|
||||
@@ -174,6 +178,10 @@ XBCP=xbecopy.exe
|
||||
# ADD BASE XBCP /NOLOGO
|
||||
# ADD XBCP /NOLOGO
|
||||
# Begin Special Build Tool
|
||||
IntDir=.\../Release_Xbox
|
||||
TargetDir=\stepmania\stepmania
|
||||
TargetName=default
|
||||
SOURCE="$(InputPath)"
|
||||
PreLink_Cmds=disasm\verinc cl /Zl /nologo /c PostBuild_Cmds=disasm\mapconv $(IntDir)\$(TargetName).map $(TargetDir)\StepMania.vdi ia32.vdi
|
||||
# End Special Build Tool
|
||||
|
||||
@@ -1237,6 +1245,25 @@ SOURCE=.\BannerCache.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\CatalogXml.cpp
|
||||
|
||||
!IF "$(CFG)" == "StepMania - Win32 Debug"
|
||||
|
||||
!ELSEIF "$(CFG)" == "StepMania - Xbox Debug"
|
||||
|
||||
!ELSEIF "$(CFG)" == "StepMania - Win32 Release"
|
||||
|
||||
!ELSEIF "$(CFG)" == "StepMania - Xbox Release"
|
||||
|
||||
!ENDIF
|
||||
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\CatalogXml.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\Character.cpp
|
||||
|
||||
!IF "$(CFG)" == "StepMania - Win32 Debug"
|
||||
|
||||
@@ -578,6 +578,12 @@ cl /Zl /nologo /c verstub.cpp /Fo"$(IntDir)"\
|
||||
<File
|
||||
RelativePath="BannerCache.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="CatalogXml.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="CatalogXml.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="Character.cpp">
|
||||
</File>
|
||||
|
||||
Reference in New Issue
Block a user