diff --git a/Aquaria/DSQ.cpp b/Aquaria/DSQ.cpp index 3156fd4..34d3ba1 100644 --- a/Aquaria/DSQ.cpp +++ b/Aquaria/DSQ.cpp @@ -34,6 +34,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "GridRender.h" #include "AutoMap.h" #include "PackRead.h" +#include "Protect.h" #include "RoundedRect.h" #include "TTFFont.h" @@ -903,6 +904,21 @@ void DSQ::setVersionLabelText() { os << AQUARIA_CUSTOM_BUILD_ID; #endif + std::string regName; + + #if AQUARIA_NODRM + #elif AQUARIA_FULL + os << " Registered to "; + + if (!getRegistrationName(regName)) + exit(1); + + os << regName; + #elif !defined(AQUARIA_DEMO) + os << " Registered to "; + os << "Review Copy"; + #endif + versionLabel->setText(os.str()); } diff --git a/Aquaria/DSQ.h b/Aquaria/DSQ.h index 622e9db..4238f6a 100644 --- a/Aquaria/DSQ.h +++ b/Aquaria/DSQ.h @@ -340,6 +340,8 @@ enum SongType const int numForms = 7; +bool getRegistrationName(std::string &name); + enum FormType { FORM_NONE = -1, diff --git a/Aquaria/Main.cpp b/Aquaria/Main.cpp index e17dd9b..e70ba1d 100644 --- a/Aquaria/Main.cpp +++ b/Aquaria/Main.cpp @@ -18,51 +18,116 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +//#define SANITY_TEST -#include "DSQ.h" +#ifdef SANITY_TEST + #include "Core.h" + #include "Quad.h" + + class SanityTest : public Core + { + std::string dud; + public: + SanityTest() : Core(dud) + { + } + void init() + { + Core::init(); + + if (!createWindow(800,600,32,0, "Aquaria")) return; + debugLog("Init Input Library..."); + initInputLibrary(); + debugLog("OK"); + + debugLog("Init Sound Library..."); + initSoundLibrary(); + debugLog("OK"); + + debugLog("Init Graphics Library..."); + initGraphicsLibrary(0, 1); + core->enable2D(800); + //core->initFrameBuffer(); + debugLog("OK"); + + renderObjectLayers.resize(2); + + Quad *q = new Quad; + q->setTexture("gfx/Logo"); + q->position = Vector(400,300); + addRenderObject(q, 1); + + } + void onUpdate(float dt) + { + Core::onUpdate(dt); + if (core->getKeyState(KEY_ESCAPE)) + quit(); + } + }; + + int WINAPI WinMain( HINSTANCE hInstance, // Instance + HINSTANCE hPrevInstance, // Previous Instance + LPSTR lpCmdLine, // Command Line Parameters + int nCmdShow) // Window Show State + { + #ifdef _DEBUG + _CrtSetDbgFlag ( _CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF); + _CrtSetReportMode ( _CRT_ERROR, _CRTDBG_MODE_DEBUG); + #endif + + { + SanityTest core; + core.init(); + core.main(); + core.shutdown(); + + } + return (0); + } + +#else + + #include "DSQ.h" #ifdef BBGE_BUILD_WINDOWS #include #endif -static void MakeRan(void) -{ -#ifdef BBGE_BUILD_WINDOWS - std::ofstream out("ran"); - for (int i = 0; i < 32; i++) - out << rand()%1000; - out.close(); -#endif -} -static void StartAQConfig() -{ -#if defined(BBGE_BUILD_WINDOWS) -#if defined(AQUARIA_DEMO) || defined(AQUARIA_FULL) - if (!exists("ran", false)) - { - MakeRan(); - if(exists("aqconfig.exe", false)) - { - ShellExecute(NULL, "open", "aqconfig.exe", NULL, NULL, SW_SHOWNORMAL); - exit(0); - } - } -#endif - remove("ran"); -#endif -} + void enumerateTest() + { +#ifdef BBGE_BUILD_SDL + SDL_Rect **modes; + /* Get available fullscreen/hardware modes */ + modes=SDL_ListModes(NULL, SDL_FULLSCREEN|SDL_HWSURFACE); -static void CheckConfig(void) -{ #ifdef BBGE_BUILD_WINDOWS - bool hasCfg = exists("usersettings.xml", false); - if(!hasCfg) - StartAQConfig(); + /* Check is there are any modes available */ + if(modes == (SDL_Rect **)0){ + MessageBox(0, "No modes available!\n", "", MB_OK); + return; + } + + /* Check if or resolution is restricted */ + if(modes == (SDL_Rect **)-1){ + MessageBox(0, "All resolutions available.\n", "", MB_OK); + } + else{ + /* Print valid modes */ + printf("Available Modes\n"); + for(int i=0;modes[i];++i){ + std::ostringstream os; + os << "[" << modes[i]->w << "x" << modes[i]->h << "]"; + MessageBox(0, os.str().c_str(), "", MB_OK); + //printf(" %d x %d\n", modes[i]->w, modes[i]->h); + } + } #endif -} +#endif + } #if defined(BBGE_BUILD_WINDOWS) && !defined(BBGE_BUILD_SDL) @@ -144,11 +209,13 @@ static void CheckConfig(void) #endif std::string fileSystem = ""; + #ifdef BBGE_BUILD_UNIX const char *envPath = getenv("AQUARIA_DATA_PATH"); if (envPath != NULL) fileSystem = envPath; #endif + DSQ core(fileSystem); #endif @@ -159,6 +226,14 @@ static void CheckConfig(void) core.shutdown(); } +#ifdef BBGE_BUILD_WINDOWS + std::ofstream out("ran"); + for (int i = 0; i < 1; i++) + out << rand()%1000; + out.close(); +#endif + return (0); } +#endif diff --git a/Aquaria/Protect.cpp b/Aquaria/Protect.cpp new file mode 100644 index 0000000..2c7e6ce --- /dev/null +++ b/Aquaria/Protect.cpp @@ -0,0 +1,41 @@ +/* +Copyright (C) 2007, 2010 - Bit-Blot + +This file is part of Aquaria. + +Aquaria is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +as published by the Free Software Foundation; either version 2 +of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + +See the GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*/ +#include "Base.h" +#include "Protect.h" + +/* +#include +#include +#include +#include +*/ + + +//#define AQUARIA_CUSTOMBUILD 1 + +bool getRegistrationName(std::string &name) +{ + name = std::string("Aquaria Player"); + return true; +} + + + diff --git a/Aquaria/Protect.h b/Aquaria/Protect.h new file mode 100644 index 0000000..5e41145 --- /dev/null +++ b/Aquaria/Protect.h @@ -0,0 +1,23 @@ +/* +Copyright (C) 2007, 2010 - Bit-Blot + +This file is part of Aquaria. + +Aquaria is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +as published by the Free Software Foundation; either version 2 +of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + +See the GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*/ +#pragma once + +extern bool getRegistrationName(std::string &name); diff --git a/CMakeLists.txt b/CMakeLists.txt index 9436f09..1b20bda 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -206,6 +206,7 @@ ADD_DEFINITIONS(-DBBGE_BUILD_OPENGL=1) ADD_DEFINITIONS(-DBBGE_BUILD_OPENGL_DYNAMIC=1) ADD_DEFINITIONS(-DBBGE_BUILD_WIDESCREEN=1) ADD_DEFINITIONS(-DBBGE_BUILD_FMOD_OPENAL_BRIDGE=1) +ADD_DEFINITIONS(-DAQUARIA_NODRM=1) ADD_DEFINITIONS(-DAQUARIA_FULL=1) ADD_DEFINITIONS(-DAQUARIA_BUILD_CONSOLE=1) ADD_DEFINITIONS(-DAQUARIA_BUILD_SCENEEDITOR=1) @@ -293,6 +294,7 @@ SET(AQUARIA_SRCS ${SRCDIR}/Path.cpp ${SRCDIR}/PathFinding.cpp ${SRCDIR}/PathRender.cpp + ${SRCDIR}/Protect.cpp ${SRCDIR}/RecipeMenuEntry.cpp ${SRCDIR}/SceneEditor.cpp ${SRCDIR}/SchoolFish.cpp