[Scummvm-cvs-logs] CVS: scummvm/backends/gp32 gp-fs.cpp,NONE,1.1 build.rules,1.4,1.5 gp32.cpp,1.4,1.5 gp32.h,1.4,1.5 portdefs.h,1.3,1.4
Joost Peters
joostp at users.sourceforge.net
Thu Apr 10 06:40:17 CEST 2003
Update of /cvsroot/scummvm/scummvm/backends/gp32
In directory sc8-pr-cvs1:/tmp/cvs-serv15494/backends/gp32
Modified Files:
build.rules gp32.cpp gp32.h portdefs.h
Added Files:
gp-fs.cpp
Log Message:
fixed GP32 port
--- NEW FILE: gp-fs.cpp ---
/* ScummVM - Scumm Interpreter
* Copyright (C) 2001-2003 The ScummVM project
*
* 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* $Header: /cvsroot/scummvm/scummvm/backends/gp32/gp-fs.cpp,v 1.1 2003/04/10 13:39:38 joostp Exp $
*/
#if defined (__GP32__)
#include "../fs/fs.h"
#include "stdio.h"
extern "C" {
#include "gpstdio.h"
}
/*
* Implementation of the ScummVM file system API based on GP32.
*/
class GP32FilesystemNode : public FilesystemNode {
protected:
String _displayName;
bool _isDirectory;
bool _isValid;
String _path;
public:
GP32FilesystemNode();
GP32FilesystemNode(const String &path);
GP32FilesystemNode(const GP32FilesystemNode *node);
virtual String displayName() const { return _displayName; }
virtual bool isValid() const { return _isValid; }
virtual bool isDirectory() const { return _isDirectory; }
virtual String path() const { return _path; }
virtual FSList *listDir(ListMode mode = kListDirectoriesOnly) const;
virtual FilesystemNode *parent() const;
virtual FilesystemNode *clone() const { return new GP32FilesystemNode(this); }
};
FilesystemNode *FilesystemNode::getRoot() {
return new GP32FilesystemNode();
}
GP32FilesystemNode::GP32FilesystemNode() {
_displayName = "gp:\\";
_isValid = true;
_isDirectory = true;
_path = "gp:\\";
}
/*
GP32FilesystemNode::GP32FilesystemNode(const String &p) {
// TODO - extract last component from path
_displayName = p;
// TODO - check whether it is a directory, and whether the file actually exists
_isValid = true;
_isDirectory = true;
_path = p;
}
*/
GP32FilesystemNode::GP32FilesystemNode(const GP32FilesystemNode *node) {
_displayName = node->_displayName;
_isValid = node->_isValid;
_isDirectory = node->_isDirectory;
_path = node->_path;
}
FSList *GP32FilesystemNode::listDir(ListMode mode) const {
assert(_isDirectory);
GPDIRENTRY dp;
ulong read;
FSList *myList = new FSList();
int start=0; // current file
// ... loop over dir entries using readdir
while (GpDirEnumList(_path.c_str(), start++, 1, &dp, &read) == SM_OK) {
if (strcmp(dp.name,".")==0|| strcmp(dp.name,"..")==0) continue;
GP32FilesystemNode entry;
entry._displayName = dp.name;
entry._path = _path;
entry._path += dp.name;
GPFILEATTR attr;
char s[256];
sprintf(s, "%s%s", _path.c_str(), dp.name);
GpFileAttr(s, &attr);
entry._isDirectory = attr.attr & (1<<4);
// Honor the chosen mode
if ((mode == kListFilesOnly && entry._isDirectory) ||
(mode == kListDirectoriesOnly && !entry._isDirectory))
continue;
if (entry._isDirectory)
entry._path += "\\"; //ph0x
myList->push_back(entry);
}
return myList;
}
const char *lastPathComponent(const ScummVM::String &str) {
const char *start = str.c_str();
const char *cur = start + str.size() - 2;
while (cur > start && *cur != '\\') { //ph0x
--cur;
}
return cur+1;
}
FilesystemNode *GP32FilesystemNode::parent() const {
GP32FilesystemNode *p = new GP32FilesystemNode();
// Root node is its own parent. Still we can't just return this
// as the GUI code will call delete on the old node.
if (_path != "gp:\\") { //ph0x
const char *start = _path.c_str();
const char *end = lastPathComponent(_path);
p->_path = String(start, end - start);
p->_isValid = true;
p->_isDirectory = true;
p->_displayName = lastPathComponent(p->_path);
}
return p;
}
#endif // defined(__GP32__)
Index: build.rules
===================================================================
RCS file: /cvsroot/scummvm/scummvm/backends/gp32/build.rules,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- build.rules 9 Dec 2002 13:38:01 -0000 1.4
+++ build.rules 10 Apr 2003 13:39:37 -0000 1.5
@@ -32,4 +32,4 @@
LIBS += -lgpgraphic -lgpmem -lgpos -lgpstdlib -lgpstdio -lgpsound -lgpfont
INCLUDES += -Ibackends/gp32
MODULES += backends/gp32
-OBJS += $(CCBASE)/arm-agb-elf/lib/gpstart/gpstart.o backends/gp32/gp32.o
\ No newline at end of file
+OBJS += $(CCBASE)/arm-agb-elf/lib/gpstart/gpstart.o backends/gp32/gp32.o backends/gp32/gp-fs.o
Index: gp32.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/backends/gp32/gp32.cpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- gp32.cpp 17 Dec 2002 01:15:13 -0000 1.4
+++ gp32.cpp 10 Apr 2003 13:39:38 -0000 1.5
@@ -1,1577 +1,1566 @@
-/* ScummVM - Scumm Interpreter
- * Copyright (C) 2001 Ludvig Strigeus
- * Copyright (C) 2001/2002 The ScummVM project
- * Copyright (C) 2002 ph0x (GP32 port)
- *
- * 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,
[...3112 lines suppressed...]
+ printf(">Running ScummVM");
+
+}
+
+extern "C" void GpMain (void * arg); // hack
+void GpMain (void * arg) {
+ gpinit();
+
+ // fixme - use get function
+ currsurface=GAME_SURFACE;
+ GpSurfaceFlip(&gpDraw[currsurface]);
+
+ char *argv[] = { "scummvm", /*(char*)menu()->filename*/ NULL };
+ int argc = 1;
+
+ extern int main(int argc, char *argv[]);
+ main(argc, argv);
+
+ error("returned from main ?!");
+}
Index: gp32.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/backends/gp32/gp32.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- gp32.h 17 Dec 2002 01:15:13 -0000 1.4
+++ gp32.h 10 Apr 2003 13:39:38 -0000 1.5
@@ -1,224 +1,222 @@
-/* ScummVM - Scumm Interpreter
- * Copyright (C) 2001 Ludvig Strigeus
- * Copyright (C) 2001/2002 The ScummVM project
- * Copyright (C) 2002 ph0x (GP32 port)
- *
- * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- */
-
-
-#include "common/stdafx.h"
-#include "common/scummsys.h"
-#include "common/system.h"
-#include "common/scummsys.h"
-#include "common/stdafx.h"
-#include "common/engine.h"
-#include "scumm/saveload.h"
-#include "common/scaler.h"
-
-#include "sdl.h"
-
-class OSystem_GP32 : public OSystem {
-public:
- // Set colors of the palette
- void set_palette(const byte *colors, uint start, uint num);
-
- // Set the size of the video bitmap.
- // Typically, 320x200
- void init_size(uint w, uint h);
-
- // Draw a bitmap to screen.
- // The screen will not be updated to reflect the new bitmap
- void copy_rect(const byte *buf, int pitch, int x, int y, int w, int h);
-
- // Moves the screen content around by the given amount of pixels
- // but only the top height pixel rows, the rest stays untouched
- void move_screen(int dx, int dy, int height);
-
- // Update the dirty areas of the screen
- void update_screen();
-
- // Either show or hide the mouse cursor
- bool show_mouse(bool visible);
-
- // Set the position of the mouse cursor
- void set_mouse_pos(int x, int y);
-
- // Set the bitmap that's used when drawing the cursor.
- void set_mouse_cursor(const byte *buf, uint w, uint h, int hotspot_x, int hotspot_y);
-
- // Shaking is used in SCUMM. Set current shake position.
- void set_shake_pos(int shake_pos);
-
- // Get the number of milliseconds since the program was started.
- uint32 get_msecs();
-
- // Delay for a specified amount of milliseconds
- void delay_msecs(uint msecs);
-
- // Create a thread
- void *create_thread(ThreadProc *proc, void *param);
-
- // Get the next event.
- // Returns true if an event was retrieved.
- bool poll_event(Event *event);
-
- // Set the function to be invoked whenever samples need to be generated
- // Format is the sample type format.
- // Only 16-bit signed mode is needed for simon & scumm
- bool set_sound_proc(void *param, SoundProc *proc, byte format);
-
- // Get or set a property
- uint32 property(int param, Property *value);
-
- // Poll cdrom status
- // Returns true if cd audio is playing
- bool poll_cdrom();
-
- // Play cdrom audio track
- void play_cdrom(int track, int num_loops, int start_frame, int end_frame);
-
- // Stop cdrom audio track
- void stop_cdrom();
-
- // Update cdrom audio status
- void update_cdrom();
-
- // Add a new callback timer
- void set_timer(int timer, int (*callback)(int));
-
- // Mutex handling
- void *create_mutex(void);
- void lock_mutex(void *mutex);
- void unlock_mutex(void *mutex);
- void delete_mutex(void *mutex);
-
- // Quit
- void quit();
-
- // Overlay
- void show_overlay();
- void hide_overlay();
- void clear_overlay();
- void grab_overlay(int16 *buf, int pitch);
- void copy_rect_overlay(const int16 *buf, int pitch, int x, int y, int w, int h);
-
- // Savefiles
- SaveFileManager *get_savefile_manager();
-
-
- static OSystem *create(int gfx_mode, bool full_screen);
-private:
- typedef void ScalerProc(uint8 *srcPtr, uint32 srcPitch, uint8 *deltaPtr,
- uint8 *dstPtr, uint32 dstPitch, int width, int height);
-
- SDL_Surface *sdl_tmpscreen; // temporary screen (for scalers/overlay)
- SDL_Surface *sdl_hwscreen; // hardware screen
- bool _overlay_visible;
-
- ScalerProc *_scaler_proc;
-
- int TMP_SCREEN_WIDTH;
-
- //uint msec_start;
- //uint32 get_ticks();
-
- ///OSystem_GP32(); // eh?
- /// ~OSystem_GP32();
-
- // unseen game screen
- SDL_Surface *_screen;
- int _screenWidth, _screenHeight;
-
- // CD Audio
- ///SDL_CD *_cdrom;
- int cd_track, cd_num_loops, cd_start_frame, cd_end_frame;
- uint32 cd_end_time, cd_stop_time, cd_next_second;
-
- enum {
- DF_WANT_RECT_OPTIM = 1 << 0,
- DF_UPDATE_EXPAND_1_PIXEL = 1 << 3
- };
-
- bool _forceFull; // Force full redraw on next update_screen
- int _scaleFactor;
- int _mode;
- bool _full_screen;
- uint32 _mode_flags;
-
- enum {
- NUM_DIRTY_RECT = 100,
-
- MAX_MOUSE_W = 40,
- MAX_MOUSE_H = 40,
- MAX_SCALING = 3
- };
-
- // Dirty rect managment
- SDL_Rect _dirty_rect_list[100];
- int _num_dirty_rects;
- uint32 *_dirty_checksums;
- bool cksum_valid;
- int CKSUM_NUM;
-
- // Keyboard mouse emulation
- struct KbdMouse {
- int16 x, y, x_vel, y_vel, x_max, y_max, x_down_count, y_down_count;
- uint32 last_time, delay_time, x_down_time, y_down_time;
- } km;
-
- struct MousePos {
- int16 x, y, w, h;
- };
-
- bool _mouseVisible;
- bool _mouseDrawn;
- byte *_mouseData;
- byte *_mouseBackup;
- MousePos _mouse_cur_state;
- MousePos _mouse_old_state;
- int16 _mouseHotspotX;
- int16 _mouseHotspotY;
-
- // Shake mode
- int _currentShakePos;
- int _newShakePos;
-
- // Palette data
- SDL_Color *_currentPalette;
- uint _paletteDirtyStart, _paletteDirtyEnd;
-
-
- void add_dirty_rgn_auto(const byte *buf);
- void mk_checksums(const byte *buf);
-
- static void fill_sound(void *userdata, Uint8 * stream, int len);
-
- void add_dirty_rect(int x, int y, int w, int h);
-
- void draw_mouse();
- void undraw_mouse();
-
- void load_gfx_mode();
- void unload_gfx_mode();
- void hotswap_gfx_mode();
-
- void get_screen_image(byte *buf);
-
- void setup_icon();
- void kbd_mouse();
-
- static OSystem_GP32 *create();
-};
+/* ScummVM - Scumm Interpreter
+ * Copyright (C) 2001 Ludvig Strigeus
+ * Copyright (C) 2001/2002 The ScummVM project
+ * Copyright (C) 2002 ph0x (GP32 port)
+ *
+ * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+
+#include "common/stdafx.h"
+#include "common/scummsys.h"
+#include "common/system.h"
+#include "common/scummsys.h"
+#include "common/stdafx.h"
+#include "common/engine.h"
+#include "scumm/saveload.h"
+#include "common/scaler.h"
+
+#include "portdefs.h"
+#include "sdl.h"
+
+class OSystem_GP32 : public OSystem {
+public:
+ // Set colors of the palette
+ void set_palette(const byte *colors, uint start, uint num);
+
+ // Set the size of the video bitmap.
+ // Typically, 320x200
+ void init_size(uint w, uint h);
+
+ // Draw a bitmap to screen.
+ // The screen will not be updated to reflect the new bitmap
+ void copy_rect(const byte *buf, int pitch, int x, int y, int w, int h);
+
+ // Moves the screen content around by the given amount of pixels
+ // but only the top height pixel rows, the rest stays untouched
+ void move_screen(int dx, int dy, int height);
+
+ // Update the dirty areas of the screen
+ void update_screen();
+
+ // Either show or hide the mouse cursor
+ bool show_mouse(bool visible);
+ void warp_mouse(int x, int y);
+
+ // Set the position of the mouse cursor
+ void set_mouse_pos(int x, int y);
+
+ // Set the bitmap that's used when drawing the cursor.
+ void set_mouse_cursor(const byte *buf, uint w, uint h, int hotspot_x, int hotspot_y);
+
+ // Shaking is used in SCUMM. Set current shake position.
+ void set_shake_pos(int shake_pos);
+
+ // Get the number of milliseconds since the program was started.
+ uint32 get_msecs();
+
+ // Delay for a specified amount of milliseconds
+ void delay_msecs(uint msecs);
+
+ // Create a thread
+ void *create_thread(ThreadProc *proc, void *param);
+
+ // Get the next event.
+ // Returns true if an event was retrieved.
+ bool poll_event(Event *event);
+
+ // Set the function to be invoked whenever samples need to be generated
+ // Format is the sample type format.
+ // Only 16-bit signed mode is needed for simon & scumm
+ bool set_sound_proc(void *param, SoundProc *proc, byte format);
+
+ // Get or set a property
+ uint32 property(int param, Property *value);
+
+ // Poll cdrom status
+ // Returns true if cd audio is playing
+ bool poll_cdrom();
+
+ // Play cdrom audio track
+ void play_cdrom(int track, int num_loops, int start_frame, int end_frame);
+
+ // Stop cdrom audio track
+ void stop_cdrom();
+
+ // Update cdrom audio status
+ void update_cdrom();
+
+ // Add a new callback timer
+ void set_timer(int timer, int (*callback)(int));
+
+ // Mutex handling
+ void *create_mutex(void);
+ void lock_mutex(void *mutex);
+ void unlock_mutex(void *mutex);
+ void delete_mutex(void *mutex);
+
+ // Quit
+ void quit();
+
+ // Overlay
+ void show_overlay();
+ void hide_overlay();
+ void clear_overlay();
+ void grab_overlay(int16 *buf, int pitch);
+ void copy_rect_overlay(const int16 *buf, int pitch, int x, int y, int w, int h);
+
+ static OSystem *create(int gfx_mode, bool full_screen);
+private:
+ typedef void ScalerProc(uint8 *srcPtr, uint32 srcPitch, uint8 *deltaPtr,
+ uint8 *dstPtr, uint32 dstPitch, int width, int height);
+
+ SDL_Surface *sdl_tmpscreen; // temporary screen (for scalers/overlay)
+ SDL_Surface *sdl_hwscreen; // hardware screen
+ bool _overlay_visible;
+
+ ScalerProc *_scaler_proc;
+
+ int TMP_SCREEN_WIDTH;
+
+ //uint msec_start;
+ //uint32 get_ticks();
+
+ ///OSystem_GP32(); // eh?
+ /// ~OSystem_GP32();
+
+ // unseen game screen
+ SDL_Surface *_screen;
+ int _screenWidth, _screenHeight;
+
+ // CD Audio
+ ///SDL_CD *_cdrom;
+ int cd_track, cd_num_loops, cd_start_frame, cd_end_frame;
+ uint32 cd_end_time, cd_stop_time, cd_next_second;
+
+ enum {
+ DF_WANT_RECT_OPTIM = 1 << 0,
+ DF_UPDATE_EXPAND_1_PIXEL = 1 << 3
+ };
+
+ bool _forceFull; // Force full redraw on next update_screen
+ int _scaleFactor;
+ int _mode;
+ bool _full_screen;
+ uint32 _mode_flags;
+
+ enum {
+ NUM_DIRTY_RECT = 100,
+
+ MAX_MOUSE_W = 40,
+ MAX_MOUSE_H = 40,
+ MAX_SCALING = 3
+ };
+
+ // Dirty rect managment
+ SDL_Rect _dirty_rect_list[100];
+ int _num_dirty_rects;
+ uint32 *_dirty_checksums;
+ bool cksum_valid;
+ int CKSUM_NUM;
+
+ // Keyboard mouse emulation
+ struct KbdMouse {
+ int16 x, y, x_vel, y_vel, x_max, y_max, x_down_count, y_down_count;
+ uint32 last_time, delay_time, x_down_time, y_down_time;
+ } km;
+
+ struct MousePos {
+ int16 x, y, w, h;
+ };
+
+ bool _mouseVisible;
+ bool _mouseDrawn;
+ byte *_mouseData;
+ byte *_mouseBackup;
+ MousePos _mouse_cur_state;
+ MousePos _mouse_old_state;
+ int16 _mouseHotspotX;
+ int16 _mouseHotspotY;
+
+ // Shake mode
+ int _currentShakePos;
+ int _newShakePos;
+
+ // Palette data
+ SDL_Color *_currentPalette;
+ uint _paletteDirtyStart, _paletteDirtyEnd;
+
+
+ void add_dirty_rgn_auto(const byte *buf);
+ void mk_checksums(const byte *buf);
+
+ static void fill_sound(void *userdata, Uint8 * stream, int len);
+
+ void add_dirty_rect(int x, int y, int w, int h);
+
+ void draw_mouse();
+ void undraw_mouse();
+
+ void load_gfx_mode();
+ void unload_gfx_mode();
+ void hotswap_gfx_mode();
+
+ void get_screen_image(byte *buf);
+
+ void setup_icon();
+ void kbd_mouse();
+
+ static OSystem_GP32 *create();
+};
Index: portdefs.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/backends/gp32/portdefs.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- portdefs.h 2 Dec 2002 16:55:18 -0000 1.3
+++ portdefs.h 10 Apr 2003 13:39:38 -0000 1.4
@@ -1,110 +1,124 @@
-/* ScummVM - Scumm Interpreter
- * Copyright (C) 2001 Ludvig Strigeus
- * Copyright (C) 2001/2002 The ScummVM project
- * Copyright (C) 2002 ph0x (GP32 port)
- *
- * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- */
-
-
-//#define __size_t // SDK hack?
- #include <stdio.h>
- #include <stdlib.h>
- #include <string.h>
- #include <stdarg.h>
- #include <ctype.h>
-
-
-extern "C" {
- #include "gpfont.h"
- #include "gpfont_port.h"
- #include "gpgraphic.h"
- #include "gpmm.h"
- #include "gpmem.h"
- #include "gpos_def.h"
- #include "gpstdio.h"
- #include "gpstdlib.h"
- #include "gpdef.h"
- //#include "defines.h"
-}
-
-#undef byte // SDK hack?
-
-typedef unsigned char u8;
-typedef signed char s8;
-typedef unsigned short u16;
-typedef short s16;
-typedef unsigned int u32;
-typedef int s32;
-
- extern int gpprintf(const char *fmt, ...);
- #define printf gpprintf
-
- extern void *gpmalloc(size_t size);
- extern void *gpcalloc(size_t nitems, size_t size);
- extern void gpfree(void *block);
- #define malloc gpmalloc
- #define calloc gpcalloc //gm_calloc
- #define free gpfree
- /*#define memset gm_memset
- #define memcopy gm_memcopy
-
- #define strcpy gm_strcpy // uncomment?
- #define strncpy gm_strncpy
- #define strcat gm_strcat
- #define sprintf gm_sprintf*/
-
- #define assert(e) ((e) ? 0 : (printf("!AS: " #e " (%s, %d)\n", __FILE__, __LINE__)))
- #define ASSERT assert
-
- #define ENDLESSLOOP while (1)
-
- #define FILE F_HANDLE
- #define stderr NULL // hack...
- #define stdout stderr
- #define stdin stderr
-
- extern FILE *gpfopen(const char *filename, const char *mode);
- extern int gpfclose(FILE *stream);
- extern int gpfseek(FILE *stream, long offset, int whence);
- extern size_t gpfread(void *ptr, size_t size, size_t n, FILE *stream);
- extern size_t gpfwrite(const void *ptr, size_t size, size_t n, FILE*stream);
- extern long gpftell(FILE *stream);
- extern void gpclearerr(FILE *stream);
- extern int gpfeof(FILE *stream);
- extern char *gpfgets(char *s, int n, FILE *stream);
- extern int gpfflush(FILE *stream);
-
- #define fopen gpfopen
- #define fclose gpfclose
- #define fseek gpfseek
- #define fread gpfread
- #define fwrite gpfwrite
- #define ftell gpftell
- #define clearerr gpclearerr
- #define feof gpfeof
- #define fgets gpfgets
-
- extern int gpfprintf(FILE *stream, const char *fmt, ...);
- #define fprintf gpfprintf
- #define fflush gpfflush
-
- extern void gphalt(int code=0);
- #define exit gphalt
- //#define error printf
-
- #define time(x) (0) // fixme! (SIMON)
-
- // EOF
+/* ScummVM - Scumm Interpreter
+ * Copyright (C) 2001 Ludvig Strigeus
+ * Copyright (C) 2001/2002 The ScummVM project
+ * Copyright (C) 2002 ph0x (GP32 port)
+ *
+ * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+
+//#define __size_t // SDK hack?
+ #include <stdio.h>
+ #include <stdlib.h>
+ #include <string.h>
+ #include <stdarg.h>
+ #include <ctype.h>
+
+
+extern "C" {
+ #include "gpfont.h"
+ #include "gpfont_port.h"
+ #include "gpgraphic.h"
+ #include "gpmm.h"
+ #include "gpmem.h"
+ #include "gpos_def.h"
+ #include "gpstdio.h"
+ #include "gpstdlib.h"
+ #include "gpdef.h"
+ //#include "defines.h"
+}
+
+#undef byte // SDK hack?
+
+typedef unsigned char u8;
+typedef signed char s8;
+typedef unsigned short u16;
+typedef short s16;
+typedef unsigned int u32;
+typedef int s32;
+
+ extern int gpprintf(const char *fmt, ...);
+ #define printf gpprintf
+
+ extern void *gpmalloc(size_t size);
+ extern void *gpcalloc(size_t nitems, size_t size);
+ extern void gpfree(void *block);
+ extern char *gpstrdup(const char *s);
+
+ #define malloc gpmalloc
+ #define calloc gpcalloc //gm_calloc
+ #define free gpfree
+ /*#define memset gm_memset
+ #define memcopy gm_memcopy
+
+ #define strcpy gm_strcpy // uncomment?
+ #define strncpy gm_strncpy
+ #define strcat gm_strcat
+ #define sprintf gm_sprintf*/
+ #define strdup gpstrdup
+
+ #define assert(e) ((e) ? 0 : (printf("!AS: " #e " (%s, %d)\n", __FILE__, __LINE__)))
+ #define ASSERT assert
+
+ #define ENDLESSLOOP while (1)
+
+
+ #define FILE F_HANDLE
+ extern FILE *fstderr;
+ extern FILE *fstdout;
+ extern FILE *fstdin;
+
+ #define stderr fstderr
+ #define stdout fstdout
+ #define stdin fstdin
+
+ extern FILE *gpfopen(const char *filename, const char *mode);
+ extern int gpfclose(FILE *stream);
+ extern int gpfseek(FILE *stream, long offset, int whence);
+ extern size_t gpfread(void *ptr, size_t size, size_t n, FILE *stream);
+ extern size_t gpfwrite(const void *ptr, size_t size, size_t n, FILE*stream);
+ extern long gpftell(FILE *stream);
+ extern void gpclearerr(FILE *stream);
+ extern int gpfeof(FILE *stream);
+ extern char *gpfgets(char *s, int n, FILE *stream);
+ extern int gpfflush(FILE *stream);
+
+ #define fopen gpfopen
+ #define fclose gpfclose
+ #define fseek gpfseek
+ #define fread gpfread
+ #define fwrite gpfwrite
+ #define ftell gpftell
+ #define clearerr gpclearerr
+ #define feof gpfeof
+ #define fgets gpfgets
+
+ extern int gpfprintf(FILE *stream, const char *fmt, ...);
+ #define fprintf gpfprintf
+ #define fflush gpfflush
+
+ extern void gpexit(int code);
+ #define exit gpexit
+ //#define error printf
+
+ extern time_t gptime(time_t *timer);
+ #define time gptime
+ #define MARK printf("MARK: %s, %s, %d", __FILE__, __FUNCTION__, __LINE__);
+
+ extern void *gpmemset (void *s, int c, size_t n);
+ extern void *gpmemcpy (void *dest, const void *src, size_t n);
+ //#define memset gpmemset
+ //#define memcpy gpmemcpy
+
More information about the Scummvm-git-logs
mailing list