1
0
Fork 0
mirror of https://github.com/AquariaOSE/Aquaria.git synced 2024-12-25 06:05:45 +00:00

Revert "remove last remains of DRM-related code and cleanup main() a bit"

This reverts commit 9757cb2fca.

Conflicts:

	Aquaria/Main.cpp
This commit is contained in:
fgenesis 2011-08-11 01:38:25 +02:00
parent ab11cdb4e4
commit f23b69ffc3
6 changed files with 192 additions and 33 deletions

View file

@ -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());
}

View file

@ -340,6 +340,8 @@ enum SongType
const int numForms = 7;
bool getRegistrationName(std::string &name);
enum FormType
{
FORM_NONE = -1,

View file

@ -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 <shellapi.h>
#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

41
Aquaria/Protect.cpp Normal file
View file

@ -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 <windows.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
*/
//#define AQUARIA_CUSTOMBUILD 1
bool getRegistrationName(std::string &name)
{
name = std::string("Aquaria Player");
return true;
}

23
Aquaria/Protect.h Normal file
View file

@ -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);

View file

@ -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