structural changes

This commit is contained in:
dborth 2009-01-10 02:41:39 +00:00
parent 110cc7fc39
commit bba6ccd468
56 changed files with 2798 additions and 3509 deletions

View File

@ -1,22 +1,3 @@
// -*- C++ -*-
// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator.
// Copyright (C) 1999-2003 Forgotten
// Copyright (C) 2004 Forgotten and the VBA 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.
#define N_(String) (String) #define N_(String) (String)
#define MSG_UNSUPPORTED_VBA_SGM 1 #define MSG_UNSUPPORTED_VBA_SGM 1

View File

@ -1,44 +1,11 @@
// -*- C++ -*- #ifndef SYSTEM_H
// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. #define SYSTEM_H
// Copyright (C) 1999-2003 Forgotten
// Copyright (C) 2004 Forgotten and the VBA development team
// This program is free software; you can redistribute it and/or modify #include "common/Types.h"
// 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.
#ifndef VBA_SYSTEM_H
#define VBA_SYSTEM_H
#include <stdint.h>
#include <zlib.h> #include <zlib.h>
#ifndef NULL class SoundDriver;
#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;
struct EmulatedSystem { struct EmulatedSystem {
// main emulation function // main emulation function
@ -84,12 +51,17 @@ extern u32 systemReadJoypad(int);
extern u32 systemGetClock(); extern u32 systemGetClock();
extern void systemMessage(int, const char *, ...); extern void systemMessage(int, const char *, ...);
extern void systemSetTitle(const char *); extern void systemSetTitle(const char *);
extern SoundDriver * systemSoundInit();
extern void systemOnWriteDataToSoundBuffer(const u16 * finalWave, int length);
extern void systemOnSoundShutdown();
// old defs
extern void systemWriteDataToSoundBuffer(); extern void systemWriteDataToSoundBuffer();
extern void systemSoundShutdown(); extern void systemSoundShutdown();
extern void systemSoundPause(); extern void systemSoundPause();
extern void systemSoundResume(); extern void systemSoundResume();
extern void systemSoundReset(); extern void systemSoundReset();
extern bool systemSoundInit(); extern bool systemSoundInit();
// end old defs
extern void systemScreenMessage(const char *); extern void systemScreenMessage(const char *);
extern void systemUpdateMotionSensor(); extern void systemUpdateMotionSensor();
extern int systemGetSensorX(); extern int systemGetSensorX();
@ -122,9 +94,8 @@ extern int systemVerbose;
extern int systemFrameSkip; extern int systemFrameSkip;
extern int systemSaveUpdateCounter; extern int systemSaveUpdateCounter;
extern int systemSpeed; extern int systemSpeed;
extern int systemThrottle;
#define SYSTEM_SAVE_UPDATED 30 #define SYSTEM_SAVE_UPDATED 30
#define SYSTEM_SAVE_NOT_UPDATED 0 #define SYSTEM_SAVE_NOT_UPDATED 0
#endif //VBA_SYSTEM_H #endif // SYSTEM_H

View File

@ -40,7 +40,7 @@ public:
// a new time frame at the end of the current frame. // a new time frame at the end of the current frame.
void end_frame( blip_time_t time ); void end_frame( blip_time_t time );
// Reads at most 'max_samples' out of buffer into 'dest', removing them from from // Reads at most 'max_samples' out of buffer into 'dest', removing them from
// the buffer. Returns number of samples actually read and removed. If stereo is // the buffer. Returns number of samples actually read and removed. If stereo is
// true, increments 'dest' one extra time after writing each sample, to allow // true, increments 'dest' one extra time after writing each sample, to allow
// easy interleving of two channels into a stereo output buffer. // easy interleving of two channels into a stereo output buffer.

View File

@ -0,0 +1,65 @@
// 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.
#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.
*/
class SoundDriver
{
public:
/**
* Destructor. Free the resources allocated by the sound driver.
*/
virtual ~SoundDriver() { };
/**
* Initialize the sound driver.
* @param sampleRate In Hertz
*/
virtual bool init(long sampleRate) = 0;
/**
* Tell the driver that the sound stream has paused
*/
virtual void pause() = 0;
/**
* Reset the sound driver
*/
virtual void reset() = 0;
/**
* Tell the driver that the sound stream has resumed
*/
virtual void resume() = 0;
/**
* Write length bytes of data from the finalWave buffer to the driver output buffer.
*/
virtual void write(u16 * finalWave, int length) = 0;
virtual void setThrottle(unsigned short throttle) { };
};
#endif // __VBA_SOUND_DRIVER_H__

33
source/vba/common/Types.h Normal file
View File

@ -0,0 +1,33 @@
// 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.
#ifndef __VBA_TYPES_H__
#define __VBA_TYPES_H__
#include <stdint.h>
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;
#endif // __VBA_TYPES_H__

View File

@ -1,21 +1,3 @@
// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator.
// Copyright (C) 1999-2003 Forgotten
// Copyright (C) 2005-2006 Forgotten and the VBA 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 <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
@ -3869,7 +3851,13 @@ static bool gbReadSaveState(gzFile gzFile)
systemDrawScreen(); systemDrawScreen();
if(version > GBSAVE_GAME_VERSION_1) if(version > GBSAVE_GAME_VERSION_1)
{
if( skipSaveGameCheats ) {
gbCheatsReadGameSkip(gzFile, version);
} else {
gbCheatsReadGame(gzFile, version); gbCheatsReadGame(gzFile, version);
}
}
if (version<11) if (version<11)
{ {
@ -4787,8 +4775,6 @@ void gbEmulate(int ticksToStop)
tempgbWindowLine = 146; tempgbWindowLine = 146;
} }
int wy = inUseRegister_WY;
if(register_LY >= inUseRegister_WY) { if(register_LY >= inUseRegister_WY) {
if (tempgbWindowLine == -1) if (tempgbWindowLine == -1)

View File

@ -1,24 +1,5 @@
// -*- C++ -*- #ifndef GB_H
// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. #define GB_H
// Copyright (C) 1999-2003 Forgotten
// Copyright (C) 2005-2006 Forgotten and the VBA 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.
#ifndef VBA_GB_GB_H
#define VBA_GB_GB_H
#define C_FLAG 0x10 #define C_FLAG 0x10
#define H_FLAG 0x20 #define H_FLAG 0x20
@ -62,4 +43,4 @@ extern struct EmulatedSystem GBSystem;
bool MemgbReadBatteryFile(char * membuffer, int read); bool MemgbReadBatteryFile(char * membuffer, int read);
int MemgbWriteBatteryFile(char * membuffer); int MemgbWriteBatteryFile(char * membuffer);
#endif #endif // GB_H

View File

@ -1,21 +1,3 @@
// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator.
// Copyright (C) 1999-2003 Forgotten
// Copyright (C) 2005 Forgotten and the VBA 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 <string.h> #include <string.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
@ -91,6 +73,35 @@ void gbCheatsReadGame(gzFile gzFile, int version)
gbCheatUpdateMap(); gbCheatUpdateMap();
} }
void gbCheatsReadGameSkip(gzFile gzFile, int version)
{
if( version <= 8 ) {
int gbGgOn = utilReadInt( gzFile );
if( gbGgOn ) {
int n = utilReadInt( gzFile );
if( n > 0 ) {
utilGzSeek( gzFile, n * sizeof(gbXxCheat), SEEK_CUR );
}
}
int gbGsOn = utilReadInt( gzFile );
if( gbGsOn ) {
int n = utilReadInt(gzFile);
if( n > 0 ) {
utilGzSeek( gzFile, n * sizeof(gbXxCheat), SEEK_CUR );
}
}
} else {
int n = utilReadInt( gzFile );
if( n > 0 ) {
utilGzSeek( gzFile, n * sizeof(gbCheat), SEEK_CUR );
}
}
}
void gbCheatsSaveCheatList(const char *file) void gbCheatsSaveCheatList(const char *file)
{ {
if(gbCheatNumber == 0) if(gbCheatNumber == 0)
@ -177,10 +188,10 @@ bool gbVerifyGsCode(const char *code)
if(!GBCHEAT_IS_HEX(code[i])) if(!GBCHEAT_IS_HEX(code[i]))
return false; return false;
int address = GBCHEAT_HEX_VALUE(code[6]) << 12 | /* int address = GBCHEAT_HEX_VALUE(code[6]) << 12 |
GBCHEAT_HEX_VALUE(code[7]) << 8 | GBCHEAT_HEX_VALUE(code[7]) << 8 |
GBCHEAT_HEX_VALUE(code[4]) << 4 | GBCHEAT_HEX_VALUE(code[4]) << 4 |
GBCHEAT_HEX_VALUE(code[5]); GBCHEAT_HEX_VALUE(code[5]);*/
return true; return true;
} }

View File

@ -1,24 +1,5 @@
// -*- C++ -*- #ifndef GBCHEATS_H
// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. #define GBCHEATS_H
// Copyright (C) 1999-2003 Forgotten
// Copyright (C) 2004 Forgotten and the VBA 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.
#ifndef __VBA_GB_GBCHEATS_H
#define __VBA_GB_GBCHEATS_H
#include "../System.h" #include "../System.h"
@ -39,6 +20,7 @@ struct gbCheat {
void gbCheatsSaveGame(gzFile); void gbCheatsSaveGame(gzFile);
void gbCheatsReadGame(gzFile, int); void gbCheatsReadGame(gzFile, int);
void gbCheatsReadGameSkip(gzFile, int);
void gbCheatsSaveCheatList(const char *); void gbCheatsSaveCheatList(const char *);
bool gbCheatsLoadCheatList(const char *); bool gbCheatsLoadCheatList(const char *);
bool gbCheatReadGSCodeFile(const char *); bool gbCheatReadGSCodeFile(const char *);
@ -58,5 +40,5 @@ bool gbVerifyGgCode(const char *code);
extern int gbCheatNumber; extern int gbCheatNumber;
extern gbCheat gbCheatList[100]; extern gbCheat gbCheatList[100];
extern bool gbCheatMap[0x10000]; extern bool gbCheatMap[0x10000];
#endif
#endif // GBCHEATS_H

View File

@ -1,22 +1,3 @@
// -*- C++ -*-
// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator.
// Copyright (C) 1999-2003 Forgotten
// Copyright (C) 2005-2006 Forgotten and the VBA 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.
case 0x00: case 0x00:
// NOP // NOP
break; break;
@ -315,7 +296,7 @@
break; break;
case 0x37: case 0x37:
// SCF // SCF
AF.B.B0 = AF.B.B0 & Z_FLAG | C_FLAG; AF.B.B0 = (AF.B.B0 & Z_FLAG) | C_FLAG;
break; break;
case 0x38: case 0x38:
// JR C,NN // JR C,NN

View File

@ -1,22 +1,3 @@
// -*- C++ -*-
// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator.
// Copyright (C) 1999-2003 Forgotten
// Copyright (C) 2005 Forgotten and the VBA 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.
case 0x00: case 0x00:
// RLC B // RLC B
AF.B.B0 = (BC.B.B1 & 0x80)?C_FLAG:0; AF.B.B0 = (BC.B.B1 & 0x80)?C_FLAG:0;

View File

@ -1,21 +1,3 @@
// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator.
// Copyright (C) 1999-2003 Forgotten
// Copyright (C) 2004 Forgotten and the VBA 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 <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>

View File

@ -1,24 +1,6 @@
// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator.
// Copyright (C) 1999-2003 Forgotten
// Copyright (C) 2005-2006 Forgotten and the VBA 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 <string.h> #include <string.h>
#include "../common/Types.h"
#include "../gba/GBA.h" #include "../Util.h"
#include "gbGlobals.h" #include "gbGlobals.h"
#include "gbSGB.h" #include "gbSGB.h"
@ -60,6 +42,7 @@ u8 gbInvertTab[256] = {
u16 gbLineMix[160]; u16 gbLineMix[160];
u16 gbWindowColor[160]; u16 gbWindowColor[160];
extern int inUseRegister_WY; extern int inUseRegister_WY;
extern int layerSettings;
void gbRenderLine() void gbRenderLine()
{ {
@ -583,11 +566,12 @@ void gbDrawSprites(bool draw)
{ {
for (int j = x-8; j<300; j++) for (int j = x-8; j<300; j++)
if (j>=0) if (j>=0)
{
if (gbSpeed) if (gbSpeed)
gbSpritesTicks[j] += 5; gbSpritesTicks[j] += 5;
else else
gbSpritesTicks[j] += 2+(count&1); gbSpritesTicks[j] += 2+(count&1);
}
} }
count++; count++;
} }

View File

@ -1,22 +1,5 @@
// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. #include <string.h>
// Copyright (C) 1999-2003 Forgotten #include "../common/Types.h"
// Copyright (C) 2005-2006 Forgotten and the VBA 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 "../gba/GBA.h"
u8 *gbMemoryMap[16]; u8 *gbMemoryMap[16];

View File

@ -1,21 +1,5 @@
// -*- C++ -*- #ifndef GBGLOBALS_H
// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. #define GBGLOBALS_H
// Copyright (C) 1999-2003 Forgotten
// Copyright (C) 2005-2006 Forgotten and the VBA 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.
extern int gbRomSizeMask; extern int gbRomSizeMask;
extern int gbRomSize; extern int gbRomSize;
@ -27,6 +11,7 @@ extern bool useBios;
extern bool skipBios; extern bool skipBios;
extern u8 *bios; extern u8 *bios;
extern bool skipSaveGameBattery; extern bool skipSaveGameBattery;
extern bool skipSaveGameCheats;
extern u8 *gbRom; extern u8 *gbRom;
extern u8 *gbRam; extern u8 *gbRam;
@ -88,3 +73,5 @@ extern void gbRenderLine();
extern void gbDrawSprites(bool); extern void gbDrawSprites(bool);
extern u8 (*gbSerialFunction)(u8); extern u8 (*gbSerialFunction)(u8);
#endif // GBGLOBALS_H

View File

@ -1,22 +1,4 @@
// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. #include "../System.h"
// Copyright (C) 1999-2003 Forgotten
// Copyright (C) 2005-2006 Forgotten and the VBA 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 "../gba/GBA.h"
#include "../common/Port.h" #include "../common/Port.h"
#include "gbGlobals.h" #include "gbGlobals.h"
#include "gbMemory.h" #include "gbMemory.h"
@ -1194,6 +1176,7 @@ mapperTAMA5 gbDataTAMA5 = {
0, // RAM Byte select 0, // RAM Byte select
0, // mapper command number 0, // mapper command number
0, // mapper last command; 0, // mapper last command;
{
0, // commands 0x0 0, // commands 0x0
0, // commands 0x1 0, // commands 0x1
0, // commands 0x2 0, // commands 0x2
@ -1209,7 +1192,8 @@ mapperTAMA5 gbDataTAMA5 = {
0, // commands 0xc 0, // commands 0xc
0, // commands 0xd 0, // commands 0xd
0, // commands 0xe 0, // commands 0xe
0, // commands 0xf 0 // commands 0xf
},
0, // register 0, // register
0, // timer clock latch 0, // timer clock latch
0, // timer clock register 0, // timer clock register
@ -1306,8 +1290,8 @@ void mapperTAMA5RAM(u16 address, u8 value)
gbDataTAMA5.mapperCommands[gbDataTAMA5.mapperCommandNumber] = value; gbDataTAMA5.mapperCommands[gbDataTAMA5.mapperCommandNumber] = value;
gbMemoryMap[0xa][0] = value; gbMemoryMap[0xa][0] = value;
int test = gbDataTAMA5.mapperCommands[gbDataTAMA5.mapperCommandNumber & 0x0e] | /* int test = gbDataTAMA5.mapperCommands[gbDataTAMA5.mapperCommandNumber & 0x0e] |
(gbDataTAMA5.mapperCommands[(gbDataTAMA5.mapperCommandNumber & 0x0e) +1]<<4); (gbDataTAMA5.mapperCommands[(gbDataTAMA5.mapperCommandNumber & 0x0e) +1]<<4);*/
if ((gbDataTAMA5.mapperCommandNumber & 0xe) == 0) // Read Command !!! if ((gbDataTAMA5.mapperCommandNumber & 0xe) == 0) // Read Command !!!
{ {
@ -1338,7 +1322,7 @@ void mapperTAMA5RAM(u16 address, u8 value)
// Write Commands !!! // Write Commands !!!
if (gbDataTAMA5.mapperCommands[0x0f] && (gbDataTAMA5.mapperCommandNumber == 7)) if (gbDataTAMA5.mapperCommands[0x0f] && (gbDataTAMA5.mapperCommandNumber == 7))
{ {
int data = gbDataTAMA5.mapperCommands[0x04] & 0x0f | int data = (gbDataTAMA5.mapperCommands[0x04] & 0x0f) |
(gbDataTAMA5.mapperCommands[0x05] <<4); (gbDataTAMA5.mapperCommands[0x05] <<4);
// Not sure when the write command should reset... // Not sure when the write command should reset...
@ -1472,7 +1456,7 @@ void mapperTAMA5RAM(u16 address, u8 value)
for (int i = 0; i<0x10; i++) for (int i = 0; i<0x10; i++)
for (int j = 0; j<0x10; j++) for (int j = 0; j<0x10; j++)
if (!(j&2)) if (!(j&2))
gbTAMA5ram[(i*0x10)+j | 2] = gbTAMA5ram[(i*0x10)+j]; gbTAMA5ram[((i*0x10)+j) | 2] = gbTAMA5ram[(i*0x10)+j];
// Enable this to see the content of the flashrom in 0xe000 // Enable this to see the content of the flashrom in 0xe000
/*for (int k = 0; k<0x100; k++) /*for (int k = 0; k<0x100; k++)
gbMemoryMap[0xe][k] = gbTAMA5ram[k];*/ gbMemoryMap[0xe][k] = gbTAMA5ram[k];*/
@ -1661,8 +1645,6 @@ void memoryUpdateMapMMM01()
// GameGenie ROM write registers // GameGenie ROM write registers
void mapperGGROM(u16 address, u8 value) void mapperGGROM(u16 address, u8 value)
{ {
int tmpAddress = 0;
switch(address & 0x6000) { switch(address & 0x6000) {
case 0x0000: // RAM enable register case 0x0000: // RAM enable register
break; break;

View File

@ -1,21 +1,5 @@
// -*- C++ -*- #ifndef GBMEMORY_H
// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. #define GBMEMORY_H
// Copyright (C) 1999-2003 Forgotten
// Copyright (C) 2004-2006 Forgotten and the VBA 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 <time.h> #include <time.h>
@ -201,6 +185,4 @@ extern void memoryUpdateMapTAMA5();
extern void memoryUpdateMapMMM01(); extern void memoryUpdateMapMMM01();
extern void memoryUpdateMapGS3(); extern void memoryUpdateMapGS3();
#endif // GBMEMORY_H

View File

@ -1,24 +1,6 @@
// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator.
// Copyright (C) 1999-2003 Forgotten
// Copyright (C) 2004 Forgotten and the VBA 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 <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
#include "../gba/GBA.h" #include "../System.h"
u8 gbPrinterStatus = 0; u8 gbPrinterStatus = 0;
int gbPrinterState = 0; int gbPrinterState = 0;

View File

@ -1,20 +1,8 @@
// -*- C++ -*- #ifndef GBPRINTER_H
// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. #define GBPRINTER_H
// Copyright (C) 1999-2003 Forgotten
// Copyright (C) 2004 Forgotten and the VBA development team
// This program is free software; you can redistribute it and/or modify #include "../System.h"
// 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.
extern u8 gbPrinterSend(u8 b); u8 gbPrinterSend(u8 b);
#endif // GBPRINTER_H

View File

@ -1,21 +1,3 @@
// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator.
// Copyright (C) 1999-2003 Forgotten
// Copyright (C) 2005-2006 Forgotten and the VBA 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 <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>

View File

@ -1,21 +1,5 @@
// -*- C++ -*- #ifndef GBSGB_H
// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. #define GBSGB_H
// Copyright (C) 1999-2003 Forgotten
// Copyright (C) 2004 Forgotten and the VBA 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.
void gbSgbInit(); void gbSgbInit();
void gbSgbShutdown(); void gbSgbShutdown();
@ -36,4 +20,4 @@ extern int gbSgbPacketTimeout;
extern u8 gbSgbReadingController; extern u8 gbSgbReadingController;
extern int gbSgbFourPlayers; extern int gbSgbFourPlayers;
#endif // GBSGB_H

View File

@ -1,21 +1,3 @@
// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator.
// Copyright (C) 1999-2003 Forgotten
// Copyright (C) 2004 Forgotten and the VBA 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 <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>

View File

@ -1,26 +1,7 @@
// -*- C++ -*- #ifndef CHEATSEARCH_H
// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. #define CHEATSEARCH_H
// Copyright (C) 1999-2003 Forgotten
// Copyright (C) 2004 Forgotten and the VBA development team
// This program is free software; you can redistribute it and/or modify #include "../System.h"
// 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.
#ifndef VBA_CHEATSEARCH_H
#define VBA_CHEATSEARCH_H
#include "System.h"
struct CheatSearchBlock { struct CheatSearchBlock {
int size; int size;
@ -60,14 +41,14 @@ enum {
(bits)[(off) >> 3] & (1 << ((off) & 7)) (bits)[(off) >> 3] & (1 << ((off) & 7))
extern CheatSearchData cheatSearchData; extern CheatSearchData cheatSearchData;
extern void cheatSearchCleanup(CheatSearchData *cs);
extern void cheatSearchStart(const CheatSearchData *cs); void cheatSearchCleanup(CheatSearchData *cs);
extern void cheatSearch(const CheatSearchData *cs, int compare, int size, void cheatSearchStart(const CheatSearchData *cs);
bool isSigned); void cheatSearch(const CheatSearchData *cs, int compare, int size, bool isSigned);
extern void cheatSearchValue(const CheatSearchData *cs, int compare, int size, void cheatSearchValue(const CheatSearchData *cs, int compare, int size, bool isSigned, u32 value);
bool isSigned, u32 value); int cheatSearchGetCount(const CheatSearchData *cs, int size);
extern int cheatSearchGetCount(const CheatSearchData *cs, int size); void cheatSearchUpdateValues(const CheatSearchData *cs);
extern void cheatSearchUpdateValues(const CheatSearchData *cs); s32 cheatSearchSignedRead(u8 *data, int off, int size);
extern s32 cheatSearchSignedRead(u8 *data, int off, int size); u32 cheatSearchRead(u8 *data, int off, int size);
extern u32 cheatSearchRead(u8 *data, int off, int size);
#endif #endif // CHEATSEARCH_H

View File

@ -1,21 +1,3 @@
// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator.
// Copyright (C) 1999-2003 Forgotten
// Copyright (C) 2005-2006 Forgotten and the VBA 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 <string.h> #include <string.h>
#include <stdio.h> #include <stdio.h>
#include <ctype.h> #include <ctype.h>
@ -2684,6 +2666,25 @@ void cheatsReadGame(gzFile file, int version)
} }
} }
// skip the cheat list data
void cheatsReadGameSkip( gzFile file, int version )
{
int nCheats = 0;
nCheats = utilReadInt( file );
if( version >= 9 ) {
utilGzSeek( file, sizeof( cheatsList ), SEEK_CUR );
}
for( int i = 0; i < nCheats; i++ ) {
if( version < 9 ) {
utilGzSeek( file, ( 7 * sizeof(int) ) + ( 52 * sizeof(char) ), SEEK_CUR );
}
}
}
void cheatsSaveCheatList(const char *file) void cheatsSaveCheatList(const char *file)
{ {
if(cheatsNumber == 0) if(cheatsNumber == 0)

View File

@ -1,24 +1,5 @@
// -*- C++ -*- #ifndef CHEATS_H
// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. #define CHEATS_H
// Copyright (C) 1999-2003 Forgotten
// Copyright (C) 2004-2006 Forgotten and the VBA 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.
#ifndef GBA_CHEATS_H
#define GBA_CHEATS_H
struct CheatsData { struct CheatsData {
int code; int code;
@ -33,23 +14,26 @@ struct CheatsData {
char desc[32]; char desc[32];
}; };
extern void cheatsAdd(const char *,const char *,u32, u32,u32,int,int); void cheatsAdd(const char *codeStr, const char *desc, u32 rawaddress, u32 address, u32 value, int code, int size);
extern void cheatsAddCheatCode(const char *code, const char *desc); void cheatsAddCheatCode(const char *code, const char *desc);
extern void cheatsAddGSACode(const char *code, const char *desc, bool v3); void cheatsAddGSACode(const char *code, const char *desc, bool v3);
extern void cheatsAddCBACode(const char *code, const char *desc); void cheatsAddCBACode(const char *code, const char *desc);
extern bool cheatsImportGSACodeFile(const char *name, int game, bool v3); bool cheatsImportGSACodeFile(const char *name, int game, bool v3);
extern void cheatsDelete(int number, bool restore); void cheatsDelete(int number, bool restore);
extern void cheatsDeleteAll(bool restore); void cheatsDeleteAll(bool restore);
extern void cheatsEnable(int number); void cheatsEnable(int number);
extern void cheatsDisable(int number); void cheatsDisable(int number);
extern void cheatsSaveGame(gzFile file); void cheatsSaveGame(gzFile file);
extern void cheatsReadGame(gzFile file, int version); void cheatsReadGame(gzFile file, int version);
extern void cheatsSaveCheatList(const char *file); void cheatsReadGameSkip(gzFile file, int version);
extern bool cheatsLoadCheatList(const char *file); void cheatsSaveCheatList(const char *file);
extern void cheatsWriteMemory(u32, u32); bool cheatsLoadCheatList(const char *file);
extern void cheatsWriteHalfWord(u32, u16); void cheatsWriteMemory(u32 address, u32 value);
extern void cheatsWriteByte(u32, u8); void cheatsWriteHalfWord(u32 address, u16 value);
extern int cheatsCheckKeys(u32,u32); void cheatsWriteByte(u32 address, u8 value);
int cheatsCheckKeys(u32 keys, u32 extended);
extern int cheatsNumber; extern int cheatsNumber;
extern CheatsData cheatsList[100]; extern CheatsData cheatsList[100];
#endif // GBA_CHEATS_H
#endif // CHEATS_H

View File

@ -1,21 +1,3 @@
// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator.
// Copyright (C) 1999-2003 Forgotten
// Copyright (C) 2005 Forgotten and the VBA 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 <string.h> #include <string.h>
#include "GBA.h" #include "GBA.h"
#include "EEprom.h" #include "EEprom.h"
@ -203,4 +185,3 @@ void eepromWrite(u32 /* address */, u8 value)
break; break;
} }
} }

View File

@ -1,24 +1,5 @@
// -*- C++ -*- #ifndef EEPROM_H
// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. #define EEPROM_H
// Copyright (C) 1999-2003 Forgotten
// Copyright (C) 2005 Forgotten and the VBA 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.
#ifndef VBA_EEPROM_H
#define VBA_EEPROM_H
extern void eepromSaveGame(gzFile _gzFile); extern void eepromSaveGame(gzFile _gzFile);
extern void eepromReadGame(gzFile _gzFile, int version); extern void eepromReadGame(gzFile _gzFile, int version);
@ -37,4 +18,4 @@ extern int eepromSize;
#define EEPROM_READDATA2 3 #define EEPROM_READDATA2 3
#define EEPROM_WRITEDATA 4 #define EEPROM_WRITEDATA 4
#endif // VBA_EEPROM_H #endif // EEPROM_H

View File

@ -1,21 +1,3 @@
// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator.
// Copyright (C) 1999-2003 Forgotten
// Copyright (C) 2004-2006 Forgotten and the VBA 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 <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
#include "GBA.h" #include "GBA.h"

View File

@ -1,24 +1,5 @@
// -*- C++ -*- #ifndef FLASH_H
// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. #define FLASH_H
// Copyright (C) 1999-2003 Forgotten
// Copyright (C) 2004 Forgotten and the VBA 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.
#ifndef VBA_FLASH_H
#define VBA_FLASH_H
extern void flashSaveGame(gzFile _gzFile); extern void flashSaveGame(gzFile _gzFile);
extern void flashReadGame(gzFile _gzFile, int version); extern void flashReadGame(gzFile _gzFile, int version);
@ -33,4 +14,5 @@ extern void flashSetSize(int size);
extern void flashInit(); extern void flashInit();
extern int flashSize; extern int flashSize;
#endif // VBA_FLASH_H
#endif // FLASH_H

View File

@ -1,22 +1,3 @@
// -*- C++ -*-
// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator.
// Copyright (C) 1999-2003 Forgotten
// Copyright (C) 2005-2006 Forgotten and the VBA 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 <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <stdarg.h> #include <stdarg.h>
@ -35,7 +16,6 @@
#include "../NLS.h" #include "../NLS.h"
#include "elf.h" #include "elf.h"
#include "../Util.h" #include "../Util.h"
#include "../common/Port.h"
#include "../System.h" #include "../System.h"
#include "agbprint.h" #include "agbprint.h"
#ifdef PROFILING #ifdef PROFILING
@ -2851,6 +2831,7 @@ static insnfunc_t armInsnTable[4096] = {
// Wrapper routine (execution loop) /////////////////////////////////////// // Wrapper routine (execution loop) ///////////////////////////////////////
#if 0
#include<time.h> #include<time.h>
static void tester(void) { static void tester(void) {
static int ran=0;if(ran)return;ran=1; static int ran=0;if(ran)return;ran=1;
@ -2862,6 +2843,7 @@ static void tester(void) {
fprintf(f,"arm%03X %6ld\n",op,e-s);fflush(f); fprintf(f,"arm%03X %6ld\n",op,e-s);fflush(f);
}fclose(f); }fclose(f);
} }
#endif
int armExecute() int armExecute()
{ {

View File

@ -1,26 +1,5 @@
// -*- C++ -*-
// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator.
// Copyright (C) 1999-2003 Forgotten
// Copyright (C) 2004 Forgotten and the VBA 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 <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
//#include <memory.h>
#include <stdarg.h> #include <stdarg.h>
#include <string.h> #include <string.h>
@ -37,7 +16,6 @@
#include "../NLS.h" #include "../NLS.h"
#include "elf.h" #include "elf.h"
#include "../Util.h" #include "../Util.h"
#include "../common/Port.h"
#include "../System.h" #include "../System.h"
#include "agbprint.h" #include "agbprint.h"
#ifdef PROFILING #ifdef PROFILING
@ -48,6 +26,7 @@
#define snprintf _snprintf #define snprintf _snprintf
#endif #endif
///////////////////////////////////////////////////////////////////////////
static int clockTicks; static int clockTicks;
@ -96,8 +75,7 @@ static INSN_REGPARM void thumbBreakpoint(u32 opcode)
#define NEG(i) ((i) >> 31) #define NEG(i) ((i) >> 31)
#define POS(i) ((~(i)) >> 31) #define POS(i) ((~(i)) >> 31)
#if 1 // Wii port override #ifndef C_CORE
//#ifndef C_CORE
#ifdef __GNUC__ #ifdef __GNUC__
#ifdef __POWERPC__ #ifdef __POWERPC__
#define ADD_RD_RS_RN(N) \ #define ADD_RD_RS_RN(N) \
@ -176,7 +154,7 @@ static INSN_REGPARM void thumbBreakpoint(u32 opcode)
{\ {\
register int Flags; \ register int Flags; \
register int Result; \ register int Result; \
asm volatile("mtspr 1, %4\n" \ asm volatile("mtspr 1, %4\n" \ /* reg 1 is xer */
"addeo. %0, %2, %3\n" \ "addeo. %0, %2, %3\n" \
"mcrxr cr1\n" \ "mcrxr cr1\n" \
"mfcr %1\n" \ "mfcr %1\n" \
@ -268,7 +246,7 @@ static INSN_REGPARM void thumbBreakpoint(u32 opcode)
{\ {\
register int Flags; \ register int Flags; \
register int Result; \ register int Result; \
asm volatile("mtspr 1, %4\n" \ asm volatile("mtspr 1, %4\n" \ /* reg 1 is xer */
"subfeo. %0, %3, %2\n" \ "subfeo. %0, %3, %2\n" \
"mcrxr cr1\n" \ "mcrxr cr1\n" \
"mfcr %1\n" \ "mfcr %1\n" \

View File

@ -1,24 +1,5 @@
// -*- C++ -*- #ifndef GBA_H
// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. #define GBA_H
// Copyright (C) 1999-2003 Forgotten
// Copyright (C) 2005 Forgotten and the VBA 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.
#ifndef VBA_GBA_H
#define VBA_GBA_H
#include "../System.h" #include "../System.h"
@ -157,4 +138,4 @@ extern struct EmulatedSystem GBASystem;
#include "EEprom.h" #include "EEprom.h"
#include "Flash.h" #include "Flash.h"
#endif //VBA_GBA_H #endif // GBA_H

View File

@ -1,21 +1,3 @@
// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator.
// Copyright (C) 1999-2003 Forgotten
// Copyright (C) 2004 Forgotten and the VBA 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 "../System.h" #include "../System.h"
int coeff[32] = { int coeff[32] = {

View File

@ -1,25 +1,5 @@
// -*- C++ -*- #ifndef GFX_H
// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. #define GFX_H
// Copyright (C) 1999-2003 Forgotten
// Copyright (C) 2005 Forgotten and the VBA development team
// 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.
#ifndef VBA_GFX_H
#define VBA_GFX_H
#include "GBA.h" #include "GBA.h"
#include "Globals.h" #include "Globals.h"
@ -1598,4 +1578,4 @@ static inline void gfxAlphaBlend(u32 *ta, u32 *tb, int ca, int cb)
} }
} }
#endif // VBA_GFX_H #endif // GFX_H

View File

@ -1,24 +1,5 @@
// -*- C++ -*- #ifndef GBACPU_H
// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. #define GBACPU_H
// Copyright (C) 1999-2003 Forgotten
// Copyright (C) 2005 Forgotten and the VBA 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.
#ifndef VBA_GBAcpu_H
#define VBA_GBAcpu_H
extern int armExecute(); extern int armExecute();
extern int thumbExecute(); extern int thumbExecute();
@ -299,4 +280,4 @@ inline void cpuMasterCodeCheck()
} }
} }
#endif //VBA_GBAcpu_H #endif // GBACPU_H

View File

@ -1,24 +1,5 @@
// -*- C++ -*- #ifndef GBAINLINE_H
// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. #define GBAINLINE_H
// Copyright (C) 1999-2003 Forgotten
// Copyright (C) 2005 Forgotten and the VBA 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.
#ifndef VBA_GBAinline_H
#define VBA_GBAinline_H
#include "../System.h" #include "../System.h"
#include "../common/Port.h" #include "../common/Port.h"
@ -717,13 +698,6 @@ static inline void CPUWriteByte(u32 address, u8 b)
case 4: case 4:
if(address < 0x4000400) { if(address < 0x4000400) {
switch(address & 0x3FF) { switch(address & 0x3FF) {
case 0x301:
if(b == 0x80)
stopState = true;
holdState = 1;
holdType = -1;
cpuNextEvent = cpuTotalTicks;
break;
case 0x60: case 0x60:
case 0x61: case 0x61:
case 0x62: case 0x62:
@ -766,15 +740,20 @@ static inline void CPUWriteByte(u32 address, u8 b)
case 0x9f: case 0x9f:
soundEvent(address&0xFF, b); soundEvent(address&0xFF, b);
break; break;
default: case 0x301: // HALTCNT, undocumented
if(address & 1) if(b == 0x80)
CPUUpdateRegister(address & 0x3fe, stopState = true;
((READ16LE(((u16 *)&ioMem[address & 0x3fe]))) holdState = 1;
& 0x00FF) | holdType = -1;
b<<8); cpuNextEvent = cpuTotalTicks;
else break;
CPUUpdateRegister(address & 0x3fe, default: // every other register
((READ16LE(((u16 *)&ioMem[address & 0x3fe])) & 0xFF00) | b)); u32 lowerBits = address & 0x3fe;
if(address & 1) {
CPUUpdateRegister(lowerBits, (READ16LE(&ioMem[lowerBits]) & 0x00FF) | (b << 8));
} else {
CPUUpdateRegister(lowerBits, (READ16LE(&ioMem[lowerBits]) & 0xFF00) | b);
}
} }
break; break;
} else goto unwritable; } else goto unwritable;
@ -836,4 +815,4 @@ static inline void CPUWriteByte(u32 address, u8 b)
} }
} }
#endif //VBA_GBAinline_H #endif // GBAINLINE_H

View File

@ -1,21 +1,3 @@
// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator.
// Copyright (C) 1999-2003 Forgotten
// Copyright (C) 2005 Forgotten and the VBA 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 "GBA.h" #include "GBA.h"
#ifdef BKPT_SUPPORT #ifdef BKPT_SUPPORT
@ -51,6 +33,12 @@ int cpuSaveType = 0;
bool cheatsEnabled = true; bool cheatsEnabled = true;
bool mirroringEnable = false; bool mirroringEnable = false;
bool skipSaveGameBattery = false; bool skipSaveGameBattery = false;
bool skipSaveGameCheats = false;
// this is an optional hack to change the backdrop/background color:
// -1: disabled
// 0x0000 to 0x7FFF: set custom 15 bit color
int customBackdropColor = -1;
u8 *bios = NULL; u8 *bios = NULL;
u8 *rom = NULL; u8 *rom = NULL;

View File

@ -1,25 +1,7 @@
// -*- C++ -*- #ifndef GLOBALS_H
// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. #define GLOBALS_H
// Copyright (C) 1999-2003 Forgotten
// Copyright (C) 2005 Forgotten and the VBA 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.
#ifndef VBA_GLOBALS_H
#define VBA_GLOBALS_H
#include "../common/Types.h"
#include "GBA.h" #include "GBA.h"
#define VERBOSE_SWI 1 #define VERBOSE_SWI 1
@ -60,7 +42,9 @@ extern bool speedHack;
extern int cpuSaveType; extern int cpuSaveType;
extern bool cheatsEnabled; extern bool cheatsEnabled;
extern bool mirroringEnable; extern bool mirroringEnable;
extern bool skipSaveGameBattery; extern bool skipSaveGameBattery; // skip battery data when reading save states
extern bool skipSaveGameCheats; // skip cheat list data when reading save states
extern int customBackdropColor;
extern u8 *bios; extern u8 *bios;
extern u8 *rom; extern u8 *rom;
@ -150,4 +134,4 @@ extern u16 IE;
extern u16 IF; extern u16 IF;
extern u16 IME; extern u16 IME;
#endif // VBA_GLOBALS_H #endif // GLOBALS_H

View File

@ -1,21 +1,3 @@
// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator.
// Copyright (C) 1999-2003 Forgotten
// Copyright (C) 2004 Forgotten and the VBA 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 "GBA.h" #include "GBA.h"
#include "Globals.h" #include "Globals.h"
#include "GBAGfx.h" #include "GBAGfx.h"
@ -49,7 +31,12 @@ void mode0RenderLine()
gfxDrawSprites(lineOBJ); gfxDrawSprites(lineOBJ);
u32 backdrop = (READ16LE(&palette[0]) | 0x30000000); u32 backdrop;
if(customBackdropColor == -1) {
backdrop = (READ16LE(&palette[0]) | 0x30000000);
} else {
backdrop = ((customBackdropColor & 0x7FFF) | 0x30000000);
}
for(int x = 0; x < 240; x++) { for(int x = 0; x < 240; x++) {
u32 color = backdrop; u32 color = backdrop;
@ -156,7 +143,12 @@ void mode0RenderLineNoWindow()
gfxDrawSprites(lineOBJ); gfxDrawSprites(lineOBJ);
u32 backdrop = (READ16LE(&palette[0]) | 0x30000000); u32 backdrop;
if(customBackdropColor == -1) {
backdrop = (READ16LE(&palette[0]) | 0x30000000);
} else {
backdrop = ((customBackdropColor & 0x7FFF) | 0x30000000);
}
int effect = (BLDMOD >> 6) & 3; int effect = (BLDMOD >> 6) & 3;
@ -349,7 +341,12 @@ void mode0RenderLineAll()
gfxDrawSprites(lineOBJ); gfxDrawSprites(lineOBJ);
gfxDrawOBJWin(lineOBJWin); gfxDrawOBJWin(lineOBJWin);
u32 backdrop = (READ16LE(&palette[0]) | 0x30000000); u32 backdrop;
if(customBackdropColor == -1) {
backdrop = (READ16LE(&palette[0]) | 0x30000000);
} else {
backdrop = ((customBackdropColor & 0x7FFF) | 0x30000000);
}
u8 inWin0Mask = WININ & 0xFF; u8 inWin0Mask = WININ & 0xFF;
u8 inWin1Mask = WININ >> 8; u8 inWin1Mask = WININ >> 8;

View File

@ -1,21 +1,3 @@
// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator.
// Copyright (C) 1999-2003 Forgotten
// Copyright (C) 2004 Forgotten and the VBA 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 "GBA.h" #include "GBA.h"
#include "Globals.h" #include "Globals.h"
#include "GBAGfx.h" #include "GBAGfx.h"
@ -51,7 +33,12 @@ void mode1RenderLine()
gfxDrawSprites(lineOBJ); gfxDrawSprites(lineOBJ);
u32 backdrop = (READ16LE(&palette[0]) | 0x30000000); u32 backdrop;
if(customBackdropColor == -1) {
backdrop = (READ16LE(&palette[0]) | 0x30000000);
} else {
backdrop = ((customBackdropColor & 0x7FFF) | 0x30000000);
}
for(int x = 0; x < 240; x++) { for(int x = 0; x < 240; x++) {
u32 color = backdrop; u32 color = backdrop;
@ -153,7 +140,12 @@ void mode1RenderLineNoWindow()
gfxDrawSprites(lineOBJ); gfxDrawSprites(lineOBJ);
u32 backdrop = (READ16LE(&palette[0]) | 0x30000000); u32 backdrop;
if(customBackdropColor == -1) {
backdrop = (READ16LE(&palette[0]) | 0x30000000);
} else {
backdrop = ((customBackdropColor & 0x7FFF) | 0x30000000);
}
for(int x = 0; x < 240; x++) { for(int x = 0; x < 240; x++) {
u32 color = backdrop; u32 color = backdrop;
@ -330,7 +322,12 @@ void mode1RenderLineAll()
gfxDrawSprites(lineOBJ); gfxDrawSprites(lineOBJ);
gfxDrawOBJWin(lineOBJWin); gfxDrawOBJWin(lineOBJWin);
u32 backdrop = (READ16LE(&palette[0]) | 0x30000000); u32 backdrop;
if(customBackdropColor == -1) {
backdrop = (READ16LE(&palette[0]) | 0x30000000);
} else {
backdrop = ((customBackdropColor & 0x7FFF) | 0x30000000);
}
u8 inWin0Mask = WININ & 0xFF; u8 inWin0Mask = WININ & 0xFF;
u8 inWin1Mask = WININ >> 8; u8 inWin1Mask = WININ >> 8;

View File

@ -1,21 +1,3 @@
// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator.
// Copyright (C) 1999-2003 Forgotten
// Copyright (C) 2004 Forgotten and the VBA 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 "GBA.h" #include "GBA.h"
#include "Globals.h" #include "Globals.h"
#include "GBAGfx.h" #include "GBAGfx.h"
@ -54,7 +36,12 @@ void mode2RenderLine()
gfxDrawSprites(lineOBJ); gfxDrawSprites(lineOBJ);
u32 backdrop = (READ16LE(&palette[0]) | 0x30000000); u32 backdrop;
if(customBackdropColor == -1) {
backdrop = (READ16LE(&palette[0]) | 0x30000000);
} else {
backdrop = ((customBackdropColor & 0x7FFF) | 0x30000000);
}
for(int x = 0; x < 240; x++) { for(int x = 0; x < 240; x++) {
u32 color = backdrop; u32 color = backdrop;
@ -150,7 +137,12 @@ void mode2RenderLineNoWindow()
gfxDrawSprites(lineOBJ); gfxDrawSprites(lineOBJ);
u32 backdrop = (READ16LE(&palette[0]) | 0x30000000); u32 backdrop;
if(customBackdropColor == -1) {
backdrop = (READ16LE(&palette[0]) | 0x30000000);
} else {
backdrop = ((customBackdropColor & 0x7FFF) | 0x30000000);
}
for(int x = 0; x < 240; x++) { for(int x = 0; x < 240; x++) {
u32 color = backdrop; u32 color = backdrop;
@ -316,7 +308,12 @@ void mode2RenderLineAll()
gfxDrawSprites(lineOBJ); gfxDrawSprites(lineOBJ);
gfxDrawOBJWin(lineOBJWin); gfxDrawOBJWin(lineOBJWin);
u32 backdrop = (READ16LE(&palette[0]) | 0x30000000); u32 backdrop;
if(customBackdropColor == -1) {
backdrop = (READ16LE(&palette[0]) | 0x30000000);
} else {
backdrop = ((customBackdropColor & 0x7FFF) | 0x30000000);
}
u8 inWin0Mask = WININ & 0xFF; u8 inWin0Mask = WININ & 0xFF;
u8 inWin1Mask = WININ >> 8; u8 inWin1Mask = WININ >> 8;

View File

@ -1,21 +1,3 @@
// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator.
// Copyright (C) 1999-2003 Forgotten
// Copyright (C) 2004 Forgotten and the VBA 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 "GBA.h" #include "GBA.h"
#include "Globals.h" #include "Globals.h"
#include "GBAGfx.h" #include "GBAGfx.h"
@ -47,7 +29,12 @@ void mode3RenderLine()
gfxDrawSprites(lineOBJ); gfxDrawSprites(lineOBJ);
u32 background = (READ16LE(&palette[0]) | 0x30000000); u32 background;
if(customBackdropColor == -1) {
background = (READ16LE(&palette[0]) | 0x30000000);
} else {
background = ((customBackdropColor & 0x7FFF) | 0x30000000);
}
for(int x = 0; x < 240; x++) { for(int x = 0; x < 240; x++) {
u32 color = background; u32 color = background;
@ -124,7 +111,12 @@ void mode3RenderLineNoWindow()
gfxDrawSprites(lineOBJ); gfxDrawSprites(lineOBJ);
u32 background = (READ16LE(&palette[0]) | 0x30000000); u32 background;
if(customBackdropColor == -1) {
background = (READ16LE(&palette[0]) | 0x30000000);
} else {
background = ((customBackdropColor & 0x7FFF) | 0x30000000);
}
for(int x = 0; x < 240; x++) { for(int x = 0; x < 240; x++) {
u32 color = background; u32 color = background;
@ -269,7 +261,12 @@ void mode3RenderLineAll()
u8 inWin1Mask = WININ >> 8; u8 inWin1Mask = WININ >> 8;
u8 outMask = WINOUT & 0xFF; u8 outMask = WINOUT & 0xFF;
u32 background = (READ16LE(&palette[0]) | 0x30000000); u32 background;
if(customBackdropColor == -1) {
background = (READ16LE(&palette[0]) | 0x30000000);
} else {
background = ((customBackdropColor & 0x7FFF) | 0x30000000);
}
for(int x = 0; x < 240; x++) { for(int x = 0; x < 240; x++) {
u32 color = background; u32 color = background;

View File

@ -1,21 +1,3 @@
// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator.
// Copyright (C) 1999-2003 Forgotten
// Copyright (C) 2004 Forgotten and the VBA 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 "GBA.h" #include "GBA.h"
#include "GBAGfx.h" #include "GBAGfx.h"
#include "Globals.h" #include "Globals.h"
@ -46,7 +28,12 @@ void mode4RenderLine()
gfxDrawSprites(lineOBJ); gfxDrawSprites(lineOBJ);
u32 backdrop = (READ16LE(&palette[0]) | 0x30000000); u32 backdrop;
if(customBackdropColor == -1) {
backdrop = (READ16LE(&palette[0]) | 0x30000000);
} else {
backdrop = ((customBackdropColor & 0x7FFF) | 0x30000000);
}
for(int x = 0; x < 240; x++) { for(int x = 0; x < 240; x++) {
u32 color = backdrop; u32 color = backdrop;
@ -122,7 +109,12 @@ void mode4RenderLineNoWindow()
gfxDrawSprites(lineOBJ); gfxDrawSprites(lineOBJ);
u32 backdrop = (READ16LE(&palette[0]) | 0x30000000); u32 backdrop;
if(customBackdropColor == -1) {
backdrop = (READ16LE(&palette[0]) | 0x30000000);
} else {
backdrop = ((customBackdropColor & 0x7FFF) | 0x30000000);
}
for(int x = 0; x < 240; x++) { for(int x = 0; x < 240; x++) {
u32 color = backdrop; u32 color = backdrop;
@ -262,7 +254,12 @@ void mode4RenderLineAll()
gfxDrawSprites(lineOBJ); gfxDrawSprites(lineOBJ);
gfxDrawOBJWin(lineOBJWin); gfxDrawOBJWin(lineOBJWin);
u32 backdrop = (READ16LE(&palette[0]) | 0x30000000); u32 backdrop;
if(customBackdropColor == -1) {
backdrop = (READ16LE(&palette[0]) | 0x30000000);
} else {
backdrop = ((customBackdropColor & 0x7FFF) | 0x30000000);
}
u8 inWin0Mask = WININ & 0xFF; u8 inWin0Mask = WININ & 0xFF;
u8 inWin1Mask = WININ >> 8; u8 inWin1Mask = WININ >> 8;

View File

@ -1,21 +1,3 @@
// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator.
// Copyright (C) 1999-2003 Forgotten
// Copyright (C) 2004 Forgotten and the VBA 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 "GBA.h" #include "GBA.h"
#include "Globals.h" #include "Globals.h"
#include "GBAGfx.h" #include "GBAGfx.h"
@ -47,7 +29,12 @@ void mode5RenderLine()
gfxDrawSprites(lineOBJ); gfxDrawSprites(lineOBJ);
u32 background = (READ16LE(&palette[0]) | 0x30000000); u32 background;
if(customBackdropColor == -1) {
background = (READ16LE(&palette[0]) | 0x30000000);
} else {
background = ((customBackdropColor & 0x7FFF) | 0x30000000);
}
for(int x = 0; x < 240; x++) { for(int x = 0; x < 240; x++) {
u32 color = background; u32 color = background;
@ -124,7 +111,12 @@ void mode5RenderLineNoWindow()
gfxDrawSprites(lineOBJ); gfxDrawSprites(lineOBJ);
u32 background = ( READ16LE(&palette[0]) | 0x30000000); u32 background;
if(customBackdropColor == -1) {
background = (READ16LE(&palette[0]) | 0x30000000);
} else {
background = ((customBackdropColor & 0x7FFF) | 0x30000000);
}
for(int x = 0; x < 240; x++) { for(int x = 0; x < 240; x++) {
u32 color = background; u32 color = background;
@ -269,7 +261,12 @@ void mode5RenderLineAll()
u8 inWin1Mask = WININ >> 8; u8 inWin1Mask = WININ >> 8;
u8 outMask = WINOUT & 0xFF; u8 outMask = WINOUT & 0xFF;
u32 background = (READ16LE(&palette[0]) | 0x30000000); u32 background;
if(customBackdropColor == -1) {
background = (READ16LE(&palette[0]) | 0x30000000);
} else {
background = ((customBackdropColor & 0x7FFF) | 0x30000000);
}
for(int x = 0; x < 240; x++) { for(int x = 0; x < 240; x++) {
u32 color = background; u32 color = background;

View File

@ -1,21 +1,3 @@
// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator.
// Copyright (C) 1999-2003 Forgotten
// Copyright (C) 2005 Forgotten and the VBA 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 "../System.h" #include "../System.h"
#include "GBA.h" #include "GBA.h"
#include "Globals.h" #include "Globals.h"

View File

@ -1,31 +1,13 @@
// -*- C++ -*- #ifndef RTC_H
// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. #define RTC_H
// Copyright (C) 1999-2003 Forgotten
// Copyright (C) 2004 Forgotten and the VBA development team
// This program is free software; you can redistribute it and/or modify u16 rtcRead(u32 address);
// it under the terms of the GNU General Public License as published by bool rtcWrite(u32 address, u16 value);
// the Free Software Foundation; either version 2, or(at your option) void rtcEnable(bool);
// any later version. bool rtcIsEnabled();
// void rtcReset();
// 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.
#ifndef VBA_RTC_H void rtcReadGame(gzFile gzFile);
#define VBA_RTC_H void rtcSaveGame(gzFile gzFile);
extern u16 rtcRead(u32 address);
extern bool rtcWrite(u32 address, u16 value);
extern void rtcEnable(bool);
extern bool rtcIsEnabled();
extern void rtcReset();
extern void rtcReadGame(gzFile gzFile); #endif // RTC_H
extern void rtcSaveGame(gzFile gzFile);
#endif

View File

@ -1,21 +1,3 @@
// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator.
// Copyright (C) 1999-2003 Forgotten
// Copyright (C) 2004 Forgotten and the VBA 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 "GBA.h" #include "GBA.h"
#include "Globals.h" #include "Globals.h"
#include "Flash.h" #include "Flash.h"

View File

@ -1,27 +1,8 @@
// -*- C++ -*- #ifndef SRAM_H
// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. #define SRAM_H
// Copyright (C) 1999-2003 Forgotten
// Copyright (C) 2004 Forgotten and the VBA development team
// This program is free software; you can redistribute it and/or modify u8 sramRead(u32 address);
// it under the terms of the GNU General Public License as published by void sramWrite(u32 address, u8 byte);
// the Free Software Foundation; either version 2, or(at your option) void sramDelayedWrite(u32 address, u8 byte);
// 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.
#ifndef VBA_SRAM_H #endif // SRAM_H
#define VBA_SRAM_H
extern u8 sramRead(u32 address);
extern void sramWrite(u32 address, u8 byte);
extern void sramDelayedWrite(u32 address, u8 byte);
#endif // VBA_SRAM_H

View File

@ -1,21 +1,3 @@
// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator.
// Copyright (C) 1999-2003 Forgotten
// Copyright (C) 2004 Forgotten and the VBA 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 <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>

View File

@ -1,27 +1,10 @@
// -*- C++ -*- #ifndef AGBPRINT_H
// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. #define AGBPRINT_H
// Copyright (C) 1999-2003 Forgotten
// Copyright (C) 2004 Forgotten and the VBA development team
// This program is free software; you can redistribute it and/or modify void agbPrintEnable(bool enable);
// it under the terms of the GNU General Public License as published by bool agbPrintIsEnabled();
// the Free Software Foundation; either version 2, or(at your option) void agbPrintReset();
// any later version. bool agbPrintWrite(u32 address, u16 value);
// void agbPrintFlush();
// 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.
#ifndef VBA_AGBPRINT_H #endif // AGBPRINT_H
#define VBA_AGBPRINT_H
extern void agbPrintEnable(bool);
extern bool agbPrintIsEnabled();
extern void agbPrintReset();
extern bool agbPrintWrite(u32, u16);
extern void agbPrintFlush();
#endif

View File

@ -1,21 +1,3 @@
// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator.
// Copyright (C) 1999-2003 Forgotten
// Copyright (C) 2005 Forgotten and the VBA 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.
/************************************************************************/ /************************************************************************/
/* Arm/Thumb command set disassembler */ /* Arm/Thumb command set disassembler */
/************************************************************************/ /************************************************************************/

View File

@ -1,22 +1,3 @@
// -*- C++ -*-
// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator.
// Copyright (C) 1999-2003 Forgotten
// Copyright (C) 2004 Forgotten and the VBA 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.
/************************************************************************/ /************************************************************************/
/* Arm/Thumb command set disassembler */ /* Arm/Thumb command set disassembler */
/************************************************************************/ /************************************************************************/

View File

@ -1,21 +1,3 @@
// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator.
// Copyright (C) 1999-2003 Forgotten
// Copyright (C) 2005-2006 Forgotten and the VBA 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 <math.h> #include <math.h>
#include <string.h> #include <string.h>
#include <stdlib.h> #include <stdlib.h>
@ -387,7 +369,7 @@ void BIOS_Diff8bitUnFilterWram()
source += 4; source += 4;
if(((source & 0xe000000) == 0) || if(((source & 0xe000000) == 0) ||
((source + ((header >> 8) & 0x1fffff) & 0xe000000) == 0)) (((source + ((header >> 8) & 0x1fffff)) & 0xe000000) == 0))
return; return;
int len = header >> 8; int len = header >> 8;

View File

@ -1,24 +1,5 @@
// -*- C++ -*- #ifndef BIOS_H
// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. #define BIOS_H
// Copyright (C) 1999-2003 Forgotten
// Copyright (C) 2004-2006 Forgotten and the VBA 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.
#ifndef VBA_BIOS_H
#define VBA_BIOS_H
extern void BIOS_ArcTan(); extern void BIOS_ArcTan();
extern void BIOS_ArcTan2(); extern void BIOS_ArcTan2();
@ -44,4 +25,5 @@ extern void BIOS_SoftReset();
extern void BIOS_Sqrt(); extern void BIOS_Sqrt();
extern void BIOS_MidiKey2Freq(); extern void BIOS_MidiKey2Freq();
extern void BIOS_SndDriverJmpTableCopy(); extern void BIOS_SndDriverJmpTableCopy();
#endif // VBA_BIOS_H
#endif // BIOS_H

View File

@ -1,21 +1,3 @@
// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator.
// Copyright (C) 1999-2003 Forgotten
// Copyright (C) 2004 Forgotten and the VBA 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 <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
@ -2800,9 +2782,16 @@ bool elfRead(const char *name, int& siz, FILE *f)
long size = ftell(f); long size = ftell(f);
elfFileData = (u8 *)malloc(size); elfFileData = (u8 *)malloc(size);
fseek(f, 0, SEEK_SET); fseek(f, 0, SEEK_SET);
fread(elfFileData, 1, size, f); int res = fread(elfFileData, 1, size, f);
fclose(f); fclose(f);
if (res < 0)
{
free(elfFileData);
elfFileData = NULL;
return false;
}
ELFHeader *header = (ELFHeader *)elfFileData; ELFHeader *header = (ELFHeader *)elfFileData;
if(READ32LE(&header->magic) != 0x464C457F || if(READ32LE(&header->magic) != 0x464C457F ||

View File

@ -1,24 +1,5 @@
// -*- C++ -*- #ifndef ELF_H
// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. #define ELF_H
// Copyright (C) 1999-2003 Forgotten
// Copyright (C) 2004 Forgotten and the VBA 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.
#ifndef VBA_ELF_H
#define VBA_ELF_H
enum LocationType { enum LocationType {
LOCATION_register, LOCATION_register,
@ -280,4 +261,5 @@ extern bool elfFindLineInModule(u32 *, const char *, int);
u32 elfDecodeLocation(Function *, ELFBlock *, LocationType *); u32 elfDecodeLocation(Function *, ELFBlock *, LocationType *);
u32 elfDecodeLocation(Function *, ELFBlock *, LocationType *, u32); u32 elfDecodeLocation(Function *, ELFBlock *, LocationType *, u32);
int elfFindLine(CompileUnit *unit, Function *func, u32 addr, const char **); int elfFindLine(CompileUnit *unit, Function *func, u32 addr, const char **);
#endif
#endif // ELF_H