Getting rid of most of the includes from Supermodel.h; each file now explicitly includes the header files it needs.

Making changes to a header file should no longer force the entire project to recompile.
This commit is contained in:
Matthew Daniels 2021-11-22 17:15:06 +00:00
parent 50465f9a5a
commit 9ffce8b92a
77 changed files with 1024 additions and 915 deletions

View file

@ -26,6 +26,8 @@
* class.
*/
#include "BlockFile.h"
#include <cstdio>
#include <cstring>
#include <cstdint>

View file

@ -33,9 +33,11 @@
* accesses (interrupts pending, halted status, etc.)
*/
#include "68K.h"
#include "Supermodel.h"
#include "Musashi/m68k.h" // Musashi 68K core
#include "Debugger/CPU/Musashi68KDebug.h"
/******************************************************************************
Internal Context

View file

@ -37,6 +37,7 @@
#include "Musashi/m68k.h"
#include "Musashi/m68kctx.h"
#include "CPU/Bus.h"
#include "BlockFile.h"
// This doesn't work for now (needs to be added to the prototypes in m68k.h for m68k_read_memory*)
//#ifndef FASTCALL

View file

@ -28,6 +28,7 @@
#ifndef INCLUDED_BUS_H
#define INCLUDED_BUS_H
#include "Types.h"
/*
* IBus:

View file

@ -28,16 +28,15 @@
/* IBM/Motorola PowerPC 4xx/6xx Emulator */
#include "ppc.h"
#include <cstring> // memset()
#include "Supermodel.h"
#include "ppc.h"
#include "CPU/Bus.h"
// Typedefs that Supermodel no longer provides
typedef unsigned int UINT;
// C++ should allow this...
#define INLINE inline
// Model 3 context provides read/write handlers
static class IBus *Bus = NULL; // pointer to Model 3 bus object (for access handlers)
@ -294,7 +293,7 @@ static void ppc_change_pc(UINT32 newpc)
if (ppc.cur_fetch.start <= newpc && newpc <= ppc.cur_fetch.end)
{
ppc.op = &ppc.cur_fetch.ptr[(newpc-ppc.cur_fetch.start)/4];
ppc.op = &ppc.cur_fetch.ptr[(newpc-ppc.cur_fetch.start)/4];
// ppc.op = (UINT32 *)((void *)ppc.cur_fetch.ptr + (UINT32)(newpc - ppc.cur_fetch.start));
return;
}
@ -307,7 +306,7 @@ static void ppc_change_pc(UINT32 newpc)
ppc.cur_fetch.end = ppc.fetch[i].end;
ppc.cur_fetch.ptr = ppc.fetch[i].ptr;
// ppc.op = (UINT32 *)((UINT32)ppc.cur_fetch.ptr + (UINT32)(newpc - ppc.cur_fetch.start));
// ppc.op = (UINT32 *)((UINT32)ppc.cur_fetch.ptr + (UINT32)(newpc - ppc.cur_fetch.start));
ppc.op = &ppc.cur_fetch.ptr[(newpc-ppc.cur_fetch.start)/4];
return;
}
@ -318,42 +317,42 @@ static void ppc_change_pc(UINT32 newpc)
ppc.fatalError = true;
}
INLINE UINT8 READ8(UINT32 address)
inline UINT8 READ8(UINT32 address)
{
return Bus->Read8(address);
}
INLINE UINT16 READ16(UINT32 address)
inline UINT16 READ16(UINT32 address)
{
return Bus->Read16(address);
}
INLINE UINT32 READ32(UINT32 address)
inline UINT32 READ32(UINT32 address)
{
return Bus->Read32(address);
}
INLINE UINT64 READ64(UINT32 address)
inline UINT64 READ64(UINT32 address)
{
return Bus->Read64(address);
}
INLINE void WRITE8(UINT32 address, UINT8 data)
inline void WRITE8(UINT32 address, UINT8 data)
{
Bus->Write8(address,data);
}
INLINE void WRITE16(UINT32 address, UINT16 data)
inline void WRITE16(UINT32 address, UINT16 data)
{
Bus->Write16(address,data);
}
INLINE void WRITE32(UINT32 address, UINT32 data)
inline void WRITE32(UINT32 address, UINT32 data)
{
Bus->Write32(address,data);
}
INLINE void WRITE64(UINT32 address, UINT64 data)
inline void WRITE64(UINT32 address, UINT64 data)
{
Bus->Write64(address,data);
}
@ -362,7 +361,7 @@ INLINE void WRITE64(UINT32 address, UINT64 data)
/*********************************************************************/
INLINE void SET_CR0(INT32 rd)
inline void SET_CR0(INT32 rd)
{
if( rd < 0 ) {
CR(0) = 0x8;
@ -376,12 +375,12 @@ INLINE void SET_CR0(INT32 rd)
CR(0) |= 0x1;
}
INLINE void SET_CR1(void)
inline void SET_CR1(void)
{
CR(1) = (ppc.fpscr >> 28) & 0xf;
}
INLINE void SET_ADD_OV(UINT32 rd, UINT32 ra, UINT32 rb)
inline void SET_ADD_OV(UINT32 rd, UINT32 ra, UINT32 rb)
{
if( ADD_OV(rd, ra, rb) )
XER |= XER_SO | XER_OV;
@ -389,7 +388,7 @@ INLINE void SET_ADD_OV(UINT32 rd, UINT32 ra, UINT32 rb)
XER &= ~XER_OV;
}
INLINE void SET_SUB_OV(UINT32 rd, UINT32 ra, UINT32 rb)
inline void SET_SUB_OV(UINT32 rd, UINT32 ra, UINT32 rb)
{
if( SUB_OV(rd, ra, rb) )
XER |= XER_SO | XER_OV;
@ -397,7 +396,7 @@ INLINE void SET_SUB_OV(UINT32 rd, UINT32 ra, UINT32 rb)
XER &= ~XER_OV;
}
INLINE void SET_ADD_CA(UINT32 rd, UINT32 ra, UINT32 rb)
inline void SET_ADD_CA(UINT32 rd, UINT32 ra, UINT32 rb)
{
if( ADD_CA(rd, ra, rb) )
XER |= XER_CA;
@ -405,7 +404,7 @@ INLINE void SET_ADD_CA(UINT32 rd, UINT32 ra, UINT32 rb)
XER &= ~XER_CA;
}
INLINE void SET_SUB_CA(UINT32 rd, UINT32 ra, UINT32 rb)
inline void SET_SUB_CA(UINT32 rd, UINT32 ra, UINT32 rb)
{
if( SUB_CA(rd, ra, rb) )
XER |= XER_CA;
@ -413,7 +412,7 @@ INLINE void SET_SUB_CA(UINT32 rd, UINT32 ra, UINT32 rb)
XER &= ~XER_CA;
}
INLINE UINT32 check_condition_code(UINT32 bo, UINT32 bi)
inline UINT32 check_condition_code(UINT32 bo, UINT32 bi)
{
UINT32 ctr_ok;
UINT32 condition_ok;
@ -431,7 +430,7 @@ INLINE UINT32 check_condition_code(UINT32 bo, UINT32 bi)
return ctr_ok && condition_ok;
}
INLINE UINT64 ppc_read_timebase(void)
inline UINT64 ppc_read_timebase(void)
{
int cycles = ppc.tb_base_icount - ppc.icount;
@ -439,7 +438,7 @@ INLINE UINT64 ppc_read_timebase(void)
return ppc.tb + (cycles / ppc.timer_ratio);
}
INLINE void ppc_write_timebase_l(UINT32 tbl)
inline void ppc_write_timebase_l(UINT32 tbl)
{
UINT64 tb = ppc_read_timebase();
@ -448,7 +447,7 @@ INLINE void ppc_write_timebase_l(UINT32 tbl)
ppc.tb = (tb&~0xffffffff)|tbl;
}
INLINE void ppc_write_timebase_h(UINT32 tbh)
inline void ppc_write_timebase_h(UINT32 tbh)
{
UINT64 tb = ppc_read_timebase();
@ -457,7 +456,7 @@ INLINE void ppc_write_timebase_h(UINT32 tbh)
ppc.tb = (tb&0xffffffff)|((UINT64)(tbh) << 32);
}
INLINE UINT32 read_decrementer(void)
inline UINT32 read_decrementer(void)
{
int cycles = ppc.dec_base_icount - ppc.icount;
@ -465,7 +464,7 @@ INLINE UINT32 read_decrementer(void)
return DEC - (cycles / ppc.timer_ratio);
}
INLINE void write_decrementer(UINT32 value)
inline void write_decrementer(UINT32 value)
{
if (((value&0x80000000) && !(read_decrementer()&0x80000000)))
{
@ -488,7 +487,7 @@ INLINE void write_decrementer(UINT32 value)
/*********************************************************************/
INLINE void ppc_set_spr(int spr, UINT32 value)
inline void ppc_set_spr(int spr, UINT32 value)
{
switch (spr)
{
@ -561,7 +560,7 @@ INLINE void ppc_set_spr(int spr, UINT32 value)
ppc.fatalError = true;
}
INLINE UINT32 ppc_get_spr(int spr)
inline UINT32 ppc_get_spr(int spr)
{
switch(spr)
{
@ -624,7 +623,7 @@ INLINE UINT32 ppc_get_spr(int spr)
return 0;
}
INLINE void ppc_set_msr(UINT32 value)
inline void ppc_set_msr(UINT32 value)
{
if( value & (MSR_ILE | MSR_LE) )
{
@ -638,12 +637,12 @@ INLINE void ppc_set_msr(UINT32 value)
ppc603_check_interrupts();
}
INLINE UINT32 ppc_get_msr(void)
inline UINT32 ppc_get_msr(void)
{
return MSR;
}
INLINE void ppc_set_cr(UINT32 value)
inline void ppc_set_cr(UINT32 value)
{
CR(0) = (value >> 28) & 0xf;
CR(1) = (value >> 24) & 0xf;
@ -655,7 +654,7 @@ INLINE void ppc_set_cr(UINT32 value)
CR(7) = (value >> 0) & 0xf;
}
INLINE UINT32 ppc_get_cr(void)
inline UINT32 ppc_get_cr(void)
{
return CR(0) << 28 | CR(1) << 24 | CR(2) << 20 | CR(3) << 16 | CR(4) << 12 | CR(5) << 8 | CR(6) << 4 | CR(7);
}
@ -1086,7 +1085,7 @@ UINT32 ppc_get_lr(void)
{
return ppc.lr;
}
UINT32 ppc_read_spr(unsigned spr)
{
return ppc_get_spr(spr);

View file

@ -28,6 +28,9 @@
#ifndef INCLUDED_PPC_H
#define INCLUDED_PPC_H
#include "BlockFile.h"
#include "Types.h"
#include "Debugger/CPU/PPCDebug.h"
/******************************************************************************
Definitions

View file

@ -1568,33 +1568,33 @@ static void ppc_invalid(UINT32 op)
*/
/*************************OLD
INLINE int is_nan_double(FPR x)
inline int is_nan_double(FPR x)
{
return( ((x.id & DOUBLE_EXP) == DOUBLE_EXP) &&
((x.id & DOUBLE_FRAC) != DOUBLE_ZERO) );
}
INLINE int is_qnan_double(FPR x)
inline int is_qnan_double(FPR x)
{
return( ((x.id & DOUBLE_EXP) == DOUBLE_EXP) &&
((x.id & 0x0007fffffffffff) == 0x000000000000000) &&
((x.id & 0x000800000000000) == 0x000800000000000) );
}
INLINE int is_snan_double(FPR x)
inline int is_snan_double(FPR x)
{
return( ((x.id & DOUBLE_EXP) == DOUBLE_EXP) &&
((x.id & DOUBLE_FRAC) != DOUBLE_ZERO) &&
((x.id & 0x0008000000000000) == DOUBLE_ZERO) );
}
INLINE int is_infinity_double(FPR x)
inline int is_infinity_double(FPR x)
{
return( ((x.id & DOUBLE_EXP) == DOUBLE_EXP) &&
((x.id & DOUBLE_FRAC) == DOUBLE_ZERO) );
}
INLINE int is_normalized_double(FPR x)
inline int is_normalized_double(FPR x)
{
UINT64 exp;
@ -1603,18 +1603,18 @@ INLINE int is_normalized_double(FPR x)
return (exp >= 1) && (exp <= 2046);
}
INLINE int is_denormalized_double(FPR x)
inline int is_denormalized_double(FPR x)
{
return( ((x.id & DOUBLE_EXP) == 0) &&
((x.id & DOUBLE_FRAC) != DOUBLE_ZERO) );
}
INLINE int sign_double(FPR x)
inline int sign_double(FPR x)
{
return ((x.id & DOUBLE_SIGN) != 0);
}
INLINE INT64 round_to_nearest(FPR f)
inline INT64 round_to_nearest(FPR f)
{
//return (INT64)(f.fd + 0.5);
if (f.fd >= 0)
@ -1627,18 +1627,18 @@ INLINE INT64 round_to_nearest(FPR f)
}
}
INLINE INT64 round_toward_zero(FPR f)
inline INT64 round_toward_zero(FPR f)
{
return (INT64)(f.fd);
}
INLINE INT64 round_toward_positive_infinity(FPR f)
inline INT64 round_toward_positive_infinity(FPR f)
{
double r = ceil(f.fd);
return (INT64)(r);
}
INLINE INT64 round_toward_negative_infinity(FPR f)
inline INT64 round_toward_negative_infinity(FPR f)
{
double r = floor(f.fd);
return (INT64)(r);
@ -1647,33 +1647,33 @@ INLINE INT64 round_toward_negative_infinity(FPR f)
// New below, based on changes in MAME
INLINE int is_nan_double(FPR x)
inline int is_nan_double(FPR x)
{
return( ((x.id & DOUBLE_EXP) == DOUBLE_EXP) &&
((x.id & DOUBLE_FRAC) != DOUBLE_ZERO) );
}
INLINE int is_qnan_double(FPR x)
inline int is_qnan_double(FPR x)
{
return( ((x.id & DOUBLE_EXP) == DOUBLE_EXP) &&
((x.id & 0x0007fffffffffffULL) == 0x000000000000000ULL) &&
((x.id & 0x000800000000000ULL) == 0x000800000000000ULL) );
}
INLINE int is_snan_double(FPR x)
inline int is_snan_double(FPR x)
{
return( ((x.id & DOUBLE_EXP) == DOUBLE_EXP) &&
((x.id & DOUBLE_FRAC) != DOUBLE_ZERO) &&
((x.id & (0x0008000000000000ULL)) == DOUBLE_ZERO) );
}
INLINE int is_infinity_double(FPR x)
inline int is_infinity_double(FPR x)
{
return( ((x.id & DOUBLE_EXP) == DOUBLE_EXP) &&
((x.id & DOUBLE_FRAC) == DOUBLE_ZERO) );
}
INLINE int is_normalized_double(FPR x)
inline int is_normalized_double(FPR x)
{
UINT64 exp;
@ -1682,18 +1682,18 @@ INLINE int is_normalized_double(FPR x)
return (exp >= 1) && (exp <= 2046);
}
INLINE int is_denormalized_double(FPR x)
inline int is_denormalized_double(FPR x)
{
return( ((x.id & DOUBLE_EXP) == 0) &&
((x.id & DOUBLE_FRAC) != DOUBLE_ZERO) );
}
INLINE int sign_double(FPR x)
inline int sign_double(FPR x)
{
return ((x.id & DOUBLE_SIGN) != 0);
}
INLINE INT64 smround_to_nearest(FPR f)
inline INT64 smround_to_nearest(FPR f)
{
if (f.fd >= 0)
{
@ -1705,18 +1705,18 @@ INLINE INT64 smround_to_nearest(FPR f)
}
}
INLINE INT64 smround_toward_zero(FPR f)
inline INT64 smround_toward_zero(FPR f)
{
return (INT64)(f.fd);
}
INLINE INT64 round_toward_positive_infinity(FPR f)
inline INT64 round_toward_positive_infinity(FPR f)
{
double r = ceil(f.fd);
return (INT64)(r);
}
INLINE INT64 round_toward_negative_infinity(FPR f)
inline INT64 round_toward_negative_infinity(FPR f)
{
double r = floor(f.fd);
return (INT64)(r);
@ -1725,7 +1725,7 @@ INLINE INT64 round_toward_negative_infinity(FPR f)
#define SET_VXSNAN(a, b) if (is_snan_double(a) || is_snan_double(b)) ppc.fpscr |= 0x80000000
#define SET_VXSNAN_1(c) if (is_snan_double(c)) ppc.fpscr |= 0x80000000
INLINE void set_fprf(FPR f)
inline void set_fprf(FPR f)
{
UINT32 fprf;

File diff suppressed because it is too large Load diff

View file

@ -19,8 +19,8 @@
** with Supermodel. If not, see <http://www.gnu.org/licenses/>.
**/
/*
* Z80KDebug.h
/*
* Z80KDebug.h
*/
#ifdef SUPERMODEL_DEBUGGER

View file

@ -19,8 +19,8 @@
** with Supermodel. If not, see <http://www.gnu.org/licenses/>.
**/
/*
* Exception.cpp
/*
* Exception.cpp
*/
#ifdef SUPERMODEL_DEBUGGER

View file

@ -25,14 +25,23 @@
#ifdef SUPERMODEL_DEBUGGER
#include "Supermodel.h"
#include "SupermodelDebugger.h"
#include "Supermodel.h"
#include "BlockFile.h"
#include "ConsoleDebugger.h"
#include "CPUDebug.h"
#include "Label.h"
#ifdef NET_BOARD
#include "Network/NetBoard.h"
#endif // NET_BOARD
#include "CPU/Musashi68KDebug.h"
#include "CPU/PPCDebug.h"
#include "CPU/Z80Debug.h"
#include "Inputs/Input.h"
#include "Inputs/InputSystem.h"
#include "Model3/SoundBoard.h"
#include "OSD/Audio.h"
#include <cstdio>
#include <string>

View file

@ -28,12 +28,12 @@
#define INCLUDED_SUPERMODELDEBUGGER_H
#include "ConsoleDebugger.h"
#include "Model3/Model3.h"
#include <stdarg.h>
#define MODEL3_STATEFILE_VERSION 0
class CModel3;
class CInputs;
class CInput;

View file

@ -32,6 +32,7 @@
*/
#include "Supermodel.h"
#include "Legacy3D.h"
namespace Legacy3D {

View file

@ -156,8 +156,12 @@
* - Can some of the floating point flag attribs be replaced with ints?
*/
#include "Legacy3D.h"
#include "Supermodel.h"
#include "Graphics/Legacy3D/Shaders3D.h" // fragment and vertex shaders
#include "Shaders3D.h" // fragment and vertex shaders
#include "Graphics/Shader.h"
#include <algorithm>
#include <cmath>
#include <cstdint>
@ -1298,21 +1302,21 @@ bool CLegacy3D::Init(unsigned xOffset, unsigned yOffset, unsigned xRes, unsigned
}
void CLegacy3D::SetSunClamp(bool enable)
{
}
void CLegacy3D::SetSignedShade(bool enable)
{
{
}
void CLegacy3D::SetSignedShade(bool enable)
{
}
float CLegacy3D::GetLosValue(int layer)
{
return 0.0f;
}
CLegacy3D::CLegacy3D(const Util::Config::Node &config)
: m_config(config)
{
}
CLegacy3D::CLegacy3D(const Util::Config::Node &config)
: m_config(config)
{
cullingRAMLo = NULL;
cullingRAMHi = NULL;
polyRAM = NULL;

View file

@ -29,9 +29,11 @@
#ifndef INCLUDED_LEGACY3D_H
#define INCLUDED_LEGACY3D_H
#include "TextureRefs.h"
#include "Graphics/IRender3D.h"
#include <GL/glew.h>
#include "Util/NewConfig.h"
#include "Types.h"
namespace Legacy3D {
@ -334,20 +336,20 @@ public:
* Sets or unsets the clamped light model
*
* Parameters:
* enable Set clamp mode
*/
void SetSunClamp(bool enable);
/*
* SetSignedShade(bool enable);
*
* Sets the sign-ness of fixed shading value
*
* Parameters:
* enable Fixed shading is expressed as signed value
*/
void SetSignedShade(bool enable);
* enable Set clamp mode
*/
void SetSunClamp(bool enable);
/*
* SetSignedShade(bool enable);
*
* Sets the sign-ness of fixed shading value
*
* Parameters:
* enable Fixed shading is expressed as signed value
*/
void SetSignedShade(bool enable);
/*
* GetLosValue(int layer);
*
@ -356,11 +358,11 @@ public:
* Parameters:
* layer Priority layer to read from
*/
float GetLosValue(int layer);
/*
* CLegacy3D(void):
* ~CLegacy3D(void):
float GetLosValue(int layer);
/*
* CLegacy3D(void):
* ~CLegacy3D(void):
*
* Parameters:
* config Configuration object.

View file

@ -106,6 +106,7 @@
#include <cmath>
#include <cstring>
#include "Supermodel.h"
#include "Legacy3D.h"
#ifdef DEBUG
extern int g_testPolyHeaderIdx;

View file

@ -30,7 +30,10 @@
* to using a hashset to store the texture references, but this requires extra memory allocation.
*/
#include "TextureRefs.h"
#include "Supermodel.h"
#include "Legacy3D.h"
namespace Legacy3D {

View file

@ -28,6 +28,8 @@
#ifndef INCLUDED_TEXTUREREFS_H
#define INCLUDED_TEXTUREREFS_H
namespace Legacy3D {
#define TEXREFS_ARRAY_SIZE 12
@ -38,7 +40,7 @@ struct HashEntry
const unsigned texRef; // Texture reference as a bitfield
HashEntry *nextEntry; // Next entry with the same hash
HashEntry(unsigned theTexRef) : texRef(theTexRef), nextEntry(NULL) { }
HashEntry(unsigned theTexRef) : texRef(theTexRef), nextEntry(nullptr) { }
};
class CLegacy3D;

View file

@ -5,7 +5,7 @@ namespace New3D {
PolyHeader::PolyHeader()
{
header = NULL;
header = nullptr;
}
PolyHeader::PolyHeader(UINT32* h)

View file

@ -1,6 +1,8 @@
#ifndef _POLY_HEADER_H_
#define _POLY_HEADER_H_
#include "Types.h"
namespace New3D {
/*

View file

@ -274,10 +274,14 @@
* -- one for A/A' and another for B/B'. These are passed to the renderer.
*/
#include "Render2D.h"
#include "Supermodel.h"
#include "Shader.h"
#include "Shaders2D.h" // fragment and vertex shaders
#include <cstring>
#include <GL/glew.h>
#include "Supermodel.h"
#include "Graphics/Shaders2D.h" // fragment and vertex shaders
/******************************************************************************

View file

@ -25,18 +25,18 @@
* OpenGL shader management.
*
* To-Do List
* ----------
* - Mesa crashes because, evidently, the function pointers are invalid. Mesa
* returns the following information:
* Vendor: Mesa project: www.mesa3d.org
* Renderer: Mesa GLX Indirect
* Version: 1.2 (1.5 Mesa 6.5.1)
* Shading Language Version: (null)
* Maximum Vertex Array Size: -1 vertices
* Maximum Texture Size: 2048 texels
* Maximum Vertex Attributes: 16
* Maximum Vertex Uniforms: 16
* - Check for OpenGL 2.0 and perhaps check some of the function pointers,
* ----------
* - Mesa crashes because, evidently, the function pointers are invalid. Mesa
* returns the following information:
* Vendor: Mesa project: www.mesa3d.org
* Renderer: Mesa GLX Indirect
* Version: 1.2 (1.5 Mesa 6.5.1)
* Shading Language Version: (null)
* Maximum Vertex Array Size: -1 vertices
* Maximum Texture Size: 2048 texels
* Maximum Vertex Attributes: 16
* Maximum Vertex Uniforms: 16
* - Check for OpenGL 2.0 and perhaps check some of the function pointers,
* which will be NULL, if GL 2.0 and shaders are not supported.
* - Keep in mind that all these checks should probably go somewhere else...
* - Turn this into a class.
@ -89,7 +89,7 @@ bool LoadShaderProgram(GLuint *shaderProgramPtr, GLuint *vertexShaderPtr, GLuint
GLuint shaderProgram, vertexShader, fragmentShader;
GLint result, len;
bool ret = OKAY;
// Load shaders from files if specified
if (!vsFile.empty())
vsSource = LoadShaderSource(vsFile.c_str());
@ -103,14 +103,14 @@ bool LoadShaderProgram(GLuint *shaderProgramPtr, GLuint *vertexShaderPtr, GLuint
{
ret = FAIL;
goto Quit;
}
// Ensure that shader support exists
if ((glCreateProgram==NULL) || (glCreateShader==NULL) || (glShaderSource==NULL) || (glCompileShader==NULL))
{
ret = FAIL;
ErrorLog("OpenGL 2.x does not appear to be present. Unable to proceed.");
goto Quit;
}
// Ensure that shader support exists
if ((glCreateProgram==NULL) || (glCreateShader==NULL) || (glShaderSource==NULL) || (glCompileShader==NULL))
{
ret = FAIL;
ErrorLog("OpenGL 2.x does not appear to be present. Unable to proceed.");
goto Quit;
}
// Create the shaders and shader program
@ -169,10 +169,10 @@ Quit:
}
void DestroyShaderProgram(GLuint shaderProgram, GLuint vertexShader, GLuint fragmentShader)
{
// In case LoadShaderProgram() failed above due to lack of OpenGL 2.0+ functions...
if ((glUseProgram==NULL) || (glDeleteShader==NULL) || (glDeleteProgram==NULL))
return;
{
// In case LoadShaderProgram() failed above due to lack of OpenGL 2.0+ functions...
if ((glUseProgram==NULL) || (glDeleteShader==NULL) || (glDeleteProgram==NULL))
return;
glUseProgram(0); // return to fixed function pipeline
glDeleteShader(vertexShader);

View file

@ -26,7 +26,10 @@
* from this.
*/
#include "Input.h"
#include "Supermodel.h"
#include "InputSystem.h"
CInput::CInput(const char *inputId, const char *inputLabel, unsigned inputFlags, unsigned inputGameFlags, const char *defaultMapping, UINT16 initValue) :
id(inputId), label(inputLabel), flags(inputFlags), gameFlags(inputGameFlags), m_defaultMapping(defaultMapping), value(initValue), prevValue(initValue),

View file

@ -29,11 +29,11 @@
#ifndef INCLUDED_INPUT_H
#define INCLUDED_INPUT_H
#include "InputSource.h"
#include "Types.h"
#include "Game.h"
#include "Util/NewConfig.h"
class CInputSource;
class CInputSystem;
// Flags for inputs

View file

@ -27,7 +27,10 @@
* values for analog inputs.
*/
#include "InputSource.h"
#include "Supermodel.h"
#include "Input.h"
#include <vector>
using namespace std;

View file

@ -32,7 +32,11 @@
// - open up API to allow direct access to keyboard, mouse and joystick values
// - add GetKey method that is easier to use than reading keyboard with ReadMapping
#include "InputSystem.h"
#include "Supermodel.h"
#include "Input.h"
#include "OSD/Thread.h"
#include <cmath>
#include <string>
@ -1993,7 +1997,7 @@ Repeat:
unsigned posDeadZone;
unsigned negDeadZone;
unsigned deadZone;
int posVal = 0;
int negVal = 0;
int offVal = 0;
@ -2514,4 +2518,4 @@ bool CInputSystem::CJoyButInputSource::GetValueAsAnalog(int &val, int minVal, in
return false;
val = maxVal;
return true;
}
}

View file

@ -26,6 +26,8 @@
* all very simple classes.
*/
#include "InputTypes.h"
#include "Supermodel.h"
/*

View file

@ -27,7 +27,11 @@
* maintains all individual inputs.
*/
#include "Inputs.h"
#include "Supermodel.h"
#include "InputSystem.h"
#include "InputTypes.h"
#include "Game.h"
#include <stdarg.h>
#include <vector>

View file

@ -28,17 +28,13 @@
#ifndef INCLUDED_INPUTS_H
#define INCLUDED_INPUTS_H
#include "InputTypes.h"
#include "Types.h"
#include "Util/NewConfig.h"
#include <vector>
class CInputSystem;
class CInput;
class CAnalogInput;
class CAxisInput;
class CSwitchInput;
class CGearShift4Input;
class CTriggerInput;
struct Game;
/*

View file

@ -25,7 +25,10 @@
* Implementation of CMultiInputSource.
*/
#include "MultiInputSource.h"
#include "Supermodel.h"
#include "Input.h"
#include <vector>
using namespace std;

View file

@ -43,9 +43,11 @@
*
*/
#include "53C810.h"
#include <cstring>
#include "Supermodel.h"
#include "CPU/PowerPC/ppc.h"
/******************************************************************************
Save States

View file

@ -28,6 +28,10 @@
#ifndef INCLUDED_53C810_H
#define INCLUDED_53C810_H
#include "IRQ.h"
#include "PCI.h"
#include "BlockFile.h"
#include "CPU/Bus.h"
/*
* struct NCR53C810Context:

View file

@ -31,6 +31,8 @@
* should just be set to 0?
*/
#include "93C46.h"
#include <string.h>
#include "Supermodel.h"

View file

@ -28,6 +28,8 @@
#ifndef INCLUDED_93C46_H
#define INCLUDED_93C46_H
#include "BlockFile.h"
#include "Types.h"
/*
* C93C46:

View file

@ -37,6 +37,8 @@
* - Should we do some bounds checking on the MPEG start/end points?
*/
#include "DSB.h"
#include "Supermodel.h"
#include "Sound/MPEG/MpegAudio.h"
#include <algorithm>

View file

@ -34,6 +34,8 @@
#include "Types.h"
#include "CPU/Bus.h"
#include "CPU/68K/68K.h"
#include "CPU/Z80/Z80.h"
#include "Util/NewConfig.h"

View file

@ -57,6 +57,8 @@
**
**/
#include "BillBoard.h"
#include "Supermodel.h"
#include <cstdio>

View file

@ -29,6 +29,7 @@
#ifndef INCLUDED_BILLBOARD_H
#define INCLUDED_BILLBOARD_H
#include "DriveBoard.h"
#include "Util/NewConfig.h"
/*

View file

@ -52,6 +52,8 @@
* CDriveBoard::Disable() to update the disabled flag.
*/
#include "DriveBoard.h"
#include "Supermodel.h"
#include <cstdio>

View file

@ -30,6 +30,10 @@
#ifndef INCLUDED_DRIVEBOARD_H
#define INCLUDED_DRIVEBOARD_H
#include "CPU/Bus.h"
#include "CPU/Z80/Z80.h"
#include "Inputs/Inputs.h"
#include "OSD/Outputs.h"
#include "Util/NewConfig.h"
#include "Game.h"

View file

@ -33,6 +33,8 @@
* NOTE: Simulation does not yet work. Drive board ROMs are required.
*/
#include "JoystickBoard.h"
#include "Supermodel.h"
#include <cstdio>

View file

@ -29,6 +29,7 @@
#ifndef INCLUDED_JOYBOARD_H
#define INCLUDED_JOYBOARD_H
#include "DriveBoard.h"
#include "Util/NewConfig.h"
#include "Game.h"

View file

@ -29,7 +29,10 @@
* NOTE: Simulation does not yet work. Drive board ROMs are required.
*/
#include "SkiBoard.h"
#include "Supermodel.h"
#include "Inputs/Input.h"
#include <cstdio>
#include <cmath>

View file

@ -29,6 +29,7 @@
#ifndef INCLUDED_SKIBOARD_H
#define INCLUDED_SKIBOARD_H
#include "DriveBoard.h"
#include "Util/NewConfig.h"
#include "Game.h"

View file

@ -29,8 +29,9 @@
* NOTE: Simulation does not yet work. Drive board ROMs are required.
*/
#include "Supermodel.h"
#include "WheelBoard.h"
#include "Supermodel.h"
#include <cstdio>
#include <cmath>
#include <algorithm>

View file

@ -29,6 +29,7 @@
#ifndef INCLUDED_WHEELBOARD_H
#define INCLUDED_WHEELBOARD_H
#include "DriveBoard.h"
#include "Util/NewConfig.h"
#include "Game.h"

View file

@ -31,7 +31,10 @@
* call the PPC core directly, which should not happen in proper OO code.
*/
#include "IRQ.h"
#include "Supermodel.h"
#include "CPU/PowerPC/ppc.h"
/******************************************************************************

View file

@ -28,6 +28,8 @@
#ifndef INCLUDED_IRQ_H
#define INCLUDED_IRQ_H
#include "BlockFile.h"
#include "Types.h"
/*
* CIRQ:

View file

@ -30,8 +30,11 @@
* probably doesn't matter), so we assume IEEE 1149.1-1990 here.
*/
#include "JTAG.h"
#include "Supermodel.h"
#include "Model3/JTAG.h"
#include "Real3D.h"
#include <iostream>
// Finite state machine. Each state has two possible next states.

View file

@ -28,6 +28,7 @@
#ifndef INCLUDED_JTAG_H
#define INCLUDED_JTAG_H
#include "BlockFile.h"
#include "Util/BitRegister.h"
class CReal3D;

View file

@ -66,6 +66,8 @@
* endian, pushing the responsibility onto the caller.
*/
#include "MPC10x.h"
#include <cstring>
#include "Supermodel.h"

View file

@ -28,6 +28,8 @@
#ifndef INCLUDED_MPC10X_H
#define INCLUDED_MPC10X_H
#include "PCI.h"
#include "BlockFile.h"
/*
* CMPC10x:

View file

@ -210,17 +210,25 @@
*
*/
#include "Model3.h"
#include <new>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include "Supermodel.h"
#include "DriveBoard/BillBoard.h"
#include "DriveBoard/JoystickBoard.h"
#include "DriveBoard/SkiBoard.h"
#include "DriveBoard/WheelBoard.h"
#include "Game.h"
#include "ROMSet.h"
#ifdef NET_BOARD
#include "Network/NetBoard.h"
#include "Network/SimNetBoard.h"
#endif // NET_BOARD
#include "OSD/Audio.h"
#include "OSD/Video.h"
#include "Util/Format.h"
#include "Util/ByteSwap.h"
#include <functional>

View file

@ -29,9 +29,18 @@
#ifndef INCLUDED_MODEL3_H
#define INCLUDED_MODEL3_H
#include "Model3/IEmulator.h"
#include "Model3/JTAG.h"
#include "Model3/Crypto.h"
#include "53C810.h"
#include "93C46.h"
#include "Crypto.h"
#include "IEmulator.h"
#include "JTAG.h"
#include "MPC10x.h"
#include "Real3D.h"
#include "RTC72421.h"
#include "SoundBoard.h"
#include "TileGen.h"
#include "DriveBoard/DriveBoard.h"
#include "CPU/PowerPC/ppc.h"
#ifdef NET_BOARD
#include "Network/INetBoard.h"
#endif // NET_BOARD

View file

@ -33,6 +33,8 @@
* the vectors do not run out of memory because so few PCI devices exist.
*/
#include "PCI.h"
#include "Supermodel.h"

View file

@ -35,6 +35,8 @@
#ifndef INCLUDED_PCI_H
#define INCLUDED_PCI_H
#include "Types.h"
#include <vector>
/*

View file

@ -31,6 +31,8 @@
* - Writes do nothing yet.
*/
#include "RTC72421.h"
#include <time.h>
#include "Supermodel.h"

View file

@ -28,6 +28,7 @@
#ifndef INCLUDED_RTC72421_H
#define INCLUDED_RTC72421_H
#include "Types.h"
/*
* CRTC72421:

View file

@ -40,9 +40,12 @@
* - Keep an eye out for games writing non-mipmap textures to the mipmap area.
* The render currently cannot cope with this.
*/
#include "Real3D.h"
#include "Supermodel.h"
#include "Model3/JTAG.h"
#include "JTAG.h"
#include "CPU/PowerPC/ppc.h"
#include "Util/BMPFile.h"
#include <cstring>
#include <algorithm>
@ -151,15 +154,15 @@ void CReal3D::LoadState(CBlockFile *SaveState)
Rendering
******************************************************************************/
static void UpdateRenderConfig(IRender3D *Render3D, uint64_t internalRenderConfig[])
{
bool noSunClamp = (internalRenderConfig[0] & 0x800000) != 0 && (internalRenderConfig[1] & 0x400000) != 0;
bool shadeIsSigned = (internalRenderConfig[0] & 0x1) == 0;
Render3D->SetSunClamp(!noSunClamp);
Render3D->SetSignedShade(shadeIsSigned);
}
void CReal3D::BeginVBlank(int statusCycles)
static void UpdateRenderConfig(IRender3D *Render3D, uint64_t internalRenderConfig[])
{
bool noSunClamp = (internalRenderConfig[0] & 0x800000) != 0 && (internalRenderConfig[1] & 0x400000) != 0;
bool shadeIsSigned = (internalRenderConfig[0] & 0x1) == 0;
Render3D->SetSunClamp(!noSunClamp);
Render3D->SetSignedShade(shadeIsSigned);
}
void CReal3D::BeginVBlank(int statusCycles)
{
// Calculate point at which status bit should change value. Currently the same timing is used for both the status bit in ReadRegister
// and in WriteDMARegister32/ReadDMARegister32, however it may be that they are completely unrelated. It appears that step 1.x games
@ -249,18 +252,18 @@ uint32_t CReal3D::UpdateSnapshots(bool copyWhole)
void CReal3D::BeginFrame(void)
{
// If multi-threaded, perform now any queued texture uploads to renderer before rendering begins
if (m_gpuMultiThreaded)
{
for (const auto &it : queuedUploadTexturesRO) {
Render3D->UploadTextures(it.level, it.x, it.y, it.width, it.height);
}
// done syncing data
queuedUploadTexturesRO.clear();
}
Render3D->BeginFrame();
// If multi-threaded, perform now any queued texture uploads to renderer before rendering begins
if (m_gpuMultiThreaded)
{
for (const auto &it : queuedUploadTexturesRO) {
Render3D->UploadTextures(it.level, it.x, it.y, it.width, it.height);
}
// done syncing data
queuedUploadTexturesRO.clear();
}
Render3D->BeginFrame();
}
void CReal3D::RenderFrame(void)
@ -277,177 +280,177 @@ void CReal3D::EndFrame(void)
/******************************************************************************
Texture Uploading and Decoding
******************************************************************************/
******************************************************************************/
// Mipmap coordinates for each reduction level (within a single 2048x1024 page)
static const int mipXBase[] = { 0, 1024, 1536, 1792, 1920, 1984, 2016, 2032, 2040, 2044, 2046, 2047 };
static const int mipYBase[] = { 0, 512, 768, 896, 960, 992, 1008, 1016, 1020, 1022, 1023 };
static const int mipDivisor[] = { 1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024 };
// Tables of texel offsets corresponding to an NxN texel texture tile
static const unsigned decode8x8[64] =
{
1, 0, 5, 4, 9, 8,13,12,
3, 2, 7, 6,11,10,15,14,
17,16,21,20,25,24,29,28,
19,18,23,22,27,26,31,30,
33,32,37,36,41,40,45,44,
35,34,39,38,43,42,47,46,
49,48,53,52,57,56,61,60,
51,50,55,54,59,58,63,62
};
static const unsigned decode8x4[32] =
{
1, 0, 5, 4,
3, 2, 7, 6,
9, 8,13,12,
11,10,15,14,
17,16,21,20,
19,18,23,22,
25,24,29,28,
27,26,31,30
};
static const unsigned decode8x2[16] =
{
1, 0,
3, 2,
5, 4,
7, 6,
9, 8,
11, 10,
13, 12,
15, 14
};
static const unsigned decode8x1[8] =
{
1,
3,
0,
2,
5,
7,
4,
6
};
void CReal3D::StoreTexture(unsigned level, unsigned xPos, unsigned yPos, unsigned width, unsigned height, const uint16_t *texData, bool sixteenBit, bool writeLSB, bool writeMSB, uint32_t &texDataOffset)
{
uint32_t tileX = (std::min)(8u, width);
uint32_t tileY = (std::min)(8u, height);
texDataOffset = 0;
if (sixteenBit) // 16-bit textures
{
// Outer 2 loops: NxN tiles
for (uint32_t y = yPos; y < (yPos + height); y += tileY)
{
for (uint32_t x = xPos; x < (xPos + width); x += tileX)
{
// Inner 2 loops: NxN texels for the current tile
uint32_t destOffset = y * 2048 + x;
for (uint32_t yy = 0; yy < tileY; yy++)
{
for (uint32_t xx = 0; xx < tileX; xx++)
{
if (m_gpuMultiThreaded)
MARK_DIRTY(textureRAMDirty, destOffset * 2);
if (tileX == 1) texData -= tileY;
if (tileY == 1) texData -= tileX;
if (tileX == 8)
textureRAM[destOffset++] = texData[decode8x8[yy * tileX + xx]];
else if (tileX == 4)
textureRAM[destOffset++] = texData[decode8x4[yy * tileX + xx]];
else if (tileX == 2)
textureRAM[destOffset++] = texData[decode8x2[yy * tileX + xx]];
else if (tileX == 1)
textureRAM[destOffset++] = texData[decode8x1[yy * tileX + xx]];
texDataOffset++;
}
destOffset += 2048 - tileX; // next line
}
texData += tileY * tileX; // next tile
}
}
}
static const int mipDivisor[] = { 1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024 };
// Tables of texel offsets corresponding to an NxN texel texture tile
static const unsigned decode8x8[64] =
{
1, 0, 5, 4, 9, 8,13,12,
3, 2, 7, 6,11,10,15,14,
17,16,21,20,25,24,29,28,
19,18,23,22,27,26,31,30,
33,32,37,36,41,40,45,44,
35,34,39,38,43,42,47,46,
49,48,53,52,57,56,61,60,
51,50,55,54,59,58,63,62
};
static const unsigned decode8x4[32] =
{
1, 0, 5, 4,
3, 2, 7, 6,
9, 8,13,12,
11,10,15,14,
17,16,21,20,
19,18,23,22,
25,24,29,28,
27,26,31,30
};
static const unsigned decode8x2[16] =
{
1, 0,
3, 2,
5, 4,
7, 6,
9, 8,
11, 10,
13, 12,
15, 14
};
static const unsigned decode8x1[8] =
{
1,
3,
0,
2,
5,
7,
4,
6
};
void CReal3D::StoreTexture(unsigned level, unsigned xPos, unsigned yPos, unsigned width, unsigned height, const uint16_t *texData, bool sixteenBit, bool writeLSB, bool writeMSB, uint32_t &texDataOffset)
{
uint32_t tileX = (std::min)(8u, width);
uint32_t tileY = (std::min)(8u, height);
texDataOffset = 0;
if (sixteenBit) // 16-bit textures
{
// Outer 2 loops: NxN tiles
for (uint32_t y = yPos; y < (yPos + height); y += tileY)
{
for (uint32_t x = xPos; x < (xPos + width); x += tileX)
{
// Inner 2 loops: NxN texels for the current tile
uint32_t destOffset = y * 2048 + x;
for (uint32_t yy = 0; yy < tileY; yy++)
{
for (uint32_t xx = 0; xx < tileX; xx++)
{
if (m_gpuMultiThreaded)
MARK_DIRTY(textureRAMDirty, destOffset * 2);
if (tileX == 1) texData -= tileY;
if (tileY == 1) texData -= tileX;
if (tileX == 8)
textureRAM[destOffset++] = texData[decode8x8[yy * tileX + xx]];
else if (tileX == 4)
textureRAM[destOffset++] = texData[decode8x4[yy * tileX + xx]];
else if (tileX == 2)
textureRAM[destOffset++] = texData[decode8x2[yy * tileX + xx]];
else if (tileX == 1)
textureRAM[destOffset++] = texData[decode8x1[yy * tileX + xx]];
texDataOffset++;
}
destOffset += 2048 - tileX; // next line
}
texData += tileY * tileX; // next tile
}
}
}
else // 8-bit textures
{
/*
* 8-bit textures appear to be unpacked into 16-bit words in the
* texture RAM. Oddly, the rows of the decoding table seem to be
* swapped.
*/
if (writeLSB && writeMSB) // write to both?
DebugLog("Observed 8-bit texture with byte_select=3!");
// Outer 2 loops: NxN tiles
const uint8_t byteSelect = (uint8_t)writeLSB | ((uint8_t)writeMSB << 1);
uint16_t tempData;
const uint16_t byteMask[4] = {0xFFFF, 0xFF00, 0x00FF, 0x0000};
for (uint32_t y = yPos; y < (yPos + height); y += tileY)
{
for (uint32_t x = xPos; x < (xPos + width); x += tileX)
{
// Inner 2 loops: NxN texels for the current tile
uint32_t destOffset = y * 2048 + x;
for (uint32_t yy = 0; yy < tileY; yy++)
{
for (uint32_t xx = 0; xx < tileX; xx++)
{
if (writeLSB | writeMSB) {
if (m_gpuMultiThreaded)
MARK_DIRTY(textureRAMDirty, destOffset * 2);
textureRAM[destOffset] &= byteMask[byteSelect];
const uint8_t shift = (8 * ((xx & 1) ^ 1));
const uint8_t index = (yy ^ 1) * tileX + (xx ^ 1) - (tileX & 1);
if (tileX == 1) texData -= tileY;
if (tileY == 1) texData -= tileX;
if (tileX == 8)
tempData = (texData[decode8x8[index] / 2] >> shift) & 0xFF;
else if (tileX == 4)
tempData = (texData[decode8x4[index] / 2] >> shift) & 0xFF;
else if (tileX == 2)
tempData = (texData[decode8x2[index] / 2] >> shift) & 0xFF;
else if (tileX == 1)
tempData = (texData[decode8x1[index] / 2] >> shift) & 0xFF;
tempData |= tempData << 8;
tempData &= byteMask[byteSelect] ^ 0xFFFF;
textureRAM[destOffset] |= tempData;
}
destOffset++;
}
destOffset += 2048 - tileX; // next line
}
uint32_t offset = (std::max)(1u, (tileY * tileX) / 2);
texData += offset; // next tile
texDataOffset += offset; // next tile
}
}
}
* swapped.
*/
if (writeLSB && writeMSB) // write to both?
DebugLog("Observed 8-bit texture with byte_select=3!");
// Outer 2 loops: NxN tiles
const uint8_t byteSelect = (uint8_t)writeLSB | ((uint8_t)writeMSB << 1);
uint16_t tempData;
const uint16_t byteMask[4] = {0xFFFF, 0xFF00, 0x00FF, 0x0000};
for (uint32_t y = yPos; y < (yPos + height); y += tileY)
{
for (uint32_t x = xPos; x < (xPos + width); x += tileX)
{
// Inner 2 loops: NxN texels for the current tile
uint32_t destOffset = y * 2048 + x;
for (uint32_t yy = 0; yy < tileY; yy++)
{
for (uint32_t xx = 0; xx < tileX; xx++)
{
if (writeLSB | writeMSB) {
if (m_gpuMultiThreaded)
MARK_DIRTY(textureRAMDirty, destOffset * 2);
textureRAM[destOffset] &= byteMask[byteSelect];
const uint8_t shift = (8 * ((xx & 1) ^ 1));
const uint8_t index = (yy ^ 1) * tileX + (xx ^ 1) - (tileX & 1);
if (tileX == 1) texData -= tileY;
if (tileY == 1) texData -= tileX;
if (tileX == 8)
tempData = (texData[decode8x8[index] / 2] >> shift) & 0xFF;
else if (tileX == 4)
tempData = (texData[decode8x4[index] / 2] >> shift) & 0xFF;
else if (tileX == 2)
tempData = (texData[decode8x2[index] / 2] >> shift) & 0xFF;
else if (tileX == 1)
tempData = (texData[decode8x1[index] / 2] >> shift) & 0xFF;
tempData |= tempData << 8;
tempData &= byteMask[byteSelect] ^ 0xFFFF;
textureRAM[destOffset] |= tempData;
}
destOffset++;
}
destOffset += 2048 - tileX; // next line
}
uint32_t offset = (std::max)(1u, (tileY * tileX) / 2);
texData += offset; // next tile
texDataOffset += offset; // next tile
}
}
}
// Signal to renderer that textures have changed
// TO-DO: mipmaps? What if a game writes non-mipmap textures to mipmap area?
if (m_gpuMultiThreaded)
{
// If multi-threaded, then queue calls to UploadTextures for render thread to perform at beginning of next frame
QueuedUploadTextures upl;
upl.level = level;
upl.x = xPos;
upl.y = yPos;
upl.width = width;
{
// If multi-threaded, then queue calls to UploadTextures for render thread to perform at beginning of next frame
QueuedUploadTextures upl;
upl.level = level;
upl.x = xPos;
upl.y = yPos;
upl.width = width;
upl.height = height;
queuedUploadTextures.push_back(upl);
}
else
Render3D->UploadTextures(level, xPos, yPos, width, height);
}
/*
Texture header:
-------- -------- -------- --xxxxxx X-position
@ -510,8 +513,8 @@ void CReal3D::UploadTexture(uint32_t header, const uint16_t *texData)
DebugLog("Unknown texture format %02X\n", type);
break;
}
}
}
/******************************************************************************
DMA Device
@ -617,15 +620,15 @@ void CReal3D::WriteDMARegister32(unsigned reg, uint32_t data)
dmaLength = data;
DMACopy();
dmaStatus |= 1;
IRQ->Assert(dmaIRQ);
break;
case 0x10: // command register
if ((data&0x20000000)) // DMA ID command
{
dmaData = pciID;
DebugLog("Real3D: DMA ID command issued (ATTENTION: make sure we're returning the correct value), PC=%08X, LR=%08X\n", ppc_get_pc(), ppc_get_lr());
}
else if ((data&0x80000000))
IRQ->Assert(dmaIRQ);
break;
case 0x10: // command register
if ((data&0x20000000)) // DMA ID command
{
dmaData = pciID;
DebugLog("Real3D: DMA ID command issued (ATTENTION: make sure we're returning the correct value), PC=%08X, LR=%08X\n", ppc_get_pc(), ppc_get_lr());
}
else if ((data&0x80000000))
{
dmaData = ReadRegister(data & 0x3F);
}
@ -645,36 +648,36 @@ void CReal3D::WriteDMARegister32(unsigned reg, uint32_t data)
******************************************************************************/
void CReal3D::Flush(void)
{
commandPortWritten = true;
DebugLog("Real3D 88000000 written @ PC=%08X\n", ppc_get_pc());
// Upload textures (if any)
if (fifoIdx > 0)
{
{
commandPortWritten = true;
DebugLog("Real3D 88000000 written @ PC=%08X\n", ppc_get_pc());
// Upload textures (if any)
if (fifoIdx > 0)
{
for (uint32_t i = 0; i < fifoIdx; )
{
uint32_t size = 2+textureFIFO[i+0]/2;
size /= 4;
uint32_t header = textureFIFO[i+1]; // texture information header
// Spikeout seems to be uploading 0 length textures
if (0 == size)
{
uint32_t size = 2+textureFIFO[i+0]/2;
size /= 4;
uint32_t header = textureFIFO[i+1]; // texture information header
// Spikeout seems to be uploading 0 length textures
if (0 == size)
{
DebugLog("Real3D: 0-length texture upload @ PC=%08X (%08X %08X %08X)\n", ppc_get_pc(), textureFIFO[i+0], textureFIFO[i+1], textureFIFO[i+2]);
break;
}
UploadTexture(header,(uint16_t *)&textureFIFO[i+2]);
DebugLog("Real3D: Texture upload completed: %X bytes (%X)\n", size*4, textureFIFO[i+0]);
i += size;
}
}
// Reset texture FIFO
fifoIdx = 0;
}
UploadTexture(header,(uint16_t *)&textureFIFO[i+2]);
DebugLog("Real3D: Texture upload completed: %X bytes (%X)\n", size*4, textureFIFO[i+0]);
i += size;
}
}
// Reset texture FIFO
fifoIdx = 0;
}
void CReal3D::WriteTextureFIFO(uint32_t data)
{
@ -873,21 +876,21 @@ void CReal3D::AttachRenderer(IRender3D *Render3DPtr)
uint32_t CReal3D::GetASICIDCode(ASIC asic) const
{
auto it = m_asicID.find(asic);
return it == m_asicID.end() ? 0 : it->second;
}
void CReal3D::SetStepping(int stepping, uint32_t pciIDValue)
{
step = stepping;
if ((step!=0x10) && (step!=0x15) && (step!=0x20) && (step!=0x21))
return it == m_asicID.end() ? 0 : it->second;
}
void CReal3D::SetStepping(int stepping, uint32_t pciIDValue)
{
step = stepping;
if ((step!=0x10) && (step!=0x15) && (step!=0x20) && (step!=0x21))
{
DebugLog("Real3D: Unrecognized stepping: %d.%d\n", (step>>4)&0xF, step&0xF);
step = 0x10;
}
// Set PCI ID
pciID = pciIDValue;
DebugLog("Real3D: Unrecognized stepping: %d.%d\n", (step>>4)&0xF, step&0xF);
step = 0x10;
}
// Set PCI ID
pciID = pciIDValue;
// Pass to renderer
if (Render3D != NULL)

View file

@ -29,6 +29,12 @@
#ifndef INCLUDED_REAL3D_H
#define INCLUDED_REAL3D_H
#include "IRQ.h"
#include "PCI.h"
#include "CPU/Bus.h"
#include "Graphics/IRender3D.h"
#include "Util/NewConfig.h"
#include <cstdint>
#include <map>
@ -375,19 +381,19 @@ public:
* any other emulation functions and after Init().
*
* Parameters:
* stepping 0x10 for Step 1.0, 0x15 for Step 1.5, 0x20 for Step 2.0, or
* stepping 0x10 for Step 1.0, 0x15 for Step 1.5, 0x20 for Step 2.0, or
* 0x21 for Step 2.1. Anything else defaults to 1.0.
* pciIDValue The PCI ID code to return. This should be one of the PCIID
* enum values otherwise games may fail to boot. Although the
* PCI ID depends on stepping, there are a few games that
* have to be explicitly configured with an older ID code,
* which is why this parameter is exposed.
*/
void SetStepping(int stepping, uint32_t pciIDValue);
/*
* Init(vromPtr, BusObjectPtr, IRQObjectPtr, dmaIRQBit):
* which is why this parameter is exposed.
*/
void SetStepping(int stepping, uint32_t pciIDValue);
/*
* Init(vromPtr, BusObjectPtr, IRQObjectPtr, dmaIRQBit):
*
* One-time initialization of the context. Must be called prior to all
* other members. Connects the Real3D device to its video ROM and allocates
@ -424,12 +430,12 @@ public:
private:
// Private member functions
void DMACopy(void);
void StoreTexture(unsigned level, unsigned xPos, unsigned yPos, unsigned width, unsigned height, const uint16_t *texData, bool sixteenBit, bool writeLSB, bool writeMSB, uint32_t &texDataOffset);
void UploadTexture(uint32_t header, const uint16_t *texData);
uint32_t UpdateSnapshots(bool copyWhole);
uint32_t UpdateSnapshot(bool copyWhole, uint8_t *src, uint8_t *dst, unsigned size, uint8_t *dirty);
void DMACopy(void);
void StoreTexture(unsigned level, unsigned xPos, unsigned yPos, unsigned width, unsigned height, const uint16_t *texData, bool sixteenBit, bool writeLSB, bool writeMSB, uint32_t &texDataOffset);
void UploadTexture(uint32_t header, const uint16_t *texData);
uint32_t UpdateSnapshots(bool copyWhole);
uint32_t UpdateSnapshot(bool copyWhole, uint8_t *src, uint8_t *dst, unsigned size, uint8_t *dirty);
// Config
const Util::Config::Node &m_config;

View file

@ -54,7 +54,11 @@
* ROM 600000-7FFFFF -> E00000-FFFFFF
*/
#include "SoundBoard.h"
#include "Supermodel.h"
#include "OSD/Audio.h"
#include "Sound/SCSP.h"
// DEBUG
//#define SUPERMODEL_LOG_AUDIO // define this to log all audio to sound.bin

View file

@ -50,6 +50,8 @@
* manually reverse the data. This keeps with the convention for VRAM.
*/
#include "TileGen.h"
#include <cstring>
#include "Supermodel.h"

View file

@ -28,6 +28,8 @@
#ifndef INCLUDED_TILEGEN_H
#define INCLUDED_TILEGEN_H
#include "IRQ.h"
#include "Graphics/Render2D.h"
/*
* CTileGen:

View file

@ -25,6 +25,7 @@
#include "Types.h"
#include "CPU/Bus.h"
#include "CPU/68K/68K.h"
#include "OSD/Thread.h"
#include <memory>
#include "INetBoard.h"

View file

@ -27,6 +27,8 @@
#ifndef INCLUDED_AUDIO_H
#define INCLUDED_AUDIO_H
#include "Types.h"
typedef void (*AudioCallbackFPtr)(void *data);

View file

@ -23,6 +23,8 @@
* Outputs.cpp
*/
#include "Outputs.h"
#include "Supermodel.h"
const char *COutputs::s_outputNames[] =

View file

@ -29,6 +29,7 @@
#define INCLUDED_OUTPUTS_H
#include "Game.h"
#include "Types.h"
/*
* EOutputs enumeration of all available outputs.

View file

@ -30,6 +30,8 @@
* initial set up of the buffer is correct.
*/
#include "Audio.h"
#include "Supermodel.h"
#include "SDLIncludes.h"

View file

@ -69,6 +69,12 @@
#include "WinOutputs.h"
#endif
#include "SDLIncludes.h"
#include "Debugger/SupermodelDebugger.h"
#include "Graphics/Legacy3D/Legacy3D.h"
#include "Graphics/New3D/New3D.h"
#include "Model3/IEmulator.h"
#include "Model3/Model3.h"
#include "OSD/Audio.h"
#include <iostream>
#include "Util/BMPFile.h"

View file

@ -29,9 +29,11 @@
* - Implement multiple keyboard and mouse support.
*/
#include "Supermodel.h"
#include "SDLInputSystem.h"
#include "Supermodel.h"
#include "Inputs/Input.h"
#include <vector>
using namespace std;

View file

@ -25,6 +25,8 @@
* SDL-based implementation of threading primitives.
*/
#include "Thread.h"
#include "Supermodel.h"
#include "SDLIncludes.h"

View file

@ -28,6 +28,8 @@
#ifndef INCLUDED_THREADS_H
#define INCLUDED_THREADS_H
#include "Types.h"
#include <string>
class CSemaphore;

View file

@ -63,13 +63,18 @@ It doesn't sound good at all.
Anyways credit to R. Belmont and ElSemi for the code, and for being awesome emulation Gods.
*/
#include "SCSP.h"
#include "Supermodel.h"
#include "Sound/SCSP.h"
#include "SCSPDSP.h"
#include "OSD/Thread.h"
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include "Sound/SCSPDSP.h"
static const Util::Config::Node *s_config = 0;
static bool s_multiThreaded = false;

View file

@ -28,6 +28,9 @@
#ifndef INCLUDED_SCSP_H
#define INCLUDED_SCSP_H
#include "BlockFile.h"
#include "Types.h"
#include "Util/NewConfig.h"
void SCSP_w8(UINT32 addr,UINT8 val);
void SCSP_w16(UINT32 addr,UINT16 val);

View file

@ -29,6 +29,8 @@
#ifndef INCLUDED_SCSPDSP_H
#define INCLUDED_SCSPDSP_H
#include "Types.h"
//#define DYNDSP
#define DYNOPT 1 //set to 1 to enable optimization of recompiler

View file

@ -125,7 +125,7 @@ void LFO_Init(void)
}
}
signed int INLINE PLFO_Step(struct _LFO *LFO)
signed int inline PLFO_Step(struct _LFO *LFO)
{
int p;
LFO->phase += LFO->phase_step;
@ -137,7 +137,7 @@ signed int INLINE PLFO_Step(struct _LFO *LFO)
return p << (SHIFT - LFO_SHIFT);
}
signed int INLINE ALFO_Step(struct _LFO *LFO)
signed int inline ALFO_Step(struct _LFO *LFO)
{
int p;
LFO->phase += LFO->phase_step;

View file

@ -27,9 +27,7 @@
#ifndef INCLUDED_SUPERMODEL_H
#define INCLUDED_SUPERMODEL_H
#if (defined NET_BOARD && defined _WIN32)
#include "Winsock2.h" // force include winsock2 before windows.h because conflict with winsock1
#endif
// Used throughout Supermodel
#include <cstdio>
#include <cstdlib>
@ -92,68 +90,10 @@
*/
#include "Types.h" // located in OSD/<port>/ directory
/*
* OSD Header Files
*/
// Error logging interface
#include "OSD/Logger.h"
// OSD Interfaces
#include "OSD/Thread.h"
#include "OSD/Audio.h"
#include "OSD/Video.h"
#include "OSD/Outputs.h"
/******************************************************************************
Header Files
All primary header files for modules used throughout Supermodel are included
here, except for external packages and APIs.
******************************************************************************/
#include "BlockFile.h"
#include "Graphics/New3D/New3D.h"
#include "Graphics/Render2D.h"
#include "Graphics/Legacy3D/TextureRefs.h"
#include "Graphics/Legacy3D/Legacy3D.h"
#include "Graphics/Shader.h"
#ifdef SUPERMODEL_DEBUGGER
#include "Debugger/SupermodelDebugger.h"
#include "Debugger/CPU/PPCDebug.h"
#include "Debugger/CPU/Musashi68KDebug.h"
#include "Debugger/CPU/Z80Debug.h"
#endif // SUPERMODEL_DEBUGGER
#include "CPU/Bus.h"
#include "CPU/PowerPC/PPCDisasm.h"
#include "CPU/PowerPC/ppc.h"
#include "CPU/68K/68K.h"
#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"
#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 "Model3/SoundBoard.h"
#include "Model3/DSB.h"
#include "Model3/DriveBoard/DriveBoard.h"
#include "Model3/DriveBoard/WheelBoard.h"
#include "Model3/DriveBoard/JoystickBoard.h"
#include "Model3/DriveBoard/SkiBoard.h"
#include "Model3/DriveBoard/BillBoard.h"
#include "Model3/Model3.h"
/******************************************************************************
Helpful Macros and Inlines