From 9757cb2fca399fc1801fd261a31e6a7da4de04ad Mon Sep 17 00:00:00 2001 From: fgenesis Date: Mon, 8 Aug 2011 04:14:46 +0200 Subject: [PATCH] remove last remains of DRM-related code and cleanup main() a bit --- Aquaria/DSQ.cpp | 16 ---- Aquaria/DSQ.h | 2 - Aquaria/Main.cpp | 176 +++++++++++--------------------------------- Aquaria/Protect.cpp | 41 ----------- Aquaria/Protect.h | 23 ------ CMakeLists.txt | 2 - 6 files changed, 43 insertions(+), 217 deletions(-) delete mode 100644 Aquaria/Protect.cpp delete mode 100644 Aquaria/Protect.h diff --git a/Aquaria/DSQ.cpp b/Aquaria/DSQ.cpp index 34d3ba1..3156fd4 100644 --- a/Aquaria/DSQ.cpp +++ b/Aquaria/DSQ.cpp @@ -34,7 +34,6 @@ 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" @@ -904,21 +903,6 @@ 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 a3a2cee..aa85a72 100644 --- a/Aquaria/DSQ.h +++ b/Aquaria/DSQ.h @@ -341,8 +341,6 @@ 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 29fb0f3..881272f 100644 --- a/Aquaria/Main.cpp +++ b/Aquaria/Main.cpp @@ -18,116 +18,51 @@ 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 -#ifdef SANITY_TEST - #include "Core.h" - #include "Quad.h" - - class SanityTest : public Core - { - std::string dud; - public: +#include "DSQ.h" - 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 - - void enumerateTest() - { -#ifdef BBGE_BUILD_SDL - SDL_Rect **modes; - /* Get available fullscreen/hardware modes */ - modes=SDL_ListModes(NULL, SDL_FULLSCREEN|SDL_HWSURFACE); - +static void MakeRan(void) +{ #ifdef BBGE_BUILD_WINDOWS - /* Check is there are any modes available */ - if(modes == (SDL_Rect **)0){ - MessageBox(0, "No modes available!\n", "", MB_OK); - return; - } + std::ofstream out("ran"); + for (int i = 0; i < 32; i++) + out << rand()%1000; + out.close(); +#endif +} - /* 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); - } - } +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 - } +} + +static void CheckConfig(void) +{ +#ifdef BBGE_BUILD_WINDOWS + bool hasCfg = exists("usersettings.xml", false); + if(!hasCfg) + StartAQConfig(); +#endif +} #if defined(BBGE_BUILD_WINDOWS) && defined(AQUARIA_WIN32_NOCONSOLE) @@ -147,51 +82,26 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. extern "C" int main(int argc,char *argv[]) { - -#ifdef BBGE_BUILD_WINDOWS - #if defined(AQUARIA_DEMO) || defined(AQUARIA_FULL) - if (!exists("ran", false)) - { - std::ofstream out("ran"); - for (int i = 0; i < 32; i++) - out << rand()%1000; - out.close(); - - ShellExecute(NULL, "open", "aqconfig.exe", NULL, NULL, SW_SHOWNORMAL); - - exit(0); - } - #endif - - remove("ran"); -#endif - - std::string dsqParam = ""; + std::string dsqParam = ""; // fileSystem #ifdef BBGE_BUILD_UNIX const char *envPath = getenv("AQUARIA_DATA_PATH"); if (envPath != NULL) dsqParam = envPath; #endif - #endif - DSQ core(dsqParam); - { - core.init(); - //enumerateTest(); - core.main(); - core.shutdown(); - } + CheckConfig(); -#ifdef BBGE_BUILD_WINDOWS - std::ofstream out("ran"); - for (int i = 0; i < 1; i++) - out << rand()%1000; - out.close(); -#endif + { + DSQ dsql(dsqParam); + dsql.init(); + dsql.main(); + dsql.shutdown(); + } + + MakeRan(); return (0); } -#endif diff --git a/Aquaria/Protect.cpp b/Aquaria/Protect.cpp deleted file mode 100644 index 2c7e6ce..0000000 --- a/Aquaria/Protect.cpp +++ /dev/null @@ -1,41 +0,0 @@ -/* -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 deleted file mode 100644 index 5e41145..0000000 --- a/Aquaria/Protect.h +++ /dev/null @@ -1,23 +0,0 @@ -/* -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 caf63ac..4c1d163 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -199,7 +199,6 @@ 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) @@ -290,7 +289,6 @@ SET(AQUARIA_SRCS ${SRCDIR}/Path.cpp ${SRCDIR}/PathFinding.cpp ${SRCDIR}/PathRender.cpp - ${SRCDIR}/Protect.cpp ${SRCDIR}/RecipeMenuEntry.cpp ${SRCDIR}/SceneEditor.cpp ${SRCDIR}/SchoolFish.cpp