mirror of
https://github.com/libretro/scummvm.git
synced 2024-11-27 19:30:41 +00:00
fixed compilation on Mac OS X; some cleanup; moved header file scumm/smusH/rect.h to common/rect.h
svn-id: r4877
This commit is contained in:
parent
0c7771a706
commit
a39711e256
@ -167,7 +167,6 @@ static void checkName(GameDetector *d, Game &game)
|
||||
if(d->detectGame()) {
|
||||
char *n = d->getGameName();
|
||||
strcpy(game.text, n);
|
||||
free(n);
|
||||
} else
|
||||
strcpy(game.text, game.filename_base);
|
||||
d->_exe_name = NULL;
|
||||
|
@ -69,9 +69,7 @@ static vmsaveResult trySave(GameDetector *d, const char *data, int size,
|
||||
|
||||
memset(&header, 0, sizeof(header));
|
||||
strncpy(header.shortdesc, "ScummVM savegame", 16);
|
||||
char *game_name = d->getGameName();
|
||||
strncpy(header.longdesc, game_name, 32);
|
||||
free(game_name);
|
||||
strncpy(header.longdesc, d->getGameName(), 32);
|
||||
strncpy(header.id, "ScummVM", 16);
|
||||
icon.create_vmicon(iconbuffer);
|
||||
header.numicons = 1;
|
||||
|
@ -30,6 +30,19 @@
|
||||
|
||||
#define xfree(p) {if (p) free(p);}
|
||||
|
||||
#ifdef NEED_STRDUP
|
||||
char *strdup(const char *s) {
|
||||
if (s) {
|
||||
int len = strlen(s) + 1;
|
||||
char *d = (char *)malloc(len);
|
||||
if (d)
|
||||
memcpy(d, s, len);
|
||||
return d;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
#endif /* NEED_STRDUP */
|
||||
|
||||
|
||||
static char *ltrim(char *t)
|
||||
{
|
||||
|
@ -56,5 +56,17 @@ public:
|
||||
static Engine *createFromDetector(GameDetector *detector, OSystem *syst);
|
||||
};
|
||||
|
||||
#if defined(__GNUC__)
|
||||
void CDECL error(const char *s, ...) NORETURN;
|
||||
#else
|
||||
void CDECL NORETURN error(const char *s, ...);
|
||||
#endif
|
||||
|
||||
void CDECL warning(const char *s, ...);
|
||||
|
||||
void CDECL debug(int level, const char *s, ...);
|
||||
void checkHeap();
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -21,19 +21,6 @@
|
||||
|
||||
#include "file.h"
|
||||
|
||||
#ifdef NEED_STRDUP
|
||||
char *strdup(const char *s) {
|
||||
if (s) {
|
||||
int len = strlen(s) + 1;
|
||||
char *d = (char *)malloc(len);
|
||||
if (d)
|
||||
memcpy(d, s, len);
|
||||
return d;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
#endif /* NEED_STRDUP */
|
||||
|
||||
File::File() {
|
||||
_handle = NULL;
|
||||
_readFailed = false;
|
||||
@ -45,28 +32,35 @@ File::~File() {
|
||||
}
|
||||
|
||||
bool File::open(const char *filename, int mode, byte encbyte) {
|
||||
char * buf;
|
||||
char buf[256], *ptr;
|
||||
if (_handle) {
|
||||
debug(2, "File %s already opened", filename);
|
||||
return false;
|
||||
}
|
||||
|
||||
clearReadFailed();
|
||||
buf = strdup(filename);
|
||||
strcpy(buf, filename);
|
||||
if (mode == 1) {
|
||||
_handle = fopen(buf, "rb");
|
||||
if (_handle == NULL) {
|
||||
_handle = fopen(strupr(buf), "rb");
|
||||
if (_handle == NULL) {
|
||||
_handle = fopen(strlwr(buf), "rb");
|
||||
}
|
||||
else {
|
||||
debug(2, "File %s not found", filename);
|
||||
return false;
|
||||
}
|
||||
ptr = buf;
|
||||
do
|
||||
*ptr++ = toupper(*ptr);
|
||||
while (*ptr);
|
||||
_handle = fopen(buf, "rb");
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (_handle == NULL) {
|
||||
ptr = buf;
|
||||
do
|
||||
*ptr++ = tolower(*ptr);
|
||||
while (*ptr);
|
||||
_handle = fopen(buf, "rb");
|
||||
}
|
||||
if (_handle == NULL) {
|
||||
debug(2, "File %s not found", filename);
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
warning("Only read mode supported!");
|
||||
return false;
|
||||
}
|
||||
|
@ -29,6 +29,9 @@
|
||||
#include "common/config-file.h"
|
||||
|
||||
|
||||
extern uint16 _debugLevel;
|
||||
|
||||
|
||||
#define CHECK_OPTION() if ((current_option != NULL) || (*s != '\0')) goto ShowHelpAndExit
|
||||
#define HANDLE_OPTION() if ((*s == '\0') && (current_option == NULL)) goto ShowHelpAndExit; \
|
||||
if ((*s != '\0') && (current_option != NULL)) goto ShowHelpAndExit; \
|
||||
@ -450,14 +453,14 @@ bool GameDetector::detectGame()
|
||||
return true;
|
||||
}
|
||||
|
||||
char *GameDetector::getGameName()
|
||||
const char *GameDetector::getGameName()
|
||||
{
|
||||
if (_gameText == NULL) {
|
||||
char buf[256];
|
||||
sprintf(buf, "Unknown game: \"%s\"", _exe_name);
|
||||
return strdup(buf);
|
||||
_gameText = strdup(buf);
|
||||
}
|
||||
return strdup(_gameText);
|
||||
return _gameText;
|
||||
}
|
||||
|
||||
int GameDetector::detectMain(int argc, char **argv)
|
||||
|
@ -31,7 +31,7 @@ public:
|
||||
int detectMain(int argc, char **argv);
|
||||
void parseCommandLine(int argc, char **argv);
|
||||
bool detectGame(void);
|
||||
char *getGameName(void);
|
||||
const char *getGameName(void);
|
||||
|
||||
bool _fullScreen;
|
||||
byte _gameId;
|
||||
|
@ -130,12 +130,10 @@ int main(int argc, char *argv[])
|
||||
OSystem *system = detector.createSystem();
|
||||
|
||||
{
|
||||
char *s = detector.getGameName();
|
||||
OSystem::Property prop;
|
||||
|
||||
prop.caption = s;
|
||||
prop.caption = detector.getGameName();
|
||||
system->property(OSystem::PROP_SET_WINDOW_CAPTION, &prop);
|
||||
free(s);
|
||||
}
|
||||
|
||||
// Create the game engine
|
||||
|
@ -19,10 +19,12 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef SMUSH_RECT_H
|
||||
#define SMUSH_RECT_H
|
||||
#ifndef COMMON_RECT_H
|
||||
#define COMMON_RECT_H
|
||||
|
||||
#include "config.h"
|
||||
#include "scummsys.h"
|
||||
|
||||
namespace ScummVM {
|
||||
|
||||
/*! @brief simple class for handling both 2D position and size
|
||||
|
||||
@ -97,4 +99,6 @@ public:
|
||||
bool clip(Rect & r) const;
|
||||
};
|
||||
|
||||
}; // End of namespace ScummVM
|
||||
|
||||
#endif
|
@ -208,7 +208,7 @@ struct CharsetRenderer {
|
||||
byte *_charPtr;
|
||||
int _width, _height;
|
||||
int _offsX, _offsY;
|
||||
byte _bitMask, _revBitMask;
|
||||
byte _bitMask;
|
||||
int _bottom;
|
||||
int _virtScreenHeight;
|
||||
|
||||
@ -368,7 +368,7 @@ public:
|
||||
|
||||
/* Init functions, etc */
|
||||
byte _fastMode;
|
||||
char *getGameName();
|
||||
const char *getGameName();
|
||||
|
||||
/* video buffer */
|
||||
byte *_videoBuffer;
|
||||
@ -835,8 +835,9 @@ public:
|
||||
void unkScreenEffect3();
|
||||
void unkScreenEffect4();
|
||||
void unkScreenEffect5(int a);
|
||||
void transitionEffect(int a); // former unkScreenEffect7
|
||||
void dissolveEffect(int width, int height); // former unkScreenEffect5(0) and unkScreenEffect6
|
||||
void transitionEffect(int a);
|
||||
void dissolveEffect(int width, int height);
|
||||
void scrollEffect(int dir);
|
||||
|
||||
void decompressBomp(byte *dst, byte *src, int w, int h);
|
||||
uint _shakeFrame;
|
||||
@ -1397,20 +1398,8 @@ public:
|
||||
Scumm_v7(GameDetector *detector, OSystem *syst) : Scumm(detector, syst) {}
|
||||
};
|
||||
|
||||
extern uint16 _debugLevel;
|
||||
|
||||
// This is a constant lookup table of reverse bit masks
|
||||
extern const byte revBitMask[8];
|
||||
//void blitToScreen(Scumm *s, byte *src, int x, int y, int w, int h);
|
||||
|
||||
#if defined(__GNUC__)
|
||||
void CDECL error(const char *s, ...) NORETURN;
|
||||
#else
|
||||
void CDECL NORETURN error(const char *s, ...);
|
||||
#endif
|
||||
|
||||
void CDECL warning(const char *s, ...);
|
||||
void CDECL debug(int level, const char *s, ...);
|
||||
void checkHeap();
|
||||
|
||||
/* Direction conversion functions (between old dir and new dir format) */
|
||||
int newDirToOldDir(int dir);
|
||||
|
@ -100,7 +100,7 @@ Scumm::Scumm (GameDetector *detector, OSystem *syst)
|
||||
_gui->init(this);
|
||||
|
||||
_newgui = new NewGui(this);
|
||||
_bundle = new Bundle(this);
|
||||
_bundle = new Bundle();
|
||||
_timer = new Timer(this);
|
||||
_sound = new Sound(this);
|
||||
|
||||
@ -1464,7 +1464,7 @@ void Scumm::launch()
|
||||
_maxHeapThreshold = 450000;
|
||||
_minHeapThreshold = 400000;
|
||||
|
||||
/* Create a primary virtual screen */
|
||||
// Create a primary virtual screen
|
||||
_videoBuffer = (byte *)calloc(328*200, 1);
|
||||
|
||||
allocResTypeData(rtBuffer, MKID('NONE'), 10, "buffer", 0);
|
||||
@ -1514,8 +1514,6 @@ void Scumm::launch()
|
||||
_sound->setupSound();
|
||||
|
||||
runScript(1, 0, 0, &_bootParam);
|
||||
|
||||
// _scummTimer = 0;
|
||||
}
|
||||
|
||||
void Scumm::go() {
|
||||
|
@ -34,7 +34,10 @@
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#include "rect.h"
|
||||
#include "common/rect.h"
|
||||
|
||||
using ScummVM::Point;
|
||||
using ScummVM::Rect;
|
||||
|
||||
class Chunk;
|
||||
/*! @brief class for handling blitting on a frame buffer
|
||||
|
@ -22,6 +22,8 @@
|
||||
#include <stdafx.h>
|
||||
#include "brenderer.h"
|
||||
|
||||
#include "common/engine.h" // for debug, warning, error
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
void BaseRenderer::clean() {
|
||||
|
@ -23,6 +23,7 @@
|
||||
#define CHANNEL_H
|
||||
|
||||
#include "config.h"
|
||||
#include "common/engine.h" // for debug, warning, error
|
||||
|
||||
#ifdef DEBUG
|
||||
# ifndef NO_DEBUG_CHANNEL
|
||||
|
@ -22,6 +22,8 @@
|
||||
#include <stdafx.h>
|
||||
#include "chunk.h"
|
||||
|
||||
#include "common/engine.h" // for debug, warning, error
|
||||
|
||||
#include <stdio.h> // for FILE, fopen, fclose, fseek and ftell
|
||||
#include <string.h> // for memcpy
|
||||
|
||||
|
@ -24,6 +24,8 @@
|
||||
#include "chunk.h"
|
||||
#include "blitter.h"
|
||||
|
||||
#include "common/engine.h" // for debug, warning, error
|
||||
|
||||
#include <assert.h>
|
||||
#include <string.h>
|
||||
|
||||
|
@ -23,7 +23,7 @@
|
||||
#define SMUSH_CONFIG_H
|
||||
|
||||
#include <stdafx.h>
|
||||
#include <scumm.h>
|
||||
#include <scummsys.h>
|
||||
|
||||
#ifndef NDEBUG
|
||||
#define DEBUG
|
||||
|
@ -24,8 +24,10 @@
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include "rect.h"
|
||||
#include "common/rect.h"
|
||||
|
||||
using ScummVM::Point;
|
||||
using ScummVM::Rect;
|
||||
class Blitter;
|
||||
class Chunk;
|
||||
|
||||
|
@ -21,9 +21,9 @@
|
||||
|
||||
#include <stdafx.h>
|
||||
#include "common/util.h"
|
||||
#include "common/engine.h" // for debug, warning, error
|
||||
|
||||
#include "frenderer.h"
|
||||
#include "rect.h"
|
||||
|
||||
#include <assert.h>
|
||||
#include <string.h>
|
||||
|
@ -35,7 +35,7 @@
|
||||
#endif
|
||||
|
||||
#include "brenderer.h"
|
||||
#include "rect.h"
|
||||
#include "common/util.h"
|
||||
#include "blitter.h"
|
||||
|
||||
/*! @brief ::renderer implementation specifically designed for font files.
|
||||
|
@ -21,6 +21,8 @@
|
||||
|
||||
#include <stdafx.h>
|
||||
#include "common/util.h"
|
||||
#include "common/engine.h" // for debug, warning, error
|
||||
|
||||
#include "player.h"
|
||||
|
||||
#include "mixer.h"
|
||||
@ -28,7 +30,6 @@
|
||||
#include "frenderer.h"
|
||||
#include "channel.h"
|
||||
#include "chunk_type.h"
|
||||
#include "rect.h"
|
||||
#include "blitter.h"
|
||||
|
||||
#include <assert.h>
|
||||
|
@ -24,7 +24,7 @@
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include "rect.h"
|
||||
#include "common/util.h"
|
||||
#include "chunk.h"
|
||||
#include "palette.h"
|
||||
#include "codec1.h"
|
||||
|
@ -25,8 +25,10 @@
|
||||
#include "config.h"
|
||||
|
||||
#include "palette.h"
|
||||
#include "rect.h"
|
||||
#include "common/rect.h"
|
||||
|
||||
using ScummVM::Point;
|
||||
using ScummVM::Rect;
|
||||
class Mixer;
|
||||
|
||||
/*! @brief interface for general output (rendering)
|
||||
|
@ -20,6 +20,7 @@
|
||||
*/
|
||||
|
||||
#include <stdafx.h>
|
||||
|
||||
#include "channel.h"
|
||||
#include "chunk.h"
|
||||
#include "chunk_type.h"
|
||||
|
@ -25,6 +25,7 @@
|
||||
#include "channel.h"
|
||||
#include "mixer.h"
|
||||
#include "sound/mixer.h"
|
||||
#include "scumm/scumm.h"
|
||||
#include "scumm/sound.h"
|
||||
|
||||
class scumm_mixer : public Mixer {
|
||||
|
@ -951,8 +951,6 @@ void CharsetRenderer::printChar(int chr)
|
||||
_mask_ptr = _vm->getResourceAddress(rtBuffer, 9)
|
||||
+ _drawTop * 40 + _left / 8 + _vm->_screenStartStrip;
|
||||
|
||||
_revBitMask = revBitMask[_left & 7];
|
||||
|
||||
_virtScreenHeight = vs->height;
|
||||
_charPtr += 4;
|
||||
|
||||
@ -992,7 +990,7 @@ void CharsetRenderer::drawBits()
|
||||
y = 0;
|
||||
|
||||
for (y = 0; y < _height && y + _drawTop < _virtScreenHeight;) {
|
||||
maskmask = _revBitMask;
|
||||
maskmask = revBitMask[_left & 7];
|
||||
maskpos = 0;
|
||||
|
||||
for (x = 0; x < _width; x++) {
|
||||
|
@ -167,12 +167,6 @@ bool Scumm::checkFixedDisk()
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
#ifdef NEED_STRDUP
|
||||
char *strdup(const char *s);
|
||||
#endif /* NEED_STRDUP */
|
||||
|
||||
|
||||
void *operator new(size_t size) {
|
||||
return calloc(size, 1);
|
||||
}
|
||||
|
@ -813,9 +813,6 @@ public:
|
||||
};
|
||||
|
||||
|
||||
void NORETURN CDECL error(const char *errmsg, ...);
|
||||
void CDECL warning(const char *errmsg, ...);
|
||||
|
||||
void palette_fadeout(uint32 *pal_values, uint num);
|
||||
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user