mirror of
https://github.com/libretro/scummvm.git
synced 2025-01-24 19:45:07 +00:00
SLUDGE: remove platform dependent defines
This commit is contained in:
parent
7430ebe883
commit
bee42dc52f
@ -20,10 +20,6 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#if 0
|
||||
#include <SDL/SDL.h>
|
||||
#endif
|
||||
|
||||
#include "sludge/debug.h"
|
||||
#include "sludge/allfiles.h"
|
||||
#include "sludge/sludger.h"
|
||||
@ -995,11 +991,7 @@ builtIn(launch) {
|
||||
launchMe = copyString(newTextA);
|
||||
} else {
|
||||
char *gameDir;
|
||||
#ifdef _WIN32
|
||||
gameDir = joinStrings(gamePath, "\\");
|
||||
#else
|
||||
gameDir = joinStrings(gamePath, "/");
|
||||
#endif
|
||||
launchMe = joinStrings(gameDir, newText);
|
||||
delete newText;
|
||||
if (!launchMe)
|
||||
|
@ -20,14 +20,6 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#if 0
|
||||
#if !defined(HAVE_GLES2)
|
||||
#include "GLee.h"
|
||||
#else
|
||||
#include <GLES2/gl2.h>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include "sludge/allfiles.h"
|
||||
#include "sludge/cursors.h"
|
||||
#include "sludge/colours.h"
|
||||
|
@ -20,10 +20,6 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#if 0
|
||||
#include <stdarg.h>
|
||||
#endif
|
||||
|
||||
#include "sludge/allfiles.h"
|
||||
#include "sludge/debug.h"
|
||||
#include "sludge/language.h"
|
||||
|
@ -19,13 +19,6 @@
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
*/
|
||||
#if 0
|
||||
#include <errno.h>
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
// For unicode conversion
|
||||
#include <iconv.h>
|
||||
#endif
|
||||
|
||||
#include "common/file.h"
|
||||
#include "common/debug.h"
|
||||
@ -44,7 +37,7 @@ bool sliceBusy = true;
|
||||
|
||||
Common::File *bigDataFile = NULL;
|
||||
|
||||
uint32_t startOfDataIndex, startOfTextIndex, startOfSubIndex, startOfObjectIndex;
|
||||
uint32 startOfDataIndex, startOfTextIndex, startOfSubIndex, startOfObjectIndex;
|
||||
|
||||
bool openSubSlice(int num) {
|
||||
// FILE * dbug = fopen ("debuggy.txt", "at");
|
||||
|
@ -22,10 +22,6 @@
|
||||
#ifndef SLUDGE_FLOOR_H
|
||||
#define SLUDGE_FLOOR_H
|
||||
|
||||
#ifdef _WIN32
|
||||
#include "windef.h"
|
||||
#endif
|
||||
|
||||
namespace Sludge {
|
||||
|
||||
struct floorPolygon {
|
||||
@ -33,12 +29,10 @@ struct floorPolygon {
|
||||
int *vertexID;
|
||||
};
|
||||
|
||||
#ifndef _WIN32
|
||||
struct POINT {
|
||||
int x;
|
||||
int y;
|
||||
};
|
||||
#endif
|
||||
|
||||
struct flor {
|
||||
int originalNum;
|
||||
|
@ -19,21 +19,6 @@
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
*/
|
||||
#if 0
|
||||
#include <stdarg.h>
|
||||
|
||||
#include <SDL/SDL.h>
|
||||
|
||||
#if !defined(HAVE_GLES2)
|
||||
#ifdef _WIN32
|
||||
#include <GL\glu.h> // handy for gluErrorString
|
||||
#elif defined __APPLE__
|
||||
#include <OpenGL/glu.h>
|
||||
#else
|
||||
#include <GL/glu.h>
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include "sludge/allfiles.h"
|
||||
#include "sludge/debug.h"
|
||||
@ -364,62 +349,6 @@ void saveTexture(GLuint tex, GLubyte *data) {
|
||||
glViewport(old_vp[0], old_vp[1], old_vp[2], old_vp[3]);
|
||||
glBindFramebuffer(GL_FRAMEBUFFER, old_fbo);
|
||||
}
|
||||
#elif defined _WIN32
|
||||
// Replacement for glGetTexImage, because some ATI drivers are buggy.
|
||||
void saveTexture(GLuint tex, GLubyte *data) {
|
||||
setPixelCoords(true);
|
||||
|
||||
glBindTexture(GL_TEXTURE_2D, tex);
|
||||
|
||||
GLint tw, th;
|
||||
getTextureDimensions(tex, &tw, &th);
|
||||
|
||||
//glTexEnvf (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
|
||||
|
||||
int xoffset = 0;
|
||||
while (xoffset < tw) {
|
||||
int w = (tw - xoffset < viewportWidth) ? tw - xoffset : viewportWidth;
|
||||
|
||||
int yoffset = 0;
|
||||
while (yoffset < th) {
|
||||
int h = (th - yoffset < viewportHeight) ? th - yoffset : viewportHeight;
|
||||
|
||||
glClear(GL_COLOR_BUFFER_BIT); // Clear The Screen
|
||||
|
||||
const GLfloat vertices[] = {
|
||||
(GLfloat) - xoffset, (GLfloat) - yoffset, 0.f,
|
||||
(GLfloat)tw - xoffset, (GLfloat) - yoffset, 0.f,
|
||||
(GLfloat) - xoffset, (GLfloat) - yoffset + th, 0.f,
|
||||
(GLfloat)tw - xoffset, (GLfloat) - yoffset + th, 0.f
|
||||
};
|
||||
|
||||
const GLfloat texCoords[] = {
|
||||
0.0f, 0.0f,
|
||||
1.0f, 0.0f,
|
||||
0.0f, 1.0f,
|
||||
1.0f, 1.0f
|
||||
};
|
||||
|
||||
glUseProgram(shader.texture);
|
||||
setPMVMatrix(shader.texture);
|
||||
|
||||
drawQuad(shader.texture, vertices, 1, texCoords);
|
||||
glUseProgram(0);
|
||||
|
||||
for (int i = 0; i < h; i++) {
|
||||
glReadPixels(viewportOffsetX, viewportOffsetY + i, w, 1, GL_RGBA, GL_UNSIGNED_BYTE, data + xoffset * 4 + (yoffset + i) * 4 * tw);
|
||||
}
|
||||
|
||||
yoffset += viewportHeight;
|
||||
}
|
||||
|
||||
xoffset += viewportWidth;
|
||||
}
|
||||
//glReadPixels(viewportOffsetX, viewportOffsetY, tw, th, GL_RGBA, GL_UNSIGNED_BYTE, data);
|
||||
|
||||
setPixelCoords(false);
|
||||
|
||||
}
|
||||
#else
|
||||
#if 0
|
||||
void saveTexture(GLuint tex, GLubyte *data) {
|
||||
|
@ -22,15 +22,6 @@
|
||||
#ifndef SLUDGE_GRAPHICS_H
|
||||
#define SLUDGE_GRAPHICS_H
|
||||
|
||||
#if 0
|
||||
#if !defined(HAVE_GLES2)
|
||||
#include "GLee.h"
|
||||
#else
|
||||
#include <GLES2/gl2.h>
|
||||
#include "eglport/eglport.h"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include "graphics/surface.h"
|
||||
|
||||
namespace Sludge {
|
||||
|
@ -70,11 +70,7 @@ char *getPrefsFilename(char *filename) {
|
||||
|
||||
char *f = filename;
|
||||
for (i = 0; i < n; i++) {
|
||||
#ifdef _WIN32
|
||||
if (filename[i] == '\\')
|
||||
#else
|
||||
if (filename[i] == '/')
|
||||
#endif
|
||||
f = filename + i + 1;
|
||||
}
|
||||
|
||||
|
@ -15,6 +15,7 @@
|
||||
#include <cassert>
|
||||
#include <stdio.h>
|
||||
|
||||
#if 0
|
||||
MkvReader::MkvReader() :
|
||||
m_file(0)
|
||||
{
|
||||
@ -116,3 +117,4 @@ int MkvReader::Read(long long offset, long len, unsigned char* buffer)
|
||||
|
||||
return 0; //success
|
||||
}
|
||||
#endif
|
||||
|
@ -16,6 +16,7 @@
|
||||
|
||||
class MkvReader : public mkvparser::IMkvReader
|
||||
{
|
||||
#if 0
|
||||
MkvReader(const MkvReader&);
|
||||
MkvReader& operator=(const MkvReader&);
|
||||
public:
|
||||
@ -32,6 +33,7 @@ private:
|
||||
long long m_length;
|
||||
unsigned int m_start;
|
||||
int m_file;
|
||||
#endif
|
||||
};
|
||||
|
||||
#endif //MKVREADER_HPP
|
||||
|
@ -19,9 +19,6 @@
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
*/
|
||||
#if 0
|
||||
#include <stdlib.h>
|
||||
#endif
|
||||
|
||||
#include "sludge/graphics.h"
|
||||
#include "sludge/allfiles.h"
|
||||
|
@ -1,230 +0,0 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
*/
|
||||
#if defined __unix__ && !(defined __APPLE__)
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
#include <unistd.h>
|
||||
#include <stdlib.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/wait.h>
|
||||
#include <getopt.h>
|
||||
|
||||
#include "linuxstuff.h"
|
||||
#include "platform-dependent.h"
|
||||
#include "allfiles.h"
|
||||
#include "language.h" // for settings
|
||||
#include "debug.h"
|
||||
#include "helpers.h"
|
||||
|
||||
namespace Sludge {
|
||||
|
||||
extern settingsStruct gameSettings;
|
||||
cmdlineSettingsStruct cmdlineSettings;
|
||||
|
||||
extern char **languageName;
|
||||
|
||||
/*
|
||||
* Functions declared in linuxstuff.h:
|
||||
*/
|
||||
|
||||
void printCmdlineUsage() {
|
||||
fprintf(stdout, "OpenSLUDGE engine, usage: sludge-engine [<options>] <gamefile name>\n\n");
|
||||
fprintf(stdout, "Options:\n");
|
||||
fprintf(stdout, "-f, --fullscreen Set display mode to fullscreen\n");
|
||||
fprintf(stdout, "-w, --window Set display mode to windowed\n");
|
||||
fprintf(stdout, "-L, --list-languages Print available languages and their indices\n");
|
||||
fprintf(stdout, "-l<index>, --language=<index> Set language to <index> (look up with -L)\n");
|
||||
fprintf(stdout, "-a<number>, --antialias=<number> Turn antialiasing on (1) or off (0)\n");
|
||||
fprintf(stdout, " or choose linear interpolation (-1)\n");
|
||||
fprintf(stdout, "-d<number>, --debug=<number> Turn debug mode on (1) or off (0)\n");
|
||||
fprintf(stdout, "-h, --help Print this help message\n\n");
|
||||
fprintf(stdout, "Options are saved, so you don't need to specify them every time.\n");
|
||||
fprintf(stdout, "If you entered a wrong language number, use -l0 to reset the language to the default setting.\n");
|
||||
fprintf(stdout, "You can always toggle between fullscreen and windowed mode with \"Alt+Enter\"\n");
|
||||
fprintf(stdout, "or antialiasing on and off with \"Alt+A\".\n");
|
||||
}
|
||||
|
||||
void printLanguageTable() {
|
||||
if (gameSettings.numLanguages) {
|
||||
fprintf(stdout, "Index Language\n");
|
||||
for (unsigned int i = 0; i <= gameSettings.numLanguages; i++) {
|
||||
if (languageName[i]) {
|
||||
fprintf(stdout, "%d %s\n", i, languageName[i]);
|
||||
} else {
|
||||
fprintf(stdout, "%d Language %d\n", i, i);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
fprintf(stdout, "No translations available.\n");
|
||||
}
|
||||
}
|
||||
|
||||
bool parseCmdlineParameters(int argc, char *argv[]) {
|
||||
int retval = true;
|
||||
cmdlineSettings.fullscreenSet = false;
|
||||
cmdlineSettings.languageSet = false;
|
||||
cmdlineSettings.aaSet = false;
|
||||
cmdlineSettings.debugModeSet = false;
|
||||
cmdlineSettings.listLanguages = false;
|
||||
while (1) {
|
||||
static struct option long_options[] = {
|
||||
{"fullscreen", no_argument, 0, 'f' },
|
||||
{"window", no_argument, 0, 'w' },
|
||||
{"list-languages", no_argument, 0, 'L' },
|
||||
{"language", required_argument, 0, 'l' },
|
||||
{"antialias", required_argument, 0, 'a' },
|
||||
{"debug", required_argument, 0, 'd' },
|
||||
{"help", no_argument, 0, 'h' },
|
||||
{0, 0, 0, 0} /* This is a filler for -1 */
|
||||
};
|
||||
int option_index = 0;
|
||||
int c = getopt_long(argc, argv, "fwLl:a:d:h", long_options, &option_index);
|
||||
if (c == -1) break;
|
||||
switch (c) {
|
||||
case 'f':
|
||||
cmdlineSettings.fullscreenSet = true;
|
||||
cmdlineSettings.userFullScreen = true;
|
||||
break;
|
||||
case 'w':
|
||||
cmdlineSettings.fullscreenSet = true;
|
||||
cmdlineSettings.userFullScreen = false;
|
||||
break;
|
||||
case 'L':
|
||||
cmdlineSettings.listLanguages = true;
|
||||
break;
|
||||
case 'l':
|
||||
cmdlineSettings.languageSet = true;
|
||||
cmdlineSettings.languageID = atoi(optarg);
|
||||
break;
|
||||
case 'a':
|
||||
cmdlineSettings.aaSet = true;
|
||||
cmdlineSettings.antiAlias = atoi(optarg);
|
||||
break;
|
||||
case 'd':
|
||||
cmdlineSettings.debugModeSet = true;
|
||||
cmdlineSettings.debugMode = atoi(optarg);
|
||||
break;
|
||||
case 'h':
|
||||
default:
|
||||
retval = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return retval;
|
||||
}
|
||||
|
||||
/*
|
||||
* Functions declared in platform-dependent.h:
|
||||
*/
|
||||
|
||||
char *grabFileName() {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
int showSetupWindow() {
|
||||
if (cmdlineSettings.listLanguages) {
|
||||
printLanguageTable();
|
||||
return 0;
|
||||
}
|
||||
if (cmdlineSettings.languageSet) {
|
||||
if (cmdlineSettings.languageID <= gameSettings.numLanguages) {
|
||||
gameSettings.languageID = cmdlineSettings.languageID;
|
||||
} else {
|
||||
fprintf(stdout, "Language index %d doesn't exist. Please specify an index between 0 and %d.\n\n",
|
||||
cmdlineSettings.languageID, gameSettings.numLanguages);
|
||||
printLanguageTable();
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
if (cmdlineSettings.fullscreenSet) {
|
||||
gameSettings.userFullScreen = cmdlineSettings.userFullScreen;
|
||||
}
|
||||
if (cmdlineSettings.aaSet) {
|
||||
gameSettings.antiAlias = cmdlineSettings.antiAlias;
|
||||
}
|
||||
if (cmdlineSettings.debugModeSet) {
|
||||
gameSettings.debugMode = cmdlineSettings.debugMode;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
void msgBox(const char *head, const char *msg) {
|
||||
fprintf(stderr, "%s\n%s\n", head, msg);
|
||||
}
|
||||
|
||||
int msgBoxQuestion(const char *head, const char *msg) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
void changeToUserDir() {
|
||||
if (chdir(getenv("HOME"))) {
|
||||
debugOut("Error: Failed changing to directory %s\n", getenv("HOME"));
|
||||
}
|
||||
mkdir(".sludge-engine", 0000777);
|
||||
if (chdir(".sludge-engine")) {
|
||||
debugOut("Error: Failed changing to directory %s\n", ".sludge-engine");
|
||||
}
|
||||
}
|
||||
|
||||
uint32 launch(char *filename) {
|
||||
debugOut("Trying to launch: %s\n", filename);
|
||||
|
||||
if (!fileExists("/usr/bin/xdg-open")) {
|
||||
debugOut("Launching failed due to missing /usr/bin/xdg-open.\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (!(filename[0] == 'h' &&
|
||||
filename[1] == 't' &&
|
||||
filename[2] == 't' &&
|
||||
filename[3] == 'p' &&
|
||||
(filename[4] == ':' || (filename[4] == 's' && filename[5] == ':'))) &&
|
||||
!fileExists(filename)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
int status;
|
||||
|
||||
pid_t pid = fork();
|
||||
if (pid < 0) {
|
||||
return 0;
|
||||
} else if (pid == 0) {
|
||||
execl("/usr/bin/xdg-open", "xdg-open", filename, (char *)0);
|
||||
exit(EXIT_FAILURE);
|
||||
} else {
|
||||
waitpid(pid, &status, 0);
|
||||
}
|
||||
|
||||
if (status == EXIT_SUCCESS) {
|
||||
return 69;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
bool defaultUserFullScreen() {
|
||||
return false;
|
||||
}
|
||||
|
||||
} // End of namespace Sludge
|
||||
|
||||
#endif
|
@ -1,44 +0,0 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
*/
|
||||
#ifndef SLUDGE_LINUXSTUFF_H
|
||||
#define SLUDGE_LINUXSTUFF_H
|
||||
|
||||
namespace Sludge {
|
||||
|
||||
struct cmdlineSettingsStruct {
|
||||
bool languageSet;
|
||||
unsigned int languageID;
|
||||
bool fullscreenSet;
|
||||
bool userFullScreen;
|
||||
bool aaSet;
|
||||
int antiAlias;
|
||||
bool debugModeSet;
|
||||
bool debugMode;
|
||||
bool listLanguages;
|
||||
};
|
||||
|
||||
void printCmdlineUsage();
|
||||
bool parseCmdlineParameters(int argc, char *argv[]);
|
||||
|
||||
} // End of namespace Sludge
|
||||
|
||||
#endif
|
@ -19,38 +19,6 @@
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
*/
|
||||
#if defined __unix__ && !(defined __APPLE__)
|
||||
#include "linuxstuff.h"
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
#ifdef _WIN32
|
||||
#include "winstuff.h"
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <math.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <iostream>
|
||||
|
||||
#include <stdexcept>
|
||||
|
||||
#include <time.h>
|
||||
#include <sys/time.h>
|
||||
|
||||
#if !defined(HAVE_GLES2)
|
||||
#include "GLee.h"
|
||||
#else
|
||||
#include <GLES2/gl2.h>
|
||||
#include "eglport/eglport.h"
|
||||
#endif
|
||||
|
||||
#include <SDL/SDL.h>
|
||||
#include <SDL/SDL_syswm.h>
|
||||
#endif
|
||||
|
||||
#include "common/debug.h"
|
||||
|
||||
@ -81,12 +49,6 @@
|
||||
|
||||
namespace Sludge {
|
||||
|
||||
#ifdef _WIN32
|
||||
#define PATHSLASH '\\'
|
||||
#else
|
||||
#define PATHSLASH '/'
|
||||
#endif
|
||||
|
||||
extern bool runningFullscreen;
|
||||
|
||||
#ifndef MAX_PATH
|
||||
@ -148,10 +110,6 @@ void saveHSI(Common::WriteStream *writer);
|
||||
|
||||
extern bool reallyWantToQuit;
|
||||
|
||||
#ifdef _WIN32
|
||||
#undef main
|
||||
#endif
|
||||
|
||||
int weAreDoneSoQuit;
|
||||
|
||||
void checkInput() {
|
||||
@ -426,13 +384,6 @@ int main_loop(char *filename)
|
||||
setupOpenGLStuff();
|
||||
#endif
|
||||
|
||||
#ifdef _WIN32
|
||||
SDL_SysWMinfo wmInfo;
|
||||
SDL_VERSION(&wmInfo.version);
|
||||
SDL_GetWMInfo(&wmInfo);
|
||||
hMainWindow = wmInfo.window;
|
||||
#endif
|
||||
|
||||
registerWindowForFatal();
|
||||
|
||||
if (!killResizeBackdrop(winWidth, winHeight))
|
||||
|
@ -42,10 +42,9 @@ MODULE_OBJS := \
|
||||
variable.o \
|
||||
zbuffer.o \
|
||||
CommonCode/utf8.o \
|
||||
# linuxstuff.o \
|
||||
shaders.o \
|
||||
libwebm/mkvparser.o \
|
||||
libwebm/mkvreader.o \
|
||||
# shaders.o \
|
||||
# libwebm/mkvparser.o \
|
||||
# libwebm/mkvreader.o \
|
||||
|
||||
MODULE_DIRS += \
|
||||
engines/sludge
|
||||
|
@ -188,12 +188,8 @@ char *encodeFilename(char *nameIn) {
|
||||
} else {
|
||||
int a;
|
||||
for (a = 0; nameIn[a]; a++) {
|
||||
#ifdef _WIN32
|
||||
if (nameIn[a] == '/') nameIn[a] = '\\';
|
||||
#else
|
||||
if (nameIn[a] == '\\')
|
||||
nameIn[a] = '/';
|
||||
#endif
|
||||
}
|
||||
|
||||
return copyString(nameIn);
|
||||
|
@ -114,6 +114,7 @@ int inFatal(const char *str) {
|
||||
atexit(displayFatal);
|
||||
exit(1);
|
||||
#endif
|
||||
return true;
|
||||
}
|
||||
|
||||
int checkNew(const void *mem) {
|
||||
|
@ -22,6 +22,8 @@
|
||||
#ifndef SLUDGE_PEOPLE_H
|
||||
#define SLUDGE_PEOPLE_H
|
||||
|
||||
#include "sludge/variable.h"
|
||||
|
||||
namespace Sludge {
|
||||
|
||||
struct animFrame {
|
||||
|
@ -22,14 +22,6 @@
|
||||
#ifndef SLUDGE_SHADERS_H
|
||||
#define SLUDGE_SHADERS_H
|
||||
|
||||
#if 0
|
||||
#if !defined(HAVE_GLES2)
|
||||
#include "GLee.h"
|
||||
#else
|
||||
#include <GLES2/gl2.h>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
namespace Sludge {
|
||||
|
||||
char *shaderFileRead(const char *fn);
|
||||
|
@ -19,19 +19,6 @@
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
*/
|
||||
#if 0
|
||||
#if defined __unix__ && !(defined __APPLE__)
|
||||
#include <png.h>
|
||||
#else
|
||||
#include <libpng/png.h>
|
||||
#endif
|
||||
|
||||
#include <SDL/SDL.h>
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <iconv.h>
|
||||
#endif
|
||||
|
||||
#include "common/debug.h"
|
||||
|
||||
@ -457,12 +444,6 @@ bool initSludge(char *filename) {
|
||||
png_set_expand(png_ptr);
|
||||
if (color_type == PNG_COLOR_TYPE_GRAY || color_type == PNG_COLOR_TYPE_GRAY_ALPHA) png_set_gray_to_rgb(png_ptr);
|
||||
if (bit_depth == 16) png_set_strip_16(png_ptr);
|
||||
#ifdef WIN32
|
||||
// Windows wants a BGR bitmap
|
||||
if (color_type == PNG_COLOR_TYPE_RGB ||
|
||||
color_type == PNG_COLOR_TYPE_RGB_ALPHA)
|
||||
png_set_bgr(png_ptr);
|
||||
#endif
|
||||
|
||||
png_set_add_alpha(png_ptr, 0xff, PNG_FILLER_AFTER);
|
||||
|
||||
@ -500,16 +481,9 @@ bool initSludge(char *filename) {
|
||||
n = 1;
|
||||
}
|
||||
while (n --) {
|
||||
#ifdef WIN32
|
||||
// Windows wants a BGR bitmap
|
||||
*p++ = (Uint8) blueValue(c);
|
||||
*p++ = (Uint8) greenValue(c);
|
||||
*p++ = (Uint8) redValue(c);
|
||||
#else
|
||||
*p++ = (Uint8) redValue(c);
|
||||
*p++ = (Uint8) greenValue(c);
|
||||
*p++ = (Uint8) blueValue(c);
|
||||
#endif
|
||||
*p++ = (Uint8) /*(c == transCol) ? 0 :*/255;
|
||||
|
||||
t1++;
|
||||
@ -541,11 +515,7 @@ bool initSludge(char *filename) {
|
||||
#if 0
|
||||
changeToUserDir();
|
||||
|
||||
#ifdef _WIN32
|
||||
mkdir(gameName);
|
||||
#else
|
||||
mkdir(gameName, 0000777);
|
||||
#endif
|
||||
|
||||
if (chdir(gameName)) return fatal("This game's preference folder is inaccessible!\nI can't access the following directory (maybe there's a file with the same name, or maybe it's read-protected):", gameName);
|
||||
#endif
|
||||
@ -577,11 +547,7 @@ bool initSludge(char *filename) {
|
||||
if (dataFol[0]) {
|
||||
char *dataFolder = encodeFilename(dataFol);
|
||||
#if 0
|
||||
#ifdef _WIN32
|
||||
mkdir(dataFolder);
|
||||
#else
|
||||
mkdir(dataFolder, 0000777);
|
||||
#endif
|
||||
|
||||
if (chdir(dataFolder)) return fatal("This game's data folder is inaccessible!\nI can't access the following directory (maybe there's a file with the same name, or maybe it's read-protected):", dataFolder);
|
||||
#endif
|
||||
|
@ -31,12 +31,10 @@
|
||||
|
||||
namespace Sludge {
|
||||
|
||||
#ifndef _WIN32
|
||||
typedef struct _FILETIME {
|
||||
uint32 dwLowDateTime;
|
||||
uint32 dwHighDateTime;
|
||||
} FILETIME;
|
||||
#endif
|
||||
|
||||
struct variable;
|
||||
struct variableStack;
|
||||
|
@ -23,11 +23,7 @@
|
||||
#ifndef SLUDGE_SOUND_H
|
||||
#define SLUDGE_SOUND_H
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <windows.h>
|
||||
#else
|
||||
#define HWND void *
|
||||
#endif
|
||||
|
||||
#include "common/file.h"
|
||||
|
||||
|
@ -281,9 +281,8 @@ bool loadSpeech(speechStruct *sS, Common::SeekableReadStream *stream) {
|
||||
(* viewLine) = newOne;
|
||||
viewLine = &(newOne->next);
|
||||
}
|
||||
|
||||
return true;
|
||||
#endif
|
||||
return true;
|
||||
}
|
||||
|
||||
} // End of namespace Sludge
|
||||
|
@ -19,9 +19,6 @@
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
*/
|
||||
#if 0
|
||||
#include <SDL/SDL.h>
|
||||
#endif
|
||||
|
||||
namespace Sludge {
|
||||
|
||||
|
@ -33,11 +33,6 @@
|
||||
#include "sludge/fileset.h"
|
||||
#include "sludge/sludge.h"
|
||||
|
||||
#ifdef _WIN32
|
||||
#include "windows.h"
|
||||
|
||||
#endif
|
||||
|
||||
namespace Sludge {
|
||||
|
||||
const char *typeName[] = { "undefined", "number", "user function", "string",
|
||||
@ -149,12 +144,6 @@ int stackSize(const stackHandler *me) {
|
||||
return r;
|
||||
}
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <windows.h>
|
||||
WCHAR *ConvertToUTF16(const char *input);
|
||||
char *ConvertFromUTF16(const WCHAR *input);
|
||||
#endif
|
||||
|
||||
bool getSavedGamesStack(stackHandler *sH, char *ext) {
|
||||
char *pattern = joinStrings("*", ext);
|
||||
if (!pattern)
|
||||
@ -163,33 +152,6 @@ bool getSavedGamesStack(stackHandler *sH, char *ext) {
|
||||
variable newName;
|
||||
newName.varType = SVT_NULL;
|
||||
#if 0
|
||||
#ifdef _WIN32
|
||||
|
||||
WCHAR *w_pattern = ConvertToUTF16(pattern);
|
||||
|
||||
WIN32_FIND_DATA theData;
|
||||
HANDLE handle = FindFirstFile(w_pattern, & theData);
|
||||
|
||||
delete w_pattern;
|
||||
|
||||
if (handle != INVALID_HANDLE_VALUE) {
|
||||
bool keepGoing;
|
||||
do {
|
||||
theData.cFileName[lstrlen(theData.cFileName) - strlen(ext)] = TEXT('\0');
|
||||
char *fileName = ConvertFromUTF16(theData.cFileName);
|
||||
char *decoded = decodeFilename(fileName);
|
||||
makeTextVar(newName, decoded);
|
||||
delete fileName;
|
||||
delete decoded;
|
||||
if (! addVarToStack(newName, sH -> first)) return false;
|
||||
if (sH -> last == NULL) sH -> last = sH -> first;
|
||||
keepGoing = FindNextFile(handle, & theData);
|
||||
}while (keepGoing);
|
||||
FindClose(handle);
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
DIR *dir = opendir(".");
|
||||
if (!dir)
|
||||
return false;
|
||||
@ -211,8 +173,6 @@ bool getSavedGamesStack(stackHandler *sH, char *ext) {
|
||||
}
|
||||
|
||||
closedir(dir);
|
||||
|
||||
#endif
|
||||
#endif
|
||||
delete[] pattern;
|
||||
pattern = NULL;
|
||||
|
@ -1,231 +0,0 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
*/
|
||||
#ifdef _WIN32
|
||||
#include <windows.h>
|
||||
#include <shellapi.h>
|
||||
|
||||
#include "allfiles.h"
|
||||
#include "debug.h"
|
||||
|
||||
#include "winstuff.h"
|
||||
#include "platform-dependent.h"
|
||||
#include "language.h"
|
||||
#include "newfatal.h"
|
||||
#include "sprites.h"
|
||||
#include "sprbanks.h"
|
||||
#include "fonttext.h"
|
||||
#include "backdrop.h"
|
||||
#include "sludger.h"
|
||||
#include "cursors.h"
|
||||
#include "objtypes.h"
|
||||
#include "region.h"
|
||||
#include "people.h"
|
||||
#include "talk.h"
|
||||
#include "direct.h"
|
||||
#include "sound.h"
|
||||
#include "colours.h"
|
||||
#include "moreio.h"
|
||||
#include "stringy.h"
|
||||
|
||||
#include <shellapi.h>
|
||||
#include <shlobj.h> // For SHGetFolderPath
|
||||
|
||||
#include "..\..\images\resource.h"
|
||||
|
||||
namespace Sludge {
|
||||
|
||||
HINSTANCE hInst; // Handle of the main instance
|
||||
extern HWND hMainWindow;
|
||||
|
||||
extern variableStack *noStack;
|
||||
|
||||
// The platform-specific functions - Windows edition.
|
||||
|
||||
WCHAR *ConvertToUTF16(const char *input) {
|
||||
int s = MultiByteToWideChar(CP_UTF8, MB_ERR_INVALID_CHARS, input, -1, NULL, 0);
|
||||
WCHAR *ret = new WCHAR [s];
|
||||
checkNew(ret);
|
||||
/*int a = */MultiByteToWideChar(CP_UTF8, MB_ERR_INVALID_CHARS, input, -1, ret, s);
|
||||
return ret;
|
||||
}
|
||||
|
||||
char *ConvertFromUTF16(const WCHAR *input) {
|
||||
int s = WideCharToMultiByte(CP_UTF8, 0, input, -1, NULL, 0, NULL, NULL);
|
||||
char *ret = new char [s];
|
||||
checkNew(ret);
|
||||
/*int a = */WideCharToMultiByte(CP_UTF8, 0, input, -1, ret, s, NULL, NULL);
|
||||
return ret;
|
||||
}
|
||||
|
||||
char *grabFileName() {
|
||||
OPENFILENAME ofn;
|
||||
WCHAR path[MAX_PATH];
|
||||
WCHAR file[MAX_PATH] = TEXT("");
|
||||
|
||||
hInst = GetModuleHandle(NULL);
|
||||
|
||||
memset(& ofn, 0, sizeof(ofn));
|
||||
ofn.lStructSize = sizeof(ofn);
|
||||
ofn.hwndOwner = NULL;
|
||||
ofn.hInstance = hInst;
|
||||
ofn.nMaxFile = MAX_PATH;
|
||||
ofn.lpstrInitialDir = path;
|
||||
ofn.Flags = OFN_HIDEREADONLY | OFN_EXPLORER;
|
||||
ofn.lpstrFilter = TEXT("SLUDGE games (*.SLG)\0*.slg\0\0");
|
||||
ofn.lpstrFile = file;
|
||||
|
||||
if (GetOpenFileName(& ofn)) {
|
||||
return ConvertFromUTF16(file);
|
||||
} else {
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
extern char **languageName;
|
||||
extern int *languageTable;
|
||||
|
||||
HBITMAP hLogo = NULL;
|
||||
extern unsigned char *gameLogo;
|
||||
|
||||
BOOL CALLBACK setupDlgProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) {
|
||||
switch (message) {
|
||||
case WM_INITDIALOG:
|
||||
if (gameLogo) {
|
||||
hLogo = CreateBitmap(310, 88, 1, 32, gameLogo);
|
||||
SendDlgItemMessage(hDlg, 1003, STM_SETIMAGE, (WPARAM)IMAGE_BITMAP, (LPARAM)hLogo);
|
||||
}
|
||||
|
||||
if (gameSettings.userFullScreen)
|
||||
CheckDlgButton(hDlg, 1000, BST_CHECKED);
|
||||
else
|
||||
CheckDlgButton(hDlg, 1000, BST_UNCHECKED);
|
||||
|
||||
SendDlgItemMessage(hDlg, 1002, CB_ADDSTRING, 0, reinterpret_cast<LPARAM>((LPCTSTR)TEXT("Default (best looking)")));
|
||||
SendDlgItemMessage(hDlg, 1002, CB_ADDSTRING, 0, reinterpret_cast<LPARAM>((LPCTSTR)TEXT("Linear (faster but blurry)")));
|
||||
SendDlgItemMessage(hDlg, 1002, CB_ADDSTRING, 0, reinterpret_cast<LPARAM>((LPCTSTR)TEXT("Off (blocky graphics)")));
|
||||
|
||||
if (gameSettings.antiAlias < 0)
|
||||
SendDlgItemMessage(hDlg, 1002, CB_SETCURSEL, 1, 0);
|
||||
else if (gameSettings.antiAlias)
|
||||
SendDlgItemMessage(hDlg, 1002, CB_SETCURSEL, 0, 0);
|
||||
else
|
||||
SendDlgItemMessage(hDlg, 1002, CB_SETCURSEL, 2, 0);
|
||||
|
||||
if (gameSettings.numLanguages) {
|
||||
WCHAR text[20];
|
||||
for (unsigned int i = 0; i <= gameSettings.numLanguages; i++) {
|
||||
if (languageName[i]) {
|
||||
WCHAR *w_lang = ConvertToUTF16(languageName[i]);
|
||||
SendDlgItemMessage(hDlg, 1001, CB_ADDSTRING, 0, reinterpret_cast<LPARAM>((LPCTSTR)w_lang));
|
||||
delete w_lang;
|
||||
} else {
|
||||
swprintf(text, TEXT("Language %d"), i);
|
||||
SendDlgItemMessage(hDlg, 1001, CB_ADDSTRING, 0, reinterpret_cast<LPARAM>((LPCTSTR)text));
|
||||
}
|
||||
}
|
||||
SendDlgItemMessage(hDlg, 1001, CB_SETCURSEL, getLanguageForFileB(), 0);
|
||||
} else {
|
||||
const WCHAR *text = TEXT("No translations available");
|
||||
SendDlgItemMessage(hDlg, 1001, CB_ADDSTRING, 0, reinterpret_cast<LPARAM>((LPCTSTR)text));
|
||||
SendDlgItemMessage(hDlg, 1001, CB_SETCURSEL, 0, 0);
|
||||
EnableWindow(GetDlgItem(hDlg, 1001), false);
|
||||
}
|
||||
return true;
|
||||
|
||||
case WM_COMMAND:
|
||||
if (hLogo) DeleteObject(hLogo);
|
||||
switch (LOWORD(wParam)) {
|
||||
case IDOK:
|
||||
|
||||
gameSettings.userFullScreen = (IsDlgButtonChecked(hDlg, 1000) == BST_CHECKED);
|
||||
gameSettings.antiAlias = SendDlgItemMessage(hDlg, 1002, CB_GETCURSEL, 0, 0);
|
||||
if (gameSettings.antiAlias == 0) gameSettings.antiAlias = 1;
|
||||
else if (gameSettings.antiAlias == 1) gameSettings.antiAlias = -1;
|
||||
else if (gameSettings.antiAlias == 2) gameSettings.antiAlias = 0;
|
||||
|
||||
if (gameSettings.numLanguages) {
|
||||
gameSettings.languageID = SendDlgItemMessage(hDlg, 1001, CB_GETCURSEL, 0, 0);
|
||||
if (gameSettings.languageID < 0) gameSettings.languageID = 0;
|
||||
gameSettings.languageID = languageTable[gameSettings.languageID];
|
||||
}
|
||||
EndDialog(hDlg, true);
|
||||
return TRUE;
|
||||
|
||||
case IDCANCEL:
|
||||
EndDialog(hDlg, false);
|
||||
return TRUE;
|
||||
}
|
||||
break;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
int showSetupWindow() {
|
||||
|
||||
hInst = GetModuleHandle(NULL);
|
||||
|
||||
if (! hInst) debugOut("ERROR: No hInst!\n");
|
||||
|
||||
if (DialogBox(hInst, TEXT("SETUPWINDOW"), NULL, setupDlgProc)) return true;
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
void msgBox(const char *head, const char *msg) {
|
||||
WCHAR *w_head = ConvertToUTF16(head);
|
||||
WCHAR *w_msg = ConvertToUTF16(msg);
|
||||
MessageBox(NULL, w_msg, w_head, MB_OK | MB_ICONSTOP | MB_SYSTEMMODAL | MB_SETFOREGROUND);
|
||||
delete w_head;
|
||||
delete w_msg;
|
||||
}
|
||||
|
||||
int msgBoxQuestion(const char *head, const char *msg) {
|
||||
WCHAR *w_head = ConvertToUTF16(head);
|
||||
WCHAR *w_msg = ConvertToUTF16(msg);
|
||||
int val = MessageBox(NULL, w_msg, w_head, MB_YESNO | MB_SETFOREGROUND | MB_APPLMODAL | MB_ICONQUESTION) == IDNO;
|
||||
delete w_head;
|
||||
delete w_msg;
|
||||
if (val)
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
void changeToUserDir() {
|
||||
TCHAR szAppData[MAX_PATH];
|
||||
/*hr = */SHGetFolderPath(NULL, CSIDL_APPDATA, NULL, 0, szAppData);
|
||||
_wchdir(szAppData);
|
||||
}
|
||||
|
||||
uint32 launch(char *f) {
|
||||
WCHAR *w_f = ConvertToUTF16(f);
|
||||
uint32 r = (uint32) ShellExecute(hMainWindow, TEXT("open"), w_f, NULL, TEXT("C:\\"), SW_SHOWNORMAL);
|
||||
delete w_f;
|
||||
return r;
|
||||
}
|
||||
|
||||
bool defaultUserFullScreen() {
|
||||
return true;
|
||||
}
|
||||
|
||||
} // End of namespace Sludge
|
||||
|
||||
#endif
|
@ -1,43 +0,0 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
*/
|
||||
#ifndef SLUDGE_WINSTUFF_H
|
||||
#define SLUDGE_WINSTUFF_H
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <windows.h>
|
||||
#endif
|
||||
|
||||
namespace Sludge {
|
||||
|
||||
#ifndef _WIN32
|
||||
#ifndef HINSTANCE
|
||||
#define HINSTANCE int
|
||||
#endif
|
||||
#endif
|
||||
|
||||
void setWindowName(const char *tx);
|
||||
bool InitApplication(HINSTANCE hInstance);
|
||||
bool InitInstance(HINSTANCE hInstance, const char *);
|
||||
|
||||
} // End of namespace Sludge
|
||||
|
||||
#endif
|
@ -22,14 +22,6 @@
|
||||
#ifndef SLUDGE_ZBUFFER_H
|
||||
#define SLUDGE_ZBUFFER_H
|
||||
|
||||
#if 0
|
||||
#if !defined(HAVE_GLES2)
|
||||
#include "GLee.h"
|
||||
#else
|
||||
#include <GLES2/gl2.h>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
namespace Sludge {
|
||||
|
||||
struct zBufferData {
|
||||
|
Loading…
x
Reference in New Issue
Block a user