diff options
author | pixel <pixel> | 2005-02-17 08:33:49 +0000 |
---|---|---|
committer | pixel <pixel> | 2005-02-17 08:33:49 +0000 |
commit | 10950039598638315f96a5a966804d68427166e5 (patch) | |
tree | f60d7f51c813a02e868963c7459a8c8ff8812c1b | |
parent | 122edf9b051308f715a325066ed480537ea0a841 (diff) |
Updating makefiles to add luapatch, and updating things a bit for PS2 target.
-rw-r--r-- | include/Exceptions.h | 4 | ||||
-rw-r--r-- | include/generic.h | 25 | ||||
-rw-r--r-- | lib/BLua.cc | 5 | ||||
-rw-r--r-- | lib/Exceptions.cc | 14 | ||||
-rw-r--r-- | lib/Handle.cc | 10 | ||||
-rw-r--r-- | lib/Input.cc | 31 | ||||
-rw-r--r-- | lib/Output.cc | 12 |
7 files changed, 76 insertions, 25 deletions
diff --git a/include/Exceptions.h b/include/Exceptions.h index 470ee45..901bd33 100644 --- a/include/Exceptions.h +++ b/include/Exceptions.h @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -/* $Id: Exceptions.h,v 1.40 2004-11-28 12:20:10 pixel Exp $ */ +/* $Id: Exceptions.h,v 1.41 2005-02-17 08:33:49 pixel Exp $ */ #ifndef __EXCEPTIONS_H__ #define __EXCEPTIONS_H__ @@ -56,6 +56,7 @@ class Base { static void * malloc(ssize_t s); static void * realloc(void * p, size_t s); static void * calloc(size_t n, size_t s); + static int dup(int); void * operator new(size_t s); void * operator new(size_t s, void * p); void operator delete(void * p); @@ -102,6 +103,7 @@ class GeneralException : public Base { char * xstrdup(const char *); void * xmalloc(size_t) throw (GeneralException); void * xrealloc(void *, size_t); +int xdup(int) throw (GeneralException); int xpipe(int *, int = 0) throw (GeneralException); pid_t xfork() throw (GeneralException); //! This will simply throw the Exit exception. diff --git a/include/generic.h b/include/generic.h index 4f71654..ee41652 100644 --- a/include/generic.h +++ b/include/generic.h @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -/* $Id: generic.h,v 1.32 2004-12-27 18:49:30 pixel Exp $ */ +/* $Id: generic.h,v 1.33 2005-02-17 08:33:49 pixel Exp $ */ #ifndef __GENERIC_H__ #define __GENERIC_H__ @@ -42,6 +42,26 @@ #define bcopy(x,y,z) memcpy((y),(x),(z)) #endif +#ifdef __MIPSEL__ +/* we most probably are in ps2dev here */ +#include <tamtypes.h> +#include <stddef.h> + +typedef u64 Uint64; +typedef s64 int64; +typedef u32 Uint32; +typedef s32 int32; +typedef u16 Uint16; +typedef s16 int16; +typedef u8 Uint8; +typedef s8 int8; + +typedef u8 Byte; +typedef u16 Word; +typedef u32 DWord; + +#else + #if ! defined SDL_VERSIONNUM && ! defined Uint32 typedef unsigned long int Uint32; #endif @@ -93,6 +113,7 @@ typedef unsigned _int64 Uint64; #error Unsupported platform (need 64 bits ints definition) #endif #endif +#endif #ifndef PACKED #if defined __linux__ || defined sun || defined __solaris__ || defined __CYGWIN32__ || defined __MINGW32__ || defined __APPLE__ @@ -189,7 +210,7 @@ inline T ABS(T x) { #include <direct.h> #define MKDIR mkdir #else -#error Unknow compiler/platform +#warning Unknow compiler/platform; MKDIR not defined. #endif #endif diff --git a/lib/BLua.cc b/lib/BLua.cc index 056598f..4a37c1b 100644 --- a/lib/BLua.cc +++ b/lib/BLua.cc @@ -17,8 +17,9 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -/* $Id: BLua.cc,v 1.28 2005-02-17 08:31:04 pixel Exp $ */ +/* $Id: BLua.cc,v 1.29 2005-02-17 08:33:50 pixel Exp $ */ +#include <stdlib.h> #include "BLua.h" #include <lualib.h> @@ -70,7 +71,7 @@ class LuaStatics : public Base { std::map<lua_State *, Lua *> Lua::lualist; -int LuaStatics::luaerror(lua_State * _L) throw (GeneralException) { +int LuaStatics::luaerror(lua_State * _L) { Lua * L = Lua::find(_L); L->push_lua_context(); L->showerror(); diff --git a/lib/Exceptions.cc b/lib/Exceptions.cc index a6cfc54..acc948c 100644 --- a/lib/Exceptions.cc +++ b/lib/Exceptions.cc @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -/* $Id: Exceptions.cc,v 1.37 2004-12-27 18:50:00 pixel Exp $ */ +/* $Id: Exceptions.cc,v 1.38 2005-02-17 08:33:50 pixel Exp $ */ #include <string.h> #include <errno.h> @@ -178,6 +178,14 @@ int xpipe(int *, int) throw (GeneralException) { } #endif +int xdup(int h) throw(GeneralException) { +#ifdef __MIPSEL__ + throw GeneralException(_("Dup isn't supported on PlayStation2 yet")); +#else + return dup(h); +#endif +} + #ifdef HAVE_FORK pid_t xfork() throw (GeneralException) { pid_t p; @@ -220,6 +228,10 @@ void * Base::calloc(size_t n, size_t s) { return xmalloc(n * s); } +int Base::dup(int h) { + return xdup(h); +} + void * Base::operator new(size_t s) { #ifdef DEBUG printm(M_BARE, _("Operator new(s) called. Allocating memory.\n")); diff --git a/lib/Handle.cc b/lib/Handle.cc index b875f3e..684001d 100644 --- a/lib/Handle.cc +++ b/lib/Handle.cc @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -/* $Id: Handle.cc,v 1.74 2004-12-23 02:30:34 pixel Exp $ */ +/* $Id: Handle.cc,v 1.75 2005-02-17 08:33:50 pixel Exp $ */ #include <stdio.h> #include <string.h> @@ -50,7 +50,7 @@ inline Uint32 bswap_32(Uint32 w) { #include <io.h> #endif -#ifndef _WIN32 +#if !defined(_WIN32) && !defined(__MIPSEL__) #include <sys/mman.h> #endif @@ -605,7 +605,11 @@ void * Handle::mmap(off_t offset, size_t length) throw (GeneralException) { } maplength = length; #ifndef _WIN32 +#ifdef __MIPSEL__ + throw GeneralException("No mmap in ps2sdk yet."); +#else r = ::mmap(0, length, (CanRead() ? PROT_READ : 0) | (CanWrite() ? PROT_WRITE : 0), MAP_SHARED, h, offset); +#endif if (!r) { throw GeneralException(String("Was not able to mmap(): ") + strerror(errno)); } @@ -643,9 +647,11 @@ void Handle::munmap() throw (GeneralException) { throw GeneralException("Can't munmap, was not mapped"); } #ifndef _WIN32 +#ifndef __MIPSEL__ if (::munmap(mappedarea, maplength)) { throw GeneralException(String("Was not able to munmap(): ") + strerror(errno)); } +#endif #else if (!UnmapViewOfFile(mappedarea)) { throw GeneralException("Was not able to UnmapViewOfFile()"); diff --git a/lib/Input.cc b/lib/Input.cc index 15d9a38..1c58dab 100644 --- a/lib/Input.cc +++ b/lib/Input.cc @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -/* $Id: Input.cc,v 1.50 2004-12-27 18:48:48 pixel Exp $ */ +/* $Id: Input.cc,v 1.51 2005-02-17 08:33:50 pixel Exp $ */ #include <stdio.h> #include <string.h> @@ -107,27 +107,24 @@ Input::Input(const String & no) throw (GeneralException) : fromarchive = false; if (results.name == "") { +#ifndef __MIPSEL__ struct stat s; fstat(GetHandle(), &s); date_modif = s.st_mtime; +#endif #ifdef __linux__ - if (S_ISREG(s.st_mode)) { + if (S_ISREG(s.st_mode)) #endif -#if 0 -#if defined (_WIN32) && !defined (NO_HFILE) - if (hFile) { - GetFileSize(hFile, (LPDWORD)&size); - } else -#endif -#endif - { - size = seek(0, SEEK_END); - seek(0, SEEK_SET); - } -#ifdef __linux__ - } +#if 0 && defined (_WIN32) && !defined (NO_HFILE) + if (hFile) { + GetFileSize(hFile, (LPDWORD)&size); + } else #endif + { + size = seek(0, SEEK_END); + seek(0, SEEK_SET); + } } else { #ifdef DEBUG printm(M_INFO, String(_("Opening file in archive, position ")) + results.ptr + "\n"); @@ -154,11 +151,15 @@ bool Input::CanRead() const { } bool Input::CanSeek() const { +#ifdef __MIPSEL__ + return true; +#else struct stat s; fstat(GetHandle(), &s); return S_ISREG(s.st_mode); +#endif } String Input::GetName() const { diff --git a/lib/Output.cc b/lib/Output.cc index 310ca79..ab5a583 100644 --- a/lib/Output.cc +++ b/lib/Output.cc @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -/* $Id: Output.cc,v 1.22 2004-11-27 21:46:04 pixel Exp $ */ +/* $Id: Output.cc,v 1.23 2005-02-17 08:33:50 pixel Exp $ */ #include <stdio.h> #include <string.h> @@ -51,11 +51,15 @@ Output::Output(String no, int create, int trunc) throw (GeneralException) : size = lseek(GetHandle(), 0, SEEK_END); lseek(GetHandle(), 0, SEEK_SET); +#ifndef __MIPSEL__ struct stat s; fstat(GetHandle(), &s); date_modif = s.st_mtime; +#else + date_modif = 0; +#endif } int Output::wrapopen(const String & n, int create, int trunc) { @@ -107,11 +111,15 @@ bool Output::CanRead() const { } bool Output::CanSeek() const { +#ifdef __MIPSEL__ + return true; +#else struct stat s; fstat(GetHandle(), &s); - return S_ISREG(s.st_mode); + return S_ISREG(s.st_mode); +#endif } off_t Output::seek(off_t offset, int whence) throw (GeneralException) { |