Initial version of the GTK GUI (forwardported from VBA's CVS)
This commit is contained in:
parent
9321a15300
commit
65d9ca1d92
|
@ -0,0 +1,192 @@
|
|||
SET(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/CMakeScripts)
|
||||
INCLUDE(CMakeScripts/CMakeDetermineASMCompiler.cmake)
|
||||
INCLUDE(CMakeScripts/CMakeASMInformation.cmake)
|
||||
|
||||
PROJECT(VBA-M ASM C CXX)
|
||||
|
||||
FIND_PACKAGE ( ZLIB REQUIRED )
|
||||
FIND_PACKAGE ( PNG REQUIRED )
|
||||
FIND_PACKAGE ( OpenGL REQUIRED )
|
||||
FIND_PACKAGE ( PkgConfig REQUIRED )
|
||||
|
||||
PKG_CHECK_MODULES ( GTKMM gtkmm-2.4 )
|
||||
PKG_CHECK_MODULES ( GLIBMM glibmm-2.4 )
|
||||
PKG_CHECK_MODULES ( GLADEMM libglademm-2.4 )
|
||||
PKG_CHECK_MODULES ( PORTAUDIO portaudio-2.0 )
|
||||
PKG_CHECK_MODULES ( SDL sdl )
|
||||
|
||||
IF(${SDL_FOUND})
|
||||
SET( CAN_BUILD_VBAM 1 )
|
||||
ELSE(${SDL_FOUND})
|
||||
SET( CAN_BUILD_VBAM 0 )
|
||||
ENDIF(${SDL_FOUND})
|
||||
|
||||
IF(${GLIBMM_FOUND} AND ${GTKMM_FOUND} AND ${GLADEMM_FOUND} AND ${PORTAUDIO_FOUND})
|
||||
SET( CAN_BUILD_GVBAM 1 )
|
||||
ELSE(${GLIBMM_FOUND} AND ${GTKMM_FOUND} AND ${GLADEMM_FOUND} AND ${PORTAUDIO_FOUND})
|
||||
SET( CAN_BUILD_GVBAM 0 )
|
||||
ENDIF(${GLIBMM_FOUND} AND ${GTKMM_FOUND} AND ${GLADEMM_FOUND} AND ${PORTAUDIO_FOUND})
|
||||
|
||||
ADD_DEFINITIONS (-DHAVE_NETINET_IN_H -DHAVE_ARPA_INET_H -DHAVE_ZLIB_H -DFINAL_VERSION -DBKPT_SUPPORT -DSDL -DUSE_OPENGL -DC_CORE -DSYSCONFDIR='"/etc"')
|
||||
|
||||
ADD_DEFINITIONS (-DVERSION='"1.8.0"' -DPKGDATADIR='"src/gtk"' -DPACKAGE='')
|
||||
|
||||
SET( CMAKE_ASM_FLAGS "-Isrc/hq/asm/ -O1 -DELF")
|
||||
SET( CMAKE_C_FLAGS "-O3")
|
||||
SET( CMAKE_CXX_FLAGS "-O3")
|
||||
|
||||
SET(SRC_MAIN
|
||||
src/2xSaI.cpp
|
||||
src/admame.cpp
|
||||
src/armdis.cpp
|
||||
src/bilinear.cpp
|
||||
src/bios.cpp
|
||||
src/Cheats.cpp
|
||||
src/CheatSearch.cpp
|
||||
src/EEprom.cpp src/elf.cpp
|
||||
src/Flash.cpp
|
||||
src/Globals.cpp
|
||||
src/interframe.cpp
|
||||
src/hq2x.cpp
|
||||
src/Mode0.cpp
|
||||
src/Mode1.cpp
|
||||
src/Mode2.cpp
|
||||
src/Mode3.cpp
|
||||
src/Mode4.cpp
|
||||
src/Mode5.cpp
|
||||
src/pixel.cpp
|
||||
src/remote.cpp
|
||||
src/RTC.cpp
|
||||
src/scanline.cpp
|
||||
src/Sound.cpp
|
||||
src/Sram.cpp
|
||||
src/Util.cpp
|
||||
src/expr.cpp
|
||||
src/exprNode.cpp
|
||||
src/expr-lex.cpp
|
||||
src/memgzio.c
|
||||
)
|
||||
|
||||
SET(SRC_AGB
|
||||
src/agb/agbprint.cpp
|
||||
src/agb/GBA.cpp
|
||||
src/agb/gbafilter.cpp
|
||||
src/agb/GBAGfx.cpp
|
||||
src/agb/GBA-thumb.cpp
|
||||
src/agb/GBA-arm.cpp
|
||||
)
|
||||
|
||||
SET(SRC_DMG
|
||||
src/dmg/GB.cpp
|
||||
src/dmg/gbCheats.cpp
|
||||
src/dmg/gbDis.cpp
|
||||
src/dmg/gbGfx.cpp
|
||||
src/dmg/gbGlobals.cpp
|
||||
src/dmg/gbMemory.cpp
|
||||
src/dmg/gbPrinter.cpp
|
||||
src/dmg/gbSGB.cpp
|
||||
src/dmg/gbSound.cpp
|
||||
src/dmg/gb_apu/Blip_Buffer.cpp
|
||||
src/dmg/gb_apu/Effects_Buffer.cpp
|
||||
src/dmg/gb_apu/Gb_Apu.cpp
|
||||
src/dmg/gb_apu/Gb_Apu_State.cpp
|
||||
src/dmg/gb_apu/Gb_Oscs.cpp
|
||||
src/dmg/gb_apu/Multi_Buffer.cpp
|
||||
)
|
||||
|
||||
SET(SRC_SDL
|
||||
src/sdl/debugger.cpp
|
||||
src/sdl/SDL.cpp
|
||||
src/sdl/dummy.cpp
|
||||
src/sdl/filters.cpp
|
||||
src/sdl/text.cpp
|
||||
src/sdl/sndSDL.cpp
|
||||
)
|
||||
|
||||
SET(SRC_FEX_MINI
|
||||
src/fex_mini.cpp
|
||||
)
|
||||
|
||||
SET(SRC_HQ_C
|
||||
src/hq/c/hq_implementation.cpp
|
||||
)
|
||||
|
||||
SET(SRC_HQ_ASM
|
||||
src/hq/asm/hq3x_16.asm
|
||||
src/hq/asm/hq3x_32.asm
|
||||
src/hq/asm/hq4x_16.asm
|
||||
src/hq/asm/hq4x_32.asm
|
||||
src/hq/asm/hq3x32.cpp
|
||||
)
|
||||
|
||||
SET(SRC_GTK
|
||||
src/gtk/configfile.cpp
|
||||
src/gtk/input.cpp
|
||||
src/gtk/main.cpp
|
||||
src/gtk/system.cpp
|
||||
src/gtk/windowcallbacks.cpp
|
||||
src/gtk/filters.cpp
|
||||
src/gtk/joypadconfig.cpp
|
||||
src/gtk/screenarea.cpp
|
||||
src/gtk/tools.cpp
|
||||
src/gtk/window.cpp
|
||||
src/gtk/sndPortAudio.cpp
|
||||
)
|
||||
|
||||
IF(CMAKE_ASM_COMPILER_LOADED)
|
||||
SET(SRC_HQ ${SRC_HQ_ASM})
|
||||
ELSE(CMAKE_ASM_COMPILER_LOADED)
|
||||
SET(SRC_HQ ${SRC_HQ_C})
|
||||
ENDIF(CMAKE_ASM_COMPILER_LOADED)
|
||||
|
||||
include_directories(
|
||||
${GTKMM_INCLUDE_DIRS}
|
||||
${GLADEMM_INCLUDE_DIRS}
|
||||
${SDL_INCLUDE_DIR}
|
||||
)
|
||||
|
||||
ADD_LIBRARY (
|
||||
vbamcore
|
||||
${PROJECT_SRCS}
|
||||
${SRC_MAIN}
|
||||
${SRC_AGB}
|
||||
${SRC_DMG}
|
||||
${SRC_FEX_MINI}
|
||||
)
|
||||
|
||||
IF(${CAN_BUILD_VBAM})
|
||||
ADD_EXECUTABLE (
|
||||
vbam
|
||||
WIN32
|
||||
MACOSX_BUNDLE
|
||||
${SRC_SDL}
|
||||
${SRC_HQ}
|
||||
)
|
||||
|
||||
TARGET_LINK_LIBRARIES (
|
||||
vbam
|
||||
vbamcore
|
||||
${SDL_LIBRARIES}
|
||||
${ZLIB_LIBRARY}
|
||||
${PNG_LIBRARY}
|
||||
${OPENGL_LIBRARY}
|
||||
)
|
||||
ENDIF(${CAN_BUILD_VBAM})
|
||||
|
||||
IF(${CAN_BUILD_GVBAM})
|
||||
ADD_EXECUTABLE (
|
||||
gvbam
|
||||
WIN32
|
||||
MACOSX_BUNDLE
|
||||
${SRC_GTK}
|
||||
)
|
||||
|
||||
TARGET_LINK_LIBRARIES (
|
||||
gvbam
|
||||
vbamcore
|
||||
${ZLIB_LIBRARY}
|
||||
${PNG_LIBRARY}
|
||||
${GLADEMM_LIBRARIES}
|
||||
${PORTAUDIO_LIBRARIES}
|
||||
)
|
||||
ENDIF(${CAN_BUILD_GVBAM})
|
|
@ -0,0 +1,12 @@
|
|||
SET(CMAKE_ASM_COMPILER "@CMAKE_ASM_COMPILER@")
|
||||
SET(CMAKE_ASM_COMPILER_LOADED 1)
|
||||
SET(CMAKE_ASM_COMPILER_ENV_VAR "ASM")
|
||||
|
||||
SET(CMAKE_ASM_SOURCE_FILE_EXTENSIONS nasm;asm;nas)
|
||||
SET(CMAKE_ASM_IGNORE_EXTENSIONS h;H;o;O;obj;OBJ;def;DEF;rc;RC)
|
||||
SET(CMAKE_ASM_LINKER_PREFERENCE None)
|
||||
IF(UNIX)
|
||||
SET(CMAKE_ASM_OUTPUT_EXTENSION .o)
|
||||
ELSE(UNIX)
|
||||
SET(CMAKE_ASM_OUTPUT_EXTENSION .obj)
|
||||
ENDIF(UNIX)
|
|
@ -0,0 +1,11 @@
|
|||
IF(NOT CMAKE_ASM_COMPILE_OBJECT)
|
||||
IF(UNIX AND NOT CYGWIN)
|
||||
SET(CMAKE_ASM_COMPILE_OBJECT "<CMAKE_ASM_COMPILER> -f elf <FLAGS> -o <OBJECT> <SOURCE>")
|
||||
ENDIF(UNIX AND NOT CYGWIN)
|
||||
IF(CYGWIN)
|
||||
SET(CMAKE_ASM_COMPILE_OBJECT "<CMAKE_ASM_COMPILER> -f gnuwin32 <FLAGS> -o <OBJECT> <SOURCE>")
|
||||
ENDIF(CYGWIN)
|
||||
IF(WIN32)
|
||||
SET(CMAKE_ASM_COMPILE_OBJECT "<CMAKE_ASM_COMPILER> -f win32 -DWIN32 <FLAGS> -o <OBJECT> -c <SOURCE>")
|
||||
ENDIF(WIN32)
|
||||
ENDIF(NOT CMAKE_ASM_COMPILE_OBJECT)
|
|
@ -0,0 +1,11 @@
|
|||
IF(NOT CMAKE_ASM_COMPILER)
|
||||
FIND_PROGRAM(CMAKE_ASM_COMPILER NAMES nasm )
|
||||
ENDIF(NOT CMAKE_ASM_COMPILER)
|
||||
MARK_AS_ADVANCED(CMAKE_ASM_COMPILER)
|
||||
|
||||
# configure variables set in this file for fast reload later on
|
||||
CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/CMakeScripts/CMakeASMCompiler.cmake.in
|
||||
${CMAKE_BINARY_DIR}/CMakeFiles/CMakeASMCompiler.cmake
|
||||
IMMEDIATE)
|
||||
|
||||
SET(CMAKE_ASM_COMPILER_ENV_VAR "ASM")
|
|
@ -127,6 +127,7 @@ extern int systemVerbose;
|
|||
extern int systemFrameSkip;
|
||||
extern int systemSaveUpdateCounter;
|
||||
extern int systemSpeed;
|
||||
extern int systemThrottle;
|
||||
|
||||
#define SYSTEM_SAVE_UPDATED 30
|
||||
#define SYSTEM_SAVE_NOT_UPDATED 0
|
||||
|
|
|
@ -0,0 +1,262 @@
|
|||
// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator.
|
||||
// Copyright (C) 1999-2003 Forgotten
|
||||
// Copyright (C) 2004 Forgotten and the VBA development team
|
||||
|
||||
// This program is free software; you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation; either version 2, or(at your option)
|
||||
// any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program; if not, write to the Free Software Foundation,
|
||||
// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
#include "configfile.h"
|
||||
|
||||
#include <string.h>
|
||||
#include <glib.h>
|
||||
|
||||
#include <glibmm/fileutils.h>
|
||||
#include <glibmm/iochannel.h>
|
||||
|
||||
namespace VBA
|
||||
{
|
||||
namespace Config
|
||||
{
|
||||
|
||||
using std::string;
|
||||
using Glib::IOChannel;
|
||||
|
||||
Line::Line(const string & _rsKey, const string & _rsValue) :
|
||||
m_sKey(_rsKey),
|
||||
m_sValue(_rsValue)
|
||||
{
|
||||
}
|
||||
|
||||
Section::Section(const string & _rsName) :
|
||||
m_sName(_rsName)
|
||||
{
|
||||
}
|
||||
|
||||
bool Section::bKeyExists(const string & _rsKey)
|
||||
{
|
||||
for (iterator it = begin(); it != end(); it++)
|
||||
{
|
||||
if (it->m_sKey == _rsKey)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void Section::vSetKey(const string & _rsKey, const string & _rsValue)
|
||||
{
|
||||
for (iterator it = begin(); it != end(); it++)
|
||||
{
|
||||
if (it->m_sKey == _rsKey)
|
||||
{
|
||||
it->m_sValue = _rsValue;
|
||||
return;
|
||||
}
|
||||
}
|
||||
push_back(Line(_rsKey, _rsValue));
|
||||
}
|
||||
|
||||
string Section::sGetKey(const string & _rsKey) const
|
||||
{
|
||||
for (const_iterator it = begin(); it != end(); it++)
|
||||
{
|
||||
if (it->m_sKey == _rsKey)
|
||||
{
|
||||
return it->m_sValue;
|
||||
}
|
||||
}
|
||||
throw KeyNotFound(m_sName, _rsKey);
|
||||
}
|
||||
|
||||
void Section::vRemoveKey(const string & _rsKey)
|
||||
{
|
||||
for (iterator it = begin(); it != end(); it++)
|
||||
{
|
||||
if (it->m_sKey == _rsKey)
|
||||
{
|
||||
erase(it);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
File::File()
|
||||
{
|
||||
}
|
||||
|
||||
File::File(const string & _rsFile)
|
||||
{
|
||||
vLoad(_rsFile);
|
||||
}
|
||||
|
||||
File::~File()
|
||||
{
|
||||
}
|
||||
|
||||
bool File::bSectionExists(const string & _rsName)
|
||||
{
|
||||
for (iterator it = begin(); it != end(); it++)
|
||||
{
|
||||
if (it->sGetName() == _rsName)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
Section * File::poAddSection(const string & _rsName)
|
||||
{
|
||||
Section * poSection = NULL;
|
||||
for (iterator it = begin(); it != end(); it++)
|
||||
{
|
||||
if (it->sGetName() == _rsName)
|
||||
{
|
||||
poSection = &(*it);
|
||||
}
|
||||
}
|
||||
if (poSection == NULL)
|
||||
{
|
||||
push_back(Section(_rsName));
|
||||
poSection = &back();
|
||||
}
|
||||
return poSection;
|
||||
}
|
||||
|
||||
Section * File::poGetSection(const string & _rsName)
|
||||
{
|
||||
for (iterator it = begin(); it != end(); it++)
|
||||
{
|
||||
if (it->sGetName() == _rsName)
|
||||
{
|
||||
return &(*it);
|
||||
}
|
||||
}
|
||||
throw SectionNotFound(_rsName);
|
||||
}
|
||||
|
||||
void File::vRemoveSection(const string & _rsName)
|
||||
{
|
||||
for (iterator it = begin(); it != end(); it++)
|
||||
{
|
||||
if (it->sGetName() == _rsName)
|
||||
{
|
||||
erase(it);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void File::vLoad(const string & _rsFile,
|
||||
bool _bAddSection,
|
||||
bool _bAddKey)
|
||||
{
|
||||
string sBuffer = Glib::file_get_contents(_rsFile);
|
||||
Section * poSection = NULL;
|
||||
char ** lines = g_strsplit(sBuffer.c_str(), "\n", 0);
|
||||
char * tmp;
|
||||
int i = 0;
|
||||
while (lines[i])
|
||||
{
|
||||
if (lines[i][0] == '[')
|
||||
{
|
||||
if ((tmp = strchr(lines[i], ']')))
|
||||
{
|
||||
*tmp = '\0';
|
||||
if (_bAddSection)
|
||||
{
|
||||
poSection = poAddSection(&lines[i][1]);
|
||||
}
|
||||
else
|
||||
{
|
||||
try
|
||||
{
|
||||
poSection = poGetSection(&lines[i][1]);
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
poSection = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (lines[i][0] != '#' && poSection != NULL)
|
||||
{
|
||||
if ((tmp = strchr(lines[i], '=')))
|
||||
{
|
||||
*tmp = '\0';
|
||||
tmp++;
|
||||
if (_bAddKey || poSection->bKeyExists(lines[i]))
|
||||
{
|
||||
poSection->vSetKey(lines[i], tmp);
|
||||
}
|
||||
}
|
||||
}
|
||||
i++;
|
||||
}
|
||||
g_strfreev(lines);
|
||||
}
|
||||
|
||||
void File::vSave(const string & _rsFile)
|
||||
{
|
||||
Glib::RefPtr<IOChannel> poFile = IOChannel::create_from_file(_rsFile, "w");
|
||||
poFile->set_encoding("");
|
||||
|
||||
for (const_iterator poSection = begin();
|
||||
poSection != end();
|
||||
poSection++)
|
||||
{
|
||||
string sName = "[" + poSection->sGetName() + "]\n";
|
||||
poFile->write(sName);
|
||||
|
||||
for (Section::const_iterator poLine = poSection->begin();
|
||||
poLine != poSection->end();
|
||||
poLine++)
|
||||
{
|
||||
string sLine = poLine->m_sKey + "=" + poLine->m_sValue + "\n";
|
||||
poFile->write(sLine);
|
||||
}
|
||||
poFile->write("\n");
|
||||
}
|
||||
}
|
||||
|
||||
void File::vClear()
|
||||
{
|
||||
clear();
|
||||
}
|
||||
|
||||
std::ostream & operator<<(std::ostream & _roOut, const File & _roFile)
|
||||
{
|
||||
for (File::const_iterator poSection = _roFile.begin();
|
||||
poSection != _roFile.end();
|
||||
poSection++)
|
||||
{
|
||||
string sName = "[" + poSection->sGetName() + "]\n";
|
||||
_roOut << sName;
|
||||
|
||||
for (Section::const_iterator poLine = poSection->begin();
|
||||
poLine != poSection->end();
|
||||
poLine++)
|
||||
{
|
||||
string sLine = poLine->m_sKey + "=" + poLine->m_sValue + "\n";
|
||||
_roOut << sLine;
|
||||
}
|
||||
_roOut << "\n";
|
||||
}
|
||||
return _roOut;
|
||||
}
|
||||
|
||||
} // namespace Config
|
||||
} // namespace VBA
|
|
@ -0,0 +1,204 @@
|
|||
// -*- 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 __VBA_CONFIGFILE_H__
|
||||
#define __VBA_CONFIGFILE_H__
|
||||
|
||||
#include <list>
|
||||
#include <string>
|
||||
#include <sstream>
|
||||
#include <ostream>
|
||||
|
||||
namespace VBA
|
||||
{
|
||||
namespace Config
|
||||
{
|
||||
|
||||
class NotFound
|
||||
{
|
||||
public:
|
||||
virtual ~NotFound() {}
|
||||
|
||||
protected:
|
||||
NotFound() {}
|
||||
};
|
||||
|
||||
class SectionNotFound : public NotFound
|
||||
{
|
||||
public:
|
||||
SectionNotFound(const std::string & _rsName) :
|
||||
m_sName(_rsName)
|
||||
{
|
||||
}
|
||||
virtual ~SectionNotFound() {}
|
||||
|
||||
inline std::string sGetName() const { return m_sName; }
|
||||
|
||||
private:
|
||||
std::string m_sName;
|
||||
};
|
||||
|
||||
class KeyNotFound : public NotFound
|
||||
{
|
||||
public:
|
||||
KeyNotFound(const std::string & _rsSection, const std::string & _rsKey) :
|
||||
m_sSection(_rsSection),
|
||||
m_sKey(_rsKey)
|
||||
{
|
||||
}
|
||||
virtual ~KeyNotFound() {}
|
||||
|
||||
inline std::string sGetSection() const { return m_sSection; }
|
||||
inline std::string sGetKey() const { return m_sKey; }
|
||||
|
||||
private:
|
||||
std::string m_sSection;
|
||||
std::string m_sKey;
|
||||
};
|
||||
|
||||
class Line
|
||||
{
|
||||
public:
|
||||
Line(const std::string & _rsKey, const std::string & _rsValue);
|
||||
|
||||
std::string m_sKey;
|
||||
std::string m_sValue;
|
||||
};
|
||||
|
||||
class Section : private std::list<Line>
|
||||
{
|
||||
public:
|
||||
explicit Section(const std::string & _rsName);
|
||||
|
||||
inline std::string sGetName() const { return m_sName; }
|
||||
|
||||
bool bKeyExists(const std::string & _rsKey);
|
||||
void vSetKey(const std::string & _rsKey, const std::string & _rsValue);
|
||||
std::string sGetKey(const std::string & _rsKey) const;
|
||||
void vRemoveKey(const std::string & _rsKey);
|
||||
|
||||
template<typename T>
|
||||
void vSetKey(const std::string & _rsKey, const T & _rValue);
|
||||
|
||||
template<typename T>
|
||||
T oGetKey(const std::string & _rsKey) const;
|
||||
|
||||
// read only
|
||||
typedef std::list<Line>::const_iterator const_iterator;
|
||||
inline const_iterator begin() const
|
||||
{
|
||||
return std::list<Line>::begin();
|
||||
}
|
||||
inline const_iterator end() const
|
||||
{
|
||||
return std::list<Line>::end();
|
||||
}
|
||||
|
||||
private:
|
||||
inline iterator begin()
|
||||
{
|
||||
return std::list<Line>::begin();
|
||||
}
|
||||
inline iterator end()
|
||||
{
|
||||
return std::list<Line>::end();
|
||||
}
|
||||
|
||||
std::string m_sName;
|
||||
};
|
||||
|
||||
class File : private std::list<Section>
|
||||
{
|
||||
public:
|
||||
File();
|
||||
File(const std::string & _rsFile);
|
||||
virtual ~File();
|
||||
|
||||
bool bSectionExists(const std::string & _rsName);
|
||||
Section * poAddSection(const std::string & _rsName);
|
||||
Section * poGetSection(const std::string & _rsName);
|
||||
void vRemoveSection(const std::string & _rsName);
|
||||
void vLoad(const std::string & _rsFile,
|
||||
bool _bAddSection = true,
|
||||
bool _bAddKey = true);
|
||||
void vSave(const std::string & _rsFile);
|
||||
void vClear();
|
||||
|
||||
// read only
|
||||
typedef std::list<Section>::const_iterator const_iterator;
|
||||
inline const_iterator begin() const
|
||||
{
|
||||
return std::list<Section>::begin();
|
||||
}
|
||||
inline const_iterator end() const
|
||||
{
|
||||
return std::list<Section>::end();
|
||||
}
|
||||
|
||||
private:
|
||||
inline iterator begin()
|
||||
{
|
||||
return std::list<Section>::begin();
|
||||
}
|
||||
inline iterator end()
|
||||
{
|
||||
return std::list<Section>::end();
|
||||
}
|
||||
};
|
||||
|
||||
// debug
|
||||
std::ostream & operator<<(std::ostream & _roOut, const File & _roConfig);
|
||||
|
||||
template<typename T>
|
||||
void Section::vSetKey(const std::string & _rsKey, const T & _rValue)
|
||||
{
|
||||
std::ostringstream oOut;
|
||||
oOut << _rValue;
|
||||
for (iterator it = begin(); it != end(); it++)
|
||||
{
|
||||
if (it->m_sKey == _rsKey)
|
||||
{
|
||||
it->m_sValue = oOut.str();
|
||||
return;
|
||||
}
|
||||
}
|
||||
push_back(Line(_rsKey, oOut.str()));
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
T Section::oGetKey(const std::string & _rsKey) const
|
||||
{
|
||||
T oValue;
|
||||
for (const_iterator it = begin(); it != end(); it++)
|
||||
{
|
||||
if (it->m_sKey == _rsKey)
|
||||
{
|
||||
std::istringstream oIn(it->m_sValue);
|
||||
oIn >> oValue;
|
||||
return oValue;
|
||||
}
|
||||
}
|
||||
throw KeyNotFound(m_sName, _rsKey);
|
||||
}
|
||||
|
||||
} // namespace Config
|
||||
} // namespace VBA
|
||||
|
||||
|
||||
#endif // __VBA_CONFIGFILE_H__
|
|
@ -0,0 +1,57 @@
|
|||
// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator.
|
||||
// Copyright (C) 1999-2003 Forgotten
|
||||
// Copyright (C) 2004 Forgotten and the VBA development team
|
||||
|
||||
// This program is free software; you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation; either version 2, or(at your option)
|
||||
// any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program; if not, write to the Free Software Foundation,
|
||||
// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
#include "filters.h"
|
||||
|
||||
namespace VBA
|
||||
{
|
||||
|
||||
static const Filter2x apvFilters2x[][2] =
|
||||
{
|
||||
{ NULL, NULL },
|
||||
{ _2xSaI, _2xSaI32 },
|
||||
{ Super2xSaI, Super2xSaI32 },
|
||||
{ SuperEagle, SuperEagle32 },
|
||||
{ Pixelate, Pixelate32 },
|
||||
{ AdMame2x, AdMame2x32 },
|
||||
{ Bilinear, Bilinear32 },
|
||||
{ BilinearPlus, BilinearPlus32 },
|
||||
{ Scanlines, Scanlines32 },
|
||||
{ ScanlinesTV, ScanlinesTV32 },
|
||||
{ hq2x, hq2x32 },
|
||||
{ lq2x, lq2x32 }
|
||||
};
|
||||
|
||||
static const FilterIB apvFiltersIB[][2] =
|
||||
{
|
||||
{ NULL, NULL },
|
||||
{ SmartIB, SmartIB32 },
|
||||
{ MotionBlurIB, MotionBlurIB32 }
|
||||
};
|
||||
|
||||
Filter2x pvGetFilter2x(EFilter2x _eFilter2x, EFilterDepth _eDepth)
|
||||
{
|
||||
return apvFilters2x[_eFilter2x][_eDepth];
|
||||
}
|
||||
|
||||
FilterIB pvGetFilterIB(EFilterIB _eFilterIB, EFilterDepth _eDepth)
|
||||
{
|
||||
return apvFiltersIB[_eFilterIB][_eDepth];
|
||||
}
|
||||
|
||||
} // namespace VBA
|
|
@ -0,0 +1,100 @@
|
|||
// -*- 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 __VBA_FILTERS_H__
|
||||
#define __VBA_FILTERS_H__
|
||||
|
||||
#include "../System.h"
|
||||
|
||||
int Init_2xSaI(u32);
|
||||
|
||||
void _2xSaI (u8 *, u32, u8 *, u8 *, u32, int, int);
|
||||
void _2xSaI32 (u8 *, u32, u8 *, u8 *, u32, int, int);
|
||||
void Super2xSaI (u8 *, u32, u8 *, u8 *, u32, int, int);
|
||||
void Super2xSaI32 (u8 *, u32, u8 *, u8 *, u32, int, int);
|
||||
void SuperEagle (u8 *, u32, u8 *, u8 *, u32, int, int);
|
||||
void SuperEagle32 (u8 *, u32, u8 *, u8 *, u32, int, int);
|
||||
void Pixelate (u8 *, u32, u8 *, u8 *, u32, int, int);
|
||||
void Pixelate32 (u8 *, u32, u8 *, u8 *, u32, int, int);
|
||||
void AdMame2x (u8 *, u32, u8 *, u8 *, u32, int, int);
|
||||
void AdMame2x32 (u8 *, u32, u8 *, u8 *, u32, int, int);
|
||||
void Bilinear (u8 *, u32, u8 *, u8 *, u32, int, int);
|
||||
void Bilinear32 (u8 *, u32, u8 *, u8 *, u32, int, int);
|
||||
void BilinearPlus (u8 *, u32, u8 *, u8 *, u32, int, int);
|
||||
void BilinearPlus32(u8 *, u32, u8 *, u8 *, u32, int, int);
|
||||
void Scanlines (u8 *, u32, u8 *, u8 *, u32, int, int);
|
||||
void Scanlines32 (u8 *, u32, u8 *, u8 *, u32, int, int);
|
||||
void ScanlinesTV (u8 *, u32, u8 *, u8 *, u32, int, int);
|
||||
void ScanlinesTV32 (u8 *, u32, u8 *, u8 *, u32, int, int);
|
||||
void hq2x (u8 *, u32, u8 *, u8 *, u32, int, int);
|
||||
void hq2x32 (u8 *, u32, u8 *, u8 *, u32, int, int);
|
||||
void lq2x (u8 *, u32, u8 *, u8 *, u32, int, int);
|
||||
void lq2x32 (u8 *, u32, u8 *, u8 *, u32, int, int);
|
||||
|
||||
void SmartIB (u8 *, u32, int, int);
|
||||
void SmartIB32 (u8 *, u32, int, int);
|
||||
void MotionBlurIB (u8 *, u32, int, int);
|
||||
void MotionBlurIB32(u8 *, u32, int, int);
|
||||
|
||||
namespace VBA
|
||||
{
|
||||
|
||||
typedef void (*Filter2x)(u8 *, u32, u8 *, u8 *, u32, int, int);
|
||||
typedef void (*FilterIB)(u8 *, u32, int, int);
|
||||
|
||||
enum EFilter2x
|
||||
{
|
||||
FirstFilter,
|
||||
FilterNone = FirstFilter,
|
||||
Filter2xSaI,
|
||||
FilterSuper2xSaI,
|
||||
FilterSuperEagle,
|
||||
FilterPixelate,
|
||||
FilterAdMame2x,
|
||||
FilterBilinear,
|
||||
FilterBilinearPlus,
|
||||
FilterScanlines,
|
||||
FilterScanlinesTV,
|
||||
FilterHq2x,
|
||||
FilterLq2x,
|
||||
LastFilter = FilterLq2x
|
||||
};
|
||||
|
||||
enum EFilterIB
|
||||
{
|
||||
FirstFilterIB,
|
||||
FilterIBNone = FirstFilterIB,
|
||||
FilterIBSmart,
|
||||
FilterIBMotionBlur,
|
||||
LastFilterIB = FilterIBMotionBlur
|
||||
};
|
||||
|
||||
enum EFilterDepth
|
||||
{
|
||||
FilterDepth16,
|
||||
FilterDepth32
|
||||
};
|
||||
|
||||
Filter2x pvGetFilter2x(EFilter2x _eFilter2x, EFilterDepth _eDepth);
|
||||
FilterIB pvGetFilterIB(EFilterIB _eFilterIB, EFilterDepth _eDepth);
|
||||
|
||||
} // namespace VBA
|
||||
|
||||
|
||||
#endif // __VBA_FILTERS_H__
|
Binary file not shown.
After Width: | Height: | Size: 604 B |
|
@ -0,0 +1,53 @@
|
|||
// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator.
|
||||
// Copyright (C) 1999-2003 Forgotten
|
||||
// Copyright (C) 2004 Forgotten and the VBA development team
|
||||
|
||||
// This program is free software; you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation; either version 2, or(at your option)
|
||||
// any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program; if not, write to the Free Software Foundation,
|
||||
// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
#include "input.h"
|
||||
|
||||
#include <new>
|
||||
|
||||
namespace VBA
|
||||
{
|
||||
|
||||
Keymap::Keymap()
|
||||
{
|
||||
m_pstTable = g_hash_table_new(g_direct_hash, g_direct_equal);
|
||||
if (m_pstTable == NULL)
|
||||
{
|
||||
throw std::bad_alloc();
|
||||
}
|
||||
}
|
||||
|
||||
Keymap::~Keymap()
|
||||
{
|
||||
g_hash_table_destroy(m_pstTable);
|
||||
}
|
||||
|
||||
void Keymap::vRegister(guint _uiVal, EKey _eKey)
|
||||
{
|
||||
g_hash_table_insert(m_pstTable,
|
||||
GUINT_TO_POINTER(_uiVal),
|
||||
GUINT_TO_POINTER(_eKey));
|
||||
}
|
||||
|
||||
void Keymap::vClear()
|
||||
{
|
||||
g_hash_table_destroy(m_pstTable);
|
||||
m_pstTable = g_hash_table_new(g_direct_hash, g_direct_equal);
|
||||
}
|
||||
|
||||
} // namespace VBA
|
|
@ -0,0 +1,92 @@
|
|||
// -*- 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 __VBA_INPUT_H__
|
||||
#define __VBA_INPUT_H__
|
||||
|
||||
#include <glib.h>
|
||||
|
||||
namespace VBA
|
||||
{
|
||||
|
||||
enum EKey
|
||||
{
|
||||
KeyNone,
|
||||
// GBA keys
|
||||
KeyA,
|
||||
KeyB,
|
||||
KeySelect,
|
||||
KeyStart,
|
||||
KeyRight,
|
||||
KeyLeft,
|
||||
KeyUp,
|
||||
KeyDown,
|
||||
KeyR,
|
||||
KeyL,
|
||||
// VBA extension
|
||||
KeySpeed,
|
||||
KeyCapture
|
||||
};
|
||||
|
||||
enum EKeyFlag
|
||||
{
|
||||
// GBA keys
|
||||
KeyFlagA = 1 << 0,
|
||||
KeyFlagB = 1 << 1,
|
||||
KeyFlagSelect = 1 << 2,
|
||||
KeyFlagStart = 1 << 3,
|
||||
KeyFlagRight = 1 << 4,
|
||||
KeyFlagLeft = 1 << 5,
|
||||
KeyFlagUp = 1 << 6,
|
||||
KeyFlagDown = 1 << 7,
|
||||
KeyFlagR = 1 << 8,
|
||||
KeyFlagL = 1 << 9,
|
||||
// VBA extension
|
||||
KeyFlagSpeed = 1 << 10,
|
||||
KeyFlagCapture = 1 << 11,
|
||||
};
|
||||
|
||||
class Keymap
|
||||
{
|
||||
public:
|
||||
Keymap();
|
||||
~Keymap();
|
||||
|
||||
void vRegister(guint _uiVal, EKey _eKey);
|
||||
void vClear();
|
||||
inline EKey eGetKey(guint _uiVal);
|
||||
|
||||
private:
|
||||
GHashTable * m_pstTable;
|
||||
|
||||
// noncopyable
|
||||
Keymap(const Keymap &);
|
||||
Keymap & operator=(const Keymap &);
|
||||
};
|
||||
|
||||
inline EKey Keymap::eGetKey(guint _uiVal)
|
||||
{
|
||||
return (EKey)GPOINTER_TO_UINT(g_hash_table_lookup(m_pstTable,
|
||||
GUINT_TO_POINTER(_uiVal)));
|
||||
}
|
||||
|
||||
} // namespace VBA
|
||||
|
||||
|
||||
#endif // __VBA_INPUT_H__
|
|
@ -0,0 +1,38 @@
|
|||
// -*- 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 __VBA_INTL_H__
|
||||
#define __VBA_INTL_H__
|
||||
|
||||
#ifdef ENABLE_NLS
|
||||
# include <libintl.h>
|
||||
# define _(String) gettext(String)
|
||||
# define N_(String) (String)
|
||||
#else
|
||||
# define _(String) (String)
|
||||
# define N_(String) (String)
|
||||
# define textdomain(String) (String)
|
||||
# define gettext(String) (String)
|
||||
# define dgettext(Domain,String) (String)
|
||||
# define dcgettext(Domain,String,Type) (String)
|
||||
# define bindtextdomain(Domain,Directory) (Domain)
|
||||
#endif
|
||||
|
||||
|
||||
#endif // __VBA_INTL_H__
|
|
@ -0,0 +1,276 @@
|
|||
// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator.
|
||||
// Copyright (C) 1999-2003 Forgotten
|
||||
// Copyright (C) 2004 Forgotten and the VBA development team
|
||||
|
||||
// This program is free software; you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation; either version 2, or(at your option)
|
||||
// any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program; if not, write to the Free Software Foundation,
|
||||
// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
#include "joypadconfig.h"
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include "intl.h"
|
||||
|
||||
namespace VBA
|
||||
{
|
||||
|
||||
guint * JoypadConfig::puiAt(int _iIndex)
|
||||
{
|
||||
guint * puiMember;
|
||||
|
||||
switch (_iIndex)
|
||||
{
|
||||
case 0:
|
||||
puiMember = &m_uiUp;
|
||||
break;
|
||||
case 1:
|
||||
puiMember = &m_uiDown;
|
||||
break;
|
||||
case 2:
|
||||
puiMember = &m_uiLeft;
|
||||
break;
|
||||
case 3:
|
||||
puiMember = &m_uiRight;
|
||||
break;
|
||||
case 4:
|
||||
puiMember = &m_uiA;
|
||||
break;
|
||||
case 5:
|
||||
puiMember = &m_uiB;
|
||||
break;
|
||||
case 6:
|
||||
puiMember = &m_uiL;
|
||||
break;
|
||||
case 7:
|
||||
puiMember = &m_uiR;
|
||||
break;
|
||||
case 8:
|
||||
puiMember = &m_uiSelect;
|
||||
break;
|
||||
case 9:
|
||||
puiMember = &m_uiStart;
|
||||
break;
|
||||
case 10:
|
||||
puiMember = &m_uiSpeed;
|
||||
break;
|
||||
case 11:
|
||||
puiMember = &m_uiCapture;
|
||||
break;
|
||||
default:
|
||||
puiMember = NULL;
|
||||
}
|
||||
|
||||
return puiMember;
|
||||
}
|
||||
|
||||
int JoypadConfig::iFind(guint _uiKeycode)
|
||||
{
|
||||
for (guint i = 0; i < 12; i++)
|
||||
{
|
||||
if (*puiAt(i) == _uiKeycode)
|
||||
{
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
void JoypadConfig::vSetDefault()
|
||||
{
|
||||
guint auiKeyval[] =
|
||||
{
|
||||
GDK_Up, GDK_Down, GDK_Left, GDK_Right,
|
||||
GDK_z, GDK_x, GDK_a, GDK_s,
|
||||
GDK_BackSpace, GDK_Return,
|
||||
GDK_space, GDK_F12
|
||||
};
|
||||
|
||||
for (guint i = 0; i < G_N_ELEMENTS(auiKeyval); i++)
|
||||
{
|
||||
GdkKeymapKey * pstKeys;
|
||||
int iKeys;
|
||||
|
||||
if (gdk_keymap_get_entries_for_keyval(gdk_keymap_get_default(),
|
||||
auiKeyval[i],
|
||||
&pstKeys,
|
||||
&iKeys))
|
||||
{
|
||||
*puiAt(i) = pstKeys[0].keycode;
|
||||
g_free(pstKeys);
|
||||
}
|
||||
else
|
||||
{
|
||||
*puiAt(i) = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Keymap * JoypadConfig::poCreateKeymap() const
|
||||
{
|
||||
Keymap * poKeymap = new Keymap();
|
||||
|
||||
poKeymap->vRegister(m_uiUp, KeyUp );
|
||||
poKeymap->vRegister(m_uiDown, KeyDown );
|
||||
poKeymap->vRegister(m_uiLeft, KeyLeft );
|
||||
poKeymap->vRegister(m_uiRight, KeyRight );
|
||||
poKeymap->vRegister(m_uiA, KeyA );
|
||||
poKeymap->vRegister(m_uiB, KeyB );
|
||||
poKeymap->vRegister(m_uiL, KeyL );
|
||||
poKeymap->vRegister(m_uiR, KeyR );
|
||||
poKeymap->vRegister(m_uiSelect, KeySelect );
|
||||
poKeymap->vRegister(m_uiStart, KeyStart );
|
||||
poKeymap->vRegister(m_uiSpeed, KeySpeed );
|
||||
poKeymap->vRegister(m_uiCapture, KeyCapture );
|
||||
|
||||
return poKeymap;
|
||||
}
|
||||
|
||||
JoypadConfigDialog::JoypadConfigDialog(GtkDialog * _pstDialog,
|
||||
const Glib::RefPtr<Gnome::Glade::Xml> & _poXml) :
|
||||
Gtk::Dialog(_pstDialog)
|
||||
{
|
||||
m_puiCurrentKeyCode = NULL;
|
||||
|
||||
memset(&m_oConfig, 0, sizeof(m_oConfig));
|
||||
|
||||
m_poOkButton = dynamic_cast<Gtk::Button *>(_poXml->get_widget("JoypadOkButton"));
|
||||
|
||||
m_oEntries.push_back(dynamic_cast<Gtk::Entry *>(_poXml->get_widget("JoypadUpEntry")));
|
||||
m_oEntries.push_back(dynamic_cast<Gtk::Entry *>(_poXml->get_widget("JoypadDownEntry")));
|
||||
m_oEntries.push_back(dynamic_cast<Gtk::Entry *>(_poXml->get_widget("JoypadLeftEntry")));
|
||||
m_oEntries.push_back(dynamic_cast<Gtk::Entry *>(_poXml->get_widget("JoypadRightEntry")));
|
||||
m_oEntries.push_back(dynamic_cast<Gtk::Entry *>(_poXml->get_widget("JoypadAEntry")));
|
||||
m_oEntries.push_back(dynamic_cast<Gtk::Entry *>(_poXml->get_widget("JoypadBEntry")));
|
||||
m_oEntries.push_back(dynamic_cast<Gtk::Entry *>(_poXml->get_widget("JoypadLEntry")));
|
||||
m_oEntries.push_back(dynamic_cast<Gtk::Entry *>(_poXml->get_widget("JoypadREntry")));
|
||||
m_oEntries.push_back(dynamic_cast<Gtk::Entry *>(_poXml->get_widget("JoypadSelectEntry")));
|
||||
m_oEntries.push_back(dynamic_cast<Gtk::Entry *>(_poXml->get_widget("JoypadStartEntry")));
|
||||
m_oEntries.push_back(dynamic_cast<Gtk::Entry *>(_poXml->get_widget("JoypadSpeedEntry")));
|
||||
m_oEntries.push_back(dynamic_cast<Gtk::Entry *>(_poXml->get_widget("JoypadCaptureEntry")));
|
||||
|
||||
for (guint i = 0; i < m_oEntries.size(); i++)
|
||||
{
|
||||
Gtk::Entry * poEntry = m_oEntries[i];
|
||||
|
||||
poEntry->signal_focus_in_event().connect(sigc::bind(
|
||||
sigc::mem_fun(*this, &JoypadConfigDialog::bOnEntryFocusIn),
|
||||
i));
|
||||
poEntry->signal_focus_out_event().connect(sigc::mem_fun(*this, &JoypadConfigDialog::bOnEntryFocusOut));
|
||||
}
|
||||
|
||||
vUpdateEntries();
|
||||
}
|
||||
|
||||
JoypadConfigDialog::~JoypadConfigDialog()
|
||||
{
|
||||
}
|
||||
|
||||
void JoypadConfigDialog::vSetConfig(const JoypadConfig & _roConfig)
|
||||
{
|
||||
m_oConfig = _roConfig;
|
||||
vUpdateEntries();
|
||||
}
|
||||
|
||||
void JoypadConfigDialog::vUpdateEntries()
|
||||
{
|
||||
for (guint i = 0; i < m_oEntries.size(); i++)
|
||||
{
|
||||
guint uiKeyval = 0;
|
||||
gdk_keymap_translate_keyboard_state(gdk_keymap_get_default(),
|
||||
*m_oConfig.puiAt(i),
|
||||
(GdkModifierType)0,
|
||||
0,
|
||||
&uiKeyval,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL);
|
||||
const char * csName = gdk_keyval_name(uiKeyval);
|
||||
if (csName == NULL)
|
||||
{
|
||||
m_oEntries[i]->set_text(_("<Undefined>"));
|
||||
}
|
||||
else
|
||||
{
|
||||
m_oEntries[i]->set_text(csName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool JoypadConfigDialog::bOnEntryFocusIn(GdkEventFocus * _pstEvent,
|
||||
guint _uiEntry)
|
||||
{
|
||||
m_uiCurrentEntry = _uiEntry;
|
||||
m_puiCurrentKeyCode = m_oConfig.puiAt(_uiEntry);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool JoypadConfigDialog::bOnEntryFocusOut(GdkEventFocus * _pstEvent)
|
||||
{
|
||||
m_puiCurrentKeyCode = NULL;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool JoypadConfigDialog::on_key_press_event(GdkEventKey * _pstEvent)
|
||||
{
|
||||
if (m_puiCurrentKeyCode == NULL)
|
||||
{
|
||||
return Gtk::Dialog::on_key_press_event(_pstEvent);
|
||||
}
|
||||
|
||||
*m_puiCurrentKeyCode = 0;
|
||||
int iFound = m_oConfig.iFind(_pstEvent->hardware_keycode);
|
||||
if (iFound >= 0)
|
||||
{
|
||||
*m_oConfig.puiAt(iFound) = 0;
|
||||
m_oEntries[iFound]->set_text(_("<Undefined>"));
|
||||
}
|
||||
|
||||
*m_puiCurrentKeyCode = _pstEvent->hardware_keycode;
|
||||
|
||||
guint uiKeyval = 0;
|
||||
gdk_keymap_translate_keyboard_state(gdk_keymap_get_default(),
|
||||
_pstEvent->hardware_keycode,
|
||||
(GdkModifierType)0,
|
||||
0,
|
||||
&uiKeyval,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL);
|
||||
|
||||
const char * csName = gdk_keyval_name(uiKeyval);
|
||||
if (csName == NULL)
|
||||
{
|
||||
m_oEntries[m_uiCurrentEntry]->set_text(_("<Undefined>"));
|
||||
}
|
||||
else
|
||||
{
|
||||
m_oEntries[m_uiCurrentEntry]->set_text(csName);
|
||||
}
|
||||
|
||||
if (m_uiCurrentEntry + 1 < m_oEntries.size())
|
||||
{
|
||||
m_oEntries[m_uiCurrentEntry + 1]->grab_focus();
|
||||
}
|
||||
else
|
||||
{
|
||||
m_poOkButton->grab_focus();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
} // namespace VBA
|
|
@ -0,0 +1,84 @@
|
|||
// -*- 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 __VBA_JOYPADCONFIG_H__
|
||||
#define __VBA_JOYPADCONFIG_H__
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include <libglademm.h>
|
||||
#include <gtkmm.h>
|
||||
|
||||
#include "input.h"
|
||||
|
||||
namespace VBA
|
||||
{
|
||||
|
||||
class JoypadConfig
|
||||
{
|
||||
public:
|
||||
guint m_uiUp;
|
||||
guint m_uiDown;
|
||||
guint m_uiLeft;
|
||||
guint m_uiRight;
|
||||
guint m_uiA;
|
||||
guint m_uiB;
|
||||
guint m_uiL;
|
||||
guint m_uiR;
|
||||
guint m_uiSelect;
|
||||
guint m_uiStart;
|
||||
guint m_uiSpeed;
|
||||
guint m_uiCapture;
|
||||
|
||||
guint * puiAt(int _iIndex);
|
||||
int iFind(guint _uiKeycode);
|
||||
void vSetDefault();
|
||||
Keymap * poCreateKeymap() const;
|
||||
};
|
||||
|
||||
class JoypadConfigDialog : public Gtk::Dialog
|
||||
{
|
||||
public:
|
||||
JoypadConfigDialog(GtkDialog * _pstDialog,
|
||||
const Glib::RefPtr<Gnome::Glade::Xml> & _poXml);
|
||||
virtual ~JoypadConfigDialog();
|
||||
|
||||
void vSetConfig(const JoypadConfig & _roConfig);
|
||||
inline JoypadConfig stGetConfig() const { return m_oConfig; }
|
||||
|
||||
protected:
|
||||
bool bOnEntryFocusIn(GdkEventFocus * _pstEvent, guint _uiEntry);
|
||||
bool bOnEntryFocusOut(GdkEventFocus * _pstEvent);
|
||||
|
||||
bool on_key_press_event(GdkEventKey * _pstEvent);
|
||||
|
||||
private:
|
||||
JoypadConfig m_oConfig;
|
||||
Gtk::Button * m_poOkButton;
|
||||
std::vector<Gtk::Entry *> m_oEntries;
|
||||
guint * m_puiCurrentKeyCode;
|
||||
guint m_uiCurrentEntry;
|
||||
|
||||
void vUpdateEntries();
|
||||
};
|
||||
|
||||
} // namespace VBA
|
||||
|
||||
|
||||
#endif // __VBA_JOYPADCONFIG_H__
|
|
@ -0,0 +1,159 @@
|
|||
// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator.
|
||||
// Copyright (C) 1999-2003 Forgotten
|
||||
// Copyright (C) 2004 Forgotten and the VBA development team
|
||||
|
||||
// This program is free software; you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation; either version 2, or(at your option)
|
||||
// any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program; if not, write to the Free Software Foundation,
|
||||
// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
#include <limits.h>
|
||||
#include <stdlib.h>
|
||||
#include "../getopt.h"
|
||||
|
||||
#include <list>
|
||||
|
||||
#include <gtkmm/main.h>
|
||||
#include <gtkmm/window.h>
|
||||
#include <gtkmm/messagedialog.h>
|
||||
#include <libglademm.h>
|
||||
|
||||
#include "window.h"
|
||||
#include "intl.h"
|
||||
|
||||
using Gnome::Glade::Xml;
|
||||
|
||||
static const char * csProgramName;
|
||||
|
||||
static int iShowHelp;
|
||||
static int iShowVersion;
|
||||
|
||||
// Non-characters used for long options that have no equivalent short option
|
||||
enum
|
||||
{
|
||||
IGNORED_OPTION = CHAR_MAX + 1
|
||||
};
|
||||
|
||||
static const char csShortOptions[] = "V";
|
||||
|
||||
static const struct option astLongOptions[] =
|
||||
{
|
||||
{ "help", no_argument, &iShowHelp, IGNORED_OPTION },
|
||||
{ "version", no_argument, NULL, 'V' },
|
||||
{ 0, 0, 0, 0 }
|
||||
};
|
||||
|
||||
static void vUsage(int iStatus)
|
||||
{
|
||||
if (iStatus != 0)
|
||||
{
|
||||
g_printerr(_("Try `%s --help' for more information.\n"), csProgramName);
|
||||
}
|
||||
else
|
||||
{
|
||||
g_print(_("Usage: %s [option ...] [file]\n"), csProgramName);
|
||||
g_print(_("\
|
||||
\n\
|
||||
Options:\n\
|
||||
--help Output this help.\n\
|
||||
-V, --version Output version information.\n\
|
||||
"));
|
||||
}
|
||||
|
||||
exit(iStatus);
|
||||
}
|
||||
|
||||
static void vSetDefaultWindowIcon()
|
||||
{
|
||||
Glib::RefPtr<Gdk::Pixbuf> pixBuf= Gdk::Pixbuf::create_from_file(PKGDATADIR "/icons/vba-m.png");
|
||||
Gtk::Window::set_default_icon(pixBuf);
|
||||
}
|
||||
|
||||
int main(int argc, char * argv[])
|
||||
{
|
||||
csProgramName = argv[0];
|
||||
|
||||
#ifdef ENABLE_NLS
|
||||
setlocale(LC_ALL, "");
|
||||
bindtextdomain(GETTEXT_PACKAGE, LOCALEDIR);
|
||||
textdomain(GETTEXT_PACKAGE);
|
||||
bind_textdomain_codeset(GETTEXT_PACKAGE, "UTF-8");
|
||||
#endif // ENABLE_NLS
|
||||
|
||||
Gtk::Main oKit(argc, argv);
|
||||
|
||||
int iOpt;
|
||||
while ((iOpt = getopt_long(argc, argv, csShortOptions, astLongOptions, NULL))
|
||||
!= -1)
|
||||
{
|
||||
switch (iOpt)
|
||||
{
|
||||
case 'V':
|
||||
iShowVersion = 1;
|
||||
break;
|
||||
case 0:
|
||||
// Long options
|
||||
break;
|
||||
default:
|
||||
vUsage(1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (iShowVersion)
|
||||
{
|
||||
g_print(_("VisualBoyAdvance version %s [GTK+]\n"), VERSION);
|
||||
exit(0);
|
||||
}
|
||||
|
||||
if (iShowHelp)
|
||||
{
|
||||
vUsage(0);
|
||||
}
|
||||
|
||||
vSetDefaultWindowIcon();
|
||||
|
||||
Glib::RefPtr<Xml> poXml;
|
||||
try
|
||||
{
|
||||
poXml = Xml::create(PKGDATADIR "/vba.glade", "MainWindow");
|
||||
}
|
||||
catch (const Xml::Error & e)
|
||||
{
|
||||
Gtk::MessageDialog oDialog(e.what(),
|
||||
false,
|
||||
Gtk::MESSAGE_ERROR,
|
||||
Gtk::BUTTONS_OK);
|
||||
oDialog.run();
|
||||
return 1;
|
||||
}
|
||||
|
||||
VBA::Window * poWindow = NULL;
|
||||
poXml->get_widget_derived<VBA::Window>("MainWindow", poWindow);
|
||||
|
||||
if (optind < argc)
|
||||
{
|
||||
// Display the window before loading the file
|
||||
poWindow->show();
|
||||
while (Gtk::Main::events_pending())
|
||||
{
|
||||
Gtk::Main::iteration();
|
||||
}
|
||||
|
||||
poWindow->bLoadROM(argv[optind]);
|
||||
}
|
||||
|
||||
Gtk::Main::run(*poWindow);
|
||||
delete poWindow;
|
||||
|
||||
return 0;
|
||||
}
|
|
@ -0,0 +1,76 @@
|
|||
// -*- 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 __VBA_MENUITEM_H__
|
||||
#define __VBA_MENUITEM_H__
|
||||
|
||||
#include <gtkmm/menuitem.h>
|
||||
#include <gtkmm/imagemenuitem.h>
|
||||
|
||||
namespace VBA
|
||||
{
|
||||
|
||||
class MenuItem : public Gtk::MenuItem
|
||||
{
|
||||
public:
|
||||
MenuItem()
|
||||
{}
|
||||
|
||||
MenuItem(Gtk::Widget & _roWidget) :
|
||||
Gtk::MenuItem(_roWidget)
|
||||
{}
|
||||
|
||||
MenuItem(const Glib::ustring & _rsLabel, bool _bMnemonic = false) :
|
||||
Gtk::MenuItem(_rsLabel, _bMnemonic)
|
||||
{}
|
||||
|
||||
inline void set_accel_key(const Gtk::AccelKey & _roAccelKey)
|
||||
{
|
||||
Gtk::MenuItem::set_accel_key(_roAccelKey);
|
||||
}
|
||||
};
|
||||
|
||||
class ImageMenuItem : public Gtk::ImageMenuItem
|
||||
{
|
||||
public:
|
||||
ImageMenuItem()
|
||||
{}
|
||||
|
||||
ImageMenuItem(Widget & _roImage, const Glib::ustring & _rsLabel, bool _bMnemonic = false) :
|
||||
Gtk::ImageMenuItem(_roImage, _rsLabel, _bMnemonic)
|
||||
{}
|
||||
|
||||
ImageMenuItem(const Glib::ustring & _rsLabel, bool _bMnemonic = false) :
|
||||
Gtk::ImageMenuItem(_rsLabel, _bMnemonic)
|
||||
{}
|
||||
|
||||
ImageMenuItem(const Gtk::StockID & _roId) :
|
||||
Gtk::ImageMenuItem(_roId)
|
||||
{}
|
||||
|
||||
inline void set_accel_key(const Gtk::AccelKey & _roAccelKey)
|
||||
{
|
||||
Gtk::MenuItem::set_accel_key(_roAccelKey);
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace VBA
|
||||
|
||||
|
||||
#endif // __VBA_MENUITEM_H__
|
|
@ -0,0 +1,293 @@
|
|||
// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator.
|
||||
// Copyright (C) 1999-2003 Forgotten
|
||||
// Copyright (C) 2004 Forgotten and the VBA development team
|
||||
|
||||
// This program is free software; you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation; either version 2, or(at your option)
|
||||
// any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program; if not, write to the Free Software Foundation,
|
||||
// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
#include "screenarea.h"
|
||||
|
||||
#include <string.h>
|
||||
|
||||
namespace VBA
|
||||
{
|
||||
|
||||
ScreenArea::ScreenArea(int _iWidth, int _iHeight, int _iScale) :
|
||||
m_puiPixels(NULL),
|
||||
m_puiDelta(NULL),
|
||||
m_vFilter2x(NULL),
|
||||
m_vFilterIB(NULL),
|
||||
m_bShowCursor(true)
|
||||
{
|
||||
g_assert(_iWidth >= 1 && _iHeight >= 1 && _iScale >= 1);
|
||||
|
||||
m_iWidth = _iWidth;
|
||||
m_iHeight = _iHeight;
|
||||
m_iScale = _iScale;
|
||||
vUpdateSize();
|
||||
|
||||
set_events(Gdk::EXPOSURE_MASK
|
||||
| Gdk::POINTER_MOTION_MASK
|
||||
| Gdk::ENTER_NOTIFY_MASK
|
||||
| Gdk::LEAVE_NOTIFY_MASK);
|
||||
|
||||
char aiEmptyData[8];
|
||||
memset(aiEmptyData, 0, sizeof(aiEmptyData));
|
||||
Glib::RefPtr<Gdk::Bitmap> poSource = Gdk::Bitmap::create(aiEmptyData, 8, 8);
|
||||
Glib::RefPtr<Gdk::Bitmap> poMask = Gdk::Bitmap::create(aiEmptyData, 8, 8);
|
||||
Gdk::Color oFg;
|
||||
Gdk::Color oBg;
|
||||
oFg.set_rgb(0, 0, 0);
|
||||
oBg.set_rgb(0, 0, 0);
|
||||
|
||||
m_poEmptyCursor = new Gdk::Cursor(poSource, poMask, oFg, oBg, 0, 0);
|
||||
}
|
||||
|
||||
ScreenArea::~ScreenArea()
|
||||
{
|
||||
if (m_puiPixels != NULL)
|
||||
{
|
||||
delete[] m_puiPixels;
|
||||
}
|
||||
|
||||
if (m_puiDelta != NULL)
|
||||
{
|
||||
delete[] m_puiDelta;
|
||||
}
|
||||
|
||||
if (m_poEmptyCursor != NULL)
|
||||
{
|
||||
delete m_poEmptyCursor;
|
||||
}
|
||||
}
|
||||
|
||||
void ScreenArea::vSetSize(int _iWidth, int _iHeight)
|
||||
{
|
||||
g_return_if_fail(_iWidth >= 1 && _iHeight >= 1);
|
||||
|
||||
if (_iWidth != m_iWidth || _iHeight != m_iHeight)
|
||||
{
|
||||
m_iWidth = _iWidth;
|
||||
m_iHeight = _iHeight;
|
||||
vUpdateSize();
|
||||
}
|
||||
}
|
||||
|
||||
void ScreenArea::vSetScale(int _iScale)
|
||||
{
|
||||
g_return_if_fail(_iScale >= 1);
|
||||
|
||||
if (_iScale != m_iScale)
|
||||
{
|
||||
m_iScale = _iScale;
|
||||
vUpdateSize();
|
||||
}
|
||||
}
|
||||
|
||||
void ScreenArea::vSetFilter2x(EFilter2x _eFilter2x)
|
||||
{
|
||||
m_vFilter2x = pvGetFilter2x(_eFilter2x, FilterDepth32);
|
||||
}
|
||||
|
||||
void ScreenArea::vSetFilterIB(EFilterIB _eFilterIB)
|
||||
{
|
||||
m_vFilterIB = pvGetFilterIB(_eFilterIB, FilterDepth32);
|
||||
}
|
||||
|
||||
void ScreenArea::vDrawPixels(u8 * _puiData)
|
||||
{
|
||||
if (m_vFilterIB != NULL)
|
||||
{
|
||||
m_vFilterIB(_puiData + m_iAreaWidth * 2 + 4,
|
||||
m_iAreaWidth * 2 + 4,
|
||||
m_iWidth,
|
||||
m_iHeight);
|
||||
}
|
||||
|
||||
if (m_iScale == 1)
|
||||
{
|
||||
u32 * puiSrc = (u32 *)_puiData + m_iWidth + 1;
|
||||
u32 * puiPixel = m_puiPixels;
|
||||
for (int y = 0; y < m_iHeight; y++)
|
||||
{
|
||||
for (int x = 0; x < m_iWidth; x++)
|
||||
{
|
||||
*puiPixel++ = *puiSrc++;
|
||||
}
|
||||
puiSrc++;
|
||||
}
|
||||
}
|
||||
else if (m_iScale == 2 && m_vFilter2x != NULL)
|
||||
{
|
||||
m_vFilter2x(_puiData + m_iAreaWidth * 2 + 4,
|
||||
m_iAreaWidth * 2 + 4,
|
||||
m_puiDelta,
|
||||
(u8 *)m_puiPixels,
|
||||
m_iRowStride,
|
||||
m_iWidth,
|
||||
m_iHeight);
|
||||
}
|
||||
else
|
||||
{
|
||||
u32 * puiSrc = (u32 *)_puiData + m_iWidth + 1;
|
||||
u32 * puiSrc2;
|
||||
u32 * puiPixel = m_puiPixels;
|
||||
for (int y = 0; y < m_iHeight; y++)
|
||||
{
|
||||
for (int j = 0; j < m_iScale; j++)
|
||||
{
|
||||
puiSrc2 = puiSrc;
|
||||
for (int x = 0; x < m_iWidth; x++)
|
||||
{
|
||||
for (int i = 0; i < m_iScale; i++)
|
||||
{
|
||||
*puiPixel++ = *puiSrc2;
|
||||
}
|
||||
puiSrc2++;
|
||||
}
|
||||
}
|
||||
puiSrc = puiSrc2 + 1;
|
||||
}
|
||||
}
|
||||
|
||||
queue_draw_area(0, 0, m_iAreaWidth, m_iAreaHeight);
|
||||
}
|
||||
|
||||
void ScreenArea::vDrawColor(u32 _uiColor)
|
||||
{
|
||||
_uiColor = GUINT32_TO_BE(_uiColor) << 8;
|
||||
|
||||
u32 * puiPixel = m_puiPixels;
|
||||
u32 * puiEnd = m_puiPixels + m_iAreaWidth * m_iAreaHeight;
|
||||
while (puiPixel != puiEnd)
|
||||
{
|
||||
*puiPixel++ = _uiColor;
|
||||
}
|
||||
|
||||
queue_draw_area(0, 0, m_iAreaWidth, m_iAreaHeight);
|
||||
}
|
||||
|
||||
void ScreenArea::vUpdateSize()
|
||||
{
|
||||
if (m_puiPixels != NULL)
|
||||
{
|
||||
delete[] m_puiPixels;
|
||||
}
|
||||
|
||||
if (m_puiDelta != NULL)
|
||||
{
|
||||
delete[] m_puiDelta;
|
||||
}
|
||||
|
||||
m_iAreaWidth = m_iScale * m_iWidth;
|
||||
m_iAreaHeight = m_iScale * m_iHeight;
|
||||
m_iRowStride = m_iAreaWidth * 4;
|
||||
|
||||
m_puiPixels = new u32[m_iAreaWidth * m_iAreaHeight];
|
||||
|
||||
m_puiDelta = new u8[(m_iWidth + 2) * (m_iHeight + 2) * 4];
|
||||
memset(m_puiDelta, 255, (m_iWidth + 2) * (m_iHeight + 2) * 4);
|
||||
|
||||
set_size_request(m_iAreaWidth, m_iAreaHeight);
|
||||
}
|
||||
|
||||
void ScreenArea::vStartCursorTimeout()
|
||||
{
|
||||
m_oCursorSig.disconnect();
|
||||
m_oCursorSig = Glib::signal_timeout().connect(
|
||||
sigc::mem_fun(*this, &ScreenArea::bOnCursorTimeout),
|
||||
2000);
|
||||
}
|
||||
|
||||
void ScreenArea::vStopCursorTimeout()
|
||||
{
|
||||
m_oCursorSig.disconnect();
|
||||
}
|
||||
|
||||
void ScreenArea::vHideCursor()
|
||||
{
|
||||
get_window()->set_cursor(*m_poEmptyCursor);
|
||||
m_bShowCursor = false;
|
||||
}
|
||||
|
||||
void ScreenArea::vShowCursor()
|
||||
{
|
||||
get_window()->set_cursor();
|
||||
m_bShowCursor = true;
|
||||
}
|
||||
|
||||
bool ScreenArea::on_expose_event(GdkEventExpose * _pstEvent)
|
||||
{
|
||||
if (_pstEvent->area.x + _pstEvent->area.width > m_iAreaWidth
|
||||
|| _pstEvent->area.y + _pstEvent->area.height > m_iAreaHeight)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
guchar * puiAreaPixels = (guchar *)m_puiPixels;
|
||||
|
||||
if (_pstEvent->area.x != 0)
|
||||
{
|
||||
puiAreaPixels += _pstEvent->area.x << 2;
|
||||
}
|
||||
|
||||
if (_pstEvent->area.y != 0)
|
||||
{
|
||||
puiAreaPixels += _pstEvent->area.y * m_iRowStride;
|
||||
}
|
||||
|
||||
get_window()->draw_rgb_32_image(get_style()->get_fg_gc(get_state()),
|
||||
_pstEvent->area.x,
|
||||
_pstEvent->area.y,
|
||||
_pstEvent->area.width,
|
||||
_pstEvent->area.height,
|
||||
Gdk::RGB_DITHER_MAX,
|
||||
puiAreaPixels,
|
||||
m_iRowStride);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ScreenArea::on_motion_notify_event(GdkEventMotion * _pstEvent)
|
||||
{
|
||||
if (! m_bShowCursor)
|
||||
{
|
||||
vShowCursor();
|
||||
}
|
||||
vStartCursorTimeout();
|
||||
return false;
|
||||
}
|
||||
|
||||
bool ScreenArea::on_enter_notify_event(GdkEventCrossing * _pstEvent)
|
||||
{
|
||||
vStartCursorTimeout();
|
||||
return false;
|
||||
}
|
||||
|
||||
bool ScreenArea::on_leave_notify_event(GdkEventCrossing * _pstEvent)
|
||||
{
|
||||
vStopCursorTimeout();
|
||||
if (! m_bShowCursor)
|
||||
{
|
||||
vShowCursor();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool ScreenArea::bOnCursorTimeout()
|
||||
{
|
||||
vHideCursor();
|
||||
return false;
|
||||
}
|
||||
|
||||
} // namespace VBA
|
|
@ -0,0 +1,77 @@
|
|||
// -*- 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 __VBA_SCREENAREA_H__
|
||||
#define __VBA_SCREENAREA_H__
|
||||
|
||||
#include <gtkmm/drawingarea.h>
|
||||
#include <gdkmm/cursor.h>
|
||||
|
||||
#include "filters.h"
|
||||
|
||||
namespace VBA
|
||||
{
|
||||
|
||||
class ScreenArea : public Gtk::DrawingArea
|
||||
{
|
||||
public:
|
||||
ScreenArea(int _iWidth, int _iHeight, int _iScale = 1);
|
||||
virtual ~ScreenArea();
|
||||
|
||||
void vSetSize(int _iWidth, int _iHeight);
|
||||
void vSetScale(int _iScale);
|
||||
void vSetFilter2x(EFilter2x _eFilter2x);
|
||||
void vSetFilterIB(EFilterIB _eFilterIB);
|
||||
void vDrawPixels(u8 * _puiData);
|
||||
void vDrawColor(u32 _uiColor); // 0xRRGGBB
|
||||
|
||||
protected:
|
||||
virtual bool on_expose_event(GdkEventExpose * _pstEvent);
|
||||
virtual bool on_motion_notify_event(GdkEventMotion * _pstEvent);
|
||||
virtual bool on_enter_notify_event(GdkEventCrossing * _pstEvent);
|
||||
virtual bool on_leave_notify_event(GdkEventCrossing * _pstEvent);
|
||||
virtual bool bOnCursorTimeout();
|
||||
|
||||
private:
|
||||
int m_iWidth;
|
||||
int m_iHeight;
|
||||
int m_iScale;
|
||||
int m_iAreaWidth;
|
||||
int m_iAreaHeight;
|
||||
int m_iRowStride;
|
||||
u32 * m_puiPixels;
|
||||
u8 * m_puiDelta;
|
||||
Filter2x m_vFilter2x;
|
||||
FilterIB m_vFilterIB;
|
||||
|
||||
bool m_bShowCursor;
|
||||
Gdk::Cursor * m_poEmptyCursor;
|
||||
SigC::Connection m_oCursorSig;
|
||||
|
||||
void vUpdateSize();
|
||||
void vStartCursorTimeout();
|
||||
void vStopCursorTimeout();
|
||||
void vHideCursor();
|
||||
void vShowCursor();
|
||||
};
|
||||
|
||||
} // namespace VBA
|
||||
|
||||
|
||||
#endif // __VBA_SCREENAREA_H__
|
|
@ -0,0 +1,179 @@
|
|||
// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator.
|
||||
// Copyright (C) 1999-2003 Forgotten
|
||||
// Copyright (C) 2004 Forgotten and the VBA development team
|
||||
|
||||
// This program is free software; you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation; either version 2, or(at your option)
|
||||
// any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program; if not, write to the Free Software Foundation,
|
||||
// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "../agb/GBA.h"
|
||||
#include "../dmg/gb.h"
|
||||
#include "../dmg/gbGlobals.h"
|
||||
#include "../Util.h"
|
||||
#include "../Sound.h"
|
||||
|
||||
#include "window.h"
|
||||
#include "intl.h"
|
||||
|
||||
// Required vars, used by the emulator core
|
||||
//
|
||||
int systemRedShift;
|
||||
int systemGreenShift;
|
||||
int systemBlueShift;
|
||||
int systemColorDepth;
|
||||
int systemDebug;
|
||||
int systemVerbose;
|
||||
int systemSaveUpdateCounter;
|
||||
int systemFrameSkip;
|
||||
u32 systemColorMap32[0x10000];
|
||||
u16 systemColorMap16[0x10000];
|
||||
u16 systemGbPalette[24];
|
||||
int systemThrottle = 0;
|
||||
|
||||
int emulating;
|
||||
bool debugger;
|
||||
int RGB_LOW_BITS_MASK;
|
||||
|
||||
// Extra vars, only used for the GUI
|
||||
//
|
||||
int systemRenderedFrames;
|
||||
int systemFPS;
|
||||
|
||||
inline VBA::Window * GUI()
|
||||
{
|
||||
return VBA::Window::poGetInstance();
|
||||
}
|
||||
|
||||
void systemMessage(int _iId, const char * _csFormat, ...)
|
||||
{
|
||||
va_list args;
|
||||
va_start(args, _csFormat);
|
||||
|
||||
GUI()->vPopupErrorV(_(_csFormat), args);
|
||||
|
||||
va_end(args);
|
||||
}
|
||||
|
||||
void systemDrawScreen()
|
||||
{
|
||||
GUI()->vDrawScreen();
|
||||
systemRenderedFrames++;
|
||||
}
|
||||
|
||||
bool systemReadJoypads()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
u32 systemReadJoypad(int)
|
||||
{
|
||||
return GUI()->uiReadJoypad();
|
||||
}
|
||||
|
||||
void systemShowSpeed(int _iSpeed)
|
||||
{
|
||||
systemFPS = systemRenderedFrames;
|
||||
systemRenderedFrames = 0;
|
||||
|
||||
GUI()->vShowSpeed(_iSpeed);
|
||||
}
|
||||
|
||||
void system10Frames(int _iRate)
|
||||
{
|
||||
GUI()->vComputeFrameskip(_iRate);
|
||||
}
|
||||
|
||||
void systemFrame()
|
||||
{
|
||||
}
|
||||
|
||||
void systemSetTitle(const char * _csTitle)
|
||||
{
|
||||
GUI()->set_title(_csTitle);
|
||||
}
|
||||
|
||||
void systemScreenCapture(int _iNum)
|
||||
{
|
||||
GUI()->vCaptureScreen(_iNum);
|
||||
}
|
||||
|
||||
u32 systemGetClock()
|
||||
{
|
||||
Glib::TimeVal time;
|
||||
time.assign_current_time();
|
||||
return time.as_double() * 1000;
|
||||
}
|
||||
|
||||
void systemUpdateMotionSensor()
|
||||
{
|
||||
}
|
||||
|
||||
int systemGetSensorX()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int systemGetSensorY()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
void systemGbPrint(u8 * _puiData,
|
||||
int _iPages,
|
||||
int _iFeed,
|
||||
int _iPalette,
|
||||
int _iContrast)
|
||||
{
|
||||
}
|
||||
|
||||
void systemScreenMessage(const char * _csMsg)
|
||||
{
|
||||
}
|
||||
|
||||
bool systemCanChangeSoundQuality()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool systemPauseOnFrame()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
void systemGbBorderOn()
|
||||
{
|
||||
}
|
||||
|
||||
void debuggerMain()
|
||||
{
|
||||
}
|
||||
|
||||
void debuggerSignal(int, int)
|
||||
{
|
||||
}
|
||||
|
||||
void debuggerOutput(const char *, u32)
|
||||
{
|
||||
}
|
||||
|
||||
void debuggerBreakOnWrite(u32 address, u32 oldvalue, u32 value, int size, int t)
|
||||
{
|
||||
}
|
||||
|
||||
void (*dbgMain)() = debuggerMain;
|
||||
void (*dbgSignal)(int, int) = debuggerSignal;
|
||||
void (*dbgOutput)(const char *, u32) = debuggerOutput;
|
|
@ -0,0 +1,65 @@
|
|||
// VisualBoyAdvance - Nintendo Gameboy/GameboyAdvance (TM) emulator.
|
||||
// Copyright (C) 1999-2003 Forgotten
|
||||
// Copyright (C) 2004 Forgotten and the VBA development team
|
||||
|
||||
// This program is free software; you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation; either version 2, or(at your option)
|
||||
// any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program; if not, write to the Free Software Foundation,
|
||||
// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
#include "tools.h"
|
||||
|
||||
namespace VBA
|
||||
{
|
||||
|
||||
std::string sCutSuffix(const std::string & _rsString,
|
||||
const std::string & _rsSep)
|
||||
{
|
||||
return _rsString.substr(0, _rsString.find_last_of(_rsSep));
|
||||
}
|
||||
|
||||
Glib::ustring sCutSuffix(const Glib::ustring & _rsString,
|
||||
const Glib::ustring & _rsSep)
|
||||
{
|
||||
return _rsString.substr(0, _rsString.find_last_of(_rsSep));
|
||||
}
|
||||
|
||||
bool bHasSuffix(const Glib::ustring & _rsString,
|
||||
const Glib::ustring & _rsSuffix,
|
||||
bool _bCaseSensitive)
|
||||
{
|
||||
if (_rsSuffix.size() > _rsString.size())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
Glib::ustring sEnd = _rsString.substr(_rsString.size() - _rsSuffix.size());
|
||||
|
||||
if (_bCaseSensitive)
|
||||
{
|
||||
if (_rsSuffix == sEnd)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (_rsSuffix.lowercase() == sEnd.lowercase())
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
} // namespace VBA
|
|
@ -0,0 +1,42 @@
|
|||
// -*- 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 __VBA_TOOLS_H__
|
||||
#define __VBA_TOOLS_H__
|
||||
|
||||
#include <string>
|
||||
#include <glibmm/ustring.h>
|
||||
|
||||
namespace VBA
|
||||
{
|
||||
|
||||
std::string sCutSuffix(const std::string & _rsString,
|
||||
const std::string & _rsSep = ".");
|
||||
|
||||
Glib::ustring sCutSuffix(const Glib::ustring & _rsString,
|
||||
const Glib::ustring & _rsSep = ".");
|
||||
|
||||
bool bHasSuffix(const Glib::ustring & _rsString,
|
||||
const Glib::ustring & _rsSuffix,
|
||||
bool _bCaseSensitive = true);
|
||||
|
||||
}
|
||||
|
||||
|
||||
#endif // __VBA_TOOLS_H__
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,309 @@
|
|||
// -*- 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 __VBA_WINDOW_H__
|
||||
#define __VBA_WINDOW_H__
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <stdarg.h>
|
||||
|
||||
#include <gtkmm.h>
|
||||
#include <libglademm.h>
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <list>
|
||||
|
||||
#include "../System.h"
|
||||
|
||||
#include "configfile.h"
|
||||
#include "screenarea.h"
|
||||
#include "filters.h"
|
||||
#include "input.h"
|
||||
#include "joypadconfig.h"
|
||||
|
||||
namespace VBA
|
||||
{
|
||||
|
||||
class Window : public Gtk::Window
|
||||
{
|
||||
friend class Gnome::Glade::Xml;
|
||||
|
||||
public:
|
||||
virtual ~Window();
|
||||
|
||||
inline static Window * poGetInstance() { return m_poInstance; }
|
||||
|
||||
enum ECartridge
|
||||
{
|
||||
CartridgeNone,
|
||||
CartridgeGB,
|
||||
CartridgeGBA
|
||||
};
|
||||
|
||||
// GB/GBA screen sizes
|
||||
const int m_iGBScreenWidth;
|
||||
const int m_iGBScreenHeight;
|
||||
const int m_iSGBScreenWidth;
|
||||
const int m_iSGBScreenHeight;
|
||||
const int m_iGBAScreenWidth;
|
||||
const int m_iGBAScreenHeight;
|
||||
|
||||
bool bLoadROM(const std::string & _rsFile);
|
||||
void vPopupError(const char * _csFormat, ...);
|
||||
void vPopupErrorV(const char * _csFormat, va_list _args);
|
||||
void vDrawScreen();
|
||||
void vComputeFrameskip(int _iRate);
|
||||
void vShowSpeed(int _iSpeed);
|
||||
void vCaptureScreen(int _iNum);
|
||||
u32 uiReadJoypad();
|
||||
|
||||
inline ECartridge eGetCartridge() const { return m_eCartridge; }
|
||||
|
||||
protected:
|
||||
Window(GtkWindow * _pstWindow,
|
||||
const Glib::RefPtr<Gnome::Glade::Xml> & _poXml);
|
||||
|
||||
enum EShowSpeed
|
||||
{
|
||||
ShowNone,
|
||||
ShowPercentage,
|
||||
ShowDetailed
|
||||
};
|
||||
|
||||
enum ESaveType
|
||||
{
|
||||
SaveAuto,
|
||||
SaveEEPROM,
|
||||
SaveSRAM,
|
||||
SaveFlash,
|
||||
SaveEEPROMSensor,
|
||||
SaveNone
|
||||
};
|
||||
|
||||
enum ESoundStatus
|
||||
{
|
||||
SoundOff,
|
||||
SoundMute,
|
||||
SoundOn
|
||||
};
|
||||
|
||||
enum ESoundQuality
|
||||
{
|
||||
Sound44K = 1,
|
||||
Sound22K = 2,
|
||||
Sound11K = 4
|
||||
};
|
||||
|
||||
enum ESoundVolume
|
||||
{
|
||||
Sound100,
|
||||
Sound200,
|
||||
Sound300,
|
||||
Sound400,
|
||||
Sound25,
|
||||
Sound50
|
||||
};
|
||||
|
||||
enum EEmulatorType
|
||||
{
|
||||
EmulatorAuto,
|
||||
EmulatorCGB,
|
||||
EmulatorSGB,
|
||||
EmulatorGB,
|
||||
EmulatorGBA,
|
||||
EmulatorSGB2
|
||||
};
|
||||
|
||||
virtual void vOnFileOpen();
|
||||
virtual void vOnFileLoad();
|
||||
virtual void vOnFileSave();
|
||||
virtual void vOnLoadGameMostRecent();
|
||||
virtual void vOnLoadGameAutoToggled(Gtk::CheckMenuItem * _poCMI);
|
||||
void vOnLoadGame(int _iSlot);
|
||||
virtual void vOnSaveGameOldest();
|
||||
void vOnSaveGame(int _iSlot);
|
||||
virtual void vOnFilePauseToggled(Gtk::CheckMenuItem * _poCMI);
|
||||
virtual void vOnFileReset();
|
||||
virtual void vOnRecentReset();
|
||||
virtual void vOnRecentFreezeToggled(Gtk::CheckMenuItem * _poCMI);
|
||||
virtual void vOnRecentFile(std::string _sFile);
|
||||
virtual void vOnImportBatteryFile();
|
||||
virtual void vOnExportBatteryFile();
|
||||
virtual void vOnFileScreenCapture();
|
||||
virtual void vOnFileClose();
|
||||
virtual void vOnFileExit();
|
||||
virtual void vOnFrameskipToggled(Gtk::CheckMenuItem * _poCMI, int _iValue);
|
||||
virtual void vOnThrottleToggled(Gtk::CheckMenuItem * _poCMI, int _iPercent);
|
||||
virtual void vOnThrottleOther(Gtk::CheckMenuItem * _poCMI);
|
||||
virtual void vOnVideoScaleToggled(Gtk::CheckMenuItem * _poCMI, int _iScale);
|
||||
virtual void vOnLayerToggled(Gtk::CheckMenuItem * _poCMI, int _iLayer);
|
||||
virtual void vOnDirectories();
|
||||
virtual void vOnDirectoryReset(Gtk::Entry * _poEntry);
|
||||
virtual void vOnDirectorySelect(Gtk::Entry * _poEntry);
|
||||
virtual void vOnPauseWhenInactiveToggled(Gtk::CheckMenuItem * _poCMI);
|
||||
virtual void vOnSelectBios();
|
||||
virtual void vOnUseBiosToggled(Gtk::CheckMenuItem * _poCMI);
|
||||
virtual void vOnShowSpeedToggled(Gtk::CheckMenuItem * _poCMI, int _iShowSpeed);
|
||||
virtual void vOnSaveTypeToggled(Gtk::CheckMenuItem * _poCMI, int _iSaveType);
|
||||
virtual void vOnFlashSizeToggled(Gtk::CheckMenuItem * _poCMI, int _iFlashSize);
|
||||
virtual void vOnScreenshotFormatToggled(Gtk::CheckMenuItem * _poCMI, std::string _sFormat);
|
||||
virtual void vOnSoundStatusToggled(Gtk::CheckMenuItem * _poCMI, int _iSoundStatus);
|
||||
virtual void vOnSoundEchoToggled(Gtk::CheckMenuItem * _poCMI);
|
||||
virtual void vOnSoundLowPassToggled(Gtk::CheckMenuItem * _poCMI);
|
||||
virtual void vOnSoundReverseToggled(Gtk::CheckMenuItem * _poCMI);
|
||||
virtual void vOnSoundChannelToggled(Gtk::CheckMenuItem * _poCMI, int _iSoundChannel);
|
||||
virtual void vOnSoundQualityToggled(Gtk::CheckMenuItem * _poCMI, int _iSoundQuality);
|
||||
virtual void vOnSoundVolumeToggled(Gtk::CheckMenuItem * _poCMI, int _iSoundVolume);
|
||||
virtual void vOnGBBorderToggled(Gtk::CheckMenuItem * _poCMI);
|
||||
virtual void vOnGBPrinterToggled(Gtk::CheckMenuItem * _poCMI);
|
||||
virtual void vOnEmulatorTypeToggled(Gtk::CheckMenuItem * _poCMI, int _iEmulatorType);
|
||||
virtual void vOnFilter2xToggled(Gtk::CheckMenuItem * _poCMI, int _iFilter2x);
|
||||
virtual void vOnFilterIBToggled(Gtk::CheckMenuItem * _poCMI, int _iFilterIB);
|
||||
virtual void vOnJoypadConfigure(int _iJoypad);
|
||||
virtual void vOnJoypadToggled(Gtk::CheckMenuItem * _poCMI, int _iJoypad);
|
||||
virtual void vOnAutofireToggled(Gtk::CheckMenuItem * _poCMI, u32 _uiKeyFlag);
|
||||
virtual void vOnGDBWait();
|
||||
virtual void vOnGDBLoadAndWait();
|
||||
virtual void vOnGDBBreak();
|
||||
virtual void vOnGDBDisconnect();
|
||||
virtual void vOnHelpAbout();
|
||||
virtual bool bOnEmuIdle();
|
||||
|
||||
virtual bool on_focus_in_event(GdkEventFocus * _pstEvent);
|
||||
virtual bool on_focus_out_event(GdkEventFocus * _pstEvent);
|
||||
virtual bool on_key_press_event(GdkEventKey * _pstEvent);
|
||||
virtual bool on_key_release_event(GdkEventKey * _pstEvent);
|
||||
|
||||
private:
|
||||
// Config limits
|
||||
const int m_iFrameskipMin;
|
||||
const int m_iFrameskipMax;
|
||||
const int m_iThrottleMin;
|
||||
const int m_iThrottleMax;
|
||||
const int m_iScaleMin;
|
||||
const int m_iScaleMax;
|
||||
const int m_iShowSpeedMin;
|
||||
const int m_iShowSpeedMax;
|
||||
const int m_iSaveTypeMin;
|
||||
const int m_iSaveTypeMax;
|
||||
const int m_iSoundQualityMin;
|
||||
const int m_iSoundQualityMax;
|
||||
const int m_iSoundVolumeMin;
|
||||
const int m_iSoundVolumeMax;
|
||||
const int m_iEmulatorTypeMin;
|
||||
const int m_iEmulatorTypeMax;
|
||||
const int m_iFilter2xMin;
|
||||
const int m_iFilter2xMax;
|
||||
const int m_iFilterIBMin;
|
||||
const int m_iFilterIBMax;
|
||||
const int m_iJoypadMin;
|
||||
const int m_iJoypadMax;
|
||||
|
||||
static Window * m_poInstance;
|
||||
|
||||
Glib::RefPtr<Gnome::Glade::Xml> m_poXml;
|
||||
|
||||
std::string m_sUserDataDir;
|
||||
std::string m_sConfigFile;
|
||||
Config::File m_oConfig;
|
||||
Config::Section * m_poHistoryConfig;
|
||||
Config::Section * m_poDirConfig;
|
||||
Config::Section * m_poCoreConfig;
|
||||
Config::Section * m_poDisplayConfig;
|
||||
Config::Section * m_poSoundConfig;
|
||||
Config::Section * m_poInputConfig;
|
||||
|
||||
Gtk::FileChooserDialog * m_poFileOpenDialog;
|
||||
|
||||
ScreenArea * m_poScreenArea;
|
||||
Gtk::Menu * m_poRecentMenu;
|
||||
Gtk::MenuItem * m_poRecentResetItem;
|
||||
Gtk::CheckMenuItem * m_poFilePauseItem;
|
||||
Gtk::CheckMenuItem * m_poUseBiosItem;
|
||||
Gtk::CheckMenuItem * m_poSoundOffItem;
|
||||
|
||||
struct SGameSlot
|
||||
{
|
||||
bool m_bEmpty;
|
||||
std::string m_sFile;
|
||||
time_t m_uiTime;
|
||||
};
|
||||
|
||||
Gtk::MenuItem * m_apoLoadGameItem[10];
|
||||
Gtk::MenuItem * m_apoSaveGameItem[10];
|
||||
SGameSlot m_astGameSlot[10];
|
||||
|
||||
std::list<std::string> m_listHistory;
|
||||
|
||||
std::list<Gtk::Widget *> m_listSensitiveWhenPlaying;
|
||||
|
||||
Gtk::Tooltips m_oTooltips;
|
||||
|
||||
SigC::Connection m_oEmuSig;
|
||||
|
||||
std::vector<JoypadConfig> m_oJoypads;
|
||||
Keymap * m_poKeymap;
|
||||
|
||||
int m_iScreenWidth;
|
||||
int m_iScreenHeight;
|
||||
|
||||
std::string m_sRomFile;
|
||||
ECartridge m_eCartridge;
|
||||
EmulatedSystem m_stEmulator;
|
||||
u32 m_uiJoypadState;
|
||||
u32 m_uiAutofireState;
|
||||
bool m_bAutofireToggle;
|
||||
bool m_bPaused;
|
||||
bool m_bWasEmulating;
|
||||
bool m_bAutoFrameskip;
|
||||
Glib::TimeVal m_uiThrottleLastTime;
|
||||
Glib::TimeVal m_uiThrottleDelay;
|
||||
EShowSpeed m_eShowSpeed;
|
||||
ESoundQuality m_eSoundQuality;
|
||||
|
||||
void vInitSystem();
|
||||
void vInitConfig();
|
||||
void vCheckConfig();
|
||||
void vLoadConfig(const std::string & _rsFile);
|
||||
void vSaveConfig(const std::string & _rsFile);
|
||||
void vLoadHistoryFromConfig();
|
||||
void vSaveHistoryToConfig();
|
||||
void vHistoryAdd(const std::string & _rsFile);
|
||||
void vClearHistoryMenu();
|
||||
void vUpdateHistoryMenu();
|
||||
void vLoadJoypadsFromConfig();
|
||||
void vSaveJoypadsToConfig();
|
||||
void vUpdateScreen();
|
||||
void vDrawDefaultScreen();
|
||||
void vSetDefaultTitle();
|
||||
void vCreateFileOpenDialog();
|
||||
void vLoadBattery();
|
||||
void vSaveBattery();
|
||||
void vStartEmu();
|
||||
void vStopEmu();
|
||||
void vSetThrottle(int _iPercent);
|
||||
void vSelectBestThrottleItem();
|
||||
void vUpdateGameSlots();
|
||||
};
|
||||
|
||||
} // namespace VBA
|
||||
|
||||
|
||||
#endif // __VBA_WINDOW_H__
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue