diff --git a/PianoGame.vcproj b/PianoGame.vcproj index fc06b70..1381fc8 100644 --- a/PianoGame.vcproj +++ b/PianoGame.vcproj @@ -49,7 +49,7 @@ RuntimeLibrary="3" UsePrecompiledHeader="0" WarningLevel="3" - Detect64BitPortabilityProblems="true" + Detect64BitPortabilityProblems="false" DebugInformationFormat="4" /> + + + + + + diff --git a/graphics/TitleGraphics.psd b/graphics/TitleGraphics.psd index dac5bf1..56bd9d6 100644 Binary files a/graphics/TitleGraphics.psd and b/graphics/TitleGraphics.psd differ diff --git a/graphics/title_GameMusicThemes.tga b/graphics/title_GameMusicThemes.tga deleted file mode 100644 index dff335a..0000000 Binary files a/graphics/title_GameMusicThemes.tga and /dev/null differ diff --git a/graphics/title_Logo.tga b/graphics/title_Logo.tga index 01b9ca5..d16e7a9 100644 Binary files a/graphics/title_Logo.tga and b/graphics/title_Logo.tga differ diff --git a/readme.txt b/readme.txt index 50239d4..12ce207 100644 --- a/readme.txt +++ b/readme.txt @@ -6,7 +6,6 @@ Visit http://www.synthesiagame.com/ for the latest version of this project. Piano Game is mostly written by Nicholas Piegdon. The following people have also contributed: -- Daniel Lawrence for the name Synthesia - Luis Anton with an early version of the MIDI input code - Troy Ramos with a suggestion to use Klavarskribo staff notation - Dave Ray for his STRING/WSTRING macro @@ -35,7 +34,7 @@ NEW: On the Mac, you can now drag a MIDI file to the application on the Dock or in Finder or right click a MIDI file and choosing "Open With..." to open. NEW: In Windows, added a low-tech solution to choose between different monitors connected to the SAME video card (doesn't work in multi-video-card - situations.) (Set the string key HKCU\Software\Synthesia\Monitor to "0" + situations.) (Set the string key HKCU\Software\PianoGame\Monitor to "0" for primary monitory, "1" for secondary, etc.) CHG: Mac OpenGL display now has v-sync enabled. CHG: Mac game window is now much less obtrusive. Other windows are allowed to diff --git a/src/CompatibleSystem.cpp b/src/CompatibleSystem.cpp index 5f67bdf..bf247d7 100644 --- a/src/CompatibleSystem.cpp +++ b/src/CompatibleSystem.cpp @@ -24,7 +24,7 @@ namespace Compatible void ShowError(const std::wstring &err) { - const static std::wstring friendly_app_name = WSTRING(L"Synthesia " << SynthesiaVersionString); + const static std::wstring friendly_app_name = WSTRING(L"Piano Game " << PianoGameVersionString); const static std::wstring message_box_title = WSTRING(friendly_app_name << L" Error"); #ifdef WIN32 diff --git a/src/KeyboardDisplay.cpp b/src/KeyboardDisplay.cpp index d7a5042..d6be797 100644 --- a/src/KeyboardDisplay.cpp +++ b/src/KeyboardDisplay.cpp @@ -4,7 +4,7 @@ #include "KeyboardDisplay.h" #include "TrackProperties.h" -#include "SynthesiaError.h" +#include "PianoGameError.h" #include "string_util.h" #include "Renderer.h" @@ -116,7 +116,7 @@ int KeyboardDisplay::GetStartingOctave() const case KeyboardSize61: return StartingOctaveOn61; case KeyboardSize76: return StartingOctaveOn76; case KeyboardSize88: return StartingOctaveOn88; - default: throw SynthesiaError(Error_BadPianoType); + default: throw PianoGameError(Error_BadPianoType); } } @@ -136,7 +136,7 @@ char KeyboardDisplay::GetStartingNote() const case KeyboardSize61: return StartingKeyOn61; case KeyboardSize76: return StartingKeyOn76; case KeyboardSize88: return StartingKeyOn88; - default: throw SynthesiaError(Error_BadPianoType); + default: throw PianoGameError(Error_BadPianoType); } } @@ -156,7 +156,7 @@ int KeyboardDisplay::GetWhiteKeyCount() const case KeyboardSize61: return WhiteKeysOn61; case KeyboardSize76: return WhiteKeysOn76; case KeyboardSize88: return WhiteKeysOn88; - default: throw SynthesiaError(Error_BadPianoType); + default: throw PianoGameError(Error_BadPianoType); } } @@ -407,7 +407,7 @@ void KeyboardDisplay::DrawNotePass(Renderer &renderer, const Tga *tex_white, con case KeyboardSize61: keyboard_type_offset = 7 - WhiteNotesPerOctave; break; // TODO! case KeyboardSize76: keyboard_type_offset = 5 - WhiteNotesPerOctave; break; // TODO! case KeyboardSize88: keyboard_type_offset = 2 - WhiteNotesPerOctave; break; - default: throw SynthesiaError(Error_BadPianoType); + default: throw PianoGameError(Error_BadPianoType); } // This array describes how to "stack" notes in a single place. The IsBlackNote array diff --git a/src/SynthesiaError.cpp b/src/PianoGameError.cpp similarity index 69% rename from src/SynthesiaError.cpp rename to src/PianoGameError.cpp index fc51641..f34df58 100644 --- a/src/SynthesiaError.cpp +++ b/src/PianoGameError.cpp @@ -2,21 +2,21 @@ // Copyright (c)2007 Nicholas Piegdon // See license.txt for license information -#include "SynthesiaError.h" +#include "PianoGameError.h" #include "string_util.h" using namespace std; -std::wstring SynthesiaError::GetErrorDescription() const +std::wstring PianoGameError::GetErrorDescription() const { switch (m_error) { case Error_StringSpecified: return m_optional_string; case Error_BadPianoType: return L"Bad piano type specified."; - case Error_BadGameState: return L"Internal Error: Synthesia entered bad game state!"; + case Error_BadGameState: return L"Internal Error: Piano Game entered bad game state!"; - default: return WSTRING(L"Unknown SynthesiaError Code (" << m_error << L")."); + default: return WSTRING(L"Unknown PianoGameError Code (" << m_error << L")."); } } diff --git a/src/SynthesiaError.h b/src/PianoGameError.h similarity index 53% rename from src/SynthesiaError.h rename to src/PianoGameError.h index 65f7833..e4c4b05 100644 --- a/src/SynthesiaError.h +++ b/src/PianoGameError.h @@ -2,13 +2,13 @@ // Copyright (c)2007 Nicholas Piegdon // See license.txt for license information -#ifndef __SYNTHESIA_ERROR_H -#define __SYNTHESIA_ERROR_H +#ifndef __PIANOGAME_ERROR_H +#define __PIANOGAME_ERROR_H #include #include -enum SynthesiaErrorCode +enum PianoGameErrorCode { Error_StringSpecified, @@ -16,23 +16,23 @@ enum SynthesiaErrorCode Error_BadGameState }; -class SynthesiaError : public std::exception +class PianoGameError : public std::exception { public: // TODO: This would be a sweet place to add stack-trace information... - SynthesiaError(SynthesiaErrorCode error) : m_error(error), m_optional_string(L"") { } - SynthesiaError(const std::wstring error) : m_error(Error_StringSpecified), m_optional_string(error) { } + PianoGameError(PianoGameErrorCode error) : m_error(error), m_optional_string(L"") { } + PianoGameError(const std::wstring error) : m_error(Error_StringSpecified), m_optional_string(error) { } std::wstring GetErrorDescription() const; - ~SynthesiaError() throw() { } + ~PianoGameError() throw() { } - const SynthesiaErrorCode m_error; + const PianoGameErrorCode m_error; private: const std::wstring m_optional_string; - SynthesiaError operator=(const SynthesiaError&); + PianoGameError operator=(const PianoGameError&); }; #endif diff --git a/src/State_Title.cpp b/src/State_Title.cpp index 7052bc1..733aa3a 100644 --- a/src/State_Title.cpp +++ b/src/State_Title.cpp @@ -323,7 +323,7 @@ void TitleState::Update() m_tooltip = L""; - if (m_back_button.hovering) m_tooltip = L"Click to exit Synthesia."; + if (m_back_button.hovering) m_tooltip = L"Click to exit Piano Game."; if (m_continue_button.hovering) m_tooltip = L"Click to continue on to the track selection screen."; if (m_file_tile->WholeTile().hovering) m_tooltip = L"Click to choose a different MIDI file."; @@ -371,7 +371,6 @@ void TitleState::Draw(Renderer &renderer) const renderer.SetColor(White); renderer.DrawTga(GetTexture(TitleLogo), left, TitleY); - renderer.DrawTga(GetTexture(GameMusicThemes), left+3, TitleY + (compress_height ? 120 : 150) ); TextWriter version(Layout::ScreenMarginX, GetStateHeight() - Layout::ScreenMarginY - Layout::SmallFontSize * 2, renderer, false, Layout::SmallFontSize); @@ -381,7 +380,7 @@ void TitleState::Draw(Renderer &renderer) const extra = L" debug"; #endif - version << Text(WSTRING(L"version " << SynthesiaVersionString << extra), Gray); + version << Text(WSTRING(L"version " << PianoGameVersionString << extra), Gray); Layout::DrawHorizontalRule(renderer, GetStateWidth(), GetStateHeight() - Layout::ScreenMarginY); diff --git a/src/TextWriter.cpp b/src/TextWriter.cpp index a534336..b900786 100644 --- a/src/TextWriter.cpp +++ b/src/TextWriter.cpp @@ -6,7 +6,7 @@ #include "TextWriter.h" #include "Renderer.h" -#include "SynthesiaError.h" +#include "PianoGameError.h" #include "os_graphics.h" #ifdef WIN32 @@ -80,13 +80,13 @@ x(in_x), y(in_y), size(in_size), original_x(0), last_line_height(0), centered(in const CFStringRef font_name = CFSTR("Trebuchet MS"); ATSFontFamilyRef font = ATSFontFamilyFindFromName(font_name, kATSOptionFlagsDefault); - if (!font) throw SynthesiaError(WSTRING(L"Couldn't get ATSFontFamilyRef for font '" << WideFromMacString(font_name) << L"'.")); + if (!font) throw PianoGameError(WSTRING(L"Couldn't get ATSFontFamilyRef for font '" << WideFromMacString(font_name) << L"'.")); AGLContext context = aglGetCurrentContext(); - if (!context) throw SynthesiaError(L"Couldn't retrieve OpenGL context while creating font."); + if (!context) throw PianoGameError(L"Couldn't retrieve OpenGL context while creating font."); GLboolean ret = aglUseFont(context, font, normal, size, 0, 128, list_start); - if (ret == GL_FALSE) throw SynthesiaError(WSTRING(L"aglUseFont() call failed with error code: " << aglGetError())); + if (ret == GL_FALSE) throw PianoGameError(WSTRING(L"aglUseFont() call failed with error code: " << aglGetError())); font_size_lookup[size] = list_start; @@ -95,7 +95,7 @@ x(in_x), y(in_y), size(in_size), original_x(0), last_line_height(0), centered(in ATSUStyle style; OSStatus status = ATSUCreateStyle(&style); - if (status != noErr) throw SynthesiaError(WSTRING(L"Couldn't create ATSU style. Error code: " << static_cast(status))); + if (status != noErr) throw PianoGameError(WSTRING(L"Couldn't create ATSU style. Error code: " << static_cast(status))); Fixed fixed_size = Long2Fix(size); @@ -103,7 +103,7 @@ x(in_x), y(in_y), size(in_size), original_x(0), last_line_height(0), centered(in ByteCount sizes[] = { sizeof(Fixed) }; ATSUAttributeValuePtr values[] = { &fixed_size }; status = ATSUSetAttributes(style, sizeof(sizes) / sizeof(ByteCount), tags, sizes, values); - if (status != noErr) throw SynthesiaError(WSTRING(L"Couldn't set ATSU style attributes. Error code: " << static_cast(status))); + if (status != noErr) throw PianoGameError(WSTRING(L"Couldn't set ATSU style attributes. Error code: " << static_cast(status))); atsu_style_lookup[size] = style; } @@ -182,14 +182,14 @@ void Text::calculate_position_and_advance_cursor(TextWriter &tw, int *out_x, int // Convert passed-in text to Unicode CFStringRef cftext = MacStringFromWide(m_text, true).get(); CFDataRef unitext = CFStringCreateExternalRepresentation(kCFAllocatorDefault, cftext, kCFStringEncodingUnicode, 0); - if (!unitext) throw SynthesiaError(WSTRING(L"Couldn't convert string to unicode: '" << m_text << L"'")); + if (!unitext) throw PianoGameError(WSTRING(L"Couldn't convert string to unicode: '" << m_text << L"'")); CFRelease(cftext); // Create an ATSU layout ATSUTextLayout layout; const UniCharCount run_length = kATSUToTextEnd; OSStatus status = ATSUCreateTextLayoutWithTextPtr((ConstUniCharArrayPtr)CFDataGetBytePtr(unitext), kATSUFromTextBeginning, kATSUToTextEnd, CFDataGetLength(unitext) / 2, 1, &run_length, &atsu_style_lookup[tw.size], &layout); - if (status != noErr) throw SynthesiaError(WSTRING(L"Couldn't create ATSU text layout for string: '" << m_text << L"', Error code: " << static_cast(status))); + if (status != noErr) throw PianoGameError(WSTRING(L"Couldn't create ATSU text layout for string: '" << m_text << L"', Error code: " << static_cast(status))); // Measure the size of the resulting text Rect drawing_rect = { 0, 0, 0, 0 }; @@ -200,7 +200,7 @@ void Text::calculate_position_and_advance_cursor(TextWriter &tw, int *out_x, int ATSUTextMeasurement descent = 0; status = ATSUGetUnjustifiedBounds(layout, 0, kATSUToTextEnd, &before, &after, &ascent, &descent); - if (status != noErr) throw SynthesiaError(WSTRING(L"Couldn't get unjustified bounds for text layout for string: '" << m_text << L"', Error code: " << static_cast(status))); + if (status != noErr) throw PianoGameError(WSTRING(L"Couldn't get unjustified bounds for text layout for string: '" << m_text << L"', Error code: " << static_cast(status))); // NOTE: the +1 here is completely arbitrary and seemed to place the text better. // It may just be a difference between the Windows and Mac text placement systems. diff --git a/src/Textures.h b/src/Textures.h index 512530f..a8d8634 100644 --- a/src/Textures.h +++ b/src/Textures.h @@ -9,7 +9,6 @@ enum Texture { TitleLogo, InterfaceButtons, - GameMusicThemes, ButtonRetrySong, ButtonChooseTracks, @@ -45,7 +44,6 @@ const static wchar_t* TextureResourceNames[_TextureEnumCount] = { L"title_Logo", L"InterfaceButtons", - L"title_GameMusicThemes", L"score_RetrySong", L"title_ChooseTracks", diff --git a/src/Tga.cpp b/src/Tga.cpp index 3df274a..4c2b5a7 100644 --- a/src/Tga.cpp +++ b/src/Tga.cpp @@ -3,7 +3,7 @@ #include "os.h" #include "os_graphics.h" #include "string_util.h" -#include "SynthesiaError.h" +#include "PianoGameError.h" Tga* Tga::Load(const std::wstring &resource_name) { @@ -14,13 +14,13 @@ Tga* Tga::Load(const std::wstring &resource_name) const HMODULE module = 0; HRSRC resource_id = FindResource(module, resource_name.c_str(), L"GRAPHICS"); - if (!resource_id) throw SynthesiaError(L"Couldn't find TGA resource."); + if (!resource_id) throw PianoGameError(L"Couldn't find TGA resource."); HGLOBAL resource = LoadResource(module, resource_id); - if (!resource) throw SynthesiaError(L"Couldn't load TGA resource."); + if (!resource) throw PianoGameError(L"Couldn't load TGA resource."); const unsigned char *bytes = reinterpret_cast(LockResource(resource)); - if (!bytes) throw SynthesiaError(L"Couldn't lock TGA resource."); + if (!bytes) throw PianoGameError(L"Couldn't lock TGA resource."); Tga *ret = LoadFromData(bytes); FreeResource(resource); @@ -31,12 +31,12 @@ Tga* Tga::Load(const std::wstring &resource_name) std::wstring full_name = WSTRING(resource_name << L".tga"); CFURLRef url = CFBundleCopyResourceURL(CFBundleGetMainBundle(), MacStringFromWide(full_name).get(), 0, 0); - if (!url) throw SynthesiaError(L"Couldn't find TGA resource."); + if (!url) throw PianoGameError(L"Couldn't find TGA resource."); OSStatus status; CFDataRef data; Boolean success = CFURLCreateDataAndPropertiesFromResource(0, url, &data, 0, 0, &status); - if (!success || status != 0) throw SynthesiaError(L"Couldn't load TGA resource."); + if (!success || status != 0) throw PianoGameError(L"Couldn't load TGA resource."); const UInt8 *bytes = CFDataGetBytePtr(data); @@ -92,7 +92,7 @@ Tga *Tga::LoadFromData(const unsigned char *bytes) if (type == TgaUnknown) { - throw SynthesiaError(L"Unsupported TGA type."); + throw PianoGameError(L"Unsupported TGA type."); } // We're done with the type header @@ -108,12 +108,12 @@ Tga *Tga::LoadFromData(const unsigned char *bytes) if (width <= 0 || height <= 0) { - throw SynthesiaError(L"Invalid TGA dimensions."); + throw PianoGameError(L"Invalid TGA dimensions."); } if (bpp != 24 && bpp != 32) { - throw SynthesiaError(L"Unsupported TGA BPP."); + throw PianoGameError(L"Unsupported TGA BPP."); } const unsigned int data_size = width * height * bpp/8; @@ -175,7 +175,7 @@ Tga *Tga::LoadCompressed(const unsigned char *src, unsigned char *dest, unsigned byte += BytesPerPixel; pixel++; - if (pixel > PixelCount) throw SynthesiaError(L"Too many pixels in TGA."); + if (pixel > PixelCount) throw PianoGameError(L"Too many pixels in TGA."); } } else @@ -195,7 +195,7 @@ Tga *Tga::LoadCompressed(const unsigned char *src, unsigned char *dest, unsigned byte += BytesPerPixel; pixel++; - if (pixel > PixelCount) throw SynthesiaError(L"Too many pixels in TGA."); + if (pixel > PixelCount) throw PianoGameError(L"Too many pixels in TGA."); } } } diff --git a/src/file_selector.cpp b/src/file_selector.cpp index e2c4cb9..4cad626 100644 --- a/src/file_selector.cpp +++ b/src/file_selector.cpp @@ -2,7 +2,7 @@ // Copyright (c)2007 Nicholas Piegdon // See license.txt for license information -#include "SynthesiaError.h" +#include "PianoGameError.h" #include "file_selector.h" #include "UserSettings.h" #include "string_util.h" @@ -35,12 +35,12 @@ static pascal Boolean NavOpenFilterProc(AEDesc *item, void *info, NavCallBackUse FSRef fsRef; status = AEGetDescData(item, &fsRef, sizeof(fsRef)); - if (status != noErr) throw SynthesiaError(WSTRING(L"Couldn't get item description. Error code: " << static_cast(status))); + if (status != noErr) throw PianoGameError(WSTRING(L"Couldn't get item description. Error code: " << static_cast(status))); const static int BufferSize(1024); char path_buffer[BufferSize]; status = FSRefMakePath(&fsRef, (UInt8*)path_buffer, BufferSize); - if (status != noErr) throw SynthesiaError(WSTRING(L"Couldn't get file path. Error code: " << static_cast(status))); + if (status != noErr) throw PianoGameError(WSTRING(L"Couldn't get file path. Error code: " << static_cast(status))); std::string path(path_buffer); if (path.length() < 5) return false; @@ -95,7 +95,7 @@ void RequestMidiFilename(std::wstring *returned_filename, std::wstring *returned ZeroMemory(&ofn, sizeof(OPENFILENAME)); ofn.lStructSize = sizeof(OPENFILENAME); ofn.hwndOwner = 0; - ofn.lpstrTitle = L"Synthesia: Choose a MIDI song to play"; + ofn.lpstrTitle = L"Piano Game: Choose a MIDI song to play"; ofn.lpstrFilter = L"MIDI Files (*.mid)\0*.mid;*.midi\0All Files (*.*)\0*.*\0"; ofn.lpstrFile = filename; ofn.nMaxFile = BufferSize; @@ -125,9 +125,9 @@ void RequestMidiFilename(std::wstring *returned_filename, std::wstring *returned NavDialogCreationOptions options; status = NavGetDefaultDialogCreationOptions(&options); - if (status != noErr) throw SynthesiaError(WSTRING(L"Couldn't create dialog options. Error code: " << static_cast(status))); + if (status != noErr) throw PianoGameError(WSTRING(L"Couldn't create dialog options. Error code: " << static_cast(status))); - options.windowTitle = CFSTR("Synthesia: Choose a MIDI song to play"); + options.windowTitle = CFSTR("Piano Game: Choose a MIDI song to play"); // TODO: Should clean this up at shut-down static NavObjectFilterUPP navFilterUPP(0); @@ -135,10 +135,10 @@ void RequestMidiFilename(std::wstring *returned_filename, std::wstring *returned NavDialogRef navDialog(0); status = NavCreateChooseFileDialog(&options, 0, 0, 0, navFilterUPP, 0, &navDialog); - if (status != noErr) throw SynthesiaError(WSTRING(L"Couldn't create open dialog. Error code: " << static_cast(status))); + if (status != noErr) throw PianoGameError(WSTRING(L"Couldn't create open dialog. Error code: " << static_cast(status))); status = NavDialogRun(navDialog); - if (status != noErr) throw SynthesiaError(WSTRING(L"Couldn't run open dialog. Error code: " << static_cast(status))); + if (status != noErr) throw PianoGameError(WSTRING(L"Couldn't run open dialog. Error code: " << static_cast(status))); NavReplyRecord navReply; status = NavDialogGetReply(navDialog, &navReply); @@ -154,22 +154,22 @@ void RequestMidiFilename(std::wstring *returned_filename, std::wstring *returned long item_count = 0; status = AECountItems(&navReply.selection, &item_count); - if (status != noErr) throw SynthesiaError(WSTRING(L"Couldn't count resulting items from open dialog. Error code: " << static_cast(status))); + if (status != noErr) throw PianoGameError(WSTRING(L"Couldn't count resulting items from open dialog. Error code: " << static_cast(status))); for (long i = 1; i <= item_count; i++) { FSRef fsRef; status = AEGetNthPtr(&navReply.selection, i, typeFSRef, 0, 0, &fsRef, sizeof(FSRef), 0); - if (status != noErr) throw SynthesiaError(WSTRING(L"Couldn't get FSRef pointer from open dialog. Error code: " << static_cast(status))); + if (status != noErr) throw PianoGameError(WSTRING(L"Couldn't get FSRef pointer from open dialog. Error code: " << static_cast(status))); CFStringRef file_title; status = LSCopyDisplayNameForRef( &fsRef, &file_title ); - if (status != noErr) throw SynthesiaError(WSTRING(L"Couldn't get file title. Error code: " << static_cast(status))); + if (status != noErr) throw PianoGameError(WSTRING(L"Couldn't get file title. Error code: " << static_cast(status))); const static int BufferSize(1024); char path_buffer[BufferSize]; status = FSRefMakePath(&fsRef, (UInt8*)path_buffer, BufferSize); - if (status != noErr) throw SynthesiaError(WSTRING(L"Couldn't get file path. Error code: " << static_cast(status))); + if (status != noErr) throw PianoGameError(WSTRING(L"Couldn't get file path. Error code: " << static_cast(status))); std::string narrow_path(path_buffer); std::wstring filepath(narrow_path.begin(), narrow_path.end()); diff --git a/src/libmidi/MidiComm.cpp b/src/libmidi/MidiComm.cpp index 0624a8f..f529706 100644 --- a/src/libmidi/MidiComm.cpp +++ b/src/libmidi/MidiComm.cpp @@ -164,9 +164,9 @@ void MidiCommIn::InputCallback(unsigned int msg, unsigned long p1, unsigned long catch (const MidiError &e) { // TODO: These appear in main.cpp too. Consolidate them. - const static wstring error_header1 = L"Synthesia detected a"; + const static wstring error_header1 = L"Piano Game detected a"; const static wstring error_header2 = L" problem and must close:\n\n"; - const static wstring error_footer = L"\n\nIf you don't think this should have happened, please\ncontact Nicholas (nicholas@synthesiagame.com) and\ndescribe what you were doing when the problem\noccurred. Thanks."; + const static wstring error_footer = L"\n"; wstring wrapped_description = WSTRING(error_header1 << L" MIDI" << error_header2 << e.GetErrorDescription() << error_footer); Compatible::ShowError(wrapped_description); @@ -398,8 +398,8 @@ MidiCommIn::MidiCommIn(unsigned int device_id) m_description = MidiCommIn::GetDeviceList()[device_id]; - MIDIClientCreate(CFSTR("Synthesia"), 0, this, &m_client); - MIDIInputPortCreate(m_client, CFSTR("Synthesia In"), midi_input, this, &m_port); + MIDIClientCreate(CFSTR("Piano Game"), 0, this, &m_client); + MIDIInputPortCreate(m_client, CFSTR("Piano Game In"), midi_input, this, &m_port); MIDIEndpointRef source = MIDIGetSource(device_id); MIDIPortConnectSource(m_port, source, this); @@ -539,8 +539,8 @@ void MidiCommOut::Acquire(unsigned int device_id) } else { - MIDIClientCreate(CFSTR("Synthesia"), 0, this, &m_client); - MIDIOutputPortCreate(m_client, CFSTR("Synthesia Out"), &m_port); + MIDIClientCreate(CFSTR("Piano Game"), 0, this, &m_client); + MIDIOutputPortCreate(m_client, CFSTR("Piano Game Out"), &m_port); // The -1 here is because device_id 0 represents the built-in // synth and pushes all the other devices over by one. diff --git a/src/libmidi/SynthVolume.h b/src/libmidi/SynthVolume.h index b3cbc42..bc58243 100644 --- a/src/libmidi/SynthVolume.h +++ b/src/libmidi/SynthVolume.h @@ -13,7 +13,7 @@ // Windows Media Player (starting in version 11) has started changing // the MIDI synth volume to 0 after playing a MIDI file and exiting. // Seeing as how that's a common file-preview path just before starting -// Synthesia, we have to combat the behavior ourselves. +// Piano Game, we have to combat the behavior ourselves. // // Once initialized, it checks to see if the system MIDI synth volume // is "reasonable" (above 33% or so volume), and if not, it will set diff --git a/src/main.cpp b/src/main.cpp index 5caab13..2fe7460 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -14,7 +14,7 @@ #include "resource.h" #include "CompatibleSystem.h" -#include "SynthesiaError.h" +#include "PianoGameError.h" #include "libmidi/Midi.h" #include "libmidi/SynthVolume.h" @@ -66,12 +66,12 @@ static const int WindowHeight = Compatible::GetDisplayHeight(); GameStateManager state_manager(WindowWidth, WindowHeight); -const static wstring application_name = L"Synthesia"; -const static std::wstring friendly_app_name = WSTRING(L"Synthesia " << SynthesiaVersionString); +const static wstring application_name = L"PianoGame"; +const static std::wstring friendly_app_name = WSTRING(L"Piano Game " << PianoGameVersionString); -const static wstring error_header1 = L"Synthesia detected a"; +const static wstring error_header1 = L"Piano Game detected a"; const static wstring error_header2 = L" problem and must close:\n\n"; -const static wstring error_footer = L"\n\nIf you don't think this should have happened, please\ncontact Nicholas (nicholas@synthesiagame.com) and\ndescribe what you were doing when the problem\noccurred. Thanks."; +const static wstring error_footer = L"\n"; class EdgeTracker { @@ -171,17 +171,17 @@ int main(int argc, char *argv[]) // The actual way to accept dragged-in files is by registering an Apple Event. static const EventTypeSpec appleEvents[] = { { kEventClassAppleEvent, kEventAppleEvent } }; status = InstallEventHandler(GetApplicationEventTarget(), NewEventHandlerUPP(AppleEventHandlerProc), GetEventTypeCount(appleEvents), appleEvents, 0, &AppleEventHandlerRef); - if (status != noErr) throw SynthesiaError(WSTRING(L"Unable to install Apple Event handler. Error code: " << static_cast(status))); + if (status != noErr) throw PianoGameError(WSTRING(L"Unable to install Apple Event handler. Error code: " << static_cast(status))); OSErr err = AEInstallEventHandler(kCoreEventClass, kAEOpenDocuments, OpenEventHandlerProc, 0, false); - if (err != noErr) throw SynthesiaError(WSTRING(L"Unable to install open-document event handler. Error code: " << static_cast(err))); + if (err != noErr) throw PianoGameError(WSTRING(L"Unable to install open-document event handler. Error code: " << static_cast(err))); // Now we run the application event loop a little early for a short duration // so we can intercept any dragged-in-file events before we proceed. EventRef event; while ((status = ReceiveNextEvent(0, 0, std::numeric_limits::epsilon(), true, &event)) != eventLoopTimedOutErr) { - if (status != noErr) throw SynthesiaError(WSTRING(L"Couldn't receive early event. Error code: " << static_cast(status))); + if (status != noErr) throw PianoGameError(WSTRING(L"Couldn't receive early event. Error code: " << static_cast(status))); SendEventToEventTarget(event, GetApplicationEventTarget()); ReleaseEvent(event); @@ -264,7 +264,7 @@ int main(int argc, char *argv[]) WS_POPUP, 0, 0, WindowWidth, WindowHeight, HWND_DESKTOP, 0, instance, 0); HDC dc_win = GetDC(hwnd); - if (!dc_win) throw SynthesiaError(L"Couldn't get window device context."); + if (!dc_win) throw PianoGameError(L"Couldn't get window device context."); // Grab the current pixel format and change a few fields int pixel_format_id = GetPixelFormat(dc_win); @@ -278,12 +278,12 @@ int main(int argc, char *argv[]) // After our changes, get the closest match the device has to offer pixel_format_id = ChoosePixelFormat(dc_win, &pfd); - if (!pixel_format_id) throw SynthesiaError(L"Unable to find a good pixel format."); - if (!SetPixelFormat(dc_win, pixel_format_id, &pfd)) throw SynthesiaError(L"Couldn't set (window) pixel format."); + if (!pixel_format_id) throw PianoGameError(L"Unable to find a good pixel format."); + if (!SetPixelFormat(dc_win, pixel_format_id, &pfd)) throw PianoGameError(L"Couldn't set (window) pixel format."); HGLRC glrc = wglCreateContext(dc_win); - if (!glrc) throw SynthesiaError(L"Couldn't create OpenGL rendering context."); - if (!wglMakeCurrent(dc_win, glrc)) throw SynthesiaError(L"Couldn't make OpenGL rendering context current."); + if (!glrc) throw PianoGameError(L"Couldn't create OpenGL rendering context."); + if (!wglMakeCurrent(dc_win, glrc)) throw PianoGameError(L"Couldn't make OpenGL rendering context current."); #else Rect windowRect; @@ -293,7 +293,7 @@ int main(int argc, char *argv[]) windowRect.bottom = (short)Compatible::GetDisplayHeight(); status = CreateNewWindow(kPlainWindowClass, kWindowStandardHandlerAttribute, &windowRect, &window); - if (status != noErr) throw SynthesiaError(WSTRING(L"Unable to create window. Error code: " << static_cast(status))); + if (status != noErr) throw PianoGameError(WSTRING(L"Unable to create window. Error code: " << static_cast(status))); SetWindowTitleWithCFString(window, MacStringFromWide(friendly_app_name).get()); @@ -307,17 +307,17 @@ int main(int argc, char *argv[]) // MACTODO: The fade effect is way cooler status = TransitionWindow(window, kWindowZoomTransitionEffect, kWindowShowTransitionAction, 0); - if (status != noErr) throw SynthesiaError(WSTRING(L"Unable to transition the window. Error code: " << static_cast(status))); + if (status != noErr) throw PianoGameError(WSTRING(L"Unable to transition the window. Error code: " << static_cast(status))); SetPortWindowPort(window); GLint attrib[] = { AGL_RGBA, AGL_DOUBLEBUFFER, AGL_NONE }; AGLPixelFormat aglPixelFormat = aglChoosePixelFormat(NULL, 0, attrib); - if (!aglPixelFormat) throw SynthesiaError(L"Couldn't set AGL pixel format."); + if (!aglPixelFormat) throw PianoGameError(L"Couldn't set AGL pixel format."); aglContext = aglCreateContext(aglPixelFormat, (aglGetCurrentContext() != 0) ? aglGetCurrentContext() : 0); aglSetDrawable(aglContext, GetWindowPort(window)); - if (!aglSetCurrentContext(aglContext)) throw SynthesiaError(L"Error in SetupAppleGLContext(): Could not set current AGL context."); + if (!aglSetCurrentContext(aglContext)) throw PianoGameError(L"Error in SetupAppleGLContext(): Could not set current AGL context."); aglSetCurrentContext(aglContext); aglUpdateContext(aglContext); @@ -398,7 +398,7 @@ int main(int argc, char *argv[]) return 0; #endif } - catch (const SynthesiaError &e) + catch (const PianoGameError &e) { wstring wrapped_description = WSTRING(error_header1 << error_header2 << e.GetErrorDescription() << error_footer); Compatible::ShowError(wrapped_description); @@ -410,12 +410,12 @@ int main(int argc, char *argv[]) } catch (const std::exception &e) { - wstring wrapped_description = WSTRING(L"Synthesia detected an unknown problem and must close! '" << e.what() << "'" << error_footer); + wstring wrapped_description = WSTRING(L"Piano Game detected an unknown problem and must close! '" << e.what() << "'" << error_footer); Compatible::ShowError(wrapped_description); } catch (...) { - wstring wrapped_description = WSTRING(L"Synthesia detected an unknown problem and must close!" << error_footer); + wstring wrapped_description = WSTRING(L"Piano Game detected an unknown problem and must close!" << error_footer); Compatible::ShowError(wrapped_description); } @@ -526,7 +526,7 @@ void InitEvents() }; ret = InstallEventHandler(GetApplicationEventTarget(), NewEventHandlerUPP(AppEventHandlerProc), GetEventTypeCount(appControlEvents), appControlEvents, 0, &AppEventHandlerRef); - if (ret != noErr) throw SynthesiaError(WSTRING(L"Unable to install app event handler. Error code: " << static_cast(ret))); + if (ret != noErr) throw PianoGameError(WSTRING(L"Unable to install app event handler. Error code: " << static_cast(ret))); static const EventTypeSpec mouseControlEvents[] = { @@ -536,7 +536,7 @@ void InitEvents() }; ret = InstallEventHandler( GetApplicationEventTarget(), NewEventHandlerUPP( MouseEventHandlerProc ), GetEventTypeCount(mouseControlEvents), mouseControlEvents, 0, &MouseEventHandlerRef ); - if (ret != noErr) throw SynthesiaError(WSTRING(L"Unable to install mouse event handler. Error code: " << static_cast(ret))); + if (ret != noErr) throw PianoGameError(WSTRING(L"Unable to install mouse event handler. Error code: " << static_cast(ret))); static const EventTypeSpec keyControlEvents[] = { @@ -546,7 +546,7 @@ void InitEvents() }; ret = InstallEventHandler( GetApplicationEventTarget(), NewEventHandlerUPP( KeyEventHandlerProc ), GetEventTypeCount(keyControlEvents), keyControlEvents, 0, &KeyEventHandlerRef ); - if (ret != noErr) throw SynthesiaError(WSTRING(L"Unable to install key event handler. Error code: " << static_cast(ret))); + if (ret != noErr) throw PianoGameError(WSTRING(L"Unable to install key event handler. Error code: " << static_cast(ret))); static const EventTypeSpec windowControlEvents[] = { @@ -568,7 +568,7 @@ void InitEvents() if (OtherWindowEventHandlerRef != 0) RemoveEventHandler(OtherWindowEventHandlerRef); ret = InstallEventHandler(GetWindowEventTarget(window), NewEventHandlerUPP(WindowEventHandlerProc), GetEventTypeCount(windowControlEvents), windowControlEvents, 0, &OtherWindowEventHandlerRef ); - if (ret != noErr) throw SynthesiaError(WSTRING(L"Unable to install window event handler. Error code: " << static_cast(ret))); + if (ret != noErr) throw PianoGameError(WSTRING(L"Unable to install window event handler. Error code: " << static_cast(ret))); } @@ -586,7 +586,7 @@ static pascal void GameLoop(EventLoopTimerRef inTimer, void *) state_manager.Draw(renderer); } - catch (const SynthesiaError &e) + catch (const PianoGameError &e) { wstring wrapped_description = WSTRING(error_header1 << error_header2 << e.GetErrorDescription() << error_footer); Compatible::ShowError(wrapped_description); @@ -600,13 +600,13 @@ static pascal void GameLoop(EventLoopTimerRef inTimer, void *) } catch (const std::exception &e) { - wstring wrapped_description = WSTRING(L"Synthesia detected an unknown problem and must close! '" << e.what() << "'" << error_footer); + wstring wrapped_description = WSTRING(L"Piano Game detected an unknown problem and must close! '" << e.what() << "'" << error_footer); Compatible::ShowError(wrapped_description); Compatible::GracefulShutdown(); } catch (...) { - wstring wrapped_description = WSTRING(L"Synthesia detected an unknown problem and must close!" << error_footer); + wstring wrapped_description = WSTRING(L"Piano Game detected an unknown problem and must close!" << error_footer); Compatible::ShowError(wrapped_description); Compatible::GracefulShutdown(); } @@ -617,7 +617,7 @@ static pascal OSErr OpenEventHandlerProc(const AppleEvent *event, AppleEvent *, { AEDescList docs; OSStatus status = AEGetParamDesc(event, keyDirectObject, typeAEList, &docs); - if (status != noErr) throw SynthesiaError(WSTRING(L"Couldn't get Apple Event parameter description. Error code: " << static_cast(status))); + if (status != noErr) throw PianoGameError(WSTRING(L"Couldn't get Apple Event parameter description. Error code: " << static_cast(status))); // We can only handle the first dragged-in file, so // all that matters is that the list isn't empty. @@ -627,12 +627,12 @@ static pascal OSErr OpenEventHandlerProc(const AppleEvent *event, AppleEvent *, FSRef ref; status = AEGetNthPtr(&docs, 1, typeFSRef, 0, 0, &ref, sizeof(ref), 0); - if (status != noErr) throw SynthesiaError(WSTRING(L"Couldn't look up Apple Event pointer. Error code: " << static_cast(status))); + if (status != noErr) throw PianoGameError(WSTRING(L"Couldn't look up Apple Event pointer. Error code: " << static_cast(status))); const static int BufferSize(1024); char path_buffer[BufferSize]; status = FSRefMakePath(&ref, (UInt8*)path_buffer, BufferSize); - if (status != noErr) throw SynthesiaError(WSTRING(L"Couldn't get file path. Error code: " << static_cast(status))); + if (status != noErr) throw PianoGameError(WSTRING(L"Couldn't get file path. Error code: " << static_cast(status))); std::string narrow_path(path_buffer); std::wstring path(narrow_path.begin(), narrow_path.end()); diff --git a/src/resource.rc b/src/resource.rc index fa2700c..7ed68e9 100644 --- a/src/resource.rc +++ b/src/resource.rc @@ -24,7 +24,6 @@ IDI_MAIN_ICON ICON "..\\app_icon.ico" title_Logo GRAPHICS "..\\graphics\\title_Logo.tga" InterfaceButtons GRAPHICS "..\\graphics\\InterfaceButtons.tga" -title_GameMusicThemes GRAPHICS "..\\graphics\\title_GameMusicThemes.tga" score_RetrySong GRAPHICS "..\\graphics\\score_RetrySong.tga" title_ChooseTracks GRAPHICS "..\\graphics\\title_ChooseTracks.tga" diff --git a/src/version.h b/src/version.h index 1ea2f8a..2b0a09d 100644 --- a/src/version.h +++ b/src/version.h @@ -2,12 +2,12 @@ // Copyright (c)2007 Nicholas Piegdon // See license.txt for license information -#ifndef __SYNTHESIA_VERSION_H -#define __SYNTHESIA_VERSION_H +#ifndef __PIANOGAME_VERSION_H +#define __PIANOGAME_VERSION_H #include // See readme.txt for a list of what has changed between versions -static const std::wstring SynthesiaVersionString = L"0.6.1a"; +static const std::wstring PianoGameVersionString = L"0.6.1b"; #endif