diff --git a/CMakeLists.txt b/CMakeLists.txt index 12651b8e..1a0e3036 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -130,12 +130,12 @@ SET(SRC_MAIN src/Mode3.cpp src/Mode4.cpp src/Mode5.cpp - src/Patch.cpp src/RTC.cpp src/Sound.cpp src/Sram.cpp src/Util.cpp - src/memgzio.c + src/common/Patch.cpp + src/common/memgzio.c ) SET(SRC_AGB @@ -178,7 +178,7 @@ SET(SRC_SDL ) SET(SRC_FEX_MINI - src/fex_mini.cpp + src/common/fex_mini.cpp ) SET(SRC_FILTERS diff --git a/src/RTC.cpp b/src/RTC.cpp index fc9cf688..a49e8d77 100644 --- a/src/RTC.cpp +++ b/src/RTC.cpp @@ -1,7 +1,7 @@ #include "System.h" #include "agb/GBA.h" #include "Globals.h" -#include "Port.h" +#include "common/Port.h" #include "Util.h" #include "NLS.h" diff --git a/src/Sound.cpp b/src/Sound.cpp index d246e763..f0075c9f 100644 --- a/src/Sound.cpp +++ b/src/Sound.cpp @@ -5,7 +5,7 @@ #include "agb/GBA.h" #include "Globals.h" #include "Util.h" -#include "Port.h" +#include "common/Port.h" #include "dmg/gb_apu/Gb_Apu.h" #include "dmg/gb_apu/Multi_Buffer.h" diff --git a/src/System.h b/src/System.h index e0228f9d..9e431228 100644 --- a/src/System.h +++ b/src/System.h @@ -1,25 +1,10 @@ #ifndef SYSTEM_H #define SYSTEM_H -#include +#include "common/Types.h" #include -#ifndef NULL -#define NULL 0 -#endif - - -typedef uint8_t u8; -typedef uint16_t u16; -typedef uint32_t u32; -typedef uint64_t u64; - -typedef int8_t s8; -typedef int16_t s16; -typedef int32_t s32; -typedef int64_t s64; - class SoundDriver; struct EmulatedSystem { diff --git a/src/Util.cpp b/src/Util.cpp index dbeac853..e5c1b42c 100644 --- a/src/Util.cpp +++ b/src/Util.cpp @@ -16,13 +16,12 @@ extern "C" { #include "agb/GBA.h" #include "Globals.h" #include "RTC.h" -#include "Patch.h" -#include "Port.h" +#include "common/Port.h" -#include "fex.h" +#include "common/fex.h" extern "C" { -#include "memgzio.h" +#include "common/memgzio.h" } #ifndef _MSC_VER @@ -313,11 +312,6 @@ bool utilWriteBMPFile(const char *fileName, int w, int h, u8 *pix) return true; } -void utilApplyIPS(const char *ips, u8 **rom, int *size) -{ - applyPatch(ips, rom, size); -} - extern bool cpuIsMultiBoot; bool utilIsGBAImage(const char * file) diff --git a/src/agb/GBA-arm.cpp b/src/agb/GBA-arm.cpp index 880c68da..667d6918 100644 --- a/src/agb/GBA-arm.cpp +++ b/src/agb/GBA-arm.cpp @@ -17,7 +17,6 @@ #include "../NLS.h" #include "../elf.h" #include "../Util.h" -#include "../Port.h" #include "../System.h" #include "agbprint.h" #ifdef PROFILING diff --git a/src/agb/GBA-thumb.cpp b/src/agb/GBA-thumb.cpp index ebdba4e1..97c7c21e 100644 --- a/src/agb/GBA-thumb.cpp +++ b/src/agb/GBA-thumb.cpp @@ -17,7 +17,6 @@ #include "../NLS.h" #include "../elf.h" #include "../Util.h" -#include "../Port.h" #include "../System.h" #include "agbprint.h" #ifdef PROFILING diff --git a/src/agb/GBA.cpp b/src/agb/GBA.cpp index 18515ad5..d57f4344 100644 --- a/src/agb/GBA.cpp +++ b/src/agb/GBA.cpp @@ -17,7 +17,7 @@ #include "../NLS.h" #include "../elf.h" #include "../Util.h" -#include "../Port.h" +#include "../common/Port.h" #include "../System.h" #include "agbprint.h" #ifdef PROFILING diff --git a/src/agb/GBAGfx.h b/src/agb/GBAGfx.h index 647a89dd..069ff0b6 100644 --- a/src/agb/GBAGfx.h +++ b/src/agb/GBAGfx.h @@ -4,7 +4,7 @@ #include "GBA.h" #include "../Globals.h" -#include "../Port.h" +#include "../common/Port.h" //#define SPRITE_DEBUG diff --git a/src/agb/GBAinline.h b/src/agb/GBAinline.h index e5bb9ad0..7183e05f 100644 --- a/src/agb/GBAinline.h +++ b/src/agb/GBAinline.h @@ -2,7 +2,7 @@ #define GBAINLINE_H #include "../System.h" -#include "../Port.h" +#include "../common/Port.h" #include "../RTC.h" #include "../Sound.h" #include "agbprint.h" diff --git a/src/agb/agbprint.cpp b/src/agb/agbprint.cpp index 8a6e7132..f79e6313 100644 --- a/src/agb/agbprint.cpp +++ b/src/agb/agbprint.cpp @@ -3,7 +3,7 @@ #include "GBA.h" #include "../Globals.h" -#include "../Port.h" +#include "../common/Port.h" #include "../System.h" #define debuggerWriteHalfWord(addr, value) \ diff --git a/src/armdis.cpp b/src/armdis.cpp index f345d08b..9d354a80 100644 --- a/src/armdis.cpp +++ b/src/armdis.cpp @@ -4,7 +4,7 @@ #include #include "System.h" -#include "Port.h" +#include "common/Port.h" #include "agb/GBA.h" #include "armdis.h" #include "elf.h" diff --git a/src/Patch.cpp b/src/common/Patch.cpp similarity index 92% rename from src/Patch.cpp rename to src/common/Patch.cpp index 86900335..d908e89b 100644 --- a/src/Patch.cpp +++ b/src/common/Patch.cpp @@ -3,14 +3,8 @@ #include #include -#include "System.h" -// #include "NLS.h" -// #include "Util.h" -// #include "Flash.h" -// #include "agb/GBA.h" -// #include "Globals.h" -// #include "RTC.h" -// #include "Port.h" +#include "Patch.h" + #ifdef __GNUC__ #if defined(__APPLE__) || defined (BSD) @@ -283,7 +277,7 @@ static int ppfVersion(FILE *f) } } -int ppfFileIdLen(FILE *f, int version) +static int ppfFileIdLen(FILE *f, int version) { if (version == 2) { fseeko64(f, -8, SEEK_END); diff --git a/src/Patch.h b/src/common/Patch.h similarity index 80% rename from src/Patch.h rename to src/common/Patch.h index 9e409275..0e69fee2 100644 --- a/src/Patch.h +++ b/src/common/Patch.h @@ -1,7 +1,7 @@ #ifndef PATCH_H #define PATCH_H -#include "System.h" +#include "Types.h" bool applyPatch(const char *patchname, u8 **rom, int *size); diff --git a/src/Port.h b/src/common/Port.h similarity index 100% rename from src/Port.h rename to src/common/Port.h diff --git a/src/common/SoundDriver.h b/src/common/SoundDriver.h index 578b3ec0..31de4588 100644 --- a/src/common/SoundDriver.h +++ b/src/common/SoundDriver.h @@ -18,6 +18,8 @@ #ifndef __VBA_SOUND_DRIVER_H__ #define __VBA_SOUND_DRIVER_H__ +#include "Types.h" + /** * Sound driver abstract interface for the core to use to output sound. * Subclass this to implement a new sound driver. diff --git a/src/common/SoundSDL.cpp b/src/common/SoundSDL.cpp index 82249d4c..4c28a6a4 100644 --- a/src/common/SoundSDL.cpp +++ b/src/common/SoundSDL.cpp @@ -1,9 +1,24 @@ -#include -#include "../System.h" -#include "../Globals.h" +// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. +// Copyright (C) 2008 VBA-M development team + +// 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, 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 "SoundSDL.h" +#include "../Globals.h" + extern int emulating; SoundSDL::SoundSDL(): diff --git a/src/common/SoundSDL.h b/src/common/SoundSDL.h index 8a00f00f..70cf1f0e 100644 --- a/src/common/SoundSDL.h +++ b/src/common/SoundSDL.h @@ -21,6 +21,8 @@ #include "SoundDriver.h" #include "RingBuffer.h" +#include + class SoundSDL: public SoundDriver { public: diff --git a/src/fex.h b/src/common/fex.h similarity index 100% rename from src/fex.h rename to src/common/fex.h diff --git a/src/fex_mini.cpp b/src/common/fex_mini.cpp similarity index 100% rename from src/fex_mini.cpp rename to src/common/fex_mini.cpp diff --git a/src/memgzio.c b/src/common/memgzio.c similarity index 100% rename from src/memgzio.c rename to src/common/memgzio.c diff --git a/src/memgzio.h b/src/common/memgzio.h similarity index 100% rename from src/memgzio.h rename to src/common/memgzio.h diff --git a/src/dmg/gbMemory.cpp b/src/dmg/gbMemory.cpp index e8d3cf87..72723874 100644 --- a/src/dmg/gbMemory.cpp +++ b/src/dmg/gbMemory.cpp @@ -1,5 +1,5 @@ #include "../agb/GBA.h" -#include "../Port.h" +#include "../common/Port.h" #include "gbGlobals.h" #include "gbMemory.h" #include "gb.h" diff --git a/src/dmg/gbSGB.cpp b/src/dmg/gbSGB.cpp index 7e73ed90..44f765d9 100644 --- a/src/dmg/gbSGB.cpp +++ b/src/dmg/gbSGB.cpp @@ -2,7 +2,7 @@ #include #include "../System.h" -#include "../Port.h" +#include "../common/Port.h" #include "../Util.h" #include "gb.h" #include "gbGlobals.h" diff --git a/src/elf.cpp b/src/elf.cpp index 278bbc4b..8ed7c861 100644 --- a/src/elf.cpp +++ b/src/elf.cpp @@ -3,7 +3,7 @@ #include #include "agb/GBA.h" -#include "Port.h" +#include "common/Port.h" #include "elf.h" #include "NLS.h" diff --git a/src/sdl/SDL.cpp b/src/sdl/SDL.cpp index 7f84fed4..fbd56e38 100644 --- a/src/sdl/SDL.cpp +++ b/src/sdl/SDL.cpp @@ -40,7 +40,7 @@ #include "../agb/GBA.h" #include "../agb/agbprint.h" #include "../Flash.h" -#include "../Patch.h" +#include "../common/Patch.h" #include "../RTC.h" #include "../Sound.h" #include "../Util.h" diff --git a/src/sdl/debugger.cpp b/src/sdl/debugger.cpp index 30bbb8f6..b660a32b 100644 --- a/src/sdl/debugger.cpp +++ b/src/sdl/debugger.cpp @@ -24,7 +24,7 @@ #include #include "../agb/GBA.h" -#include "../Port.h" +#include "../common/Port.h" #include "../Sound.h" #include "../armdis.h" #include "../elf.h" diff --git a/src/sdl/exprNode.cpp b/src/sdl/exprNode.cpp index a2e6dccd..c400501c 100644 --- a/src/sdl/exprNode.cpp +++ b/src/sdl/exprNode.cpp @@ -21,7 +21,7 @@ #include #include "../agb/GBA.h" -#include "../Port.h" +#include "../common/Port.h" #include "../elf.h" #include "exprNode.h"