Upgrade to 1.8 beta core

git-svn-id: https://svn.code.sf.net/p/vbam/code/trunk@23 a31d4220-a93d-0410-bf67-fe4944624d44
This commit is contained in:
DJRobX 2007-11-07 01:27:54 +00:00
parent 0e1ef89215
commit ee40ad3d5c
301 changed files with 100519 additions and 33545 deletions

View File

@ -51,7 +51,7 @@
<Tool <Tool
Name="VCCLCompilerTool" Name="VCCLCompilerTool"
Optimization="0" Optimization="0"
AdditionalIncludeDirectories="&quot;$(SolutionDir)zlib&quot;;&quot;$(SolutionDir)libpng&quot;" AdditionalIncludeDirectories="&quot;$(SolutionDir)src\win32\dependencies\zlib&quot;;&quot;$(SolutionDir)src\win32\dependencies\libpng&quot;;&quot;$(SolutionDir)src\win32\dependencies\cximage&quot;"
PreprocessorDefinitions="WIN32;_WINDOWS;_DEBUG;DEV_VERSION;BKPT_SUPPORT;MMX;_CRT_SECURE_NO_WARNINGS" PreprocessorDefinitions="WIN32;_WINDOWS;_DEBUG;DEV_VERSION;BKPT_SUPPORT;MMX;_CRT_SECURE_NO_WARNINGS"
StringPooling="false" StringPooling="false"
MinimalRebuild="true" MinimalRebuild="true"
@ -83,7 +83,7 @@
/> />
<Tool <Tool
Name="VCLinkerTool" Name="VCLinkerTool"
AdditionalDependencies="nafxcwd.lib LIBCMTD.lib Vfw32.Lib OpenGL32.Lib dinput8.lib dxguid.lib ddraw.lib winmm.lib d3dx9.lib Dsound.lib" AdditionalDependencies="nafxcwd.lib LIBCMTD.lib Vfw32.Lib OpenGL32.Lib dinput8.lib dxguid.lib ddraw.lib dxerr9.lib winmm.lib d3dx9.lib d3d9.lib Dsound.lib"
OutputFile="$(ProjectDir)VisualBoyAdvance.exe" OutputFile="$(ProjectDir)VisualBoyAdvance.exe"
Version="" Version=""
LinkIncremental="2" LinkIncremental="2"
@ -165,7 +165,7 @@
OmitFramePointers="true" OmitFramePointers="true"
EnableFiberSafeOptimizations="false" EnableFiberSafeOptimizations="false"
WholeProgramOptimization="true" WholeProgramOptimization="true"
AdditionalIncludeDirectories="&quot;$(SolutionDir)zlib&quot;;&quot;$(SolutionDir)libpng&quot;" AdditionalIncludeDirectories="&quot;$(SolutionDir)src\win32\dependencies\zlib&quot;;&quot;$(SolutionDir)src\win32\dependencies\libpng&quot;;&quot;$(SolutionDir)src\win32\dependencies\cximage&quot;"
PreprocessorDefinitions="WIN32;_WINDOWS;NDEBUG;FINAL_VERSION;MMX;_CRT_SECURE_NO_WARNINGS" PreprocessorDefinitions="WIN32;_WINDOWS;NDEBUG;FINAL_VERSION;MMX;_CRT_SECURE_NO_WARNINGS"
IgnoreStandardIncludePath="false" IgnoreStandardIncludePath="false"
GeneratePreprocessedFile="0" GeneratePreprocessedFile="0"
@ -216,7 +216,7 @@
Name="VCLinkerTool" Name="VCLinkerTool"
RegisterOutput="false" RegisterOutput="false"
IgnoreImportLibrary="false" IgnoreImportLibrary="false"
AdditionalDependencies="nafxcw.lib LIBCMT.lib Vfw32.Lib OpenGL32.Lib dinput8.lib winmm.lib dxguid.lib ddraw.lib d3dx9.lib Dsound.lib" AdditionalDependencies="nafxcw.lib LIBCMT.lib Vfw32.Lib OpenGL32.Lib dinput8.lib winmm.lib dxguid.lib ddraw.lib d3d9.lib d3dx9.lib Dsound.lib"
ShowProgress="0" ShowProgress="0"
OutputFile="$(ProjectDir)VisualBoyAdvance.exe" OutputFile="$(ProjectDir)VisualBoyAdvance.exe"
Version="" Version=""
@ -308,7 +308,7 @@
EnableIntrinsicFunctions="true" EnableIntrinsicFunctions="true"
FavorSizeOrSpeed="1" FavorSizeOrSpeed="1"
OmitFramePointers="true" OmitFramePointers="true"
AdditionalIncludeDirectories="&quot;$(SolutionDir)zlib&quot;;&quot;$(SolutionDir)libpng&quot;" AdditionalIncludeDirectories="&quot;$(SolutionDir)src\win32\dependencies\zlib&quot;;&quot;$(SolutionDir)src\win32\dependencies\libpng&quot;;&quot;$(SolutionDir)src\win32\dependencies\cximage&quot;"
PreprocessorDefinitions="WIN32;_WINDOWS;NDEBUG;FINAL_VERSION;MMX;_CRT_SECURE_NO_WARNINGS" PreprocessorDefinitions="WIN32;_WINDOWS;NDEBUG;FINAL_VERSION;MMX;_CRT_SECURE_NO_WARNINGS"
IgnoreStandardIncludePath="false" IgnoreStandardIncludePath="false"
GeneratePreprocessedFile="0" GeneratePreprocessedFile="0"
@ -649,14 +649,6 @@
RelativePath=".\src\hq_shared32.cpp" RelativePath=".\src\hq_shared32.cpp"
> >
</File> </File>
<File
RelativePath=".\src\lq3x.cpp"
>
</File>
<File
RelativePath=".\src\lq4x.cpp"
>
</File>
<File <File
RelativePath=".\src\portable.cpp" RelativePath=".\src\portable.cpp"
> >
@ -683,16 +675,40 @@
> >
</File> </File>
<File <File
RelativePath=".\src\getopt.cpp" RelativePath=".\src\getopt.c"
> >
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
CompileAs="1"
/>
</FileConfiguration>
</File> </File>
<File <File
RelativePath=".\src\getopt1.cpp" RelativePath=".\src\getopt1.c"
> >
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
CompileAs="1"
/>
</FileConfiguration>
</File> </File>
<File <File
RelativePath=".\src\memgzio.cpp" RelativePath=".\src\memgzio.c"
> >
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
CompileAs="1"
/>
</FileConfiguration>
</File> </File>
<File <File
RelativePath=".\src\snd_interp.cpp" RelativePath=".\src\snd_interp.cpp"
@ -890,6 +906,10 @@
RelativePath=".\src\win32\FileDlg.cpp" RelativePath=".\src\win32\FileDlg.cpp"
> >
</File> </File>
<File
RelativePath=".\src\win32\GameOverrides.cpp"
>
</File>
<File <File
RelativePath=".\src\win32\GBACheats.cpp" RelativePath=".\src\win32\GBACheats.cpp"
> >
@ -1002,6 +1022,14 @@
RelativePath=".\src\win32\RomInfo.cpp" RelativePath=".\src\win32\RomInfo.cpp"
> >
</File> </File>
<File
RelativePath=".\src\win32\skin.cpp"
>
</File>
<File
RelativePath=".\src\win32\skinButton.cpp"
>
</File>
<File <File
RelativePath=".\src\win32\StringTokenizer.cpp" RelativePath=".\src\win32\StringTokenizer.cpp"
> >
@ -1014,10 +1042,6 @@
RelativePath=".\src\win32\TileView.cpp" RelativePath=".\src\win32\TileView.cpp"
> >
</File> </File>
<File
RelativePath=".\src\win32\UniVideoModeDlg.cpp"
>
</File>
<File <File
RelativePath=".\src\win32\VideoMode.cpp" RelativePath=".\src\win32\VideoMode.cpp"
> >
@ -1106,6 +1130,10 @@
RelativePath=".\src\win32\DirectSound.cpp" RelativePath=".\src\win32\DirectSound.cpp"
> >
</File> </File>
<File
RelativePath=".\src\win32\display.cpp"
>
</File>
<File <File
RelativePath=".\src\win32\GDIDisplay.cpp" RelativePath=".\src\win32\GDIDisplay.cpp"
> >
@ -1155,6 +1183,130 @@
> >
</File> </File>
</Filter> </Filter>
<Filter
Name="Cximage"
>
<File
RelativePath=".\src\win32\dependencies\cximage\tif_xfile.cpp"
>
</File>
<File
RelativePath=".\src\win32\dependencies\cximage\ximabmp.cpp"
>
</File>
<File
RelativePath=".\src\win32\dependencies\cximage\ximadsp.cpp"
>
</File>
<File
RelativePath=".\src\win32\dependencies\cximage\ximaenc.cpp"
>
</File>
<File
RelativePath=".\src\win32\dependencies\cximage\ximaexif.cpp"
>
</File>
<File
RelativePath=".\src\win32\dependencies\cximage\ximage.cpp"
>
</File>
<File
RelativePath=".\src\win32\dependencies\cximage\ximagif.cpp"
>
</File>
<File
RelativePath=".\src\win32\dependencies\cximage\ximahist.cpp"
>
</File>
<File
RelativePath=".\src\win32\dependencies\cximage\ximaico.cpp"
>
</File>
<File
RelativePath=".\src\win32\dependencies\cximage\ximainfo.cpp"
>
</File>
<File
RelativePath=".\src\win32\dependencies\cximage\ximaint.cpp"
>
</File>
<File
RelativePath=".\src\win32\dependencies\cximage\ximaj2k.cpp"
>
</File>
<File
RelativePath=".\src\win32\dependencies\cximage\ximajas.cpp"
>
</File>
<File
RelativePath=".\src\win32\dependencies\cximage\ximajbg.cpp"
>
</File>
<File
RelativePath=".\src\win32\dependencies\cximage\ximajpg.cpp"
>
</File>
<File
RelativePath=".\src\win32\dependencies\cximage\ximalpha.cpp"
>
</File>
<File
RelativePath=".\src\win32\dependencies\cximage\ximalyr.cpp"
>
</File>
<File
RelativePath=".\src\win32\dependencies\cximage\ximamng.cpp"
>
</File>
<File
RelativePath=".\src\win32\dependencies\cximage\ximapal.cpp"
>
</File>
<File
RelativePath=".\src\win32\dependencies\cximage\ximapcx.cpp"
>
</File>
<File
RelativePath=".\src\win32\dependencies\cximage\ximapng.cpp"
>
</File>
<File
RelativePath=".\src\win32\dependencies\cximage\ximasel.cpp"
>
</File>
<File
RelativePath=".\src\win32\dependencies\cximage\ximatga.cpp"
>
</File>
<File
RelativePath=".\src\win32\dependencies\cximage\ximath.cpp"
>
</File>
<File
RelativePath=".\src\win32\dependencies\cximage\ximatif.cpp"
>
</File>
<File
RelativePath=".\src\win32\dependencies\cximage\ximatran.cpp"
>
</File>
<File
RelativePath=".\src\win32\dependencies\cximage\ximawbmp.cpp"
>
</File>
<File
RelativePath=".\src\win32\dependencies\cximage\ximawmf.cpp"
>
</File>
<File
RelativePath=".\src\win32\dependencies\cximage\ximawnd.cpp"
>
</File>
<File
RelativePath=".\src\win32\dependencies\cximage\xmemfile.cpp"
>
</File>
</Filter>
</Filter> </Filter>
<Filter <Filter
Name="Header" Name="Header"
@ -1624,15 +1776,7 @@
> >
</File> </File>
<File <File
RelativePath=".\res\resource.h" RelativePath=".\src\win32\VBA.rc"
>
</File>
<File
RelativePath=".\res\VBA.ico"
>
</File>
<File
RelativePath=".\res\VBA.rc"
> >
</File> </File>
</Filter> </Filter>

View File

@ -1,6 +1,8 @@
#include "System.h" #include "System.h"
#include "Port.h" #include "Port.h"
extern int RGB_LOW_BITS_MASK;
extern "C" extern "C"
{ {
@ -48,6 +50,7 @@ int Init_2xSaI(u32 BitFormat)
greenMask = 0x7E0; greenMask = 0x7E0;
qRGB_COLOR_MASK[0] = qRGB_COLOR_MASK[1] = 0xF7DEF7DE; qRGB_COLOR_MASK[0] = qRGB_COLOR_MASK[1] = 0xF7DEF7DE;
hq2x_init(16); hq2x_init(16);
RGB_LOW_BITS_MASK = 0x0821;
} else if (BitFormat == 555) { } else if (BitFormat == 555) {
colorMask = 0x7BDE7BDE; colorMask = 0x7BDE7BDE;
lowPixelMask = 0x04210421; lowPixelMask = 0x04210421;
@ -57,6 +60,7 @@ int Init_2xSaI(u32 BitFormat)
greenMask = 0x3E0; greenMask = 0x3E0;
qRGB_COLOR_MASK[0] = qRGB_COLOR_MASK[1] = 0x7BDE7BDE; qRGB_COLOR_MASK[0] = qRGB_COLOR_MASK[1] = 0x7BDE7BDE;
hq2x_init(15); hq2x_init(15);
RGB_LOW_BITS_MASK = 0x0421;
} else { } else {
return 0; return 0;
} }
@ -67,6 +71,7 @@ int Init_2xSaI(u32 BitFormat)
qlowpixelMask = 0x030303; qlowpixelMask = 0x030303;
qRGB_COLOR_MASK[0] = qRGB_COLOR_MASK[1] = 0xfefefe; qRGB_COLOR_MASK[0] = qRGB_COLOR_MASK[1] = 0xfefefe;
hq2x_init(32); hq2x_init(32);
RGB_LOW_BITS_MASK = 0x010101;
} else } else
return 0; return 0;

31
src/AutoBuild.h Normal file
View File

@ -0,0 +1,31 @@
// -*- 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.
#ifndef __AUTOBUILD_H__
#define __AUTOBUILD_H__
#ifndef VERSION
#define VERSION "1.8.0"
#endif
//change the FALSE to TRUE for autoincrement of build number
#define INCREMENT_VERSION FALSE
#define FILEVER 1,8,0,600
#define PRODUCTVER 1,8,0,600
#define STRFILEVER "1, 8, 0, 600\0"
#define STRPRODUCTVER "1, 8, 0, 600\0"
#endif //__AUTOBUILD_H__

File diff suppressed because it is too large Load Diff

View File

@ -1,55 +1,55 @@
// -*- C++ -*- // -*- C++ -*-
// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. // VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator.
// Copyright (C) 1999-2003 Forgotten // Copyright (C) 1999-2003 Forgotten
// Copyright (C) 2004 Forgotten and the VBA development team // Copyright (C) 2004-2006 Forgotten and the VBA development team
// This program is free software; you can redistribute it and/or modify // 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 // it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2, or(at your option) // the Free Software Foundation; either version 2, or(at your option)
// any later version. // any later version.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details. // GNU General Public License for more details.
// //
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software Foundation, // along with this program; if not, write to the Free Software Foundation,
// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#ifndef GBA_CHEATS_H #ifndef GBA_CHEATS_H
#define GBA_CHEATS_H #define GBA_CHEATS_H
struct CheatsData { struct CheatsData {
int code; int code;
int size; int size;
int status; int status;
bool enabled; bool enabled;
u32 rawaddress; u32 rawaddress;
u32 address; u32 address;
u32 value; u32 value;
u32 oldValue; u32 oldValue;
char codestring[20]; char codestring[20];
char desc[32]; char desc[32];
}; };
extern void cheatsAdd(const char *,const char *,u32, u32,u32,int,int); extern void cheatsAdd(const char *,const char *,u32, u32,u32,int,int);
extern void cheatsAddCheatCode(const char *code, const char *desc); extern void cheatsAddCheatCode(const char *code, const char *desc);
extern void cheatsAddGSACode(const char *code, const char *desc, bool v3); extern void cheatsAddGSACode(const char *code, const char *desc, bool v3);
extern void cheatsAddCBACode(const char *code, const char *desc); extern void cheatsAddCBACode(const char *code, const char *desc);
extern bool cheatsImportGSACodeFile(const char *name, int game, bool v3); extern bool cheatsImportGSACodeFile(const char *name, int game, bool v3);
extern void cheatsDelete(int number, bool restore); extern void cheatsDelete(int number, bool restore);
extern void cheatsDeleteAll(bool restore); extern void cheatsDeleteAll(bool restore);
extern void cheatsEnable(int number); extern void cheatsEnable(int number);
extern void cheatsDisable(int number); extern void cheatsDisable(int number);
extern void cheatsSaveGame(gzFile file); extern void cheatsSaveGame(gzFile file);
extern void cheatsReadGame(gzFile file); extern void cheatsReadGame(gzFile file, int version);
extern void cheatsSaveCheatList(const char *file); extern void cheatsSaveCheatList(const char *file);
extern bool cheatsLoadCheatList(const char *file); extern bool cheatsLoadCheatList(const char *file);
extern void cheatsWriteMemory(u32, u32); extern void cheatsWriteMemory(u32, u32);
extern void cheatsWriteHalfWord(u32, u16); extern void cheatsWriteHalfWord(u32, u16);
extern void cheatsWriteByte(u32, u8); extern void cheatsWriteByte(u32, u8);
extern int cheatsCheckKeys(u32,u32); extern int cheatsCheckKeys(u32,u32);
extern int cheatsNumber; extern int cheatsNumber;
extern CheatsData cheatsList[100]; extern CheatsData cheatsList[100];
#endif // GBA_CHEATS_H #endif // GBA_CHEATS_H

View File

@ -1,6 +1,6 @@
// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. // VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator.
// Copyright (C) 1999-2003 Forgotten // Copyright (C) 1999-2003 Forgotten
// Copyright (C) 2004 Forgotten and the VBA development team // Copyright (C) 2005 Forgotten and the VBA development team
// This program is free software; you can redistribute it and/or modify // 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 // it under the terms of the GNU General Public License as published by
@ -16,6 +16,7 @@
// along with this program; if not, write to the Free Software Foundation, // along with this program; if not, write to the Free Software Foundation,
// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include <memory.h>
#include "GBA.h" #include "GBA.h"
#include "EEprom.h" #include "EEprom.h"
#include "Util.h" #include "Util.h"
@ -42,6 +43,11 @@ variable_desc eepromSaveData[] = {
{ NULL, 0 } { NULL, 0 }
}; };
void eepromInit()
{
memset(eepromData, 255, sizeof(eepromData));
}
void eepromReset() void eepromReset()
{ {
eepromMode = EEPROM_IDLE; eepromMode = EEPROM_IDLE;

View File

@ -1,7 +1,7 @@
// -*- C++ -*- // -*- C++ -*-
// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. // VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator.
// Copyright (C) 1999-2003 Forgotten // Copyright (C) 1999-2003 Forgotten
// Copyright (C) 2004 Forgotten and the VBA development team // Copyright (C) 2005 Forgotten and the VBA development team
// This program is free software; you can redistribute it and/or modify // 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 // it under the terms of the GNU General Public License as published by
@ -20,10 +20,11 @@
#ifndef VBA_EEPROM_H #ifndef VBA_EEPROM_H
#define 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);
extern int eepromRead(u32 address); extern int eepromRead(u32 address);
extern void eepromWrite(u32 address, u8 value); extern void eepromWrite(u32 address, u8 value);
extern void eepromInit();
extern void eepromReset(); extern void eepromReset();
extern u8 eepromData[0x2000]; extern u8 eepromData[0x2000];
extern bool eepromInUse; extern bool eepromInUse;

View File

@ -1,259 +1,263 @@
// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. // VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator.
// Copyright (C) 1999-2003 Forgotten // Copyright (C) 1999-2003 Forgotten
// Copyright (C) 2004 Forgotten and the VBA development team // Copyright (C) 2004-2006 Forgotten and the VBA development team
// This program is free software; you can redistribute it and/or modify // 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 // it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2, or(at your option) // the Free Software Foundation; either version 2, or(at your option)
// any later version. // any later version.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details. // GNU General Public License for more details.
// //
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software Foundation, // along with this program; if not, write to the Free Software Foundation,
// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include <stdio.h> #include <stdio.h>
#include <memory.h> #include <memory.h>
#include "GBA.h" #include "GBA.h"
#include "Globals.h" #include "Globals.h"
#include "Flash.h" #include "Flash.h"
#include "Sram.h" #include "Sram.h"
#include "Util.h" #include "Util.h"
#define FLASH_READ_ARRAY 0 #define FLASH_READ_ARRAY 0
#define FLASH_CMD_1 1 #define FLASH_CMD_1 1
#define FLASH_CMD_2 2 #define FLASH_CMD_2 2
#define FLASH_AUTOSELECT 3 #define FLASH_AUTOSELECT 3
#define FLASH_CMD_3 4 #define FLASH_CMD_3 4
#define FLASH_CMD_4 5 #define FLASH_CMD_4 5
#define FLASH_CMD_5 6 #define FLASH_CMD_5 6
#define FLASH_ERASE_COMPLETE 7 #define FLASH_ERASE_COMPLETE 7
#define FLASH_PROGRAM 8 #define FLASH_PROGRAM 8
#define FLASH_SETBANK 9 #define FLASH_SETBANK 9
u8 flashSaveMemory[0x20000]; u8 flashSaveMemory[0x20000];
int flashState = FLASH_READ_ARRAY; int flashState = FLASH_READ_ARRAY;
int flashReadState = FLASH_READ_ARRAY; int flashReadState = FLASH_READ_ARRAY;
int flashSize = 0x10000; int flashSize = 0x10000;
int flashDeviceID = 0x1b; int flashDeviceID = 0x1b;
int flashManufacturerID = 0x32; int flashManufacturerID = 0x32;
int flashBank = 0; int flashBank = 0;
static variable_desc flashSaveData[] = { static variable_desc flashSaveData[] = {
{ &flashState, sizeof(int) }, { &flashState, sizeof(int) },
{ &flashReadState, sizeof(int) }, { &flashReadState, sizeof(int) },
{ &flashSaveMemory[0], 0x10000 }, { &flashSaveMemory[0], 0x10000 },
{ NULL, 0 } { NULL, 0 }
}; };
static variable_desc flashSaveData2[] = { static variable_desc flashSaveData2[] = {
{ &flashState, sizeof(int) }, { &flashState, sizeof(int) },
{ &flashReadState, sizeof(int) }, { &flashReadState, sizeof(int) },
{ &flashSize, sizeof(int) }, { &flashSize, sizeof(int) },
{ &flashSaveMemory[0], 0x20000 }, { &flashSaveMemory[0], 0x20000 },
{ NULL, 0 } { NULL, 0 }
}; };
static variable_desc flashSaveData3[] = { static variable_desc flashSaveData3[] = {
{ &flashState, sizeof(int) }, { &flashState, sizeof(int) },
{ &flashReadState, sizeof(int) }, { &flashReadState, sizeof(int) },
{ &flashSize, sizeof(int) }, { &flashSize, sizeof(int) },
{ &flashBank, sizeof(int) }, { &flashBank, sizeof(int) },
{ &flashSaveMemory[0], 0x20000 }, { &flashSaveMemory[0], 0x20000 },
{ NULL, 0 } { NULL, 0 }
}; };
void flashInit() void flashInit()
{ {
memset(flashSaveMemory, 0xff, sizeof(flashSaveMemory)); memset(flashSaveMemory, 0xff, sizeof(flashSaveMemory));
} }
void flashReset() void flashReset()
{ {
flashState = FLASH_READ_ARRAY; flashState = FLASH_READ_ARRAY;
flashReadState = FLASH_READ_ARRAY; flashReadState = FLASH_READ_ARRAY;
flashBank = 0; flashBank = 0;
} }
void flashSaveGame(gzFile gzFile) void flashSaveGame(gzFile gzFile)
{ {
utilWriteData(gzFile, flashSaveData3); utilWriteData(gzFile, flashSaveData3);
} }
void flashReadGame(gzFile gzFile, int version) void flashReadGame(gzFile gzFile, int version)
{ {
if(version < SAVE_GAME_VERSION_5) if(version < SAVE_GAME_VERSION_5)
utilReadData(gzFile, flashSaveData); utilReadData(gzFile, flashSaveData);
else if(version < SAVE_GAME_VERSION_7) { else if(version < SAVE_GAME_VERSION_7) {
utilReadData(gzFile, flashSaveData2); utilReadData(gzFile, flashSaveData2);
flashBank = 0; flashBank = 0;
flashSetSize(flashSize); flashSetSize(flashSize);
} else { } else {
utilReadData(gzFile, flashSaveData3); utilReadData(gzFile, flashSaveData3);
} }
} }
void flashSetSize(int size) void flashSetSize(int size)
{ {
// log("Setting flash size to %d\n", size); // log("Setting flash size to %d\n", size);
flashSize = size; if(size == 0x10000) {
if(size == 0x10000) { flashDeviceID = 0x1b;
flashDeviceID = 0x1b; flashManufacturerID = 0x32;
flashManufacturerID = 0x32; } else {
} else { flashDeviceID = 0x13; //0x09;
flashDeviceID = 0x13; //0x09; flashManufacturerID = 0x62; //0xc2;
flashManufacturerID = 0x62; //0xc2; }
} // Added to make 64k saves compatible with 128k ones
} // (allow wrongfuly set 64k saves to work for Pokemon games)
if ((size == 0x20000) && (flashSize == 0x10000))
u8 flashRead(u32 address) memcpy((u8 *)(flashSaveMemory+0x10000), (u8 *)(flashSaveMemory), 0x10000);
{ flashSize = size;
// log("Reading %08x from %08x\n", address, reg[15].I); }
// log("Current read state is %d\n", flashReadState);
address &= 0xFFFF; u8 flashRead(u32 address)
{
switch(flashReadState) { // log("Reading %08x from %08x\n", address, reg[15].I);
case FLASH_READ_ARRAY: // log("Current read state is %d\n", flashReadState);
return flashSaveMemory[(flashBank << 16) + address]; address &= 0xFFFF;
case FLASH_AUTOSELECT:
switch(address & 0xFF) { switch(flashReadState) {
case 0: case FLASH_READ_ARRAY:
// manufacturer ID return flashSaveMemory[(flashBank << 16) + address];
return flashManufacturerID; case FLASH_AUTOSELECT:
case 1: switch(address & 0xFF) {
// device ID case 0:
return flashDeviceID; // manufacturer ID
} return flashManufacturerID;
break; case 1:
case FLASH_ERASE_COMPLETE: // device ID
flashState = FLASH_READ_ARRAY; return flashDeviceID;
flashReadState = FLASH_READ_ARRAY; }
return 0xFF; break;
}; case FLASH_ERASE_COMPLETE:
return 0; flashState = FLASH_READ_ARRAY;
} flashReadState = FLASH_READ_ARRAY;
return 0xFF;
void flashSaveDecide(u32 address, u8 byte) };
{ return 0;
// log("Deciding save type %08x\n", address); }
if(address == 0x0e005555) {
saveType = 2; void flashSaveDecide(u32 address, u8 byte)
cpuSaveGameFunc = flashWrite; {
} else { // log("Deciding save type %08x\n", address);
saveType = 1; if(address == 0x0e005555) {
cpuSaveGameFunc = sramWrite; saveType = 2;
} cpuSaveGameFunc = flashWrite;
} else {
(*cpuSaveGameFunc)(address, byte); saveType = 1;
} cpuSaveGameFunc = sramWrite;
}
void flashDelayedWrite(u32 address, u8 byte)
{ (*cpuSaveGameFunc)(address, byte);
saveType = 2; }
cpuSaveGameFunc = flashWrite;
flashWrite(address, byte); void flashDelayedWrite(u32 address, u8 byte)
} {
saveType = 2;
void flashWrite(u32 address, u8 byte) cpuSaveGameFunc = flashWrite;
{ flashWrite(address, byte);
// log("Writing %02x at %08x\n", byte, address); }
// log("Current state is %d\n", flashState);
address &= 0xFFFF; void flashWrite(u32 address, u8 byte)
switch(flashState) { {
case FLASH_READ_ARRAY: // log("Writing %02x at %08x\n", byte, address);
if(address == 0x5555 && byte == 0xAA) // log("Current state is %d\n", flashState);
flashState = FLASH_CMD_1; address &= 0xFFFF;
break; switch(flashState) {
case FLASH_CMD_1: case FLASH_READ_ARRAY:
if(address == 0x2AAA && byte == 0x55) if(address == 0x5555 && byte == 0xAA)
flashState = FLASH_CMD_2; flashState = FLASH_CMD_1;
else break;
flashState = FLASH_READ_ARRAY; case FLASH_CMD_1:
break; if(address == 0x2AAA && byte == 0x55)
case FLASH_CMD_2: flashState = FLASH_CMD_2;
if(address == 0x5555) { else
if(byte == 0x90) { flashState = FLASH_READ_ARRAY;
flashState = FLASH_AUTOSELECT; break;
flashReadState = FLASH_AUTOSELECT; case FLASH_CMD_2:
} else if(byte == 0x80) { if(address == 0x5555) {
flashState = FLASH_CMD_3; if(byte == 0x90) {
} else if(byte == 0xF0) { flashState = FLASH_AUTOSELECT;
flashState = FLASH_READ_ARRAY; flashReadState = FLASH_AUTOSELECT;
flashReadState = FLASH_READ_ARRAY; } else if(byte == 0x80) {
} else if(byte == 0xA0) { flashState = FLASH_CMD_3;
flashState = FLASH_PROGRAM; } else if(byte == 0xF0) {
} else if(byte == 0xB0 && flashSize == 0x20000) { flashState = FLASH_READ_ARRAY;
flashState = FLASH_SETBANK; flashReadState = FLASH_READ_ARRAY;
} else { } else if(byte == 0xA0) {
flashState = FLASH_READ_ARRAY; flashState = FLASH_PROGRAM;
flashReadState = FLASH_READ_ARRAY; } else if(byte == 0xB0 && flashSize == 0x20000) {
} flashState = FLASH_SETBANK;
} else { } else {
flashState = FLASH_READ_ARRAY; flashState = FLASH_READ_ARRAY;
flashReadState = FLASH_READ_ARRAY; flashReadState = FLASH_READ_ARRAY;
} }
break; } else {
case FLASH_CMD_3: flashState = FLASH_READ_ARRAY;
if(address == 0x5555 && byte == 0xAA) { flashReadState = FLASH_READ_ARRAY;
flashState = FLASH_CMD_4; }
} else { break;
flashState = FLASH_READ_ARRAY; case FLASH_CMD_3:
flashReadState = FLASH_READ_ARRAY; if(address == 0x5555 && byte == 0xAA) {
} flashState = FLASH_CMD_4;
break; } else {
case FLASH_CMD_4: flashState = FLASH_READ_ARRAY;
if(address == 0x2AAA && byte == 0x55) { flashReadState = FLASH_READ_ARRAY;
flashState = FLASH_CMD_5; }
} else { break;
flashState = FLASH_READ_ARRAY; case FLASH_CMD_4:
flashReadState = FLASH_READ_ARRAY; if(address == 0x2AAA && byte == 0x55) {
} flashState = FLASH_CMD_5;
break; } else {
case FLASH_CMD_5: flashState = FLASH_READ_ARRAY;
if(byte == 0x30) { flashReadState = FLASH_READ_ARRAY;
// SECTOR ERASE }
memset(&flashSaveMemory[(flashBank << 16) + (address & 0xF000)], break;
0, case FLASH_CMD_5:
0x1000); if(byte == 0x30) {
systemSaveUpdateCounter = SYSTEM_SAVE_UPDATED; // SECTOR ERASE
flashReadState = FLASH_ERASE_COMPLETE; memset(&flashSaveMemory[(flashBank << 16) + (address & 0xF000)],
} else if(byte == 0x10) { 0,
// CHIP ERASE 0x1000);
memset(flashSaveMemory, 0, flashSize); systemSaveUpdateCounter = SYSTEM_SAVE_UPDATED;
systemSaveUpdateCounter = SYSTEM_SAVE_UPDATED; flashReadState = FLASH_ERASE_COMPLETE;
flashReadState = FLASH_ERASE_COMPLETE; } else if(byte == 0x10) {
} else { // CHIP ERASE
flashState = FLASH_READ_ARRAY; memset(flashSaveMemory, 0, flashSize);
flashReadState = FLASH_READ_ARRAY; systemSaveUpdateCounter = SYSTEM_SAVE_UPDATED;
} flashReadState = FLASH_ERASE_COMPLETE;
break; } else {
case FLASH_AUTOSELECT: flashState = FLASH_READ_ARRAY;
if(byte == 0xF0) { flashReadState = FLASH_READ_ARRAY;
flashState = FLASH_READ_ARRAY; }
flashReadState = FLASH_READ_ARRAY; break;
} else if(address == 0x5555 && byte == 0xAA) case FLASH_AUTOSELECT:
flashState = FLASH_CMD_1; if(byte == 0xF0) {
else { flashState = FLASH_READ_ARRAY;
flashState = FLASH_READ_ARRAY; flashReadState = FLASH_READ_ARRAY;
flashReadState = FLASH_READ_ARRAY; } else if(address == 0x5555 && byte == 0xAA)
} flashState = FLASH_CMD_1;
break; else {
case FLASH_PROGRAM: flashState = FLASH_READ_ARRAY;
flashSaveMemory[(flashBank<<16)+address] = byte; flashReadState = FLASH_READ_ARRAY;
systemSaveUpdateCounter = SYSTEM_SAVE_UPDATED; }
flashState = FLASH_READ_ARRAY; break;
flashReadState = FLASH_READ_ARRAY; case FLASH_PROGRAM:
break; flashSaveMemory[(flashBank<<16)+address] = byte;
case FLASH_SETBANK: systemSaveUpdateCounter = SYSTEM_SAVE_UPDATED;
if(address == 0) { flashState = FLASH_READ_ARRAY;
flashBank = (byte & 1); flashReadState = FLASH_READ_ARRAY;
} break;
flashState = FLASH_READ_ARRAY; case FLASH_SETBANK:
flashReadState = FLASH_READ_ARRAY; if(address == 0) {
break; flashBank = (byte & 1);
} }
} flashState = FLASH_READ_ARRAY;
flashReadState = FLASH_READ_ARRAY;
break;
}
}

View File

@ -1,35 +1,35 @@
// -*- C++ -*- // -*- C++ -*-
// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. // VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator.
// Copyright (C) 1999-2003 Forgotten // Copyright (C) 1999-2003 Forgotten
// Copyright (C) 2004 Forgotten and the VBA development team // Copyright (C) 2004 Forgotten and the VBA development team
// This program is free software; you can redistribute it and/or modify // 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 // it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2, or(at your option) // the Free Software Foundation; either version 2, or(at your option)
// any later version. // any later version.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details. // GNU General Public License for more details.
// //
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software Foundation, // along with this program; if not, write to the Free Software Foundation,
// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#ifndef VBA_FLASH_H #ifndef VBA_FLASH_H
#define 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);
extern u8 flashRead(u32 address); extern u8 flashRead(u32 address);
extern void flashWrite(u32 address, u8 byte); extern void flashWrite(u32 address, u8 byte);
extern void flashDelayedWrite(u32 address, u8 byte); extern void flashDelayedWrite(u32 address, u8 byte);
extern u8 flashSaveMemory[0x20000]; extern u8 flashSaveMemory[0x20000];
extern void flashSaveDecide(u32 address, u8 byte); extern void flashSaveDecide(u32 address, u8 byte);
extern void flashReset(); extern void flashReset();
extern void flashSetSize(int size); extern void flashSetSize(int size);
extern void flashInit(); extern void flashInit();
extern int flashSize; extern int flashSize;
#endif // VBA_FLASH_H #endif // VBA_FLASH_H

File diff suppressed because it is too large Load Diff

305
src/GBA.h
View File

@ -1,147 +1,158 @@
// -*- C++ -*- // -*- C++ -*-
// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. // VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator.
// Copyright (C) 1999-2003 Forgotten // Copyright (C) 1999-2003 Forgotten
// Copyright (C) 2004 Forgotten and the VBA development team // Copyright (C) 2005 Forgotten and the VBA development team
// This program is free software; you can redistribute it and/or modify // 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 // it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2, or(at your option) // the Free Software Foundation; either version 2, or(at your option)
// any later version. // any later version.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details. // GNU General Public License for more details.
// //
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software Foundation, // along with this program; if not, write to the Free Software Foundation,
// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#ifndef VBA_GBA_H #ifndef VBA_GBA_H
#define VBA_GBA_H #define VBA_GBA_H
#include "System.h" #include "System.h"
#define SAVE_GAME_VERSION_1 1 #define SAVE_GAME_VERSION_1 1
#define SAVE_GAME_VERSION_2 2 #define SAVE_GAME_VERSION_2 2
#define SAVE_GAME_VERSION_3 3 #define SAVE_GAME_VERSION_3 3
#define SAVE_GAME_VERSION_4 4 #define SAVE_GAME_VERSION_4 4
#define SAVE_GAME_VERSION_5 5 #define SAVE_GAME_VERSION_5 5
#define SAVE_GAME_VERSION_6 6 #define SAVE_GAME_VERSION_6 6
#define SAVE_GAME_VERSION_7 7 #define SAVE_GAME_VERSION_7 7
#define SAVE_GAME_VERSION_8 8 #define SAVE_GAME_VERSION_8 8
#define SAVE_GAME_VERSION SAVE_GAME_VERSION_8 #define SAVE_GAME_VERSION_9 9
#define SAVE_GAME_VERSION SAVE_GAME_VERSION_9
typedef struct {
u8 *address; typedef struct {
u32 mask; u8 *address;
} memoryMap; u32 mask;
} memoryMap;
typedef union {
struct { typedef union {
#ifdef WORDS_BIGENDIAN struct {
u8 B3; #ifdef WORDS_BIGENDIAN
u8 B2; u8 B3;
u8 B1; u8 B2;
u8 B0; u8 B1;
#else u8 B0;
u8 B0; #else
u8 B1; u8 B0;
u8 B2; u8 B1;
u8 B3; u8 B2;
#endif u8 B3;
} B; #endif
struct { } B;
#ifdef WORDS_BIGENDIAN struct {
u16 W1; #ifdef WORDS_BIGENDIAN
u16 W0; u16 W1;
#else u16 W0;
u16 W0; #else
u16 W1; u16 W0;
#endif u16 W1;
} W; #endif
#ifdef WORDS_BIGENDIAN } W;
volatile u32 I; #ifdef WORDS_BIGENDIAN
#else volatile u32 I;
u32 I; #else
#endif u32 I;
} reg_pair; #endif
} reg_pair;
#ifndef NO_GBA_MAP
extern memoryMap map[256]; #ifndef NO_GBA_MAP
#endif extern memoryMap map[256];
#endif
extern reg_pair reg[45];
extern u8 biosProtected[4]; extern reg_pair reg[45];
extern u8 biosProtected[4];
extern bool N_FLAG;
extern bool Z_FLAG; extern bool N_FLAG;
extern bool C_FLAG; extern bool Z_FLAG;
extern bool V_FLAG; extern bool C_FLAG;
extern bool armIrqEnable; extern bool V_FLAG;
extern bool armState; extern bool armIrqEnable;
extern int armMode; extern bool armState;
extern void (*cpuSaveGameFunc)(u32,u8); extern int armMode;
extern void (*cpuSaveGameFunc)(u32,u8);
extern u8 freezeWorkRAM[0x40000];
extern u8 freezeInternalRAM[0x8000]; extern u8 freezeWorkRAM[0x40000];
extern bool CPUReadGSASnapshot(const char *); extern u8 freezeInternalRAM[0x8000];
extern bool CPUWriteGSASnapshot(const char *, const char *, const char *, const char *); extern u8 freezeVRAM[0x18000];
extern bool CPUWriteBatteryFile(const char *); extern u8 freezeOAM[0x400];
extern bool CPUReadBatteryFile(const char *); extern u8 freezePRAM[0x400];
extern bool CPUExportEepromFile(const char *); extern bool debugger_last;
extern bool CPUImportEepromFile(const char *); extern int oldreg[17];
extern bool CPUWritePNGFile(const char *); extern char oldbuffer[10];
extern bool CPUWriteBMPFile(const char *);
extern void CPUCleanUp(); extern bool CPUReadGSASnapshot(const char *);
extern void CPUUpdateRender(); extern bool CPUWriteGSASnapshot(const char *, const char *, const char *, const char *);
extern bool CPUReadMemState(char *, int); extern bool CPUWriteBatteryFile(const char *);
extern bool CPUReadState(const char *); extern bool CPUReadBatteryFile(const char *);
extern bool CPUWriteMemState(char *, int); extern bool CPUExportEepromFile(const char *);
extern bool CPUWriteState(const char *); extern bool CPUImportEepromFile(const char *);
extern int CPULoadRom(const char *); extern bool CPUWritePNGFile(const char *);
extern void CPUUpdateRegister(u32, u16); extern bool CPUWriteBMPFile(const char *);
extern void CPUWriteHalfWord(u32, u16); extern void CPUCleanUp();
extern void CPUWriteByte(u32, u8); extern void CPUUpdateRender();
extern void CPUInit(const char *,bool); extern bool CPUReadMemState(char *, int);
extern void CPUReset(); extern bool CPUReadState(const char *);
extern void CPULoop(int); extern bool CPUWriteMemState(char *, int);
extern bool CPUCheckDMA(int,int); extern bool CPUWriteState(const char *);
extern bool CPUIsGBAImage(const char *); extern int CPULoadRom(const char *);
extern bool CPUIsZipFile(const char *); extern void doMirroring(bool);
#ifdef PROFILING extern void CPUUpdateRegister(u32, u16);
extern void cpuProfil(char *buffer, int, u32, int); extern void applyTimer ();
extern void cpuEnableProfiling(int hz); extern void CPUWriteHalfWord(u32, u16);
#endif extern void CPUWriteByte(u32, u8);
extern void CPUInit(const char *,bool);
extern struct EmulatedSystem GBASystem; extern void CPUReset();
extern void CPULoop(int);
#define R13_IRQ 18 extern void CPUCheckDMA(int,int);
#define R14_IRQ 19 extern bool CPUIsGBAImage(const char *);
#define SPSR_IRQ 20 extern bool CPUIsZipFile(const char *);
#define R13_USR 26 #ifdef PROFILING
#define R14_USR 27 #include "prof/prof.h"
#define R13_SVC 28 extern void cpuProfil(profile_segment *seg);
#define R14_SVC 29 extern void cpuEnableProfiling(int hz);
#define SPSR_SVC 30 #endif
#define R13_ABT 31
#define R14_ABT 32 extern struct EmulatedSystem GBASystem;
#define SPSR_ABT 33
#define R13_UND 34 #define R13_IRQ 18
#define R14_UND 35 #define R14_IRQ 19
#define SPSR_UND 36 #define SPSR_IRQ 20
#define R8_FIQ 37 #define R13_USR 26
#define R9_FIQ 38 #define R14_USR 27
#define R10_FIQ 39 #define R13_SVC 28
#define R11_FIQ 40 #define R14_SVC 29
#define R12_FIQ 41 #define SPSR_SVC 30
#define R13_FIQ 42 #define R13_ABT 31
#define R14_FIQ 43 #define R14_ABT 32
#define SPSR_FIQ 44 #define SPSR_ABT 33
#define R13_UND 34
#include "Cheats.h" #define R14_UND 35
#include "Globals.h" #define SPSR_UND 36
#include "EEprom.h" #define R8_FIQ 37
#include "Flash.h" #define R9_FIQ 38
#define R10_FIQ 39
#endif //VBA_GBA_H #define R11_FIQ 40
#define R12_FIQ 41
#define R13_FIQ 42
#define R14_FIQ 43
#define SPSR_FIQ 44
#include "Cheats.h"
#include "Globals.h"
#include "EEprom.h"
#include "Flash.h"
#endif //VBA_GBA_H

View File

@ -1,427 +1,488 @@
// -*- C++ -*- // -*- C++ -*-
// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. // VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator.
// Copyright (C) 1999-2003 Forgotten // Copyright (C) 1999-2003 Forgotten
// Copyright (C) 2004 Forgotten and the VBA development team // Copyright (C) 2005 Forgotten and the VBA development team
// This program is free software; you can redistribute it and/or modify // 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 // it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2, or(at your option) // the Free Software Foundation; either version 2, or(at your option)
// any later version. // any later version.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details. // GNU General Public License for more details.
// //
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software Foundation, // along with this program; if not, write to the Free Software Foundation,
// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#ifndef VBA_GBAinline_H #ifndef VBA_GBAinline_H
#define VBA_GBAinline_H #define VBA_GBAinline_H
#include "System.h" #include "System.h"
#include "Port.h" #include "Port.h"
#include "RTC.h" #include "RTC.h"
#include "Sound.h"
extern bool cpuSramEnabled;
extern bool cpuSramEnabled; extern bool cpuFlashEnabled;
extern bool cpuFlashEnabled; extern bool cpuEEPROMEnabled;
extern bool cpuEEPROMEnabled; extern bool cpuEEPROMSensorEnabled;
extern bool cpuEEPROMSensorEnabled; extern bool cpuDmaHack;
extern bool cpuDmaHack; extern u32 cpuDmaLast;
extern bool cpuDmaHack2; extern bool timer0On;
extern u32 cpuDmaLast; extern int timer0Ticks;
extern int timer0ClockReload;
extern int lspeed; extern bool timer1On;
extern void LinkSStop(void); extern int timer1Ticks;
extern int timer1ClockReload;
#define CPUReadByteQuick(addr) \ extern bool timer2On;
map[(addr)>>24].address[(addr) & map[(addr)>>24].mask] extern int timer2Ticks;
extern int timer2ClockReload;
#define CPUReadHalfWordQuick(addr) \ extern bool timer3On;
READ16LE(((u16*)&map[(addr)>>24].address[(addr) & map[(addr)>>24].mask])) extern int timer3Ticks;
extern int timer3ClockReload;
#define CPUReadMemoryQuick(addr) \ extern int cpuTotalTicks;
READ32LE(((u32*)&map[(addr)>>24].address[(addr) & map[(addr)>>24].mask]))
#define CPUReadByteQuick(addr) \
inline u32 CPUReadMemory(u32 address) map[(addr)>>24].address[(addr) & map[(addr)>>24].mask]
{
#define CPUReadHalfWordQuick(addr) \
#ifdef DEV_VERSION READ16LE(((u16*)&map[(addr)>>24].address[(addr) & map[(addr)>>24].mask]))
if(address & 3) {
if(systemVerbose & VERBOSE_UNALIGNED_MEMORY) { #define CPUReadMemoryQuick(addr) \
log("Unaligned word read: %08x at %08x\n", address, armMode ? READ32LE(((u32*)&map[(addr)>>24].address[(addr) & map[(addr)>>24].mask]))
armNextPC - 4 : armNextPC - 2);
} static inline u32 CPUReadMemory(u32 address)
} {
#endif
#ifdef DEV_VERSION
u32 value; if(address & 3) {
switch(address >> 24) { if(systemVerbose & VERBOSE_UNALIGNED_MEMORY) {
case 0: log("Unaligned word read: %08x at %08x\n", address, armMode ?
if(reg[15].I >> 24) { armNextPC - 4 : armNextPC - 2);
if(address < 0x4000) { }
#ifdef DEV_VERSION }
if(systemVerbose & VERBOSE_ILLEGAL_READ) { #endif
log("Illegal word read: %08x at %08x\n", address, armMode ?
armNextPC - 4 : armNextPC - 2); u32 value;
} switch(address >> 24) {
#endif case 0:
if(reg[15].I >> 24) {
value = READ32LE(((u32 *)&biosProtected)); if(address < 0x4000) {
} #ifdef DEV_VERSION
else goto unreadable; if(systemVerbose & VERBOSE_ILLEGAL_READ) {
} else log("Illegal word read: %08x at %08x\n", address, armMode ?
value = READ32LE(((u32 *)&bios[address & 0x3FFC])); armNextPC - 4 : armNextPC - 2);
break; }
case 2: #endif
value = READ32LE(((u32 *)&workRAM[address & 0x3FFFC]));
break; value = READ32LE(((u32 *)&biosProtected));
case 3: }
value = READ32LE(((u32 *)&internalRAM[address & 0x7ffC])); else goto unreadable;
break; } else
case 4: value = READ32LE(((u32 *)&bios[address & 0x3FFC]));
if((address>=0x4000120||address<=0x4000126)&&lspeed) break;
LinkSStop(); case 2:
if((address < 0x4000400) && ioReadable[address & 0x3fc]) { value = READ32LE(((u32 *)&workRAM[address & 0x3FFFC]));
if(ioReadable[(address & 0x3fc) + 2]) break;
value = soundRead32(address & 0x3fC); case 3:
else value = READ32LE(((u32 *)&internalRAM[address & 0x7ffC]));
value = soundRead16(address & 0x3fc); break;
} else goto unreadable; case 4:
break; if((address < 0x4000400) && ioReadable[address & 0x3fc]) {
case 5: if(ioReadable[(address & 0x3fc) + 2])
value = READ32LE(((u32 *)&paletteRAM[address & 0x3fC])); value = READ32LE(((u32 *)&ioMem[address & 0x3fC]));
break; else
case 6: value = READ16LE(((u16 *)&ioMem[address & 0x3fc]));
value = READ32LE(((u32 *)&vram[address & 0x1fffc])); } else goto unreadable;
break; break;
case 7: case 5:
value = READ32LE(((u32 *)&oam[address & 0x3FC])); value = READ32LE(((u32 *)&paletteRAM[address & 0x3fC]));
break; break;
case 8: case 6:
case 9: address = (address & 0x1fffc);
case 10: if (((DISPCNT & 7) >2) && ((address & 0x1C000) == 0x18000))
case 11: {
case 12: value = 0;
value = READ32LE(((u32 *)&rom[address&0x1FFFFFC])); break;
break; }
case 13: if ((address & 0x18000) == 0x18000)
if(cpuEEPROMEnabled) address &= 0x17fff;
// no need to swap this value = READ32LE(((u32 *)&vram[address]));
return eepromRead(address); break;
goto unreadable; case 7:
case 14: value = READ32LE(((u32 *)&oam[address & 0x3FC]));
if(cpuFlashEnabled | cpuSramEnabled) break;
// no need to swap this case 8:
return flashRead(address); case 9:
// default case 10:
default: case 11:
unreadable: case 12:
#ifdef DEV_VERSION value = READ32LE(((u32 *)&rom[address&0x1FFFFFC]));
if(systemVerbose & VERBOSE_ILLEGAL_READ) { break;
log("Illegal word read: %08x at %08x\n", address, armMode ? case 13:
armNextPC - 4 : armNextPC - 2); if(cpuEEPROMEnabled)
} // no need to swap this
#endif return eepromRead(address);
goto unreadable;
if(cpuDmaHack || cpuDmaHack2) { case 14:
value = cpuDmaLast; if(cpuFlashEnabled | cpuSramEnabled)
} else { // no need to swap this
if(armState) { return flashRead(address);
value = CPUReadMemoryQuick(reg[15].I); // default
} else { default:
value = CPUReadHalfWordQuick(reg[15].I) | unreadable:
CPUReadHalfWordQuick(reg[15].I) << 16; #ifdef DEV_VERSION
} if(systemVerbose & VERBOSE_ILLEGAL_READ) {
} log("Illegal word read: %08x at %08x\n", address, armMode ?
} armNextPC - 4 : armNextPC - 2);
}
if(address & 3) { #endif
#ifdef C_CORE
int shift = (address & 3) << 3; if(cpuDmaHack) {
value = (value >> shift) | (value << (32 - shift)); value = cpuDmaLast;
#else } else {
#ifdef __GNUC__ if(armState) {
asm("and $3, %%ecx;" value = CPUReadMemoryQuick(reg[15].I);
"shl $3 ,%%ecx;" } else {
"ror %%cl, %0" value = CPUReadHalfWordQuick(reg[15].I) |
: "=r" (value) CPUReadHalfWordQuick(reg[15].I) << 16;
: "r" (value), "c" (address)); }
#else }
__asm { }
mov ecx, address;
and ecx, 3; if(address & 3) {
shl ecx, 3; #ifdef C_CORE
ror [dword ptr value], cl; int shift = (address & 3) << 3;
} value = (value >> shift) | (value << (32 - shift));
#endif #else
#endif #ifdef __GNUC__
} asm("and $3, %%ecx;"
return value; "shl $3 ,%%ecx;"
} "ror %%cl, %0"
: "=r" (value)
extern u32 myROM[]; : "r" (value), "c" (address));
#else
inline u32 CPUReadHalfWord(u32 address) __asm {
{ mov ecx, address;
#ifdef DEV_VERSION and ecx, 3;
if(address & 1) { shl ecx, 3;
if(systemVerbose & VERBOSE_UNALIGNED_MEMORY) { ror [dword ptr value], cl;
log("Unaligned halfword read: %08x at %08x\n", address, armMode ? }
armNextPC - 4 : armNextPC - 2); #endif
} #endif
} }
#endif return value;
}
u32 value;
extern u32 myROM[];
switch(address >> 24) {
case 0: static inline u32 CPUReadHalfWord(u32 address)
if (reg[15].I >> 24) { {
if(address < 0x4000) { #ifdef DEV_VERSION
#ifdef DEV_VERSION if(address & 1) {
if(systemVerbose & VERBOSE_ILLEGAL_READ) { if(systemVerbose & VERBOSE_UNALIGNED_MEMORY) {
log("Illegal halfword read: %08x at %08x\n", address, armMode ? log("Unaligned halfword read: %08x at %08x\n", address, armMode ?
armNextPC - 4 : armNextPC - 2); armNextPC - 4 : armNextPC - 2);
} }
#endif }
value = READ16LE(((u16 *)&biosProtected[address&2])); #endif
} else goto unreadable;
} else u32 value;
value = READ16LE(((u16 *)&bios[address & 0x3FFE]));
break; switch(address >> 24) {
case 2: case 0:
value = READ16LE(((u16 *)&workRAM[address & 0x3FFFE])); if (reg[15].I >> 24) {
break; if(address < 0x4000) {
case 3: #ifdef DEV_VERSION
value = READ16LE(((u16 *)&internalRAM[address & 0x7ffe])); if(systemVerbose & VERBOSE_ILLEGAL_READ) {
break; log("Illegal halfword read: %08x at %08x\n", address, armMode ?
case 4: armNextPC - 4 : armNextPC - 2);
if((address>=0x4000120||address<=0x4000126)&&lspeed) }
LinkSStop(); #endif
if((address < 0x4000400) && ioReadable[address & 0x3fe]) value = READ16LE(((u16 *)&biosProtected[address&2]));
value = READ16LE(((u16 *)&ioMem[address & 0x3fe])); } else goto unreadable;
else goto unreadable; } else
break; value = READ16LE(((u16 *)&bios[address & 0x3FFE]));
case 5: break;
value = READ16LE(((u16 *)&paletteRAM[address & 0x3fe])); case 2:
break; value = READ16LE(((u16 *)&workRAM[address & 0x3FFFE]));
case 6: break;
value = READ16LE(((u16 *)&vram[address & 0x1fffe])); case 3:
break; value = READ16LE(((u16 *)&internalRAM[address & 0x7ffe]));
case 7: break;
value = READ16LE(((u16 *)&oam[address & 0x3fe])); case 4:
break; if((address < 0x4000400) && ioReadable[address & 0x3fe])
case 8: {
case 9: value = READ16LE(((u16 *)&ioMem[address & 0x3fe]));
case 10: if (((address & 0x3fe)>0xFF) && ((address & 0x3fe)<0x10E))
case 11: {
case 12: if (((address & 0x3fe) == 0x100) && timer0On)
if(address == 0x80000c4 || address == 0x80000c6 || address == 0x80000c8) value = 0xFFFF - ((timer0Ticks-cpuTotalTicks) >> timer0ClockReload);
value = rtcRead(address); else
else if (((address & 0x3fe) == 0x104) && timer1On && !(TM1CNT & 4))
value = READ16LE(((u16 *)&rom[address & 0x1FFFFFE])); value = 0xFFFF - ((timer1Ticks-cpuTotalTicks) >> timer1ClockReload);
break; else
case 13: if (((address & 0x3fe) == 0x108) && timer2On && !(TM2CNT & 4))
if(cpuEEPROMEnabled) value = 0xFFFF - ((timer2Ticks-cpuTotalTicks) >> timer2ClockReload);
// no need to swap this else
return eepromRead(address); if (((address & 0x3fe) == 0x10C) && timer3On && !(TM3CNT & 4))
goto unreadable; value = 0xFFFF - ((timer3Ticks-cpuTotalTicks) >> timer3ClockReload);
case 14: }
if(cpuFlashEnabled | cpuSramEnabled) }
// no need to swap this else goto unreadable;
return flashRead(address); break;
// default case 5:
default: value = READ16LE(((u16 *)&paletteRAM[address & 0x3fe]));
unreadable: break;
#ifdef DEV_VERSION case 6:
if(systemVerbose & VERBOSE_ILLEGAL_READ) { address = (address & 0x1fffe);
log("Illegal halfword read: %08x at %08x\n", address, armMode ? if (((DISPCNT & 7) >2) && ((address & 0x1C000) == 0x18000))
armNextPC - 4 : armNextPC - 2); {
} value = 0;
#endif break;
if(cpuDmaHack2 || cpuDmaHack) { }
value = cpuDmaLast & 0xFFFF; if ((address & 0x18000) == 0x18000)
} else { address &= 0x17fff;
if(armState) { value = READ16LE(((u16 *)&vram[address]));
value = CPUReadHalfWordQuick(reg[15].I + (address & 2)); break;
} else { case 7:
value = CPUReadHalfWordQuick(reg[15].I); value = READ16LE(((u16 *)&oam[address & 0x3fe]));
} break;
} case 8:
break; case 9:
} case 10:
case 11:
if(address & 1) { case 12:
value = (value >> 8) | (value << 24); if(address == 0x80000c4 || address == 0x80000c6 || address == 0x80000c8)
} value = rtcRead(address);
else
return value; value = READ16LE(((u16 *)&rom[address & 0x1FFFFFE]));
} break;
case 13:
inline u16 CPUReadHalfWordSigned(u32 address) if(cpuEEPROMEnabled)
{ // no need to swap this
u16 value = CPUReadHalfWord(address); return eepromRead(address);
if((address & 1)) goto unreadable;
value = (s8)value; case 14:
return value; if(cpuFlashEnabled | cpuSramEnabled)
} // no need to swap this
return flashRead(address);
inline u8 CPUReadByte(u32 address) // default
{ default:
switch(address >> 24) { unreadable:
case 0: #ifdef DEV_VERSION
if (reg[15].I >> 24) { if(systemVerbose & VERBOSE_ILLEGAL_READ) {
if(address < 0x4000) { log("Illegal halfword read: %08x at %08x\n", address, armMode ?
#ifdef DEV_VERSION armNextPC - 4 : armNextPC - 2);
if(systemVerbose & VERBOSE_ILLEGAL_READ) { }
log("Illegal byte read: %08x at %08x\n", address, armMode ? #endif
armNextPC - 4 : armNextPC - 2); if(cpuDmaHack) {
} value = cpuDmaLast & 0xFFFF;
#endif } else {
return biosProtected[address & 3]; if(armState) {
} else goto unreadable; value = CPUReadHalfWordQuick(reg[15].I + (address & 2));
} } else {
return bios[address & 0x3FFF]; value = CPUReadHalfWordQuick(reg[15].I);
case 2: }
return workRAM[address & 0x3FFFF]; }
case 3: break;
return internalRAM[address & 0x7fff]; }
case 4:
if((address>=0x4000120||address<=0x4000126)&&lspeed) if(address & 1) {
LinkSStop(); value = (value >> 8) | (value << 24);
if((address < 0x4000400) && ioReadable[address & 0x3ff]) }
return soundRead(address & 0x3ff);
else goto unreadable; return value;
case 5: }
return paletteRAM[address & 0x3ff];
case 6: static inline u16 CPUReadHalfWordSigned(u32 address)
return vram[address & 0x1ffff]; {
case 7: u16 value = CPUReadHalfWord(address);
return oam[address & 0x3ff]; if((address & 1))
case 8: value = (s8)value;
case 9: return value;
case 10: }
case 11:
case 12: static inline u8 CPUReadByte(u32 address)
return rom[address & 0x1FFFFFF]; {
case 13: switch(address >> 24) {
if(cpuEEPROMEnabled) case 0:
return eepromRead(address); if (reg[15].I >> 24) {
goto unreadable; if(address < 0x4000) {
case 14: #ifdef DEV_VERSION
if(cpuSramEnabled | cpuFlashEnabled) if(systemVerbose & VERBOSE_ILLEGAL_READ) {
return flashRead(address); log("Illegal byte read: %08x at %08x\n", address, armMode ?
if(cpuEEPROMSensorEnabled) { armNextPC - 4 : armNextPC - 2);
switch(address & 0x00008f00) { }
case 0x8200: #endif
return systemGetSensorX() & 255; return biosProtected[address & 3];
case 0x8300: } else goto unreadable;
return (systemGetSensorX() >> 8)|0x80; }
case 0x8400: return bios[address & 0x3FFF];
return systemGetSensorY() & 255; case 2:
case 0x8500: return workRAM[address & 0x3FFFF];
return systemGetSensorY() >> 8; case 3:
} return internalRAM[address & 0x7fff];
} case 4:
// default if((address < 0x4000400) && ioReadable[address & 0x3ff])
default: return ioMem[address & 0x3ff];
unreadable: else goto unreadable;
#ifdef DEV_VERSION case 5:
if(systemVerbose & VERBOSE_ILLEGAL_READ) { return paletteRAM[address & 0x3ff];
log("Illegal byte read: %08x at %08x\n", address, armMode ? case 6:
armNextPC - 4 : armNextPC - 2); address = (address & 0x1ffff);
} if (((DISPCNT & 7) >2) && ((address & 0x1C000) == 0x18000))
#endif return 0;
if(cpuDmaHack || cpuDmaHack2) { if ((address & 0x18000) == 0x18000)
return cpuDmaLast & 0xFF; address &= 0x17fff;
} else { return vram[address];
if(armState) { case 7:
return CPUReadByteQuick(reg[15].I+(address & 3)); return oam[address & 0x3ff];
} else { case 8:
return CPUReadByteQuick(reg[15].I+(address & 1)); case 9:
} case 10:
} case 11:
break; case 12:
} return rom[address & 0x1FFFFFF];
} case 13:
if(cpuEEPROMEnabled)
inline void CPUWriteMemory(u32 address, u32 value) return eepromRead(address);
{ goto unreadable;
#ifdef DEV_VERSION case 14:
if(address & 3) { if(cpuSramEnabled | cpuFlashEnabled)
if(systemVerbose & VERBOSE_UNALIGNED_MEMORY) { return flashRead(address);
log("Unaliagned word write: %08x to %08x from %08x\n", if(cpuEEPROMSensorEnabled) {
value, switch(address & 0x00008f00) {
address, case 0x8200:
armMode ? armNextPC - 4 : armNextPC - 2); return systemGetSensorX() & 255;
} case 0x8300:
} return (systemGetSensorX() >> 8)|0x80;
#endif case 0x8400:
return systemGetSensorY() & 255;
switch(address >> 24) { case 0x8500:
case 0x02: return systemGetSensorY() >> 8;
#ifdef SDL }
if(*((u32 *)&freezeWorkRAM[address & 0x3FFFC])) }
cheatsWriteMemory(address & 0x203FFFC, // default
value); default:
else unreadable:
#endif #ifdef DEV_VERSION
WRITE32LE(((u32 *)&workRAM[address & 0x3FFFC]), value); if(systemVerbose & VERBOSE_ILLEGAL_READ) {
break; log("Illegal byte read: %08x at %08x\n", address, armMode ?
case 0x03: armNextPC - 4 : armNextPC - 2);
#ifdef SDL }
if(*((u32 *)&freezeInternalRAM[address & 0x7ffc])) #endif
cheatsWriteMemory(address & 0x3007FFC, if(cpuDmaHack) {
value); return cpuDmaLast & 0xFF;
else } else {
#endif if(armState) {
WRITE32LE(((u32 *)&internalRAM[address & 0x7ffC]), value); return CPUReadByteQuick(reg[15].I+(address & 3));
break; } else {
case 0x04: return CPUReadByteQuick(reg[15].I+(address & 1));
if(address < 0x4000400) { }
CPUUpdateRegister((address & 0x3FC), value & 0xFFFF); }
CPUUpdateRegister((address & 0x3FC) + 2, (value >> 16)); break;
} else goto unwritable; }
break; }
case 0x05:
WRITE32LE(((u32 *)&paletteRAM[address & 0x3FC]), value); static inline void CPUWriteMemory(u32 address, u32 value)
break; {
case 0x06:
if(address & 0x10000) #ifdef DEV_VERSION
WRITE32LE(((u32 *)&vram[address & 0x17ffc]), value); if(address & 3) {
else if(systemVerbose & VERBOSE_UNALIGNED_MEMORY) {
WRITE32LE(((u32 *)&vram[address & 0x1fffc]), value); log("Unaligned word write: %08x to %08x from %08x\n",
break; value,
case 0x07: address,
WRITE32LE(((u32 *)&oam[address & 0x3fc]), value); armMode ? armNextPC - 4 : armNextPC - 2);
break; }
case 0x0D: }
if(cpuEEPROMEnabled) { #endif
eepromWrite(address, value);
break; switch(address >> 24) {
} case 0x02:
goto unwritable; #ifdef BKPT_SUPPORT
case 0x0E: if(*((u32 *)&freezeWorkRAM[address & 0x3FFFC]))
if(!eepromInUse | cpuSramEnabled | cpuFlashEnabled) { cheatsWriteMemory(address & 0x203FFFC,
(*cpuSaveGameFunc)(address, (u8)value); value);
break; else
} #endif
// default WRITE32LE(((u32 *)&workRAM[address & 0x3FFFC]), value);
default: break;
unwritable: case 0x03:
#ifdef DEV_VERSION #ifdef BKPT_SUPPORT
if(systemVerbose & VERBOSE_ILLEGAL_WRITE) { if(*((u32 *)&freezeInternalRAM[address & 0x7ffc]))
log("Illegal word write: %08x to %08x from %08x\n", cheatsWriteMemory(address & 0x3007FFC,
value, value);
address, else
armMode ? armNextPC - 4 : armNextPC - 2); #endif
} WRITE32LE(((u32 *)&internalRAM[address & 0x7ffC]), value);
#endif break;
break; case 0x04:
} if(address < 0x4000400) {
} CPUUpdateRegister((address & 0x3FC), value & 0xFFFF);
CPUUpdateRegister((address & 0x3FC) + 2, (value >> 16));
#endif //VBA_GBAinline_H } else goto unwritable;
break;
case 0x05:
#ifdef BKPT_SUPPORT
if(*((u32 *)&freezePRAM[address & 0x3fc]))
cheatsWriteMemory(address & 0x70003FC,
value);
else
#endif
WRITE32LE(((u32 *)&paletteRAM[address & 0x3FC]), value);
break;
case 0x06:
address = (address & 0x1fffc);
if (((DISPCNT & 7) >2) && ((address & 0x1C000) == 0x18000))
return;
if ((address & 0x18000) == 0x18000)
address &= 0x17fff;
#ifdef BKPT_SUPPORT
if(*((u32 *)&freezeVRAM[address]))
cheatsWriteMemory(address + 0x06000000, value);
else
#endif
WRITE32LE(((u32 *)&vram[address]), value);
break;
case 0x07:
#ifdef BKPT_SUPPORT
if(*((u32 *)&freezeOAM[address & 0x3fc]))
cheatsWriteMemory(address & 0x70003FC,
value);
else
#endif
WRITE32LE(((u32 *)&oam[address & 0x3fc]), value);
break;
case 0x0D:
if(cpuEEPROMEnabled) {
eepromWrite(address, value);
break;
}
goto unwritable;
case 0x0E:
if(!eepromInUse | cpuSramEnabled | cpuFlashEnabled) {
(*cpuSaveGameFunc)(address, (u8)value);
break;
}
// default
default:
unwritable:
#ifdef DEV_VERSION
if(systemVerbose & VERBOSE_ILLEGAL_WRITE) {
log("Illegal word write: %08x to %08x from %08x\n",
value,
address,
armMode ? armNextPC - 4 : armNextPC - 2);
}
#endif
break;
}
}
#endif //VBA_GBAinline_H

View File

@ -22,7 +22,6 @@ int coeff[32] = {
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16}; 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16};
u32 line0[240]; u32 line0[240];
u32 line1[240]; u32 line1[240];
u32 line2[240]; u32 line2[240];
@ -32,6 +31,7 @@ u32 lineOBJWin[240];
u32 lineMix[240]; u32 lineMix[240];
bool gfxInWin0[240]; bool gfxInWin0[240];
bool gfxInWin1[240]; bool gfxInWin1[240];
int lineOBJpixleft[128];
int gfxBG2Changed = 0; int gfxBG2Changed = 0;
int gfxBG3Changed = 0; int gfxBG3Changed = 0;

3235
src/Gfx.h

File diff suppressed because it is too large Load Diff

View File

@ -16,7 +16,12 @@
// along with this program; if not, write to the Free Software Foundation, // along with this program; if not, write to the Free Software Foundation,
// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "Globals.h" #include "GBA.h"
#ifdef BKPT_SUPPORT
int oldreg[17];
char oldbuffer[10];
#endif
reg_pair reg[45]; reg_pair reg[45];
memoryMap map[256]; memoryMap map[256];
@ -43,8 +48,8 @@ int layerSettings = 0xff00;
int layerEnable = 0xff00; int layerEnable = 0xff00;
bool speedHack = false; bool speedHack = false;
int cpuSaveType = 0; int cpuSaveType = 0;
bool cpuEnhancedDetection = true;
bool cheatsEnabled = true; bool cheatsEnabled = true;
bool mirroringEnable = false;
u8 *bios = NULL; u8 *bios = NULL;
u8 *rom = NULL; u8 *rom = NULL;

View File

@ -57,8 +57,8 @@ extern int layerSettings;
extern int layerEnable; extern int layerEnable;
extern bool speedHack; extern bool speedHack;
extern int cpuSaveType; extern int cpuSaveType;
extern bool cpuEnhancedDetection;
extern bool cheatsEnabled; extern bool cheatsEnabled;
extern bool mirroringEnable;
extern u8 *bios; extern u8 *bios;
extern u8 *rom; extern u8 *rom;

126
src/NLS.h
View File

@ -1,62 +1,64 @@
// -*- C++ -*- // -*- C++ -*-
// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. // VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator.
// Copyright (C) 1999-2003 Forgotten // Copyright (C) 1999-2003 Forgotten
// Copyright (C) 2004 Forgotten and the VBA development team // Copyright (C) 2004 Forgotten and the VBA development team
// This program is free software; you can redistribute it and/or modify // 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 // it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2, or(at your option) // the Free Software Foundation; either version 2, or(at your option)
// any later version. // any later version.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details. // GNU General Public License for more details.
// //
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software Foundation, // along with this program; if not, write to the Free Software Foundation,
// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // 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
#define MSG_CANNOT_LOAD_SGM 2 #define MSG_CANNOT_LOAD_SGM 2
#define MSG_SAVE_GAME_NOT_USING_BIOS 3 #define MSG_SAVE_GAME_NOT_USING_BIOS 3
#define MSG_SAVE_GAME_USING_BIOS 4 #define MSG_SAVE_GAME_USING_BIOS 4
#define MSG_UNSUPPORTED_SAVE_TYPE 5 #define MSG_UNSUPPORTED_SAVE_TYPE 5
#define MSG_CANNOT_OPEN_FILE 6 #define MSG_CANNOT_OPEN_FILE 6
#define MSG_BAD_ARCHIVE_FILE 7 #define MSG_BAD_ZIP_FILE 7
#define MSG_NO_IMAGE_ON_ARCHIVE 8 #define MSG_NO_IMAGE_ON_ZIP 8
#define MSG_ERROR_OPENING_IMAGE 9 #define MSG_ERROR_OPENING_IMAGE 9
#define MSG_ERROR_READING_IMAGE 10 #define MSG_ERROR_READING_IMAGE 10
#define MSG_UNSUPPORTED_BIOS_FUNCTION 11 #define MSG_UNSUPPORTED_BIOS_FUNCTION 11
#define MSG_INVALID_BIOS_FILE_SIZE 12 #define MSG_INVALID_BIOS_FILE_SIZE 12
#define MSG_INVALID_CHEAT_CODE 13 #define MSG_INVALID_CHEAT_CODE 13
#define MSG_UNKNOWN_ARM_OPCODE 14 #define MSG_UNKNOWN_ARM_OPCODE 14
#define MSG_UNKNOWN_THUMB_OPCODE 15 #define MSG_UNKNOWN_THUMB_OPCODE 15
#define MSG_ERROR_CREATING_FILE 16 #define MSG_ERROR_CREATING_FILE 16
#define MSG_FAILED_TO_READ_SGM 17 #define MSG_FAILED_TO_READ_SGM 17
#define MSG_FAILED_TO_READ_RTC 18 #define MSG_FAILED_TO_READ_RTC 18
#define MSG_UNSUPPORTED_VB_SGM 19 #define MSG_UNSUPPORTED_VB_SGM 19
#define MSG_CANNOT_LOAD_SGM_FOR 20 #define MSG_CANNOT_LOAD_SGM_FOR 20
#define MSG_ERROR_OPENING_IMAGE_FROM 21 #define MSG_ERROR_OPENING_IMAGE_FROM 21
#define MSG_ERROR_READING_IMAGE_FROM 22 #define MSG_ERROR_READING_IMAGE_FROM 22
#define MSG_UNSUPPORTED_ROM_SIZE 23 #define MSG_UNSUPPORTED_ROM_SIZE 23
#define MSG_UNSUPPORTED_RAM_SIZE 24 #define MSG_UNSUPPORTED_RAM_SIZE 24
#define MSG_UNKNOWN_CARTRIDGE_TYPE 25 #define MSG_UNKNOWN_CARTRIDGE_TYPE 25
#define MSG_MAXIMUM_NUMBER_OF_CHEATS 26 #define MSG_MAXIMUM_NUMBER_OF_CHEATS 26
#define MSG_INVALID_GAMESHARK_CODE 27 #define MSG_INVALID_GAMESHARK_CODE 27
#define MSG_INVALID_GAMEGENIE_CODE 28 #define MSG_INVALID_GAMEGENIE_CODE 28
#define MSG_INVALID_CHEAT_TO_REMOVE 29 #define MSG_INVALID_CHEAT_TO_REMOVE 29
#define MSG_INVALID_CHEAT_CODE_ADDRESS 30 #define MSG_INVALID_CHEAT_CODE_ADDRESS 30
#define MSG_UNSUPPORTED_CHEAT_LIST_VERSION 31 #define MSG_UNSUPPORTED_CHEAT_LIST_VERSION 31
#define MSG_UNSUPPORTED_CHEAT_LIST_TYPE 32 #define MSG_UNSUPPORTED_CHEAT_LIST_TYPE 32
#define MSG_INVALID_GSA_CODE 33 #define MSG_INVALID_GSA_CODE 33
#define MSG_CANNOT_IMPORT_SNAPSHOT_FOR 34 #define MSG_CANNOT_IMPORT_SNAPSHOT_FOR 34
#define MSG_UNSUPPORTED_SNAPSHOT_FILE 35 #define MSG_UNSUPPORTED_SNAPSHOT_FILE 35
#define MSG_UNSUPPORTED_ARM_MODE 36 #define MSG_UNSUPPORTED_ARM_MODE 36
#define MSG_UNSUPPORTED_CODE_FILE 37 #define MSG_UNSUPPORTED_CODE_FILE 37
#define MSG_GBA_CODE_WARNING 38 #define MSG_GBA_CODE_WARNING 38
#define MSG_INVALID_CBA_CODE 39 #define MSG_INVALID_CBA_CODE 39
#define MSG_CBA_CODE_WARNING 40 #define MSG_CBA_CODE_WARNING 40
#define MSG_OUT_OF_MEMORY 41 #define MSG_OUT_OF_MEMORY 41
#define MSG_WRONG_GAMESHARK_CODE 42
#define MSG_UNSUPPORTED_GAMESHARK_CODE 43

View File

@ -1,220 +1,222 @@
// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. // VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator.
// Copyright (C) 1999-2003 Forgotten // Copyright (C) 1999-2003 Forgotten
// Copyright (C) 2004 Forgotten and the VBA development team // Copyright (C) 2005 Forgotten and the VBA development team
// This program is free software; you can redistribute it and/or modify // 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 // it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2, or(at your option) // the Free Software Foundation; either version 2, or(at your option)
// any later version. // any later version.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details. // GNU General Public License for more details.
// //
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software Foundation, // along with this program; if not, write to the Free Software Foundation,
// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // 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"
#include "Port.h" #include "Port.h"
#include "Util.h" #include "Util.h"
#include "NLS.h" #include "NLS.h"
#include <time.h> #include <time.h>
#include <memory.h> #include <memory.h>
enum RTCSTATE { IDLE, COMMAND, DATA, READDATA }; enum RTCSTATE { IDLE, COMMAND, DATA, READDATA };
typedef struct { typedef struct {
u8 byte0; u8 byte0;
u8 byte1; u8 byte1;
u8 byte2; u8 byte2;
u8 command; u8 command;
int dataLen; int dataLen;
int bits; int bits;
RTCSTATE state; RTCSTATE state;
u8 data[12]; u8 data[12];
// reserved variables for future // reserved variables for future
u8 reserved[12]; u8 reserved[12];
bool reserved2; bool reserved2;
u32 reserved3; u32 reserved3;
} RTCCLOCKDATA; } RTCCLOCKDATA;
static RTCCLOCKDATA rtcClockData; static RTCCLOCKDATA rtcClockData;
static bool rtcEnabled = false; static bool rtcEnabled = false;
void rtcEnable(bool e) void rtcEnable(bool e)
{ {
rtcEnabled = e; rtcEnabled = e;
} }
bool rtcIsEnabled() bool rtcIsEnabled()
{ {
return rtcEnabled; return rtcEnabled;
} }
u16 rtcRead(u32 address) u16 rtcRead(u32 address)
{ {
if(rtcEnabled) { if(rtcEnabled) {
if(address == 0x80000c8) if(address == 0x80000c8)
return rtcClockData.byte2; return rtcClockData.byte2;
else if(address == 0x80000c6) else if(address == 0x80000c6)
return rtcClockData.byte1; return rtcClockData.byte1;
else if(address == 0x80000c4) { else if(address == 0x80000c4) {
return rtcClockData.byte0; return rtcClockData.byte0;
} }
} }
return READ16LE((&rom[address & 0x1FFFFFE])); return READ16LE((&rom[address & 0x1FFFFFE]));
} }
static u8 toBCD(u8 value) static u8 toBCD(u8 value)
{ {
value = value % 100; value = value % 100;
int l = value % 10; int l = value % 10;
int h = value / 10; int h = value / 10;
return h * 16 + l; return h * 16 + l;
} }
bool rtcWrite(u32 address, u16 value) bool rtcWrite(u32 address, u16 value)
{ {
if(!rtcEnabled) if(!rtcEnabled)
return false; return false;
if(address == 0x80000c8) { if(address == 0x80000c8) {
rtcClockData.byte2 = (u8)value; // enable ? rtcClockData.byte2 = (u8)value; // enable ?
} else if(address == 0x80000c6) { } else if(address == 0x80000c6) {
rtcClockData.byte1 = (u8)value; // read/write rtcClockData.byte1 = (u8)value; // read/write
} else if(address == 0x80000c4) { } else if(address == 0x80000c4) {
if(rtcClockData.byte2 & 1) { if(rtcClockData.byte2 & 1) {
if(rtcClockData.state == IDLE && rtcClockData.byte0 == 1 && value == 5) { if(rtcClockData.state == IDLE && rtcClockData.byte0 == 1 && value == 5) {
rtcClockData.state = COMMAND; rtcClockData.state = COMMAND;
rtcClockData.bits = 0; rtcClockData.bits = 0;
rtcClockData.command = 0; rtcClockData.command = 0;
} else if(!(rtcClockData.byte0 & 1) && (value & 1)) { // bit transfer } else if(!(rtcClockData.byte0 & 1) && (value & 1)) { // bit transfer
rtcClockData.byte0 = (u8)value; rtcClockData.byte0 = (u8)value;
switch(rtcClockData.state) { switch(rtcClockData.state) {
case COMMAND: case COMMAND:
rtcClockData.command |= ((value & 2) >> 1) << (7-rtcClockData.bits); rtcClockData.command |= ((value & 2) >> 1) << (7-rtcClockData.bits);
rtcClockData.bits++; rtcClockData.bits++;
if(rtcClockData.bits == 8) { if(rtcClockData.bits == 8) {
rtcClockData.bits = 0; rtcClockData.bits = 0;
switch(rtcClockData.command) { switch(rtcClockData.command) {
case 0x60: case 0x60:
// not sure what this command does but it doesn't take parameters // not sure what this command does but it doesn't take parameters
// maybe it is a reset or stop // maybe it is a reset or stop
rtcClockData.state = IDLE; rtcClockData.state = IDLE;
rtcClockData.bits = 0; rtcClockData.bits = 0;
break; break;
case 0x62: case 0x62:
// this sets the control state but not sure what those values are // this sets the control state but not sure what those values are
rtcClockData.state = READDATA; rtcClockData.state = READDATA;
rtcClockData.dataLen = 1; rtcClockData.dataLen = 1;
break; break;
case 0x63: case 0x63:
rtcClockData.dataLen = 1; rtcClockData.dataLen = 1;
rtcClockData.data[0] = 0x40; rtcClockData.data[0] = 0x40;
rtcClockData.state = DATA; rtcClockData.state = DATA;
break; break;
case 0x65: case 0x64:
{ break;
struct tm *newtime; case 0x65:
time_t long_time; {
struct tm *newtime;
time( &long_time ); /* Get time as long integer. */ time_t long_time;
newtime = localtime( &long_time ); /* Convert to local time. */
time( &long_time ); /* Get time as long integer. */
rtcClockData.dataLen = 7; newtime = localtime( &long_time ); /* Convert to local time. */
rtcClockData.data[0] = toBCD(newtime->tm_year);
rtcClockData.data[1] = toBCD(newtime->tm_mon+1); rtcClockData.dataLen = 7;
rtcClockData.data[2] = toBCD(newtime->tm_mday); rtcClockData.data[0] = toBCD(newtime->tm_year);
rtcClockData.data[3] = toBCD(newtime->tm_wday); rtcClockData.data[1] = toBCD(newtime->tm_mon+1);
rtcClockData.data[4] = toBCD(newtime->tm_hour); rtcClockData.data[2] = toBCD(newtime->tm_mday);
rtcClockData.data[5] = toBCD(newtime->tm_min); rtcClockData.data[3] = toBCD(newtime->tm_wday);
rtcClockData.data[6] = toBCD(newtime->tm_sec); rtcClockData.data[4] = toBCD(newtime->tm_hour);
rtcClockData.state = DATA; rtcClockData.data[5] = toBCD(newtime->tm_min);
} rtcClockData.data[6] = toBCD(newtime->tm_sec);
break; rtcClockData.state = DATA;
case 0x67: }
{ break;
struct tm *newtime; case 0x67:
time_t long_time; {
struct tm *newtime;
time( &long_time ); /* Get time as long integer. */ time_t long_time;
newtime = localtime( &long_time ); /* Convert to local time. */
time( &long_time ); /* Get time as long integer. */
rtcClockData.dataLen = 3; newtime = localtime( &long_time ); /* Convert to local time. */
rtcClockData.data[0] = toBCD(newtime->tm_hour);
rtcClockData.data[1] = toBCD(newtime->tm_min); rtcClockData.dataLen = 3;
rtcClockData.data[2] = toBCD(newtime->tm_sec); rtcClockData.data[0] = toBCD(newtime->tm_hour);
rtcClockData.state = DATA; rtcClockData.data[1] = toBCD(newtime->tm_min);
} rtcClockData.data[2] = toBCD(newtime->tm_sec);
break; rtcClockData.state = DATA;
default: }
systemMessage(0, N_("Unknown RTC command %02x"), rtcClockData.command); break;
rtcClockData.state = IDLE; default:
break; systemMessage(0, N_("Unknown RTC command %02x"), rtcClockData.command);
} rtcClockData.state = IDLE;
} break;
break; }
case DATA: }
if(rtcClockData.byte1 & 2) { break;
} else { case DATA:
rtcClockData.byte0 = (rtcClockData.byte0 & ~2) | if(rtcClockData.byte1 & 2) {
((rtcClockData.data[rtcClockData.bits >> 3] >> } else {
(rtcClockData.bits & 7)) & 1)*2; rtcClockData.byte0 = (rtcClockData.byte0 & ~2) |
rtcClockData.bits++; ((rtcClockData.data[rtcClockData.bits >> 3] >>
if(rtcClockData.bits == 8*rtcClockData.dataLen) { (rtcClockData.bits & 7)) & 1)*2;
rtcClockData.bits = 0; rtcClockData.bits++;
rtcClockData.state = IDLE; if(rtcClockData.bits == 8*rtcClockData.dataLen) {
} rtcClockData.bits = 0;
} rtcClockData.state = IDLE;
break; }
case READDATA: }
if(!(rtcClockData.byte1 & 2)) { break;
} else { case READDATA:
rtcClockData.data[rtcClockData.bits >> 3] = if(!(rtcClockData.byte1 & 2)) {
(rtcClockData.data[rtcClockData.bits >> 3] >> 1) | } else {
((value << 6) & 128); rtcClockData.data[rtcClockData.bits >> 3] =
rtcClockData.bits++; (rtcClockData.data[rtcClockData.bits >> 3] >> 1) |
if(rtcClockData.bits == 8*rtcClockData.dataLen) { ((value << 6) & 128);
rtcClockData.bits = 0; rtcClockData.bits++;
rtcClockData.state = IDLE; if(rtcClockData.bits == 8*rtcClockData.dataLen) {
} rtcClockData.bits = 0;
} rtcClockData.state = IDLE;
break; }
default: }
break; break;
} default:
} else break;
rtcClockData.byte0 = (u8)value; }
} } else
} rtcClockData.byte0 = (u8)value;
return true; }
} }
return true;
void rtcReset() }
{
memset(&rtcClockData, 0, sizeof(rtcClockData)); void rtcReset()
{
rtcClockData.byte0 = 0; memset(&rtcClockData, 0, sizeof(rtcClockData));
rtcClockData.byte1 = 0;
rtcClockData.byte2 = 0; rtcClockData.byte0 = 0;
rtcClockData.command = 0; rtcClockData.byte1 = 0;
rtcClockData.dataLen = 0; rtcClockData.byte2 = 0;
rtcClockData.bits = 0; rtcClockData.command = 0;
rtcClockData.state = IDLE; rtcClockData.dataLen = 0;
} rtcClockData.bits = 0;
rtcClockData.state = IDLE;
void rtcSaveGame(gzFile gzFile) }
{
utilGzWrite(gzFile, &rtcClockData, sizeof(rtcClockData)); void rtcSaveGame(gzFile gzFile)
} {
utilGzWrite(gzFile, &rtcClockData, sizeof(rtcClockData));
void rtcReadGame(gzFile gzFile) }
{
utilGzRead(gzFile, &rtcClockData, sizeof(rtcClockData)); void rtcReadGame(gzFile gzFile)
} {
utilGzRead(gzFile, &rtcClockData, sizeof(rtcClockData));
}

View File

@ -659,40 +659,17 @@ void soundChannel4()
{ {
} }
#include <stdio.h>
inline void soundDirectSoundA() inline void soundDirectSoundA()
{ {
#ifdef ENHANCED_RATE
double cr = calc_rate(soundDSATimer);
static int cnt = 0;
static double lastcr = 0;
static FILE *fp = NULL;
if (fp==NULL)
fp=fopen("C:\\cr.txt", "at");
if (cr!=lastcr)
{
fprintf(fp, "%f %d\n", lastcr, cnt);
cnt=0;
lastcr=cr;
}
else
cnt++;
directBuffer[0][soundIndex] = interp_pop(0, calc_rate(soundDSATimer)); //soundDSAValue;
#else
directBuffer[0][soundIndex] = interp_pop(0); //soundDSAValue; directBuffer[0][soundIndex] = interp_pop(0); //soundDSAValue;
#endif
} }
void soundDirectSoundATimer() void soundDirectSoundATimer()
{ {
if(soundDSAEnabled) { if(soundDSAEnabled) {
if(soundDSFifoACount <= 16) { if(soundDSFifoACount <= 16) {
cpuDmaHack2 = CPUCheckDMA(3, 2); CPUCheckDMA(3, 2);
if(soundDSFifoACount <= 16) { if(soundDSFifoACount <= 16) {
soundEvent(FIFOA_L, (u16)0); soundEvent(FIFOA_L, (u16)0);
soundEvent(FIFOA_H, (u16)0); soundEvent(FIFOA_H, (u16)0);
@ -714,18 +691,15 @@ void soundDirectSoundATimer()
inline void soundDirectSoundB() inline void soundDirectSoundB()
{ {
#ifdef ENHANCED_RATE
directBuffer[1][soundIndex] = interp_pop(1, calc_rate(soundDSBTimer)); //soundDSBValue;
#else
directBuffer[1][soundIndex] = interp_pop(1); //soundDSBValue; directBuffer[1][soundIndex] = interp_pop(1); //soundDSBValue;
#endif
} }
void soundDirectSoundBTimer() void soundDirectSoundBTimer()
{ {
if(soundDSBEnabled) { if(soundDSBEnabled) {
if(soundDSFifoBCount <= 16) { if(soundDSFifoBCount <= 16) {
cpuDmaHack2 = CPUCheckDMA(3, 4); //cpuDmaHack2 =
CPUCheckDMA(3, 4);
if(soundDSFifoBCount <= 16) { if(soundDSFifoBCount <= 16) {
soundEvent(FIFOB_L, (u16)0); soundEvent(FIFOB_L, (u16)0);
soundEvent(FIFOB_H, (u16)0); soundEvent(FIFOB_H, (u16)0);

View File

@ -2,6 +2,7 @@
// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. // VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator.
// Copyright (C) 1999-2003 Forgotten // Copyright (C) 1999-2003 Forgotten
// Copyright (C) 2004 Forgotten and the VBA development team // Copyright (C) 2004 Forgotten and the VBA development team
// Copyright (C) 2004-2006 VBA development team
// This program is free software; you can redistribute it and/or modify // 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 // it under the terms of the GNU General Public License as published by
@ -95,7 +96,6 @@ extern Multi_Buffer * apu_out;
extern Gb_Apu * apu; extern Gb_Apu * apu;
extern const BOOST::uint8_t sound_data [Gb_Apu::register_count]; extern const BOOST::uint8_t sound_data [Gb_Apu::register_count];
extern void interp_rate(); extern void interp_rate();

View File

@ -1,39 +1,39 @@
// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. // VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator.
// Copyright (C) 1999-2003 Forgotten // Copyright (C) 1999-2003 Forgotten
// Copyright (C) 2004 Forgotten and the VBA development team // Copyright (C) 2004 Forgotten and the VBA development team
// This program is free software; you can redistribute it and/or modify // 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 // it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2, or(at your option) // the Free Software Foundation; either version 2, or(at your option)
// any later version. // any later version.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details. // GNU General Public License for more details.
// //
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software Foundation, // along with this program; if not, write to the Free Software Foundation,
// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // 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"
#include "Sram.h" #include "Sram.h"
u8 sramRead(u32 address) u8 sramRead(u32 address)
{ {
return flashSaveMemory[address & 0xFFFF]; return flashSaveMemory[address & 0xFFFF];
} }
void sramDelayedWrite(u32 address, u8 byte) void sramDelayedWrite(u32 address, u8 byte)
{ {
saveType = 1; saveType = 1;
cpuSaveGameFunc = sramWrite; cpuSaveGameFunc = sramWrite;
sramWrite(address, byte); sramWrite(address, byte);
} }
void sramWrite(u32 address, u8 byte) void sramWrite(u32 address, u8 byte)
{ {
flashSaveMemory[address & 0xFFFF] = byte; flashSaveMemory[address & 0xFFFF] = byte;
systemSaveUpdateCounter = SYSTEM_SAVE_UPDATED; systemSaveUpdateCounter = SYSTEM_SAVE_UPDATED;
} }

View File

@ -1,27 +1,27 @@
// -*- C++ -*- // -*- C++ -*-
// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. // VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator.
// Copyright (C) 1999-2003 Forgotten // Copyright (C) 1999-2003 Forgotten
// Copyright (C) 2004 Forgotten and the VBA development team // Copyright (C) 2004 Forgotten and the VBA development team
// This program is free software; you can redistribute it and/or modify // 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 // it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2, or(at your option) // the Free Software Foundation; either version 2, or(at your option)
// any later version. // any later version.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details. // GNU General Public License for more details.
// //
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software Foundation, // along with this program; if not, write to the Free Software Foundation,
// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#ifndef VBA_SRAM_H #ifndef VBA_SRAM_H
#define VBA_SRAM_H #define VBA_SRAM_H
extern u8 sramRead(u32 address); extern u8 sramRead(u32 address);
extern void sramWrite(u32 address, u8 byte); extern void sramWrite(u32 address, u8 byte);
extern void sramDelayedWrite(u32 address, u8 byte); extern void sramDelayedWrite(u32 address, u8 byte);
#endif // VBA_SRAM_H #endif // VBA_SRAM_H

View File

@ -106,6 +106,12 @@ extern void system10Frames(int);
extern void systemFrame(); extern void systemFrame();
extern void systemGbBorderOn(); extern void systemGbBorderOn();
extern void Sm60FPS_Init();
extern bool Sm60FPS_CanSkipFrame();
extern void Sm60FPS_Sleep();
extern void DbgMsg(const char *msg, ...);
extern void winlog(const char *,...);
extern bool systemSoundOn; extern bool systemSoundOn;
extern u16 systemColorMap16[0x10000]; extern u16 systemColorMap16[0x10000];
extern u32 systemColorMap32[0x10000]; extern u32 systemColorMap32[0x10000];
@ -118,6 +124,7 @@ extern int systemDebug;
extern int systemVerbose; extern int systemVerbose;
extern int systemFrameSkip; extern int systemFrameSkip;
extern int systemSaveUpdateCounter; extern int systemSaveUpdateCounter;
extern int systemSpeed;
#define SYSTEM_SAVE_UPDATED 30 #define SYSTEM_SAVE_UPDATED 30
#define SYSTEM_SAVE_NOT_UPDATED 0 #define SYSTEM_SAVE_NOT_UPDATED 0

File diff suppressed because it is too large Load Diff

View File

@ -1,65 +1,65 @@
// -*- C++ -*- // -*- C++ -*-
// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. // VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator.
// Copyright (C) 1999-2003 Forgotten // Copyright (C) 1999-2003 Forgotten
// Copyright (C) 2004 Forgotten and the VBA development team // Copyright (C) 2004 Forgotten and the VBA development team
// This program is free software; you can redistribute it and/or modify // 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 // it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2, or(at your option) // the Free Software Foundation; either version 2, or(at your option)
// any later version. // any later version.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details. // GNU General Public License for more details.
// //
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software Foundation, // along with this program; if not, write to the Free Software Foundation,
// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#ifndef VBA_UTIL_H #ifndef VBA_UTIL_H
#define VBA_UTIL_H #define VBA_UTIL_H
enum IMAGE_TYPE { enum IMAGE_TYPE {
IMAGE_UNKNOWN = -1, IMAGE_UNKNOWN = -1,
IMAGE_GBA = 0, IMAGE_GBA = 0,
IMAGE_GB = 1 IMAGE_GB = 1
}; };
// save game // save game
typedef struct { typedef struct {
void *address; void *address;
int size; int size;
} variable_desc; } variable_desc;
extern bool utilWritePNGFile(const char *, int, int, u8 *); extern bool utilWritePNGFile(const char *, int, int, u8 *);
extern bool utilWriteBMPFile(const char *, int, int, u8 *); extern bool utilWriteBMPFile(const char *, int, int, u8 *);
extern void utilApplyIPS(const char *ips, u8 **rom, int *size); extern void utilApplyIPS(const char *ips, u8 **rom, int *size);
extern void utilWriteBMP(char *, int, int, u8 *); extern void utilWriteBMP(char *, int, int, u8 *);
extern bool utilIsGBAImage(const char *); extern bool utilIsGBAImage(const char *);
extern bool utilIsGBImage(const char *); extern bool utilIsGBImage(const char *);
extern bool utilIsZipFile(const char *); extern bool utilIsZipFile(const char *);
extern bool utilIsGzipFile(const char *); extern bool utilIsGzipFile(const char *);
extern bool utilIsRarFile(const char *); extern bool utilIsRarFile(const char *);
extern void utilGetBaseName(const char *, char *); extern void utilGetBaseName(const char *, char *);
extern IMAGE_TYPE utilFindType(const char *); extern IMAGE_TYPE utilFindType(const char *);
extern u8 *utilLoad(const char *, extern u8 *utilLoad(const char *,
bool (*)(const char*), bool (*)(const char*),
u8 *, u8 *,
int &); int &);
extern void utilPutDword(u8 *, u32); extern void utilPutDword(u8 *, u32);
extern void utilPutWord(u8 *, u16); extern void utilPutWord(u8 *, u16);
extern void utilWriteData(gzFile, variable_desc *); extern void utilWriteData(gzFile, variable_desc *);
extern void utilReadData(gzFile, variable_desc *); extern void utilReadData(gzFile, variable_desc *);
extern int utilReadInt(gzFile); extern int utilReadInt(gzFile);
extern void utilWriteInt(gzFile, int); extern void utilWriteInt(gzFile, int);
extern gzFile utilGzOpen(const char *file, const char *mode); extern gzFile utilGzOpen(const char *file, const char *mode);
extern gzFile utilMemGzOpen(char *memory, int available, char *mode); extern gzFile utilMemGzOpen(char *memory, int available, char *mode);
extern int utilGzWrite(gzFile file, const voidp buffer, unsigned int len); extern int utilGzWrite(gzFile file, const voidp buffer, unsigned int len);
extern int utilGzRead(gzFile file, voidp buffer, unsigned int len); extern int utilGzRead(gzFile file, voidp buffer, unsigned int len);
extern int utilGzClose(gzFile file); extern int utilGzClose(gzFile file);
extern long utilGzMemTell(gzFile file); extern long utilGzMemTell(gzFile file);
extern void utilGBAFindSave(const u8 *, const int); extern void utilGBAFindSave(const u8 *, const int);
extern void utilUpdateSystemColorMaps(int lcd); extern void utilUpdateSystemColorMaps();
#endif #endif

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,6 @@
// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. // VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator.
// Copyright (C) 1999-2003 Forgotten // Copyright (C) 1999-2003 Forgotten
// Copyright (C) 2004 Forgotten and the VBA development team // Copyright (C) 2005 Forgotten and the VBA development team
// This program is free software; you can redistribute it and/or modify // 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 // it under the terms of the GNU General Public License as published by
@ -117,8 +117,8 @@ const Opcodes thumbOpcodes[] = {
{0xfa00, 0x5800, "ldr%b %r0, [%r3, %r6]"}, {0xfa00, 0x5800, "ldr%b %r0, [%r3, %r6]"},
// Format 8 // Format 8
{0xfe00, 0x5200, "strh %r0, [%r3, %r6]"}, {0xfe00, 0x5200, "strh %r0, [%r3, %r6]"},
{0xfe00, 0x5600, "ldrh %r0, [%r3, %r6]"}, {0xfe00, 0x5600, "ldsb %r0, [%r3, %r6]"},
{0xfe00, 0x5a00, "ldsb %r0, [%r3, %r6]"}, {0xfe00, 0x5a00, "ldrh %r0, [%r3, %r6]"},
{0xfe00, 0x5e00, "ldsh %r0, [%r3, %r6]"}, {0xfe00, 0x5e00, "ldsh %r0, [%r3, %r6]"},
// Format 9 // Format 9
{0xe800, 0x6000, "str%B %r0, [%r3, %p]"}, {0xe800, 0x6000, "str%B %r0, [%r3, %p]"},

File diff suppressed because it is too large Load Diff

View File

@ -1,7 +1,7 @@
// -*- C++ -*- // -*- C++ -*-
// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. // VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator.
// Copyright (C) 1999-2003 Forgotten // Copyright (C) 1999-2003 Forgotten
// Copyright (C) 2004 Forgotten and the VBA development team // Copyright (C) 2004-2006 Forgotten and the VBA development team
// This program is free software; you can redistribute it and/or modify // 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 // it under the terms of the GNU General Public License as published by
@ -23,6 +23,7 @@
extern void BIOS_ArcTan(); extern void BIOS_ArcTan();
extern void BIOS_ArcTan2(); extern void BIOS_ArcTan2();
extern void BIOS_BitUnPack(); extern void BIOS_BitUnPack();
extern void BIOS_GetBiosChecksum();
extern void BIOS_BgAffineSet(); extern void BIOS_BgAffineSet();
extern void BIOS_CpuSet(); extern void BIOS_CpuSet();
extern void BIOS_CpuFastSet(); extern void BIOS_CpuFastSet();

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,7 +1,7 @@
// -*- C++ -*- // -*- C++ -*-
// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. // VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator.
// Copyright (C) 1999-2003 Forgotten // Copyright (C) 1999-2003 Forgotten
// Copyright (C) 2004 Forgotten and the VBA development team // Copyright (C) 2005-2006 Forgotten and the VBA development team
// This program is free software; you can redistribute it and/or modify // 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 // it under the terms of the GNU General Public License as published by
@ -38,11 +38,15 @@ typedef union {
extern bool gbLoadRom(const char *); extern bool gbLoadRom(const char *);
extern void gbEmulate(int); extern void gbEmulate(int);
extern void gbWriteMemory(register u16, register u8);
extern void gbDrawLine();
extern bool gbIsGameboyRom(const char *); extern bool gbIsGameboyRom(const char *);
extern void gbSoundReset(); extern void gbSoundReset();
extern void gbSoundSetQuality(int); extern void gbSoundSetQuality(int);
extern void gbGetHardwareType();
extern void gbReset(); extern void gbReset();
extern void gbCleanUp(); extern void gbCleanUp();
extern void gbCPUInit(const char *,bool);
extern bool gbWriteBatteryFile(const char *); extern bool gbWriteBatteryFile(const char *);
extern bool gbWriteBatteryFile(const char *, bool); extern bool gbWriteBatteryFile(const char *, bool);
extern bool gbReadBatteryFile(const char *); extern bool gbReadBatteryFile(const char *);

View File

@ -1,6 +1,6 @@
// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. // VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator.
// Copyright (C) 1999-2003 Forgotten // Copyright (C) 1999-2003 Forgotten
// Copyright (C) 2004 Forgotten and the VBA development team // Copyright (C) 2005 Forgotten and the VBA development team
// This program is free software; you can redistribute it and/or modify // 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 // it under the terms of the GNU General Public License as published by
@ -27,9 +27,11 @@
#include "gbCheats.h" #include "gbCheats.h"
#include "gbGlobals.h" #include "gbGlobals.h"
#include "GB.h"
gbCheat gbCheatList[100]; gbCheat gbCheatList[100];
int gbCheatNumber = 0; int gbCheatNumber = 0;
int gbNextCheat = 0;
bool gbCheatMap[0x10000]; bool gbCheatMap[0x10000];
extern bool cheatsEnabled; extern bool cheatsEnabled;
@ -50,7 +52,7 @@ void gbCheatUpdateMap()
void gbCheatsSaveGame(gzFile gzFile) void gbCheatsSaveGame(gzFile gzFile)
{ {
utilWriteInt(gzFile, gbCheatNumber); utilWriteInt(gzFile, gbCheatNumber);
if(gbCheatNumber) if(gbCheatNumber>0)
utilGzWrite(gzFile, &gbCheatList[0], sizeof(gbCheat)*gbCheatNumber); utilGzWrite(gzFile, &gbCheatList[0], sizeof(gbCheat)*gbCheatNumber);
} }
@ -81,7 +83,7 @@ void gbCheatsReadGame(gzFile gzFile, int version)
} else { } else {
gbCheatNumber = utilReadInt(gzFile); gbCheatNumber = utilReadInt(gzFile);
if(gbCheatNumber) { if(gbCheatNumber>0) {
utilGzRead(gzFile, &gbCheatList[0], sizeof(gbCheat)*gbCheatNumber); utilGzRead(gzFile, &gbCheatList[0], sizeof(gbCheat)*gbCheatNumber);
} }
} }
@ -163,7 +165,7 @@ bool gbCheatsLoadCheatList(const char *file)
bool gbVerifyGsCode(const char *code) bool gbVerifyGsCode(const char *code)
{ {
int len = strlen(code); size_t len = strlen(code);
if(len == 0) if(len == 0)
return true; return true;
@ -180,10 +182,6 @@ bool gbVerifyGsCode(const char *code)
GBCHEAT_HEX_VALUE(code[4]) << 4 | GBCHEAT_HEX_VALUE(code[4]) << 4 |
GBCHEAT_HEX_VALUE(code[5]); GBCHEAT_HEX_VALUE(code[5]);
if(address < 0xa000 ||
address > 0xdfff)
return false;
return true; return true;
} }
@ -220,15 +218,23 @@ void gbAddGsCheat(const char *code, const char *desc)
gbCheatList[i].compare = 0; gbCheatList[i].compare = 0;
gbCheatList[i].enabled = true; gbCheatList[i].enabled = true;
gbCheatMap[gbCheatList[i].address] = true; int gsCode = gbCheatList[i].code;
if ((gsCode !=1) && ((gsCode & 0xF0) !=0x80) && ((gsCode & 0xF0) !=0x90) &&
((gsCode & 0xF0) !=0xA0) && ((gsCode) !=0xF0) && ((gsCode) !=0xF1))
systemMessage(MSG_WRONG_GAMESHARK_CODE,
N_("Wrong GameShark code type : %s"), code);
else if (((gsCode & 0xF0) ==0xA0) || ((gsCode) ==0xF0) || ((gsCode) ==0xF1))
systemMessage(MSG_UNSUPPORTED_GAMESHARK_CODE,
N_("Unsupported GameShark code type : %s"), code);
gbCheatNumber++; gbCheatNumber++;
} }
bool gbVerifyGgCode(const char *code) bool gbVerifyGgCode(const char *code)
{ {
int len = strlen(code); size_t len = strlen(code);
if(len != 11 && if(len != 11 &&
len != 7 && len != 7 &&
@ -313,12 +319,12 @@ void gbAddGgCheat(const char *code, const char *desc)
int i = gbCheatNumber; int i = gbCheatNumber;
int len = strlen(code); size_t len = strlen(code);
strcpy(gbCheatList[i].cheatCode, code); strcpy(gbCheatList[i].cheatCode, code);
strcpy(gbCheatList[i].cheatDesc, desc); strcpy(gbCheatList[i].cheatDesc, desc);
gbCheatList[i].code = 1; gbCheatList[i].code = 0x101;
gbCheatList[i].value = (GBCHEAT_HEX_VALUE(code[0]) << 4) + gbCheatList[i].value = (GBCHEAT_HEX_VALUE(code[0]) << 4) +
GBCHEAT_HEX_VALUE(code[1]); GBCHEAT_HEX_VALUE(code[1]);
@ -338,9 +344,12 @@ void gbAddGgCheat(const char *code, const char *desc)
compare ^= 0x45; compare ^= 0x45;
gbCheatList[i].compare = compare; gbCheatList[i].compare = compare;
gbCheatList[i].code = 0; //gbCheatList[i].code = 0;
gbCheatList[i].code = 0x100; // fix for compare value
} }
gbCheatList[i].enabled = true; gbCheatList[i].enabled = true;
gbCheatMap[gbCheatList[i].address] = true; gbCheatMap[gbCheatList[i].address] = true;
@ -425,6 +434,7 @@ bool gbCheatReadGSCodeFile(const char *fileName)
return true; return true;
} }
// Used to emulated GG codes
u8 gbCheatRead(u16 address) u8 gbCheatRead(u16 address)
{ {
if(!cheatsEnabled) if(!cheatsEnabled)
@ -437,26 +447,72 @@ u8 gbCheatRead(u16 address)
if(gbMemoryMap[address>>12][address&0xFFF] == gbCheatList[i].compare) if(gbMemoryMap[address>>12][address&0xFFF] == gbCheatList[i].compare)
return gbCheatList[i].value; return gbCheatList[i].value;
break; break;
case 0x00: case 0x101: // GameGenie 6 digits code support
case 0x01:
case 0x80:
return gbCheatList[i].value;
case 0x90:
case 0x91:
case 0x92:
case 0x93:
case 0x94:
case 0x95:
case 0x96:
case 0x97:
if(address >= 0xd000 && address < 0xe000) {
if(((gbMemoryMap[0x0d] - gbWram)/0x1000) ==
(gbCheatList[i].code - 0x90))
return gbCheatList[i].value;
} else
return gbCheatList[i].value; return gbCheatList[i].value;
break;
} }
} }
} }
return gbMemoryMap[address>>12][address&0xFFF]; return gbMemoryMap[address>>12][address&0xFFF];
} }
// Used to emulate GS codes.
void gbCheatWrite(bool reboot)
{
if(cheatsEnabled)
{
u16 address = 0;
if (gbNextCheat >= gbCheatNumber)
gbNextCheat = 0;
for(int i = gbNextCheat; i < gbCheatNumber; i++) {
if(gbCheatList[i].enabled) {
address = gbCheatList[i].address;
if ((!reboot) && (address >= 0x8000) && !((address>=0xA000) && (address<0xC000)))
{ // These codes are executed one per one, at each Vblank
switch(gbCheatList[i].code) {
case 0x01:
gbWriteMemory(address, gbCheatList[i].value);
gbNextCheat = i+1;
return;
case 0x90:
case 0x91:
case 0x92:
case 0x93:
case 0x94:
case 0x95:
case 0x96:
case 0x97:
case 0x98:
case 0x99:
case 0x9A:
case 0x9B:
case 0x9C:
case 0x9D:
case 0x9E:
case 0x9F:
int oldbank = gbMemory[0xff70];
gbWriteMemory(0xff70, gbCheatList[i].code & 0xf);
gbWriteMemory(address, gbCheatList[i].value);
gbWriteMemory(0xff70, oldbank);
gbNextCheat = i+1;
return;
}
}
else // These codes are only executed when the game is booted
{
switch(gbCheatList[i].code & 0xF0) {
case 0x80:
gbWriteMemory(0x0000, 0x0A);
gbWriteMemory(0x4000, gbCheatList[i].value & 0xF);
gbWriteMemory(address, gbCheatList[i].value);
gbNextCheat = i+1;
return;
}
}
}
}
}
}

View File

@ -50,6 +50,7 @@ extern void gbCheatRemoveAll();
extern void gbCheatEnable(int); extern void gbCheatEnable(int);
extern void gbCheatDisable(int); extern void gbCheatDisable(int);
extern u8 gbCheatRead(u16); extern u8 gbCheatRead(u16);
extern void gbCheatWrite(bool);
extern int gbCheatNumber; extern int gbCheatNumber;
extern gbCheat gbCheatList[100]; extern gbCheat gbCheatList[100];

View File

@ -1,7 +1,7 @@
// -*- C++ -*- // -*- C++ -*-
// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. // VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator.
// Copyright (C) 1999-2003 Forgotten // Copyright (C) 1999-2003 Forgotten
// Copyright (C) 2004 Forgotten and the VBA development team // Copyright (C) 2005-2006 Forgotten and the VBA development team
// This program is free software; you can redistribute it and/or modify // 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 // it under the terms of the GNU General Public License as published by
@ -22,8 +22,8 @@
break; break;
case 0x01: case 0x01:
// LD BC, NNNN // LD BC, NNNN
BC.B.B0=gbReadMemory(PC.W++); BC.B.B0=gbReadOpcode(PC.W++);
BC.B.B1=gbReadMemory(PC.W++); BC.B.B1=gbReadOpcode(PC.W++);
break; break;
case 0x02: case 0x02:
// LD (BC),A // LD (BC),A
@ -102,7 +102,9 @@
opcode = gbReadOpcode(PC.W++); opcode = gbReadOpcode(PC.W++);
if(gbCgbMode) { if(gbCgbMode) {
if(gbMemory[0xff4d] & 1) { if(gbMemory[0xff4d] & 1) {
gbSpeedSwitch(); gbSpeedSwitch();
//clockTicks += 228*144-(gbSpeed ? 62 : 63);
if(gbSpeed == 0) if(gbSpeed == 0)
gbMemory[0xff4d] = 0x00; gbMemory[0xff4d] = 0x00;
@ -113,8 +115,8 @@
break; break;
case 0x11: case 0x11:
// LD DE, NNNN // LD DE, NNNN
DE.B.B0=gbReadMemory(PC.W++); DE.B.B0=gbReadOpcode(PC.W++);
DE.B.B1=gbReadMemory(PC.W++); DE.B.B1=gbReadOpcode(PC.W++);
break; break;
case 0x12: case 0x12:
// LD (DE),A // LD (DE),A
@ -147,7 +149,7 @@
break; break;
case 0x18: case 0x18:
// JR NN // JR NN
PC.W+=(s8)gbReadMemory(PC.W)+1; PC.W+=(s8)gbReadOpcode(PC.W)+1;
break; break;
case 0x19: case 0x19:
// ADD HL,DE // ADD HL,DE
@ -190,14 +192,14 @@
if(AF.B.B0&Z_FLAG) if(AF.B.B0&Z_FLAG)
PC.W++; PC.W++;
else { else {
PC.W+=(s8)gbReadMemory(PC.W)+1; PC.W+=(s8)gbReadOpcode(PC.W)+1;
clockTicks++; clockTicks++;
} }
break; break;
case 0x21: case 0x21:
// LD HL,NNNN // LD HL,NNNN
HL.B.B0=gbReadMemory(PC.W++); HL.B.B0=gbReadOpcode(PC.W++);
HL.B.B1=gbReadMemory(PC.W++); HL.B.B1=gbReadOpcode(PC.W++);
break; break;
case 0x22: case 0x22:
// LDI (HL),A // LDI (HL),A
@ -233,7 +235,7 @@
case 0x28: case 0x28:
// JR Z,NN // JR Z,NN
if(AF.B.B0&Z_FLAG) { if(AF.B.B0&Z_FLAG) {
PC.W+=(s8)gbReadMemory(PC.W)+1; PC.W+=(s8)gbReadOpcode(PC.W)+1;
clockTicks++; clockTicks++;
} else } else
PC.W++; PC.W++;
@ -278,14 +280,14 @@
if(AF.B.B0&C_FLAG) if(AF.B.B0&C_FLAG)
PC.W++; PC.W++;
else { else {
PC.W+=(s8)gbReadMemory(PC.W)+1; PC.W+=(s8)gbReadOpcode(PC.W)+1;
clockTicks++; clockTicks++;
} }
break; break;
case 0x31: case 0x31:
// LD SP,NNNN // LD SP,NNNN
SP.B.B0=gbReadMemory(PC.W++); SP.B.B0=gbReadOpcode(PC.W++);
SP.B.B1=gbReadMemory(PC.W++); SP.B.B1=gbReadOpcode(PC.W++);
break; break;
case 0x32: case 0x32:
// LDD (HL),A // LDD (HL),A
@ -318,7 +320,7 @@
case 0x38: case 0x38:
// JR C,NN // JR C,NN
if(AF.B.B0&C_FLAG) { if(AF.B.B0&C_FLAG) {
PC.W+=(s8)gbReadMemory(PC.W)+1; PC.W+=(s8)gbReadOpcode(PC.W)+1;
clockTicks ++; clockTicks ++;
} else } else
PC.W++; PC.W++;
@ -575,16 +577,24 @@ case 0x38:
break; break;
case 0x76: case 0x76:
// HALT // HALT
if(IFF & 1) { // If an EI is pending, the interrupts are triggered before Halt state !!
// Fix Torpedo Range's intro.
if (IFF & 0x40)
{
IFF &= ~0x70;
IFF |=1;
PC.W--; PC.W--;
IFF |= 0x80; }
} else { else
if((register_IE & register_IF) > 0) {
IFF |= 0x100; // if (IE & IF) and interrupts are disabeld,
else { // Halt is cancelled.
PC.W--; if ((register_IE & register_IF & 0x1f) && !(IFF & 1))
IFF |= 0x81; {
IFF|=2;
} }
else
IFF |= 0x80;
} }
break; break;
case 0x77: case 0x77:
@ -1036,16 +1046,16 @@ case 0x38:
if(AF.B.B0&Z_FLAG) if(AF.B.B0&Z_FLAG)
PC.W+=2; PC.W+=2;
else { else {
tempRegister.B.B0=gbReadMemory(PC.W++); tempRegister.B.B0=gbReadOpcode(PC.W++);
tempRegister.B.B1=gbReadMemory(PC.W); tempRegister.B.B1=gbReadOpcode(PC.W);
PC.W=tempRegister.W; PC.W=tempRegister.W;
clockTicks++; clockTicks++;
} }
break; break;
case 0xc3: case 0xc3:
// JP NNNN // JP NNNN
tempRegister.B.B0=gbReadMemory(PC.W++); tempRegister.B.B0=gbReadOpcode(PC.W++);
tempRegister.B.B1=gbReadMemory(PC.W); tempRegister.B.B1=gbReadOpcode(PC.W);
PC.W=tempRegister.W; PC.W=tempRegister.W;
break; break;
case 0xc4: case 0xc4:
@ -1053,8 +1063,8 @@ case 0x38:
if(AF.B.B0&Z_FLAG) if(AF.B.B0&Z_FLAG)
PC.W+=2; PC.W+=2;
else { else {
tempRegister.B.B0=gbReadMemory(PC.W++); tempRegister.B.B0=gbReadOpcode(PC.W++);
tempRegister.B.B1=gbReadMemory(PC.W++); tempRegister.B.B1=gbReadOpcode(PC.W++);
gbWriteMemory(--SP.W,PC.B.B1); gbWriteMemory(--SP.W,PC.B.B1);
gbWriteMemory(--SP.W,PC.B.B0); gbWriteMemory(--SP.W,PC.B.B0);
PC.W=tempRegister.W; PC.W=tempRegister.W;
@ -1096,8 +1106,8 @@ case 0x38:
case 0xca: case 0xca:
// JP Z,NNNN // JP Z,NNNN
if(AF.B.B0&Z_FLAG) { if(AF.B.B0&Z_FLAG) {
tempRegister.B.B0=gbReadMemory(PC.W++); tempRegister.B.B0=gbReadOpcode(PC.W++);
tempRegister.B.B1=gbReadMemory(PC.W); tempRegister.B.B1=gbReadOpcode(PC.W);
PC.W=tempRegister.W; PC.W=tempRegister.W;
clockTicks++; clockTicks++;
} else } else
@ -1107,8 +1117,8 @@ case 0x38:
case 0xcc: case 0xcc:
// CALL Z,NNNN // CALL Z,NNNN
if(AF.B.B0&Z_FLAG) { if(AF.B.B0&Z_FLAG) {
tempRegister.B.B0=gbReadMemory(PC.W++); tempRegister.B.B0=gbReadOpcode(PC.W++);
tempRegister.B.B1=gbReadMemory(PC.W++); tempRegister.B.B1=gbReadOpcode(PC.W++);
gbWriteMemory(--SP.W,PC.B.B1); gbWriteMemory(--SP.W,PC.B.B1);
gbWriteMemory(--SP.W,PC.B.B0); gbWriteMemory(--SP.W,PC.B.B0);
PC.W=tempRegister.W; PC.W=tempRegister.W;
@ -1118,8 +1128,8 @@ case 0x38:
break; break;
case 0xcd: case 0xcd:
// CALL NNNN // CALL NNNN
tempRegister.B.B0=gbReadMemory(PC.W++); tempRegister.B.B0=gbReadOpcode(PC.W++);
tempRegister.B.B1=gbReadMemory(PC.W++); tempRegister.B.B1=gbReadOpcode(PC.W++);
gbWriteMemory(--SP.W,PC.B.B1); gbWriteMemory(--SP.W,PC.B.B1);
gbWriteMemory(--SP.W,PC.B.B0); gbWriteMemory(--SP.W,PC.B.B0);
PC.W=tempRegister.W; PC.W=tempRegister.W;
@ -1156,20 +1166,24 @@ case 0x38:
if(AF.B.B0&C_FLAG) if(AF.B.B0&C_FLAG)
PC.W+=2; PC.W+=2;
else { else {
tempRegister.B.B0=gbReadMemory(PC.W++); tempRegister.B.B0=gbReadOpcode(PC.W++);
tempRegister.B.B1=gbReadMemory(PC.W); tempRegister.B.B1=gbReadOpcode(PC.W);
PC.W=tempRegister.W; PC.W=tempRegister.W;
clockTicks++; clockTicks++;
} }
break; break;
// D3 illegal // D3 illegal
case 0xd3:
PC.W--;
IFF = 0;
break;
case 0xd4: case 0xd4:
// CALL NC,NNNN // CALL NC,NNNN
if(AF.B.B0&C_FLAG) if(AF.B.B0&C_FLAG)
PC.W+=2; PC.W+=2;
else { else {
tempRegister.B.B0=gbReadMemory(PC.W++); tempRegister.B.B0=gbReadOpcode(PC.W++);
tempRegister.B.B1=gbReadMemory(PC.W++); tempRegister.B.B1=gbReadOpcode(PC.W++);
gbWriteMemory(--SP.W,PC.B.B1); gbWriteMemory(--SP.W,PC.B.B1);
gbWriteMemory(--SP.W,PC.B.B0); gbWriteMemory(--SP.W,PC.B.B0);
PC.W=tempRegister.W; PC.W=tempRegister.W;
@ -1200,7 +1214,7 @@ case 0x38:
if(AF.B.B0&C_FLAG) { if(AF.B.B0&C_FLAG) {
PC.B.B0=gbReadMemory(SP.W++); PC.B.B0=gbReadMemory(SP.W++);
PC.B.B1=gbReadMemory(SP.W++); PC.B.B1=gbReadMemory(SP.W++);
clockTicks += 4; clockTicks += 3;
} }
break; break;
case 0xd9: case 0xd9:
@ -1212,19 +1226,23 @@ case 0x38:
case 0xda: case 0xda:
// JP C,NNNN // JP C,NNNN
if(AF.B.B0&C_FLAG) { if(AF.B.B0&C_FLAG) {
tempRegister.B.B0=gbReadMemory(PC.W++); tempRegister.B.B0=gbReadOpcode(PC.W++);
tempRegister.B.B1=gbReadMemory(PC.W); tempRegister.B.B1=gbReadOpcode(PC.W);
PC.W=tempRegister.W; PC.W=tempRegister.W;
clockTicks++; clockTicks++;
} else } else
PC.W+=2; PC.W+=2;
break; break;
// DB illegal // DB illegal
case 0xdb:
PC.W--;
IFF = 0;
break;
case 0xdc: case 0xdc:
// CALL C,NNNN // CALL C,NNNN
if(AF.B.B0&C_FLAG) { if(AF.B.B0&C_FLAG) {
tempRegister.B.B0=gbReadMemory(PC.W++); tempRegister.B.B0=gbReadOpcode(PC.W++);
tempRegister.B.B1=gbReadMemory(PC.W++); tempRegister.B.B1=gbReadOpcode(PC.W++);
gbWriteMemory(--SP.W,PC.B.B1); gbWriteMemory(--SP.W,PC.B.B1);
gbWriteMemory(--SP.W,PC.B.B0); gbWriteMemory(--SP.W,PC.B.B0);
PC.W=tempRegister.W; PC.W=tempRegister.W;
@ -1233,6 +1251,10 @@ case 0x38:
PC.W+=2; PC.W+=2;
break; break;
// DD illegal // DD illegal
case 0xdd:
PC.W--;
IFF = 0;
break;
case 0xde: case 0xde:
// SBC NN // SBC NN
tempValue=gbReadOpcode(PC.W++); tempValue=gbReadOpcode(PC.W++);
@ -1262,6 +1284,11 @@ case 0x38:
break; break;
// E3 illegal // E3 illegal
// E4 illegal // E4 illegal
case 0xe3:
case 0xe4:
PC.W--;
IFF = 0;
break;
case 0xe5: case 0xe5:
// PUSH HL // PUSH HL
gbWriteMemory(--SP.W,HL.B.B1); gbWriteMemory(--SP.W,HL.B.B1);
@ -1308,6 +1335,12 @@ case 0x38:
// EB illegal // EB illegal
// EC illegal // EC illegal
// ED illegal // ED illegal
case 0xeb:
case 0xec:
case 0xed:
PC.W--;
IFF = 0;
break;
case 0xee: case 0xee:
// XOR NN // XOR NN
tempValue=gbReadOpcode(PC.W++); tempValue=gbReadOpcode(PC.W++);
@ -1336,9 +1369,13 @@ case 0x38:
case 0xf3: case 0xf3:
// DI // DI
// IFF&=0xFE; // IFF&=0xFE;
IFF&=(~0x21); IFF|=0x08;
break; break;
// F4 illegal // F4 illegal
case 0xf4:
PC.W--;
IFF = 0;
break;
case 0xf5: case 0xf5:
// PUSH AF // PUSH AF
gbWriteMemory(--SP.W,AF.B.B1); gbWriteMemory(--SP.W,AF.B.B1);
@ -1383,10 +1420,23 @@ case 0x38:
break; break;
case 0xfb: case 0xfb:
// EI // EI
IFF|=0x20; if (!(IFF & 0x30))
// If an EI is executed right before HALT,
// the interrupts are triggered before the Halt state !!
// Fix Torpedo Range Intro.
// IFF |= 0x10 : 1 ticks before the EI enables the interrupts
// IFF |= 0x40 : marks that an EI is being executed.
IFF|=0x50;
break; break;
// FC illegal // FC illegal (FC = breakpoint)
case 0xfc:
breakpoint = true;
break;
// FD illegal // FD illegal
case 0xfd:
PC.W--;
IFF = 0;
break;
case 0xfe: case 0xfe:
// CP NN // CP NN
tempValue=gbReadOpcode(PC.W++); tempValue=gbReadOpcode(PC.W++);
@ -1401,7 +1451,10 @@ case 0x38:
PC.W=0x0038; PC.W=0x0038;
break; break;
default: default:
systemMessage(0, N_("Unknown opcode %02x at %04x"), if (gbSystemMessage == false)
gbReadOpcode(PC.W-1),PC.W-1); {
emulating = false; systemMessage(0, N_("Unknown opcode %02x at %04x"),
gbReadOpcode(PC.W-1),PC.W-1);
gbSystemMessage =true;
}
return; return;

View File

@ -1,7 +1,7 @@
// -*- C++ -*- // -*- C++ -*-
// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. // VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator.
// Copyright (C) 1999-2003 Forgotten // Copyright (C) 1999-2003 Forgotten
// Copyright (C) 2004 Forgotten and the VBA development team // Copyright (C) 2005 Forgotten and the VBA development team
// This program is free software; you can redistribute it and/or modify // 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 // it under the terms of the GNU General Public License as published by
@ -1282,7 +1282,10 @@
AF.B.B1|=1<<7; AF.B.B1|=1<<7;
break; break;
default: default:
systemMessage(0, N_("Unknown opcode %02x at %04x"), if (gbSystemMessage == false)
gbReadOpcode(PC.W-1),PC.W-1); {
emulating = false; systemMessage(0, N_("Unknown opcode %02x at %04x"),
gbReadOpcode(PC.W-1),PC.W-1);
gbSystemMessage =true;
}
return; return;

View File

@ -1,6 +1,6 @@
// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. // VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator.
// Copyright (C) 1999-2003 Forgotten // Copyright (C) 1999-2003 Forgotten
// Copyright (C) 2004 Forgotten and the VBA development team // Copyright (C) 2005-2006 Forgotten and the VBA development team
// This program is free software; you can redistribute it and/or modify // 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 // it under the terms of the GNU General Public License as published by
@ -58,9 +58,12 @@ u8 gbInvertTab[256] = {
}; };
u16 gbLineMix[160]; u16 gbLineMix[160];
u16 gbWindowColor[160];
extern int inUseRegister_WY;
void gbRenderLine() void gbRenderLine()
{ {
memset(gbLineMix, 0, sizeof(gbLineMix));
u8 * bank0; u8 * bank0;
u8 * bank1; u8 * bank1;
if(gbCgbMode) { if(gbCgbMode) {
@ -86,10 +89,9 @@ void gbRenderLine()
if(y >= 144) if(y >= 144)
return; return;
// int yLine = (y + gbBorderRowSkip) * gbBorderLineSkip; int SpritesTicks = gbSpritesTicks[x]*(gbSpeed ? 2 : 4);
int sx = gbSCXLine[(gbSpeed ? 0 : 4)+SpritesTicks];
int sx = register_SCX; int sy = gbSCYLine[(gbSpeed ? 11 : 5)+SpritesTicks];
int sy = register_SCY;
sy+=y; sy+=y;
@ -113,16 +115,17 @@ void gbRenderLine()
tile_map_address++; tile_map_address++;
if((register_LCDC & 16) == 0) { if(!(register_LCDC & 0x10))
if(tile < 128) tile += 128; tile ^= 0x80;
else tile -= 128;
}
int tile_pattern_address = tile_pattern + tile * 16 + by*2; int tile_pattern_address = tile_pattern + tile * 16 + by*2;
if(register_LCDC & 0x80) { if(register_LCDC & 0x80) {
if((register_LCDC & 0x01 || gbCgbMode) && (layerSettings & 0x0100)) { if((register_LCDC & 0x01 || gbCgbMode) && (layerSettings & 0x0100)) {
while(x < 160) { while(x < 160) {
u8 tile_a = 0; u8 tile_a = 0;
u8 tile_b = 0; u8 tile_b = 0;
@ -155,7 +158,7 @@ void gbRenderLine()
if(gbCgbMode) { if(gbCgbMode) {
c = c + (attrs & 7)*4; c = c + (attrs & 7)*4;
} else { } else {
c = gbBgp[c]; c = (gbBgpLine[x+(gbSpeed ? 5 : 11)+SpritesTicks]>>(c<<1)) &3;
if(gbSgbMode && !gbCgbMode) { if(gbSgbMode && !gbCgbMode) {
int dx = x >> 3; int dx = x >> 3;
int dy = y >> 3; int dy = y >> 3;
@ -168,42 +171,92 @@ void gbRenderLine()
c = c + 4*palette; c = c + 4*palette;
} }
} }
gbLineMix[x] = gbColorOption ? gbColorFilter[gbPalette[c]] : gbLineMix[x] = gbColorOption ? gbColorFilter[gbPalette[c] & 0x7FFF] :
gbPalette[c]; gbPalette[c] & 0x7FFF;
x++; x++;
if(x >= 160) if(x >= 160)
break; break;
bx >>= 1; bx >>= 1;
} }
tx++;
if(tx == 32)
tx = 0;
bx = 128; bx = 128;
SpritesTicks = gbSpritesTicks[x]*(gbSpeed ? 2 : 4);
sx = gbSCXLine[x+(gbSpeed ? 0 : 4)+SpritesTicks];
sy = gbSCYLine[x+(gbSpeed ? 11 : 5)+SpritesTicks];
tx = ((sx+x)>>3) & 0x1f;
sy+=y;
sy &= 255;
ty = sy >> 3;
by = sy & 7;
tile_pattern_address = tile_pattern + tile * 16 + by * 2;
tile_map_line_y = tile_map + ty * 32;
tile_map_address = tile_map_line_y + tx;
if(bank1) if(bank1)
attrs = bank1[tile_map_line_y + tx]; attrs = bank1[tile_map_line_y + tx];
tile = bank0[tile_map_line_y + tx]; tile = bank0[tile_map_line_y + tx];
if((register_LCDC & 16) == 0) { if(!(register_LCDC & 0x10))
if(tile < 128) tile += 128; tile ^= 0x80;
else tile -= 128;
}
tile_pattern_address = tile_pattern + tile * 16 + by * 2; tile_pattern_address = tile_pattern + tile * 16 + by * 2;
} }
} else { } else {
for(int i = 0; i < 160; i++) { // Use gbBgp[0] instead of 0 (?)
gbLineMix[i] = gbPalette[0]; // (this fixes white flashes on Last Bible II)
// Also added the gbColorOption (fixes Dracula Densetsu II color problems)
for(int i = 0; i < 160; i++)
{
u16 color = gbColorOption ? gbColorFilter[0x7FFF] :
0x7FFF;
if (!gbCgbMode)
color = gbColorOption ? gbColorFilter[gbPalette[gbBgpLine[i+(gbSpeed ? 5 : 11)+gbSpritesTicks[i]*(gbSpeed ? 2 : 4)]&3] & 0x7FFF] :
gbPalette[gbBgpLine[i+(gbSpeed ? 5 : 11)+gbSpritesTicks[i]*(gbSpeed ? 2 : 4)]&3] & 0x7FFF;
gbLineMix[i] = color;
gbLineBuffer[i] = 0; gbLineBuffer[i] = 0;
} }
} }
// do the window display // do the window display
if((register_LCDC & 0x20) && (layerSettings & 0x2000)) { // LCDC.0 also enables/disables the window in !gbCgbMode ?!?!
int wy = register_WY; // (tested on real hardware)
// This fixes Last Bible II & Zankurou Musouken
if((register_LCDC & 0x01 || gbCgbMode) && (register_LCDC & 0x20) &&
(layerSettings & 0x2000) && (gbWindowLine != -2)) {
int i = 0;
// Fix (accurate emulation) for most of the window display problems
// (ie. Zen - Intergalactic Ninja, Urusei Yatsura...).
if ((gbWindowLine == -1) || (gbWindowLine>144))
{
inUseRegister_WY = oldRegister_WY;
if (register_LY>oldRegister_WY)
gbWindowLine = 146;
// for (i = 0; i<160; i++)
// gbWindowColor[i] = gbLineMix[i];
}
int wy = inUseRegister_WY;
if(y >= wy) { if(y >= inUseRegister_WY) {
if (gbWindowLine == -1)
gbWindowLine = 0;
int wx = register_WX; int wx = register_WX;
int swx = 0;
wx -= 7; wx -= 7;
if( wx <= 159 && gbWindowLine <= 143) { if( wx <= 159 && gbWindowLine <= 143) {
@ -212,10 +265,7 @@ void gbRenderLine()
if((register_LCDC & 0x40) != 0) if((register_LCDC & 0x40) != 0)
tile_map = 0x1c00; tile_map = 0x1c00;
if(gbWindowLine == -1) {
gbWindowLine = 0;
}
tx = 0; tx = 0;
ty = gbWindowLine >> 3; ty = gbWindowLine >> 3;
@ -223,6 +273,25 @@ void gbRenderLine()
bx = 128; bx = 128;
by = gbWindowLine & 7; by = gbWindowLine & 7;
// Tries to emulate the 'window scrolling bug' when wx == 0 (ie. wx-7 == -7).
// Nothing close to perfect, but good enought for now...
if (wx == -7)
{
swx = 7-((gbSCXLine[0]-1) & 7);
bx >>= ((gbSCXLine[0]+((swx != 1) ? 1 : 0)) & 7);
if (swx == 1)
swx = 2;
//bx >>= ((gbSCXLine[0]+(((swx>1) && (swx != 7)) ? 1 : 0)) & 7);
if ((swx == 7))
{
//wx = 0;
if ((gbWindowLine>0) || (wy == 0))
swx = 0;
}
}
else
if(wx < 0) { if(wx < 0) {
bx >>= (-wx); bx >>= (-wx);
wx = 0; wx = 0;
@ -247,6 +316,10 @@ void gbRenderLine()
tile_pattern_address = tile_pattern + tile * 16 + by*2; tile_pattern_address = tile_pattern + tile * 16 + by*2;
if (wx)
for (i = 0; i<swx; i++)
gbLineMix[i] = gbWindowColor[i];
while(x < 160) { while(x < 160) {
u8 tile_a = 0; u8 tile_a = 0;
u8 tile_b = 0; u8 tile_b = 0;
@ -272,6 +345,8 @@ void gbRenderLine()
u8 c = (tile_a & bx) != 0 ? 1 : 0; u8 c = (tile_a & bx) != 0 ? 1 : 0;
c += ((tile_b & bx) != 0 ? 2 : 0); c += ((tile_b & bx) != 0 ? 2 : 0);
if (x>=0)
{
if(attrs & 0x80) if(attrs & 0x80)
gbLineBuffer[x] = 0x300 + c; gbLineBuffer[x] = 0x300 + c;
else else
@ -280,8 +355,8 @@ void gbRenderLine()
if(gbCgbMode) { if(gbCgbMode) {
c = c + (attrs & 7) * 4; c = c + (attrs & 7) * 4;
} else { } else {
c = gbBgp[c]; c = (gbBgpLine[x+(gbSpeed ? 5 : 11)+gbSpritesTicks[x]*(gbSpeed ? 2 : 4)]>>(c<<1)) &3;
if(gbSgbMode && ! gbCgbMode) { if(gbSgbMode && !gbCgbMode) {
int dx = x >> 3; int dx = x >> 3;
int dy = y >> 3; int dy = y >> 3;
@ -293,8 +368,9 @@ void gbRenderLine()
c = c + 4*palette; c = c + 4*palette;
} }
} }
gbLineMix[x] = gbColorOption ? gbColorFilter[gbPalette[c]] : gbLineMix[x] = gbColorOption ? gbColorFilter[gbPalette[c] & 0x7FFF] :
gbPalette[c]; gbPalette[c] & 0x7FFF;
}
x++; x++;
if(x >= 160) if(x >= 160)
break; break;
@ -314,13 +390,30 @@ void gbRenderLine()
} }
tile_pattern_address = tile_pattern + tile * 16 + by * 2; tile_pattern_address = tile_pattern + tile * 16 + by * 2;
} }
//for (i = swx; i<160; i++)
// gbLineMix[i] = gbWindowColor[i];
gbWindowLine++; gbWindowLine++;
} }
} }
} }
else if (gbWindowLine == -2)
{
inUseRegister_WY = oldRegister_WY;
if (register_LY>oldRegister_WY)
gbWindowLine = 146;
else
gbWindowLine = 0;
}
} else { } else {
for(int i = 0; i < 160; i++) { u16 color = gbColorOption ? gbColorFilter[0x7FFF] :
gbLineMix[i] = gbPalette[0]; 0x7FFF;
if (!gbCgbMode)
color = gbColorOption ? gbColorFilter[gbPalette[0] & 0x7FFF] :
gbPalette[0] & 0x7FFF;
for(int i = 0; i < 160; i++)
{
gbLineMix[i] = color;
gbLineBuffer[i] = 0; gbLineBuffer[i] = 0;
} }
} }
@ -346,8 +439,11 @@ void gbDrawSpriteTile(int tile, int x,int y,int t, int flags,
int init = 0x0000; int init = 0x0000;
// int yLine = (y+gbBorderRowSkip) * gbBorderLineSkip; for (int i = 0; i<4; i++)
{
gbObp0[i] = (gbObp0Line[x+11+gbSpritesTicks[x]*(gbSpeed ? 2 : 4)]>>(i<<1)) & 3;
gbObp1[i] = (gbObp1Line[x+11+gbSpritesTicks[x]*(gbSpeed ? 2 : 4)]>>(i<<1)) & 3;
}
u8 *pal = gbObp0; u8 *pal = gbObp0;
int flipx = (flags & 0x20); int flipx = (flags & 0x20);
@ -366,7 +462,7 @@ void gbDrawSpriteTile(int tile, int x,int y,int t, int flags,
int a = 0; int a = 0;
int b = 0; int b = 0;
if(gbCgbMode && flags & 0x08) { if(gbCgbMode && (flags & 0x08)) {
a = bank1[address++]; a = bank1[address++];
b = bank1[address++]; b = bank1[address++];
} else { } else {
@ -392,12 +488,14 @@ void gbDrawSpriteTile(int tile, int x,int y,int t, int flags,
continue; continue;
u16 color = gbLineBuffer[xxx]; u16 color = gbLineBuffer[xxx];
if(prio) { // Fixes OAM-BG priority
if(prio && (register_LCDC & 1)) {
if(color < 0x200 && ((color & 0xFF) != 0)) if(color < 0x200 && ((color & 0xFF) != 0))
continue; continue;
} }
if(color >= 0x300 && color != 0x300) // Fixes OAM-BG priority for Moorhuhn 2
if(color >= 0x300 && color != 0x300 && (register_LCDC & 1))
continue; continue;
else if(color >= 0x200 && color < 0x300) { else if(color >= 0x200 && color < 0x300) {
int sprite = color & 0xff; int sprite = color & 0xff;
@ -412,7 +510,9 @@ void gbDrawSpriteTile(int tile, int x,int y,int t, int flags,
if(sprite < spriteNumber) if(sprite < spriteNumber)
continue; continue;
} else { } else {
if(spriteX < x+8) // Fixes GB sprites priorities (was '< x + 8' before)
// ('A boy and his blob...' sprites' emulation is now correct)
if(spriteX < x)
continue; continue;
} }
} }
@ -442,12 +542,12 @@ void gbDrawSpriteTile(int tile, int x,int y,int t, int flags,
} }
} }
gbLineMix[xxx] = gbColorOption ? gbColorFilter[gbPalette[c]] : gbLineMix[xxx] = gbColorOption ? gbColorFilter[gbPalette[c] & 0x7FFF] :
gbPalette[c]; gbPalette[c] & 0x7FFF;
} }
} }
void gbDrawSprites() void gbDrawSprites(bool draw)
{ {
int x = 0; int x = 0;
int y = 0; int y = 0;
@ -455,6 +555,9 @@ void gbDrawSprites()
int size = (register_LCDC & 4); int size = (register_LCDC & 4);
if (!draw)
memset (gbSpritesTicks, 0, sizeof(gbSpritesTicks));
if(!(register_LCDC & 0x80)) if(!(register_LCDC & 0x80))
return; return;
@ -473,11 +576,19 @@ void gbDrawSprites()
if(x > 0 && y > 0 && x < 168 && y < 160) { if(x > 0 && y > 0 && x < 168 && y < 160) {
// check if sprite intersects current line // check if sprite intersects current line
int t = yc -y + 16; int t = yc -y + 16;
if(size && t >=0 && t < 16) { if((size && t >=0 && t < 16) || (!size && t >= 0 && t < 8)) {
gbDrawSpriteTile(tile,x-8,yc,t,flags,size,i); if (draw)
count++; gbDrawSpriteTile(tile,x-8,yc,t,flags,size,i);
} else if(!size && t >= 0 && t < 8) { else
gbDrawSpriteTile(tile, x-8, yc, t, flags,size,i); {
for (int j = x-8; j<300; j++)
if (j>=0)
if (gbSpeed)
gbSpritesTicks[j] += 5;
else
gbSpritesTicks[j] += 2+(count&1);
}
count++; count++;
} }
} }
@ -486,5 +597,5 @@ void gbDrawSprites()
break; break;
} }
} }
} return;
}

View File

@ -1,6 +1,6 @@
// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. // VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator.
// Copyright (C) 1999-2003 Forgotten // Copyright (C) 1999-2003 Forgotten
// Copyright (C) 2004 Forgotten and the VBA development team // Copyright (C) 2005-2006 Forgotten and the VBA development team
// This program is free software; you can redistribute it and/or modify // 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 // it under the terms of the GNU General Public License as published by
@ -24,6 +24,7 @@ int gbRomSizeMask = 0;
int gbRomSize = 0; int gbRomSize = 0;
int gbRamSizeMask = 0; int gbRamSizeMask = 0;
int gbRamSize = 0; int gbRamSize = 0;
int gbTAMA5ramSize = 0;
u8 *gbMemory = NULL; u8 *gbMemory = NULL;
u8 *gbVram = NULL; u8 *gbVram = NULL;
@ -31,6 +32,7 @@ u8 *gbRom = NULL;
u8 *gbRam = NULL; u8 *gbRam = NULL;
u8 *gbWram = NULL; u8 *gbWram = NULL;
u16 *gbLineBuffer = NULL; u16 *gbLineBuffer = NULL;
u8 *gbTAMA5ram = NULL;
u16 gbPalette[128]; u16 gbPalette[128];
u8 gbBgp[4] = { 0, 1, 2, 3}; u8 gbBgp[4] = { 0, 1, 2, 3};
@ -38,6 +40,7 @@ u8 gbObp0[4] = { 0, 1, 2, 3};
u8 gbObp1[4] = { 0, 1, 2, 3}; u8 gbObp1[4] = { 0, 1, 2, 3};
int gbWindowLine = -1; int gbWindowLine = -1;
bool genericflashcardEnable = false;
int gbCgbMode = 0; int gbCgbMode = 0;
u16 gbColorFilter[32768]; u16 gbColorFilter[32768];

View File

@ -1,7 +1,7 @@
// -*- C++ -*- // -*- C++ -*-
// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. // VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator.
// Copyright (C) 1999-2003 Forgotten // Copyright (C) 1999-2003 Forgotten
// Copyright (C) 2004 Forgotten and the VBA development team // Copyright (C) 2005-2006 Forgotten and the VBA development team
// This program is free software; you can redistribute it and/or modify // 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 // it under the terms of the GNU General Public License as published by
@ -21,6 +21,11 @@ extern int gbRomSizeMask;
extern int gbRomSize; extern int gbRomSize;
extern int gbRamSize; extern int gbRamSize;
extern int gbRamSizeMask; extern int gbRamSizeMask;
extern int gbTAMA5ramSize;
extern bool useBios;
extern bool skipBios;
extern u8 *bios;
extern u8 *gbRom; extern u8 *gbRom;
extern u8 *gbRam; extern u8 *gbRam;
@ -28,6 +33,7 @@ extern u8 *gbVram;
extern u8 *gbWram; extern u8 *gbWram;
extern u8 *gbMemory; extern u8 *gbMemory;
extern u16 *gbLineBuffer; extern u16 *gbLineBuffer;
extern u8 *gbTAMA5ram;
extern u8 *gbMemoryMap[16]; extern u8 *gbMemoryMap[16];
@ -46,6 +52,19 @@ extern u8 gbBgp[4];
extern u8 gbObp0[4]; extern u8 gbObp0[4];
extern u8 gbObp1[4]; extern u8 gbObp1[4];
extern u16 gbPalette[128]; extern u16 gbPalette[128];
extern bool gbScreenOn;
extern bool gbDrawWindow;
extern u8 gbSCYLine[300];
// gbSCXLine is used for the emulation (bug) of the SX change
// found in the Artic Zone game.
extern u8 gbSCXLine[300];
// gbBgpLine is used for the emulation of the
// Prehistorik Man's title screen scroller.
extern u8 gbBgpLine[300];
extern u8 gbObp0Line [300];
extern u8 gbObp1Line [300];
// gbSpritesTicks is used for the emulation of Parodius' Laser Beam.
extern u8 gbSpritesTicks[300];
extern u8 register_LCDC; extern u8 register_LCDC;
extern u8 register_LY; extern u8 register_LY;
@ -54,8 +73,10 @@ extern u8 register_SCX;
extern u8 register_WY; extern u8 register_WY;
extern u8 register_WX; extern u8 register_WX;
extern u8 register_VBK; extern u8 register_VBK;
extern u8 oldRegister_WY;
extern int emulating; extern int emulating;
extern bool genericflashcardEnable;
extern int gbBorderLineSkip; extern int gbBorderLineSkip;
extern int gbBorderRowSkip; extern int gbBorderRowSkip;
@ -63,6 +84,6 @@ extern int gbBorderColumnSkip;
extern int gbDmaTicks; extern int gbDmaTicks;
extern void gbRenderLine(); extern void gbRenderLine();
extern void gbDrawSprites(); extern void gbDrawSprites(bool);
extern u8 (*gbSerialFunction)(u8); extern u8 (*gbSerialFunction)(u8);

View File

@ -1,6 +1,6 @@
// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. // VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator.
// Copyright (C) 1999-2003 Forgotten // Copyright (C) 1999-2003 Forgotten
// Copyright (C) 2004 Forgotten and the VBA development team // Copyright (C) 2005-2006 Forgotten and the VBA development team
// This program is free software; you can redistribute it and/or modify // 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 // it under the terms of the GNU General Public License as published by
@ -20,6 +20,12 @@
#include "../Port.h" #include "../Port.h"
#include "gbGlobals.h" #include "gbGlobals.h"
#include "gbMemory.h" #include "gbMemory.h"
#include "GB.h"
u8 gbDaysinMonth [12] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
const u8 gbDisabledRam [8] = {0x80, 0xff, 0xf0, 0x00, 0x30, 0xbf, 0xbf, 0xbf};
extern int gbHardware;
extern int gbGBCColorType;
extern gbRegister PC;
mapperMBC1 gbDataMBC1 = { mapperMBC1 gbDataMBC1 = {
0, // RAM enable 0, // RAM enable
@ -27,7 +33,8 @@ mapperMBC1 gbDataMBC1 = {
0, // RAM bank 0, // RAM bank
0, // memory model 0, // memory model
0, // ROM high address 0, // ROM high address
0 // RAM address 0, // RAM address
0 // Rom Bank 0 remapping
}; };
// MBC1 ROM write registers // MBC1 ROM write registers
@ -41,17 +48,25 @@ void mapperMBC1ROM(u16 address, u8 value)
break; break;
case 0x2000: // ROM bank select case 0x2000: // ROM bank select
// value = value & 0x1f; // value = value & 0x1f;
if(value == 0) if ((value == 1) && (address == 0x2100))
value = 1; gbDataMBC1.mapperRomBank0Remapping = 1;
if((value & 0x1f) == 0)
value += 1;
if(value == gbDataMBC1.mapperROMBank) if(value == gbDataMBC1.mapperROMBank)
break; break;
tmpAddress = value << 14; tmpAddress = value << 14;
// check current model // check current model
if (gbDataMBC1.mapperRomBank0Remapping == 3) {
tmpAddress = (value & 0xf) << 14;
tmpAddress |= (gbDataMBC1.mapperROMHighAddress & 3) << 18;
}
else
if(gbDataMBC1.mapperMemoryModel == 0) { if(gbDataMBC1.mapperMemoryModel == 0) {
// model is 16/8, so we have a high address in use // model is 16/8, so we have a high address in use
tmpAddress |= (gbDataMBC1.mapperROMHighAddress) << 19; tmpAddress |= (gbDataMBC1.mapperROMHighAddress & 3) << 19;
} }
tmpAddress &= gbRomSizeMask; tmpAddress &= gbRomSizeMask;
@ -63,16 +78,39 @@ void mapperMBC1ROM(u16 address, u8 value)
break; break;
case 0x4000: // RAM bank select case 0x4000: // RAM bank select
if(gbDataMBC1.mapperMemoryModel == 1) { if(gbDataMBC1.mapperMemoryModel == 1) {
if (!gbRamSize)
{
if (gbDataMBC1.mapperRomBank0Remapping == 3)
{
gbDataMBC1.mapperROMHighAddress = value & 0x03;
tmpAddress = (gbDataMBC1.mapperROMHighAddress) << 18;
tmpAddress &= gbRomSizeMask;
gbMemoryMap[0x00] = &gbRom[tmpAddress];
gbMemoryMap[0x01] = &gbRom[tmpAddress + 0x1000];
gbMemoryMap[0x02] = &gbRom[tmpAddress + 0x2000];
gbMemoryMap[0x03] = &gbRom[tmpAddress + 0x3000];
gbMemoryMap[0x04] = &gbRom[tmpAddress + 0x4000];
gbMemoryMap[0x05] = &gbRom[tmpAddress + 0x5000];
gbMemoryMap[0x06] = &gbRom[tmpAddress + 0x6000];
gbMemoryMap[0x07] = &gbRom[tmpAddress + 0x7000];
}
else gbDataMBC1.mapperRomBank0Remapping = 0;
}
// 4/32 model, RAM bank switching provided // 4/32 model, RAM bank switching provided
value = value & 0x03; value = value & 0x03;
if(value == gbDataMBC1.mapperRAMBank) if(value == gbDataMBC1.mapperRAMBank)
break; break;
tmpAddress = value << 13; tmpAddress = value << 13;
tmpAddress &= gbRamSizeMask; tmpAddress &= gbRamSizeMask;
gbMemoryMap[0x0a] = &gbRam[tmpAddress]; if(gbRamSize) {
gbMemoryMap[0x0b] = &gbRam[tmpAddress + 0x1000]; gbMemoryMap[0x0a] = &gbRam[tmpAddress];
gbMemoryMap[0x0b] = &gbRam[tmpAddress + 0x1000];
}
gbDataMBC1.mapperRAMBank = value; gbDataMBC1.mapperRAMBank = value;
gbDataMBC1.mapperRAMAddress = tmpAddress; gbDataMBC1.mapperRAMAddress = tmpAddress;
if (gbDataMBC1.mapperRomBank0Remapping != 3)
gbDataMBC1.mapperROMHighAddress = 0;
} else { } else {
// 16/8, set the high address // 16/8, set the high address
gbDataMBC1.mapperROMHighAddress = value & 0x03; gbDataMBC1.mapperROMHighAddress = value & 0x03;
@ -83,10 +121,57 @@ void mapperMBC1ROM(u16 address, u8 value)
gbMemoryMap[0x05] = &gbRom[tmpAddress + 0x1000]; gbMemoryMap[0x05] = &gbRom[tmpAddress + 0x1000];
gbMemoryMap[0x06] = &gbRom[tmpAddress + 0x2000]; gbMemoryMap[0x06] = &gbRom[tmpAddress + 0x2000];
gbMemoryMap[0x07] = &gbRom[tmpAddress + 0x3000]; gbMemoryMap[0x07] = &gbRom[tmpAddress + 0x3000];
if(gbRamSize) {
gbMemoryMap[0x0a] = &gbRam[0];
gbMemoryMap[0x0b] = &gbRam[0x1000];
}
gbDataMBC1.mapperRAMBank = 0;
} }
break; break;
case 0x6000: // memory model select case 0x6000: // memory model select
gbDataMBC1.mapperMemoryModel = value & 1; gbDataMBC1.mapperMemoryModel = value & 1;
if(gbDataMBC1.mapperMemoryModel == 1) {
// 4/32 model, RAM bank switching provided
value = gbDataMBC1.mapperRAMBank & 0x03;
tmpAddress = value << 13;
tmpAddress &= gbRamSizeMask;
if(gbRamSize) {
gbMemoryMap[0x0a] = &gbRam[gbDataMBC1.mapperRAMAddress];
gbMemoryMap[0x0b] = &gbRam[gbDataMBC1.mapperRAMAddress + 0x1000];
gbDataMBC1.mapperRomBank0Remapping = 0;
}
else gbDataMBC1.mapperRomBank0Remapping |=2;
gbDataMBC1.mapperRAMBank = value;
gbDataMBC1.mapperRAMAddress = tmpAddress;
tmpAddress = gbDataMBC1.mapperROMBank << 14;
tmpAddress &= gbRomSizeMask;
gbMemoryMap[0x04] = &gbRom[tmpAddress];
gbMemoryMap[0x05] = &gbRom[tmpAddress + 0x1000];
gbMemoryMap[0x06] = &gbRom[tmpAddress + 0x2000];
gbMemoryMap[0x07] = &gbRom[tmpAddress + 0x3000];
} else {
// 16/8, set the high address
tmpAddress = gbDataMBC1.mapperROMBank << 14;
tmpAddress |= (gbDataMBC1.mapperROMHighAddress) << 19;
tmpAddress &= gbRomSizeMask;
gbMemoryMap[0x04] = &gbRom[tmpAddress];
gbMemoryMap[0x05] = &gbRom[tmpAddress + 0x1000];
gbMemoryMap[0x06] = &gbRom[tmpAddress + 0x2000];
gbMemoryMap[0x07] = &gbRom[tmpAddress + 0x3000];
if(gbRamSize) {
gbMemoryMap[0x0a] = &gbRam[0];
gbMemoryMap[0x0b] = &gbRam[0x1000];
}
}
break; break;
} }
} }
@ -102,23 +187,72 @@ void mapperMBC1RAM(u16 address, u8 value)
} }
} }
// MBC1 read RAM
u8 mapperMBC1ReadRAM(u16 address)
{
if(gbDataMBC1.mapperRAMEnable)
return gbMemoryMap[address>>12][address & 0x0fff];
if (!genericflashcardEnable)
return 0xff;
else
if ((address & 0x1000) >= 0x1000)
{
// The value returned when reading RAM while it's disabled
// is constant, exept for the GBASP hardware.
// (actually, is the address that read is out of the ROM, the returned value if 0xff...)
if (PC.W>=0xff80)
return 0xff;
else
if ((gbHardware & 0x08) && (gbGBCColorType == 2))
{
if (address & 1)
return 0xfb;
else
return 0x7a;
}
else
return 0x0a;
}
else
return gbDisabledRam[address & 7];
}
void memoryUpdateMapMBC1() void memoryUpdateMapMBC1()
{ {
int tmpAddress = gbDataMBC1.mapperROMBank << 14; int tmpAddress = gbDataMBC1.mapperROMBank << 14;
// check current model // check current model
if(gbDataMBC1.mapperMemoryModel == 1) { if (gbDataMBC1.mapperRomBank0Remapping == 3) {
// model is 16/8, so we have a high address in use tmpAddress = (gbDataMBC1.mapperROMHighAddress & 3) << 18;
tmpAddress |= (gbDataMBC1.mapperROMHighAddress) << 19; tmpAddress &= gbRomSizeMask;
gbMemoryMap[0x00] = &gbRom[tmpAddress];
gbMemoryMap[0x01] = &gbRom[tmpAddress + 0x1000];
gbMemoryMap[0x02] = &gbRom[tmpAddress + 0x2000];
gbMemoryMap[0x03] = &gbRom[tmpAddress + 0x3000];
tmpAddress |= (gbDataMBC1.mapperROMBank & 0xf) << 14;
gbMemoryMap[0x04] = &gbRom[tmpAddress];
gbMemoryMap[0x05] = &gbRom[tmpAddress + 0x1000];
gbMemoryMap[0x06] = &gbRom[tmpAddress + 0x2000];
gbMemoryMap[0x07] = &gbRom[tmpAddress + 0x3000];
}
else
{
if(gbDataMBC1.mapperMemoryModel == 0) {
// model is 16/8, so we have a high address in use
tmpAddress |= (gbDataMBC1.mapperROMHighAddress & 3) << 19;
}
tmpAddress &= gbRomSizeMask;
gbMemoryMap[0x04] = &gbRom[tmpAddress];
gbMemoryMap[0x05] = &gbRom[tmpAddress + 0x1000];
gbMemoryMap[0x06] = &gbRom[tmpAddress + 0x2000];
gbMemoryMap[0x07] = &gbRom[tmpAddress + 0x3000];
} }
tmpAddress &= gbRomSizeMask; if((gbRamSize) && (gbDataMBC1.mapperMemoryModel == 1)){
gbMemoryMap[0x04] = &gbRom[tmpAddress];
gbMemoryMap[0x05] = &gbRom[tmpAddress + 0x1000];
gbMemoryMap[0x06] = &gbRom[tmpAddress + 0x2000];
gbMemoryMap[0x07] = &gbRom[tmpAddress + 0x3000];
if(gbRamSize) {
gbMemoryMap[0x0a] = &gbRam[gbDataMBC1.mapperRAMAddress]; gbMemoryMap[0x0a] = &gbRam[gbDataMBC1.mapperRAMAddress];
gbMemoryMap[0x0b] = &gbRam[gbDataMBC1.mapperRAMAddress + 0x1000]; gbMemoryMap[0x0b] = &gbRam[gbDataMBC1.mapperRAMAddress + 0x1000];
} }
@ -210,7 +344,7 @@ void memoryUpdateMBC3Clock()
time_t diff = now - gbDataMBC3.mapperLastTime; time_t diff = now - gbDataMBC3.mapperLastTime;
if(diff > 0) { if(diff > 0) {
// update the clock according to the last update time // update the clock according to the last update time
gbDataMBC3.mapperSeconds += diff % 60; gbDataMBC3.mapperSeconds += (int)(diff % 60);
if(gbDataMBC3.mapperSeconds > 59) { if(gbDataMBC3.mapperSeconds > 59) {
gbDataMBC3.mapperSeconds -= 60; gbDataMBC3.mapperSeconds -= 60;
gbDataMBC3.mapperMinutes++; gbDataMBC3.mapperMinutes++;
@ -218,22 +352,22 @@ void memoryUpdateMBC3Clock()
diff /= 60; diff /= 60;
gbDataMBC3.mapperMinutes += diff % 60; gbDataMBC3.mapperMinutes += (int)(diff % 60);
if(gbDataMBC3.mapperMinutes > 60) { if(gbDataMBC3.mapperMinutes > 59) {
gbDataMBC3.mapperMinutes -= 60; gbDataMBC3.mapperMinutes -= 60;
gbDataMBC3.mapperHours++; gbDataMBC3.mapperHours++;
} }
diff /= 60; diff /= 60;
gbDataMBC3.mapperHours += diff % 24; gbDataMBC3.mapperHours += (int)(diff % 24);
if(gbDataMBC3.mapperHours > 24) { if(gbDataMBC3.mapperHours > 23) {
gbDataMBC3.mapperHours -= 24; gbDataMBC3.mapperHours -= 24;
gbDataMBC3.mapperDays++; gbDataMBC3.mapperDays++;
} }
diff /= 24; diff /= 24;
gbDataMBC3.mapperDays += diff; gbDataMBC3.mapperDays += (int)(diff & 0xffffffff);
if(gbDataMBC3.mapperDays > 255) { if(gbDataMBC3.mapperDays > 255) {
if(gbDataMBC3.mapperDays > 511) { if(gbDataMBC3.mapperDays > 511) {
gbDataMBC3.mapperDays %= 512; gbDataMBC3.mapperDays %= 512;
@ -365,7 +499,30 @@ u8 mapperMBC3ReadRAM(u16 address)
return gbDataMBC3.mapperLControl; return gbDataMBC3.mapperLControl;
} }
} }
return 0;
if (!genericflashcardEnable)
return 0xff;
else
if ((address & 0x1000) >= 0x1000)
{
// The value returned when reading RAM while it's disabled
// is constant, exept for the GBASP hardware.
// (actually, is the address that read is out of the ROM, the returned value if 0xff...)
if (PC.W>=0xff80)
return 0xff;
else
if ((gbHardware & 0x08) && (gbGBCColorType == 2))
{
if (address & 1)
return 0xfb;
else
return 0x7a;
}
else
return 0x0a;
}
else
return gbDisabledRam[address & 7];
} }
void memoryUpdateMapMBC3() void memoryUpdateMapMBC3()
@ -406,6 +563,7 @@ void mapperMBC5ROM(u16 address, u8 value)
gbDataMBC5.mapperRAMEnable = ( ( value & 0x0a) == 0x0a ? 1 : 0); gbDataMBC5.mapperRAMEnable = ( ( value & 0x0a) == 0x0a ? 1 : 0);
break; break;
case 0x2000: // ROM bank select case 0x2000: // ROM bank select
if(address < 0x3000) { if(address < 0x3000) {
value = value & 0xff; value = value & 0xff;
if(value == gbDataMBC5.mapperROMBank) if(value == gbDataMBC5.mapperROMBank)
@ -466,6 +624,38 @@ void mapperMBC5RAM(u16 address, u8 value)
} }
} }
// MBC5 read RAM
u8 mapperMBC5ReadRAM(u16 address)
{
if(gbDataMBC5.mapperRAMEnable)
return gbMemoryMap[address>>12][address & 0x0fff];
if (!genericflashcardEnable)
return 0xff;
else
if ((address & 0x1000) >= 0x1000)
{
// The value returned when reading RAM while it's disabled
// is constant, exept for the GBASP hardware.
// (actually, is the address that read is out of the ROM, the returned value if 0xff...)
if (PC.W>=0xff80)
return 0xff;
else
if ((gbHardware & 0x08) && (gbGBCColorType == 2))
{
if (address & 1)
return 0xfb;
else
return 0x7a;
}
else
return 0x0a;
}
else
return gbDisabledRam[address & 7];
}
void memoryUpdateMapMBC5() void memoryUpdateMapMBC5()
{ {
int tmpAddress = (gbDataMBC5.mapperROMBank << 14) | int tmpAddress = (gbDataMBC5.mapperROMBank << 14) |
@ -568,7 +758,30 @@ u8 mapperMBC7ReadRAM(u16 address)
case 0xa080: case 0xa080:
return gbDataMBC7.value; return gbDataMBC7.value;
} }
return 0xff;
if (!genericflashcardEnable)
return 0xff;
else
if ((address & 0x1000) >= 0x1000)
{
// The value returned when reading RAM while it's disabled
// is constant, exept for the GBASP hardware.
// (actually, is the address that read is out of the ROM, the returned value if 0xff...)
if (PC.W>=0xff80)
return 0xff;
else
if ((gbHardware & 0x08) && (gbGBCColorType == 2))
{
if (address & 1)
return 0xfb;
else
return 0x7a;
}
else
return 0x0a;
}
else
return gbDisabledRam[address & 7];
} }
// MBC7 RAM write // MBC7 RAM write
@ -717,7 +930,7 @@ void mapperMBC7RAM(u16 address, u8 value)
void memoryUpdateMapMBC7() void memoryUpdateMapMBC7()
{ {
int tmpAddress = (gbDataMBC5.mapperROMBank << 14); int tmpAddress = (gbDataMBC7.mapperROMBank << 14);
tmpAddress &= gbRomSizeMask; tmpAddress &= gbRomSizeMask;
gbMemoryMap[0x04] = &gbRom[tmpAddress]; gbMemoryMap[0x04] = &gbRom[tmpAddress];
@ -965,3 +1178,540 @@ void memoryUpdateMapHuC3()
gbMemoryMap[0x0b] = &gbRam[tmpAddress + 0x1000]; gbMemoryMap[0x0b] = &gbRam[tmpAddress + 0x1000];
} }
} }
// TAMA5 (for Tamagotchi 3 (gb)).
// Very basic (and ugly :p) support, only rom bank switching is actually working...
mapperTAMA5 gbDataTAMA5 = {
1, // RAM enable
1, // ROM bank
0, // RAM bank
0, // RAM address
0, // RAM Byte select
0, // mapper command number
0, // mapper last command;
0, // commands 0x0
0, // commands 0x1
0, // commands 0x2
0, // commands 0x3
0, // commands 0x4
0, // commands 0x5
0, // commands 0x6
0, // commands 0x7
0, // commands 0x8
0, // commands 0x9
0, // commands 0xa
0, // commands 0xb
0, // commands 0xc
0, // commands 0xd
0, // commands 0xe
0, // commands 0xf
0, // register
0, // timer clock latch
0, // timer clock register
0, // timer seconds
0, // timer minutes
0, // timer hours
0, // timer days
0, // timer months
0, // timer years
0, // timer control
0, // timer latched seconds
0, // timer latched minutes
0, // timer latched hours
0, // timer latched days
0, // timer latched months
0, // timer latched years
0, // timer latched control
(time_t)-1 // last time
};
void memoryUpdateTAMA5Clock()
{
if ((gbDataTAMA5.mapperYears & 3) == 0)
gbDaysinMonth[1] = 29;
else
gbDaysinMonth[1] = 28;
time_t now = time(NULL);
time_t diff = now - gbDataTAMA5.mapperLastTime;
if(diff > 0) {
// update the clock according to the last update time
gbDataTAMA5.mapperSeconds += (int)(diff % 60);
if(gbDataTAMA5.mapperSeconds > 59) {
gbDataTAMA5.mapperSeconds -= 60;
gbDataTAMA5.mapperMinutes++;
}
diff /= 60;
gbDataTAMA5.mapperMinutes += (int)(diff % 60);
if(gbDataTAMA5.mapperMinutes > 59) {
gbDataTAMA5.mapperMinutes -= 60;
gbDataTAMA5.mapperHours++;
}
diff /= 60;
gbDataTAMA5.mapperHours += (int)(diff % 24);
diff /= 24;
if(gbDataTAMA5.mapperHours > 23) {
gbDataTAMA5.mapperHours -= 24;
diff++;
}
time_t days = diff;
while (days)
{
gbDataTAMA5.mapperDays++;
days--;
if (gbDataTAMA5.mapperDays>gbDaysinMonth[gbDataTAMA5.mapperMonths-1])
{
gbDataTAMA5.mapperDays = 1;
gbDataTAMA5.mapperMonths++;
if (gbDataTAMA5.mapperMonths>12)
{
gbDataTAMA5.mapperMonths = 1;
gbDataTAMA5.mapperYears++;
if ((gbDataTAMA5.mapperYears & 3) == 0)
gbDaysinMonth[1] = 29;
else
gbDaysinMonth[1] = 28;
}
}
}
}
gbDataTAMA5.mapperLastTime = now;
}
// TAMA5 RAM write
void mapperTAMA5RAM(u16 address, u8 value)
{
if ((address & 0xffff) <= 0xa001)
{
switch (address & 1)
{
case 0: // 'Values' Register
{
value &= 0xf;
gbDataTAMA5.mapperCommands[gbDataTAMA5.mapperCommandNumber] = value;
gbMemoryMap[0xa][0] = value;
int test = gbDataTAMA5.mapperCommands[gbDataTAMA5.mapperCommandNumber & 0x0e] |
(gbDataTAMA5.mapperCommands[(gbDataTAMA5.mapperCommandNumber & 0x0e) +1]<<4);
if ((gbDataTAMA5.mapperCommandNumber & 0xe) == 0) // Read Command !!!
{
gbDataTAMA5.mapperROMBank = gbDataTAMA5.mapperCommands[0] |
(gbDataTAMA5.mapperCommands[1]<<4);
int tmpAddress = (gbDataTAMA5.mapperROMBank << 14);
tmpAddress &= gbRomSizeMask;
gbMemoryMap[0x04] = &gbRom[tmpAddress];
gbMemoryMap[0x05] = &gbRom[tmpAddress + 0x1000];
gbMemoryMap[0x06] = &gbRom[tmpAddress + 0x2000];
gbMemoryMap[0x07] = &gbRom[tmpAddress + 0x3000];
gbDataTAMA5.mapperCommands[0x0f] = 0;
}
else if ((gbDataTAMA5.mapperCommandNumber & 0xe) == 4)
{
gbDataTAMA5.mapperCommands[0x0f] = 1;
if (gbDataTAMA5.mapperCommandNumber == 4)
gbDataTAMA5.mapperCommands[5] =0; // correct ?
}
else if ((gbDataTAMA5.mapperCommandNumber & 0xe) == 6)
{
gbDataTAMA5.mapperRamByteSelect = (gbDataTAMA5.mapperCommands[7]<<4) |
(gbDataTAMA5.mapperCommands[6]&0x0f);
// Write Commands !!!
if (gbDataTAMA5.mapperCommands[0x0f] && (gbDataTAMA5.mapperCommandNumber == 7))
{
int data = gbDataTAMA5.mapperCommands[0x04] & 0x0f |
(gbDataTAMA5.mapperCommands[0x05] <<4);
// Not sure when the write command should reset...
// but it doesn't seem to matter.
// gbDataTAMA5.mapperCommands[0x0f] = 0;
if (gbDataTAMA5.mapperRamByteSelect == 0x8) // Timer stuff
{
switch (data & 0xf)
{
case 0x7:
gbDataTAMA5.mapperDays = ((gbDataTAMA5.mapperDays)/10)*10 + (data >> 4);
break;
case 0x8:
gbDataTAMA5.mapperDays = (gbDataTAMA5.mapperDays%10) + (data >>4)*10;
break;
case 0x9:
gbDataTAMA5.mapperMonths = ((gbDataTAMA5.mapperMonths)/10)*10 + (data >> 4);
break;
case 0xa:
gbDataTAMA5.mapperMonths = (gbDataTAMA5.mapperMonths%10) + (data >>4)*10;
break;
case 0xb:
gbDataTAMA5.mapperYears = ((gbDataTAMA5.mapperYears)%1000) + (data >> 4)*1000;
break;
case 0xc:
gbDataTAMA5.mapperYears = (gbDataTAMA5.mapperYears%100) + (gbDataTAMA5.mapperYears/1000)*1000 +
(data >>4)*100;
break;
default :
break;
}
}
else if (gbDataTAMA5.mapperRamByteSelect == 0x18) // Timer stuff again
{
memoryUpdateTAMA5Clock();
gbDataTAMA5.mapperLSeconds = gbDataTAMA5.mapperSeconds;
gbDataTAMA5.mapperLMinutes = gbDataTAMA5.mapperMinutes;
gbDataTAMA5.mapperLHours = gbDataTAMA5.mapperHours;
gbDataTAMA5.mapperLDays = gbDataTAMA5.mapperDays;
gbDataTAMA5.mapperLMonths = gbDataTAMA5.mapperMonths;
gbDataTAMA5.mapperLYears = gbDataTAMA5.mapperYears;
gbDataTAMA5.mapperLControl = gbDataTAMA5.mapperControl;
int seconds = (gbDataTAMA5.mapperLSeconds / 10)*16 + gbDataTAMA5.mapperLSeconds %10;
int secondsL = (gbDataTAMA5.mapperLSeconds % 10);
int secondsH = (gbDataTAMA5.mapperLSeconds / 10);
int minutes = (gbDataTAMA5.mapperLMinutes / 10)*16 + gbDataTAMA5.mapperLMinutes %10;
int hours = (gbDataTAMA5.mapperLHours / 10)*16 + gbDataTAMA5.mapperLHours %10;
int DaysL = gbDataTAMA5.mapperLDays % 10;
int DaysH = gbDataTAMA5.mapperLDays /10;
int MonthsL = gbDataTAMA5.mapperLMonths % 10;
int MonthsH = gbDataTAMA5.mapperLMonths / 10;
int Years3 = (gbDataTAMA5.mapperLYears / 100) % 10;
int Years4 = (gbDataTAMA5.mapperLYears / 1000);
switch (data & 0x0f)
{
// I guess cases 0 and 1 are used for secondsL and secondsH
// so the game would update the timer values on screen when
// the seconds reset to 0... ?
case 0x0:
gbTAMA5ram[gbDataTAMA5.mapperRamByteSelect] = secondsL;
break;
case 0x1:
gbTAMA5ram[gbDataTAMA5.mapperRamByteSelect] = secondsH;
break;
case 0x7:
gbTAMA5ram[gbDataTAMA5.mapperRamByteSelect] = DaysL; // days low
break;
case 0x8:
gbTAMA5ram[gbDataTAMA5.mapperRamByteSelect] = DaysH; // days high
break;
case 0x9:
gbTAMA5ram[gbDataTAMA5.mapperRamByteSelect] = MonthsL; // month low
break;
case 0xa:
gbTAMA5ram[gbDataTAMA5.mapperRamByteSelect] = MonthsH; // month high
break;
case 0xb:
gbTAMA5ram[gbDataTAMA5.mapperRamByteSelect] = Years4; // years 4th digit
break;
case 0xc:
gbTAMA5ram[gbDataTAMA5.mapperRamByteSelect] = Years3; // years 3rd digit
break;
default :
break;
}
gbTAMA5ram[0x54] = seconds; // incorrect ? (not used by the game) ?
gbTAMA5ram[0x64] = minutes;
gbTAMA5ram[0x74] = hours;
gbTAMA5ram[0x84] = DaysH*16+DaysL; // incorrect ? (not used by the game) ?
gbTAMA5ram[0x94] = MonthsH*16+MonthsL; // incorrect ? (not used by the game) ?
time(&gbDataTAMA5.mapperLastTime);
gbMemoryMap[0xa][0] = 1;
}
else if (gbDataTAMA5.mapperRamByteSelect == 0x28) // Timer stuff again
{
if ((data & 0xf) == 0xb)
gbDataTAMA5.mapperYears = ((gbDataTAMA5.mapperYears>>2)<<2) + (data & 3);
}
else if (gbDataTAMA5.mapperRamByteSelect == 0x44)
{
gbDataTAMA5.mapperMinutes = (data/16)*10 + data%16;
}
else if (gbDataTAMA5.mapperRamByteSelect == 0x54)
{
gbDataTAMA5.mapperHours = (data/16)*10 + data%16;
}
else
{
gbTAMA5ram[gbDataTAMA5.mapperRamByteSelect] = data;
}
}
}
}
break;
case 1: // 'Commands' Register
{
gbMemoryMap[0xa][1] = gbDataTAMA5.mapperCommandNumber = value;
// This should be only a 'is the flashrom ready ?' command.
// However as I couldn't find any 'copy' command
// (that seems to be needed for the saving system to work)
// I put it there...
if (value == 0x0a)
{
for (int i = 0; i<0x10; i++)
for (int j = 0; j<0x10; j++)
if (!(j&2))
gbTAMA5ram[(i*0x10)+j | 2] = gbTAMA5ram[(i*0x10)+j];
// Enable this to see the content of the flashrom in 0xe000
/*for (int k = 0; k<0x100; k++)
gbMemoryMap[0xe][k] = gbTAMA5ram[k];*/
gbMemoryMap[0xa][0] = gbDataTAMA5.mapperRAMEnable = 1;
}
else
{
if ((value & 0x0e) == 0x0c)
{
gbDataTAMA5.mapperRamByteSelect = gbDataTAMA5.mapperCommands[6] |
(gbDataTAMA5.mapperCommands[7]<<4);
u8 byte = gbTAMA5ram[gbDataTAMA5.mapperRamByteSelect];
gbMemoryMap[0xa][0] = (value & 1) ? byte >> 4 : byte & 0x0f;
gbDataTAMA5.mapperCommands[0x0f] = 0;
}
}
break;
}
}
}
else
{
if(gbDataTAMA5.mapperRAMEnable) {
if(gbDataTAMA5.mapperRAMBank != -1) {
if(gbRamSize) {
gbMemoryMap[address>>12][address & 0x0fff] = value;
systemSaveUpdateCounter = SYSTEM_SAVE_UPDATED;
}
}
}
}
}
// TAMA5 read RAM
u8 mapperTAMA5ReadRAM(u16 address)
{
return gbMemoryMap[address>>12][address & 0xfff];
}
void memoryUpdateMapTAMA5()
{
int tmpAddress = (gbDataTAMA5.mapperROMBank << 14);
tmpAddress &= gbRomSizeMask;
gbMemoryMap[0x04] = &gbRom[tmpAddress];
gbMemoryMap[0x05] = &gbRom[tmpAddress + 0x1000];
gbMemoryMap[0x06] = &gbRom[tmpAddress + 0x2000];
gbMemoryMap[0x07] = &gbRom[tmpAddress + 0x3000];
if(gbRamSize) {
tmpAddress = 0 << 13;
tmpAddress &= gbRamSizeMask;
gbMemoryMap[0x0a] = &gbRam[tmpAddress];
gbMemoryMap[0x0b] = &gbRam[tmpAddress + 0x1000];
}
}
// MMM01 Used in Momotarou collection (however the rom is corrupted)
mapperMMM01 gbDataMMM01 ={
0, // RAM enable
1, // ROM bank
0, // RAM bank
0, // memory model
0, // ROM high address
0, // RAM address
0 // Rom Bank 0 remapping
};
// MMM01 ROM write registers
void mapperMMM01ROM(u16 address, u8 value)
{
int tmpAddress = 0;
switch(address & 0x6000) {
case 0x0000: // RAM enable register
gbDataMMM01.mapperRAMEnable = ( ( value & 0x0a) == 0x0a ? 1 : 0);
break;
case 0x2000: // ROM bank select
// value = value & 0x1f;
if(value == 0)
value = 1;
if(value == gbDataMMM01.mapperROMBank)
break;
tmpAddress = value << 14;
// check current model
if(gbDataMMM01.mapperMemoryModel == 0) {
// model is 16/8, so we have a high address in use
tmpAddress |= (gbDataMMM01.mapperROMHighAddress) << 19;
}
else
tmpAddress |= gbDataMMM01.mapperRomBank0Remapping << 18;
tmpAddress &= gbRomSizeMask;
gbDataMMM01.mapperROMBank = value;
gbMemoryMap[0x04] = &gbRom[tmpAddress];
gbMemoryMap[0x05] = &gbRom[tmpAddress + 0x1000];
gbMemoryMap[0x06] = &gbRom[tmpAddress + 0x2000];
gbMemoryMap[0x07] = &gbRom[tmpAddress + 0x3000];
break;
case 0x4000: // RAM bank select
if(gbDataMMM01.mapperMemoryModel == 1) {
// 4/32 model, RAM bank switching provided
value = value & 0x03;
if(value == gbDataMBC1.mapperRAMBank)
break;
tmpAddress = value << 13;
tmpAddress &= gbRamSizeMask;
gbMemoryMap[0x0a] = &gbRam[tmpAddress];
gbMemoryMap[0x0b] = &gbRam[tmpAddress + 0x1000];
gbDataMMM01.mapperRAMBank = value;
gbDataMMM01.mapperRAMAddress = tmpAddress;
} else {
// 16/8, set the high address
gbDataMMM01.mapperROMHighAddress = value & 0x03;
tmpAddress = gbDataMMM01.mapperROMBank << 14;
tmpAddress |= (gbDataMMM01.mapperROMHighAddress) << 19;
tmpAddress &= gbRomSizeMask;
gbMemoryMap[0x04] = &gbRom[tmpAddress];
gbMemoryMap[0x05] = &gbRom[tmpAddress + 0x1000];
gbMemoryMap[0x06] = &gbRom[tmpAddress + 0x2000];
gbMemoryMap[0x07] = &gbRom[tmpAddress + 0x3000];
gbDataMMM01.mapperRomBank0Remapping = ((value<<1) | (value & 0x40 ? 1 : 0)) & 0xff;
tmpAddress = gbDataMMM01.mapperRomBank0Remapping << 18;
tmpAddress &= gbRomSizeMask;
gbMemoryMap[0x00] = &gbRom[tmpAddress];
gbMemoryMap[0x01] = &gbRom[tmpAddress + 0x1000];
gbMemoryMap[0x02] = &gbRom[tmpAddress + 0x2000];
gbMemoryMap[0x03] = &gbRom[tmpAddress + 0x3000];
}
break;
case 0x6000: // memory model select
gbDataMMM01.mapperMemoryModel = value & 1;
break;
}
}
// MMM01 RAM write
void mapperMMM01RAM(u16 address, u8 value)
{
if(gbDataMMM01.mapperRAMEnable) {
if(gbRamSize) {
gbMemoryMap[address >> 12][address & 0x0fff] = value;
systemSaveUpdateCounter = SYSTEM_SAVE_UPDATED;
}
}
}
void memoryUpdateMapMMM01()
{
int tmpAddress = gbDataMMM01.mapperROMBank << 14;
// check current model
if(gbDataMMM01.mapperMemoryModel == 1) {
// model is 16/8, so we have a high address in use
tmpAddress |= (gbDataMMM01.mapperROMHighAddress) << 19;
}
tmpAddress &= gbRomSizeMask;
gbMemoryMap[0x04] = &gbRom[tmpAddress];
gbMemoryMap[0x05] = &gbRom[tmpAddress + 0x1000];
gbMemoryMap[0x06] = &gbRom[tmpAddress + 0x2000];
gbMemoryMap[0x07] = &gbRom[tmpAddress + 0x3000];
tmpAddress = gbDataMMM01.mapperRomBank0Remapping << 18;
tmpAddress &= gbRomSizeMask;
gbMemoryMap[0x00] = &gbRom[tmpAddress];
gbMemoryMap[0x01] = &gbRom[tmpAddress + 0x1000];
gbMemoryMap[0x02] = &gbRom[tmpAddress + 0x2000];
gbMemoryMap[0x03] = &gbRom[tmpAddress + 0x3000];
if(gbRamSize) {
gbMemoryMap[0x0a] = &gbRam[gbDataMMM01.mapperRAMAddress];
gbMemoryMap[0x0b] = &gbRam[gbDataMMM01.mapperRAMAddress + 0x1000];
}
}
// GameGenie ROM write registers
void mapperGGROM(u16 address, u8 value)
{
int tmpAddress = 0;
switch(address & 0x6000) {
case 0x0000: // RAM enable register
break;
case 0x2000: // GameGenie has only a half bank
break;
case 0x4000: // GameGenie has no RAM
if ((address >=0x4001) && (address <= 0x4020)) // GG Hardware Registers
gbMemoryMap[address >> 12][address & 0x0fff] = value;
break;
case 0x6000: // GameGenie has only a half bank
break;
}
}
// GS3 Used to emulate the GS V3.0 rom bank switching
mapperGS3 gbDataGS3 = { 1 }; // ROM bank
void mapperGS3ROM(u16 address, u8 value)
{
int tmpAddress = 0;
switch(address & 0x6000) {
case 0x0000: // GS has no ram
break;
case 0x2000: // GS has no 'classic' ROM bank select
break;
case 0x4000: // GS has no ram
break;
case 0x6000: // 0x6000 area is RW, and used for GS hardware registers
if (address == 0x7FE1) // This is the (half) ROM bank select register
{
if(value == gbDataGS3.mapperROMBank)
break;
tmpAddress = value << 13;
tmpAddress &= gbRomSizeMask;
gbDataGS3.mapperROMBank = value;
gbMemoryMap[0x04] = &gbRom[tmpAddress];
gbMemoryMap[0x05] = &gbRom[tmpAddress + 0x1000];
}
else
gbMemoryMap[address>>12][address & 0x0fff] = value;
break;
}
}
void memoryUpdateMapGS3()
{
int tmpAddress = gbDataGS3.mapperROMBank << 13;
tmpAddress &= gbRomSizeMask;
// GS can only change a half ROM bank
gbMemoryMap[0x04] = &gbRom[tmpAddress];
gbMemoryMap[0x05] = &gbRom[tmpAddress + 0x1000];
}

View File

@ -1,7 +1,7 @@
// -*- C++ -*- // -*- C++ -*-
// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. // VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator.
// Copyright (C) 1999-2003 Forgotten // Copyright (C) 1999-2003 Forgotten
// Copyright (C) 2004 Forgotten and the VBA development team // Copyright (C) 2004-2006 Forgotten and the VBA development team
// This program is free software; you can redistribute it and/or modify // 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 // it under the terms of the GNU General Public License as published by
@ -26,6 +26,7 @@ struct mapperMBC1 {
int mapperMemoryModel; int mapperMemoryModel;
int mapperROMHighAddress; int mapperROMHighAddress;
int mapperRAMAddress; int mapperRAMAddress;
int mapperRomBank0Remapping;
}; };
struct mapperMBC2 { struct mapperMBC2 {
@ -106,15 +107,62 @@ struct mapperHuC3 {
int mapperRegister8; int mapperRegister8;
}; };
struct mapperTAMA5 {
int mapperRAMEnable;
int mapperROMBank;
int mapperRAMBank;
int mapperRAMAddress;
int mapperRamByteSelect;
int mapperCommandNumber;
int mapperLastCommandNumber;
int mapperCommands[0x10];
int mapperRegister;
int mapperClockLatch;
int mapperClockRegister;
int mapperSeconds;
int mapperMinutes;
int mapperHours;
int mapperDays;
int mapperMonths;
int mapperYears;
int mapperControl;
int mapperLSeconds;
int mapperLMinutes;
int mapperLHours;
int mapperLDays;
int mapperLMonths;
int mapperLYears;
int mapperLControl;
time_t mapperLastTime;
};
struct mapperMMM01 {
int mapperRAMEnable;
int mapperROMBank;
int mapperRAMBank;
int mapperMemoryModel;
int mapperROMHighAddress;
int mapperRAMAddress;
int mapperRomBank0Remapping;
};
struct mapperGS3 {
int mapperROMBank;
};
extern mapperMBC1 gbDataMBC1; extern mapperMBC1 gbDataMBC1;
extern mapperMBC2 gbDataMBC2; extern mapperMBC2 gbDataMBC2;
extern mapperMBC3 gbDataMBC3; extern mapperMBC3 gbDataMBC3;
extern mapperMBC5 gbDataMBC5; extern mapperMBC5 gbDataMBC5;
extern mapperHuC1 gbDataHuC1; extern mapperHuC1 gbDataHuC1;
extern mapperHuC3 gbDataHuC3; extern mapperHuC3 gbDataHuC3;
extern mapperTAMA5 gbDataTAMA5;
extern mapperMMM01 gbDataMMM01;
extern mapperGS3 gbDataGS3;
void mapperMBC1ROM(u16,u8); void mapperMBC1ROM(u16,u8);
void mapperMBC1RAM(u16,u8); void mapperMBC1RAM(u16,u8);
u8 mapperMBC1ReadRAM(u16);
void mapperMBC2ROM(u16,u8); void mapperMBC2ROM(u16,u8);
void mapperMBC2RAM(u16,u8); void mapperMBC2RAM(u16,u8);
void mapperMBC3ROM(u16,u8); void mapperMBC3ROM(u16,u8);
@ -122,6 +170,7 @@ void mapperMBC3RAM(u16,u8);
u8 mapperMBC3ReadRAM(u16); u8 mapperMBC3ReadRAM(u16);
void mapperMBC5ROM(u16,u8); void mapperMBC5ROM(u16,u8);
void mapperMBC5RAM(u16,u8); void mapperMBC5RAM(u16,u8);
u8 mapperMBC5ReadRAM(u16);
void mapperMBC7ROM(u16,u8); void mapperMBC7ROM(u16,u8);
void mapperMBC7RAM(u16,u8); void mapperMBC7RAM(u16,u8);
u8 mapperMBC7ReadRAM(u16); u8 mapperMBC7ReadRAM(u16);
@ -130,7 +179,13 @@ void mapperHuC1RAM(u16,u8);
void mapperHuC3ROM(u16,u8); void mapperHuC3ROM(u16,u8);
void mapperHuC3RAM(u16,u8); void mapperHuC3RAM(u16,u8);
u8 mapperHuC3ReadRAM(u16); u8 mapperHuC3ReadRAM(u16);
void mapperTAMA5RAM(u16,u8);
u8 mapperTAMA5ReadRAM(u16);
void memoryUpdateTAMA5Clock();
void mapperMMM01ROM(u16,u8);
void mapperMMM01RAM(u16,u8);
void mapperGGROM(u16,u8);
void mapperGS3ROM(u16,u8);
//extern void (*mapper)(u16,u8); //extern void (*mapper)(u16,u8);
//extern void (*mapperRAM)(u16,u8); //extern void (*mapperRAM)(u16,u8);
//extern u8 (*mapperReadRAM)(u16); //extern u8 (*mapperReadRAM)(u16);
@ -142,7 +197,9 @@ extern void memoryUpdateMapMBC5();
extern void memoryUpdateMapMBC7(); extern void memoryUpdateMapMBC7();
extern void memoryUpdateMapHuC1(); extern void memoryUpdateMapHuC1();
extern void memoryUpdateMapHuC3(); extern void memoryUpdateMapHuC3();
extern void memoryUpdateMapTAMA5();
extern void memoryUpdateMapMMM01();
extern void memoryUpdateMapGS3();

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,61 +1,59 @@
// -*- C++ -*- // -*- C++ -*-
// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. // VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator.
// Copyright (C) 1999-2003 Forgotten // Copyright (C) 1999-2003 Forgotten
// Copyright (C) 2004 Forgotten and the VBA development team // Copyright (C) 2004 Forgotten and the VBA development team
// This program is free software; you can redistribute it and/or modify // 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 // it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2, or(at your option) // the Free Software Foundation; either version 2, or(at your option)
// any later version. // any later version.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details. // GNU General Public License for more details.
// //
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software Foundation, // along with this program; if not, write to the Free Software Foundation,
// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#define NR10 0xff10 #define NR10 0xff10
#define NR11 0xff11 #define NR11 0xff11
#define NR12 0xff12 #define NR12 0xff12
#define NR13 0xff13 #define NR13 0xff13
#define NR14 0xff14 #define NR14 0xff14
#define NR21 0xff16 #define NR21 0xff16
#define NR22 0xff17 #define NR22 0xff17
#define NR23 0xff18 #define NR23 0xff18
#define NR24 0xff19 #define NR24 0xff19
#define NR30 0xff1a #define NR30 0xff1a
#define NR31 0xff1b #define NR31 0xff1b
#define NR32 0xff1c #define NR32 0xff1c
#define NR33 0xff1d #define NR33 0xff1d
#define NR34 0xff1e #define NR34 0xff1e
#define NR41 0xff20 #define NR41 0xff20
#define NR42 0xff21 #define NR42 0xff21
#define NR43 0xff22 #define NR43 0xff22
#define NR44 0xff23 #define NR44 0xff23
#define NR50 0xff24 #define NR50 0xff24
#define NR51 0xff25 #define NR51 0xff25
#define NR52 0xff26 #define NR52 0xff26
#define SOUND_EVENT(address,value) \ #define SOUND_EVENT(address,value) \
gbSoundEvent(address,value) gbSoundEvent(address,value)
extern void gbSoundTick(); extern void gbSoundTick();
extern void gbSoundPause(); extern void gbSoundPause();
extern void gbSoundResume(); extern void gbSoundResume();
extern void gbSoundEnable(int); extern void gbSoundEnable(int);
extern void gbSoundDisable(int); extern void gbSoundDisable(int);
extern int gbSoundGetEnable(); extern int gbSoundGetEnable();
extern void gbSoundReset(); extern void gbSoundReset();
extern void gbSoundSaveGame(gzFile); extern void gbSoundSaveGame(gzFile);
extern void gbSoundReadGame(int,gzFile); extern void gbSoundReadGame(int,gzFile);
extern void gbSoundEvent(register u16, register int); extern void gbSoundEvent(register u16, register int);
extern void gbSoundSetQuality(int); extern void gbSoundSetQuality(int);
extern u8 gbSoundRead(u16 address); extern int soundTicks;
extern int soundQuality;
extern int soundTicks; extern int SOUND_CLOCK_TICKS;
extern int soundQuality;
extern int SOUND_CLOCK_TICKS;

File diff suppressed because it is too large Load Diff

View File

@ -131,10 +131,7 @@ extern int getopt ();
extern int getopt_long (); extern int getopt_long ();
extern int getopt_long_only (); extern int getopt_long_only ();
extern int _getopt_internal (int argc, char *const *argv, extern int _getopt_internal ();
const char *shortopts,
const struct option *longopts, int *longind,
int long_only);
#endif /* __STDC__ */ #endif /* __STDC__ */
#ifdef __cplusplus #ifdef __cplusplus

View File

@ -1,180 +0,0 @@
/* getopt_long and getopt_long_only entry points for GNU getopt.
Copyright (C) 1987,88,89,90,91,92,93,94,96,97,98
Free Software Foundation, Inc.
NOTE: This source is derived from an old version taken from the GNU C
Library (glibc).
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. */
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include "getopt.h"
#if !defined __STDC__ || !__STDC__
/* This is a separate conditional since some stdc systems
reject `defined (const)'. */
#ifndef const
#define const
#endif
#endif
#include <stdio.h>
/* Comment out all this code if we are using the GNU C Library, and are not
actually compiling the library itself. This code is part of the GNU C
Library, but also included in many other GNU distributions. Compiling
and linking in this code is a waste when using the GNU C library
(especially if it is a shared library). Rather than having every GNU
program understand `configure --with-gnu-libc' and omit the object files,
it is simpler to just do this in the source for each such file. */
#define GETOPT_INTERFACE_VERSION 2
#if !defined _LIBC && defined __GLIBC__ && __GLIBC__ >= 2
#include <gnu-versions.h>
#if _GNU_GETOPT_INTERFACE_VERSION == GETOPT_INTERFACE_VERSION
#define ELIDE_CODE
#endif
#endif
#ifndef ELIDE_CODE
/* This needs to come after some library #include
to get __GNU_LIBRARY__ defined. */
#ifdef __GNU_LIBRARY__
#include <stdlib.h>
#endif
#ifndef NULL
#define NULL 0
#endif
int
getopt_long (int argc, char *const *argv, const char *options, const struct option *long_options, int *opt_index)
{
return _getopt_internal (argc, argv, options, long_options, opt_index, 0);
}
/* Like getopt_long, but '-' as well as '--' can indicate a long option.
If an option that starts with '-' (not '--') doesn't match a long option,
but does match a short option, it is parsed as a short option
instead. */
int
getopt_long_only (int argc, char *const *argv, const char *options, const struct option *long_options, int *opt_index)
{
return _getopt_internal (argc, argv, options, long_options, opt_index, 1);
}
#endif /* Not ELIDE_CODE. */
#ifdef TEST
#include <stdio.h>
int
main (argc, argv)
int argc;
char **argv;
{
int c;
int digit_optind = 0;
while (1)
{
int this_option_optind = optind ? optind : 1;
int option_index = 0;
static struct option long_options[] =
{
{"add", 1, 0, 0},
{"append", 0, 0, 0},
{"delete", 1, 0, 0},
{"verbose", 0, 0, 0},
{"create", 0, 0, 0},
{"file", 1, 0, 0},
{0, 0, 0, 0}
};
c = getopt_long (argc, argv, "abc:d:0123456789",
long_options, &option_index);
if (c == -1)
break;
switch (c)
{
case 0:
printf ("option %s", long_options[option_index].name);
if (optarg)
printf (" with arg %s", optarg);
printf ("\n");
break;
case '0':
case '1':
case '2':
case '3':
case '4':
case '5':
case '6':
case '7':
case '8':
case '9':
if (digit_optind != 0 && digit_optind != this_option_optind)
printf ("digits occur in two different argv-elements.\n");
digit_optind = this_option_optind;
printf ("option %c\n", c);
break;
case 'a':
printf ("option a\n");
break;
case 'b':
printf ("option b\n");
break;
case 'c':
printf ("option c with value `%s'\n", optarg);
break;
case 'd':
printf ("option d with value `%s'\n", optarg);
break;
case '?':
break;
default:
printf ("?? getopt returned character code 0%o ??\n", c);
}
}
if (optind < argc)
{
printf ("non-option ARGV-elements: ");
while (optind < argc)
printf ("%s ", argv[optind++]);
printf ("\n");
}
exit (0);
}
#endif /* TEST */

File diff suppressed because it is too large Load Diff

View File

@ -40,11 +40,6 @@
static unsigned interp_mask[2]; static unsigned interp_mask[2];
static unsigned interp_bits_per_pixel; static unsigned interp_bits_per_pixel;
typedef unsigned short interp_uint16;
typedef unsigned int interp_uint32;
#define restrict
#define INTERP_16_MASK_1(v) (v & interp_mask[0]) #define INTERP_16_MASK_1(v) (v & interp_mask[0])
#define INTERP_16_MASK_2(v) (v & interp_mask[1]) #define INTERP_16_MASK_2(v) (v & interp_mask[1])

View File

@ -9,7 +9,7 @@
* Adapted from original gzio.c from zlib library by Forgotten * Adapted from original gzio.c from zlib library by Forgotten
*/ */
/* @(#) $Id: memgzio.c,v 1.3 2004/01/17 23:07:32 kxu Exp $ */ /* @(#) $Id: memgzio.c,v 1.5 2006/06/06 21:04:20 spacy51 Exp $ */
#include <stdio.h> #include <stdio.h>
#include <stdarg.h> #include <stdarg.h>
@ -125,7 +125,7 @@ local size_t memWrite(const void *buffer, size_t size, size_t count,
total = file->available; total = file->available;
} }
memcpy(file->next, buffer, total); memcpy(file->next, buffer, total);
file->available -= total; file->available -= (int)total;
file->next += total; file->next += total;
return total; return total;
} }
@ -147,7 +147,7 @@ local size_t memRead(void *buffer, size_t size, size_t count,
total = file->available; total = file->available;
} }
memcpy(buffer, file->next, total); memcpy(buffer, file->next, total);
file->available -= total; file->available -= (int)total;
file->next += total; file->next += total;
return total; return total;
} }
@ -170,7 +170,7 @@ local int memPutc(int c, MEMFILE *file)
local long memTell(MEMFILE *f) local long memTell(MEMFILE *f)
{ {
return (f->next - f->memory) - 8; return (long)(f->next - f->memory) - 8;
} }
local int memError(MEMFILE *f) local int memError(MEMFILE *f)
@ -197,7 +197,7 @@ local int memPrintf(MEMFILE *f, const char *format, ...)
len = vsprintf(buffer, format, list); len = vsprintf(buffer, format, list);
va_end(list); va_end(list);
return memWrite(buffer, 1, len, f); return (int)memWrite(buffer, 1, len, f);
} }
/* =========================================================================== /* ===========================================================================
@ -209,7 +209,10 @@ local int memPrintf(MEMFILE *f, const char *format, ...)
can be checked to distinguish the two cases (if errno is zero, the can be checked to distinguish the two cases (if errno is zero, the
zlib error is Z_MEM_ERROR). zlib error is Z_MEM_ERROR).
*/ */
local gzFile gz_open (char *memory, const int available, const char *mode) local gzFile gz_open (memory, available, mode)
char *memory;
const int available;
const char *mode;
{ {
int err; int err;
int level = Z_DEFAULT_COMPRESSION; /* compression level */ int level = Z_DEFAULT_COMPRESSION; /* compression level */
@ -309,7 +312,10 @@ local gzFile gz_open (char *memory, const int available, const char *mode)
/* =========================================================================== /* ===========================================================================
Opens a gzip (.gz) file for reading or writing. Opens a gzip (.gz) file for reading or writing.
*/ */
gzFile ZEXPORT memgzopen (char *memory, int available, const char *mode) gzFile ZEXPORT memgzopen (memory, available, mode)
char *memory;
int available;
const char *mode;
{ {
return gz_open (memory, available, mode); return gz_open (memory, available, mode);
} }
@ -319,12 +325,13 @@ gzFile ZEXPORT memgzopen (char *memory, int available, const char *mode)
for end of file. for end of file.
IN assertion: the stream s has been sucessfully opened for reading. IN assertion: the stream s has been sucessfully opened for reading.
*/ */
local int get_byte(mem_stream *s) local int get_byte(s)
mem_stream *s;
{ {
if (s->z_eof) return EOF; if (s->z_eof) return EOF;
if (s->stream.avail_in == 0) { if (s->stream.avail_in == 0) {
errno = 0; errno = 0;
s->stream.avail_in = memRead(s->inbuf, 1, Z_BUFSIZE, s->file); s->stream.avail_in = (uInt)memRead(s->inbuf, 1, Z_BUFSIZE, s->file);
if (s->stream.avail_in == 0) { if (s->stream.avail_in == 0) {
s->z_eof = 1; s->z_eof = 1;
if (memError(s->file)) s->z_err = Z_ERRNO; if (memError(s->file)) s->z_err = Z_ERRNO;
@ -345,7 +352,8 @@ local int get_byte(mem_stream *s)
s->stream.avail_in is zero for the first time, but may be non-zero s->stream.avail_in is zero for the first time, but may be non-zero
for concatenated .gz files. for concatenated .gz files.
*/ */
local void check_header(mem_stream *s) local void check_header(s)
mem_stream *s;
{ {
int method; /* method byte */ int method; /* method byte */
int flags; /* flags byte */ int flags; /* flags byte */
@ -397,7 +405,8 @@ local void check_header(mem_stream *s)
* Cleanup then free the given mem_stream. Return a zlib error code. * Cleanup then free the given mem_stream. Return a zlib error code.
Try freeing in the reverse order of allocations. Try freeing in the reverse order of allocations.
*/ */
local int destroy (mem_stream *s) local int destroy (s)
mem_stream *s;
{ {
int err = Z_OK; int err = Z_OK;
@ -434,7 +443,10 @@ local int destroy (mem_stream *s)
Reads the given number of uncompressed bytes from the compressed file. Reads the given number of uncompressed bytes from the compressed file.
gzread returns the number of bytes actually read (0 for end of file). gzread returns the number of bytes actually read (0 for end of file).
*/ */
int ZEXPORT memgzread (gzFile file, voidp buf, unsigned len) int ZEXPORT memgzread (file, buf, len)
gzFile file;
voidp buf;
unsigned len;
{ {
mem_stream *s = (mem_stream*)file; mem_stream *s = (mem_stream*)file;
Bytef *start = (Bytef*)buf; /* starting point for crc computation */ Bytef *start = (Bytef*)buf; /* starting point for crc computation */
@ -464,8 +476,7 @@ int ZEXPORT memgzread (gzFile file, voidp buf, unsigned len)
s->stream.avail_in -= n; s->stream.avail_in -= n;
} }
if (s->stream.avail_out > 0) { if (s->stream.avail_out > 0) {
s->stream.avail_out -= memRead(next_out, 1, s->stream.avail_out, s->stream.avail_out -= (uInt)memRead(next_out, 1, s->stream.avail_out, s->file);
s->file);
} }
len -= s->stream.avail_out; len -= s->stream.avail_out;
s->stream.total_in += (uLong)len; s->stream.total_in += (uLong)len;
@ -476,7 +487,7 @@ int ZEXPORT memgzread (gzFile file, voidp buf, unsigned len)
if (s->stream.avail_in == 0 && !s->z_eof) { if (s->stream.avail_in == 0 && !s->z_eof) {
errno = 0; errno = 0;
s->stream.avail_in = memRead(s->inbuf, 1, Z_BUFSIZE, s->file); s->stream.avail_in = (uInt)memRead(s->inbuf, 1, Z_BUFSIZE, s->file);
if (s->stream.avail_in == 0) { if (s->stream.avail_in == 0) {
s->z_eof = 1; s->z_eof = 1;
if (memError(s->file)) { if (memError(s->file)) {
@ -526,7 +537,10 @@ int ZEXPORT memgzread (gzFile file, voidp buf, unsigned len)
Writes the given number of uncompressed bytes into the compressed file. Writes the given number of uncompressed bytes into the compressed file.
gzwrite returns the number of bytes actually written (0 in case of error). gzwrite returns the number of bytes actually written (0 in case of error).
*/ */
int ZEXPORT memgzwrite (gzFile file, const voidp buf, unsigned len) int ZEXPORT memgzwrite (file, buf, len)
gzFile file;
const voidp buf;
unsigned len;
{ {
mem_stream *s = (mem_stream*)file; mem_stream *s = (mem_stream*)file;
@ -558,7 +572,9 @@ int ZEXPORT memgzwrite (gzFile file, const voidp buf, unsigned len)
Flushes all pending output into the compressed file. The parameter Flushes all pending output into the compressed file. The parameter
flush is as in the deflate() function. flush is as in the deflate() function.
*/ */
local int do_flush (gzFile file, int flush) local int do_flush (file, flush)
gzFile file;
int flush;
{ {
uInt len; uInt len;
int done = 0; int done = 0;
@ -598,7 +614,9 @@ local int do_flush (gzFile file, int flush)
/* =========================================================================== /* ===========================================================================
Outputs a long in LSB order to the given file Outputs a long in LSB order to the given file
*/ */
local void putLong (MEMFILE *file, uLong x) local void putLong (file, x)
MEMFILE *file;
uLong x;
{ {
int n; int n;
for (n = 0; n < 4; n++) { for (n = 0; n < 4; n++) {
@ -611,7 +629,8 @@ local void putLong (MEMFILE *file, uLong x)
Reads a long in LSB order from the given mem_stream. Sets z_err in case Reads a long in LSB order from the given mem_stream. Sets z_err in case
of error. of error.
*/ */
local uLong getLong (mem_stream *s) local uLong getLong (s)
mem_stream *s;
{ {
uLong x = (uLong)get_byte(s); uLong x = (uLong)get_byte(s);
int c; int c;
@ -628,7 +647,8 @@ local uLong getLong (mem_stream *s)
Flushes all pending output if necessary, closes the compressed file Flushes all pending output if necessary, closes the compressed file
and deallocates all the (de)compression state. and deallocates all the (de)compression state.
*/ */
int ZEXPORT memgzclose (gzFile file) int ZEXPORT memgzclose (file)
gzFile file;
{ {
int err; int err;
mem_stream *s = (mem_stream*)file; mem_stream *s = (mem_stream*)file;
@ -649,7 +669,8 @@ int ZEXPORT memgzclose (gzFile file)
return destroy((mem_stream*)file); return destroy((mem_stream*)file);
} }
long ZEXPORT memtell(gzFile file) long ZEXPORT memtell(file)
gzFile file;
{ {
mem_stream *s = (mem_stream*)file; mem_stream *s = (mem_stream*)file;

View File

@ -8,7 +8,12 @@
/* memgzio.c - IO on .gz files in memory /* memgzio.c - IO on .gz files in memory
* Adapted from original gzio.c from zlib library by Forgotten * Adapted from original gzio.c from zlib library by Forgotten
*/ */
#include <zutil.h>
#if defined(HAVE_ZUTIL_H) || defined(_WIN32)
# include <zutil.h>
#else
# include "../win32/dependencies/zlib/zutil.h"
#endif
gzFile ZEXPORT memgzopen(char *memory, int, const char *); gzFile ZEXPORT memgzopen(char *memory, int, const char *);
int ZEXPORT memgzread(gzFile, voidp, unsigned); int ZEXPORT memgzread(gzFile, voidp, unsigned);

View File

@ -20,7 +20,7 @@
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
#ifndef WIN32 #ifndef _WIN32
# include <unistd.h> # include <unistd.h>
# include <sys/socket.h> # include <sys/socket.h>
# include <netdb.h> # include <netdb.h>
@ -32,14 +32,15 @@
# else // ! HAVE_ARPA_INET_H # else // ! HAVE_ARPA_INET_H
# define socklen_t int # define socklen_t int
# endif // ! HAVE_ARPA_INET_H # endif // ! HAVE_ARPA_INET_H
#else // WIN32 # define SOCKET int
#else // _WIN32
# include <winsock.h> # include <winsock.h>
# include <io.h> # include <io.h>
# define socklen_t int # define socklen_t int
# define close closesocket # define close closesocket
# define read _read # define read _read
# define write _write # define write _write
#endif // WIN32 #endif // _WIN32
#include "GBA.h" #include "GBA.h"
@ -54,8 +55,8 @@ extern void debuggerSignal(int,int);
int remotePort = 55555; int remotePort = 55555;
int remoteSignal = 5; int remoteSignal = 5;
int remoteSocket = -1; SOCKET remoteSocket = -1;
int remoteListenSocket = -1; SOCKET remoteListenSocket = -1;
bool remoteConnected = false; bool remoteConnected = false;
bool remoteResumed = false; bool remoteResumed = false;
@ -85,11 +86,11 @@ int remoteTcpRecv(char *data, int len)
bool remoteTcpInit() bool remoteTcpInit()
{ {
if(remoteSocket == -1) { if(remoteSocket == -1) {
#ifdef WIN32 #ifdef _WIN32
WSADATA wsaData; WSADATA wsaData;
int error = WSAStartup(MAKEWORD(1,1),&wsaData); int error = WSAStartup(MAKEWORD(1,1),&wsaData);
#endif // WIN32 #endif // _WIN32
int s = socket(PF_INET, SOCK_STREAM, 0); SOCKET s = socket(PF_INET, SOCK_STREAM, 0);
remoteListenSocket = s; remoteListenSocket = s;
@ -131,19 +132,19 @@ bool remoteTcpInit()
} }
socklen_t len = sizeof(addr); socklen_t len = sizeof(addr);
#ifdef WIN32 #ifdef _WIN32
int flag = 0; int flag = 0;
ioctlsocket(s, FIONBIO, (unsigned long *)&flag); ioctlsocket(s, FIONBIO, (unsigned long *)&flag);
#endif // WIN32 #endif // _WIN32
int s2 = accept(s, (sockaddr *)&addr, &len); SOCKET s2 = accept(s, (sockaddr *)&addr, &len);
if(s2 > 0) { if(s2 > 0) {
fprintf(stderr, "Got a connection from %s %d\n", fprintf(stderr, "Got a connection from %s %d\n",
inet_ntoa((in_addr)addr.sin_addr), inet_ntoa((in_addr)addr.sin_addr),
ntohs(addr.sin_port)); ntohs(addr.sin_port));
} else { } else {
#ifdef WIN32 #ifdef _WIN32
int error = WSAGetLastError(); int error = WSAGetLastError();
#endif // WIN32 #endif // _WIN32
} }
char dummy; char dummy;
recv(s2, &dummy, 1, 0); recv(s2, &dummy, 1, 0);
@ -230,14 +231,14 @@ void remotePutPacket(char *packet)
char *hex = "0123456789abcdef"; char *hex = "0123456789abcdef";
char buffer[1024]; char buffer[1024];
int count = strlen(packet); size_t count = strlen(packet);
unsigned char csum = 0; unsigned char csum = 0;
char *p = buffer; char *p = buffer;
*p++ = '$'; *p++ = '$';
for(int i = 0 ;i < count; i++) { for(size_t i = 0 ;i < count; i++) {
csum += packet[i]; csum += packet[i];
*p++ = packet[i]; *p++ = packet[i];
} }
@ -246,7 +247,7 @@ void remotePutPacket(char *packet)
*p++ = hex[csum & 15]; *p++ = hex[csum & 15];
*p++ = 0; *p++ = 0;
// printf("Sending %s\n", buffer); // printf("Sending %s\n", buffer);
remoteSendFnc(buffer, count + 4); remoteSendFnc(buffer, (int)count + 4);
char c = 0; char c = 0;
remoteRecvFnc(&c, 1); remoteRecvFnc(&c, 1);

File diff suppressed because it is too large Load Diff

View File

@ -154,7 +154,7 @@ typedef struct
local int unzlocal_getByte(FILE *fin,int *pi) local int unzlocal_getByte(FILE *fin,int *pi)
{ {
unsigned char c; unsigned char c;
int err = fread(&c, 1, 1, fin); size_t err = fread(&c, 1, 1, fin);
if (err==1) if (err==1)
{ {
*pi = (int)c; *pi = (int)c;

View File

@ -19,8 +19,9 @@
// AboutDialog.cpp : implementation file // AboutDialog.cpp : implementation file
// //
#include "stdafx.h"
#include "AboutDialog.h" #include "AboutDialog.h"
#include "..\..\res\resource.h" #include "../AutoBuild.h"
#ifdef _DEBUG #ifdef _DEBUG
#define new DEBUG_NEW #define new DEBUG_NEW
@ -63,15 +64,13 @@ BOOL AboutDialog::OnInitDialog()
{ {
CDialog::OnInitDialog(); CDialog::OnInitDialog();
CWnd *p = GetDlgItem(IDC_TRANSLATOR_URL);
if(p) {
m_translator.SubclassDlgItem(IDC_TRANSLATOR_URL, this);
}
m_link.SetWindowText("http://vba.ngemu.com"); m_link.SetWindowText("http://vba.ngemu.com");
return TRUE; // return TRUE unless you set the focus to a control return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE // EXCEPTION: OCX Property Pages should return FALSE
} }
void AboutDialog::OnOK()
{
// TODO: Add extra validation here
CDialog::OnOK();
}

View File

@ -27,7 +27,7 @@
// //
#include "stdafx.h" #include "stdafx.h"
#include "Hyperlink.h" #include "Hyperlink.h"
#include "..\..\res\resource.h" #include "resource.h"
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// AboutDialog dialog // AboutDialog dialog
@ -60,7 +60,6 @@ class AboutDialog : public CDialog
// Generated message map functions // Generated message map functions
//{{AFX_MSG(AboutDialog) //{{AFX_MSG(AboutDialog)
virtual BOOL OnInitDialog(); virtual BOOL OnInitDialog();
virtual void OnOK();
//}}AFX_MSG //}}AFX_MSG

View File

@ -156,7 +156,7 @@ void AccelEditor::OnSelchangeCommands()
pAccel->GetString(szBuffer); pAccel->GetString(szBuffer);
index = m_currents.AddString(szBuffer); index = m_currents.AddString(szBuffer);
// and a pointer to the accel object. // and a pointer to the accel object.
m_currents.SetItemData(index, (DWORD)pAccel); m_currents.SetItemData(index, (DWORD_PTR)pAccel);
} }
} }
// Init the key editor // Init the key editor
@ -180,12 +180,12 @@ void AccelEditor::OnAssign()
WORD wKey; WORD wKey;
bool bCtrl, bAlt, bShift; bool bCtrl, bAlt, bShift;
int index;
if (!m_key.GetAccelKey(wKey, bCtrl, bAlt, bShift)) if (!m_key.GetAccelKey(wKey, bCtrl, bAlt, bShift))
return; // no valid key, abort return; // no valid key, abort
int count = m_commands.GetCount(); int count = m_commands.GetCount();
int index;
for (index = 0; index < count; index++) { for (index = 0; index < count; index++) {
wIDCommand = LOWORD(m_commands.GetItemData(index)); wIDCommand = LOWORD(m_commands.GetItemData(index));
@ -235,7 +235,7 @@ void AccelEditor::OnAssign()
pAccel->GetString(szBuffer); pAccel->GetString(szBuffer);
index = m_currents.AddString(szBuffer); index = m_currents.AddString(szBuffer);
m_currents.SetItemData(index, (DWORD)pAccel); m_currents.SetItemData(index, (DWORD_PTR)pAccel);
// Reset the key editor. // Reset the key editor.
m_key.ResetKey(); m_key.ResetKey();

View File

@ -27,7 +27,7 @@
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
#include "stdafx.h" #include "stdafx.h"
//#include "..\..\res\resource.h" //#include "resource.h"
#include "../System.h" #include "../System.h"
#include "AcceleratorManager.h" #include "AcceleratorManager.h"
@ -247,7 +247,7 @@ bool CAcceleratorManager::UpdateWndTable()
} }
} }
int nAccel = arrayACCEL.GetSize(); INT_PTR nAccel = arrayACCEL.GetSize();
LPACCEL lpAccel = (LPACCEL)LocalAlloc(LPTR, nAccel * sizeof(ACCEL)); LPACCEL lpAccel = (LPACCEL)LocalAlloc(LPTR, nAccel * sizeof(ACCEL));
if (!lpAccel) { if (!lpAccel) {
for (iLoop = 0; iLoop < nAccel; iLoop++) for (iLoop = 0; iLoop < nAccel; iLoop++)
@ -268,7 +268,7 @@ bool CAcceleratorManager::UpdateWndTable()
} }
arrayACCEL.RemoveAll(); arrayACCEL.RemoveAll();
HACCEL hNewTable = CreateAcceleratorTable(lpAccel, nAccel); HACCEL hNewTable = CreateAcceleratorTable(lpAccel, (int)nAccel);
if (!hNewTable) { if (!hNewTable) {
::LocalFree(lpAccel); ::LocalFree(lpAccel);
return false; return false;
@ -709,14 +709,14 @@ bool CAcceleratorManager::Write()
} }
// AccelsDatasArray.InsertAt(0, MAKELONG(65535, iCount)); // AccelsDatasArray.InsertAt(0, MAKELONG(65535, iCount));
int count = AccelsDatasArray.GetSize(); INT_PTR count = AccelsDatasArray.GetSize();
DWORD *data = (DWORD *)malloc(count * sizeof(DWORD)); DWORD *data = (DWORD *)malloc(count * sizeof(DWORD));
ASSERT(data != NULL); ASSERT(data != NULL);
for(int index = 0; index < count; index++) for(int index = 0; index < count; index++)
data[index] = AccelsDatasArray[index]; data[index] = AccelsDatasArray[index];
regSetBinaryValue("keyboard", (char *)data, count*sizeof(DWORD)); regSetBinaryValue("keyboard", (char *)data, (int)(count*sizeof(DWORD)));
AccelsDatasArray.RemoveAll(); AccelsDatasArray.RemoveAll();
CmdDatasArray.RemoveAll(); CmdDatasArray.RemoveAll();

View File

@ -33,6 +33,7 @@
#endif // _MSC_VER >= 1000 #endif // _MSC_VER >= 1000
#include "CmdAccelOb.h" #include "CmdAccelOb.h"

View File

@ -20,7 +20,7 @@
#if !defined(AFX_BITMAPCONTROL_H__2434AADB_B6A5_4E43_AA16_7B65B6F7FA26__INCLUDED_) #if !defined(AFX_BITMAPCONTROL_H__2434AADB_B6A5_4E43_AA16_7B65B6F7FA26__INCLUDED_)
#define AFX_BITMAPCONTROL_H__2434AADB_B6A5_4E43_AA16_7B65B6F7FA26__INCLUDED_ #define AFX_BITMAPCONTROL_H__2434AADB_B6A5_4E43_AA16_7B65B6F7FA26__INCLUDED_
#include "..\System.h" // Added by ClassView #include "../System.h" // Added by ClassView
#if _MSC_VER > 1000 #if _MSC_VER > 1000
#pragma once #pragma once
#endif // _MSC_VER > 1000 #endif // _MSC_VER > 1000

View File

@ -1,6 +1,6 @@
// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. // VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator.
// Copyright (C) 1999-2003 Forgotten // Copyright (C) 1999-2003 Forgotten
// Copyright (C) 2004 Forgotten and the VBA development team // Copyright (C) 2005 Forgotten and the VBA development team
// This program is free software; you can redistribute it and/or modify // 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 // it under the terms of the GNU General Public License as published by
@ -24,6 +24,7 @@
#include "BugReport.h" #include "BugReport.h"
#include "../agbprint.h" #include "../agbprint.h"
#include "../AutoBuild.h"
#include "../GBA.h" #include "../GBA.h"
#include "../Globals.h" #include "../Globals.h"
#include "../Port.h" #include "../Port.h"
@ -215,7 +216,6 @@ CString BugReport::createReport()
AppendFormat(report, "Using BIOS : %d\r\n", theApp.useBiosFile); AppendFormat(report, "Using BIOS : %d\r\n", theApp.useBiosFile);
AppendFormat(report, "Skip BIOS : %d\r\n", theApp.skipBiosFile); AppendFormat(report, "Skip BIOS : %d\r\n", theApp.skipBiosFile);
AppendFormat(report, "Disable SFX : %d\r\n", cpuDisableSfx); AppendFormat(report, "Disable SFX : %d\r\n", cpuDisableSfx);
AppendFormat(report, "Skip intro : %d\r\n", theApp.removeIntros);
AppendFormat(report, "Throttle : %d\r\n", theApp.throttle); AppendFormat(report, "Throttle : %d\r\n", theApp.throttle);
AppendFormat(report, "Rewind : %d\r\n", theApp.rewindTimer); AppendFormat(report, "Rewind : %d\r\n", theApp.rewindTimer);
AppendFormat(report, "Auto frame : %d\r\n", theApp.autoFrameSkip); AppendFormat(report, "Auto frame : %d\r\n", theApp.autoFrameSkip);
@ -226,6 +226,7 @@ CString BugReport::createReport()
AppendFormat(report, "Green shift : %08x\r\n", systemGreenShift); AppendFormat(report, "Green shift : %08x\r\n", systemGreenShift);
AppendFormat(report, "Blue shift : %08x\r\n", systemBlueShift); AppendFormat(report, "Blue shift : %08x\r\n", systemBlueShift);
AppendFormat(report, "Layer setting: %04X\r\n", layerSettings); AppendFormat(report, "Layer setting: %04X\r\n", layerSettings);
AppendFormat(report, "Mirroring : %d\r\n", mirroringEnable);
AppendFormat(report, "Save type : %d (%d)\r\n", AppendFormat(report, "Save type : %d (%d)\r\n",
theApp.winSaveType, cpuSaveType); theApp.winSaveType, cpuSaveType);
AppendFormat(report, "Flash size : %08X (%08x)\r\n", AppendFormat(report, "Flash size : %08X (%08x)\r\n",

File diff suppressed because it is too large Load Diff

View File

@ -20,7 +20,7 @@
#if !defined(AFX_COLORBUTTON_H__DF02109B_B91C_49FD_954F_74A48B83C314__INCLUDED_) #if !defined(AFX_COLORBUTTON_H__DF02109B_B91C_49FD_954F_74A48B83C314__INCLUDED_)
#define AFX_COLORBUTTON_H__DF02109B_B91C_49FD_954F_74A48B83C314__INCLUDED_ #define AFX_COLORBUTTON_H__DF02109B_B91C_49FD_954F_74A48B83C314__INCLUDED_
#include "..\System.h" // Added by ClassView #include "../System.h" // Added by ClassView
#if _MSC_VER > 1000 #if _MSC_VER > 1000
#pragma once #pragma once
#endif // _MSC_VER > 1000 #endif // _MSC_VER > 1000

View File

@ -20,7 +20,7 @@
#if !defined(AFX_COLORCONTROL_H__747E1E47_DDFA_4D67_B337_A473F2BACB86__INCLUDED_) #if !defined(AFX_COLORCONTROL_H__747E1E47_DDFA_4D67_B337_A473F2BACB86__INCLUDED_)
#define AFX_COLORCONTROL_H__747E1E47_DDFA_4D67_B337_A473F2BACB86__INCLUDED_ #define AFX_COLORCONTROL_H__747E1E47_DDFA_4D67_B337_A473F2BACB86__INCLUDED_
#include "..\System.h" // Added by ClassView #include "../System.h" // Added by ClassView
#if _MSC_VER > 1000 #if _MSC_VER > 1000
#pragma once #pragma once
#endif // _MSC_VER > 1000 #endif // _MSC_VER > 1000

View File

@ -1,253 +1,258 @@
// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. // VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator.
// Copyright (C) 1999-2003 Forgotten // Copyright (C) 1999-2003 Forgotten
// Copyright (C) 2004 Forgotten and the VBA development team // Copyright (C) 2005 Forgotten and the VBA development team
// This program is free software; you can redistribute it and/or modify // 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 // it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2, or(at your option) // the Free Software Foundation; either version 2, or(at your option)
// any later version. // any later version.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details. // GNU General Public License for more details.
// //
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software Foundation, // along with this program; if not, write to the Free Software Foundation,
// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "stdafx.h" #include "stdafx.h"
#include "AcceleratorManager.h" #include "AcceleratorManager.h"
#include "..\..\res\resource.h" #include "resource.h"
#include <afxres.h> #include <afxres.h>
#include <afxtempl.h> // MFC Templates extension #include <afxtempl.h> // MFC Templates extension
#ifndef CMapStringToWord #ifndef CMapStringToWord
typedef CMap< CString, LPCSTR, WORD, WORD& > CMapStringToWord; typedef CMap< CString, LPCSTR, WORD, WORD& > CMapStringToWord;
#endif #endif
static CMapStringToWord winAccelStrings; static CMapStringToWord winAccelStrings;
static bool initialized = false; static bool initialized = false;
struct { struct {
const char *command; const char *command;
WORD id; WORD id;
} winAccelCommands[] = { } winAccelCommands[] = {
{ "FileOpen", ID_FILE_OPEN }, { "FileOpen", ID_FILE_OPEN },
{ "FileOpenGameboy", ID_FILE_OPENGAMEBOY }, { "FileOpenGameboy", ID_FILE_OPENGAMEBOY },
{ "FileLoad", ID_FILE_LOAD }, { "FileLoad", ID_FILE_LOAD },
{ "FileSave", ID_FILE_SAVE }, { "FileSave", ID_FILE_SAVE },
{ "FileLoadGame01", ID_FILE_LOADGAME_SLOT1 }, { "FileLoadGame01", ID_FILE_LOADGAME_SLOT1 },
{ "FileLoadGame02", ID_FILE_LOADGAME_SLOT2 }, { "FileLoadGame02", ID_FILE_LOADGAME_SLOT2 },
{ "FileLoadGame03", ID_FILE_LOADGAME_SLOT3 }, { "FileLoadGame03", ID_FILE_LOADGAME_SLOT3 },
{ "FileLoadGame04", ID_FILE_LOADGAME_SLOT4 }, { "FileLoadGame04", ID_FILE_LOADGAME_SLOT4 },
{ "FileLoadGame05", ID_FILE_LOADGAME_SLOT5 }, { "FileLoadGame05", ID_FILE_LOADGAME_SLOT5 },
{ "FileLoadGame06", ID_FILE_LOADGAME_SLOT6 }, { "FileLoadGame06", ID_FILE_LOADGAME_SLOT6 },
{ "FileLoadGame07", ID_FILE_LOADGAME_SLOT7 }, { "FileLoadGame07", ID_FILE_LOADGAME_SLOT7 },
{ "FileLoadGame08", ID_FILE_LOADGAME_SLOT8 }, { "FileLoadGame08", ID_FILE_LOADGAME_SLOT8 },
{ "FileLoadGame09", ID_FILE_LOADGAME_SLOT9 }, { "FileLoadGame09", ID_FILE_LOADGAME_SLOT9 },
{ "FileLoadGame10", ID_FILE_LOADGAME_SLOT10 }, { "FileLoadGame10", ID_FILE_LOADGAME_SLOT10 },
{ "FileLoadGameAutoLoad", ID_FILE_LOADGAME_AUTOLOADMOSTRECENT }, { "FileLoadGameAutoLoad", ID_FILE_LOADGAME_AUTOLOADMOSTRECENT },
{ "FileLoadGameRecent", ID_FILE_LOADGAME_MOSTRECENT }, { "FileLoadGameRecent", ID_FILE_LOADGAME_MOSTRECENT },
{ "FileSaveGame01", ID_FILE_SAVEGAME_SLOT1 }, { "FileSaveGame01", ID_FILE_SAVEGAME_SLOT1 },
{ "FileSaveGame02", ID_FILE_SAVEGAME_SLOT2 }, { "FileSaveGame02", ID_FILE_SAVEGAME_SLOT2 },
{ "FileSaveGame03", ID_FILE_SAVEGAME_SLOT3 }, { "FileSaveGame03", ID_FILE_SAVEGAME_SLOT3 },
{ "FileSaveGame04", ID_FILE_SAVEGAME_SLOT4 }, { "FileSaveGame04", ID_FILE_SAVEGAME_SLOT4 },
{ "FileSaveGame05", ID_FILE_SAVEGAME_SLOT5 }, { "FileSaveGame05", ID_FILE_SAVEGAME_SLOT5 },
{ "FileSaveGame06", ID_FILE_SAVEGAME_SLOT6 }, { "FileSaveGame06", ID_FILE_SAVEGAME_SLOT6 },
{ "FileSaveGame07", ID_FILE_SAVEGAME_SLOT7 }, { "FileSaveGame07", ID_FILE_SAVEGAME_SLOT7 },
{ "FileSaveGame08", ID_FILE_SAVEGAME_SLOT8 }, { "FileSaveGame08", ID_FILE_SAVEGAME_SLOT8 },
{ "FileSaveGame09", ID_FILE_SAVEGAME_SLOT9 }, { "FileSaveGame09", ID_FILE_SAVEGAME_SLOT9 },
{ "FileSaveGame10", ID_FILE_SAVEGAME_SLOT10 }, { "FileSaveGame10", ID_FILE_SAVEGAME_SLOT10 },
{ "FileSaveGameOldest", ID_FILE_SAVEGAME_OLDESTSLOT }, { "FileSaveGameOldest", ID_FILE_SAVEGAME_OLDESTSLOT },
{ "FileRecentReset", ID_FILE_RECENT_RESET }, { "FileRecentReset", ID_FILE_RECENT_RESET },
{ "FileRecentFreeze", ID_FILE_RECENT_FREEZE }, { "FileRecentFreeze", ID_FILE_RECENT_FREEZE },
{ "FileRecent01", ID_FILE_MRU_FILE1 }, { "FileRecent01", ID_FILE_MRU_FILE1 },
{ "FileRecent02", ID_FILE_MRU_FILE2 }, { "FileRecent02", ID_FILE_MRU_FILE2 },
{ "FileRecent03", ID_FILE_MRU_FILE3 }, { "FileRecent03", ID_FILE_MRU_FILE3 },
{ "FileRecent04", ID_FILE_MRU_FILE4 }, { "FileRecent04", ID_FILE_MRU_FILE4 },
{ "FileRecent05", ID_FILE_MRU_FILE5 }, { "FileRecent05", ID_FILE_MRU_FILE5 },
{ "FileRecent06", ID_FILE_MRU_FILE6 }, { "FileRecent06", ID_FILE_MRU_FILE6 },
{ "FileRecent07", ID_FILE_MRU_FILE7 }, { "FileRecent07", ID_FILE_MRU_FILE7 },
{ "FileRecent08", ID_FILE_MRU_FILE8 }, { "FileRecent08", ID_FILE_MRU_FILE8 },
{ "FileRecent09", ID_FILE_MRU_FILE9 }, { "FileRecent09", ID_FILE_MRU_FILE9 },
{ "FileRecent10", ID_FILE_MRU_FILE10 }, { "FileRecent10", ID_FILE_MRU_FILE10 },
{ "FilePause", ID_FILE_PAUSE }, { "FilePause", ID_FILE_PAUSE },
{ "FileReset", ID_FILE_RESET }, { "FileReset", ID_FILE_RESET },
{ "FileImportBatteryFile", ID_FILE_IMPORT_BATTERYFILE }, { "FileImportBatteryFile", ID_FILE_IMPORT_BATTERYFILE },
{ "FileImportGamesharkCodeFile", ID_FILE_IMPORT_GAMESHARKCODEFILE }, { "FileImportGamesharkCodeFile", ID_FILE_IMPORT_GAMESHARKCODEFILE },
{ "FileImportGamesharkSnapshot", ID_FILE_IMPORT_GAMESHARKSNAPSHOT }, { "FileImportGamesharkSnapshot", ID_FILE_IMPORT_GAMESHARKSNAPSHOT },
{ "FileExportBatteryFile", ID_FILE_EXPORT_BATTERYFILE }, { "FileExportBatteryFile", ID_FILE_EXPORT_BATTERYFILE },
{ "FileExportGamesharkSnapshot", ID_FILE_EXPORT_GAMESHARKSNAPSHOT }, { "FileExportGamesharkSnapshot", ID_FILE_EXPORT_GAMESHARKSNAPSHOT },
{ "FileScreenCapture", ID_FILE_SCREENCAPTURE }, { "FileScreenCapture", ID_FILE_SCREENCAPTURE },
{ "FileRomInformation", ID_FILE_ROMINFORMATION }, { "FileRomInformation", ID_FILE_ROMINFORMATION },
{ "FileToggleMenu", ID_FILE_TOGGLEMENU }, { "FileToggleMenu", ID_FILE_TOGGLEMENU },
{ "FileClose", ID_FILE_CLOSE }, { "FileClose", ID_FILE_CLOSE },
{ "FileExit", ID_FILE_EXIT }, { "FileExit", ID_FILE_EXIT },
{ "OptionsFrameSkip0", ID_OPTIONS_VIDEO_FRAMESKIP_0 }, { "OptionsFrameSkip0", ID_OPTIONS_VIDEO_FRAMESKIP_0 },
{ "OptionsFrameSkip1", ID_OPTIONS_VIDEO_FRAMESKIP_1 }, { "OptionsFrameSkip1", ID_OPTIONS_VIDEO_FRAMESKIP_1 },
{ "OptionsFrameSkip2", ID_OPTIONS_VIDEO_FRAMESKIP_2 }, { "OptionsFrameSkip2", ID_OPTIONS_VIDEO_FRAMESKIP_2 },
{ "OptionsFrameSkip3", ID_OPTIONS_VIDEO_FRAMESKIP_3 }, { "OptionsFrameSkip3", ID_OPTIONS_VIDEO_FRAMESKIP_3 },
{ "OptionsFrameSkip4", ID_OPTIONS_VIDEO_FRAMESKIP_4 }, { "OptionsFrameSkip4", ID_OPTIONS_VIDEO_FRAMESKIP_4 },
{ "OptionsFrameSkip5", ID_OPTIONS_VIDEO_FRAMESKIP_5 }, { "OptionsFrameSkip5", ID_OPTIONS_VIDEO_FRAMESKIP_5 },
{ "OptionsFrameSkip6", ID_OPTIONS_VIDEO_FRAMESKIP_6 }, { "OptionsFrameSkip6", ID_OPTIONS_VIDEO_FRAMESKIP_6 },
{ "OptionsFrameSkip7", ID_OPTIONS_VIDEO_FRAMESKIP_7 }, { "OptionsFrameSkip7", ID_OPTIONS_VIDEO_FRAMESKIP_7 },
{ "OptionsFrameSkip8", ID_OPTIONS_VIDEO_FRAMESKIP_8 }, { "OptionsFrameSkip8", ID_OPTIONS_VIDEO_FRAMESKIP_8 },
{ "OptionsFrameSkip9", ID_OPTIONS_VIDEO_FRAMESKIP_9 }, { "OptionsFrameSkip9", ID_OPTIONS_VIDEO_FRAMESKIP_9 },
{ "OptionsThrottleNone", ID_OPTIONS_FRAMESKIP_THROTTLE_NOTHROTTLE }, { "OptionsThrottleNone", ID_OPTIONS_FRAMESKIP_THROTTLE_NOTHROTTLE },
{ "OptionsThrottle025%", ID_OPTIONS_FRAMESKIP_THROTTLE_25 }, { "OptionsThrottle025%", ID_OPTIONS_FRAMESKIP_THROTTLE_25 },
{ "OptionsThrottle050%", ID_OPTIONS_FRAMESKIP_THROTTLE_50 }, { "OptionsThrottle050%", ID_OPTIONS_FRAMESKIP_THROTTLE_50 },
{ "OptionsThrottle100%", ID_OPTIONS_FRAMESKIP_THROTTLE_100 }, { "OptionsThrottle100%", ID_OPTIONS_FRAMESKIP_THROTTLE_100 },
{ "OptionsThrottle150%", ID_OPTIONS_FRAMESKIP_THROTTLE_150 }, { "OptionsThrottle150%", ID_OPTIONS_FRAMESKIP_THROTTLE_150 },
{ "OptionsThrottle200%", ID_OPTIONS_FRAMESKIP_THROTTLE_200 }, { "OptionsThrottle200%", ID_OPTIONS_FRAMESKIP_THROTTLE_200 },
{ "OptionsThrottleOther", ID_OPTIONS_FRAMESKIP_THROTTLE_OTHER }, { "OptionsThrottleOther", ID_OPTIONS_FRAMESKIP_THROTTLE_OTHER },
{ "OptionsVideoRenderGDI", ID_OPTIONS_VIDEO_RENDERMETHOD_GDI }, { "OptionsVideoRenderGDI", ID_OPTIONS_VIDEO_RENDERMETHOD_GDI },
{ "OptionsVideoRenderDDRAW", ID_OPTIONS_VIDEO_RENDERMETHOD_DIRECTDRAW }, { "OptionsVideoRenderDDRAW", ID_OPTIONS_VIDEO_RENDERMETHOD_DIRECTDRAW },
{ "OptionsVideoRenderD3D", ID_OPTIONS_VIDEO_RENDERMETHOD_DIRECT3D }, { "OptionsVideoRenderD3D", ID_OPTIONS_VIDEO_RENDERMETHOD_DIRECT3D },
{ "OptionsVideoRenderOGL", ID_OPTIONS_VIDEO_RENDERMETHOD_OPENGL }, { "OptionsVideoRenderOGL", ID_OPTIONS_VIDEO_RENDERMETHOD_OPENGL },
{ "OptionsVideoVsync", ID_OPTIONS_VIDEO_VSYNC }, { "OptionsVideoRenderSelectSkin", ID_OPTIONS_VIDEO_RENDEROPTIONS_SELECTSKIN },
{ "OptionsVideoX1", ID_OPTIONS_VIDEO_X1 }, { "OptionsVideoRenderSkin", ID_OPTIONS_VIDEO_RENDEROPTIONS_SKIN },
{ "OptionsVideoX2", ID_OPTIONS_VIDEO_X2 }, { "OptionsVideoVsync", ID_OPTIONS_VIDEO_VSYNC },
{ "OptionsVideoX3", ID_OPTIONS_VIDEO_X3 }, { "OptionsVideoX1", ID_OPTIONS_VIDEO_X1 },
{ "OptionsVideoX4", ID_OPTIONS_VIDEO_X4 }, { "OptionsVideoX2", ID_OPTIONS_VIDEO_X2 },
{ "OptionsVideo320x240", ID_OPTIONS_VIDEO_FULLSCREEN320X240 }, { "OptionsVideoX3", ID_OPTIONS_VIDEO_X3 },
{ "OptionsVideo640x480", ID_OPTIONS_VIDEO_FULLSCREEN640X480 }, { "OptionsVideoX4", ID_OPTIONS_VIDEO_X4 },
{ "OptionsVideo800x600", ID_OPTIONS_VIDEO_FULLSCREEN800X600 }, { "OptionsVideo320x240", ID_OPTIONS_VIDEO_FULLSCREEN320X240 },
{ "OptionsVideoFullscreen", ID_OPTIONS_VIDEO_FULLSCREEN }, { "OptionsVideo640x480", ID_OPTIONS_VIDEO_FULLSCREEN640X480 },
{ "OptionsVideoFullscreenMaxScale", ID_OPTIONS_VIDEO_FULLSCREENMAXSCALE }, { "OptionsVideo800x600", ID_OPTIONS_VIDEO_FULLSCREEN800X600 },
{ "OptionsVideoLayersBg0", ID_OPTIONS_VIDEO_LAYERS_BG0 }, { "OptionsVideoFullscreen", ID_OPTIONS_VIDEO_FULLSCREEN },
{ "OptionsVideoLayersBg1", ID_OPTIONS_VIDEO_LAYERS_BG1 }, { "OptionsVideoFullscreenMaxScale", ID_OPTIONS_VIDEO_FULLSCREENMAXSCALE },
{ "OptionsVideoLayersBg2", ID_OPTIONS_VIDEO_LAYERS_BG2 }, { "OptionsVideoLayersBg0", ID_OPTIONS_VIDEO_LAYERS_BG0 },
{ "OptionsVideoLayersBg3", ID_OPTIONS_VIDEO_LAYERS_BG3 }, { "OptionsVideoLayersBg1", ID_OPTIONS_VIDEO_LAYERS_BG1 },
{ "OptionsVideoLayersOBJ", ID_OPTIONS_VIDEO_LAYERS_OBJ }, { "OptionsVideoLayersBg2", ID_OPTIONS_VIDEO_LAYERS_BG2 },
{ "OptionsVideoLayersWIN0", ID_OPTIONS_VIDEO_LAYERS_WIN0 }, { "OptionsVideoLayersBg3", ID_OPTIONS_VIDEO_LAYERS_BG3 },
{ "OptionsVideoLayersWIN1", ID_OPTIONS_VIDEO_LAYERS_WIN1 }, { "OptionsVideoLayersOBJ", ID_OPTIONS_VIDEO_LAYERS_OBJ },
{ "OptionsVideoLayersOBJWIN", ID_OPTIONS_VIDEO_LAYERS_OBJWIN }, { "OptionsVideoLayersWIN0", ID_OPTIONS_VIDEO_LAYERS_WIN0 },
{ "OptionsEmulatorAssociate", ID_OPTIONS_EMULATOR_ASSOCIATE }, { "OptionsVideoLayersWIN1", ID_OPTIONS_VIDEO_LAYERS_WIN1 },
{ "OptionsEmulatorDirectories", ID_OPTIONS_EMULATOR_DIRECTORIES }, { "OptionsVideoLayersOBJWIN", ID_OPTIONS_VIDEO_LAYERS_OBJWIN },
{ "OptionsEmulatorSelectBIOS", ID_OPTIONS_EMULATOR_SELECTBIOSFILE }, { "OptionsEmulatorAssociate", ID_OPTIONS_EMULATOR_ASSOCIATE },
{ "OptionsEmulatorUseBIOS", ID_OPTIONS_EMULATOR_USEBIOSFILE }, { "OptionsEmulatorDirectories", ID_OPTIONS_EMULATOR_DIRECTORIES },
{ "OptionsEmulatorSkipBIOS", ID_OPTIONS_EMULATOR_SKIPBIOS }, { "OptionsEmulatorSelectBIOS", ID_OPTIONS_EMULATOR_SELECTBIOSFILE },
{ "OptionsEmulatorShowSpeedNone", ID_OPTIONS_EMULATOR_SHOWSPEED_NONE }, { "OptionsEmulatorUseBIOS", ID_OPTIONS_EMULATOR_USEBIOSFILE },
{ "OptionsEmulatorShowSpeedPercentage", ID_OPTIONS_EMULATOR_SHOWSPEED_PERCENTAGE }, { "OptionsEmulatorGameOverrides", ID_OPTIONS_EMULATOR_GAMEOVERRIDES },
{ "OptionsEmulatorShowSpeedDetailed", ID_OPTIONS_EMULATOR_SHOWSPEED_DETAILED }, { "OptionsEmulatorSkipBIOS", ID_OPTIONS_EMULATOR_SKIPBIOS },
{ "OptionsEmulatorShowSpeedTransparent", ID_OPTIONS_EMULATOR_SHOWSPEED_TRANSPARENT }, { "OptionsEmulatorShowSpeedNone", ID_OPTIONS_EMULATOR_SHOWSPEED_NONE },
{ "OptionsEmulatorSpeedupToggle", ID_OPTIONS_EMULATOR_SPEEDUPTOGGLE }, { "OptionsEmulatorShowSpeedPercentage", ID_OPTIONS_EMULATOR_SHOWSPEED_PERCENTAGE },
{ "OptionsEmulatorRemoveIntros", ID_OPTIONS_EMULATOR_REMOVEINTROSGBA }, { "OptionsEmulatorShowSpeedDetailed", ID_OPTIONS_EMULATOR_SHOWSPEED_DETAILED },
{ "OptionsEmulatorAutoHideMenu", ID_OPTIONS_EMULATOR_AUTOHIDEMENU }, { "OptionsEmulatorShowSpeedTransparent", ID_OPTIONS_EMULATOR_SHOWSPEED_TRANSPARENT },
{ "OptionsEmulatorSaveAuto", ID_OPTIONS_EMULATOR_SAVETYPE_AUTOMATIC }, { "OptionsEmulatorSpeedupToggle", ID_OPTIONS_EMULATOR_SPEEDUPTOGGLE },
{ "OptionsEmulatorSaveEEPROM", ID_OPTIONS_EMULATOR_SAVETYPE_EEPROM }, { "OptionsEmulatorAutoHideMenu", ID_OPTIONS_EMULATOR_AUTOHIDEMENU },
{ "OptionsEmulatorSaveSRAM", ID_OPTIONS_EMULATOR_SAVETYPE_SRAM }, { "OptionsEmulatorSaveAuto", ID_OPTIONS_EMULATOR_SAVETYPE_AUTOMATIC },
{ "OptionsEmulatorSaveFLASH", ID_OPTIONS_EMULATOR_SAVETYPE_FLASH }, { "OptionsEmulatorSaveEEPROM", ID_OPTIONS_EMULATOR_SAVETYPE_EEPROM },
{ "OptionsEmulatorSaveEEPROMSensor", ID_OPTIONS_EMULATOR_SAVETYPE_EEPROMSENSOR }, { "OptionsEmulatorSaveSRAM", ID_OPTIONS_EMULATOR_SAVETYPE_SRAM },
{ "OptionsEmulatorSaveFlash64K", ID_OPTIONS_EMULATOR_SAVETYPE_FLASH512K }, { "OptionsEmulatorSaveFLASH", ID_OPTIONS_EMULATOR_SAVETYPE_FLASH },
{ "OptionsEmulatorSaveFlash128K", ID_OPTIONS_EMULATOR_SAVETYPE_FLASH1M }, { "OptionsEmulatorSaveEEPROMSensor", ID_OPTIONS_EMULATOR_SAVETYPE_EEPROMSENSOR },
{ "OptionsEmulatorAutoIPSPatch", ID_OPTIONS_EMULATOR_AUTOMATICALLYIPSPATCH }, { "OptionsEmulatorSaveFlash64K", ID_OPTIONS_EMULATOR_SAVETYPE_FLASH512K },
{ "OptionsEmulatorAGBPrint", ID_OPTIONS_EMULATOR_AGBPRINT }, { "OptionsEmulatorSaveFlash128K", ID_OPTIONS_EMULATOR_SAVETYPE_FLASH1M },
{ "OptionsEmulatorRTC", ID_OPTIONS_EMULATOR_REALTIMECLOCK }, { "OptionsEmulatorAutoIPSPatch", ID_OPTIONS_EMULATOR_AUTOMATICALLYIPSPATCH },
{ "OptionsEmulatorRewindInterval", ID_OPTIONS_EMULATOR_REWINDINTERVAL }, { "OptionsEmulatorAGBPrint", ID_OPTIONS_EMULATOR_AGBPRINT },
{ "OptionsSoundOff", ID_OPTIONS_SOUND_OFF }, { "OptionsEmulatorRTC", ID_OPTIONS_EMULATOR_REALTIMECLOCK },
{ "OptionsSoundMute", ID_OPTIONS_SOUND_OFF }, /* mute hax */ { "OptionsEmulatorGenericflashcard", ID_OPTIONS_EMULATOR_GENERICFLASHCARD },
{ "OptionsSoundOn", ID_OPTIONS_SOUND_ON }, { "OptionsEmulatorRewindInterval", ID_OPTIONS_EMULATOR_REWINDINTERVAL },
{ "OptionsSoundChannel1", ID_OPTIONS_SOUND_CHANNEL1 }, { "OptionsSoundOff", ID_OPTIONS_SOUND_OFF },
{ "OptionsSoundChannel2", ID_OPTIONS_SOUND_CHANNEL2 }, { "OptionsSoundMute", ID_OPTIONS_SOUND_MUTE },
{ "OptionsSoundChannel3", ID_OPTIONS_SOUND_CHANNEL3 }, { "OptionsSoundOn", ID_OPTIONS_SOUND_ON },
{ "OptionsSoundChannel4", ID_OPTIONS_SOUND_CHANNEL4 }, { "OptionsSoundChannel1", ID_OPTIONS_SOUND_CHANNEL1 },
{ "OptionsSoundDirectSoundA", ID_OPTIONS_SOUND_DIRECTSOUNDA }, { "OptionsSoundChannel2", ID_OPTIONS_SOUND_CHANNEL2 },
{ "OptionsSoundDirectSoundB", ID_OPTIONS_SOUND_DIRECTSOUNDB }, { "OptionsSoundChannel3", ID_OPTIONS_SOUND_CHANNEL3 },
{ "OptionsSound11Khz", ID_OPTIONS_SOUND_11KHZ }, { "OptionsSoundChannel4", ID_OPTIONS_SOUND_CHANNEL4 },
{ "OptionsSound22Khz", ID_OPTIONS_SOUND_22KHZ }, { "OptionsSoundDirectSoundA", ID_OPTIONS_SOUND_DIRECTSOUNDA },
{ "OptionsSound44Khz", ID_OPTIONS_SOUND_44KHZ }, { "OptionsSoundDirectSoundB", ID_OPTIONS_SOUND_DIRECTSOUNDB },
{ "OptionsSoundEcho", ID_OPTIONS_SOUND_ECHO }, { "OptionsSound11Khz", ID_OPTIONS_SOUND_11KHZ },
{ "OptionsSoundLowPassFilter", ID_OPTIONS_SOUND_LOWPASSFILTER }, { "OptionsSound22Khz", ID_OPTIONS_SOUND_22KHZ },
{ "OptionsSoundReverseStereo", ID_OPTIONS_SOUND_REVERSESTEREO }, { "OptionsSound44Khz", ID_OPTIONS_SOUND_44KHZ },
{ "OptionsSoundVolume1x", ID_OPTIONS_SOUND_VOLUME_1X }, { "OptionsSoundEcho", ID_OPTIONS_SOUND_ECHO },
{ "OptionsSoundVolume2x", ID_OPTIONS_SOUND_VOLUME_2X }, { "OptionsSoundLowPassFilter", ID_OPTIONS_SOUND_LOWPASSFILTER },
{ "OptionsSoundVolume3x", ID_OPTIONS_SOUND_VOLUME_3X }, { "OptionsSoundReverseStereo", ID_OPTIONS_SOUND_REVERSESTEREO },
{ "OptionsSoundVolume4x", ID_OPTIONS_SOUND_VOLUME_4X }, { "OptionsSoundVolume1x", ID_OPTIONS_SOUND_VOLUME_1X },
{ "OptionsGameboyBorder", ID_OPTIONS_GAMEBOY_BORDER }, { "OptionsSoundVolume2x", ID_OPTIONS_SOUND_VOLUME_2X },
{ "OptionsGameboyBorderAutomatic", ID_OPTIONS_GAMEBOY_BORDERAUTOMATIC }, { "OptionsSoundVolume3x", ID_OPTIONS_SOUND_VOLUME_3X },
{ "OptionsGameboyColors", ID_OPTIONS_GAMEBOY_COLORS }, { "OptionsSoundVolume4x", ID_OPTIONS_SOUND_VOLUME_4X },
{ "OptionsFilterNormal", ID_OPTIONS_FILTER_NORMAL }, { "OptionsGameboyBorder", ID_OPTIONS_GAMEBOY_BORDER },
{ "OptionsFilterTVMode", ID_OPTIONS_FILTER_TVMODE }, { "OptionsGameboyBorderAutomatic", ID_OPTIONS_GAMEBOY_BORDERAUTOMATIC },
{ "OptionsFilter2xSaI", ID_OPTIONS_FILTER_2XSAI }, { "OptionsGameboyColors", ID_OPTIONS_GAMEBOY_COLORS },
{ "OptionsFilterSuper2xSaI", ID_OPTIONS_FILTER_SUPER2XSAI }, { "OptionsFilterNormal", ID_OPTIONS_FILTER_NORMAL },
{ "OptionsFilterSuperEagle", ID_OPTIONS_FILTER_SUPEREAGLE }, { "OptionsFilterTVMode", ID_OPTIONS_FILTER_TVMODE },
{ "OptionsFilterPixelate", ID_OPTIONS_FILTER16BIT_PIXELATEEXPERIMENTAL }, { "OptionsFilter2xSaI", ID_OPTIONS_FILTER_2XSAI },
{ "OptionsFilterAdMameScale2x", ID_OPTIONS_FILTER16BIT_ADVANCEMAMESCALE2X }, { "OptionsFilterSuper2xSaI", ID_OPTIONS_FILTER_SUPER2XSAI },
{ "OptionsFilterSimple2x", ID_OPTIONS_FILTER16BIT_SIMPLE2X }, { "OptionsFilterSuperEagle", ID_OPTIONS_FILTER_SUPEREAGLE },
{ "OptionsFilterBilinear", ID_OPTIONS_FILTER_BILINEAR }, { "OptionsFilterPixelate", ID_OPTIONS_FILTER16BIT_PIXELATEEXPERIMENTAL },
{ "OptionsFilterBilinearPlus", ID_OPTIONS_FILTER_BILINEARPLUS }, { "OptionsFilterMotionBlur", ID_OPTIONS_FILTER16BIT_MOTIONBLUREXPERIMENTAL },
{ "OptionsFilterScanlines", ID_OPTIONS_FILTER_SCANLINES }, { "OptionsFilterAdMameScale2x", ID_OPTIONS_FILTER16BIT_ADVANCEMAMESCALE2X },
{ "OptionsFilterHq2x", ID_OPTIONS_FILTER_HQ2X }, { "OptionsFilterSimple2x", ID_OPTIONS_FILTER16BIT_SIMPLE2X },
{ "OptionsFilterLq2x", ID_OPTIONS_FILTER_LQ2X }, { "OptionsFilterBilinear", ID_OPTIONS_FILTER_BILINEAR },
{ "OptionsFilterIFBNone", ID_OPTIONS_FILTER_INTERFRAMEBLENDING_NONE }, { "OptionsFilterBilinearPlus", ID_OPTIONS_FILTER_BILINEARPLUS },
{ "OptionsFilterIFBMotionBlur", ID_OPTIONS_FILTER_INTERFRAMEBLENDING_MOTIONBLUR }, { "OptionsFilterScanlines", ID_OPTIONS_FILTER_SCANLINES },
{ "OptionsFilterIFBSmart", ID_OPTIONS_FILTER_INTERFRAMEBLENDING_SMART }, { "OptionsFilterHq2x", ID_OPTIONS_FILTER_HQ2X },
{ "OptionsFilterDisableMMX", ID_OPTIONS_FILTER_DISABLEMMX }, { "OptionsFilterLq2x", ID_OPTIONS_FILTER_LQ2X },
{ "OptionsJoypadConfigure1", ID_OPTIONS_JOYPAD_CONFIGURE_1 }, { "OptionsFilterIFBNone", ID_OPTIONS_FILTER_INTERFRAMEBLENDING_NONE },
{ "OptionsJoypadConfigure2", ID_OPTIONS_JOYPAD_CONFIGURE_2 }, { "OptionsFilterIFBMotionBlur", ID_OPTIONS_FILTER_INTERFRAMEBLENDING_MOTIONBLUR },
{ "OptionsJoypadConfigure3", ID_OPTIONS_JOYPAD_CONFIGURE_3 }, { "OptionsFilterIFBSmart", ID_OPTIONS_FILTER_INTERFRAMEBLENDING_SMART },
{ "OptionsJoypadConfigure4", ID_OPTIONS_JOYPAD_CONFIGURE_4 }, { "OptionsFilterDisableMMX", ID_OPTIONS_FILTER_DISABLEMMX },
{ "OptionsJoypadMotionConfigure", ID_OPTIONS_JOYPAD_MOTIONCONFIGURE }, { "OptionsJoypadConfigure1", ID_OPTIONS_JOYPAD_CONFIGURE_1 },
{ "OptionsJoypadAutofireA", ID_OPTIONS_JOYPAD_AUTOFIRE_A }, { "OptionsJoypadConfigure2", ID_OPTIONS_JOYPAD_CONFIGURE_2 },
{ "OptionsJoypadAutofireB", ID_OPTIONS_JOYPAD_AUTOFIRE_B }, { "OptionsJoypadConfigure3", ID_OPTIONS_JOYPAD_CONFIGURE_3 },
{ "OptionsJoypadAutofireL", ID_OPTIONS_JOYPAD_AUTOFIRE_L }, { "OptionsJoypadConfigure4", ID_OPTIONS_JOYPAD_CONFIGURE_4 },
{ "OptionsJoypadAutofireR", ID_OPTIONS_JOYPAD_AUTOFIRE_R }, { "OptionsJoypadMotionConfigure", ID_OPTIONS_JOYPAD_MOTIONCONFIGURE },
{ "CheatsSearch", ID_CHEATS_SEARCHFORCHEATS }, { "OptionsJoypadAutofireA", ID_OPTIONS_JOYPAD_AUTOFIRE_A },
{ "CheatsList", ID_CHEATS_CHEATLIST }, { "OptionsJoypadAutofireB", ID_OPTIONS_JOYPAD_AUTOFIRE_B },
{ "CheatsLoad", ID_CHEATS_LOADCHEATLIST }, { "OptionsJoypadAutofireL", ID_OPTIONS_JOYPAD_AUTOFIRE_L },
{ "CheatsSave", ID_CHEATS_SAVECHEATLIST }, { "OptionsJoypadAutofireR", ID_OPTIONS_JOYPAD_AUTOFIRE_R },
{ "CheatsDisable", ID_CHEATS_DISABLECHEATS }, { "CheatsSearch", ID_CHEATS_SEARCHFORCHEATS },
{ "ToolsDebugGDB", ID_TOOLS_DEBUG_GDB }, { "CheatsList", ID_CHEATS_CHEATLIST },
{ "ToolsDebugGDBLoad", ID_TOOLS_DEBUG_LOADANDWAIT }, { "CheatsLoad", ID_CHEATS_LOADCHEATLIST },
{ "ToolsDebugGDBBreak", ID_TOOLS_DEBUG_BREAK }, { "CheatsSave", ID_CHEATS_SAVECHEATLIST },
{ "ToolsDebugGDBDisconnect", ID_TOOLS_DEBUG_DISCONNECT }, { "CheatsDisable", ID_CHEATS_DISABLECHEATS },
{ "ToolsDisassemble", ID_TOOLS_DISASSEMBLE }, { "ToolsDebugGDB", ID_TOOLS_DEBUG_GDB },
{ "ToolsIOViewer", ID_TOOLS_IOVIEWER }, { "ToolsDebugGDBLoad", ID_TOOLS_DEBUG_LOADANDWAIT },
{ "ToolsLogging", ID_TOOLS_LOGGING }, { "ToolsDebugGDBBreak", ID_TOOLS_DEBUG_BREAK },
{ "ToolsMapViewer", ID_TOOLS_MAPVIEW }, { "ToolsDebugGDBDisconnect", ID_TOOLS_DEBUG_DISCONNECT },
{ "ToolsMemoryViewer", ID_TOOLS_MEMORYVIEWER }, { "ToolsDisassemble", ID_TOOLS_DISASSEMBLE },
{ "ToolsOAMViewer", ID_TOOLS_OAMVIEWER }, { "ToolsIOViewer", ID_TOOLS_IOVIEWER },
{ "ToolsPaletteViewer", ID_TOOLS_PALETTEVIEW }, { "ToolsLogging", ID_TOOLS_LOGGING },
{ "ToolsTileViewer", ID_TOOLS_TILEVIEWER }, { "ToolsMapViewer", ID_TOOLS_MAPVIEW },
{ "ToolsNextFrame", ID_DEBUG_NEXTFRAME }, { "ToolsMemoryViewer", ID_TOOLS_MEMORYVIEWER },
{ "ToolsRecordSoundStartRecording", ID_OPTIONS_SOUND_STARTRECORDING }, { "ToolsOAMViewer", ID_TOOLS_OAMVIEWER },
{ "ToolsRecordSoundStopRecording", ID_OPTIONS_SOUND_STOPRECORDING }, { "ToolsPaletteViewer", ID_TOOLS_PALETTEVIEW },
{ "ToolsRecordAVIStartRecording", ID_TOOLS_RECORD_STARTAVIRECORDING }, { "ToolsTileViewer", ID_TOOLS_TILEVIEWER },
{ "ToolsRecordAVIStopRecording", ID_TOOLS_RECORD_STOPAVIRECORDING }, { "ToolsNextFrame", ID_DEBUG_NEXTFRAME },
{ "ToolsRecordMovieStartRecording", ID_TOOLS_RECORD_STARTMOVIERECORDING }, { "ToolsRecordSoundStartRecording", ID_OPTIONS_SOUND_STARTRECORDING },
{ "ToolsRecordMovieStopRecording", ID_TOOLS_RECORD_STOPMOVIERECORDING }, { "ToolsRecordSoundStopRecording", ID_OPTIONS_SOUND_STOPRECORDING },
{ "ToolsPlayMovieStartPlaying", ID_TOOLS_PLAY_STARTMOVIEPLAYING }, { "ToolsRecordAVIStartRecording", ID_TOOLS_RECORD_STARTAVIRECORDING },
{ "ToolsPlayMovieStopPlaying", ID_TOOLS_PLAY_STOPMOVIEPLAYING }, { "ToolsRecordAVIStopRecording", ID_TOOLS_RECORD_STOPAVIRECORDING },
{ "ToolsRewind", ID_TOOLS_REWIND }, { "ToolsRecordMovieStartRecording", ID_TOOLS_RECORD_STARTMOVIERECORDING },
{ "ToolsCustomize", ID_TOOLS_CUSTOMIZE }, { "ToolsRecordMovieStopRecording", ID_TOOLS_RECORD_STOPMOVIERECORDING },
{ "HelpBugReport", ID_HELP_BUGREPORT }, { "ToolsPlayMovieStartPlaying", ID_TOOLS_PLAY_STARTMOVIEPLAYING },
{ "HelpFAQ", ID_HELP_FAQ }, { "ToolsPlayMovieStopPlaying", ID_TOOLS_PLAY_STOPMOVIEPLAYING },
{ "HelpAbout", ID_HELP_ABOUT } { "ToolsRewind", ID_TOOLS_REWIND },
}; { "ToolsCustomize", ID_TOOLS_CUSTOMIZE },
{ "HelpBugReport", ID_HELP_BUGREPORT },
bool winAccelGetID(const char *command, WORD& id) { "HelpFAQ", ID_HELP_FAQ },
{ { "HelpAbout", ID_HELP_ABOUT },
if(!initialized) { { "SystemMinimize", ID_SYSTEM_MINIMIZE }
int count = sizeof(winAccelCommands)/sizeof(winAccelCommands[0]); };
for(int i = 0; i < count; i++) { bool winAccelGetID(const char *command, WORD& id)
winAccelStrings.SetAt(winAccelCommands[i].command, winAccelCommands[i].id); {
} if(!initialized) {
initialized = true; int count = sizeof(winAccelCommands)/sizeof(winAccelCommands[0]);
}
for(int i = 0; i < count; i++) {
return winAccelStrings.Lookup(command, id) ? true : false; winAccelStrings.SetAt(winAccelCommands[i].command, winAccelCommands[i].id);
} }
initialized = true;
void winAccelAddCommands(CAcceleratorManager& mgr) }
{
int count = sizeof(winAccelCommands)/sizeof(winAccelCommands[0]); return winAccelStrings.Lookup(command, id) ? true : false;
}
for(int i = 0; i < count; i++) {
if(!mgr.AddCommandAccel(winAccelCommands[i].id, winAccelCommands[i].command, false)) void winAccelAddCommands(CAcceleratorManager& mgr)
mgr.CreateEntry(winAccelCommands[i].id, winAccelCommands[i].command); {
} int count = sizeof(winAccelCommands)/sizeof(winAccelCommands[0]);
} for(int i = 0; i < count; i++) {
if(!mgr.AddCommandAccel(winAccelCommands[i].id, winAccelCommands[i].command, false))
mgr.CreateEntry(winAccelCommands[i].id, winAccelCommands[i].command);
}
}

File diff suppressed because it is too large Load Diff

View File

@ -21,8 +21,6 @@
#define DIRECTDRAW_VERSION 0x0700 #define DIRECTDRAW_VERSION 0x0700
#include <ddraw.h> #include <ddraw.h>
#include <mmsystem.h>
#include "../System.h" #include "../System.h"
#include "../gb/gbGlobals.h" #include "../gb/gbGlobals.h"
#include "../GBA.h" #include "../GBA.h"
@ -33,7 +31,9 @@
#include "VBA.h" #include "VBA.h"
#include "MainWnd.h" #include "MainWnd.h"
#include "Reg.h" #include "Reg.h"
#include "..\..\res\resource.h" #include "resource.h"
#include "Display.h"
#ifdef _DEBUG #ifdef _DEBUG
#define new DEBUG_NEW #define new DEBUG_NEW
@ -58,18 +58,7 @@ private:
int height; int height;
bool failed; bool failed;
volatile unsigned wait_lastscanline;
volatile unsigned wait_screenheight;
volatile unsigned wait_maxheight;
volatile unsigned wait_firstline;
HANDLE wait_event;
UINT wait_timerres;
UINT wait_timerid;
bool initializeOffscreen(int w, int h); bool initializeOffscreen(int w, int h);
bool StartTimer();
void StopTimer();
static void CALLBACK g_timer_proc( UINT id, UINT msg, DWORD_PTR dwUser, DWORD_PTR dw1, DWORD_PTR dw2 );
public: public:
DirectDrawDisplay(); DirectDrawDisplay();
virtual ~DirectDrawDisplay(); virtual ~DirectDrawDisplay();
@ -83,9 +72,8 @@ public:
virtual bool changeRenderSize(int w, int h); virtual bool changeRenderSize(int w, int h);
virtual DISPLAY_TYPE getType() { return DIRECT_DRAW; }; virtual DISPLAY_TYPE getType() { return DIRECT_DRAW; };
virtual void setOption(const char *, int) {} virtual void setOption(const char *, int) {}
virtual bool isSkinSupported() { return true; }
virtual int selectFullScreenMode(GUID **); virtual int selectFullScreenMode(GUID **);
void timer_proc( UINT id, UINT msg, DWORD_PTR dw1, DWORD_PTR dw2 );
}; };
static HRESULT WINAPI checkModesAvailable(LPDDSURFACEDESC2 surf, LPVOID lpContext) static HRESULT WINAPI checkModesAvailable(LPDDSURFACEDESC2 surf, LPVOID lpContext)
@ -144,10 +132,6 @@ DirectDrawDisplay::DirectDrawDisplay()
width = 0; width = 0;
height = 0; height = 0;
failed = false; failed = false;
wait_screenheight = 0;
wait_event = 0;
wait_timerres = 0;
wait_timerid = 0;
} }
DirectDrawDisplay::~DirectDrawDisplay() DirectDrawDisplay::~DirectDrawDisplay()
@ -158,15 +142,6 @@ DirectDrawDisplay::~DirectDrawDisplay()
void DirectDrawDisplay::cleanup() void DirectDrawDisplay::cleanup()
{ {
if(pDirectDraw != NULL) { if(pDirectDraw != NULL) {
if ( wait_timerid ) {
StopTimer();
}
if ( wait_event ) {
CloseHandle( wait_event );
wait_event = 0;
}
if(ddsClipper != NULL) { if(ddsClipper != NULL) {
ddsClipper->Release(); ddsClipper->Release();
ddsClipper = NULL; ddsClipper = NULL;
@ -192,7 +167,11 @@ void DirectDrawDisplay::cleanup()
} }
if(ddrawDLL != NULL) { if(ddrawDLL != NULL) {
FreeLibrary(ddrawDLL); #ifdef _AFXDLL
AfxFreeLibrary( ddrawDLL );
#else
FreeLibrary( ddrawDLL );
#endif
ddrawDLL = NULL; ddrawDLL = NULL;
} }
width = 0; width = 0;
@ -228,13 +207,13 @@ bool DirectDrawDisplay::initialize()
case VIDEO_1280x1024: case VIDEO_1280x1024:
case VIDEO_OTHER: case VIDEO_OTHER:
{ {
float scaleX = ((float)theApp.fsWidth / (float)theApp.sizeX); int scaleX = (theApp.fsWidth / theApp.sizeX);
float scaleY = ((float)theApp.fsHeight / (float)theApp.sizeY); int scaleY = (theApp.fsHeight / theApp.sizeY);
float min = scaleX < scaleY ? scaleX : scaleY; int min = scaleX < scaleY ? scaleX : scaleY;
if(theApp.fsMaxScale) if(theApp.fsMaxScale)
min = min > theApp.fsMaxScale ? theApp.fsMaxScale : min; min = min > theApp.fsMaxScale ? theApp.fsMaxScale : min;
theApp.surfaceSizeX = (int)(theApp.sizeX * min); theApp.surfaceSizeX = theApp.sizeX * min;
theApp.surfaceSizeY = (int)(theApp.sizeY * min); theApp.surfaceSizeY = theApp.sizeY * min;
if(theApp.fullScreenStretch) { if(theApp.fullScreenStretch) {
theApp.surfaceSizeX = theApp.fsWidth; theApp.surfaceSizeX = theApp.fsWidth;
theApp.surfaceSizeY = theApp.fsHeight; theApp.surfaceSizeY = theApp.fsHeight;
@ -242,7 +221,7 @@ bool DirectDrawDisplay::initialize()
} }
break; break;
} }
theApp.rect.left = 0; theApp.rect.left = 0;
theApp.rect.top = 0; theApp.rect.top = 0;
theApp.rect.right = theApp.sizeX; theApp.rect.right = theApp.sizeX;
@ -306,7 +285,12 @@ bool DirectDrawDisplay::initialize()
if(theApp.pVideoDriverGUID) if(theApp.pVideoDriverGUID)
guid = theApp.pVideoDriverGUID; guid = theApp.pVideoDriverGUID;
ddrawDLL = LoadLibrary("DDRAW.DLL"); #ifdef _AFXDLL
ddrawDLL = AfxLoadLibrary("ddraw.dll");
#else
ddrawDLL = LoadLibrary( _T("ddraw.dll") );
#endif
HRESULT (WINAPI *DDrawCreateEx)(GUID *,LPVOID *,REFIID,IUnknown *); HRESULT (WINAPI *DDrawCreateEx)(GUID *,LPVOID *,REFIID,IUnknown *);
if(ddrawDLL != NULL) { if(ddrawDLL != NULL) {
DDrawCreateEx = (HRESULT (WINAPI *)(GUID *,LPVOID *,REFIID,IUnknown *)) DDrawCreateEx = (HRESULT (WINAPI *)(GUID *,LPVOID *,REFIID,IUnknown *))
@ -459,12 +443,6 @@ bool DirectDrawDisplay::initialize()
} }
// } // }
wait_event = CreateEvent( NULL, FALSE, FALSE, NULL );
if ( ! StartTimer() ) {
return FALSE;
}
DDPIXELFORMAT px; DDPIXELFORMAT px;
px.dwSize = sizeof(px); px.dwSize = sizeof(px);
@ -633,7 +611,7 @@ bool DirectDrawDisplay::initializeOffscreen(int w, int h)
winlog("B shift: %d\n", systemBlueShift); winlog("B shift: %d\n", systemBlueShift);
} }
utilUpdateSystemColorMaps(theApp.filterLCD); utilUpdateSystemColorMaps();
width = w; width = w;
height = h; height = h;
return true; return true;
@ -671,6 +649,7 @@ void DirectDrawDisplay::checkFullScreen()
void DirectDrawDisplay::render() void DirectDrawDisplay::render()
{ {
HRESULT hret; HRESULT hret;
unsigned int nBytesPerPixel = systemColorDepth>>3;
if(pDirectDraw == NULL || if(pDirectDraw == NULL ||
ddsOffscreen == NULL || ddsOffscreen == NULL ||
@ -743,62 +722,9 @@ void DirectDrawDisplay::render()
copyY = 144; copyY = 144;
} }
} }
// MMX doesn't seem to be faster to copy the data copyImage( pix, ddsDesc.lpSurface, copyX, copyY, ddsDesc.lPitch, systemColorDepth );
__asm {
mov eax, copyX;
mov ebx, copyY;
mov esi, pix;
mov edi, ddsDesc.lpSurface;
mov edx, ddsDesc.lPitch;
cmp systemColorDepth, 16;
jnz gbaOtherColor;
sub edx, eax;
sub edx, eax;
lea esi,[esi+2*eax+4];
shr eax, 1;
gbaLoop16bit:
mov ecx, eax;
repz movsd;
inc esi;
inc esi;
inc esi;
inc esi;
add edi, edx;
dec ebx;
jnz gbaLoop16bit;
jmp gbaLoopEnd;
gbaOtherColor:
cmp systemColorDepth, 32;
jnz gbaOtherColor2;
sub edx, eax;
sub edx, eax;
sub edx, eax;
sub edx, eax;
lea esi, [esi+4*eax+4];
gbaLoop32bit:
mov ecx, eax;
repz movsd;
add esi, 4;
add edi, edx;
dec ebx;
jnz gbaLoop32bit;
jmp gbaLoopEnd;
gbaOtherColor2:
lea eax, [eax+2*eax];
sub edx, eax;
gbaLoop24bit:
mov ecx, eax;
shr ecx, 2;
repz movsd;
add edi, edx;
dec ebx;
jnz gbaLoop24bit;
gbaLoopEnd:
}
} }
if(theApp.showSpeed && theApp.videoOption > VIDEO_4X) { if(theApp.showSpeed && (theApp.videoOption > VIDEO_4X || theApp.skin != NULL)) {
char buffer[30]; char buffer[30];
if(theApp.showSpeed == 1) if(theApp.showSpeed == 1)
sprintf(buffer, "%3d%%", systemSpeed); sprintf(buffer, "%3d%%", systemSpeed);
@ -826,8 +752,7 @@ void DirectDrawDisplay::render()
if(hret == DD_OK) { if(hret == DD_OK) {
if(theApp.vsync && !(theApp.tripleBuffering && theApp.videoOption > VIDEO_4X) && !speedup) { // isn't the Flip() call synced unless a certain flag is passed to it? if(theApp.vsync && !(theApp.tripleBuffering && theApp.videoOption > VIDEO_4X) && !speedup) { // isn't the Flip() call synced unless a certain flag is passed to it?
//hret = pDirectDraw->WaitForVerticalBlank(DDWAITVB_BLOCKBEGIN, 0); hret = pDirectDraw->WaitForVerticalBlank(DDWAITVB_BLOCKBEGIN, 0);
WaitForSingleObject( wait_event, 100 );
} }
ddsOffscreen->PageLock(0); ddsOffscreen->PageLock(0);
if(theApp.tripleBuffering && theApp.videoOption > VIDEO_4X) { if(theApp.tripleBuffering && theApp.videoOption > VIDEO_4X) {
@ -865,7 +790,7 @@ void DirectDrawDisplay::render()
SetTextColor(hdc, RGB(255,0,0)); SetTextColor(hdc, RGB(255,0,0));
SetBkMode(hdc,TRANSPARENT); SetBkMode(hdc,TRANSPARENT);
TextOut(hdc, theApp.dest.left+10, theApp.dest.bottom - 20, theApp.screenMessageBuffer, TextOut(hdc, theApp.dest.left+10, theApp.dest.bottom - 20, theApp.screenMessageBuffer,
strlen(theApp.screenMessageBuffer)); (int)_tcslen(theApp.screenMessageBuffer));
ddsPrimary->ReleaseDC(hdc); ddsPrimary->ReleaseDC(hdc);
} else { } else {
theApp.screenMessage = false; theApp.screenMessage = false;
@ -883,74 +808,8 @@ int DirectDrawDisplay::selectFullScreenMode(GUID **pGUID)
return winVideoModeSelect(theApp.m_pMainWnd, pGUID); return winVideoModeSelect(theApp.m_pMainWnd, pGUID);
} }
bool DirectDrawDisplay::StartTimer()
{
MMRESULT result;
TIMECAPS tc;
if ( TIMERR_NOERROR == timeGetDevCaps( & tc, sizeof( TIMECAPS ) ) ) {
wait_timerres = min( max( tc.wPeriodMin, 1 ), tc.wPeriodMax );
timeBeginPeriod( wait_timerres );
} else {
return false;
}
result = timeSetEvent( wait_timerres, wait_timerres, & DirectDrawDisplay::g_timer_proc, ( DWORD_PTR ) this, TIME_PERIODIC );
if (NULL != result) {
wait_timerid = (UINT)result;
return true;
}
return false;
}
void DirectDrawDisplay::StopTimer()
{
MMRESULT result;
result = timeKillEvent( wait_timerid );
if ( TIMERR_NOERROR == result ) {
wait_timerid = 0;
}
if ( 0 != wait_timerres ) {
timeEndPeriod( wait_timerres );
wait_timerres = 0;
}
}
void CALLBACK DirectDrawDisplay::g_timer_proc( UINT id, UINT msg, DWORD_PTR dwUser, DWORD_PTR dw1, DWORD_PTR dw2 )
{
DirectDrawDisplay * p_this = reinterpret_cast< DirectDrawDisplay * >( dwUser );
if ( p_this ) {
p_this->timer_proc( id, msg, dw1, dw2 );
}
}
void DirectDrawDisplay::timer_proc( UINT id, UINT msg, DWORD_PTR dw1, DWORD_PTR dw2 )
{
DWORD scanline;
if ( pDirectDraw->GetScanLine( & scanline ) == DD_OK ) {
unsigned height = GetSystemMetrics( SM_CYSCREEN );
if ( wait_screenheight != height ) {
wait_screenheight = height;
wait_maxheight = height;
}
if ( scanline >= wait_maxheight ) wait_maxheight = scanline + 1;
scanline = ( scanline + wait_maxheight - min( theApp.dest.bottom, wait_screenheight ) ) % wait_maxheight;
if ( scanline < wait_lastscanline ) {
PulseEvent( wait_event );
}
wait_lastscanline = scanline;
}
}
IDisplay *newDirectDrawDisplay() IDisplay *newDirectDrawDisplay()
{ {
return new DirectDrawDisplay(); return new DirectDrawDisplay();
} }

File diff suppressed because it is too large Load Diff

View File

@ -1,380 +1,383 @@
// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. // VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator.
// Copyright (C) 1999-2003 Forgotten // Copyright (C) 1999-2003 Forgotten
// Copyright (C) 2004-2005 Forgotten and the VBA development team // Copyright (C) 2004 Forgotten and the VBA development team
// Copyright (C) 2004-2006 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 // This program is free software; you can redistribute it and/or modify
// the Free Software Foundation; either version 2, or(at your option) // it under the terms of the GNU General Public License as published by
// any later version. // 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 // This program is distributed in the hope that it will be useful,
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // but WITHOUT ANY WARRANTY; without even the implied warranty of
// GNU General Public License for more details. // 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, // You should have received a copy of the GNU General Public License
// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // along with this program; if not, write to the Free Software Foundation,
// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "stdafx.h"
#include "VBA.h" // MFC
#include "AVIWrite.h" #include "stdafx.h"
#include "Sound.h"
#include "WavWriter.h" // Tools
#include "AVIWrite.h"
#include "../System.h" #include "WavWriter.h"
#include "../GBA.h"
#include "../Globals.h" // Internals
#include "../Sound.h" #include "../System.h"
#include "../GBA.h"
#include <mmreg.h> #include "../Globals.h"
#include <Dsound.h> //DirectSound #include "../Sound.h"
extern bool soundBufferLow; // DirectSound8
#include <Dsound.h>
class DirectSound : public ISound #pragma comment( lib, "Dsound" )
{ #pragma comment( lib, "Dxguid" )
private:
HINSTANCE dsoundDLL; extern bool soundBufferLow;
LPDIRECTSOUND pDirectSound;
LPDIRECTSOUNDBUFFER dsbPrimary; class DirectSound : public ISound
LPDIRECTSOUNDBUFFER dsbSecondary; {
LPDIRECTSOUNDNOTIFY dsbNotify; private:
HANDLE dsbEvent; LPDIRECTSOUND8 pDirectSound; // DirectSound interface
WAVEFORMATEX wfx; LPDIRECTSOUNDBUFFER dsbPrimary; // Primary DirectSound buffer
LPDIRECTSOUNDBUFFER dsbSecondary; // Secondary DirectSound buffer
public: LPDIRECTSOUNDNOTIFY8 dsbNotify;
DirectSound(); HANDLE dsbEvent;
virtual ~DirectSound(); WAVEFORMATEX wfx; // Primary buffer wave format
bool init(); public:
void pause(); DirectSound();
void reset(); virtual ~DirectSound();
void resume();
void write(); bool init(); // initialize the primary and secondary sound buffer
}; void pause(); // pause the secondary sound buffer
void reset(); // stop and reset the secondary sound buffer
DirectSound::DirectSound() void resume(); // resume the secondary sound buffer
{ void write(); // write the emulated sound to the secondary sound buffer
dsoundDLL = NULL; };
pDirectSound = NULL;
dsbPrimary = NULL;
dsbSecondary = NULL; DirectSound::DirectSound()
dsbNotify = NULL; {
dsbEvent = NULL; CoInitialize( NULL );
}
pDirectSound = NULL;
DirectSound::~DirectSound() dsbPrimary = NULL;
{ dsbSecondary = NULL;
if(theApp.aviRecorder != NULL) { dsbNotify = NULL;
delete theApp.aviRecorder; dsbEvent = NULL;
theApp.aviRecorder = NULL; }
theApp.aviFrameNumber = 0;
}
DirectSound::~DirectSound()
if(theApp.soundRecording) { {
if(theApp.soundRecorder != NULL) { if(theApp.aviRecorder) {
delete theApp.soundRecorder; delete theApp.aviRecorder;
theApp.soundRecorder = NULL; theApp.aviRecorder = NULL;
} theApp.aviFrameNumber = 0;
theApp.soundRecording = false; }
}
if(theApp.soundRecording) {
if(dsbNotify != NULL) { if(theApp.soundRecorder) {
dsbNotify->Release(); delete theApp.soundRecorder;
dsbNotify = NULL; theApp.soundRecorder = NULL;
} }
theApp.soundRecording = false;
if(dsbEvent != NULL) { }
CloseHandle(dsbEvent);
dsbEvent = NULL; if(dsbNotify) {
} dsbNotify->Release();
dsbNotify = NULL;
if(pDirectSound != NULL) { }
if(dsbPrimary != NULL) {
dsbPrimary->Release(); if(dsbEvent) {
dsbPrimary = NULL; CloseHandle(dsbEvent);
} dsbEvent = NULL;
}
if(dsbSecondary != NULL) {
dsbSecondary->Release(); if(pDirectSound) {
dsbSecondary = NULL; if(dsbPrimary) {
} dsbPrimary->Release();
dsbPrimary = NULL;
pDirectSound->Release(); }
pDirectSound = NULL;
} if(dsbSecondary) {
dsbSecondary->Release();
if(dsoundDLL != NULL) { dsbSecondary = NULL;
FreeLibrary(dsoundDLL); }
dsoundDLL = NULL;
} pDirectSound->Release();
} pDirectSound = NULL;
}
bool DirectSound::init()
{ CoUninitialize();
HRESULT hr; }
dsoundDLL = LoadLibrary("dsound.dll");
HRESULT (WINAPI *DSoundCreate)(LPCGUID,LPDIRECTSOUND *,IUnknown *); bool DirectSound::init()
if(dsoundDLL != NULL) { {
DSoundCreate = (HRESULT (WINAPI *)(LPCGUID,LPDIRECTSOUND *,IUnknown *)) HRESULT hr;
GetProcAddress(dsoundDLL, "DirectSoundCreate8"); DWORD freq;
DSBUFFERDESC dsbdesc;
if(DSoundCreate == NULL) { int i;
theApp.directXMessage("DirectSoundCreate8");
return false;
} // Initialize DirectSound
} else { if( FAILED( hr = DirectSoundCreate8( &DSDEVID_DefaultPlayback, &pDirectSound, NULL ) ) ) {
theApp.directXMessage("dsound.dll"); systemMessage( IDS_CANNOT_CREATE_DIRECTSOUND, _T("Cannot create DirectSound %08x"), hr );
return false; pDirectSound = NULL;
} return false;
}
if((hr = DSoundCreate(NULL,&pDirectSound,NULL) != DS_OK)) {
// errorMessage(myLoadString(IDS_ERROR_SOUND_CREATE), hr);
systemMessage(IDS_CANNOT_CREATE_DIRECTSOUND, if( FAILED( hr = pDirectSound->SetCooperativeLevel( theApp.m_pMainWnd->GetSafeHwnd(), DSSCL_EXCLUSIVE ) ) ) {
"Cannot create DirectSound %08x", hr); systemMessage( IDS_CANNOT_SETCOOPERATIVELEVEL, _T("Cannot SetCooperativeLevel %08x"), hr );
pDirectSound = NULL; return false;
dsbSecondary = NULL; }
return false;
}
// Create primary sound buffer
if((hr=pDirectSound->SetCooperativeLevel((HWND)*theApp.m_pMainWnd, ZeroMemory( &dsbdesc, sizeof(DSBUFFERDESC) );
DSSCL_EXCLUSIVE)) != DS_OK) { dsbdesc.dwSize = sizeof(DSBUFFERDESC);
// errorMessage(myLoadString(IDS_ERROR_SOUND_LEVEL), hr); dsbdesc.dwFlags = DSBCAPS_PRIMARYBUFFER;
systemMessage(IDS_CANNOT_SETCOOPERATIVELEVEL, if( theApp.dsoundDisableHardwareAcceleration ) {
"Cannot SetCooperativeLevel %08x", hr); dsbdesc.dwFlags |= DSBCAPS_LOCSOFTWARE;
return false; }
}
if( FAILED( hr = pDirectSound->CreateSoundBuffer( &dsbdesc, &dsbPrimary, NULL ) ) ) {
DSBUFFERDESC dsbdesc; systemMessage(IDS_CANNOT_CREATESOUNDBUFFER, _T("Cannot CreateSoundBuffer %08x"), hr);
ZeroMemory(&dsbdesc,sizeof(DSBUFFERDESC)); return false;
dsbdesc.dwSize=sizeof(DSBUFFERDESC); }
dsbdesc.dwFlags = DSBCAPS_PRIMARYBUFFER;
switch(soundQuality)
if((hr=pDirectSound->CreateSoundBuffer(&dsbdesc, {
&dsbPrimary, case 4:
NULL) != DS_OK)) { freq = 11025;
// errorMessage(myLoadString(IDS_ERROR_SOUND_BUFFER),hr); break;
systemMessage(IDS_CANNOT_CREATESOUNDBUFFER, case 2:
"Cannot CreateSoundBuffer %08x", hr); freq = 22050;
return false; break;
} default:
soundQuality = 1;
// Set primary buffer format case 1:
freq = 44100;
memset(&wfx, 0, sizeof(WAVEFORMATEX)); break;
wfx.wFormatTag = WAVE_FORMAT_PCM; }
wfx.nChannels = 2; soundBufferLen = freq*2/30;
switch(soundQuality) { soundBufferTotalLen = soundBufferLen * 10;
case 2:
wfx.nSamplesPerSec = 22050; ZeroMemory( &wfx, sizeof(WAVEFORMATEX) );
soundBufferLen = 736*2; wfx.wFormatTag = WAVE_FORMAT_PCM;
soundBufferTotalLen = 7360*2; wfx.nChannels = 2;
break; wfx.nSamplesPerSec = freq;
case 4: wfx.wBitsPerSample = 16;
wfx.nSamplesPerSec = 11025; wfx.nBlockAlign = wfx.nChannels * wfx.wBitsPerSample / 8;
soundBufferLen = 368*2; wfx.nAvgBytesPerSec = wfx.nSamplesPerSec * wfx.nBlockAlign;
soundBufferTotalLen = 3680*2;
break; if( FAILED( hr = dsbPrimary->SetFormat( &wfx ) ) ) {
default: systemMessage( IDS_CANNOT_SETFORMAT_PRIMARY, _T("CreateSoundBuffer(primary) failed %08x"), hr );
soundQuality = 1; return false;
wfx.nSamplesPerSec = 44100; }
soundBufferLen = 1470*2;
soundBufferTotalLen = 14700*2;
} // Create secondary sound buffer
wfx.wBitsPerSample = 16; ZeroMemory( &dsbdesc, sizeof(DSBUFFERDESC) );
wfx.nBlockAlign = (wfx.wBitsPerSample / 8) * wfx.nChannels; dsbdesc.dwSize = sizeof(DSBUFFERDESC);
wfx.nAvgBytesPerSec = wfx.nSamplesPerSec * wfx.nBlockAlign; dsbdesc.dwFlags = DSBCAPS_GETCURRENTPOSITION2 | DSBCAPS_CTRLPOSITIONNOTIFY | DSBCAPS_GLOBALFOCUS;
if( theApp.dsoundDisableHardwareAcceleration ) {
if((hr = dsbPrimary->SetFormat(&wfx)) != DS_OK) { dsbdesc.dwFlags |= DSBCAPS_LOCSOFTWARE;
// errorMessage(myLoadString(IDS_ERROR_SOUND_PRIMARY),hr); }
systemMessage(IDS_CANNOT_SETFORMAT_PRIMARY, dsbdesc.dwBufferBytes = soundBufferTotalLen;
"Cannot SetFormat for primary %08x", hr); dsbdesc.lpwfxFormat = &wfx;
return false;
} if( FAILED( hr = pDirectSound->CreateSoundBuffer( &dsbdesc, &dsbSecondary, NULL ) ) ) {
systemMessage( IDS_CANNOT_CREATESOUNDBUFFER, _T("CreateSoundBuffer(secondary) failed %08x"), hr );
ZeroMemory(&dsbdesc,sizeof(DSBUFFERDESC)); return false;
dsbdesc.dwSize = sizeof(DSBUFFERDESC); }
dsbdesc.dwFlags = DSBCAPS_GETCURRENTPOSITION2|DSBCAPS_CTRLPOSITIONNOTIFY;
dsbdesc.dwBufferBytes = soundBufferTotalLen; if( FAILED( hr = dsbSecondary->SetCurrentPosition( 0 ) ) ) {
dsbdesc.lpwfxFormat = &wfx; systemMessage( 0, _T("dsbSecondary->SetCurrentPosition failed %08x"), hr );
return false;
if((hr = pDirectSound->CreateSoundBuffer(&dsbdesc, &dsbSecondary, NULL)) }
!= DS_OK) {
dsbdesc.dwFlags = DSBCAPS_GETCURRENTPOSITION2;
if((hr = pDirectSound->CreateSoundBuffer(&dsbdesc, &dsbSecondary, NULL)) if( !theApp.useOldSync ) {
!= DS_OK) { if( FAILED( hr = dsbSecondary->QueryInterface( IID_IDirectSoundNotify8, (LPVOID*)&dsbNotify ) ) ) {
systemMessage(IDS_CANNOT_CREATESOUNDBUFFER_SEC, dsbEvent = CreateEvent( NULL, FALSE, FALSE, NULL );
"Cannot CreateSoundBuffer secondary %08x", hr); DSBPOSITIONNOTIFY notify[10];
return false; for( i = 0; i < 10; i++ ) {
} notify[i].dwOffset = i * soundBufferLen;
} notify[i].hEventNotify = dsbEvent;
}
dsbSecondary->SetCurrentPosition(0);
if( FAILED( dsbNotify->SetNotificationPositions( 10, notify ) ) ) {
if(!theApp.useOldSync) { dsbNotify->Release();
hr = dsbSecondary->QueryInterface(IID_IDirectSoundNotify, dsbNotify = NULL;
(void **)&dsbNotify); CloseHandle(dsbEvent);
if(!FAILED(hr)) { dsbEvent = NULL;
dsbEvent = CreateEvent(NULL, FALSE, FALSE, NULL); }
}
DSBPOSITIONNOTIFY notify[10]; }
for(int i = 0; i < 10; i++) {
notify[i].dwOffset = i*soundBufferLen; // Play primary buffer
notify[i].hEventNotify = dsbEvent; if( FAILED( hr = dsbPrimary->Play( 0, 0, DSBPLAY_LOOPING ) ) ) {
} systemMessage( IDS_CANNOT_PLAY_PRIMARY, _T("Cannot Play primary %08x"), hr );
if(FAILED(dsbNotify->SetNotificationPositions(10, notify))) { return false;
dsbNotify->Release(); }
dsbNotify = NULL;
CloseHandle(dsbEvent); systemSoundOn = true;
dsbEvent = NULL;
} return true;
} }
}
hr = dsbPrimary->Play(0,0,DSBPLAY_LOOPING); void DirectSound::pause()
{
if(hr != DS_OK) { if( dsbSecondary == NULL ) return;
// errorMessage(myLoadString(IDS_ERROR_SOUND_PLAYPRIM), hr);
systemMessage(IDS_CANNOT_PLAY_PRIMARY, "Cannot Play primary %08x", hr); DWORD status;
return false;
} dsbSecondary->GetStatus( &status );
setsystemSoundOn(true); if( status & DSBSTATUS_PLAYING ) dsbSecondary->Stop();
return true; }
}
void DirectSound::pause() void DirectSound::reset()
{ {
if(dsbSecondary != NULL) { if( dsbSecondary == NULL ) return;
DWORD status = 0;
dsbSecondary->GetStatus(&status); dsbSecondary->Stop();
if(status & DSBSTATUS_PLAYING) { dsbSecondary->SetCurrentPosition( 0 );
dsbSecondary->Stop(); }
}
}
} void DirectSound::resume()
{
void DirectSound::reset() if( dsbSecondary == NULL ) return;
{
if(dsbSecondary) { dsbSecondary->Play( 0, 0, DSBPLAY_LOOPING );
dsbSecondary->Stop(); }
dsbSecondary->SetCurrentPosition(0);
}
} void DirectSound::write()
{
void DirectSound::resume() if(!pDirectSound) return;
{
if(dsbSecondary != NULL) {
dsbSecondary->Play(0,0,DSBPLAY_LOOPING); HRESULT hr;
} DWORD status = 0;
} DWORD play = 0;
WAVEFORMATEX format;
void DirectSound::write() LPVOID lpvPtr1;
{ DWORD dwBytes1 = 0;
int len = soundBufferLen; LPVOID lpvPtr2;
LPVOID lpvPtr1; DWORD dwBytes2 = 0;
DWORD dwBytes1;
LPVOID lpvPtr2;
DWORD dwBytes2; if( theApp.soundRecording ) {
if( dsbSecondary ) {
if(!pDirectSound) if( theApp.soundRecorder ) {
return; theApp.soundRecorder->AddSound( (u8 *)soundFinalWave, soundBufferLen );
} else {
if(theApp.soundRecording) { theApp.soundRecorder = new WavWriter;
if(dsbSecondary) { dsbSecondary->GetFormat( &format, sizeof(format), NULL );
if(theApp.soundRecorder == NULL) { if( theApp.soundRecorder->Open( theApp.soundRecordName ) ) {
theApp.soundRecorder = new WavWriter; theApp.soundRecorder->SetFormat( &format );
WAVEFORMATEX format; }
dsbSecondary->GetFormat(&format, sizeof(format), NULL); }
if(theApp.soundRecorder->Open(theApp.soundRecordName)) }
theApp.soundRecorder->SetFormat(&format); }
}
}
if( theApp.aviRecording ) {
if(theApp.soundRecorder) { if( theApp.aviRecorder ) {
theApp.soundRecorder->AddSound((u8 *)soundFinalWave, len); if( dsbSecondary ) {
} if( !theApp.aviRecorder->IsSoundAdded() ) {
} dsbSecondary->GetFormat( &format, sizeof(format), NULL );
theApp.aviRecorder->SetSoundFormat( &format );
if(theApp.aviRecording) { }
if(theApp.aviRecorder) { }
if(dsbSecondary) { theApp.aviRecorder->AddSound( (const char *)soundFinalWave, soundBufferLen );
if(!theApp.aviRecorder->IsSoundAdded()) { }
WAVEFORMATEX format; }
dsbSecondary->GetFormat(&format, sizeof(format), NULL);
theApp.aviRecorder->SetSoundFormat(&format);
} if( !speedup && synchronize && !theApp.throttle ) {
} hr = dsbSecondary->GetStatus(&status);
if( status & DSBSTATUS_PLAYING ) {
theApp.aviRecorder->AddSound((const char *)soundFinalWave, len); if( !soundPaused ) {
} while( true ) {
} dsbSecondary->GetCurrentPosition(&play, NULL);
int BufferLeft = ((soundNextPosition <= play) ?
HRESULT hr; play - soundNextPosition :
soundBufferTotalLen - soundNextPosition + play);
if(!speedup && synchronize && !theApp.throttle) {
DWORD status=0; if(BufferLeft > soundBufferLen)
hr = dsbSecondary->GetStatus(&status); {
if(status && DSBSTATUS_PLAYING) { if (BufferLeft > soundBufferTotalLen - (soundBufferLen * 3))
if(!soundPaused) { soundBufferLow = true;
DWORD play; break;
while(true) { }
dsbSecondary->GetCurrentPosition(&play, NULL); soundBufferLow = false;
int BufferLeft = ((soundNextPosition <= play) ?
play - soundNextPosition : if(dsbEvent) {
soundBufferTotalLen - soundNextPosition + play); WaitForSingleObject(dsbEvent, 50);
}
if(BufferLeft > soundBufferLen) }
{ }
if (BufferLeft > soundBufferTotalLen - (soundBufferLen * 3)) } else {
soundBufferLow = true; setsoundPaused(true);
break; }
} }
soundBufferLow = false;
if(dsbEvent) { // Obtain memory address of write block.
WaitForSingleObject(dsbEvent, 50); // This will be in two parts if the block wraps around.
} if( DSERR_BUFFERLOST == ( hr = dsbSecondary->Lock(
} soundNextPosition,
} soundBufferLen,
} else { &lpvPtr1,
setsoundPaused(true); &dwBytes1,
} &lpvPtr2,
} &dwBytes2,
// Obtain memory address of write block. This will be in two parts 0 ) ) ) {
// if the block wraps around. // If DSERR_BUFFERLOST is returned, restore and retry lock.
hr = dsbSecondary->Lock(soundNextPosition, soundBufferLen, &lpvPtr1, dsbSecondary->Restore();
&dwBytes1, &lpvPtr2, &dwBytes2, hr = dsbSecondary->Lock(
0); soundNextPosition,
soundBufferLen,
// If DSERR_BUFFERLOST is returned, restore and retry lock. &lpvPtr1,
if (DSERR_BUFFERLOST == hr) { &dwBytes1,
dsbSecondary->Restore(); &lpvPtr2,
hr = dsbSecondary->Lock(soundNextPosition, soundBufferLen,&lpvPtr1, &dwBytes2,
&dwBytes1, &lpvPtr2, &dwBytes2, 0 );
0); }
}
soundNextPosition += soundBufferLen;
soundNextPosition += soundBufferLen; soundNextPosition = soundNextPosition % soundBufferTotalLen;
soundNextPosition = soundNextPosition % soundBufferTotalLen;
if( SUCCEEDED( hr ) ) {
if SUCCEEDED(hr) { // Write to pointers.
// Write to pointers. CopyMemory( lpvPtr1, soundFinalWave, dwBytes1 );
CopyMemory(lpvPtr1, soundFinalWave, dwBytes1); if ( lpvPtr2 ) {
if (NULL != lpvPtr2) { CopyMemory( lpvPtr2, soundFinalWave + dwBytes1, dwBytes2 );
CopyMemory(lpvPtr2, soundFinalWave+dwBytes1, dwBytes2); }
}
// Release the data back to DirectSound. // Release the data back to DirectSound.
hr = dsbSecondary->Unlock(lpvPtr1, dwBytes1, lpvPtr2, hr = dsbSecondary->Unlock( lpvPtr1, dwBytes1, lpvPtr2, dwBytes2 );
dwBytes2); } else {
} systemMessage( 0, _T("dsbSecondary->Lock() failed: %08x"), hr );
} return;
}
ISound *newDirectSound() }
{
return new DirectSound();
} ISound *newDirectSound()
{
return new DirectSound();
}

View File

@ -26,6 +26,7 @@
#include "WinResUtil.h" #include "WinResUtil.h"
#include <shlobj.h> #include <shlobj.h>
#include <shlwapi.h>
#ifdef _DEBUG #ifdef _DEBUG
#define new DEBUG_NEW #define new DEBUG_NEW
@ -54,27 +55,21 @@ static int CALLBACK browseCallbackProc(HWND hWnd, UINT msg,
Directories::Directories(CWnd* pParent /*=NULL*/) Directories::Directories(CWnd* pParent /*=NULL*/)
: CDialog(Directories::IDD, pParent) : CDialog(Directories::IDD, pParent)
{ {
//{{AFX_DATA_INIT(Directories)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
} }
void Directories::DoDataExchange(CDataExchange* pDX) void Directories::DoDataExchange(CDataExchange* pDX)
{ {
CDialog::DoDataExchange(pDX); CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(Directories)
DDX_Control(pDX, IDC_SAVE_PATH, m_savePath); DDX_Control(pDX, IDC_SAVE_PATH, m_savePath);
DDX_Control(pDX, IDC_ROM_PATH, m_romPath); DDX_Control(pDX, IDC_ROM_PATH, m_romPath);
DDX_Control(pDX, IDC_GBROM_PATH, m_gbromPath); DDX_Control(pDX, IDC_GBROM_PATH, m_gbromPath);
DDX_Control(pDX, IDC_CAPTURE_PATH, m_capturePath); DDX_Control(pDX, IDC_CAPTURE_PATH, m_capturePath);
DDX_Control(pDX, IDC_BATTERY_PATH, m_batteryPath); DDX_Control(pDX, IDC_BATTERY_PATH, m_batteryPath);
//}}AFX_DATA_MAP
} }
BEGIN_MESSAGE_MAP(Directories, CDialog) BEGIN_MESSAGE_MAP(Directories, CDialog)
//{{AFX_MSG_MAP(Directories)
ON_BN_CLICKED(IDC_BATTERY_DIR, OnBatteryDir) ON_BN_CLICKED(IDC_BATTERY_DIR, OnBatteryDir)
ON_BN_CLICKED(IDC_BATTERY_DIR_RESET, OnBatteryDirReset) ON_BN_CLICKED(IDC_BATTERY_DIR_RESET, OnBatteryDirReset)
ON_BN_CLICKED(IDC_CAPTURE_DIR, OnCaptureDir) ON_BN_CLICKED(IDC_CAPTURE_DIR, OnCaptureDir)
@ -85,8 +80,7 @@ BEGIN_MESSAGE_MAP(Directories, CDialog)
ON_BN_CLICKED(IDC_ROM_DIR_RESET, OnRomDirReset) ON_BN_CLICKED(IDC_ROM_DIR_RESET, OnRomDirReset)
ON_BN_CLICKED(IDC_SAVE_DIR, OnSaveDir) ON_BN_CLICKED(IDC_SAVE_DIR, OnSaveDir)
ON_BN_CLICKED(IDC_SAVE_DIR_RESET, OnSaveDirReset) ON_BN_CLICKED(IDC_SAVE_DIR_RESET, OnSaveDirReset)
//}}AFX_MSG_MAP END_MESSAGE_MAP()
END_MESSAGE_MAP()
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// Directories message handlers // Directories message handlers
@ -206,23 +200,76 @@ void Directories::OnCancel()
void Directories::OnOK() void Directories::OnOK()
{ {
CString buffer; char baseDir[MAX_PATH+1];
m_romPath.GetWindowText(buffer); char temp[MAX_PATH+1];
if(!buffer.IsEmpty()) GetModuleFileName( NULL, baseDir, MAX_PATH );
regSetStringValue("romdir", buffer); baseDir[MAX_PATH] = '\0'; // for security reasons
m_gbromPath.GetWindowText(buffer); PathRemoveFileSpec( baseDir ); // removes the trailing file name and backslash
if(!buffer.IsEmpty())
regSetStringValue("gbromdir", buffer);
m_batteryPath.GetWindowText(buffer); CString buffer;
if(!buffer.IsEmpty())
regSetStringValue("batteryDir", buffer); m_romPath.GetWindowText(buffer);
m_savePath.GetWindowText(buffer); if( !buffer.IsEmpty() )
if(!buffer.IsEmpty()) regSetStringValue( "romdir", buffer );
regSetStringValue("saveDir", buffer); if( buffer[0] == '.' ) {
m_capturePath.GetWindowText(buffer); strcpy( temp, baseDir );
if(!buffer.IsEmpty()) strcat( temp, "\\" );
regSetStringValue("captureDir", buffer); strcat( temp, buffer );
EndDialog(TRUE); buffer = temp;
}
if( !directoryDoesExist( buffer ) )
SHCreateDirectoryEx( NULL, buffer, NULL );
m_gbromPath.GetWindowText(buffer);
if( !buffer.IsEmpty() )
regSetStringValue( "gbromdir", buffer );
if( buffer[0] == '.' ) {
strcpy( temp, baseDir );
strcat( temp, "\\" );
strcat( temp, buffer );
buffer = temp;
}
if( !directoryDoesExist( buffer ) )
SHCreateDirectoryEx( NULL, buffer, NULL );
m_batteryPath.GetWindowText(buffer);
if( !buffer.IsEmpty() )
regSetStringValue( "batteryDir", buffer );
if( buffer[0] == '.' ) {
strcpy( temp, baseDir );
strcat( temp, "\\" );
strcat( temp, buffer );
buffer = temp;
}
if( !directoryDoesExist( buffer ) )
SHCreateDirectoryEx( NULL, buffer, NULL );
m_savePath.GetWindowText(buffer);
if( !buffer.IsEmpty() )
regSetStringValue( "saveDir", buffer );
if( buffer[0] == '.' ) {
strcpy( temp, baseDir );
strcat( temp, "\\" );
strcat( temp, buffer );
buffer = temp;
}
if( !directoryDoesExist( buffer ) )
SHCreateDirectoryEx( NULL, buffer, NULL );
m_capturePath.GetWindowText(buffer);
if( !buffer.IsEmpty() )
regSetStringValue( "captureDir", buffer );
if( buffer[0] == '.' ) {
strcpy( temp, baseDir );
strcat( temp, "\\" );
strcat( temp, buffer );
buffer = temp;
}
if( !directoryDoesExist( buffer ) )
SHCreateDirectoryEx( NULL, buffer, NULL );
EndDialog(TRUE);
} }
CString Directories::browseForDir(CString title) CString Directories::browseForDir(CString title)

View File

@ -75,7 +75,24 @@ class Directories : public CDialog
virtual void OnOK(); virtual void OnOK();
//}}AFX_MSG //}}AFX_MSG
DECLARE_MESSAGE_MAP() DECLARE_MESSAGE_MAP()
}; private:
bool directoryDoesExist(const char *directory)
{ // returns true if the directory does exist
HANDLE hDir;
hDir = CreateFile(
directory,
GENERIC_READ,
FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE,
NULL,
OPEN_EXISTING,
FILE_FLAG_BACKUP_SEMANTICS,
NULL );
bool retval = (hDir == INVALID_HANDLE_VALUE) ? false : true;
CloseHandle( hDir );
return retval;
}
};
//{{AFX_INSERT_LOCATION}} //{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line. // Microsoft Visual C++ will insert additional declarations immediately before the previous line.

View File

@ -1,6 +1,6 @@
// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. // VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator.
// Copyright (C) 1999-2003 Forgotten // Copyright (C) 1999-2003 Forgotten
// Copyright (C) 2004 Forgotten and the VBA development team // Copyright (C) 2005 Forgotten and the VBA development team
// This program is free software; you can redistribute it and/or modify // 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 // it under the terms of the GNU General Public License as published by
@ -118,6 +118,7 @@ void Disassemble::OnAutomatic()
void Disassemble::OnArm() void Disassemble::OnArm()
{ {
mode = 1; mode = 1;
address&=0xfffffffC;
refresh(); refresh();
} }
@ -133,21 +134,30 @@ void Disassemble::OnGo()
CString buffer; CString buffer;
m_address.GetWindowText(buffer); m_address.GetWindowText(buffer);
sscanf(buffer, "%x", &address); sscanf(buffer, "%x", &address);
if (mode==1)
address&=0xfffffffc;
else if (mode==2)
address&=0xfffffffe;
refresh(); refresh();
} }
void Disassemble::OnGopc() void Disassemble::OnGopc()
{ {
if(rom != NULL)
{
if(armState) if(armState)
address = armNextPC - 16; address = armNextPC - 16;
else else
address = armNextPC - 8; address = armNextPC - 8;
refresh(); refresh();
}
} }
void Disassemble::OnNext() void Disassemble::OnNext()
{ {
if(rom != NULL)
{
CPULoop(1); CPULoop(1);
if(armState) { if(armState) {
u32 total = address+count*4; u32 total = address+count*4;
@ -163,6 +173,7 @@ void Disassemble::OnNext()
} }
} }
refresh(); refresh();
}
} }
void Disassemble::OnRefresh() void Disassemble::OnRefresh()
@ -173,6 +184,7 @@ void Disassemble::OnRefresh()
void Disassemble::OnThumb() void Disassemble::OnThumb()
{ {
mode = 2; mode = 2;
address&=0xfffffffe;
refresh(); refresh();
} }

View File

@ -17,6 +17,8 @@
// along with this program; if not, write to the Free Software Foundation, // along with this program; if not, write to the Free Software Foundation,
// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#pragma once
enum DISPLAY_TYPE { enum DISPLAY_TYPE {
GDI = 0, GDI = 0,
DIRECT_DRAW = 1, DIRECT_DRAW = 1,
@ -32,13 +34,15 @@ class IDisplay {
virtual bool initialize() = 0; virtual bool initialize() = 0;
virtual void cleanup() = 0; virtual void cleanup() = 0;
virtual void render() = 0; virtual void render() = 0;
virtual void checkFullScreen() { }; virtual void checkFullScreen() {};
virtual void renderMenu() { }; virtual void renderMenu() {};
virtual void clear() = 0; virtual void clear() = 0;
virtual bool changeRenderSize(int w, int h) { return true; }; virtual bool changeRenderSize(int w, int h) { return true; };
virtual void resize(int w, int h) {}; virtual void resize(int w, int h) {};
virtual void setOption(const char *option, int value) = 0; virtual void setOption(const char *option, int value) {};
virtual DISPLAY_TYPE getType() = 0; virtual DISPLAY_TYPE getType() = 0;
virtual bool isSkinSupported() { return false; }
virtual int selectFullScreenMode(GUID **) = 0; virtual int selectFullScreenMode(GUID **) = 0;
virtual int selectFullScreenMode2() { return 0; };
}; };
void copyImage( void *source, void *destination, unsigned int width, unsigned int height, unsigned int destinationPitch, unsigned int colorDepth );

View File

@ -1,6 +1,6 @@
// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. // VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator.
// Copyright (C) 1999-2003 Forgotten // Copyright (C) 1999-2003 Forgotten
// Copyright (C) 2004 Forgotten and the VBA development team // Copyright (C) 2005 Forgotten and the VBA development team
// This program is free software; you can redistribute it and/or modify // 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 // it under the terms of the GNU General Public License as published by
@ -18,7 +18,7 @@
// FileDlg.cpp: implementation of the FileDlg class. // FileDlg.cpp: implementation of the FileDlg class.
// //
//////////////////////////////////////////////////////////////////////
#include "stdafx.h" #include "stdafx.h"
#include <commdlg.h> #include <commdlg.h>
#include <dlgs.h> #include <dlgs.h>
@ -26,7 +26,7 @@
#include "VBA.h" #include "VBA.h"
#include "FileDlg.h" #include "FileDlg.h"
#include "../System.h" #include "../System.h"
#include "..\..\res\resource.h" #include "resource.h"
#ifdef _DEBUG #ifdef _DEBUG
#define new DEBUG_NEW #define new DEBUG_NEW
@ -159,20 +159,23 @@ void FileDlg::OnTypeChange(HWND hwnd)
ASSERT(typeControl != NULL); ASSERT(typeControl != NULL);
int sel = ::SendMessage(typeControl, CB_GETCURSEL, 0, 0); LRESULT sel = ::SendMessage(typeControl, CB_GETCURSEL, 0, 0);
ASSERT(sel != -1); ASSERT(sel != -1);
LPCTSTR typeName = extensions[sel]; LPCTSTR typeName = extensions[sel];
if(filename.GetLength() == 0) { if(filename.GetLength() == 0) {
filename.Format("*%s", typeName); if(strlen(typeName) != 0)
filename.Format("*%s", typeName);
} else { } else {
int index = filename.Find('.'); if(strlen(typeName) != 0) {
if (index == -1) { int index = filename.Find('.');
filename = filename + typeName; if (index == -1) {
} else { filename = filename + typeName;
filename = filename.Left(index) + typeName; } else {
filename = filename.Left(index) + typeName;
}
} }
} }
SetWindowText(fileNameControl, filename); SetWindowText(fileNameControl, filename);

View File

@ -683,7 +683,7 @@ bool AddCheat::addCheat()
code.Format("%08x:%08x", address, value); code.Format("%08x:%08x", address, value);
break; break;
} }
cheatsAdd(code, buffer, address ,address, value,-1, sizeType); cheatsAdd(code, buffer, address ,address, value,-1, sizeType);
return true; return true;
} }
@ -765,16 +765,16 @@ void GBACheatList::OnEnable()
if(mark != -1) { if(mark != -1) {
LVITEM item; LVITEM item;
for(int i = 0; i < count; i++) { for(int i = 0; i < count; i++) {
memset(&item,0, sizeof(item)); memset(&item, 0, sizeof(item));
item.mask = LVIF_PARAM|LVIF_STATE; item.mask = LVIF_PARAM|LVIF_STATE;
item.stateMask = LVIS_SELECTED; item.stateMask = LVIS_SELECTED;
item.iItem = i; item.iItem = i;
if(m_list.GetItem(&item)) { if(m_list.GetItem(&item)) {
if(item.state & LVIS_SELECTED) { if(item.state & LVIS_SELECTED) {
if(cheatsList[item.lParam].enabled) if(cheatsList[item.lParam].enabled)
cheatsDisable(item.lParam); cheatsDisable((int)(item.lParam & 0xFFFFFFFF));
else else
cheatsEnable(item.lParam); cheatsEnable((int)(item.lParam & 0xFFFFFFFF));
} }
} }
} }
@ -796,7 +796,7 @@ void GBACheatList::OnRemove()
item.stateMask = LVIS_SELECTED; item.stateMask = LVIS_SELECTED;
if(m_list.GetItem(&item)) { if(m_list.GetItem(&item)) {
if(item.state & LVIS_SELECTED) { if(item.state & LVIS_SELECTED) {
cheatsDelete(item.lParam, restoreValues); cheatsDelete((int)(item.lParam & 0xFFFFFFFF), restoreValues);
} }
} }
} }
@ -838,9 +838,9 @@ void GBACheatList::OnItemchangedCheatList(NMHDR* pNMHDR, LRESULT* pResult)
if(((l->uOldState & LVIS_STATEIMAGEMASK)>>12) != if(((l->uOldState & LVIS_STATEIMAGEMASK)>>12) !=
(((l->uNewState & LVIS_STATEIMAGEMASK)>>12))) { (((l->uNewState & LVIS_STATEIMAGEMASK)>>12))) {
if(m_list.GetCheck(l->iItem)) if(m_list.GetCheck(l->iItem))
cheatsEnable(l->lParam); cheatsEnable((int)(l->lParam & 0xFFFFFFFF));
else else
cheatsDisable(l->lParam); cheatsDisable((int)(l->lParam & 0xFFFFFFFF));
refresh(); refresh();
} }
} }

View File

@ -20,7 +20,7 @@
#if !defined(AFX_GBACHEATS_H__FC31D47D_52C8_42B2_95C7_7C3FD09316A4__INCLUDED_) #if !defined(AFX_GBACHEATS_H__FC31D47D_52C8_42B2_95C7_7C3FD09316A4__INCLUDED_)
#define AFX_GBACHEATS_H__FC31D47D_52C8_42B2_95C7_7C3FD09316A4__INCLUDED_ #define AFX_GBACHEATS_H__FC31D47D_52C8_42B2_95C7_7C3FD09316A4__INCLUDED_
#include "..\System.h" // Added by ClassView #include "../System.h" // Added by ClassView
#if _MSC_VER > 1000 #if _MSC_VER > 1000
#pragma once #pragma once
#endif // _MSC_VER > 1000 #endif // _MSC_VER > 1000

View File

@ -637,7 +637,7 @@ bool AddGBCheat::addCheat()
m_desc.GetWindowText(buffer); m_desc.GetWindowText(buffer);
int bank = (address >> 16); LONG_PTR bank = (address >> 16);
address &= 0xFFFF; address &= 0xFFFF;
if(address >= 0xd000) if(address >= 0xd000)
@ -689,9 +689,7 @@ BOOL AddGBCheat::OnInitDialog()
buffer.Format("%02x:%08x", (address>>16), address&0xFFFF); buffer.Format("%02x:%08x", (address>>16), address&0xFFFF);
m_address.SetWindowText(buffer); m_address.SetWindowText(buffer);
m_address.EnableWindow(FALSE); m_address.EnableWindow(FALSE);
::SetWindowLong(m_address, ::SetWindowLongPtr( m_address.GetSafeHwnd(), GWLP_USERDATA, address);
GWL_USERDATA,
address);
numberType = regQueryDwordValue("gbCheatsNumberType", 2); numberType = regQueryDwordValue("gbCheatsNumberType", 2);
if(numberType < 0 || numberType > 2) if(numberType < 0 || numberType > 2)
@ -826,9 +824,9 @@ void GBCheatList::OnEnable()
item.iItem = mark; item.iItem = mark;
if(m_list.GetItem(&item)) { if(m_list.GetItem(&item)) {
if(gbCheatList[item.lParam].enabled) if(gbCheatList[item.lParam].enabled)
gbCheatDisable(item.lParam); gbCheatDisable((int)item.lParam);
else else
gbCheatEnable(item.lParam); gbCheatEnable((int)item.lParam);
refresh(); refresh();
} }
} }
@ -844,7 +842,7 @@ void GBCheatList::OnRemove()
item.mask = LVIF_PARAM; item.mask = LVIF_PARAM;
item.iItem = mark; item.iItem = mark;
if(m_list.GetItem(&item)) { if(m_list.GetItem(&item)) {
gbCheatRemove(item.lParam); gbCheatRemove((int)item.lParam);
refresh(); refresh();
} }
} }
@ -872,9 +870,9 @@ void GBCheatList::OnItemchangedCheatList(NMHDR* pNMHDR, LRESULT* pResult)
if(((l->uOldState & LVIS_STATEIMAGEMASK)>>12) != if(((l->uOldState & LVIS_STATEIMAGEMASK)>>12) !=
(((l->uNewState & LVIS_STATEIMAGEMASK)>>12))) { (((l->uNewState & LVIS_STATEIMAGEMASK)>>12))) {
if(m_list.GetCheck(l->iItem)) if(m_list.GetCheck(l->iItem))
gbCheatEnable(l->lParam); gbCheatEnable((int)l->lParam);
else else
gbCheatDisable(l->lParam); gbCheatDisable((int)l->lParam);
refresh(); refresh();
} }
} }

View File

@ -121,7 +121,7 @@ class AddGBCheat : public CDialog
// Implementation // Implementation
protected: protected:
u32 address; LONG_PTR address;
// Generated message map functions // Generated message map functions
//{{AFX_MSG(AddGBCheat) //{{AFX_MSG(AddGBCheat)

View File

@ -1,6 +1,6 @@
// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. // VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator.
// Copyright (C) 1999-2003 Forgotten // Copyright (C) 1999-2003 Forgotten
// Copyright (C) 2004 Forgotten and the VBA development team // Copyright (C) 2004-2006 Forgotten and the VBA development team
// This program is free software; you can redistribute it and/or modify // 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 // it under the terms of the GNU General Public License as published by
@ -32,28 +32,31 @@ extern u16 gbPalette[128];
static u16 defaultPalettes[][24] = { static u16 defaultPalettes[][24] = {
{ {
0x7FFF, 0x56B5, 0x318C, 0x0000, 0x7FFF, 0x56B5, 0x318C, 0x0000, 0x7FFF, 0x56B5, 0x318C, 0x0000, 0x7FFF, 0x56B5, 0x318C, 0x0000,
}, },
{ {
0x6200, 0x7E10, 0x7C10, 0x5000, 0x6200, 0x7E10, 0x7C10, 0x5000, 0x6200, 0x7E10, 0x7C10, 0x5000, 0x6200, 0x7E10, 0x7C10, 0x5000,
}, },
{ {
0x4008, 0x4000, 0x2000, 0x2008, 0x4008, 0x4000, 0x2000, 0x2008, 0x4008, 0x4000, 0x2000, 0x2008, 0x4008, 0x4000, 0x2000, 0x2008,
}, },
{ {
0x43F0, 0x03E0, 0x4200, 0x2200, 0x43F0, 0x03E0, 0x4200, 0x2200, 0x43F0, 0x03E0, 0x4200, 0x2200, 0x43F0, 0x03E0, 0x4200, 0x2200,
}, },
{ {
0x43FF, 0x03FF, 0x221F, 0x021F, 0x43FF, 0x03FF, 0x221F, 0x021F, 0x43FF, 0x03FF, 0x221F, 0x021F, 0x43FF, 0x03FF, 0x221F, 0x021F,
}, },
{ {
0x621F, 0x7E1F, 0x7C1F, 0x2010, 0x621F, 0x7E1F, 0x7C1F, 0x2010, 0x621F, 0x7E1F, 0x7C1F, 0x2010, 0x621F, 0x7E1F, 0x7C1F, 0x2010,
}, },
{ {
0x621F, 0x401F, 0x001F, 0x2010, 0x621F, 0x401F, 0x001F, 0x2010, 0x621F, 0x401F, 0x001F, 0x2010, 0x621F, 0x401F, 0x001F, 0x2010,
}, },
{ {
0x421F, 0x03E0, 0x7C00, 0x401F, 0x021F, 0x2200, 0x4008, 0x2010, 0x1B8E, 0x02C0, 0x0DA0, 0x1140, 0x1B8E, 0x02C0, 0x0DA0, 0x1140,
},
{
0x7BDE, /*0x23F0*/ 0x5778, /*0x5DC0*/ 0x5640, 0x0000, 0x7BDE, /*0x3678*/ 0x529C, /*0x0980*/ 0x2990, 0x0000,
} }
}; };
@ -70,20 +73,15 @@ static char THIS_FILE[] = __FILE__;
GBColorDlg::GBColorDlg(CWnd* pParent /*=NULL*/) GBColorDlg::GBColorDlg(CWnd* pParent /*=NULL*/)
: CDialog(GBColorDlg::IDD, pParent) : CDialog(GBColorDlg::IDD, pParent)
{ {
//{{AFX_DATA_INIT(GBColorDlg)
which = -1;
//}}AFX_DATA_INIT
which = gbPaletteOption; which = gbPaletteOption;
} }
void GBColorDlg::DoDataExchange(CDataExchange* pDX) void GBColorDlg::DoDataExchange(CDataExchange* pDX)
{ {
CDialog::DoDataExchange(pDX); CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(GBColorDlg)
DDX_Control(pDX, IDC_PREDEFINED, m_predefined); DDX_Control(pDX, IDC_PREDEFINED, m_predefined);
DDX_Radio(pDX, IDC_DEFAULT, which); DDX_Radio(pDX, IDC_DEFAULT, which);
//}}AFX_DATA_MAP
} }
@ -95,8 +93,8 @@ BEGIN_MESSAGE_MAP(GBColorDlg, CDialog)
ON_BN_CLICKED(IDC_USER2, OnUser2) ON_BN_CLICKED(IDC_USER2, OnUser2)
ON_BN_CLICKED(ID_OK, OnOk) ON_BN_CLICKED(ID_OK, OnOk)
ON_BN_CLICKED(ID_CANCEL, OnCancel) ON_BN_CLICKED(ID_CANCEL, OnCancel)
ON_CBN_SELCHANGE(IDC_PREDEFINED, OnSelchangePredefined) ON_CBN_SELCHANGE(IDC_PREDEFINED, OnSelchangePredefined)
//}}AFX_MSG_MAP //}}AFX_MSG_MAP
ON_CONTROL_RANGE(BN_CLICKED, IDC_COLOR_BG0, IDC_COLOR_OB3, OnColorClicked) ON_CONTROL_RANGE(BN_CLICKED, IDC_COLOR_BG0, IDC_COLOR_OB3, OnColorClicked)
END_MESSAGE_MAP() END_MESSAGE_MAP()
@ -167,10 +165,12 @@ BOOL GBColorDlg::OnInitDialog()
"Green Forest", "Green Forest",
"Hot Desert", "Hot Desert",
"Pink Dreams", "Pink Dreams",
"Weird Colors" "Weird Colors",
"Real GB Colors",
"Real 'GB on GBASP' Colors"
}; };
for(int j = 0; j < 7; j++) { for(int j = 0; j < 9; j++) {
int index = m_predefined.AddString(names[j]); int index = m_predefined.AddString(names[j]);
m_predefined.SetItemData(index, j); m_predefined.SetItemData(index, j);
} }
@ -222,15 +222,20 @@ void GBColorDlg::OnColorClicked(UINT id)
{ {
id -= IDC_COLOR_BG0; id -= IDC_COLOR_BG0;
u16 color = colors[id]; u16 color = colors[which*8+id];
CColorDialog dlg(RGB(color & 0x1f, (color >> 5) & 0x1f, (color >> 10) & 0x1f), COLORREF colorInit =
RGB((color & 0x1f) << 3, ((color >> 5) & 0x1f) << 3, ((color >> 10) & 0x1f) << 3);
CColorDialog dlg(colorInit,
CC_FULLOPEN | CC_ANYCOLOR, this); CC_FULLOPEN | CC_ANYCOLOR, this);
if(dlg.DoModal()) {
if(IDOK == dlg.DoModal())
{
COLORREF c = dlg.GetColor(); COLORREF c = dlg.GetColor();
colors[which*8+id] = (u16)((c >> 3) & 0x1f | ((c >> 11) & 0x1f) << 5 | colors[which*8+id] = (u16)((c >> 3) & 0x1f | ((c >> 11) & 0x1f) << 5 | ((c >> 19) & 0x1f) << 10);
((c >> 19) & 0x1f) << 10);
colorControls[id].setColor(colors[which*8+id]); colorControls[id].setColor(colors[which*8+id]);
} }
} }
@ -246,7 +251,7 @@ void GBColorDlg::OnSelchangePredefined()
int sel = m_predefined.GetCurSel(); int sel = m_predefined.GetCurSel();
if(sel != -1) { if(sel != -1) {
int data = m_predefined.GetItemData(sel); DWORD_PTR data = m_predefined.GetItemData(sel);
for(int i = 0; i < 8; i++) { for(int i = 0; i < 8; i++) {
colorControls[i].setColor(defaultPalettes[data][i]); colorControls[i].setColor(defaultPalettes[data][i]);
colors[which*8+i] = defaultPalettes[data][i]; colors[which*8+i] = defaultPalettes[data][i];

View File

@ -21,7 +21,7 @@
#define AFX_GBCOLORDLG_H__8D6126EF_06BB_48CF_ABB3_2CC4B1B60358__INCLUDED_ #define AFX_GBCOLORDLG_H__8D6126EF_06BB_48CF_ABB3_2CC4B1B60358__INCLUDED_
#include "ColorButton.h" // Added by ClassView #include "ColorButton.h" // Added by ClassView
#include "..\System.h" // Added by ClassView #include "../System.h" // Added by ClassView
#if _MSC_VER > 1000 #if _MSC_VER > 1000
#pragma once #pragma once
#endif // _MSC_VER > 1000 #endif // _MSC_VER > 1000

View File

@ -1,6 +1,6 @@
// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. // VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator.
// Copyright (C) 1999-2003 Forgotten // Copyright (C) 1999-2003 Forgotten
// Copyright (C) 2004 Forgotten and the VBA development team // Copyright (C) 2005 Forgotten and the VBA development team
// This program is free software; you can redistribute it and/or modify // 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 // it under the terms of the GNU General Public License as published by
@ -39,6 +39,7 @@ extern gbRegister DE;
extern gbRegister HL; extern gbRegister HL;
extern gbRegister SP; extern gbRegister SP;
extern gbRegister PC; extern gbRegister PC;
extern u8 register_LY;
extern u16 IFF; extern u16 IFF;
extern int gbDis(char *, u16); extern int gbDis(char *, u16);
@ -114,8 +115,9 @@ void GBDisassemble::OnNext()
void GBDisassemble::OnGo() void GBDisassemble::OnGo()
{ {
CString buffer; CString buffer;
m_address.GetWindowText(buffer); m_address.GetWindowText(buffer);
sscanf(buffer, "%x", &address); sscanf(buffer, "%hx", &address);
refresh(); refresh();
} }
@ -242,6 +244,8 @@ void GBDisassemble::refresh()
GetDlgItem(IDC_R5)->SetWindowText(buffer); GetDlgItem(IDC_R5)->SetWindowText(buffer);
sprintf(buffer, "%04x", IFF); sprintf(buffer, "%04x", IFF);
GetDlgItem(IDC_R6)->SetWindowText(buffer); GetDlgItem(IDC_R6)->SetWindowText(buffer);
sprintf(buffer, "%04x", register_LY);
GetDlgItem(IDC_LY)->SetWindowText(buffer);
m_z = (AF.B.B0 & 0x80) != 0; m_z = (AF.B.B0 & 0x80) != 0;
m_n = (AF.B.B0 & 0x40) != 0; m_n = (AF.B.B0 & 0x40) != 0;

View File

@ -20,7 +20,7 @@
#if !defined(AFX_GBDISASSEMBLE_H__3EFD5B47_6DBF_4F63_8F91_A9511EC590EB__INCLUDED_) #if !defined(AFX_GBDISASSEMBLE_H__3EFD5B47_6DBF_4F63_8F91_A9511EC590EB__INCLUDED_)
#define AFX_GBDISASSEMBLE_H__3EFD5B47_6DBF_4F63_8F91_A9511EC590EB__INCLUDED_ #define AFX_GBDISASSEMBLE_H__3EFD5B47_6DBF_4F63_8F91_A9511EC590EB__INCLUDED_
#include "..\System.h" // Added by ClassView #include "../System.h" // Added by ClassView
#if _MSC_VER > 1000 #if _MSC_VER > 1000
#pragma once #pragma once
#endif // _MSC_VER > 1000 #endif // _MSC_VER > 1000

View File

@ -499,8 +499,8 @@ LRESULT GBMapView::OnMapInfo(WPARAM wParam, LPARAM lParam)
u8 *colors = (u8 *)lParam; u8 *colors = (u8 *)lParam;
mapViewZoom.setColors(colors); mapViewZoom.setColors(colors);
int x = wParam & 0xffff; int x = (int)(wParam & 0xffff);
int y = (wParam >> 16); int y = (int)(wParam >> 16);
CString buffer; CString buffer;
buffer.Format("(%d,%d)", x, y); buffer.Format("(%d,%d)", x, y);

View File

@ -31,7 +31,7 @@
#include "ZoomControl.h" #include "ZoomControl.h"
#include "ResizeDlg.h" #include "ResizeDlg.h"
#include "IUpdate.h" #include "IUpdate.h"
#include "..\System.h" // Added by ClassView #include "../System.h" // Added by ClassView
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// GBMapView dialog // GBMapView dialog

View File

@ -135,8 +135,8 @@ void GBPaletteView::save(int which)
if(dlg.DoModal() == IDCANCEL) { if(dlg.DoModal() == IDCANCEL) {
return; return;
} }
captureBuffer = dlg.GetPathName(); captureBuffer = dlg.GetPathName();
PaletteViewControl *p = NULL; PaletteViewControl *p = NULL;

View File

@ -460,8 +460,8 @@ LRESULT GBTileView::OnMapInfo(WPARAM wParam, LPARAM lParam)
u8 *colors = (u8 *)lParam; u8 *colors = (u8 *)lParam;
zoom.setColors(colors); zoom.setColors(colors);
int x = (wParam & 0xFFFF)/8; int x = (int)((wParam & 0xffff)/8);
int y = ((wParam >> 16) & 0xFFFF)/8; int y = (int)(((wParam >> 16) & 0xFFFF)/8);
int tiles = 0x0000; int tiles = 0x0000;
if(charBase) if(charBase)

View File

@ -1,479 +1,402 @@
// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. // VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator.
// Copyright (C) 1999-2003 Forgotten // Copyright (C) 1999-2003 Forgotten
// Copyright (C) 2005 Forgotten and the VBA development team // Copyright (C) 2004 Forgotten and the VBA development team
// Copyright (C) 2005-2006 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 // This program is free software; you can redistribute it and/or modify
// the Free Software Foundation; either version 2, or(at your option) // it under the terms of the GNU General Public License as published by
// any later version. // 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 // This program is distributed in the hope that it will be useful,
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // but WITHOUT ANY WARRANTY; without even the implied warranty of
// GNU General Public License for more details. // 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, // You should have received a copy of the GNU General Public License
// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // along with this program; if not, write to the Free Software Foundation,
// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "stdafx.h"
#include <stdio.h> #include "stdafx.h"
#include "../System.h" #include "Display.h"
#include "../GBA.h"
#include "../Globals.h" #include "../System.h"
#include "..\gb\gbGlobals.h" #include "../GBA.h"
#include "../Text.h" #include "../Globals.h"
#include "../Util.h" #include "../Text.h"
#include "UniVideoModeDlg.h" #include "../Util.h"
#include "VBA.h" #include "VBA.h"
#include "MainWnd.h" #include "MainWnd.h"
#include "Reg.h" #include "Reg.h"
#include "..\..\res\resource.h" #include "resource.h"
#include "../gbafilter.h" #ifdef _DEBUG
#define new DEBUG_NEW
#ifdef _DEBUG #undef THIS_FILE
#define new DEBUG_NEW static char THIS_FILE[] = __FILE__;
#undef THIS_FILE #endif
static char THIS_FILE[] = __FILE__;
#endif extern void winlog(const char *,...);
extern int Init_2xSaI(u32);
extern void winlog(const char *,...); extern int systemSpeed;
extern int Init_2xSaI(u32);
extern int systemSpeed; class GDIDisplay : public IDisplay {
extern int winVideoModeSelect(CWnd *, GUID **); private:
u8 *filterData;
u8 info[sizeof(BITMAPINFOHEADER)+256*sizeof(RGBQUAD)];
class GDIDisplay : public IDisplay
{ public:
private: GDIDisplay();
u8 *filterData; virtual ~GDIDisplay();
u8 info[sizeof(BITMAPINFOHEADER)+256*sizeof(RGBQUAD)];
int SelectedFreq, SelectedAdapter; virtual bool initialize();
public: virtual void cleanup();
GDIDisplay(); virtual void render();
virtual ~GDIDisplay(); virtual void checkFullScreen();
virtual void renderMenu();
virtual bool changeRenderSize(int w, int h); virtual void clear();
virtual bool initialize(); virtual DISPLAY_TYPE getType() { return GDI; };
virtual void cleanup(); virtual void setOption(const char *, int) {}
virtual void render(); virtual bool isSkinSupported() { return true; }
virtual void checkFullScreen(); virtual int selectFullScreenMode(GUID **);
virtual void renderMenu(); };
virtual void clear();
virtual DISPLAY_TYPE getType() { return GDI; }; static int calculateShift(u32 mask)
virtual void setOption(const char *, int) {} {
virtual int selectFullScreenMode(GUID **); int m = 0;
virtual int selectFullScreenMode2();
}; while(mask) {
m++;
mask >>= 1;
static int calculateShift(u32 mask) }
{
int m = 0; return m-5;
}
while(mask) {
m++; GDIDisplay::GDIDisplay()
mask >>= 1; {
} filterData = (u8 *)malloc(4*4*256*240);
}
return m-5;
} GDIDisplay::~GDIDisplay()
{
GDIDisplay::GDIDisplay() cleanup();
{ }
filterData = NULL;
} void GDIDisplay::cleanup()
{
GDIDisplay::~GDIDisplay() if(filterData) {
{ free(filterData);
cleanup(); filterData = NULL;
} }
}
void GDIDisplay::cleanup()
{ bool GDIDisplay::initialize()
if(filterData) {
{ theApp.sizeX = 240;
delete [] filterData; theApp.sizeY = 160;
filterData = NULL; switch(theApp.videoOption) {
} case VIDEO_1X:
} theApp.surfaceSizeX = theApp.sizeX;
theApp.surfaceSizeY = theApp.sizeY;
bool GDIDisplay::initialize() break;
{ case VIDEO_2X:
switch(theApp.cartridgeType) theApp.surfaceSizeX = theApp.sizeX * 2;
{ theApp.surfaceSizeY = theApp.sizeY * 2;
case 0: break;
theApp.sizeX = 240; case VIDEO_3X:
theApp.sizeY = 160; theApp.surfaceSizeX = theApp.sizeX * 3;
break; theApp.surfaceSizeY = theApp.sizeY * 3;
case 1: break;
if(gbBorderOn) case VIDEO_4X:
{ theApp.surfaceSizeX = theApp.sizeX * 4;
theApp.sizeX = 256; theApp.surfaceSizeY = theApp.sizeY * 4;
theApp.sizeY = 224; break;
} case VIDEO_320x240:
else case VIDEO_640x480:
{ case VIDEO_800x600:
theApp.sizeX = 160; case VIDEO_OTHER:
theApp.sizeY = 144; {
} int scaleX = (theApp.fsWidth / theApp.sizeX);
break; int scaleY = (theApp.fsHeight / theApp.sizeY);
} int min = scaleX < scaleY ? scaleX : scaleY;
if(theApp.fsMaxScale)
switch(theApp.videoOption) min = min > theApp.fsMaxScale ? theApp.fsMaxScale : min;
{ theApp.surfaceSizeX = theApp.sizeX * min;
case VIDEO_1X: theApp.surfaceSizeY = theApp.sizeY * min;
theApp.surfaceSizeX = theApp.sizeX; if(theApp.fullScreenStretch) {
theApp.surfaceSizeY = theApp.sizeY; theApp.surfaceSizeX = theApp.fsWidth;
break; theApp.surfaceSizeY = theApp.fsHeight;
case VIDEO_2X: }
theApp.surfaceSizeX = theApp.sizeX * 2; }
theApp.surfaceSizeY = theApp.sizeY * 2; break;
break; }
case VIDEO_3X:
theApp.surfaceSizeX = theApp.sizeX * 3; theApp.rect.left = 0;
theApp.surfaceSizeY = theApp.sizeY * 3; theApp.rect.top = 0;
break; theApp.rect.right = theApp.sizeX;
case VIDEO_4X: theApp.rect.bottom = theApp.sizeY;
theApp.surfaceSizeX = theApp.sizeX * 4;
theApp.surfaceSizeY = theApp.sizeY * 4; theApp.dest.left = 0;
break; theApp.dest.top = 0;
case VIDEO_320x240: theApp.dest.right = theApp.surfaceSizeX;
case VIDEO_640x480: theApp.dest.bottom = theApp.surfaceSizeY;
case VIDEO_800x600:
case VIDEO_1024x768: DWORD style = WS_POPUP | WS_VISIBLE;
case VIDEO_1280x1024: DWORD styleEx = 0;
case VIDEO_OTHER:
float scaleX = ((float)theApp.fsWidth / theApp.sizeX); if(theApp.videoOption <= VIDEO_4X)
float scaleY = ((float)theApp.fsHeight / theApp.sizeY); style |= WS_OVERLAPPEDWINDOW;
float min = scaleX < scaleY ? scaleX : scaleY; else
if(theApp.fsMaxScale) styleEx = 0;
min = min > theApp.fsMaxScale ? theApp.fsMaxScale : min;
if(theApp.fullScreenStretch) if(theApp.videoOption <= VIDEO_4X)
{ AdjustWindowRectEx(&theApp.dest, style, TRUE, styleEx);
theApp.surfaceSizeX = theApp.fsWidth; else
theApp.surfaceSizeY = theApp.fsHeight; AdjustWindowRectEx(&theApp.dest, style, FALSE, styleEx);
}
else int winSizeX = theApp.dest.right-theApp.dest.left;
{ int winSizeY = theApp.dest.bottom-theApp.dest.top;
theApp.surfaceSizeX = (int)(theApp.sizeX * min);
theApp.surfaceSizeY = (int)(theApp.sizeY * min); if(theApp.videoOption > VIDEO_4X) {
} winSizeX = theApp.fsWidth;
break; winSizeY = theApp.fsHeight;
} }
theApp.rect.left = 0; int x = 0;
theApp.rect.top = 0; int y = 0;
theApp.rect.right = theApp.sizeX;
theApp.rect.bottom = theApp.sizeY; if(theApp.videoOption <= VIDEO_4X) {
x = theApp.windowPositionX;
theApp.dest.left = 0; y = theApp.windowPositionY;
theApp.dest.top = 0; }
theApp.dest.right = theApp.surfaceSizeX;
theApp.dest.bottom = theApp.surfaceSizeY; // Create a window
MainWnd *pWnd = new MainWnd;
DWORD style = WS_POPUP | WS_VISIBLE; theApp.m_pMainWnd = pWnd;
DWORD styleEx = 0;
pWnd->CreateEx(styleEx,
if(theApp.videoOption <= VIDEO_4X) theApp.wndClass,
style |= WS_OVERLAPPEDWINDOW; "VisualBoyAdvance",
else style,
styleEx = 0; x,y,winSizeX,winSizeY,
NULL,
if(theApp.videoOption <= VIDEO_4X) 0);
AdjustWindowRectEx(&theApp.dest, style, TRUE, styleEx);
else if (!(HWND)*pWnd) {
AdjustWindowRectEx(&theApp.dest, style, FALSE, styleEx); winlog("Error creating Window %08x\n", GetLastError());
return FALSE;
int winSizeX = theApp.dest.right-theApp.dest.left; }
int winSizeY = theApp.dest.bottom-theApp.dest.top;
theApp.updateMenuBar();
if(theApp.videoOption > VIDEO_4X) {
winSizeX = theApp.fsWidth; theApp.adjustDestRect();
winSizeY = theApp.fsHeight;
} theApp.mode320Available = false;
theApp.mode640Available = false;
int x = 0; theApp.mode800Available = false;
int y = 0;
HDC dc = GetDC(NULL);
if(theApp.videoOption <= VIDEO_4X) { HBITMAP hbm = CreateCompatibleBitmap(dc, 1, 1);
x = theApp.windowPositionX; BITMAPINFO *bi = (BITMAPINFO *)info;
y = theApp.windowPositionY; ZeroMemory(bi, sizeof(info));
} bi->bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
GetDIBits(dc, hbm, 0, 1, NULL, (LPBITMAPINFO)info, DIB_RGB_COLORS);
// Create a window GetDIBits(dc, hbm, 0, 1, NULL, (LPBITMAPINFO)info, DIB_RGB_COLORS);
MainWnd *pWnd = new MainWnd; DeleteObject(hbm);
theApp.m_pMainWnd = pWnd; ReleaseDC(NULL, dc);
pWnd->CreateEx(styleEx, if(bi->bmiHeader.biCompression == BI_BITFIELDS) {
theApp.wndClass, systemColorDepth = bi->bmiHeader.biBitCount;
"VisualBoyAdvance", if(systemColorDepth == 15)
style, systemColorDepth = 16;
x,y,winSizeX,winSizeY, systemRedShift = calculateShift(*((DWORD *)&bi->bmiColors[0]));
NULL, systemGreenShift = calculateShift(*((DWORD *)&bi->bmiColors[1]));
0); systemBlueShift = calculateShift(*((DWORD *)&bi->bmiColors[2]));
if(systemColorDepth == 16) {
if (!(HWND)*pWnd) { if(systemGreenShift == 6) {
winlog("Error creating Window %08x\n", GetLastError()); Init_2xSaI(565);
return FALSE; } else {
} Init_2xSaI(555);
}
theApp.updateMenuBar(); } else if(systemColorDepth == 32)
Init_2xSaI(32);
theApp.adjustDestRect(); } else {
systemColorDepth = 32;
// Enumerate available display modes systemRedShift = 19;
theApp.mode320Available = false; systemGreenShift = 11;
theApp.mode640Available = false; systemBlueShift = 3;
theApp.mode800Available = false;
theApp.mode1024Available = false; Init_2xSaI(32);
theApp.mode1280Available = false; }
DISPLAY_DEVICE dev; theApp.fsColorDepth = systemColorDepth;
dev.cb = sizeof(DISPLAY_DEVICE); if(systemColorDepth == 24)
EnumDisplayDevices(NULL, 0, &dev, 0); theApp.filterFunction = NULL;
DEVMODE mode; #ifdef MMX
for (DWORD iMode = 0; if(!theApp.disableMMX)
TRUE == EnumDisplaySettings(dev.DeviceName, iMode, &mode); cpu_mmx = theApp.detectMMX();
iMode++) else
{ cpu_mmx = 0;
if ( (mode.dmBitsPerPel == 16) && #endif
(mode.dmPelsWidth==320) && (mode.dmPelsHeight==240))
theApp.mode320Available = true; utilUpdateSystemColorMaps();
theApp.updateFilter();
if ( (mode.dmBitsPerPel == 16) && theApp.updateIFB();
(mode.dmPelsWidth==640) && (mode.dmPelsHeight==480))
theApp.mode640Available = true; pWnd->DragAcceptFiles(TRUE);
if ( (mode.dmBitsPerPel == 16) && return TRUE;
(mode.dmPelsWidth==800) && (mode.dmPelsHeight==600)) }
theApp.mode800Available = true;
void GDIDisplay::clear()
if ( (mode.dmBitsPerPel == 32) && {
(mode.dmPelsWidth==1024) && (mode.dmPelsHeight==768)) }
theApp.mode1024Available = true;
void GDIDisplay::renderMenu()
if ( (mode.dmBitsPerPel == 32) && {
(mode.dmPelsWidth==1280) && (mode.dmPelsHeight==1024)) checkFullScreen();
theApp.mode1280Available = true; theApp.m_pMainWnd->DrawMenuBar();
} }
// Go into fullscreen void GDIDisplay::checkFullScreen()
if(theApp.videoOption >= VIDEO_320x240) {
{ }
mode.dmBitsPerPel = theApp.fsColorDepth;
mode.dmPelsWidth = theApp.fsWidth; void GDIDisplay::render()
mode.dmPelsHeight = theApp.fsHeight; {
mode.dmDisplayFrequency = theApp.fsFrequency; BITMAPINFO *bi = (BITMAPINFO *)info;
mode.dmFields = DM_BITSPERPEL | DM_PELSWIDTH | DM_PELSHEIGHT | DM_DISPLAYFREQUENCY; bi->bmiHeader.biWidth = theApp.filterWidth+1;
DISPLAY_DEVICE dd; bi->bmiHeader.biHeight = -theApp.filterHeight;
dd.cb = sizeof(DISPLAY_DEVICE);
EnumDisplayDevices(NULL, theApp.fsAdapter, &dd, 0); int pitch = theApp.filterWidth * 2 + 4;
ChangeDisplaySettingsEx(dd.DeviceName, &mode, NULL, CDS_FULLSCREEN, NULL); if(systemColorDepth == 24)
} pitch = theApp.filterWidth * 3;
else // Reset from fullscreen else if(systemColorDepth == 32)
{ pitch = theApp.filterWidth * 4 + 4;
ChangeDisplaySettings(NULL, 0);
} if(theApp.filterFunction) {
bi->bmiHeader.biWidth = theApp.filterWidth * 2;
bi->bmiHeader.biHeight = -theApp.filterHeight * 2;
// Initialize 2xSaI
HDC dc = GetDC(NULL); if(systemColorDepth == 16)
HBITMAP hbm = CreateCompatibleBitmap(dc, 1, 1); (*theApp.filterFunction)(pix+pitch,
BITMAPINFO *bi = (BITMAPINFO *)info; pitch,
ZeroMemory(bi, sizeof(info)); (u8*)theApp.delta,
bi->bmiHeader.biSize = sizeof(BITMAPINFOHEADER); (u8*)filterData,
GetDIBits(dc, hbm, 0, 1, NULL, (LPBITMAPINFO)info, DIB_RGB_COLORS); theApp.filterWidth*2*2,
GetDIBits(dc, hbm, 0, 1, NULL, (LPBITMAPINFO)info, DIB_RGB_COLORS); theApp.filterWidth,
DeleteObject(hbm); theApp.filterHeight);
ReleaseDC(NULL, dc); else
(*theApp.filterFunction)(pix+pitch,
if(bi->bmiHeader.biCompression == BI_BITFIELDS) { pitch,
systemColorDepth = bi->bmiHeader.biBitCount; (u8*)theApp.delta,
if(systemColorDepth == 15) (u8*)filterData,
systemColorDepth = 16; theApp.filterWidth*4*2,
systemRedShift = calculateShift(*((DWORD *)&bi->bmiColors[0])); theApp.filterWidth,
systemGreenShift = calculateShift(*((DWORD *)&bi->bmiColors[1])); theApp.filterHeight);
systemBlueShift = calculateShift(*((DWORD *)&bi->bmiColors[2])); }
if(systemColorDepth == 16) {
if(systemGreenShift == 6) { if(theApp.showSpeed && (theApp.videoOption > VIDEO_4X || theApp.skin != NULL)) {
Init_2xSaI(565); char buffer[30];
} else { if(theApp.showSpeed == 1)
Init_2xSaI(555); sprintf(buffer, "%3d%%", systemSpeed);
} else
} else if(systemColorDepth == 32) sprintf(buffer, "%3d%%(%d, %d fps)", systemSpeed,
Init_2xSaI(32); systemFrameSkip,
} else { theApp.showRenderedFrames);
systemColorDepth = 32;
systemRedShift = 19; if(theApp.filterFunction) {
systemGreenShift = 11; int p = theApp.filterWidth * 4;
systemBlueShift = 3; if(systemColorDepth == 24)
p = theApp.filterWidth * 6;
Init_2xSaI(32); else if(systemColorDepth == 32)
} p = theApp.filterWidth * 8;
if(theApp.showSpeedTransparent)
drawTextTransp((u8*)filterData,
// Setup system color depth p,
theApp.fsColorDepth = systemColorDepth; 10,
if(systemColorDepth == 24) theApp.filterHeight*2-10,
theApp.filterFunction = NULL; buffer);
#ifdef MMX else
if(!theApp.disableMMX) drawText((u8*)filterData,
cpu_mmx = theApp.detectMMX(); p,
else 10,
cpu_mmx = 0; theApp.filterHeight*2-10,
#endif buffer);
} else {
utilUpdateSystemColorMaps(theApp.filterLCD ); if(theApp.showSpeedTransparent)
theApp.updateFilter(); drawTextTransp((u8*)pix,
theApp.updateIFB(); pitch,
10,
pWnd->DragAcceptFiles(TRUE); theApp.filterHeight-10,
buffer);
return TRUE; else
} drawText((u8*)pix,
pitch,
10,
void GDIDisplay::clear() theApp.filterHeight-10,
{ buffer);
CDC *dc = theApp.m_pMainWnd->GetDC(); }
CBrush brush(RGB(0x00, 0x00, 0x00)); }
dc->FillRect(CRect(0, 0, theApp.fsWidth, theApp.fsHeight), &brush);
theApp.m_pMainWnd->ReleaseDC(dc); POINT p;
} p.x = theApp.dest.left;
p.y = theApp.dest.top;
void GDIDisplay::renderMenu() CWnd *pWnd = theApp.m_pMainWnd;
{ pWnd->ScreenToClient(&p);
checkFullScreen(); POINT p2;
theApp.m_pMainWnd->DrawMenuBar(); p2.x = theApp.dest.right;
} p2.y = theApp.dest.bottom;
pWnd->ScreenToClient(&p2);
void GDIDisplay::checkFullScreen()
{ CDC *dc = pWnd->GetDC();
}
StretchDIBits((HDC)*dc,
void GDIDisplay::render() p.x,
{ p.y,
unsigned int pitch = theApp.filterWidth * (systemColorDepth / 8) + 4; p2.x - p.x,
p2.y - p.y,
BITMAPINFO *bi = (BITMAPINFO *)info; 0,
bi->bmiHeader.biWidth = theApp.filterWidth + 1; 0,
bi->bmiHeader.biHeight = -theApp.filterHeight; theApp.rect.right,
theApp.rect.bottom,
if(theApp.filterFunction) theApp.filterFunction ? filterData : pix+pitch,
{ bi,
bi->bmiHeader.biWidth = theApp.rect.right; DIB_RGB_COLORS,
bi->bmiHeader.biHeight = -(int)theApp.rect.bottom; SRCCOPY);
(*theApp.filterFunction)( if(theApp.screenMessage) {
pix + pitch, if(((GetTickCount() - theApp.screenMessageTime) < 3000) &&
pitch, !theApp.disableStatusMessage) {
(u8*)theApp.delta, dc->SetTextColor(RGB(255,0,0));
(u8*)filterData, dc->SetBkMode(TRANSPARENT);
theApp.rect.right * (systemColorDepth / 8), dc->TextOut(p.x+10, p2.y - 20, theApp.screenMessageBuffer);
theApp.filterWidth, } else {
theApp.filterHeight); theApp.screenMessage = false;
} }
}
POINT p1, p2;
p1.x = theApp.dest.left; pWnd->ReleaseDC(dc);
p1.y = theApp.dest.top; }
p2.x = theApp.dest.right;
p2.y = theApp.dest.bottom; int GDIDisplay::selectFullScreenMode(GUID **)
theApp.m_pMainWnd->ScreenToClient(&p1); {
theApp.m_pMainWnd->ScreenToClient(&p2); HWND wnd = GetDesktopWindow();
RECT r;
CDC *dc = theApp.m_pMainWnd->GetDC(); GetWindowRect(wnd, &r);
int w = (r.right - r.left) & 4095;
// Draw bitmap to device int h = (r.bottom - r.top) & 4095;
StretchDIBits( HDC dc = GetDC(wnd);
dc->GetSafeHdc(), int c = GetDeviceCaps(dc, BITSPIXEL);
p1.x, p1.y, ReleaseDC(wnd, dc);
p2.x - p1.x,
p2.y - p1.y, return (c << 24) | (w << 12) | h;
theApp.rect.left, theApp.rect.top, }
theApp.rect.right - theApp.rect.left,
theApp.rect.bottom - theApp.rect.top, IDisplay *newGDIDisplay()
theApp.filterFunction ? filterData : pix + pitch, {
bi, return new GDIDisplay();
DIB_RGB_COLORS, }
SRCCOPY);
// Draw frame counter
if (theApp.showSpeed && (theApp.videoOption >= VIDEO_320x240))
{
CString speedText;
if (theApp.showSpeed == 1)
speedText.AppendFormat("%3d%%", systemSpeed);
else
speedText.AppendFormat("%3d%%(%d, %d fps)",
systemSpeed, systemFrameSkip, theApp.showRenderedFrames);
dc->SetTextColor(RGB(0xFF, 0x3F, 0x3F));
if (theApp.showSpeedTransparent)
dc->SetBkMode(TRANSPARENT);
else
dc->SetBkMode(OPAQUE);
dc->SetBkColor(RGB(0xFF, 0xFF, 0xFF));
dc->TextOut(p1.x + 16, p1.y + 16, speedText);
}
// Draw screen message
if (theApp.screenMessage)
{
if ( ((GetTickCount() - theApp.screenMessageTime) < 3000) && !theApp.disableStatusMessage )
{
dc->SetTextColor(RGB(0x3F, 0x3F, 0xFF));
if (theApp.showSpeedTransparent)
dc->SetBkMode(TRANSPARENT);
else
dc->SetBkMode(OPAQUE);
dc->SetBkColor(RGB(0xFF, 0xFF, 0xFF));
dc->TextOut(p1.x + 16, p2.y - 16, theApp.screenMessageBuffer);
}
else
theApp.screenMessage = false;
}
theApp.m_pMainWnd->ReleaseDC(dc);
}
int GDIDisplay::selectFullScreenMode(GUID **pGUID)
{
int w, h, b;
UniVideoModeDlg dlg(0, &w, &h, &b, &SelectedFreq, &SelectedAdapter);
if (0 == dlg.DoModal())
{
return (b<<24) + (w<<12) + h;
// Bits<<24 | Width<<12 | Height
}
else
{
return -1;
}
}
int GDIDisplay::selectFullScreenMode2()
{
return (SelectedAdapter<<16) + SelectedFreq;
}
bool GDIDisplay::changeRenderSize(int w, int h)
{
if (filterData)
{
delete [] filterData;
filterData = NULL;
}
filterData = new u8[w*h*(systemColorDepth>>3)];
return true;
}
IDisplay *newGDIDisplay()
{
return new GDIDisplay();
}

View File

@ -1,202 +1,239 @@
// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. // VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator.
// Copyright (C) 1999-2003 Forgotten // Copyright (C) 1999-2003 Forgotten
// Copyright (C) 2004 Forgotten and the VBA development team // Copyright (C) 2005 Forgotten and the VBA development team
// This program is free software; you can redistribute it and/or modify // 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 // it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2, or(at your option) // the Free Software Foundation; either version 2, or(at your option)
// any later version. // any later version.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details. // GNU General Public License for more details.
// //
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software Foundation, // along with this program; if not, write to the Free Software Foundation,
// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
// IOViewer.cpp : implementation file // IOViewer.cpp : implementation file
// //
#include "stdafx.h" #include "stdafx.h"
#include "vba.h" #include "vba.h"
#include "IOViewer.h" #include "IOViewer.h"
#include "../System.h" #include "../System.h"
#include "../GBA.h" #include "../GBA.h"
#include "../Globals.h" #include "../Globals.h"
#include "../Sound.h"
#include "IOViewerRegs.h"
#include "IOViewerRegs.h"
#ifdef _DEBUG
#ifdef _DEBUG #define new DEBUG_NEW
#define new DEBUG_NEW #undef THIS_FILE
#undef THIS_FILE static char THIS_FILE[] = __FILE__;
static char THIS_FILE[] = __FILE__; #endif
#endif
/////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////// // IOViewer dialog
// IOViewer dialog
IOViewer::IOViewer(CWnd* pParent /*=NULL*/)
IOViewer::IOViewer(CWnd* pParent /*=NULL*/) : ResizeDlg(IOViewer::IDD, pParent)
: ResizeDlg(IOViewer::IDD, pParent) {
{ //{{AFX_DATA_INIT(IOViewer)
//{{AFX_DATA_INIT(IOViewer) // NOTE: the ClassWizard will add member initialization here
// NOTE: the ClassWizard will add member initialization here //}}AFX_DATA_INIT
//}}AFX_DATA_INIT selected = 0;
selected = 0; autoUpdate = false;
autoUpdate = false; }
}
void IOViewer::DoDataExchange(CDataExchange* pDX)
void IOViewer::DoDataExchange(CDataExchange* pDX) {
{ CDialog::DoDataExchange(pDX);
CDialog::DoDataExchange(pDX); //{{AFX_DATA_MAP(IOViewer)
//{{AFX_DATA_MAP(IOViewer) DDX_Control(pDX, IDC_VALUE, m_value);
DDX_Control(pDX, IDC_VALUE, m_value); DDX_Control(pDX, IDC_ADDRESSES, m_address);
DDX_Control(pDX, IDC_ADDRESSES, m_address); //}}AFX_DATA_MAP
//}}AFX_DATA_MAP }
}
BEGIN_MESSAGE_MAP(IOViewer, CDialog)
BEGIN_MESSAGE_MAP(IOViewer, CDialog) //{{AFX_MSG_MAP(IOViewer)
//{{AFX_MSG_MAP(IOViewer) ON_BN_CLICKED(IDC_CLOSE, OnClose)
ON_BN_CLICKED(IDC_CLOSE, OnClose) ON_BN_CLICKED(IDC_REFRESH, OnRefresh)
ON_BN_CLICKED(IDC_REFRESH, OnRefresh) ON_BN_CLICKED(IDC_AUTO_UPDATE, OnAutoUpdate)
ON_BN_CLICKED(IDC_AUTO_UPDATE, OnAutoUpdate) ON_CBN_SELCHANGE(IDC_ADDRESSES, OnSelchangeAddresses)
ON_CBN_SELCHANGE(IDC_ADDRESSES, OnSelchangeAddresses) ON_BN_CLICKED(IDC_APPLY, OnApply)
ON_BN_CLICKED(IDC_APPLY, OnApply) ON_BN_CLICKED(IDC_BIT_0, bitChange)
//}}AFX_MSG_MAP ON_BN_CLICKED(IDC_BIT_1, bitChange)
END_MESSAGE_MAP() ON_BN_CLICKED(IDC_BIT_2, bitChange)
ON_BN_CLICKED(IDC_BIT_3, bitChange)
///////////////////////////////////////////////////////////////////////////// ON_BN_CLICKED(IDC_BIT_4, bitChange)
// IOViewer message handlers ON_BN_CLICKED(IDC_BIT_5, bitChange)
ON_BN_CLICKED(IDC_BIT_6, bitChange)
void IOViewer::OnClose() ON_BN_CLICKED(IDC_BIT_7, bitChange)
{ ON_BN_CLICKED(IDC_BIT_8, bitChange)
theApp.winRemoveUpdateListener(this); ON_BN_CLICKED(IDC_BIT_9, bitChange)
ON_BN_CLICKED(IDC_BIT_10, bitChange)
DestroyWindow(); ON_BN_CLICKED(IDC_BIT_11, bitChange)
} ON_BN_CLICKED(IDC_BIT_12, bitChange)
ON_BN_CLICKED(IDC_BIT_13, bitChange)
void IOViewer::OnRefresh() ON_BN_CLICKED(IDC_BIT_14, bitChange)
{ ON_BN_CLICKED(IDC_BIT_15, bitChange)
// TODO: Add your control notification handler code here //}}AFX_MSG_MAP
END_MESSAGE_MAP()
}
/////////////////////////////////////////////////////////////////////////////
void IOViewer::OnAutoUpdate() // IOViewer message handlers
{
autoUpdate = !autoUpdate; void IOViewer::OnClose()
if(autoUpdate) { {
theApp.winAddUpdateListener(this); theApp.winRemoveUpdateListener(this);
} else {
theApp.winRemoveUpdateListener(this); DestroyWindow();
} }
}
void IOViewer::bitChange()
void IOViewer::OnSelchangeAddresses() {
{ CString buffer;
selected = m_address.GetCurSel(); u16 data = 0;
update(); for(int i = 0; i < 16; i++) {
} CButton *pWnd = (CButton *)GetDlgItem(IDC_BIT_0 + i);
void IOViewer::PostNcDestroy() if(pWnd) {
{ if(pWnd->GetCheck())
delete this; data |= (1 << i);
} }
}
BOOL IOViewer::OnInitDialog()
{ buffer.Format("%04X", data);
CDialog::OnInitDialog(); m_value.SetWindowText(buffer);
}
// winCenterWindow(getHandle());
DIALOG_SIZER_START( sz ) void IOViewer::OnRefresh()
DIALOG_SIZER_END() {
SetData(sz, // TODO: Add your control notification handler code here
TRUE,
HKEY_CURRENT_USER, update();
"Software\\Emulators\\VisualBoyAdvance\\Viewer\\IOView", }
NULL);
void IOViewer::OnAutoUpdate()
CFont *font = CFont::FromHandle((HFONT)GetStockObject(SYSTEM_FIXED_FONT)); {
int i; autoUpdate = !autoUpdate;
for(i = 0; i < sizeof(ioViewRegisters)/sizeof(IOData); i++) { if(autoUpdate) {
m_address.AddString(ioViewRegisters[i].name); theApp.winAddUpdateListener(this);
} } else {
m_address.SetFont(font); theApp.winRemoveUpdateListener(this);
for(i = 0; i < 16; i++) { }
GetDlgItem(IDC_BIT_0+i)->SetFont(font); }
}
void IOViewer::OnSelchangeAddresses()
RECT cbSize; {
int Height; selected = m_address.GetCurSel();
m_address.GetClientRect(&cbSize); update();
Height = m_address.GetItemHeight(0); }
Height += m_address.GetItemHeight(0) * (10);
void IOViewer::PostNcDestroy()
// Note: The use of SM_CYEDGE assumes that we're using Windows '95 {
// Now add on the height of the border of the edit box delete this;
Height += GetSystemMetrics(SM_CYEDGE) * 2; // top & bottom edges }
// The height of the border of the drop-down box BOOL IOViewer::OnInitDialog()
Height += GetSystemMetrics(SM_CYEDGE) * 2; // top & bottom edges {
CDialog::OnInitDialog();
// now set the size of the window
m_address.SetWindowPos(NULL, // winCenterWindow(getHandle());
0, 0, DIALOG_SIZER_START( sz )
cbSize.right, Height, DIALOG_SIZER_END()
SWP_NOMOVE | SWP_NOZORDER); SetData(sz,
TRUE,
m_address.SetCurSel(0); HKEY_CURRENT_USER,
update(); "Software\\Emulators\\VisualBoyAdvance\\Viewer\\IOView",
NULL);
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE CFont *font = CFont::FromHandle((HFONT)GetStockObject(SYSTEM_FIXED_FONT));
} int i;
for(i = 0; i < sizeof(ioViewRegisters)/sizeof(IOData); i++) {
void IOViewer::update() m_address.AddString(ioViewRegisters[i].name);
{ }
CString buffer; m_address.SetFont(font);
for(i = 0; i < 16; i++) {
const IOData *sel = &ioViewRegisters[selected]; GetDlgItem(IDC_BIT_0+i)->SetFont(font);
u16 data = sel->address ? *sel->address : }
(ioMem ? soundRead16(sel->offset) : 0);
RECT cbSize;
for(int i = 0; i < 16; i++) { int Height;
CButton *pWnd = (CButton *)GetDlgItem(IDC_BIT_0 + i);
m_address.GetClientRect(&cbSize);
if(pWnd) { Height = m_address.GetItemHeight(0);
if(!(sel->write & (1 << i))) Height += m_address.GetItemHeight(0) * (10);
pWnd->EnableWindow(FALSE);
else // Note: The use of SM_CYEDGE assumes that we're using Windows '95
pWnd->EnableWindow(TRUE); // Now add on the height of the border of the edit box
pWnd->SetCheck(((data & (1 << i)) >> i)); Height += GetSystemMetrics(SM_CYEDGE) * 2; // top & bottom edges
buffer.Format("%2d %s", i, sel->bits[i]);
pWnd->SetWindowText(buffer); // The height of the border of the drop-down box
} Height += GetSystemMetrics(SM_CYEDGE) * 2; // top & bottom edges
}
// now set the size of the window
buffer.Format("%04X", data); m_address.SetWindowPos(NULL,
m_value.SetWindowText(buffer); 0, 0,
} cbSize.right, Height,
SWP_NOMOVE | SWP_NOZORDER);
void IOViewer::OnApply()
{ m_address.SetCurSel(0);
const IOData *sel = &ioViewRegisters[selected]; update();
u16 res = 0;
for(int i = 0; i < 16; i++) { return TRUE; // return TRUE unless you set the focus to a control
CButton *pWnd = (CButton *)GetDlgItem(IDC_BIT_0 + i); // EXCEPTION: OCX Property Pages should return FALSE
}
if(pWnd) {
if(pWnd->GetCheck()) void IOViewer::update()
res |= (1 << i); {
} CString buffer;
}
CPUWriteHalfWord(0x4000000+sel->offset, res); const IOData *sel = &ioViewRegisters[selected];
update(); u16 data = sel->address ? *sel->address :
} (ioMem ? *((u16 *)&ioMem[sel->offset]) : 0);
for(int i = 0; i < 16; i++) {
CButton *pWnd = (CButton *)GetDlgItem(IDC_BIT_0 + i);
if(pWnd) {
if(!(sel->write & (1 << i)))
pWnd->EnableWindow(FALSE);
else
pWnd->EnableWindow(TRUE);
pWnd->SetCheck(((data & (1 << i)) >> i));
buffer.Format("%2d %s", i, sel->bits[i]);
pWnd->SetWindowText(buffer);
}
}
buffer.Format("%04X", data);
m_value.SetWindowText(buffer);
}
void IOViewer::OnApply()
{
if(rom != NULL)
{
const IOData *sel = &ioViewRegisters[selected];
u16 res = 0;
for(int i = 0; i < 16; i++) {
CButton *pWnd = (CButton *)GetDlgItem(IDC_BIT_0 + i);
if(pWnd) {
if(pWnd->GetCheck())
res |= (1 << i);
}
}
CPUWriteHalfWord(0x4000000+sel->offset, res);
update();
}
}

View File

@ -1,7 +1,7 @@
// -*- C++ -*- // -*- C++ -*-
// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. // VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator.
// Copyright (C) 1999-2003 Forgotten // Copyright (C) 1999-2003 Forgotten
// Copyright (C) 2004 Forgotten and the VBA development team // Copyright (C) 2005 Forgotten and the VBA development team
// This program is free software; you can redistribute it and/or modify // 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 // it under the terms of the GNU General Public License as published by
@ -37,6 +37,7 @@ class IOViewer : public ResizeDlg, IUpdateListener
// Construction // Construction
public: public:
void update(); void update();
void bitChange();
bool autoUpdate; bool autoUpdate;
int selected; int selected;
IOViewer(CWnd* pParent = NULL); // standard constructor IOViewer(CWnd* pParent = NULL); // standard constructor

View File

@ -1,7 +1,7 @@
// -*- C++ -*- // -*- C++ -*-
// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. // VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator.
// Copyright (C) 1999-2003 Forgotten // Copyright (C) 1999-2003 Forgotten
// Copyright (C) 2004 Forgotten and the VBA development team // Copyright (C) 2005 Forgotten and the VBA development team
// This program is free software; you can redistribute it and/or modify // 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 // it under the terms of the GNU General Public License as published by
@ -258,7 +258,7 @@ const IOData ioViewRegisters[] = {
} }
}, },
{ {
&BG2HOFS, 0x18, "0x4000018-BG8HOFS", 0x01FF, &BG2HOFS, 0x18, "0x4000018-BG2HOFS", 0x01FF,
{ {
"", "",
"", "",
@ -1119,7 +1119,7 @@ const IOData ioViewRegisters[] = {
} }
}, },
{ {
NULL, 0x82, "0x4000082-SGCNT0_H", 0xFF1F, NULL, 0x82, "0x4000082-SGCNT0_H", 0xFF0F,
{ {
"", "",
"Sound 1-4 Volume (2 bits)", "Sound 1-4 Volume (2 bits)",

View File

@ -22,10 +22,6 @@
#include "../System.h" #include "../System.h"
#define JOYCONFIG_MESSAGE (WM_USER + 1000) #define JOYCONFIG_MESSAGE (WM_USER + 1000)
typedef CList<int,int> KeyList;
//typedef CList<USHORT,USHORT> KeyList;
#define JOYPADS 4 #define JOYPADS 4
#define MOTION_KEYS 4 #define MOTION_KEYS 4
#define KEYS_PER_PAD 13 #define KEYS_PER_PAD 13
@ -35,6 +31,8 @@ typedef CList<int,int> KeyList;
#define DEVICEOF(key) (key >> 8) #define DEVICEOF(key) (key >> 8)
#define KEYOF(key) (key & 255) #define KEYOF(key) (key & 255)
typedef CList<LONG_PTR,LONG_PTR> KeyList;
enum { enum {
KEY_LEFT, KEY_RIGHT, KEY_LEFT, KEY_RIGHT,
KEY_UP, KEY_DOWN, KEY_UP, KEY_DOWN,
@ -46,6 +44,7 @@ enum {
}; };
class Input { class Input {
public: public:
KeyList joypaddata[JOYPADS * KEYS_PER_PAD + MOTION_KEYS]; KeyList joypaddata[JOYPADS * KEYS_PER_PAD + MOTION_KEYS];
@ -56,7 +55,7 @@ class Input {
virtual bool readDevices() = 0; virtual bool readDevices() = 0;
virtual u32 readDevice(int which) = 0; virtual u32 readDevice(int which) = 0;
virtual CString getKeyName(int key) = 0; virtual CString getKeyName(LONG_PTR key) = 0;
virtual void checkKeys() = 0; virtual void checkKeys() = 0;
virtual void checkMotionKeys() = 0; virtual void checkMotionKeys() = 0;
virtual void checkDevices() = 0; virtual void checkDevices() = 0;
@ -65,6 +64,4 @@ class Input {
virtual void saveSettings() = 0; virtual void saveSettings() = 0;
}; };
#define joypad theApp.input->joypaddata
#endif #endif

View File

@ -43,25 +43,25 @@ void AssignKey(KeyList &Key, int Out)
CString GetKeyListName(KeyList& Keys) CString GetKeyListName(KeyList& Keys)
{ {
CString txtKeys; CString txtKeys;
POSITION p = Keys.GetHeadPosition(); POSITION p = Keys.GetHeadPosition();
while(p!=NULL) while(p!=NULL)
{ {
txtKeys+=theApp.input->getKeyName(Keys.GetNext(p)); txtKeys+=theApp.input->getKeyName(Keys.GetNext(p));
if (p!=NULL) if (p!=NULL)
txtKeys+=", "; txtKeys+=", ";
} }
return txtKeys; return txtKeys;
} }
void CopyKeys(KeyList &Out, KeyList &In) void CopyKeys(KeyList &Out, KeyList &In)
{ {
Out.RemoveAll(); Out.RemoveAll();
POSITION p = In.GetHeadPosition(); POSITION p = In.GetHeadPosition();
while(p!=NULL) while(p!=NULL)
Out.AddTail(In.GetNext(p)); Out.AddTail(In.GetNext(p));
} }
#define AssignKeys(in, out) CopyKeys(out, in); #define AssignKeys(in, out) CopyKeys(out, in);
@ -100,6 +100,7 @@ LRESULT JoypadEditControl::OnJoyConfig(WPARAM wParam, LPARAM lParam)
return TRUE; return TRUE;
} }
BOOL JoypadEditControl::PreTranslateMessage(MSG *pMsg) BOOL JoypadEditControl::PreTranslateMessage(MSG *pMsg)
{ {
if(pMsg->message == WM_KEYDOWN && (pMsg->wParam == VK_ESCAPE || pMsg->wParam == VK_RETURN)) if(pMsg->message == WM_KEYDOWN && (pMsg->wParam == VK_ESCAPE || pMsg->wParam == VK_RETURN))
@ -125,35 +126,33 @@ JoypadConfig::JoypadConfig(int w, CWnd* pParent /*=NULL*/)
void JoypadConfig::DoDataExchange(CDataExchange* pDX) void JoypadConfig::DoDataExchange(CDataExchange* pDX)
{ {
CDialog::DoDataExchange(pDX); CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(JoypadConfig) //{{AFX_DATA_MAP(JoypadConfig)
DDX_Control(pDX, IDC_EDIT_UP, up); DDX_Control(pDX, IDC_EDIT_UP, up);
DDX_Control(pDX, IDC_EDIT_SPEED, speed); DDX_Control(pDX, IDC_EDIT_SPEED, speed);
DDX_Control(pDX, IDC_EDIT_RIGHT, right); DDX_Control(pDX, IDC_EDIT_RIGHT, right);
DDX_Control(pDX, IDC_EDIT_LEFT, left); DDX_Control(pDX, IDC_EDIT_LEFT, left);
DDX_Control(pDX, IDC_EDIT_DOWN, down); DDX_Control(pDX, IDC_EDIT_DOWN, down);
DDX_Control(pDX, IDC_EDIT_CAPTURE, capture); DDX_Control(pDX, IDC_EDIT_CAPTURE, capture);
DDX_Control(pDX, IDC_EDIT_BUTTON_START, buttonStart); DDX_Control(pDX, IDC_EDIT_BUTTON_START, buttonStart);
DDX_Control(pDX, IDC_EDIT_BUTTON_SELECT, buttonSelect); DDX_Control(pDX, IDC_EDIT_BUTTON_SELECT, buttonSelect);
DDX_Control(pDX, IDC_EDIT_BUTTON_R, buttonR); DDX_Control(pDX, IDC_EDIT_BUTTON_R, buttonR);
DDX_Control(pDX, IDC_EDIT_BUTTON_L, buttonL); DDX_Control(pDX, IDC_EDIT_BUTTON_L, buttonL);
DDX_Control(pDX, IDC_EDIT_BUTTON_GS, buttonGS); DDX_Control(pDX, IDC_EDIT_BUTTON_GS, buttonGS);
DDX_Control(pDX, IDC_EDIT_BUTTON_B, buttonB); DDX_Control(pDX, IDC_EDIT_BUTTON_B, buttonB);
DDX_Control(pDX, IDC_EDIT_BUTTON_A, buttonA); DDX_Control(pDX, IDC_EDIT_BUTTON_A, buttonA);
//}}AFX_DATA_MAP //}}AFX_DATA_MAP
} }
BEGIN_MESSAGE_MAP(JoypadConfig, CDialog) BEGIN_MESSAGE_MAP(JoypadConfig, CDialog)
//{{AFX_MSG_MAP(JoypadConfig)
ON_BN_CLICKED(ID_CANCEL, OnCancel) ON_BN_CLICKED(ID_CANCEL, OnCancel)
ON_BN_CLICKED(ID_OK, OnOk) ON_BN_CLICKED(ID_OK, OnOk)
ON_WM_CHAR() ON_WM_CHAR()
ON_WM_DESTROY() ON_WM_DESTROY()
ON_WM_TIMER() ON_WM_TIMER()
ON_WM_KEYDOWN() ON_WM_KEYDOWN()
//}}AFX_MSG_MAP ON_BN_CLICKED(IDC_APPENDMODE, &JoypadConfig::OnBnClickedAppendmode)
ON_BN_CLICKED(IDC_APPENDMODE, &JoypadConfig::OnBnClickedAppendmode)
END_MESSAGE_MAP() END_MESSAGE_MAP()
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
@ -166,19 +165,19 @@ void JoypadConfig::OnCancel()
void JoypadConfig::OnOk() void JoypadConfig::OnOk()
{ {
AssignKeys(up.m_Keys,joypad[JOYPAD(which,KEY_UP)]); AssignKeys(up.m_Keys,theApp.input->joypaddata[JOYPAD(which,KEY_UP)]);
AssignKeys(speed.m_Keys,joypad[JOYPAD(which,KEY_BUTTON_SPEED)]); AssignKeys(speed.m_Keys,theApp.input->joypaddata[JOYPAD(which,KEY_BUTTON_SPEED)]);
AssignKeys(right.m_Keys,joypad[JOYPAD(which,KEY_RIGHT)]); AssignKeys(right.m_Keys,theApp.input->joypaddata[JOYPAD(which,KEY_RIGHT)]);
AssignKeys(left.m_Keys,joypad[JOYPAD(which,KEY_LEFT)]); AssignKeys(left.m_Keys,theApp.input->joypaddata[JOYPAD(which,KEY_LEFT)]);
AssignKeys(down.m_Keys,joypad[JOYPAD(which,KEY_DOWN)]); AssignKeys(down.m_Keys,theApp.input->joypaddata[JOYPAD(which,KEY_DOWN)]);
AssignKeys(capture.m_Keys,joypad[JOYPAD(which,KEY_BUTTON_CAPTURE)]); AssignKeys(capture.m_Keys,theApp.input->joypaddata[JOYPAD(which,KEY_BUTTON_CAPTURE)]);
AssignKeys(buttonStart.m_Keys,joypad[JOYPAD(which,KEY_BUTTON_START)]); AssignKeys(buttonStart.m_Keys,theApp.input->joypaddata[JOYPAD(which,KEY_BUTTON_START)]);
AssignKeys(buttonSelect.m_Keys,joypad[JOYPAD(which,KEY_BUTTON_SELECT)]); AssignKeys(buttonSelect.m_Keys,theApp.input->joypaddata[JOYPAD(which,KEY_BUTTON_SELECT)]);
AssignKeys(buttonR.m_Keys,joypad[JOYPAD(which,KEY_BUTTON_R)]); AssignKeys(buttonR.m_Keys,theApp.input->joypaddata[JOYPAD(which,KEY_BUTTON_R)]);
AssignKeys(buttonL.m_Keys,joypad[JOYPAD(which,KEY_BUTTON_L)]); AssignKeys(buttonL.m_Keys,theApp.input->joypaddata[JOYPAD(which,KEY_BUTTON_L)]);
AssignKeys(buttonGS.m_Keys,joypad[JOYPAD(which,KEY_BUTTON_GS)]); AssignKeys(buttonGS.m_Keys,theApp.input->joypaddata[JOYPAD(which,KEY_BUTTON_GS)]);
AssignKeys(buttonB.m_Keys,joypad[JOYPAD(which,KEY_BUTTON_B)]); AssignKeys(buttonB.m_Keys,theApp.input->joypaddata[JOYPAD(which,KEY_BUTTON_B)]);
AssignKeys(buttonA.m_Keys,joypad[JOYPAD(which,KEY_BUTTON_A)]); AssignKeys(buttonA.m_Keys,theApp.input->joypaddata[JOYPAD(which,KEY_BUTTON_A)]);
theApp.input->checkKeys(); theApp.input->checkKeys();
EndDialog(TRUE); EndDialog(TRUE);
@ -195,7 +194,7 @@ void JoypadConfig::OnDestroy()
KillTimer(timerId); KillTimer(timerId);
} }
void JoypadConfig::OnTimer(UINT nIDEvent) void JoypadConfig::OnTimer(UINT_PTR nIDEvent)
{ {
theApp.input->checkDevices(); theApp.input->checkDevices();
@ -212,35 +211,35 @@ BOOL JoypadConfig::OnInitDialog()
bAppendMode = FALSE; bAppendMode = FALSE;
timerId = SetTimer(0,200,NULL); timerId = SetTimer(0,50,NULL);
CopyKeys(up.m_Keys,joypad[JOYPAD(which,KEY_UP)]); CopyKeys(up.m_Keys,theApp.input->joypaddata[JOYPAD(which,KEY_UP)]);
CopyKeys(speed.m_Keys,joypad[JOYPAD(which,KEY_BUTTON_SPEED)]); CopyKeys(speed.m_Keys,theApp.input->joypaddata[JOYPAD(which,KEY_BUTTON_SPEED)]);
CopyKeys(right.m_Keys,joypad[JOYPAD(which,KEY_RIGHT)]); CopyKeys(right.m_Keys,theApp.input->joypaddata[JOYPAD(which,KEY_RIGHT)]);
CopyKeys(left.m_Keys,joypad[JOYPAD(which,KEY_LEFT)]); CopyKeys(left.m_Keys,theApp.input->joypaddata[JOYPAD(which,KEY_LEFT)]);
CopyKeys(down.m_Keys,joypad[JOYPAD(which,KEY_DOWN)]); CopyKeys(down.m_Keys,theApp.input->joypaddata[JOYPAD(which,KEY_DOWN)]);
CopyKeys(capture.m_Keys,joypad[JOYPAD(which,KEY_BUTTON_CAPTURE)]); CopyKeys(capture.m_Keys,theApp.input->joypaddata[JOYPAD(which,KEY_BUTTON_CAPTURE)]);
CopyKeys(buttonStart.m_Keys,joypad[JOYPAD(which,KEY_BUTTON_START)]); CopyKeys(buttonStart.m_Keys,theApp.input->joypaddata[JOYPAD(which,KEY_BUTTON_START)]);
CopyKeys(buttonSelect.m_Keys,joypad[JOYPAD(which,KEY_BUTTON_SELECT)]); CopyKeys(buttonSelect.m_Keys,theApp.input->joypaddata[JOYPAD(which,KEY_BUTTON_SELECT)]);
CopyKeys(buttonR.m_Keys,joypad[JOYPAD(which,KEY_BUTTON_R)]); CopyKeys(buttonR.m_Keys,theApp.input->joypaddata[JOYPAD(which,KEY_BUTTON_R)]);
CopyKeys(buttonL.m_Keys,joypad[JOYPAD(which,KEY_BUTTON_L)]); CopyKeys(buttonL.m_Keys,theApp.input->joypaddata[JOYPAD(which,KEY_BUTTON_L)]);
CopyKeys(buttonGS.m_Keys,joypad[JOYPAD(which,KEY_BUTTON_GS)]); CopyKeys(buttonGS.m_Keys,theApp.input->joypaddata[JOYPAD(which,KEY_BUTTON_GS)]);
CopyKeys(buttonB.m_Keys,joypad[JOYPAD(which,KEY_BUTTON_B)]); CopyKeys(buttonB.m_Keys,theApp.input->joypaddata[JOYPAD(which,KEY_BUTTON_B)]);
CopyKeys(buttonA.m_Keys,joypad[JOYPAD(which,KEY_BUTTON_A)]); CopyKeys(buttonA.m_Keys,theApp.input->joypaddata[JOYPAD(which,KEY_BUTTON_A)]);
up.SetWindowText(GetKeyListName(joypad[JOYPAD(which,KEY_UP)])); up.SetWindowText(GetKeyListName(theApp.input->joypaddata[JOYPAD(which,KEY_UP)]));
down.SetWindowText(GetKeyListName(joypad[JOYPAD(which,KEY_DOWN)])); down.SetWindowText(GetKeyListName(theApp.input->joypaddata[JOYPAD(which,KEY_DOWN)]));
left.SetWindowText(GetKeyListName(joypad[JOYPAD(which,KEY_LEFT)])); left.SetWindowText(GetKeyListName(theApp.input->joypaddata[JOYPAD(which,KEY_LEFT)]));
right.SetWindowText(GetKeyListName(joypad[JOYPAD(which,KEY_RIGHT)])); right.SetWindowText(GetKeyListName(theApp.input->joypaddata[JOYPAD(which,KEY_RIGHT)]));
buttonA.SetWindowText(GetKeyListName(joypad[JOYPAD(which,KEY_BUTTON_A)])); buttonA.SetWindowText(GetKeyListName(theApp.input->joypaddata[JOYPAD(which,KEY_BUTTON_A)]));
buttonB.SetWindowText(GetKeyListName(joypad[JOYPAD(which,KEY_BUTTON_B)])); buttonB.SetWindowText(GetKeyListName(theApp.input->joypaddata[JOYPAD(which,KEY_BUTTON_B)]));
buttonL.SetWindowText(GetKeyListName(joypad[JOYPAD(which,KEY_BUTTON_L)])); buttonL.SetWindowText(GetKeyListName(theApp.input->joypaddata[JOYPAD(which,KEY_BUTTON_L)]));
buttonR.SetWindowText(GetKeyListName(joypad[JOYPAD(which,KEY_BUTTON_R)])); buttonR.SetWindowText(GetKeyListName(theApp.input->joypaddata[JOYPAD(which,KEY_BUTTON_R)]));
buttonSelect.SetWindowText(GetKeyListName(joypad[JOYPAD(which,KEY_BUTTON_SELECT)])); buttonSelect.SetWindowText(GetKeyListName(theApp.input->joypaddata[JOYPAD(which,KEY_BUTTON_SELECT)]));
buttonStart.SetWindowText(GetKeyListName(joypad[JOYPAD(which,KEY_BUTTON_START)])); buttonStart.SetWindowText(GetKeyListName(theApp.input->joypaddata[JOYPAD(which,KEY_BUTTON_START)]));
speed.SetWindowText(GetKeyListName(joypad[JOYPAD(which,KEY_BUTTON_SPEED)])); speed.SetWindowText(GetKeyListName(theApp.input->joypaddata[JOYPAD(which,KEY_BUTTON_SPEED)]));
capture.SetWindowText(GetKeyListName(joypad[JOYPAD(which,KEY_BUTTON_CAPTURE)])); capture.SetWindowText(GetKeyListName(theApp.input->joypaddata[JOYPAD(which,KEY_BUTTON_CAPTURE)]));
buttonGS.SetWindowText(GetKeyListName(joypad[JOYPAD(which,KEY_BUTTON_GS)])); buttonGS.SetWindowText(GetKeyListName(theApp.input->joypaddata[JOYPAD(which,KEY_BUTTON_GS)]));
CenterWindow(); CenterWindow();
@ -248,47 +247,47 @@ BOOL JoypadConfig::OnInitDialog()
// EXCEPTION: OCX Property Pages should return FALSE // EXCEPTION: OCX Property Pages should return FALSE
} }
void JoypadConfig::assignKey(int id, int key) void JoypadConfig::assignKey(int id, LONG_PTR key)
{ {
switch(id) { switch(id) {
case IDC_EDIT_LEFT: case IDC_EDIT_LEFT:
AssignKey(joypad[JOYPAD(which,KEY_LEFT)],key); AssignKey(theApp.input->joypaddata[JOYPAD(which,KEY_LEFT)],key);
break; break;
case IDC_EDIT_RIGHT: case IDC_EDIT_RIGHT:
AssignKey(joypad[JOYPAD(which,KEY_RIGHT)],key); AssignKey(theApp.input->joypaddata[JOYPAD(which,KEY_RIGHT)],key);
break; break;
case IDC_EDIT_UP: case IDC_EDIT_UP:
AssignKey(joypad[JOYPAD(which,KEY_UP)],key); AssignKey(theApp.input->joypaddata[JOYPAD(which,KEY_UP)],key);
break; break;
case IDC_EDIT_SPEED: case IDC_EDIT_SPEED:
AssignKey(joypad[JOYPAD(which,KEY_BUTTON_SPEED)],key); AssignKey(theApp.input->joypaddata[JOYPAD(which,KEY_BUTTON_SPEED)],key);
break; break;
case IDC_EDIT_CAPTURE: case IDC_EDIT_CAPTURE:
AssignKey(joypad[JOYPAD(which,KEY_BUTTON_CAPTURE)],key); AssignKey(theApp.input->joypaddata[JOYPAD(which,KEY_BUTTON_CAPTURE)],key);
break; break;
case IDC_EDIT_DOWN: case IDC_EDIT_DOWN:
AssignKey(joypad[JOYPAD(which,KEY_DOWN)],key); AssignKey(theApp.input->joypaddata[JOYPAD(which,KEY_DOWN)],key);
break; break;
case IDC_EDIT_BUTTON_A: case IDC_EDIT_BUTTON_A:
AssignKey(joypad[JOYPAD(which,KEY_BUTTON_A)],key); AssignKey(theApp.input->joypaddata[JOYPAD(which,KEY_BUTTON_A)],key);
break; break;
case IDC_EDIT_BUTTON_B: case IDC_EDIT_BUTTON_B:
AssignKey(joypad[JOYPAD(which,KEY_BUTTON_B)],key); AssignKey(theApp.input->joypaddata[JOYPAD(which,KEY_BUTTON_B)],key);
break; break;
case IDC_EDIT_BUTTON_L: case IDC_EDIT_BUTTON_L:
AssignKey(joypad[JOYPAD(which,KEY_BUTTON_L)],key); AssignKey(theApp.input->joypaddata[JOYPAD(which,KEY_BUTTON_L)],key);
break; break;
case IDC_EDIT_BUTTON_R: case IDC_EDIT_BUTTON_R:
AssignKey(joypad[JOYPAD(which,KEY_BUTTON_R)],key); AssignKey(theApp.input->joypaddata[JOYPAD(which,KEY_BUTTON_R)],key);
break; break;
case IDC_EDIT_BUTTON_START: case IDC_EDIT_BUTTON_START:
AssignKey(joypad[JOYPAD(which,KEY_BUTTON_START)],key); AssignKey(theApp.input->joypaddata[JOYPAD(which,KEY_BUTTON_START)],key);
break; break;
case IDC_EDIT_BUTTON_SELECT: case IDC_EDIT_BUTTON_SELECT:
AssignKey(joypad[JOYPAD(which,KEY_BUTTON_SELECT)],key); AssignKey(theApp.input->joypaddata[JOYPAD(which,KEY_BUTTON_SELECT)],key);
break; break;
case IDC_EDIT_BUTTON_GS: case IDC_EDIT_BUTTON_GS:
AssignKey(joypad[JOYPAD(which,KEY_BUTTON_GS)],key); AssignKey(theApp.input->joypaddata[JOYPAD(which,KEY_BUTTON_GS)],key);
break; break;
} }
} }
@ -322,15 +321,12 @@ void MotionConfig::DoDataExchange(CDataExchange* pDX)
BEGIN_MESSAGE_MAP(MotionConfig, CDialog) BEGIN_MESSAGE_MAP(MotionConfig, CDialog)
//{{AFX_MSG_MAP(MotionConfig)
ON_BN_CLICKED(ID_CANCEL, OnCancel) ON_BN_CLICKED(ID_CANCEL, OnCancel)
ON_BN_CLICKED(ID_OK, OnOk) ON_BN_CLICKED(ID_OK, OnOk)
ON_WM_CHAR()
ON_WM_DESTROY() ON_WM_DESTROY()
ON_WM_KEYDOWN() ON_WM_KEYDOWN()
ON_WM_TIMER() ON_WM_TIMER()
//}}AFX_MSG_MAP ON_BN_CLICKED(IDC_APPENDMODE, &MotionConfig::OnBnClickedAppendmode)
ON_BN_CLICKED(IDC_APPENDMODE, &MotionConfig::OnBnClickedAppendmode)
END_MESSAGE_MAP() END_MESSAGE_MAP()
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
@ -343,16 +339,11 @@ void MotionConfig::OnCancel()
void MotionConfig::OnOk() void MotionConfig::OnOk()
{ {
assignKeys();
theApp.input->checkKeys(); theApp.input->checkKeys();
EndDialog( TRUE); EndDialog( TRUE);
} }
void MotionConfig::OnChar(UINT nChar, UINT nRepCnt, UINT nFlags)
{
}
void MotionConfig::OnDestroy() void MotionConfig::OnDestroy()
{ {
CDialog::OnDestroy(); CDialog::OnDestroy();
@ -360,24 +351,23 @@ void MotionConfig::OnDestroy()
KillTimer(timerId); KillTimer(timerId);
} }
BOOL MotionConfig::OnInitDialog() BOOL MotionConfig::OnInitDialog()
{ {
CDialog::OnInitDialog(); CDialog::OnInitDialog();
timerId = SetTimer(0,200,NULL); timerId = SetTimer(0,50,NULL);
CopyKeys(up.m_Keys, joypad[MOTION(KEY_UP)]); CopyKeys(up.m_Keys, theApp.input->joypaddata[MOTION(KEY_UP)]);
up.SetWindowText(GetKeyListName(joypad[MOTION(KEY_UP)])); up.SetWindowText(GetKeyListName(theApp.input->joypaddata[MOTION(KEY_UP)]));
CopyKeys(down.m_Keys, joypad[MOTION(KEY_DOWN)]); CopyKeys(down.m_Keys, theApp.input->joypaddata[MOTION(KEY_DOWN)]);
down.SetWindowText(GetKeyListName(joypad[MOTION(KEY_DOWN)])); down.SetWindowText(GetKeyListName(theApp.input->joypaddata[MOTION(KEY_DOWN)]));
CopyKeys(left.m_Keys, joypad[MOTION(KEY_LEFT)]); CopyKeys(left.m_Keys, theApp.input->joypaddata[MOTION(KEY_LEFT)]);
left.SetWindowText(GetKeyListName(joypad[MOTION(KEY_LEFT)])); left.SetWindowText(GetKeyListName(theApp.input->joypaddata[MOTION(KEY_LEFT)]));
CopyKeys(right.m_Keys, joypad[MOTION(KEY_RIGHT)]); CopyKeys(right.m_Keys, theApp.input->joypaddata[MOTION(KEY_RIGHT)]);
right.SetWindowText(GetKeyListName(joypad[MOTION(KEY_RIGHT)])); right.SetWindowText(GetKeyListName(theApp.input->joypaddata[MOTION(KEY_RIGHT)]));
CenterWindow(); CenterWindow();
@ -400,16 +390,16 @@ void MotionConfig::assignKey(int id, int key)
{ {
switch(id) { switch(id) {
case IDC_EDIT_LEFT: case IDC_EDIT_LEFT:
AssignKey(joypad[MOTION(KEY_LEFT)],key); AssignKey(theApp.input->joypaddata[MOTION(KEY_LEFT)],key);
break; break;
case IDC_EDIT_RIGHT: case IDC_EDIT_RIGHT:
AssignKey(joypad[MOTION(KEY_RIGHT)],key); AssignKey(theApp.input->joypaddata[MOTION(KEY_RIGHT)],key);
break; break;
case IDC_EDIT_UP: case IDC_EDIT_UP:
AssignKey(joypad[MOTION(KEY_UP)],key); AssignKey(theApp.input->joypaddata[MOTION(KEY_UP)],key);
break; break;
case IDC_EDIT_DOWN: case IDC_EDIT_DOWN:
AssignKey(joypad[MOTION(KEY_DOWN)],key); AssignKey(theApp.input->joypaddata[MOTION(KEY_DOWN)],key);
break; break;
} }
} }
@ -430,13 +420,13 @@ void MotionConfig::assignKeys()
id = IDC_EDIT_RIGHT; id = IDC_EDIT_RIGHT;
assignKey(id, GetWindowLong(right, GWL_USERDATA)); assignKey(id, GetWindowLong(right, GWL_USERDATA));
} }
void JoypadConfig::OnBnClickedAppendmode() void JoypadConfig::OnBnClickedAppendmode()
{ {
bAppendMode = (::SendMessage(GetDlgItem(IDC_APPENDMODE)->GetSafeHwnd(), BM_GETCHECK, 0, 0L) != 0); bAppendMode = (::SendMessage(GetDlgItem(IDC_APPENDMODE)->GetSafeHwnd(), BM_GETCHECK, 0, 0L) != 0);
} }
void MotionConfig::OnBnClickedAppendmode() void MotionConfig::OnBnClickedAppendmode()
{ {
bAppendMode = (::SendMessage(GetDlgItem(IDC_APPENDMODE)->GetSafeHwnd(), BM_GETCHECK, 0, 0L) != 0); bAppendMode = (::SendMessage(GetDlgItem(IDC_APPENDMODE)->GetSafeHwnd(), BM_GETCHECK, 0, 0L) != 0);
} }

View File

@ -1,176 +1,176 @@
// -*- C++ -*- // -*- C++ -*-
// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. // VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator.
// Copyright (C) 1999-2003 Forgotten // Copyright (C) 1999-2003 Forgotten
// Copyright (C) 2004 Forgotten and the VBA development team // Copyright (C) 2004 Forgotten and the VBA development team
// This program is free software; you can redistribute it and/or modify // 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 // it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2, or(at your option) // the Free Software Foundation; either version 2, or(at your option)
// any later version. // any later version.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details. // GNU General Public License for more details.
// //
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software Foundation, // along with this program; if not, write to the Free Software Foundation,
// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "afxwin.h" #include "afxwin.h"
#if !defined(AFX_JOYPAD_H__FFFB2470_9EEC_4D2D_A5F0_3BF31579999A__INCLUDED_) #if !defined(AFX_JOYPAD_H__FFFB2470_9EEC_4D2D_A5F0_3BF31579999A__INCLUDED_)
#define AFX_JOYPAD_H__FFFB2470_9EEC_4D2D_A5F0_3BF31579999A__INCLUDED_ #define AFX_JOYPAD_H__FFFB2470_9EEC_4D2D_A5F0_3BF31579999A__INCLUDED_
#if _MSC_VER > 1000 #if _MSC_VER > 1000
#pragma once #pragma once
#endif // _MSC_VER > 1000 #endif // _MSC_VER > 1000
// Joypad.h : header file // Joypad.h : header file
// //
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// JoypadEditControl window // JoypadEditControl window
class JoypadEditControl : public CEdit class JoypadEditControl : public CEdit
{ {
// Construction // Construction
public: public:
JoypadEditControl(); JoypadEditControl();
KeyList m_Keys; KeyList m_Keys;
// Attributes // Attributes
public: public:
// Operations // Operations
public: public:
// Overrides // Overrides
// ClassWizard generated virtual function overrides // ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(JoypadEditControl) //{{AFX_VIRTUAL(JoypadEditControl)
//}}AFX_VIRTUAL //}}AFX_VIRTUAL
// Implementation // Implementation
public: public:
virtual BOOL PreTranslateMessage(MSG *pMsg); virtual BOOL PreTranslateMessage(MSG *pMsg);
afx_msg LRESULT OnJoyConfig(WPARAM wParam, LPARAM lParam); afx_msg LRESULT OnJoyConfig(WPARAM wParam, LPARAM lParam);
virtual ~JoypadEditControl(); virtual ~JoypadEditControl();
// Generated message map functions // Generated message map functions
protected: protected:
//{{AFX_MSG(JoypadEditControl) //{{AFX_MSG(JoypadEditControl)
afx_msg void OnChar(UINT nChar, UINT nRepCnt, UINT nFlags); afx_msg void OnChar(UINT nChar, UINT nRepCnt, UINT nFlags);
//}}AFX_MSG //}}AFX_MSG
DECLARE_MESSAGE_MAP() DECLARE_MESSAGE_MAP()
}; };
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// JoypadConfig dialog // JoypadConfig dialog
class JoypadConfig : public CDialog class JoypadConfig : public CDialog
{ {
// Construction // Construction
public: public:
void assignKey(int id, int key); void assignKey(int id, LONG_PTR key);
JoypadConfig(int w, CWnd* pParent = NULL); // standard constructor JoypadConfig(int w, CWnd* pParent = NULL); // standard constructor
// Dialog Data // Dialog Data
//{{AFX_DATA(JoypadConfig) //{{AFX_DATA(JoypadConfig)
enum { IDD = IDD_CONFIG }; enum { IDD = IDD_CONFIG };
JoypadEditControl up; JoypadEditControl up;
JoypadEditControl speed; JoypadEditControl speed;
JoypadEditControl right; JoypadEditControl right;
JoypadEditControl left; JoypadEditControl left;
JoypadEditControl down; JoypadEditControl down;
JoypadEditControl capture; JoypadEditControl capture;
JoypadEditControl buttonStart; JoypadEditControl buttonStart;
JoypadEditControl buttonSelect; JoypadEditControl buttonSelect;
JoypadEditControl buttonR; JoypadEditControl buttonR;
JoypadEditControl buttonL; JoypadEditControl buttonL;
JoypadEditControl buttonGS; JoypadEditControl buttonGS;
JoypadEditControl buttonB; JoypadEditControl buttonB;
JoypadEditControl buttonA; JoypadEditControl buttonA;
//}}AFX_DATA //}}AFX_DATA
// Overrides // Overrides
// ClassWizard generated virtual function overrides // ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(JoypadConfig) //{{AFX_VIRTUAL(JoypadConfig)
protected: protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL //}}AFX_VIRTUAL
// Implementation // Implementation
protected: protected:
UINT timerId; UINT timerId;
int which; int which;
// Generated message map functions // Generated message map functions
//{{AFX_MSG(JoypadConfig) //{{AFX_MSG(JoypadConfig)
afx_msg void OnCancel(); afx_msg void OnCancel();
afx_msg void OnOk(); afx_msg void OnOk();
afx_msg void OnChar(UINT nChar, UINT nRepCnt, UINT nFlags); afx_msg void OnChar(UINT nChar, UINT nRepCnt, UINT nFlags);
afx_msg void OnDestroy(); afx_msg void OnDestroy();
afx_msg void OnTimer(UINT nIDEvent); afx_msg void OnTimer(UINT nIDEvent);
afx_msg void OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags); afx_msg void OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags);
virtual BOOL OnInitDialog(); virtual BOOL OnInitDialog();
//}}AFX_MSG //}}AFX_MSG
DECLARE_MESSAGE_MAP() DECLARE_MESSAGE_MAP()
public: public:
afx_msg void OnBnClickedAppendmode(); afx_msg void OnBnClickedAppendmode();
}; };
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// MotionConfig dialog // MotionConfig dialog
class MotionConfig : public CDialog class MotionConfig : public CDialog
{ {
// Construction // Construction
public: public:
void assignKeys(); void assignKeys();
void assignKey(int id, int key); void assignKey(int id, int key);
MotionConfig(CWnd* pParent = NULL); // standard constructor MotionConfig(CWnd* pParent = NULL); // standard constructor
// Dialog Data // Dialog Data
//{{AFX_DATA(MotionConfig) //{{AFX_DATA(MotionConfig)
enum { IDD = IDD_MOTION_CONFIG }; enum { IDD = IDD_MOTION_CONFIG };
JoypadEditControl up; JoypadEditControl up;
JoypadEditControl right; JoypadEditControl right;
JoypadEditControl left; JoypadEditControl left;
JoypadEditControl down; JoypadEditControl down;
//}}AFX_DATA //}}AFX_DATA
// Overrides // Overrides
// ClassWizard generated virtual function overrides // ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(MotionConfig) //{{AFX_VIRTUAL(MotionConfig)
protected: protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL //}}AFX_VIRTUAL
// Implementation // Implementation
protected: protected:
// Generated message map functions // Generated message map functions
//{{AFX_MSG(MotionConfig) //{{AFX_MSG(MotionConfig)
afx_msg void OnCancel(); afx_msg void OnCancel();
afx_msg void OnOk(); afx_msg void OnOk();
afx_msg void OnChar(UINT nChar, UINT nRepCnt, UINT nFlags); afx_msg void OnChar(UINT nChar, UINT nRepCnt, UINT nFlags);
afx_msg void OnDestroy(); afx_msg void OnDestroy();
virtual BOOL OnInitDialog(); virtual BOOL OnInitDialog();
afx_msg void OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags); afx_msg void OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags);
afx_msg void OnTimer(UINT nIDEvent); afx_msg void OnTimer(UINT nIDEvent);
//}}AFX_MSG //}}AFX_MSG
DECLARE_MESSAGE_MAP() DECLARE_MESSAGE_MAP()
private: private:
UINT timerId; UINT timerId;
public: public:
afx_msg void OnBnClickedAppendmode(); afx_msg void OnBnClickedAppendmode();
}; };
//{{AFX_INSERT_LOCATION}} //{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line. // Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_JOYPAD_H__FFFB2470_9EEC_4D2D_A5F0_3BF31579999A__INCLUDED_) #endif // !defined(AFX_JOYPAD_H__FFFB2470_9EEC_4D2D_A5F0_3BF31579999A__INCLUDED_)

View File

@ -1,6 +1,6 @@
// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. // VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator.
// Copyright (C) 1999-2003 Forgotten // Copyright (C) 1999-2003 Forgotten
// Copyright (C) 2004 Forgotten and the VBA development team // Copyright (C) 2005 Forgotten and the VBA development team
// This program is free software; you can redistribute it and/or modify // 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 // it under the terms of the GNU General Public License as published by
@ -225,7 +225,7 @@ BOOL Logging::OnInitDialog()
m_dma2 = (systemVerbose & 64) != 0; m_dma2 = (systemVerbose & 64) != 0;
m_dma3 = (systemVerbose & 128) != 0; m_dma3 = (systemVerbose & 128) != 0;
m_undefined = (systemVerbose & 256) != 0; m_undefined = (systemVerbose & 256) != 0;
m_agbprint = (systemVerbose & 256) != 0; m_agbprint = (systemVerbose & 512) != 0;
UpdateData(FALSE); UpdateData(FALSE);
m_log.LimitText(-1); m_log.LimitText(-1);
@ -237,7 +237,7 @@ BOOL Logging::OnInitDialog()
void Logging::log(const char *s) void Logging::log(const char *s)
{ {
int size = ::SendMessage(m_log, WM_GETTEXTLENGTH, 0, 0); DWORD size = (DWORD)::SendMessage(m_log, WM_GETTEXTLENGTH, 0, 0);
m_log.SetSel(size, size); m_log.SetSel(size, size);
m_log.ReplaceSel(s); m_log.ReplaceSel(s);
} }

File diff suppressed because it is too large Load Diff

View File

@ -1,442 +1,446 @@
// -*- C++ -*- // -*- C++ -*-
// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator. // VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator.
// Copyright (C) 1999-2003 Forgotten // Copyright (C) 1999-2003 Forgotten
// Copyright (C) 2004 Forgotten and the VBA development team // Copyright (C) 2005 Forgotten and the VBA development team
// This program is free software; you can redistribute it and/or modify // 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 // it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2, or(at your option) // the Free Software Foundation; either version 2, or(at your option)
// any later version. // any later version.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details. // GNU General Public License for more details.
// //
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software Foundation, // along with this program; if not, write to the Free Software Foundation,
// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#if !defined(AFX_MAINWND_H__E8AD28B9_C9FB_4EC2_A2DC_DD1BBA55A275__INCLUDED_) #if !defined(AFX_MAINWND_H__E8AD28B9_C9FB_4EC2_A2DC_DD1BBA55A275__INCLUDED_)
#define AFX_MAINWND_H__E8AD28B9_C9FB_4EC2_A2DC_DD1BBA55A275__INCLUDED_ #define AFX_MAINWND_H__E8AD28B9_C9FB_4EC2_A2DC_DD1BBA55A275__INCLUDED_
#if _MSC_VER > 1000 #if _MSC_VER > 1000
#pragma once #pragma once
#endif // _MSC_VER > 1000 #endif // _MSC_VER > 1000
// MainWnd.h : header file // MainWnd.h : header file
// //
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// MainWnd window // MainWnd window
class MainWnd : public CWnd class MainWnd : public CWnd
{ {
// Construction // Construction
public: public:
MainWnd(); MainWnd();
// Attributes // Attributes
public: public:
// Operations // Operations
public: public:
bool FileRun(); bool FileRun();
// Overrides // Overrides
// ClassWizard generated virtual function overrides // ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(MainWnd) //{{AFX_VIRTUAL(MainWnd)
public: public:
virtual BOOL PreTranslateMessage(MSG* pMsg); virtual BOOL PreTranslateMessage(MSG* pMsg);
//}}AFX_VIRTUAL //}}AFX_VIRTUAL
// Implementation // Implementation
public: public:
HCURSOR arrow; HCURSOR arrow;
void winMouseOn(); void winMouseOn();
void screenCapture(int captureNumber); void screenCapture(int captureNumber);
HACCEL m_hAccelTable; HACCEL m_hAccelTable;
bool fileOpenSelect(); bool fileOpenSelect( bool gb = false );
afx_msg LRESULT OnConfirmMode(WPARAM, LPARAM); afx_msg LRESULT OnConfirmMode(WPARAM, LPARAM);
afx_msg LRESULT OnMySysCommand(WPARAM, LPARAM); afx_msg LRESULT OnMySysCommand(WPARAM, LPARAM);
afx_msg void OnUpdateFileLoadGameSlot(CCmdUI *pCmdUI); afx_msg void OnUpdateFileLoadGameSlot(CCmdUI *pCmdUI);
afx_msg void OnUpdateFileSaveGameSlot(CCmdUI *pCmdUI); afx_msg void OnUpdateFileSaveGameSlot(CCmdUI *pCmdUI);
afx_msg void OnUpdateOptionsJoypadAutofire(CCmdUI *pCmdUI); afx_msg void OnUpdateOptionsJoypadAutofire(CCmdUI *pCmdUI);
afx_msg BOOL OnOptionsJoypadAutofire(UINT nID); afx_msg BOOL OnOptionsJoypadAutofire(UINT nID);
afx_msg void OnUpdateOptionsJoypadDefault(CCmdUI *pCmdUI); afx_msg void OnUpdateOptionsJoypadDefault(CCmdUI *pCmdUI);
afx_msg BOOL OnOptionsJoypadDefault(UINT nID); afx_msg BOOL OnOptionsJoypadDefault(UINT nID);
afx_msg void OnUpdateOptionsFilterIFB(CCmdUI *pCmdUI); afx_msg void OnUpdateOptionsFilterIFB(CCmdUI *pCmdUI);
afx_msg BOOL OnOptionsFilterIFB(UINT nID); afx_msg BOOL OnOptionsFilterIFB(UINT nID);
afx_msg void OnUpdateOptionsFilter(CCmdUI *pCmdUI); afx_msg void OnUpdateOptionsFilter(CCmdUI *pCmdUI);
afx_msg BOOL OnOptionsFilter(UINT nID); afx_msg BOOL OnOptionsFilter(UINT nID);
afx_msg void OnUpdateOptionsPriority(CCmdUI *pCmdUI); afx_msg void OnUpdateOptionsPriority(CCmdUI *pCmdUI);
afx_msg BOOL OnOptionsPriority(UINT nID); afx_msg BOOL OnOptionsPriority(UINT nID);
afx_msg void OnSetFocus(CWnd * pOldWnd); void updateSoundChannels(UINT nID);
afx_msg void OnKillFocus(CWnd * pNewWnd); afx_msg void OnUpdateOptionsSoundVolume(CCmdUI *pCmdUI);
afx_msg BOOL OnOptionsSoundVolume(UINT nID);
void updateSoundChannels(UINT nID); afx_msg void OnUpdateOptionsEmulatorShowSpeed(CCmdUI *pCmdUI);
afx_msg void OnUpdateOptionsSoundVolume(CCmdUI *pCmdUI); afx_msg BOOL OnOptionsEmulatorShowSpeed(UINT nID);
afx_msg BOOL OnOptionsSoundVolume(UINT nID); afx_msg void OnSystemMinimize();
afx_msg void OnUpdateOptionsEmulatorShowSpeed(CCmdUI *pCmdUI); afx_msg void OnUpdateVideoLayer(CCmdUI* pCmdUI);
afx_msg BOOL OnOptionsEmulatorShowSpeed(UINT nID); afx_msg BOOL OnVideoLayer(UINT nID);
afx_msg void OnSystemMinimize(); void winConfirmMode();
afx_msg void OnUpdateVideoLayer(CCmdUI* pCmdUI); afx_msg BOOL OnOptionVideoSize(UINT nID);
afx_msg BOOL OnVideoLayer(UINT nID); afx_msg BOOL OnOptionsFrameskip(UINT nID);
void winConfirmMode(); bool fileImportGSACodeFile(CString& fileName);
afx_msg BOOL OnOptionVideoSize(UINT nID); bool writeSaveGame(const char *name);
afx_msg BOOL OnOptionsFrameskip(UINT nID); bool loadSaveGame(const char *name);
bool fileImportGSACodeFile(CString& fileName); CString winLoadFilter(UINT id);
bool writeSaveGame(const char *name); void winLoadCheatList(const char *name);
bool loadSaveGame(const char *name); void winLoadCheatListDefault();
CString winLoadFilter(UINT id); void readBatteryFile();
void winLoadCheatList(const char *name); void writeBatteryFile();
void winLoadCheatListDefault(); bool isDriveRoot(CString& file);
void readBatteryFile(); CString getDirFromFile(CString& file);
void writeBatteryFile(); void winSaveCheatList(const char *name);
bool isDriveRoot(CString& file); void winSaveCheatListDefault();
CString getDirFromFile(CString& file); virtual ~MainWnd();
void winSaveCheatList(const char *name);
void winSaveCheatListDefault(); // Generated message map functions
virtual ~MainWnd(); protected:
//{{AFX_MSG(MainWnd)
// Generated message map functions afx_msg void OnClose();
protected: afx_msg void OnHelpAbout();
//{{AFX_MSG(MainWnd) afx_msg void OnHelpFaq();
afx_msg void OnClose(); afx_msg void OnFileOpen();
afx_msg void OnHelpAbout(); afx_msg void OnInitMenuPopup(CMenu* pPopupMenu, UINT nIndex, BOOL bSysMenu);
afx_msg void OnHelpFaq(); afx_msg void OnFilePause();
afx_msg void OnFileOpen(); afx_msg void OnUpdateFilePause(CCmdUI* pCmdUI);
afx_msg void OnInitMenuPopup(CMenu* pPopupMenu, UINT nIndex, BOOL bSysMenu); afx_msg void OnFileReset();
afx_msg void OnFilePause(); afx_msg void OnUpdateFileReset(CCmdUI* pCmdUI);
afx_msg void OnUpdateFilePause(CCmdUI* pCmdUI); afx_msg void OnUpdateFileRecentFreeze(CCmdUI* pCmdUI);
afx_msg void OnFileReset(); afx_msg void OnFileRecentReset();
afx_msg void OnUpdateFileReset(CCmdUI* pCmdUI); afx_msg void OnFileRecentFreeze();
afx_msg void OnUpdateFileRecentFreeze(CCmdUI* pCmdUI); afx_msg void OnFileExit();
afx_msg void OnFileRecentReset(); afx_msg void OnFileClose();
afx_msg void OnFileRecentFreeze(); afx_msg void OnUpdateFileClose(CCmdUI* pCmdUI);
afx_msg void OnFileExit(); afx_msg void OnFileOpengameboy();
afx_msg void OnFileClose(); afx_msg void OnFileLoad();
afx_msg void OnUpdateFileClose(CCmdUI* pCmdUI); afx_msg void OnUpdateFileLoad(CCmdUI* pCmdUI);
afx_msg void OnFileOpengameboy(); afx_msg void OnFileSave();
afx_msg void OnFileLoad(); afx_msg void OnUpdateFileSave(CCmdUI* pCmdUI);
afx_msg void OnUpdateFileLoad(CCmdUI* pCmdUI); afx_msg void OnFileImportBatteryfile();
afx_msg void OnFileSave(); afx_msg void OnUpdateFileImportBatteryfile(CCmdUI* pCmdUI);
afx_msg void OnUpdateFileSave(CCmdUI* pCmdUI); afx_msg void OnFileImportGamesharkcodefile();
afx_msg void OnFileImportBatteryfile(); afx_msg void OnUpdateFileImportGamesharkcodefile(CCmdUI* pCmdUI);
afx_msg void OnUpdateFileImportBatteryfile(CCmdUI* pCmdUI); afx_msg void OnFileImportGamesharksnapshot();
afx_msg void OnFileImportGamesharkcodefile(); afx_msg void OnUpdateFileImportGamesharksnapshot(CCmdUI* pCmdUI);
afx_msg void OnUpdateFileImportGamesharkcodefile(CCmdUI* pCmdUI); afx_msg void OnFileExportBatteryfile();
afx_msg void OnFileImportGamesharksnapshot(); afx_msg void OnUpdateFileExportBatteryfile(CCmdUI* pCmdUI);
afx_msg void OnUpdateFileImportGamesharksnapshot(CCmdUI* pCmdUI); afx_msg void OnFileExportGamesharksnapshot();
afx_msg void OnFileExportBatteryfile(); afx_msg void OnUpdateFileExportGamesharksnapshot(CCmdUI* pCmdUI);
afx_msg void OnUpdateFileExportBatteryfile(CCmdUI* pCmdUI); afx_msg void OnFileScreencapture();
afx_msg void OnFileExportGamesharksnapshot(); afx_msg void OnUpdateFileScreencapture(CCmdUI* pCmdUI);
afx_msg void OnUpdateFileExportGamesharksnapshot(CCmdUI* pCmdUI); afx_msg void OnFileRominformation();
afx_msg void OnFileScreencapture(); afx_msg void OnUpdateFileRominformation(CCmdUI* pCmdUI);
afx_msg void OnUpdateFileScreencapture(CCmdUI* pCmdUI); afx_msg void OnFileTogglemenu();
afx_msg void OnFileRominformation(); afx_msg void OnUpdateFileTogglemenu(CCmdUI* pCmdUI);
afx_msg void OnUpdateFileRominformation(CCmdUI* pCmdUI); afx_msg void OnUpdateOptionsFrameskipThrottleNothrottle(CCmdUI* pCmdUI);
afx_msg void OnFileTogglemenu(); afx_msg void OnUpdateOptionsFrameskipThrottle25(CCmdUI* pCmdUI);
afx_msg void OnUpdateFileTogglemenu(CCmdUI* pCmdUI); afx_msg void OnUpdateOptionsFrameskipThrottle50(CCmdUI* pCmdUI);
afx_msg void OnUpdateOptionsFrameskipThrottleNothrottle(CCmdUI* pCmdUI); afx_msg void OnUpdateOptionsFrameskipThrottle100(CCmdUI* pCmdUI);
afx_msg void OnUpdateOptionsFrameskipThrottle25(CCmdUI* pCmdUI); afx_msg void OnUpdateOptionsFrameskipThrottle150(CCmdUI* pCmdUI);
afx_msg void OnUpdateOptionsFrameskipThrottle50(CCmdUI* pCmdUI); afx_msg void OnUpdateOptionsFrameskipThrottle200(CCmdUI* pCmdUI);
afx_msg void OnUpdateOptionsFrameskipThrottle100(CCmdUI* pCmdUI); afx_msg void OnUpdateOptionsFrameskipThrottleOther(CCmdUI* pCmdUI);
afx_msg void OnUpdateOptionsFrameskipThrottle150(CCmdUI* pCmdUI); afx_msg void OnOptionsFrameskipThrottleNothrottle();
afx_msg void OnUpdateOptionsFrameskipThrottle200(CCmdUI* pCmdUI); afx_msg void OnOptionsFrameskipThrottle25();
afx_msg void OnUpdateOptionsFrameskipThrottleOther(CCmdUI* pCmdUI); afx_msg void OnOptionsFrameskipThrottle50();
afx_msg void OnOptionsFrameskipThrottleNothrottle(); afx_msg void OnOptionsFrameskipThrottle100();
afx_msg void OnOptionsFrameskipThrottle25(); afx_msg void OnOptionsFrameskipThrottle150();
afx_msg void OnOptionsFrameskipThrottle50(); afx_msg void OnOptionsFrameskipThrottle200();
afx_msg void OnOptionsFrameskipThrottle100(); afx_msg void OnOptionsFrameskipThrottleOther();
afx_msg void OnOptionsFrameskipThrottle150(); afx_msg void OnOptionsFrameskipAutomatic();
afx_msg void OnOptionsFrameskipThrottle200(); afx_msg void OnUpdateOptionsFrameskipAutomatic(CCmdUI* pCmdUI);
afx_msg void OnOptionsFrameskipThrottleOther(); afx_msg void OnUpdateOptionsVideoFrameskip0(CCmdUI* pCmdUI);
afx_msg void OnOptionsFrameskipAutomatic(); afx_msg void OnUpdateOptionsVideoFrameskip1(CCmdUI* pCmdUI);
afx_msg void OnUpdateOptionsFrameskipAutomatic(CCmdUI* pCmdUI); afx_msg void OnUpdateOptionsVideoFrameskip2(CCmdUI* pCmdUI);
afx_msg void OnUpdateOptionsVideoFrameskip0(CCmdUI* pCmdUI); afx_msg void OnUpdateOptionsVideoFrameskip3(CCmdUI* pCmdUI);
afx_msg void OnUpdateOptionsVideoFrameskip1(CCmdUI* pCmdUI); afx_msg void OnUpdateOptionsVideoFrameskip4(CCmdUI* pCmdUI);
afx_msg void OnUpdateOptionsVideoFrameskip2(CCmdUI* pCmdUI); afx_msg void OnUpdateOptionsVideoFrameskip5(CCmdUI* pCmdUI);
afx_msg void OnUpdateOptionsVideoFrameskip3(CCmdUI* pCmdUI); afx_msg void OnUpdateOptionsVideoFrameskip6(CCmdUI* pCmdUI);
afx_msg void OnUpdateOptionsVideoFrameskip4(CCmdUI* pCmdUI); afx_msg void OnUpdateOptionsVideoFrameskip7(CCmdUI* pCmdUI);
afx_msg void OnUpdateOptionsVideoFrameskip5(CCmdUI* pCmdUI); afx_msg void OnUpdateOptionsVideoFrameskip8(CCmdUI* pCmdUI);
afx_msg void OnUpdateOptionsVideoFrameskip6(CCmdUI* pCmdUI); afx_msg void OnUpdateOptionsVideoFrameskip9(CCmdUI* pCmdUI);
afx_msg void OnUpdateOptionsVideoFrameskip7(CCmdUI* pCmdUI); afx_msg void OnOptionsVideoVsync();
afx_msg void OnUpdateOptionsVideoFrameskip8(CCmdUI* pCmdUI); afx_msg void OnUpdateOptionsVideoVsync(CCmdUI* pCmdUI);
afx_msg void OnUpdateOptionsVideoFrameskip9(CCmdUI* pCmdUI); afx_msg void OnUpdateOptionsVideoX1(CCmdUI* pCmdUI);
afx_msg void OnOptionsVideoVsync(); afx_msg void OnUpdateOptionsVideoX2(CCmdUI* pCmdUI);
afx_msg void OnUpdateOptionsVideoVsync(CCmdUI* pCmdUI); afx_msg void OnUpdateOptionsVideoX3(CCmdUI* pCmdUI);
afx_msg void OnUpdateOptionsVideoX1(CCmdUI* pCmdUI); afx_msg void OnUpdateOptionsVideoX4(CCmdUI* pCmdUI);
afx_msg void OnUpdateOptionsVideoX2(CCmdUI* pCmdUI); afx_msg void OnUpdateOptionsVideoFullscreen320x240(CCmdUI* pCmdUI);
afx_msg void OnUpdateOptionsVideoX3(CCmdUI* pCmdUI); afx_msg void OnUpdateOptionsVideoFullscreen640x480(CCmdUI* pCmdUI);
afx_msg void OnUpdateOptionsVideoX4(CCmdUI* pCmdUI); afx_msg void OnUpdateOptionsVideoFullscreen800x600(CCmdUI* pCmdUI);
afx_msg void OnUpdateOptionsVideoFullscreen320x240(CCmdUI* pCmdUI); afx_msg void OnOptionsVideoFullscreen320x240();
afx_msg void OnUpdateOptionsVideoFullscreen640x480(CCmdUI* pCmdUI); afx_msg void OnOptionsVideoFullscreen640x480();
afx_msg void OnUpdateOptionsVideoFullscreen800x600(CCmdUI* pCmdUI); afx_msg void OnOptionsVideoFullscreen800x600();
afx_msg void OnOptionsVideoFullscreen320x240(); afx_msg void OnOptionsVideoFullscreen();
afx_msg void OnOptionsVideoFullscreen640x480(); afx_msg void OnUpdateOptionsVideoFullscreen(CCmdUI* pCmdUI);
afx_msg void OnOptionsVideoFullscreen800x600(); afx_msg void OnMove(int x, int y);
afx_msg void OnOptionsVideoFullscreen(); afx_msg void OnSize(UINT nType, int cx, int cy);
afx_msg void OnUpdateOptionsVideoFullscreen(CCmdUI* pCmdUI); afx_msg void OnOptionsVideoDisablesfx();
afx_msg void OnMove(int x, int y); afx_msg void OnUpdateOptionsVideoDisablesfx(CCmdUI* pCmdUI);
afx_msg void OnSize(UINT nType, int cx, int cy); afx_msg void OnOptionsVideoFullscreenstretchtofit();
afx_msg void OnOptionsVideoDisablesfx(); afx_msg void OnUpdateOptionsVideoFullscreenstretchtofit(CCmdUI* pCmdUI);
afx_msg void OnUpdateOptionsVideoDisablesfx(CCmdUI* pCmdUI); afx_msg void OnOptionsVideoRendermethodGdi();
afx_msg void OnOptionsVideoFullscreenstretchtofit(); afx_msg void OnUpdateOptionsVideoRendermethodGdi(CCmdUI* pCmdUI);
afx_msg void OnUpdateOptionsVideoFullscreenstretchtofit(CCmdUI* pCmdUI); afx_msg void OnOptionsVideoRendermethodDirectdraw();
afx_msg void OnOptionsVideoRendermethodGdi(); afx_msg void OnUpdateOptionsVideoRendermethodDirectdraw(CCmdUI* pCmdUI);
afx_msg void OnUpdateOptionsVideoRendermethodGdi(CCmdUI* pCmdUI); afx_msg void OnOptionsVideoRendermethodDirect3d();
afx_msg void OnOptionsVideoRendermethodDirectdraw(); afx_msg void OnUpdateOptionsVideoRendermethodDirect3d(CCmdUI* pCmdUI);
afx_msg void OnUpdateOptionsVideoRendermethodDirectdraw(CCmdUI* pCmdUI); afx_msg void OnOptionsVideoRendermethodOpengl();
afx_msg void OnOptionsVideoRendermethodDirect3d(); afx_msg void OnUpdateOptionsVideoRendermethodOpengl(CCmdUI* pCmdUI);
afx_msg void OnUpdateOptionsVideoRendermethodDirect3d(CCmdUI* pCmdUI); afx_msg void OnOptionsVideoTriplebuffering();
afx_msg void OnOptionsVideoRendermethodOpengl(); afx_msg void OnUpdateOptionsVideoTriplebuffering(CCmdUI* pCmdUI);
afx_msg void OnUpdateOptionsVideoRendermethodOpengl(CCmdUI* pCmdUI); afx_msg void OnOptionsVideoDdrawemulationonly();
afx_msg void OnOptionsVideoTriplebuffering(); afx_msg void OnUpdateOptionsVideoDdrawemulationonly(CCmdUI* pCmdUI);
afx_msg void OnUpdateOptionsVideoTriplebuffering(CCmdUI* pCmdUI); afx_msg void OnOptionsVideoDdrawusevideomemory();
afx_msg void OnOptionsVideoDdrawemulationonly(); afx_msg void OnUpdateOptionsVideoDdrawusevideomemory(CCmdUI* pCmdUI);
afx_msg void OnUpdateOptionsVideoDdrawemulationonly(CCmdUI* pCmdUI); afx_msg void OnOptionsVideoRenderoptionsD3dnofilter();
afx_msg void OnOptionsVideoDdrawusevideomemory(); afx_msg void OnUpdateOptionsVideoRenderoptionsD3dnofilter(CCmdUI* pCmdUI);
afx_msg void OnUpdateOptionsVideoDdrawusevideomemory(CCmdUI* pCmdUI); afx_msg void OnOptionsVideoRenderoptionsD3dbilinear();
afx_msg void OnOptionsVideoRenderoptionsD3dnofilter(); afx_msg void OnUpdateOptionsVideoRenderoptionsD3dbilinear(CCmdUI* pCmdUI);
afx_msg void OnUpdateOptionsVideoRenderoptionsD3dnofilter(CCmdUI* pCmdUI); afx_msg void OnOptionsVideoRenderoptionsGlnearest();
afx_msg void OnOptionsVideoRenderoptionsD3dbilinear(); afx_msg void OnUpdateOptionsVideoRenderoptionsGlnearest(CCmdUI* pCmdUI);
afx_msg void OnUpdateOptionsVideoRenderoptionsD3dbilinear(CCmdUI* pCmdUI); afx_msg void OnOptionsVideoRenderoptionsGlbilinear();
afx_msg void OnOptionsVideoRenderoptionsGlnearest(); afx_msg void OnUpdateOptionsVideoRenderoptionsGlbilinear(CCmdUI* pCmdUI);
afx_msg void OnUpdateOptionsVideoRenderoptionsGlnearest(CCmdUI* pCmdUI); afx_msg void OnOptionsVideoRenderoptionsGltriangle();
afx_msg void OnOptionsVideoRenderoptionsGlbilinear(); afx_msg void OnUpdateOptionsVideoRenderoptionsGltriangle(CCmdUI* pCmdUI);
afx_msg void OnUpdateOptionsVideoRenderoptionsGlbilinear(CCmdUI* pCmdUI); afx_msg void OnOptionsVideoRenderoptionsGlquads();
afx_msg void OnOptionsVideoRenderoptionsGltriangle(); afx_msg void OnUpdateOptionsVideoRenderoptionsGlquads(CCmdUI* pCmdUI);
afx_msg void OnUpdateOptionsVideoRenderoptionsGltriangle(CCmdUI* pCmdUI); afx_msg void OnOptionsVideoRenderoptionsSelectskin();
afx_msg void OnOptionsVideoRenderoptionsGlquads(); afx_msg void OnUpdateOptionsVideoRenderoptionsSelectskin(CCmdUI* pCmdUI);
afx_msg void OnUpdateOptionsVideoRenderoptionsGlquads(CCmdUI* pCmdUI); afx_msg void OnOptionsVideoRenderoptionsSkin();
afx_msg void OnContextMenu(CWnd* pWnd, CPoint point); afx_msg void OnUpdateOptionsVideoRenderoptionsSkin(CCmdUI* pCmdUI);
afx_msg void OnOptionsEmulatorAssociate(); afx_msg void OnContextMenu(CWnd* pWnd, CPoint point);
afx_msg void OnOptionsEmulatorDirectories(); afx_msg void OnOptionsEmulatorAssociate();
afx_msg void OnOptionsEmulatorDisablestatusmessages(); afx_msg void OnOptionsEmulatorDirectories();
afx_msg void OnUpdateOptionsEmulatorDisablestatusmessages(CCmdUI* pCmdUI); afx_msg void OnOptionsEmulatorDisablestatusmessages();
afx_msg void OnOptionsEmulatorSynchronize(); afx_msg void OnUpdateOptionsEmulatorDisablestatusmessages(CCmdUI* pCmdUI);
afx_msg void OnUpdateOptionsEmulatorSynchronize(CCmdUI* pCmdUI); afx_msg void OnOptionsEmulatorSynchronize();
afx_msg void OnOptionsEmulatorPausewheninactive(); afx_msg void OnUpdateOptionsEmulatorSynchronize(CCmdUI* pCmdUI);
afx_msg void OnUpdateOptionsEmulatorPausewheninactive(CCmdUI* pCmdUI); afx_msg void OnOptionsEmulatorPausewheninactive();
afx_msg void OnOptionsEmulatorSpeeduptoggle(); afx_msg void OnUpdateOptionsEmulatorPausewheninactive(CCmdUI* pCmdUI);
afx_msg void OnUpdateOptionsEmulatorSpeeduptoggle(CCmdUI* pCmdUI); afx_msg void OnOptionsEmulatorSpeeduptoggle();
afx_msg void OnOptionsEmulatorRemoveintrosgba(); afx_msg void OnUpdateOptionsEmulatorSpeeduptoggle(CCmdUI* pCmdUI);
afx_msg void OnUpdateOptionsEmulatorRemoveintrosgba(CCmdUI* pCmdUI); afx_msg void OnOptionsEmulatorAutomaticallyipspatch();
afx_msg void OnOptionsEmulatorAutomaticallyipspatch(); afx_msg void OnUpdateOptionsEmulatorAutomaticallyipspatch(CCmdUI* pCmdUI);
afx_msg void OnUpdateOptionsEmulatorAutomaticallyipspatch(CCmdUI* pCmdUI); afx_msg void OnOptionsEmulatorAgbprint();
afx_msg void OnOptionsEmulatorAgbprint(); afx_msg void OnUpdateOptionsEmulatorAgbprint(CCmdUI* pCmdUI);
afx_msg void OnUpdateOptionsEmulatorAgbprint(CCmdUI* pCmdUI); afx_msg void OnOptionsEmulatorRealtimeclock();
afx_msg void OnOptionsEmulatorRealtimeclock(); afx_msg void OnUpdateOptionsEmulatorRealtimeclock(CCmdUI* pCmdUI);
afx_msg void OnUpdateOptionsEmulatorRealtimeclock(CCmdUI* pCmdUI); afx_msg void OnOptionsEmulatorGenericflashcard();
afx_msg void OnOptionsEmulatorAutohidemenu(); afx_msg void OnUpdateOptionsEmulatorGenericflashcard(CCmdUI* pCmdUI);
afx_msg void OnUpdateOptionsEmulatorAutohidemenu(CCmdUI* pCmdUI); afx_msg void OnOptionsEmulatorAutohidemenu();
afx_msg void OnOptionsEmulatorRewindinterval(); afx_msg void OnUpdateOptionsEmulatorAutohidemenu(CCmdUI* pCmdUI);
afx_msg void OnOptionsEmulatorSavetypeAutomatic(); afx_msg void OnOptionsEmulatorRewindinterval();
afx_msg void OnUpdateOptionsEmulatorSavetypeAutomatic(CCmdUI* pCmdUI); afx_msg void OnOptionsEmulatorSavetypeAutomatic();
afx_msg void OnOptionsEmulatorSavetypeEeprom(); afx_msg void OnUpdateOptionsEmulatorSavetypeAutomatic(CCmdUI* pCmdUI);
afx_msg void OnUpdateOptionsEmulatorSavetypeEeprom(CCmdUI* pCmdUI); afx_msg void OnOptionsEmulatorSavetypeEeprom();
afx_msg void OnOptionsEmulatorSavetypeSram(); afx_msg void OnUpdateOptionsEmulatorSavetypeEeprom(CCmdUI* pCmdUI);
afx_msg void OnUpdateOptionsEmulatorSavetypeSram(CCmdUI* pCmdUI); afx_msg void OnOptionsEmulatorSavetypeSram();
afx_msg void OnOptionsEmulatorSavetypeFlash(); afx_msg void OnUpdateOptionsEmulatorSavetypeSram(CCmdUI* pCmdUI);
afx_msg void OnUpdateOptionsEmulatorSavetypeFlash(CCmdUI* pCmdUI); afx_msg void OnOptionsEmulatorSavetypeFlash();
afx_msg void OnOptionsEmulatorSavetypeEepromsensor(); afx_msg void OnUpdateOptionsEmulatorSavetypeFlash(CCmdUI* pCmdUI);
afx_msg void OnUpdateOptionsEmulatorSavetypeEepromsensor(CCmdUI* pCmdUI); afx_msg void OnOptionsEmulatorSavetypeEepromsensor();
afx_msg void OnOptionsEmulatorSavetypeNone(); afx_msg void OnUpdateOptionsEmulatorSavetypeEepromsensor(CCmdUI* pCmdUI);
afx_msg void OnUpdateOptionsEmulatorSavetypeNone(CCmdUI* pCmdUI); afx_msg void OnOptionsEmulatorSavetypeNone();
afx_msg void OnOptionsEmulatorSavetypeFlash512k(); afx_msg void OnUpdateOptionsEmulatorSavetypeNone(CCmdUI* pCmdUI);
afx_msg void OnUpdateOptionsEmulatorSavetypeFlash512k(CCmdUI* pCmdUI); afx_msg void OnOptionsEmulatorSavetypeFlash512k();
afx_msg void OnOptionsEmulatorSavetypeFlash1m(); afx_msg void OnUpdateOptionsEmulatorSavetypeFlash512k(CCmdUI* pCmdUI);
afx_msg void OnUpdateOptionsEmulatorSavetypeFlash1m(CCmdUI* pCmdUI); afx_msg void OnOptionsEmulatorSavetypeFlash1m();
afx_msg void OnOptionsEmulatorUsebiosfile(); afx_msg void OnUpdateOptionsEmulatorSavetypeFlash1m(CCmdUI* pCmdUI);
afx_msg void OnUpdateOptionsEmulatorUsebiosfile(CCmdUI* pCmdUI); afx_msg void OnOptionsEmulatorUsebiosfile();
afx_msg void OnOptionsEmulatorSkipbios(); afx_msg void OnUpdateOptionsEmulatorUsebiosfile(CCmdUI* pCmdUI);
afx_msg void OnUpdateOptionsEmulatorSkipbios(CCmdUI* pCmdUI); afx_msg void OnOptionsEmulatorSkipbios();
afx_msg void OnOptionsEmulatorSelectbiosfile(); afx_msg void OnUpdateOptionsEmulatorSkipbios(CCmdUI* pCmdUI);
afx_msg void OnOptionsEmulatorPngformat(); afx_msg void OnOptionsEmulatorSelectbiosfile();
afx_msg void OnUpdateOptionsEmulatorPngformat(CCmdUI* pCmdUI); afx_msg void OnOptionsEmulatorPngformat();
afx_msg void OnOptionsEmulatorBmpformat(); afx_msg void OnUpdateOptionsEmulatorPngformat(CCmdUI* pCmdUI);
afx_msg void OnUpdateOptionsEmulatorBmpformat(CCmdUI* pCmdUI); afx_msg void OnOptionsEmulatorBmpformat();
afx_msg void OnOptionsSoundOff(); /* mute hax */ afx_msg void OnUpdateOptionsEmulatorBmpformat(CCmdUI* pCmdUI);
afx_msg void OnUpdateOptionsSoundOff(CCmdUI* pCmdUI); /* mute hax */ afx_msg void OnOptionsSoundOff();
afx_msg void OnOptionsSoundMute(); afx_msg void OnUpdateOptionsSoundOff(CCmdUI* pCmdUI);
afx_msg void OnUpdateOptionsSoundMute(CCmdUI* pCmdUI); afx_msg void OnOptionsSoundMute();
afx_msg void OnOptionsSoundOn(); afx_msg void OnUpdateOptionsSoundMute(CCmdUI* pCmdUI);
afx_msg void OnUpdateOptionsSoundOn(CCmdUI* pCmdUI); afx_msg void OnOptionsSoundOn();
afx_msg void OnOptionsSoundUseoldsynchronization(); afx_msg void OnUpdateOptionsSoundOn(CCmdUI* pCmdUI);
afx_msg void OnUpdateOptionsSoundUseoldsynchronization(CCmdUI* pCmdUI); afx_msg void OnOptionsSoundUseoldsynchronization();
afx_msg void OnOptionsSoundEcho(); afx_msg void OnUpdateOptionsSoundUseoldsynchronization(CCmdUI* pCmdUI);
afx_msg void OnUpdateOptionsSoundEcho(CCmdUI* pCmdUI); afx_msg void OnOptionsSoundEcho();
afx_msg void OnOptionsSoundLowpassfilter(); afx_msg void OnUpdateOptionsSoundEcho(CCmdUI* pCmdUI);
afx_msg void OnUpdateOptionsSoundLowpassfilter(CCmdUI* pCmdUI); afx_msg void OnOptionsSoundLowpassfilter();
afx_msg void OnOptionsSoundReversestereo(); afx_msg void OnUpdateOptionsSoundLowpassfilter(CCmdUI* pCmdUI);
afx_msg void OnUpdateOptionsSoundReversestereo(CCmdUI* pCmdUI); afx_msg void OnOptionsSoundReversestereo();
afx_msg void OnOptionsSound11khz(); afx_msg void OnUpdateOptionsSoundReversestereo(CCmdUI* pCmdUI);
afx_msg void OnUpdateOptionsSound11khz(CCmdUI* pCmdUI); afx_msg void OnOptionsSound11khz();
afx_msg void OnOptionsSound22khz(); afx_msg void OnUpdateOptionsSound11khz(CCmdUI* pCmdUI);
afx_msg void OnUpdateOptionsSound22khz(CCmdUI* pCmdUI); afx_msg void OnOptionsSound22khz();
afx_msg void OnOptionsSound44khz(); afx_msg void OnUpdateOptionsSound22khz(CCmdUI* pCmdUI);
afx_msg void OnUpdateOptionsSound44khz(CCmdUI* pCmdUI); afx_msg void OnOptionsSound44khz();
afx_msg void OnOptionsSoundChannel1(); afx_msg void OnUpdateOptionsSound44khz(CCmdUI* pCmdUI);
afx_msg void OnUpdateOptionsSoundChannel1(CCmdUI* pCmdUI); afx_msg void OnOptionsSoundChannel1();
afx_msg void OnOptionsSoundChannel2(); afx_msg void OnUpdateOptionsSoundChannel1(CCmdUI* pCmdUI);
afx_msg void OnUpdateOptionsSoundChannel2(CCmdUI* pCmdUI); afx_msg void OnOptionsSoundChannel2();
afx_msg void OnOptionsSoundChannel3(); afx_msg void OnUpdateOptionsSoundChannel2(CCmdUI* pCmdUI);
afx_msg void OnUpdateOptionsSoundChannel3(CCmdUI* pCmdUI); afx_msg void OnOptionsSoundChannel3();
afx_msg void OnOptionsSoundChannel4(); afx_msg void OnUpdateOptionsSoundChannel3(CCmdUI* pCmdUI);
afx_msg void OnUpdateOptionsSoundChannel4(CCmdUI* pCmdUI); afx_msg void OnOptionsSoundChannel4();
afx_msg void OnOptionsSoundDirectsounda(); afx_msg void OnUpdateOptionsSoundChannel4(CCmdUI* pCmdUI);
afx_msg void OnUpdateOptionsSoundDirectsounda(CCmdUI* pCmdUI); afx_msg void OnOptionsSoundDirectsounda();
afx_msg void OnOptionsSoundDirectsoundb(); afx_msg void OnUpdateOptionsSoundDirectsounda(CCmdUI* pCmdUI);
afx_msg void OnUpdateOptionsSoundDirectsoundb(CCmdUI* pCmdUI); afx_msg void OnOptionsSoundDirectsoundb();
afx_msg void OnOptionsGameboyBorder(); afx_msg void OnUpdateOptionsSoundDirectsoundb(CCmdUI* pCmdUI);
afx_msg void OnUpdateOptionsGameboyBorder(CCmdUI* pCmdUI); afx_msg void OnOptionsGameboyBorder();
afx_msg void OnOptionsGameboyPrinter(); afx_msg void OnUpdateOptionsGameboyBorder(CCmdUI* pCmdUI);
afx_msg void OnUpdateOptionsGameboyPrinter(CCmdUI* pCmdUI); afx_msg void OnOptionsGameboyPrinter();
afx_msg void OnOptionsGameboyBorderAutomatic(); afx_msg void OnUpdateOptionsGameboyPrinter(CCmdUI* pCmdUI);
afx_msg void OnUpdateOptionsGameboyBorderAutomatic(CCmdUI* pCmdUI); afx_msg void OnOptionsGameboyBorderAutomatic();
afx_msg void OnOptionsGameboyAutomatic(); afx_msg void OnUpdateOptionsGameboyBorderAutomatic(CCmdUI* pCmdUI);
afx_msg void OnUpdateOptionsGameboyAutomatic(CCmdUI* pCmdUI); afx_msg void OnOptionsGameboyAutomatic();
afx_msg void OnOptionsGameboyGba(); afx_msg void OnUpdateOptionsGameboyAutomatic(CCmdUI* pCmdUI);
afx_msg void OnUpdateOptionsGameboyGba(CCmdUI* pCmdUI); afx_msg void OnOptionsGameboyGba();
afx_msg void OnOptionsGameboyCgb(); afx_msg void OnUpdateOptionsGameboyGba(CCmdUI* pCmdUI);
afx_msg void OnUpdateOptionsGameboyCgb(CCmdUI* pCmdUI); afx_msg void OnOptionsGameboyCgb();
afx_msg void OnOptionsGameboySgb(); afx_msg void OnUpdateOptionsGameboyCgb(CCmdUI* pCmdUI);
afx_msg void OnUpdateOptionsGameboySgb(CCmdUI* pCmdUI); afx_msg void OnOptionsGameboySgb();
afx_msg void OnOptionsGameboySgb2(); afx_msg void OnUpdateOptionsGameboySgb(CCmdUI* pCmdUI);
afx_msg void OnUpdateOptionsGameboySgb2(CCmdUI* pCmdUI); afx_msg void OnOptionsGameboySgb2();
afx_msg void OnOptionsGameboyGb(); afx_msg void OnUpdateOptionsGameboySgb2(CCmdUI* pCmdUI);
afx_msg void OnUpdateOptionsGameboyGb(CCmdUI* pCmdUI); afx_msg void OnOptionsGameboyGb();
afx_msg void OnOptionsGameboyRealcolors(); afx_msg void OnUpdateOptionsGameboyGb(CCmdUI* pCmdUI);
afx_msg void OnUpdateOptionsGameboyRealcolors(CCmdUI* pCmdUI); afx_msg void OnOptionsGameboyRealcolors();
afx_msg void OnOptionsGameboyGameboycolors(); afx_msg void OnUpdateOptionsGameboyRealcolors(CCmdUI* pCmdUI);
afx_msg void OnUpdateOptionsGameboyGameboycolors(CCmdUI* pCmdUI); afx_msg void OnOptionsGameboyGameboycolors();
afx_msg void OnOptionsGameboyColors(); afx_msg void OnUpdateOptionsGameboyGameboycolors(CCmdUI* pCmdUI);
afx_msg void OnOptionsFilterDisablemmx(); afx_msg void OnOptionsGameboyColors();
afx_msg void OnUpdateOptionsFilterDisablemmx(CCmdUI* pCmdUI); afx_msg void OnOptionsFilterDisablemmx();
afx_msg void OnOptionsLanguageSystem(); afx_msg void OnUpdateOptionsFilterDisablemmx(CCmdUI* pCmdUI);
afx_msg void OnUpdateOptionsLanguageSystem(CCmdUI* pCmdUI); afx_msg void OnOptionsLanguageSystem();
afx_msg void OnOptionsLanguageEnglish(); afx_msg void OnUpdateOptionsLanguageSystem(CCmdUI* pCmdUI);
afx_msg void OnUpdateOptionsLanguageEnglish(CCmdUI* pCmdUI); afx_msg void OnOptionsLanguageEnglish();
afx_msg void OnOptionsLanguageOther(); afx_msg void OnUpdateOptionsLanguageEnglish(CCmdUI* pCmdUI);
afx_msg void OnUpdateOptionsLanguageOther(CCmdUI* pCmdUI); afx_msg void OnOptionsLanguageOther();
afx_msg void OnOptionsJoypadConfigure1(); afx_msg void OnUpdateOptionsLanguageOther(CCmdUI* pCmdUI);
afx_msg void OnUpdateOptionsJoypadConfigure1(CCmdUI* pCmdUI); afx_msg void OnOptionsJoypadConfigure1();
afx_msg void OnOptionsJoypadConfigure2(); afx_msg void OnUpdateOptionsJoypadConfigure1(CCmdUI* pCmdUI);
afx_msg void OnUpdateOptionsJoypadConfigure2(CCmdUI* pCmdUI); afx_msg void OnOptionsJoypadConfigure2();
afx_msg void OnOptionsJoypadConfigure3(); afx_msg void OnUpdateOptionsJoypadConfigure2(CCmdUI* pCmdUI);
afx_msg void OnUpdateOptionsJoypadConfigure3(CCmdUI* pCmdUI); afx_msg void OnOptionsJoypadConfigure3();
afx_msg void OnOptionsJoypadConfigure4(); afx_msg void OnUpdateOptionsJoypadConfigure3(CCmdUI* pCmdUI);
afx_msg void OnUpdateOptionsJoypadConfigure4(CCmdUI* pCmdUI); afx_msg void OnOptionsJoypadConfigure4();
afx_msg void OnOptionsJoypadMotionconfigure(); afx_msg void OnUpdateOptionsJoypadConfigure4(CCmdUI* pCmdUI);
afx_msg void OnUpdateOptionsJoypadMotionconfigure(CCmdUI* pCmdUI); afx_msg void OnOptionsJoypadMotionconfigure();
afx_msg void OnCheatsSearchforcheats(); afx_msg void OnUpdateOptionsJoypadMotionconfigure(CCmdUI* pCmdUI);
afx_msg void OnUpdateCheatsSearchforcheats(CCmdUI* pCmdUI); afx_msg void OnCheatsSearchforcheats();
afx_msg void OnCheatsCheatlist(); afx_msg void OnUpdateCheatsSearchforcheats(CCmdUI* pCmdUI);
afx_msg void OnUpdateCheatsCheatlist(CCmdUI* pCmdUI); afx_msg void OnCheatsCheatlist();
afx_msg void OnCheatsAutomaticsaveloadcheats(); afx_msg void OnUpdateCheatsCheatlist(CCmdUI* pCmdUI);
afx_msg void OnCheatsLoadcheatlist(); afx_msg void OnCheatsAutomaticsaveloadcheats();
afx_msg void OnUpdateCheatsLoadcheatlist(CCmdUI* pCmdUI); afx_msg void OnCheatsLoadcheatlist();
afx_msg void OnCheatsSavecheatlist(); afx_msg void OnUpdateCheatsLoadcheatlist(CCmdUI* pCmdUI);
afx_msg void OnUpdateCheatsSavecheatlist(CCmdUI* pCmdUI); afx_msg void OnCheatsSavecheatlist();
afx_msg void OnToolsDisassemble(); afx_msg void OnUpdateCheatsSavecheatlist(CCmdUI* pCmdUI);
afx_msg void OnUpdateToolsDisassemble(CCmdUI* pCmdUI); afx_msg void OnToolsDisassemble();
afx_msg void OnToolsLogging(); afx_msg void OnUpdateToolsDisassemble(CCmdUI* pCmdUI);
afx_msg void OnUpdateToolsLogging(CCmdUI* pCmdUI); afx_msg void OnToolsLogging();
afx_msg void OnToolsIoviewer(); afx_msg void OnUpdateToolsLogging(CCmdUI* pCmdUI);
afx_msg void OnUpdateToolsIoviewer(CCmdUI* pCmdUI); afx_msg void OnToolsIoviewer();
afx_msg void OnToolsMapview(); afx_msg void OnUpdateToolsIoviewer(CCmdUI* pCmdUI);
afx_msg void OnUpdateToolsMapview(CCmdUI* pCmdUI); afx_msg void OnToolsMapview();
afx_msg void OnToolsMemoryviewer(); afx_msg void OnUpdateToolsMapview(CCmdUI* pCmdUI);
afx_msg void OnUpdateToolsMemoryviewer(CCmdUI* pCmdUI); afx_msg void OnToolsMemoryviewer();
afx_msg void OnToolsOamviewer(); afx_msg void OnUpdateToolsMemoryviewer(CCmdUI* pCmdUI);
afx_msg void OnUpdateToolsOamviewer(CCmdUI* pCmdUI); afx_msg void OnToolsOamviewer();
afx_msg void OnToolsPaletteview(); afx_msg void OnUpdateToolsOamviewer(CCmdUI* pCmdUI);
afx_msg void OnUpdateToolsPaletteview(CCmdUI* pCmdUI); afx_msg void OnToolsPaletteview();
afx_msg void OnToolsTileviewer(); afx_msg void OnUpdateToolsPaletteview(CCmdUI* pCmdUI);
afx_msg void OnUpdateToolsTileviewer(CCmdUI* pCmdUI); afx_msg void OnToolsTileviewer();
afx_msg void OnDebugNextframe(); afx_msg void OnUpdateToolsTileviewer(CCmdUI* pCmdUI);
afx_msg void OnUpdateCheatsAutomaticsaveloadcheats(CCmdUI* pCmdUI); afx_msg void OnDebugNextframe();
afx_msg void OnToolsDebugGdb(); afx_msg void OnUpdateCheatsAutomaticsaveloadcheats(CCmdUI* pCmdUI);
afx_msg void OnUpdateToolsDebugGdb(CCmdUI* pCmdUI); afx_msg void OnToolsDebugGdb();
afx_msg void OnToolsDebugLoadandwait(); afx_msg void OnUpdateToolsDebugGdb(CCmdUI* pCmdUI);
afx_msg void OnUpdateToolsDebugLoadandwait(CCmdUI* pCmdUI); afx_msg void OnToolsDebugLoadandwait();
afx_msg void OnToolsDebugBreak(); afx_msg void OnUpdateToolsDebugLoadandwait(CCmdUI* pCmdUI);
afx_msg void OnUpdateToolsDebugBreak(CCmdUI* pCmdUI); afx_msg void OnToolsDebugBreak();
afx_msg void OnToolsDebugDisconnect(); afx_msg void OnUpdateToolsDebugBreak(CCmdUI* pCmdUI);
afx_msg void OnUpdateToolsDebugDisconnect(CCmdUI* pCmdUI); afx_msg void OnToolsDebugDisconnect();
afx_msg void OnOptionsSoundStartrecording(); afx_msg void OnUpdateToolsDebugDisconnect(CCmdUI* pCmdUI);
afx_msg void OnUpdateOptionsSoundStartrecording(CCmdUI* pCmdUI); afx_msg void OnOptionsSoundStartrecording();
afx_msg void OnOptionsSoundStoprecording(); afx_msg void OnUpdateOptionsSoundStartrecording(CCmdUI* pCmdUI);
afx_msg void OnUpdateOptionsSoundStoprecording(CCmdUI* pCmdUI); afx_msg void OnOptionsSoundStoprecording();
afx_msg void OnToolsRecordStartavirecording(); afx_msg void OnUpdateOptionsSoundStoprecording(CCmdUI* pCmdUI);
afx_msg void OnUpdateToolsRecordStartavirecording(CCmdUI* pCmdUI); afx_msg void OnToolsRecordStartavirecording();
afx_msg void OnToolsRecordStopavirecording(); afx_msg void OnUpdateToolsRecordStartavirecording(CCmdUI* pCmdUI);
afx_msg void OnUpdateToolsRecordStopavirecording(CCmdUI* pCmdUI); afx_msg void OnToolsRecordStopavirecording();
afx_msg void OnPaint(); afx_msg void OnUpdateToolsRecordStopavirecording(CCmdUI* pCmdUI);
afx_msg void OnToolsRecordStartmovierecording(); afx_msg void OnPaint();
afx_msg void OnUpdateToolsRecordStartmovierecording(CCmdUI* pCmdUI); afx_msg void OnToolsRecordStartmovierecording();
afx_msg void OnToolsRecordStopmovierecording(); afx_msg void OnUpdateToolsRecordStartmovierecording(CCmdUI* pCmdUI);
afx_msg void OnUpdateToolsRecordStopmovierecording(CCmdUI* pCmdUI); afx_msg void OnToolsRecordStopmovierecording();
afx_msg void OnToolsPlayStartmovieplaying(); afx_msg void OnUpdateToolsRecordStopmovierecording(CCmdUI* pCmdUI);
afx_msg void OnUpdateToolsPlayStartmovieplaying(CCmdUI* pCmdUI); afx_msg void OnToolsPlayStartmovieplaying();
afx_msg void OnToolsPlayStopmovieplaying(); afx_msg void OnUpdateToolsPlayStartmovieplaying(CCmdUI* pCmdUI);
afx_msg void OnUpdateToolsPlayStopmovieplaying(CCmdUI* pCmdUI); afx_msg void OnToolsPlayStopmovieplaying();
afx_msg void OnToolsRewind(); afx_msg void OnUpdateToolsPlayStopmovieplaying(CCmdUI* pCmdUI);
afx_msg void OnUpdateToolsRewind(CCmdUI* pCmdUI); afx_msg void OnToolsRewind();
afx_msg void OnToolsCustomize(); afx_msg void OnUpdateToolsRewind(CCmdUI* pCmdUI);
afx_msg void OnUpdateToolsCustomize(CCmdUI* pCmdUI); afx_msg void OnToolsCustomize();
afx_msg void OnHelpBugreport(); afx_msg void OnUpdateToolsCustomize(CCmdUI* pCmdUI);
afx_msg void OnMouseMove(UINT nFlags, CPoint point); afx_msg void OnHelpBugreport();
afx_msg void OnInitMenu(CMenu* pMenu); afx_msg void OnMouseMove(UINT nFlags, CPoint point);
afx_msg void OnActivate(UINT nState, CWnd* pWndOther, BOOL bMinimized); afx_msg void OnInitMenu(CMenu* pMenu);
#if _MSC_VER <= 1200 afx_msg void OnActivate(UINT nState, CWnd* pWndOther, BOOL bMinimized);
afx_msg void OnActivateApp(BOOL bActive, HTASK hTask); #if _MSC_VER <= 1200
#else afx_msg void OnActivateApp(BOOL bActive, HTASK hTask);
afx_msg void OnActivateApp(BOOL bActive, DWORD hTask); #else
#endif afx_msg void OnActivateApp(BOOL bActive, DWORD hTask);
afx_msg void OnDropFiles(HDROP hDropInfo); #endif
afx_msg void OnFileSavegameOldestslot(); afx_msg void OnDropFiles(HDROP hDropInfo);
afx_msg void OnUpdateFileSavegameOldestslot(CCmdUI* pCmdUI); afx_msg void OnFileSavegameOldestslot();
afx_msg void OnFileLoadgameMostrecent(); afx_msg void OnUpdateFileSavegameOldestslot(CCmdUI* pCmdUI);
afx_msg void OnUpdateFileLoadgameMostrecent(CCmdUI* pCmdUI); afx_msg void OnFileLoadgameMostrecent();
afx_msg void OnFileLoadgameAutoloadmostrecent(); afx_msg void OnUpdateFileLoadgameMostrecent(CCmdUI* pCmdUI);
afx_msg void OnUpdateFileLoadgameAutoloadmostrecent(CCmdUI* pCmdUI); afx_msg void OnFileLoadgameAutoloadmostrecent();
afx_msg void OnOptionsSoundVolume25x(); afx_msg void OnUpdateFileLoadgameAutoloadmostrecent(CCmdUI* pCmdUI);
afx_msg void OnUpdateOptionsSoundVolume25x(CCmdUI* pCmdUI); afx_msg void OnOptionsSoundVolume25x();
afx_msg void OnOptionsSoundVolume5x(); afx_msg void OnUpdateOptionsSoundVolume25x(CCmdUI* pCmdUI);
afx_msg void OnUpdateOptionsSoundVolume5x(CCmdUI* pCmdUI); afx_msg void OnOptionsSoundVolume5x();
afx_msg void OnCheatsDisablecheats(); afx_msg void OnUpdateOptionsSoundVolume5x(CCmdUI* pCmdUI);
afx_msg void OnUpdateCheatsDisablecheats(CCmdUI* pCmdUI); afx_msg void OnCheatsDisablecheats();
afx_msg void OnOptionsVideoFullscreenmaxscale(); afx_msg void OnUpdateCheatsDisablecheats(CCmdUI* pCmdUI);
//}}AFX_MSG afx_msg void OnOptionsVideoFullscreenmaxscale();
DECLARE_MESSAGE_MAP() afx_msg void OnOptionsEmulatorGameoverrides();
afx_msg void OnUpdateOptionsEmulatorGameoverrides(CCmdUI* pCmdUI);
afx_msg BOOL OnFileRecentFile(UINT nID); afx_msg void OnHelpGnupubliclicense();
afx_msg BOOL OnFileLoadSlot(UINT nID); //}}AFX_MSG
afx_msg BOOL OnFileSaveSlot(UINT nID); DECLARE_MESSAGE_MAP()
afx_msg void OnOptionsFilterLcdcolors();
afx_msg void OnUpdateOptionsFilterLcdcolors(CCmdUI *pCmdUI); afx_msg BOOL OnFileRecentFile(UINT nID);
afx_msg BOOL OnFileLoadSlot(UINT nID);
afx_msg BOOL OnOptionsSoundPcminterpolation(UINT nID); afx_msg BOOL OnFileSaveSlot(UINT nID);
afx_msg void OnUpdateOptionsSoundPcminterpolation(CCmdUI *pCmdUI); afx_msg void OnOptionsFilterLcdcolors();
public: afx_msg void OnUpdateOptionsFilterLcdcolors(CCmdUI *pCmdUI);
afx_msg void OnOptionsVideoFullscreen1280x1024();
afx_msg void OnOptionsVideoFullscreen1024x768(); afx_msg BOOL OnOptionsSoundPcminterpolation(UINT nID);
afx_msg void OnUpdateOptionsVideoFullscreen1024x768(CCmdUI *pCmdUI); afx_msg void OnUpdateOptionsSoundPcminterpolation(CCmdUI *pCmdUI);
afx_msg void OnUpdateOptionsVideoFullscreen1280x1024(CCmdUI *pCmdUI); public:
void OnLinkOptions(); afx_msg void OnOptionsSoundHardwareacceleration();
void OnOptionsLinkLog() ; afx_msg void OnUpdateOptionsSoundHardwareacceleration(CCmdUI *pCmdUI);
void OnUpdateOptionsLinkLog(CCmdUI* pCmdUI) ; afx_msg void OnOptionsVideoFullscreen1280x1024();
void OnOptionsLinkRFU() ; afx_msg void OnOptionsVideoFullscreen1024x768();
void OnUpdateOptionsLinkRFU(CCmdUI* pCmdUI) ; afx_msg void OnUpdateOptionsVideoFullscreen1024x768(CCmdUI *pCmdUI);
afx_msg void OnUpdateOptionsVideoFullscreen1280x1024(CCmdUI *pCmdUI);
void OnLinkOptions();
void OnOptionsLinkLog() ;
}; void OnUpdateOptionsLinkLog(CCmdUI* pCmdUI) ;
void OnOptionsLinkRFU() ;
///////////////////////////////////////////////////////////////////////////// void OnUpdateOptionsLinkRFU(CCmdUI* pCmdUI) ;
//{{AFX_INSERT_LOCATION}} };
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
/////////////////////////////////////////////////////////////////////////////
#endif // !defined(AFX_MAINWND_H__E8AD28B9_C9FB_4EC2_A2DC_DD1BBA55A275__INCLUDED_)
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_MAINWND_H__E8AD28B9_C9FB_4EC2_A2DC_DD1BBA55A275__INCLUDED_)

File diff suppressed because it is too large Load Diff

View File

@ -44,3 +44,9 @@ void MainWnd::OnHelpBugreport()
dlg.DoModal(); dlg.DoModal();
} }
void MainWnd::OnHelpGnupubliclicense()
{
::ShellExecute(0, _T("open"), "http://www.gnu.org/licenses/gpl.html",
0, 0, SW_SHOWNORMAL);
}

File diff suppressed because it is too large Load Diff

View File

@ -51,7 +51,7 @@ static char THIS_FILE[] = __FILE__;
extern bool debugger; extern bool debugger;
extern int emulating; extern int emulating;
extern int remoteSocket; extern SOCKET remoteSocket;
extern void remoteCleanUp(); extern void remoteCleanUp();
extern void remoteSetSockets(SOCKET, SOCKET); extern void remoteSetSockets(SOCKET, SOCKET);
@ -205,7 +205,7 @@ void MainWnd::OnToolsDebugGdb()
remoteSetSockets(wait.getListenSocket(), wait.getSocket()); remoteSetSockets(wait.getListenSocket(), wait.getSocket());
debugger = true; debugger = true;
emulating = 1; emulating = 1;
theApp.cartridgeType = 0; theApp.cartridgeType = IMAGE_GBA;
theApp.filename = "\\gnu_stub"; theApp.filename = "\\gnu_stub";
rom = (u8 *)malloc(0x2000000); rom = (u8 *)malloc(0x2000000);
workRAM = (u8 *)calloc(1, 0x40000); workRAM = (u8 *)calloc(1, 0x40000);
@ -214,7 +214,7 @@ void MainWnd::OnToolsDebugGdb()
paletteRAM = (u8 *)calloc(1,0x400); paletteRAM = (u8 *)calloc(1,0x400);
vram = (u8 *)calloc(1, 0x20000); vram = (u8 *)calloc(1, 0x20000);
oam = (u8 *)calloc(1, 0x400); oam = (u8 *)calloc(1, 0x400);
pix = (u8 *)calloc(1, 4 * 240 * 160); pix = (u8 *)calloc(1, 4 * 241 * 162);
ioMem = (u8 *)calloc(1, 0x400); ioMem = (u8 *)calloc(1, 0x400);
theApp.emulator = GBASystem; theApp.emulator = GBASystem;

Some files were not shown because too many files have changed in this diff Show More