Supermodel/Src/Supermodel.h

183 lines
5.2 KiB
C
Raw Normal View History

2011-04-24 01:14:00 +00:00
/**
** Supermodel
** A Sega Model 3 Arcade Emulator.
** Copyright 2011-2012 Bart Trzynadlowski, Nik Henson
2011-04-24 01:14:00 +00:00
**
** This file is part of Supermodel.
**
** Supermodel 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 3 of the License, or (at your option)
** any later version.
**
** Supermodel 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 Supermodel. If not, see <http://www.gnu.org/licenses/>.
**/
/*
* Supermodel.h
*
* Program-wide header file.
*/
#ifndef INCLUDED_SUPERMODEL_H
#define INCLUDED_SUPERMODEL_H
// Used throughout Supermodel
#include <cstdio>
#include <cstdlib>
#include <cstring>
2011-04-24 01:14:00 +00:00
/******************************************************************************
Program-Wide Definitions
******************************************************************************/
#include "Version.h"
2011-04-24 01:14:00 +00:00
/******************************************************************************
OS-Dependent (OSD) Items
Everything here must be provided by the OSD layer. The following include files
must be located in the OSD directories for each port:
Types.h Defines fundamental data types.
OSDConfig.h COSDConfig class (OSD-specific configuration settings).
2011-04-24 01:14:00 +00:00
******************************************************************************/
// stricmp() is non-standard, apparently...
#ifdef _MSC_VER // MS VisualC++
#define stricmp _stricmp
#else // assume GCC
#define stricmp strcasecmp
#endif
// 32-bit rotate left
#ifdef _MSC_VER // MS VisualC++ - use VS intrinsic function _rotl
#define rotl(val, shift) val = _rotl(val, shift)
#else // Otherwise assume GCC which should optimise following to asm
#define rotl(val, shift) val = (val>>shift)|(val<<(32-shift))
#endif
2011-04-24 01:14:00 +00:00
/*
* Fundamental Data Types:
*
* UINT64 Unsigned 64-bit integer.
* INT64 Signed 64-bit integer.
* UINT32 Unsigned 32-bit integer.
* INT32 Signed 32-bit integer.
* UINT16 Unsigned 16-bit integer.
* INT16 Signed 16-bit integer.
* UINT8 Unsigned 8-bit integer.
* INT8 Signed 8-bit integer.
* FLOAT32 Single-precision, 32-bit floating point number.
* FLOAT64 Double-precision, 64-bit floating point number.
*
* Boolean Values:
*
* OKAY 0
* FAIL 1
*
* Types.h is used within C++ and C modules, so it must NOT include any C++-
* specific stuff. Some modules may choose to include it directly rather than
* use Supermodel.h, so it must exist.
2011-04-24 01:14:00 +00:00
*/
#include "Types.h" // located in OSD/<port>/ directory
2011-04-24 01:14:00 +00:00
/*
* OSD Header Files
2011-04-24 01:14:00 +00:00
*/
// Error logging interface
#include "OSD/Logger.h"
2011-04-24 01:14:00 +00:00
// OSD Interfaces
#include "OSD/Thread.h"
#include "OSD/Audio.h"
#include "OSD/Video.h"
Committing various small updates that have been hanging around in my source tree for a while now: - Added 'crosshairs' command line and config option. - Added 'vsync' command line and config option (so far only tested on NVidia cards on Windows 7 - other graphics drivers, O/Ss or driver settings may simply chose to ignore this). - Added fullscreen toggle within game using Alt+Enter key combination. - Added framework for lamp outputs and 'outputs' command line and config option. So far only the lamps for driving games are hooked up in the emulator (others to be added later). - Added an initial outputs implementation for Windows that sends MAMEHooker compatible messages (-outputs=win to enable) - Fixed fps calculation in Main.cpp that was producing incorrect results and so giving the impression that frame throttling wasn't working properly when in fact it was. - Fixed palette indexed colours as the index was always off by one, causing incorrect colours in various games, eg drivers' suits and flashing Start sign in Daytona 2. - Altered caching of models so that models with palette indexed colours use the dynamic cache rather than the static one. This is so that changes in palette indexed colours appear on screen, eg the flashing Start sign on the advanced course of Daytona 2 (although currently the START message itself is not visible due to other problems with texture decoding). - Fixed small bug in TileGen.cpp which meant both palettes were being completely recomputed pretty much with every frame. This was a significant performance hit, particularly as palette recomputation is currently being done in SyncSnapshots (it should be moved out of here at some point, although for now it's no big deal). - Made sure all OpenGL objects and resources are deleted in Render2D/3D destructors, in particular the deleting of the VBO buffer in DestroyModelCache. - Made sure that GLSL uniforms are always checked to see if they are bound before using them in order to stop unecessary (but harmless) GL errors. - Altered the default texture sheet handling to use a single large GL texture holding multiple Model3 texture sheets rather than multiple GL textures as before (if required, the old behaviour can still be selected with the mulisheet fragment shader). I believe this fixes the disappearing crosshairs/corrupt GL state problem which the multisheet fragment shader seemed to be triggering somehow. - Fixed a bug in debugger which meant memory watches were not triggering properly
2012-07-15 21:04:46 +00:00
#include "OSD/Outputs.h"
2011-04-24 01:14:00 +00:00
/******************************************************************************
Header Files
All primary header files for modules used throughout Supermodel are included
here, except for external packages and APIs.
******************************************************************************/
2011-04-24 01:14:00 +00:00
#include "Games.h"
#include "ROMLoad.h"
#include "INIFile.h"
#include "BlockFile.h"
#include "Graphics/New3D/New3D.h"
2011-04-24 01:14:00 +00:00
#include "Graphics/Render2D.h"
#include "Graphics/Legacy3D/TextureRefs.h"
#include "Graphics/Legacy3D/Legacy3D.h"
2011-04-24 01:14:00 +00:00
#include "Graphics/Shader.h"
2011-06-27 23:22:50 +00:00
#ifdef SUPERMODEL_DEBUGGER
#include "Debugger/SupermodelDebugger.h"
#include "Debugger/CPU/PPCDebug.h"
#include "Debugger/CPU/Musashi68KDebug.h"
#include "Debugger/CPU/Z80Debug.h"
2011-06-27 23:22:50 +00:00
#endif // SUPERMODEL_DEBUGGER
#include "CPU/Bus.h"
2011-04-24 01:14:00 +00:00
#include "CPU/PowerPC/PPCDisasm.h"
#include "CPU/PowerPC/ppc.h"
#include "CPU/68K/68K.h"
2011-07-18 19:59:37 +00:00
#include "CPU/Z80/Z80.h"
#include "Inputs/Input.h"
#include "Inputs/Inputs.h"
#include "Inputs/InputSource.h"
#include "Inputs/InputSystem.h"
#include "Inputs/InputTypes.h"
#include "Inputs/MultiInputSource.h"
2011-04-24 01:14:00 +00:00
#include "Model3/IRQ.h"
#include "Model3/PCI.h"
#include "Model3/53C810.h"
#include "Model3/MPC10x.h"
#include "Model3/RTC72421.h"
#include "Model3/93C46.h"
#include "Model3/TileGen.h"
#include "Model3/Real3D.h"
#include "Sound/SCSP.h"
#include "Sound/MPEG/MPEG.h"
2011-04-24 01:14:00 +00:00
#include "Model3/SoundBoard.h"
#include "Model3/DSB.h"
2011-09-07 07:08:32 +00:00
#include "Model3/DriveBoard.h"
2011-04-24 01:14:00 +00:00
#include "Model3/Model3.h"
2011-04-24 01:14:00 +00:00
/******************************************************************************
Helpful Macros and Inlines
******************************************************************************/
/*
* FLIPENDIAN16(data):
* FLIPENDIAN32(data):
*
* Flips the endianness of the data (reverses bytes).
*
* Parameters:
* data Word or half-word to flip.
*
* Returns:
* Flipped word.
*/
static inline UINT16 FLIPENDIAN16(UINT16 d)
{
return ((d>>8) | (d<<8));
2011-04-24 01:14:00 +00:00
}
static inline UINT32 FLIPENDIAN32(UINT32 d)
{
return ((d>>24) | ((d<<8)&0x00FF0000) | ((d>>8)&0x0000FF00) | (d<<24));
2011-04-24 01:14:00 +00:00
}
#endif // INCLUDED_SUPERMODEL_H