From 13c8e7208ef037ff09f1b9fc9c496820a78b45bf Mon Sep 17 00:00:00 2001 From: Nach Date: Wed, 14 Nov 2007 10:40:41 +0000 Subject: [PATCH] More fixes. --- src/elf.cpp | 6 +++--- src/elf.h | 12 ++++++------ src/gb/GB.cpp | 2 +- src/gb/gbCheats.cpp | 4 ++-- src/gb/gbDis.cpp | 12 ++++++------ src/gb/gbGfx.cpp | 2 +- src/gb/gbMemory.cpp | 4 ++-- src/gb/gbSGB.cpp | 2 +- src/memgzio.c | 19 +++++++++++++++++++ src/memgzio.h | 2 ++ 10 files changed, 43 insertions(+), 22 deletions(-) diff --git a/src/elf.cpp b/src/elf.cpp index 6bb2b0a6..3d228f6d 100644 --- a/src/elf.cpp +++ b/src/elf.cpp @@ -332,7 +332,7 @@ const char *elfGetAddressSymbol(u32 addr) return ""; } -bool elfFindLineInModule(u32 *addr, char *name, int line) +bool elfFindLineInModule(u32 *addr, const char *name, int line) { CompileUnit *unit = elfCompileUnits; @@ -366,7 +366,7 @@ bool elfFindLineInModule(u32 *addr, char *name, int line) return false; } -int elfFindLine(CompileUnit *unit, Function * /* func */, u32 addr, char **f) +int elfFindLine(CompileUnit *unit, Function * /* func */, u32 addr, const char **f) { int currentLine = -1; if(unit->hasLineInfo) { @@ -480,7 +480,7 @@ const char *elfGetSymbol(int i, u32 *value, u32 *size, int *type) return NULL; } -bool elfGetSymbolAddress(char *sym, u32 *addr, u32 *size, int *type) +bool elfGetSymbolAddress(const char *sym, u32 *addr, u32 *size, int *type) { if(elfSymbolsCount) { for(int i = 0; i < elfSymbolsCount; i++) { diff --git a/src/elf.h b/src/elf.h index c6c4a59f..9ba7bfcf 100644 --- a/src/elf.h +++ b/src/elf.h @@ -164,7 +164,7 @@ struct Enum { struct Type { u32 offset; TypeEnum type; - char *name; + const char *name; int encoding; int size; int bitSize; @@ -258,7 +258,7 @@ struct DebugInfo { }; struct Symbol { - char *name; + const char *name; int type; int binding; u32 address; @@ -269,15 +269,15 @@ struct Symbol { extern u32 elfReadLEB128(u8 *, int *); extern s32 elfReadSignedLEB128(u8 *, int *); extern bool elfRead(const char *, int &, FILE *f); -extern bool elfGetSymbolAddress(char *,u32 *, u32 *, int *); +extern bool elfGetSymbolAddress(const char *,u32 *, u32 *, int *); extern const char *elfGetAddressSymbol(u32); extern const char *elfGetSymbol(int, u32 *, u32 *, int *); extern void elfCleanUp(); extern bool elfGetCurrentFunction(u32, Function **, CompileUnit **c); -extern bool elfGetObject(char *, Function *, CompileUnit *, Object **); +extern bool elfGetObject(const char *, Function *, CompileUnit *, Object **); extern bool elfFindLineInUnit(u32 *, CompileUnit *, int); -extern bool elfFindLineInModule(u32 *, char *, int); +extern bool elfFindLineInModule(u32 *, const char *, int); u32 elfDecodeLocation(Function *, ELFBlock *, LocationType *); u32 elfDecodeLocation(Function *, ELFBlock *, LocationType *, u32); -int elfFindLine(CompileUnit *unit, Function *func, u32 addr, char **); +int elfFindLine(CompileUnit *unit, Function *func, u32 addr, const char **); #endif diff --git a/src/gb/GB.cpp b/src/gb/GB.cpp index 4536c2db..ea18adb3 100644 --- a/src/gb/GB.cpp +++ b/src/gb/GB.cpp @@ -23,7 +23,7 @@ #include "../System.h" #include "../NLS.h" -#include "GB.h" +#include "gb.h" #include "gbCheats.h" #include "gbGlobals.h" #include "gbMemory.h" diff --git a/src/gb/gbCheats.cpp b/src/gb/gbCheats.cpp index 62a7ccb3..0914d9ec 100644 --- a/src/gb/gbCheats.cpp +++ b/src/gb/gbCheats.cpp @@ -27,7 +27,7 @@ #include "gbCheats.h" #include "gbGlobals.h" -#include "GB.h" +#include "gb.h" gbCheat gbCheatList[100]; int gbCheatNumber = 0; @@ -515,4 +515,4 @@ void gbCheatWrite(bool reboot) } } } -} \ No newline at end of file +} diff --git a/src/gb/gbDis.cpp b/src/gb/gbDis.cpp index bf85f3a8..85651fd4 100644 --- a/src/gb/gbDis.cpp +++ b/src/gb/gbDis.cpp @@ -25,19 +25,19 @@ typedef struct { u8 mask; u8 value; - char *mnen; + const char *mnen; } GBOPCODE; #define GB_READ(x) gbMemoryMap[(x)>>12][(x)&0xfff] -static char *registers[] = +static const char *registers[] = { "B", "C", "D", "E", "H", "L", "(HL)", "A" }; -static char *registers16[] = +static const char *registers16[] = { "BC", "DE", "HL", "SP", // for some operations "BC", "DE", "HL", "AF" }; // for push/pop -static char *cond[] = +static const char *cond[] = { "NZ", "Z", "NC", "C" }; static char hexDigits[16] = { @@ -145,7 +145,7 @@ static char *addHex16(char *p, u16 value) return addHex(p, value & 255); } -static char *addStr(char *p, char *s) +static char *addStr(char *p, const char *s) { while(*s) { *p++ = *s++; @@ -163,7 +163,7 @@ int gbDis(char *buffer, u16 address) u8 opcode = GB_READ(address); address++; - char *mnen; + const char *mnen; GBOPCODE *op; if(opcode == 0xcb) { opcode = GB_READ(address); diff --git a/src/gb/gbGfx.cpp b/src/gb/gbGfx.cpp index 6558b4eb..07872e88 100644 --- a/src/gb/gbGfx.cpp +++ b/src/gb/gbGfx.cpp @@ -598,4 +598,4 @@ void gbDrawSprites(bool draw) } } return; -} \ No newline at end of file +} diff --git a/src/gb/gbMemory.cpp b/src/gb/gbMemory.cpp index fd57aee1..7ea6d979 100644 --- a/src/gb/gbMemory.cpp +++ b/src/gb/gbMemory.cpp @@ -20,7 +20,7 @@ #include "../Port.h" #include "gbGlobals.h" #include "gbMemory.h" -#include "GB.h" +#include "gb.h" u8 gbDaysinMonth [12] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}; const u8 gbDisabledRam [8] = {0x80, 0xff, 0xf0, 0x00, 0x30, 0xbf, 0xbf, 0xbf}; extern int gbHardware; @@ -1714,4 +1714,4 @@ void memoryUpdateMapGS3() // GS can only change a half ROM bank gbMemoryMap[0x04] = &gbRom[tmpAddress]; gbMemoryMap[0x05] = &gbRom[tmpAddress + 0x1000]; -} \ No newline at end of file +} diff --git a/src/gb/gbSGB.cpp b/src/gb/gbSGB.cpp index 9c8469fc..4f516d87 100644 --- a/src/gb/gbSGB.cpp +++ b/src/gb/gbSGB.cpp @@ -22,7 +22,7 @@ #include "../System.h" #include "../Port.h" #include "../Util.h" -#include "GB.h" +#include "gb.h" #include "gbGlobals.h" extern u8 *pix; diff --git a/src/memgzio.c b/src/memgzio.c index 528539c3..0ec4b2dc 100644 --- a/src/memgzio.c +++ b/src/memgzio.c @@ -14,9 +14,28 @@ #include #include #include +#include +#include #include "memgzio.h" +#ifndef local +#define local static +#endif + +#ifndef DEF_MEM_LEVEL +# define DEF_MEM_LEVEL 8 +#endif + +#ifndef OS_CODE +#define OS_CODE 3 +#endif + +#ifndef zmemcpy +#define zmemcpy memcpy +#endif + + /*struct internal_state {int dummy;};*/ /* for buggy compilers */ #ifndef Z_BUFSIZE diff --git a/src/memgzio.h b/src/memgzio.h index 75db5981..8b69a10e 100644 --- a/src/memgzio.h +++ b/src/memgzio.h @@ -11,6 +11,8 @@ #if defined(HAVE_ZUTIL_H) || defined(_WIN32) # include +#else +#include #endif gzFile ZEXPORT memgzopen(char *memory, int, const char *);