
Media X Menu Version 0.2 Alpha

Media X Menu is a menu system to launch applications from a DVD collection or from 
a hard drive. It is intended to be very configurable and allow new "themes" to be added 
in, both with simple visual changes, or adding 3D effects to the presentation of the 
menus by re-writing the software.

I am releasing this source code for others to use for both their own projects, and 
hopefully, to enhance this project. The current features are as follows:

There *ARE* still some bugs with this thing.... but I've tried to do as much testing as 
possible without spending three weeks on it. I believe most of it relates to the 
handling of the soundtracks at the moment, but tracking down everything is time consuming
and at the moment, it seems to work 99.9% of the time. My suggestion would be to not use 
"random" soundtrack play, and it will be turned of by default.

* Impliments the "Simple" theme, allowing a title screen, menu screen, loading screen 
  and saver screen, each with configurable elements (custom backgrounds, custom bouncing 
  logo for the screen saver)
* Launches applications from the hard drive and the CD/DVD drive.
* Screen saver! 
* Can play one or more music tracks, with multiple options, such as-
  - Disc-specific tracks (played from subdirectory, for example)
  - Can play from the XBox soundtracks the user has on his hard drive
  - Can play random or in order
* Supports BMP, PNG, TGA, and JPG image formats
* All settings are done via INI file support, a format familiar to most users.
* Supports 640x480 at the moment. Sorry, just ran out of time to get the multi-res
  support in.


===================================================================
HISTORY:
===================================================================

Alpha 0.2
  Minor bug fix release
* Fixed problem identifying the correct partitions. (Thanks ITM of xboxhacker.net for the fix)
* Added speed enhancement, again, thanks ITM for this code.
* Moved soundtrack to it's own thread to prevent pausing in screen saver
* "About" box added  when pressing "White button" in the menu screen
* Added the  PersistDisplay() call, but didn't notice a difference. No loading screen joy.
* Added "DrawDescription" to Menu section to allow you the ability to turn off the description.
* Keyboard support - Cursor Up/Down, ENTER to select. Keys skip title and saver, F1 brings up 
  "about box" and PrintScreen key will reboot to the dashboard.



===================================================================
Things that couldn't make it into this release, but are planned:
===================================================================

* More detailed directions. Look, this stuff takes forever, and this will
  have to do until he next release. Sorry.
* Video based images, clips can be used for screen shots or backgrounds.
* Automatic menu population... drop this system on a disc with multiple 
  subdirectories, each containing "item" configuration files, and the menu system
  can automatically set them up. (i.e. the game directory might contain an MXM_ITEM.ini
  and an MXM_ITEM.png file)
* Smarter relative paths. For now, we must assume any relative path is a CD/DVD. There
  is still work to be done to examine symbolic links so the menu system knows "where" it 
  actually  is being run from.
* More eye-candy. 
  - Animated menus (M$ Dash style or a rotating screenshot cube, for example)
  - Soundtrack-aware visuals in a screensaver
* Support for all video modes (HDTV, PAL).
* Full support for external fonts.


===================================================================
Other ideas:
===================================================================

* Remote control support
* A PC-side app to handhold through the process of making and verifying a menu.




Main options:
DiscTitle=<Title String Here>
  The title displayed in the title screen

DiscSubtitle=<Subtitle String Here>
  Text displayed below title in title screen

TitleScreen=<Filepath of title background bitmap>
  Background used for title screen

MenuBack=<Filepath of menu background bitmap>
  Background for menu screen

SaverLogo=<Filepath of SaverLogo bitmap>
  Logo used for screen saver (Solid black is transparent)

WaitScreen=<Filepath of Wait screen background bitmap>
  Displayed when program is launched.

Theme=<Theme ID>
  Theme ID, currently unsupported

TitleDelay=<Delay in seconds>
  Delay, in seconds, for the display of the title screen on startup. (Default 20sec)
  Hitting a button will bypass the title screen.

SaverDelay=<Delay in seconds>
  Delay before launching the screen saver from the menu screen. 
  (Default 300sec, or 5 min)

TitleColor=<32-bit color value, in decimal or hex>
SubTitleColor=<32-bit color value, in decimal or hex>
  Colors used in display of title

ShadowTitle=<on/true/1/yes or off/false/0/no>
ShadowSubTitle=<on/true/1/yes or off/false/0/no>
  Display shadows

MXMPath=<Absolute path>
  Defaults to D:\, this represents the path the menu is being run from.
  Used to launch apps run from relative paths. This is only useful when running 
  the app from the hard drive, otherwise, just leave it off.


[Main]
DiscTitle=MediaX Menu
DiscSubtitle=
TitleScreen=
MenuBack=
SaverLogo=
WaitScreen=
Theme=-1
TitleDelay=20
SaverDelay=300
TitleColor=0xffffffff
SubTitleColor=0xffffffff
ShadowTitle=on
ShadowSubTitle=on
MXMPath=D:\

ScreenShot Options:

Top=<pixel row>
Left=<pixel column>
Width=<Pixel width>
Height=<Pixel Height>
  Defines the location of the screenshot on the menu screen

Example:

[ScreenShot]
Top=120
Left=334
Width=193
Height=260


Menu section options:

Top=<pixel row>
Left=<Pixel column>
  Location of upper left of selection menu

MenuBorderColor=<32-bit color value, in decimal or hex>
MenuBackColor=<32-bit color value, in decimal or hex>
SelItemColor=<32-bit color value, in decimal or hex>
ItemColor=<32-bit color value, in decimal or hex>
DescrColor=<32-bit color value, in decimal or hex>
  Colors used in menu elements
DrawDescription=<on/true/1/yes or off/false/0/no>
  This could also be the done by using "DescrColor=0"

ShadowSelItem=<on/true/1/yes or off/false/0/no>
ShadowItem=<on/true/1/yes or off/false/0/no>
ShadowDescr=<on/true/1/yes or off/false/0/no>
AllowSaverMusic=<on/true/1/yes or off/false/0/no>
AllowSaverSound=<on/true/1/yes or off/false/0/no>
  These are pretty much self-explanatory

SndUp=<file path>
SndDn=<file path>
SndLaunch=<file path>
  Use these to choose differrent sound files


Example:

[Menu]
Top=104
Left=65
MenuBorderColor=0xa04444ff
MenuBackColor=0x80000000
SelItemColor=0xffffffff
ItemColor=0xa0808080
DescrColor=0xffffffff
ShadowSelItem=on
ShadowItem=on
ShadowDescr=on
AllowSaverMusic=on
AllowSaverSound=on
SndUp=
SndDn=
SndLaunch=


Menu items:	

Each menu item will be listed in its own section, using "Item_x" as the name.
It will read each item in order, until it fails to find the "next" one.... See
the sample INI file for a detailed example.


Example:

[Item_1]
Title=ToeJam and Earl III
Description=Platforming classic returns!
Media=TOEJAM3.png
Dir=TOEJAM


Title=<title string>
  The title that's displayed in the menu selection

Description=<text to be displayed at the bottom of the selection menu>
  The text displayed at teh bottom of the menu selection box

Media=<filename (may include absolute or relative path) of image>
  The bitmap (BMP,TGA,PNG,JPG) used to display a screenshot or title screen

Dir=<Relative or absolute path to program>
  The directory the exeutable resides in

Exe=<executable filename>
  The executable filename, defaults to default.xbe





Adding music tracks to the menu system

You have several basic options:
1. Playing a specific file
2. Playing a directory of music
3. Playing the Xbox's own soundtrack

You should always have something to play.

Options under [Music]:

UseMusic=<on/off>
  If on (Default), music will play, if off, no music will be played.

Background=<filename>
  This option allows you to place a single file into the "local" soundtrack. Use this
  to select a single file to play during the menu operation.

Directory=<directory>
  This option will cause the menu system to read an entire directory and add it to the 
  "local" soundtrack.

Global=<on/off>
  This option, when activated (default) will play any tracks contained on the Xbox's 
  regular soundtracks.

Random=<on/off>
  Default is on. This randomizes the order used to play the soundtrack files. If off,
  it will play the local soundtrack (in order) followed by the Xbox soundtracks (if 
  Global is on, of course)


[Music]
UseMusic=true
Background=MyTrack.wma
Directory=MUSIC
Global=true
Random=off




Note to developers:

Sorry this is in such a messy state.

I'd like to acknowledge CodeProject as the source of the CStdString class.
I've discovered that it really helps with the Xbox APIs, particularly with 
conversion, but it's a bit kludgy. Best to use CStdString natively (compiles 
as 8-bit ASCII strings) and whenever you need wchar_t types, simply assign 
to a temporary CStdStringW object and pass out "wsTemp.c_str()" for the 
desired wchar format. You could even use:

    CStdString sThis String(_T("test"));

	SomeFunctionW( CStdStringW(sThis).c_str() );

to pass in the value.

The INI classes were built specifically with the Xbox in mind, They utilize
STL templates for mapping the parameters and CStdString as the basis for
the strings. Feel free to port this to your own applications. I intended 
this implementation to support other formats as well, on multiple platforms,
such as XML and registry configurations on desktop systems or handhelds.
Support may be added for more data types, as well.

The application is laid out with the idea of operating the applications
in different states. Each state has it's own initialization, activation, 
movement and rendering functions. This makes it easier to bounce between 
the different modes. This is in it's second incarnation, and I've got some 
ideas to improve it further. I plan on integrating the music manager further
as well as more utility functions.

Did I mention it's rather messy right now? Ugh. I'm working on cleaning it up.

The music manager required quite a bit of work to make it more robust. Please 
keep in mind I'm not working with a debug console, so when something breaks, 
the system just doesn't work at all.... MusicManager was a big headache. I plan
enhancing the current classes with more dynamic support in the future, but for now,
it's pretty complete. Callbacks into the Application class (or access to buffers 
for the app) would be nice, particularly for the visualization stuff.


"xntdll.h" The magic NTDLL routines are generally the realm of device driver 
programmers. There's a lot of cool stuff in here. As I said online, I think 
new BIOSes could theoretically support LAN drives through enhancing the driver 
support in the BIOS. This file will hopefully grow with other functions, as well.

CStdString GetRealCDROMPath( void ): :::sigh::: This should have worked, but
it's not at the moment. If anybody can figure this one out, I'd greatly appreciate
it. I'd prefer not to have to kludge up some detect based on writing to D:\ to see
if I'm on the hard drive or not - and it makes it absolutely impossible to see if
I'm running from a subdirectory of the hard drive. This routine was supposed to
unravel the symbolic links that convert the menu program's directory to be seen
as "D:\" instead of what it really is. Microsoft has even been so kind as to 
change the parameters used by NtOpenSymbolicLinkObject() call in the Xbox.

Video support: I'm probably missing something simple, something I'll see a half hour
after I send this whole thing out.... but it's not working at the moment. Everything 
is in place.... it's just broken as it sits. Dunno why at the moment. It should load
up the video info initially, then when "getting" the texture, load up the next frame, 
and send the texture from the "current" frame. Seems pretty simple. Once it's working,
any video should be able to be used where a bitmap is.

Modularizing the themes: I'd like to look at doing sections for this, but even better if 
there is a way to do it like a DLL. Again, I don;t know if this will be possible, given
the way the XBEs are loaded, but I get the impression the dashboard uses standard XBEs in
EXACTLY this fashion, when they are renamed .xip's. I suspect there is a kernel function
to load these by section to run. Anybody look at this?


