mirror of
https://github.com/RetroDECK/Supermodel.git
synced 2024-11-25 23:25:40 +00:00
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:
parent
50465f9a5a
commit
9ffce8b92a
|
@ -26,6 +26,8 @@
|
||||||
* class.
|
* class.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "BlockFile.h"
|
||||||
|
|
||||||
#include <cstdio>
|
#include <cstdio>
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
|
|
|
@ -33,9 +33,11 @@
|
||||||
* accesses (interrupts pending, halted status, etc.)
|
* accesses (interrupts pending, halted status, etc.)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "68K.h"
|
||||||
|
|
||||||
#include "Supermodel.h"
|
#include "Supermodel.h"
|
||||||
#include "Musashi/m68k.h" // Musashi 68K core
|
#include "Musashi/m68k.h" // Musashi 68K core
|
||||||
|
#include "Debugger/CPU/Musashi68KDebug.h"
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
Internal Context
|
Internal Context
|
||||||
|
|
|
@ -37,6 +37,7 @@
|
||||||
#include "Musashi/m68k.h"
|
#include "Musashi/m68k.h"
|
||||||
#include "Musashi/m68kctx.h"
|
#include "Musashi/m68kctx.h"
|
||||||
#include "CPU/Bus.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*)
|
// This doesn't work for now (needs to be added to the prototypes in m68k.h for m68k_read_memory*)
|
||||||
//#ifndef FASTCALL
|
//#ifndef FASTCALL
|
||||||
|
|
|
@ -28,6 +28,7 @@
|
||||||
#ifndef INCLUDED_BUS_H
|
#ifndef INCLUDED_BUS_H
|
||||||
#define INCLUDED_BUS_H
|
#define INCLUDED_BUS_H
|
||||||
|
|
||||||
|
#include "Types.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* IBus:
|
* IBus:
|
||||||
|
|
|
@ -28,16 +28,15 @@
|
||||||
|
|
||||||
/* IBM/Motorola PowerPC 4xx/6xx Emulator */
|
/* IBM/Motorola PowerPC 4xx/6xx Emulator */
|
||||||
|
|
||||||
|
#include "ppc.h"
|
||||||
|
|
||||||
#include <cstring> // memset()
|
#include <cstring> // memset()
|
||||||
#include "Supermodel.h"
|
#include "Supermodel.h"
|
||||||
#include "ppc.h"
|
#include "CPU/Bus.h"
|
||||||
|
|
||||||
// Typedefs that Supermodel no longer provides
|
// Typedefs that Supermodel no longer provides
|
||||||
typedef unsigned int UINT;
|
typedef unsigned int UINT;
|
||||||
|
|
||||||
// C++ should allow this...
|
|
||||||
#define INLINE inline
|
|
||||||
|
|
||||||
// Model 3 context provides read/write handlers
|
// Model 3 context provides read/write handlers
|
||||||
static class IBus *Bus = NULL; // pointer to Model 3 bus object (for access 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)
|
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));
|
// ppc.op = (UINT32 *)((void *)ppc.cur_fetch.ptr + (UINT32)(newpc - ppc.cur_fetch.start));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -307,7 +306,7 @@ static void ppc_change_pc(UINT32 newpc)
|
||||||
ppc.cur_fetch.end = ppc.fetch[i].end;
|
ppc.cur_fetch.end = ppc.fetch[i].end;
|
||||||
ppc.cur_fetch.ptr = ppc.fetch[i].ptr;
|
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];
|
ppc.op = &ppc.cur_fetch.ptr[(newpc-ppc.cur_fetch.start)/4];
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -318,42 +317,42 @@ static void ppc_change_pc(UINT32 newpc)
|
||||||
ppc.fatalError = true;
|
ppc.fatalError = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
INLINE UINT8 READ8(UINT32 address)
|
inline UINT8 READ8(UINT32 address)
|
||||||
{
|
{
|
||||||
return Bus->Read8(address);
|
return Bus->Read8(address);
|
||||||
}
|
}
|
||||||
|
|
||||||
INLINE UINT16 READ16(UINT32 address)
|
inline UINT16 READ16(UINT32 address)
|
||||||
{
|
{
|
||||||
return Bus->Read16(address);
|
return Bus->Read16(address);
|
||||||
}
|
}
|
||||||
|
|
||||||
INLINE UINT32 READ32(UINT32 address)
|
inline UINT32 READ32(UINT32 address)
|
||||||
{
|
{
|
||||||
return Bus->Read32(address);
|
return Bus->Read32(address);
|
||||||
}
|
}
|
||||||
|
|
||||||
INLINE UINT64 READ64(UINT32 address)
|
inline UINT64 READ64(UINT32 address)
|
||||||
{
|
{
|
||||||
return Bus->Read64(address);
|
return Bus->Read64(address);
|
||||||
}
|
}
|
||||||
|
|
||||||
INLINE void WRITE8(UINT32 address, UINT8 data)
|
inline void WRITE8(UINT32 address, UINT8 data)
|
||||||
{
|
{
|
||||||
Bus->Write8(address,data);
|
Bus->Write8(address,data);
|
||||||
}
|
}
|
||||||
|
|
||||||
INLINE void WRITE16(UINT32 address, UINT16 data)
|
inline void WRITE16(UINT32 address, UINT16 data)
|
||||||
{
|
{
|
||||||
Bus->Write16(address,data);
|
Bus->Write16(address,data);
|
||||||
}
|
}
|
||||||
|
|
||||||
INLINE void WRITE32(UINT32 address, UINT32 data)
|
inline void WRITE32(UINT32 address, UINT32 data)
|
||||||
{
|
{
|
||||||
Bus->Write32(address,data);
|
Bus->Write32(address,data);
|
||||||
}
|
}
|
||||||
|
|
||||||
INLINE void WRITE64(UINT32 address, UINT64 data)
|
inline void WRITE64(UINT32 address, UINT64 data)
|
||||||
{
|
{
|
||||||
Bus->Write64(address,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 ) {
|
if( rd < 0 ) {
|
||||||
CR(0) = 0x8;
|
CR(0) = 0x8;
|
||||||
|
@ -376,12 +375,12 @@ INLINE void SET_CR0(INT32 rd)
|
||||||
CR(0) |= 0x1;
|
CR(0) |= 0x1;
|
||||||
}
|
}
|
||||||
|
|
||||||
INLINE void SET_CR1(void)
|
inline void SET_CR1(void)
|
||||||
{
|
{
|
||||||
CR(1) = (ppc.fpscr >> 28) & 0xf;
|
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) )
|
if( ADD_OV(rd, ra, rb) )
|
||||||
XER |= XER_SO | XER_OV;
|
XER |= XER_SO | XER_OV;
|
||||||
|
@ -389,7 +388,7 @@ INLINE void SET_ADD_OV(UINT32 rd, UINT32 ra, UINT32 rb)
|
||||||
XER &= ~XER_OV;
|
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) )
|
if( SUB_OV(rd, ra, rb) )
|
||||||
XER |= XER_SO | XER_OV;
|
XER |= XER_SO | XER_OV;
|
||||||
|
@ -397,7 +396,7 @@ INLINE void SET_SUB_OV(UINT32 rd, UINT32 ra, UINT32 rb)
|
||||||
XER &= ~XER_OV;
|
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) )
|
if( ADD_CA(rd, ra, rb) )
|
||||||
XER |= XER_CA;
|
XER |= XER_CA;
|
||||||
|
@ -405,7 +404,7 @@ INLINE void SET_ADD_CA(UINT32 rd, UINT32 ra, UINT32 rb)
|
||||||
XER &= ~XER_CA;
|
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) )
|
if( SUB_CA(rd, ra, rb) )
|
||||||
XER |= XER_CA;
|
XER |= XER_CA;
|
||||||
|
@ -413,7 +412,7 @@ INLINE void SET_SUB_CA(UINT32 rd, UINT32 ra, UINT32 rb)
|
||||||
XER &= ~XER_CA;
|
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 ctr_ok;
|
||||||
UINT32 condition_ok;
|
UINT32 condition_ok;
|
||||||
|
@ -431,7 +430,7 @@ INLINE UINT32 check_condition_code(UINT32 bo, UINT32 bi)
|
||||||
return ctr_ok && condition_ok;
|
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;
|
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);
|
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();
|
UINT64 tb = ppc_read_timebase();
|
||||||
|
|
||||||
|
@ -448,7 +447,7 @@ INLINE void ppc_write_timebase_l(UINT32 tbl)
|
||||||
ppc.tb = (tb&~0xffffffff)|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();
|
UINT64 tb = ppc_read_timebase();
|
||||||
|
|
||||||
|
@ -457,7 +456,7 @@ INLINE void ppc_write_timebase_h(UINT32 tbh)
|
||||||
ppc.tb = (tb&0xffffffff)|((UINT64)(tbh) << 32);
|
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;
|
int cycles = ppc.dec_base_icount - ppc.icount;
|
||||||
|
|
||||||
|
@ -465,7 +464,7 @@ INLINE UINT32 read_decrementer(void)
|
||||||
return DEC - (cycles / ppc.timer_ratio);
|
return DEC - (cycles / ppc.timer_ratio);
|
||||||
}
|
}
|
||||||
|
|
||||||
INLINE void write_decrementer(UINT32 value)
|
inline void write_decrementer(UINT32 value)
|
||||||
{
|
{
|
||||||
if (((value&0x80000000) && !(read_decrementer()&0x80000000)))
|
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)
|
switch (spr)
|
||||||
{
|
{
|
||||||
|
@ -561,7 +560,7 @@ INLINE void ppc_set_spr(int spr, UINT32 value)
|
||||||
ppc.fatalError = true;
|
ppc.fatalError = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
INLINE UINT32 ppc_get_spr(int spr)
|
inline UINT32 ppc_get_spr(int spr)
|
||||||
{
|
{
|
||||||
switch(spr)
|
switch(spr)
|
||||||
{
|
{
|
||||||
|
@ -624,7 +623,7 @@ INLINE UINT32 ppc_get_spr(int spr)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
INLINE void ppc_set_msr(UINT32 value)
|
inline void ppc_set_msr(UINT32 value)
|
||||||
{
|
{
|
||||||
if( value & (MSR_ILE | MSR_LE) )
|
if( value & (MSR_ILE | MSR_LE) )
|
||||||
{
|
{
|
||||||
|
@ -638,12 +637,12 @@ INLINE void ppc_set_msr(UINT32 value)
|
||||||
ppc603_check_interrupts();
|
ppc603_check_interrupts();
|
||||||
}
|
}
|
||||||
|
|
||||||
INLINE UINT32 ppc_get_msr(void)
|
inline UINT32 ppc_get_msr(void)
|
||||||
{
|
{
|
||||||
return MSR;
|
return MSR;
|
||||||
}
|
}
|
||||||
|
|
||||||
INLINE void ppc_set_cr(UINT32 value)
|
inline void ppc_set_cr(UINT32 value)
|
||||||
{
|
{
|
||||||
CR(0) = (value >> 28) & 0xf;
|
CR(0) = (value >> 28) & 0xf;
|
||||||
CR(1) = (value >> 24) & 0xf;
|
CR(1) = (value >> 24) & 0xf;
|
||||||
|
@ -655,7 +654,7 @@ INLINE void ppc_set_cr(UINT32 value)
|
||||||
CR(7) = (value >> 0) & 0xf;
|
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);
|
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;
|
return ppc.lr;
|
||||||
}
|
}
|
||||||
|
|
||||||
UINT32 ppc_read_spr(unsigned spr)
|
UINT32 ppc_read_spr(unsigned spr)
|
||||||
{
|
{
|
||||||
return ppc_get_spr(spr);
|
return ppc_get_spr(spr);
|
||||||
|
|
|
@ -28,6 +28,9 @@
|
||||||
#ifndef INCLUDED_PPC_H
|
#ifndef INCLUDED_PPC_H
|
||||||
#define INCLUDED_PPC_H
|
#define INCLUDED_PPC_H
|
||||||
|
|
||||||
|
#include "BlockFile.h"
|
||||||
|
#include "Types.h"
|
||||||
|
#include "Debugger/CPU/PPCDebug.h"
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
Definitions
|
Definitions
|
||||||
|
|
|
@ -1568,33 +1568,33 @@ static void ppc_invalid(UINT32 op)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*************************OLD
|
/*************************OLD
|
||||||
INLINE int is_nan_double(FPR x)
|
inline int is_nan_double(FPR x)
|
||||||
{
|
{
|
||||||
return( ((x.id & DOUBLE_EXP) == DOUBLE_EXP) &&
|
return( ((x.id & DOUBLE_EXP) == DOUBLE_EXP) &&
|
||||||
((x.id & DOUBLE_FRAC) != DOUBLE_ZERO) );
|
((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) &&
|
return( ((x.id & DOUBLE_EXP) == DOUBLE_EXP) &&
|
||||||
((x.id & 0x0007fffffffffff) == 0x000000000000000) &&
|
((x.id & 0x0007fffffffffff) == 0x000000000000000) &&
|
||||||
((x.id & 0x000800000000000) == 0x000800000000000) );
|
((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) &&
|
return( ((x.id & DOUBLE_EXP) == DOUBLE_EXP) &&
|
||||||
((x.id & DOUBLE_FRAC) != DOUBLE_ZERO) &&
|
((x.id & DOUBLE_FRAC) != DOUBLE_ZERO) &&
|
||||||
((x.id & 0x0008000000000000) == 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) &&
|
return( ((x.id & DOUBLE_EXP) == DOUBLE_EXP) &&
|
||||||
((x.id & DOUBLE_FRAC) == DOUBLE_ZERO) );
|
((x.id & DOUBLE_FRAC) == DOUBLE_ZERO) );
|
||||||
}
|
}
|
||||||
|
|
||||||
INLINE int is_normalized_double(FPR x)
|
inline int is_normalized_double(FPR x)
|
||||||
{
|
{
|
||||||
UINT64 exp;
|
UINT64 exp;
|
||||||
|
|
||||||
|
@ -1603,18 +1603,18 @@ INLINE int is_normalized_double(FPR x)
|
||||||
return (exp >= 1) && (exp <= 2046);
|
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) &&
|
return( ((x.id & DOUBLE_EXP) == 0) &&
|
||||||
((x.id & DOUBLE_FRAC) != DOUBLE_ZERO) );
|
((x.id & DOUBLE_FRAC) != DOUBLE_ZERO) );
|
||||||
}
|
}
|
||||||
|
|
||||||
INLINE int sign_double(FPR x)
|
inline int sign_double(FPR x)
|
||||||
{
|
{
|
||||||
return ((x.id & DOUBLE_SIGN) != 0);
|
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);
|
//return (INT64)(f.fd + 0.5);
|
||||||
if (f.fd >= 0)
|
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);
|
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);
|
double r = ceil(f.fd);
|
||||||
return (INT64)(r);
|
return (INT64)(r);
|
||||||
}
|
}
|
||||||
|
|
||||||
INLINE INT64 round_toward_negative_infinity(FPR f)
|
inline INT64 round_toward_negative_infinity(FPR f)
|
||||||
{
|
{
|
||||||
double r = floor(f.fd);
|
double r = floor(f.fd);
|
||||||
return (INT64)(r);
|
return (INT64)(r);
|
||||||
|
@ -1647,33 +1647,33 @@ INLINE INT64 round_toward_negative_infinity(FPR f)
|
||||||
|
|
||||||
|
|
||||||
// New below, based on changes in MAME
|
// 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) &&
|
return( ((x.id & DOUBLE_EXP) == DOUBLE_EXP) &&
|
||||||
((x.id & DOUBLE_FRAC) != DOUBLE_ZERO) );
|
((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) &&
|
return( ((x.id & DOUBLE_EXP) == DOUBLE_EXP) &&
|
||||||
((x.id & 0x0007fffffffffffULL) == 0x000000000000000ULL) &&
|
((x.id & 0x0007fffffffffffULL) == 0x000000000000000ULL) &&
|
||||||
((x.id & 0x000800000000000ULL) == 0x000800000000000ULL) );
|
((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) &&
|
return( ((x.id & DOUBLE_EXP) == DOUBLE_EXP) &&
|
||||||
((x.id & DOUBLE_FRAC) != DOUBLE_ZERO) &&
|
((x.id & DOUBLE_FRAC) != DOUBLE_ZERO) &&
|
||||||
((x.id & (0x0008000000000000ULL)) == 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) &&
|
return( ((x.id & DOUBLE_EXP) == DOUBLE_EXP) &&
|
||||||
((x.id & DOUBLE_FRAC) == DOUBLE_ZERO) );
|
((x.id & DOUBLE_FRAC) == DOUBLE_ZERO) );
|
||||||
}
|
}
|
||||||
|
|
||||||
INLINE int is_normalized_double(FPR x)
|
inline int is_normalized_double(FPR x)
|
||||||
{
|
{
|
||||||
UINT64 exp;
|
UINT64 exp;
|
||||||
|
|
||||||
|
@ -1682,18 +1682,18 @@ INLINE int is_normalized_double(FPR x)
|
||||||
return (exp >= 1) && (exp <= 2046);
|
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) &&
|
return( ((x.id & DOUBLE_EXP) == 0) &&
|
||||||
((x.id & DOUBLE_FRAC) != DOUBLE_ZERO) );
|
((x.id & DOUBLE_FRAC) != DOUBLE_ZERO) );
|
||||||
}
|
}
|
||||||
|
|
||||||
INLINE int sign_double(FPR x)
|
inline int sign_double(FPR x)
|
||||||
{
|
{
|
||||||
return ((x.id & DOUBLE_SIGN) != 0);
|
return ((x.id & DOUBLE_SIGN) != 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
INLINE INT64 smround_to_nearest(FPR f)
|
inline INT64 smround_to_nearest(FPR f)
|
||||||
{
|
{
|
||||||
if (f.fd >= 0)
|
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);
|
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);
|
double r = ceil(f.fd);
|
||||||
return (INT64)(r);
|
return (INT64)(r);
|
||||||
}
|
}
|
||||||
|
|
||||||
INLINE INT64 round_toward_negative_infinity(FPR f)
|
inline INT64 round_toward_negative_infinity(FPR f)
|
||||||
{
|
{
|
||||||
double r = floor(f.fd);
|
double r = floor(f.fd);
|
||||||
return (INT64)(r);
|
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(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
|
#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;
|
UINT32 fprf;
|
||||||
|
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -19,8 +19,8 @@
|
||||||
** with Supermodel. If not, see <http://www.gnu.org/licenses/>.
|
** with Supermodel. If not, see <http://www.gnu.org/licenses/>.
|
||||||
**/
|
**/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Z80KDebug.h
|
* Z80KDebug.h
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifdef SUPERMODEL_DEBUGGER
|
#ifdef SUPERMODEL_DEBUGGER
|
||||||
|
|
|
@ -19,8 +19,8 @@
|
||||||
** with Supermodel. If not, see <http://www.gnu.org/licenses/>.
|
** with Supermodel. If not, see <http://www.gnu.org/licenses/>.
|
||||||
**/
|
**/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Exception.cpp
|
* Exception.cpp
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifdef SUPERMODEL_DEBUGGER
|
#ifdef SUPERMODEL_DEBUGGER
|
||||||
|
|
|
@ -25,14 +25,23 @@
|
||||||
|
|
||||||
#ifdef SUPERMODEL_DEBUGGER
|
#ifdef SUPERMODEL_DEBUGGER
|
||||||
|
|
||||||
#include "Supermodel.h"
|
#include "SupermodelDebugger.h"
|
||||||
|
|
||||||
|
#include "Supermodel.h"
|
||||||
|
#include "BlockFile.h"
|
||||||
#include "ConsoleDebugger.h"
|
#include "ConsoleDebugger.h"
|
||||||
#include "CPUDebug.h"
|
#include "CPUDebug.h"
|
||||||
#include "Label.h"
|
#include "Label.h"
|
||||||
#ifdef NET_BOARD
|
#ifdef NET_BOARD
|
||||||
#include "Network/NetBoard.h"
|
#include "Network/NetBoard.h"
|
||||||
#endif // NET_BOARD
|
#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 <cstdio>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
|
@ -28,12 +28,12 @@
|
||||||
#define INCLUDED_SUPERMODELDEBUGGER_H
|
#define INCLUDED_SUPERMODELDEBUGGER_H
|
||||||
|
|
||||||
#include "ConsoleDebugger.h"
|
#include "ConsoleDebugger.h"
|
||||||
|
#include "Model3/Model3.h"
|
||||||
|
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
|
|
||||||
#define MODEL3_STATEFILE_VERSION 0
|
#define MODEL3_STATEFILE_VERSION 0
|
||||||
|
|
||||||
class CModel3;
|
|
||||||
class CInputs;
|
class CInputs;
|
||||||
class CInput;
|
class CInput;
|
||||||
|
|
||||||
|
|
|
@ -32,6 +32,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "Supermodel.h"
|
#include "Supermodel.h"
|
||||||
|
#include "Legacy3D.h"
|
||||||
|
|
||||||
namespace Legacy3D {
|
namespace Legacy3D {
|
||||||
|
|
||||||
|
|
|
@ -156,8 +156,12 @@
|
||||||
* - Can some of the floating point flag attribs be replaced with ints?
|
* - Can some of the floating point flag attribs be replaced with ints?
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "Legacy3D.h"
|
||||||
|
|
||||||
#include "Supermodel.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 <algorithm>
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
|
@ -1298,21 +1302,21 @@ bool CLegacy3D::Init(unsigned xOffset, unsigned yOffset, unsigned xRes, unsigned
|
||||||
}
|
}
|
||||||
|
|
||||||
void CLegacy3D::SetSunClamp(bool enable)
|
void CLegacy3D::SetSunClamp(bool enable)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void CLegacy3D::SetSignedShade(bool enable)
|
void CLegacy3D::SetSignedShade(bool enable)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
float CLegacy3D::GetLosValue(int layer)
|
float CLegacy3D::GetLosValue(int layer)
|
||||||
{
|
{
|
||||||
return 0.0f;
|
return 0.0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
CLegacy3D::CLegacy3D(const Util::Config::Node &config)
|
CLegacy3D::CLegacy3D(const Util::Config::Node &config)
|
||||||
: m_config(config)
|
: m_config(config)
|
||||||
{
|
{
|
||||||
cullingRAMLo = NULL;
|
cullingRAMLo = NULL;
|
||||||
cullingRAMHi = NULL;
|
cullingRAMHi = NULL;
|
||||||
polyRAM = NULL;
|
polyRAM = NULL;
|
||||||
|
|
|
@ -29,9 +29,11 @@
|
||||||
#ifndef INCLUDED_LEGACY3D_H
|
#ifndef INCLUDED_LEGACY3D_H
|
||||||
#define INCLUDED_LEGACY3D_H
|
#define INCLUDED_LEGACY3D_H
|
||||||
|
|
||||||
|
#include "TextureRefs.h"
|
||||||
#include "Graphics/IRender3D.h"
|
#include "Graphics/IRender3D.h"
|
||||||
#include <GL/glew.h>
|
#include <GL/glew.h>
|
||||||
#include "Util/NewConfig.h"
|
#include "Util/NewConfig.h"
|
||||||
|
#include "Types.h"
|
||||||
|
|
||||||
namespace Legacy3D {
|
namespace Legacy3D {
|
||||||
|
|
||||||
|
@ -334,20 +336,20 @@ public:
|
||||||
* Sets or unsets the clamped light model
|
* Sets or unsets the clamped light model
|
||||||
*
|
*
|
||||||
* Parameters:
|
* Parameters:
|
||||||
* enable Set clamp mode
|
* enable Set clamp mode
|
||||||
*/
|
*/
|
||||||
void SetSunClamp(bool enable);
|
void SetSunClamp(bool enable);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* SetSignedShade(bool enable);
|
* SetSignedShade(bool enable);
|
||||||
*
|
*
|
||||||
* Sets the sign-ness of fixed shading value
|
* Sets the sign-ness of fixed shading value
|
||||||
*
|
*
|
||||||
* Parameters:
|
* Parameters:
|
||||||
* enable Fixed shading is expressed as signed value
|
* enable Fixed shading is expressed as signed value
|
||||||
*/
|
*/
|
||||||
void SetSignedShade(bool enable);
|
void SetSignedShade(bool enable);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* GetLosValue(int layer);
|
* GetLosValue(int layer);
|
||||||
*
|
*
|
||||||
|
@ -356,11 +358,11 @@ public:
|
||||||
* Parameters:
|
* Parameters:
|
||||||
* layer Priority layer to read from
|
* layer Priority layer to read from
|
||||||
*/
|
*/
|
||||||
float GetLosValue(int layer);
|
float GetLosValue(int layer);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* CLegacy3D(void):
|
* CLegacy3D(void):
|
||||||
* ~CLegacy3D(void):
|
* ~CLegacy3D(void):
|
||||||
*
|
*
|
||||||
* Parameters:
|
* Parameters:
|
||||||
* config Configuration object.
|
* config Configuration object.
|
||||||
|
|
|
@ -106,6 +106,7 @@
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
#include "Supermodel.h"
|
#include "Supermodel.h"
|
||||||
|
#include "Legacy3D.h"
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
extern int g_testPolyHeaderIdx;
|
extern int g_testPolyHeaderIdx;
|
||||||
|
|
|
@ -30,7 +30,10 @@
|
||||||
* to using a hashset to store the texture references, but this requires extra memory allocation.
|
* to using a hashset to store the texture references, but this requires extra memory allocation.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "TextureRefs.h"
|
||||||
|
|
||||||
#include "Supermodel.h"
|
#include "Supermodel.h"
|
||||||
|
#include "Legacy3D.h"
|
||||||
|
|
||||||
namespace Legacy3D {
|
namespace Legacy3D {
|
||||||
|
|
||||||
|
|
|
@ -28,6 +28,8 @@
|
||||||
#ifndef INCLUDED_TEXTUREREFS_H
|
#ifndef INCLUDED_TEXTUREREFS_H
|
||||||
#define INCLUDED_TEXTUREREFS_H
|
#define INCLUDED_TEXTUREREFS_H
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
namespace Legacy3D {
|
namespace Legacy3D {
|
||||||
|
|
||||||
#define TEXREFS_ARRAY_SIZE 12
|
#define TEXREFS_ARRAY_SIZE 12
|
||||||
|
@ -38,7 +40,7 @@ struct HashEntry
|
||||||
const unsigned texRef; // Texture reference as a bitfield
|
const unsigned texRef; // Texture reference as a bitfield
|
||||||
HashEntry *nextEntry; // Next entry with the same hash
|
HashEntry *nextEntry; // Next entry with the same hash
|
||||||
|
|
||||||
HashEntry(unsigned theTexRef) : texRef(theTexRef), nextEntry(NULL) { }
|
HashEntry(unsigned theTexRef) : texRef(theTexRef), nextEntry(nullptr) { }
|
||||||
};
|
};
|
||||||
|
|
||||||
class CLegacy3D;
|
class CLegacy3D;
|
||||||
|
|
|
@ -5,7 +5,7 @@ namespace New3D {
|
||||||
|
|
||||||
PolyHeader::PolyHeader()
|
PolyHeader::PolyHeader()
|
||||||
{
|
{
|
||||||
header = NULL;
|
header = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
PolyHeader::PolyHeader(UINT32* h)
|
PolyHeader::PolyHeader(UINT32* h)
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
#ifndef _POLY_HEADER_H_
|
#ifndef _POLY_HEADER_H_
|
||||||
#define _POLY_HEADER_H_
|
#define _POLY_HEADER_H_
|
||||||
|
|
||||||
|
#include "Types.h"
|
||||||
|
|
||||||
namespace New3D {
|
namespace New3D {
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -274,10 +274,14 @@
|
||||||
* -- one for A/A' and another for B/B'. These are passed to the renderer.
|
* -- 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 <cstring>
|
||||||
#include <GL/glew.h>
|
#include <GL/glew.h>
|
||||||
#include "Supermodel.h"
|
|
||||||
#include "Graphics/Shaders2D.h" // fragment and vertex shaders
|
|
||||||
|
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
|
|
|
@ -25,18 +25,18 @@
|
||||||
* OpenGL shader management.
|
* OpenGL shader management.
|
||||||
*
|
*
|
||||||
* To-Do List
|
* To-Do List
|
||||||
* ----------
|
* ----------
|
||||||
* - Mesa crashes because, evidently, the function pointers are invalid. Mesa
|
* - Mesa crashes because, evidently, the function pointers are invalid. Mesa
|
||||||
* returns the following information:
|
* returns the following information:
|
||||||
* Vendor: Mesa project: www.mesa3d.org
|
* Vendor: Mesa project: www.mesa3d.org
|
||||||
* Renderer: Mesa GLX Indirect
|
* Renderer: Mesa GLX Indirect
|
||||||
* Version: 1.2 (1.5 Mesa 6.5.1)
|
* Version: 1.2 (1.5 Mesa 6.5.1)
|
||||||
* Shading Language Version: (null)
|
* Shading Language Version: (null)
|
||||||
* Maximum Vertex Array Size: -1 vertices
|
* Maximum Vertex Array Size: -1 vertices
|
||||||
* Maximum Texture Size: 2048 texels
|
* Maximum Texture Size: 2048 texels
|
||||||
* Maximum Vertex Attributes: 16
|
* Maximum Vertex Attributes: 16
|
||||||
* Maximum Vertex Uniforms: 16
|
* Maximum Vertex Uniforms: 16
|
||||||
* - Check for OpenGL 2.0 and perhaps check some of the function pointers,
|
* - 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.
|
* 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...
|
* - Keep in mind that all these checks should probably go somewhere else...
|
||||||
* - Turn this into a class.
|
* - Turn this into a class.
|
||||||
|
@ -89,7 +89,7 @@ bool LoadShaderProgram(GLuint *shaderProgramPtr, GLuint *vertexShaderPtr, GLuint
|
||||||
GLuint shaderProgram, vertexShader, fragmentShader;
|
GLuint shaderProgram, vertexShader, fragmentShader;
|
||||||
GLint result, len;
|
GLint result, len;
|
||||||
bool ret = OKAY;
|
bool ret = OKAY;
|
||||||
|
|
||||||
// Load shaders from files if specified
|
// Load shaders from files if specified
|
||||||
if (!vsFile.empty())
|
if (!vsFile.empty())
|
||||||
vsSource = LoadShaderSource(vsFile.c_str());
|
vsSource = LoadShaderSource(vsFile.c_str());
|
||||||
|
@ -103,14 +103,14 @@ bool LoadShaderProgram(GLuint *shaderProgramPtr, GLuint *vertexShaderPtr, GLuint
|
||||||
{
|
{
|
||||||
ret = FAIL;
|
ret = FAIL;
|
||||||
goto Quit;
|
goto Quit;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Ensure that shader support exists
|
// Ensure that shader support exists
|
||||||
if ((glCreateProgram==NULL) || (glCreateShader==NULL) || (glShaderSource==NULL) || (glCompileShader==NULL))
|
if ((glCreateProgram==NULL) || (glCreateShader==NULL) || (glShaderSource==NULL) || (glCompileShader==NULL))
|
||||||
{
|
{
|
||||||
ret = FAIL;
|
ret = FAIL;
|
||||||
ErrorLog("OpenGL 2.x does not appear to be present. Unable to proceed.");
|
ErrorLog("OpenGL 2.x does not appear to be present. Unable to proceed.");
|
||||||
goto Quit;
|
goto Quit;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create the shaders and shader program
|
// Create the shaders and shader program
|
||||||
|
@ -169,10 +169,10 @@ Quit:
|
||||||
}
|
}
|
||||||
|
|
||||||
void DestroyShaderProgram(GLuint shaderProgram, GLuint vertexShader, GLuint fragmentShader)
|
void DestroyShaderProgram(GLuint shaderProgram, GLuint vertexShader, GLuint fragmentShader)
|
||||||
{
|
{
|
||||||
// In case LoadShaderProgram() failed above due to lack of OpenGL 2.0+ functions...
|
// In case LoadShaderProgram() failed above due to lack of OpenGL 2.0+ functions...
|
||||||
if ((glUseProgram==NULL) || (glDeleteShader==NULL) || (glDeleteProgram==NULL))
|
if ((glUseProgram==NULL) || (glDeleteShader==NULL) || (glDeleteProgram==NULL))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
glUseProgram(0); // return to fixed function pipeline
|
glUseProgram(0); // return to fixed function pipeline
|
||||||
glDeleteShader(vertexShader);
|
glDeleteShader(vertexShader);
|
||||||
|
|
|
@ -26,7 +26,10 @@
|
||||||
* from this.
|
* from this.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "Input.h"
|
||||||
|
|
||||||
#include "Supermodel.h"
|
#include "Supermodel.h"
|
||||||
|
#include "InputSystem.h"
|
||||||
|
|
||||||
CInput::CInput(const char *inputId, const char *inputLabel, unsigned inputFlags, unsigned inputGameFlags, const char *defaultMapping, UINT16 initValue) :
|
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),
|
id(inputId), label(inputLabel), flags(inputFlags), gameFlags(inputGameFlags), m_defaultMapping(defaultMapping), value(initValue), prevValue(initValue),
|
||||||
|
|
|
@ -29,11 +29,11 @@
|
||||||
#ifndef INCLUDED_INPUT_H
|
#ifndef INCLUDED_INPUT_H
|
||||||
#define INCLUDED_INPUT_H
|
#define INCLUDED_INPUT_H
|
||||||
|
|
||||||
|
#include "InputSource.h"
|
||||||
#include "Types.h"
|
#include "Types.h"
|
||||||
#include "Game.h"
|
#include "Game.h"
|
||||||
#include "Util/NewConfig.h"
|
#include "Util/NewConfig.h"
|
||||||
|
|
||||||
class CInputSource;
|
|
||||||
class CInputSystem;
|
class CInputSystem;
|
||||||
|
|
||||||
// Flags for inputs
|
// Flags for inputs
|
||||||
|
|
|
@ -27,7 +27,10 @@
|
||||||
* values for analog inputs.
|
* values for analog inputs.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "InputSource.h"
|
||||||
|
|
||||||
#include "Supermodel.h"
|
#include "Supermodel.h"
|
||||||
|
#include "Input.h"
|
||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
|
@ -32,7 +32,11 @@
|
||||||
// - open up API to allow direct access to keyboard, mouse and joystick values
|
// - 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
|
// - add GetKey method that is easier to use than reading keyboard with ReadMapping
|
||||||
|
|
||||||
|
#include "InputSystem.h"
|
||||||
|
|
||||||
#include "Supermodel.h"
|
#include "Supermodel.h"
|
||||||
|
#include "Input.h"
|
||||||
|
#include "OSD/Thread.h"
|
||||||
|
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
@ -1993,7 +1997,7 @@ Repeat:
|
||||||
unsigned posDeadZone;
|
unsigned posDeadZone;
|
||||||
unsigned negDeadZone;
|
unsigned negDeadZone;
|
||||||
unsigned deadZone;
|
unsigned deadZone;
|
||||||
|
|
||||||
int posVal = 0;
|
int posVal = 0;
|
||||||
int negVal = 0;
|
int negVal = 0;
|
||||||
int offVal = 0;
|
int offVal = 0;
|
||||||
|
@ -2514,4 +2518,4 @@ bool CInputSystem::CJoyButInputSource::GetValueAsAnalog(int &val, int minVal, in
|
||||||
return false;
|
return false;
|
||||||
val = maxVal;
|
val = maxVal;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,6 +26,8 @@
|
||||||
* all very simple classes.
|
* all very simple classes.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "InputTypes.h"
|
||||||
|
|
||||||
#include "Supermodel.h"
|
#include "Supermodel.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -27,7 +27,11 @@
|
||||||
* maintains all individual inputs.
|
* maintains all individual inputs.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "Inputs.h"
|
||||||
|
|
||||||
#include "Supermodel.h"
|
#include "Supermodel.h"
|
||||||
|
#include "InputSystem.h"
|
||||||
|
#include "InputTypes.h"
|
||||||
#include "Game.h"
|
#include "Game.h"
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
|
@ -28,17 +28,13 @@
|
||||||
#ifndef INCLUDED_INPUTS_H
|
#ifndef INCLUDED_INPUTS_H
|
||||||
#define INCLUDED_INPUTS_H
|
#define INCLUDED_INPUTS_H
|
||||||
|
|
||||||
|
#include "InputTypes.h"
|
||||||
#include "Types.h"
|
#include "Types.h"
|
||||||
#include "Util/NewConfig.h"
|
#include "Util/NewConfig.h"
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
class CInputSystem;
|
class CInputSystem;
|
||||||
class CInput;
|
class CInput;
|
||||||
class CAnalogInput;
|
|
||||||
class CAxisInput;
|
|
||||||
class CSwitchInput;
|
|
||||||
class CGearShift4Input;
|
|
||||||
class CTriggerInput;
|
|
||||||
struct Game;
|
struct Game;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -25,7 +25,10 @@
|
||||||
* Implementation of CMultiInputSource.
|
* Implementation of CMultiInputSource.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "MultiInputSource.h"
|
||||||
|
|
||||||
#include "Supermodel.h"
|
#include "Supermodel.h"
|
||||||
|
#include "Input.h"
|
||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
|
@ -43,9 +43,11 @@
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "53C810.h"
|
||||||
|
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
#include "Supermodel.h"
|
#include "Supermodel.h"
|
||||||
|
#include "CPU/PowerPC/ppc.h"
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
Save States
|
Save States
|
||||||
|
|
|
@ -28,6 +28,10 @@
|
||||||
#ifndef INCLUDED_53C810_H
|
#ifndef INCLUDED_53C810_H
|
||||||
#define INCLUDED_53C810_H
|
#define INCLUDED_53C810_H
|
||||||
|
|
||||||
|
#include "IRQ.h"
|
||||||
|
#include "PCI.h"
|
||||||
|
#include "BlockFile.h"
|
||||||
|
#include "CPU/Bus.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* struct NCR53C810Context:
|
* struct NCR53C810Context:
|
||||||
|
|
|
@ -31,6 +31,8 @@
|
||||||
* should just be set to 0?
|
* should just be set to 0?
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "93C46.h"
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include "Supermodel.h"
|
#include "Supermodel.h"
|
||||||
|
|
||||||
|
|
|
@ -28,6 +28,8 @@
|
||||||
#ifndef INCLUDED_93C46_H
|
#ifndef INCLUDED_93C46_H
|
||||||
#define INCLUDED_93C46_H
|
#define INCLUDED_93C46_H
|
||||||
|
|
||||||
|
#include "BlockFile.h"
|
||||||
|
#include "Types.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* C93C46:
|
* C93C46:
|
||||||
|
|
|
@ -37,6 +37,8 @@
|
||||||
* - Should we do some bounds checking on the MPEG start/end points?
|
* - Should we do some bounds checking on the MPEG start/end points?
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "DSB.h"
|
||||||
|
|
||||||
#include "Supermodel.h"
|
#include "Supermodel.h"
|
||||||
#include "Sound/MPEG/MpegAudio.h"
|
#include "Sound/MPEG/MpegAudio.h"
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|
|
@ -34,6 +34,8 @@
|
||||||
|
|
||||||
#include "Types.h"
|
#include "Types.h"
|
||||||
#include "CPU/Bus.h"
|
#include "CPU/Bus.h"
|
||||||
|
#include "CPU/68K/68K.h"
|
||||||
|
#include "CPU/Z80/Z80.h"
|
||||||
#include "Util/NewConfig.h"
|
#include "Util/NewConfig.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -57,6 +57,8 @@
|
||||||
**
|
**
|
||||||
**/
|
**/
|
||||||
|
|
||||||
|
#include "BillBoard.h"
|
||||||
|
|
||||||
#include "Supermodel.h"
|
#include "Supermodel.h"
|
||||||
|
|
||||||
#include <cstdio>
|
#include <cstdio>
|
||||||
|
|
|
@ -29,6 +29,7 @@
|
||||||
#ifndef INCLUDED_BILLBOARD_H
|
#ifndef INCLUDED_BILLBOARD_H
|
||||||
#define INCLUDED_BILLBOARD_H
|
#define INCLUDED_BILLBOARD_H
|
||||||
|
|
||||||
|
#include "DriveBoard.h"
|
||||||
#include "Util/NewConfig.h"
|
#include "Util/NewConfig.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -52,6 +52,8 @@
|
||||||
* CDriveBoard::Disable() to update the disabled flag.
|
* CDriveBoard::Disable() to update the disabled flag.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "DriveBoard.h"
|
||||||
|
|
||||||
#include "Supermodel.h"
|
#include "Supermodel.h"
|
||||||
|
|
||||||
#include <cstdio>
|
#include <cstdio>
|
||||||
|
|
|
@ -30,6 +30,10 @@
|
||||||
#ifndef INCLUDED_DRIVEBOARD_H
|
#ifndef INCLUDED_DRIVEBOARD_H
|
||||||
#define 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 "Util/NewConfig.h"
|
||||||
#include "Game.h"
|
#include "Game.h"
|
||||||
|
|
||||||
|
|
|
@ -33,6 +33,8 @@
|
||||||
* NOTE: Simulation does not yet work. Drive board ROMs are required.
|
* NOTE: Simulation does not yet work. Drive board ROMs are required.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "JoystickBoard.h"
|
||||||
|
|
||||||
#include "Supermodel.h"
|
#include "Supermodel.h"
|
||||||
|
|
||||||
#include <cstdio>
|
#include <cstdio>
|
||||||
|
|
|
@ -29,6 +29,7 @@
|
||||||
#ifndef INCLUDED_JOYBOARD_H
|
#ifndef INCLUDED_JOYBOARD_H
|
||||||
#define INCLUDED_JOYBOARD_H
|
#define INCLUDED_JOYBOARD_H
|
||||||
|
|
||||||
|
#include "DriveBoard.h"
|
||||||
#include "Util/NewConfig.h"
|
#include "Util/NewConfig.h"
|
||||||
#include "Game.h"
|
#include "Game.h"
|
||||||
|
|
||||||
|
|
|
@ -29,7 +29,10 @@
|
||||||
* NOTE: Simulation does not yet work. Drive board ROMs are required.
|
* NOTE: Simulation does not yet work. Drive board ROMs are required.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "SkiBoard.h"
|
||||||
|
|
||||||
#include "Supermodel.h"
|
#include "Supermodel.h"
|
||||||
|
#include "Inputs/Input.h"
|
||||||
|
|
||||||
#include <cstdio>
|
#include <cstdio>
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
|
|
|
@ -29,6 +29,7 @@
|
||||||
#ifndef INCLUDED_SKIBOARD_H
|
#ifndef INCLUDED_SKIBOARD_H
|
||||||
#define INCLUDED_SKIBOARD_H
|
#define INCLUDED_SKIBOARD_H
|
||||||
|
|
||||||
|
#include "DriveBoard.h"
|
||||||
#include "Util/NewConfig.h"
|
#include "Util/NewConfig.h"
|
||||||
#include "Game.h"
|
#include "Game.h"
|
||||||
|
|
||||||
|
|
|
@ -29,8 +29,9 @@
|
||||||
* NOTE: Simulation does not yet work. Drive board ROMs are required.
|
* NOTE: Simulation does not yet work. Drive board ROMs are required.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "Supermodel.h"
|
#include "WheelBoard.h"
|
||||||
|
|
||||||
|
#include "Supermodel.h"
|
||||||
#include <cstdio>
|
#include <cstdio>
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|
|
@ -29,6 +29,7 @@
|
||||||
#ifndef INCLUDED_WHEELBOARD_H
|
#ifndef INCLUDED_WHEELBOARD_H
|
||||||
#define INCLUDED_WHEELBOARD_H
|
#define INCLUDED_WHEELBOARD_H
|
||||||
|
|
||||||
|
#include "DriveBoard.h"
|
||||||
#include "Util/NewConfig.h"
|
#include "Util/NewConfig.h"
|
||||||
#include "Game.h"
|
#include "Game.h"
|
||||||
|
|
||||||
|
|
|
@ -31,7 +31,10 @@
|
||||||
* call the PPC core directly, which should not happen in proper OO code.
|
* call the PPC core directly, which should not happen in proper OO code.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "IRQ.h"
|
||||||
|
|
||||||
#include "Supermodel.h"
|
#include "Supermodel.h"
|
||||||
|
#include "CPU/PowerPC/ppc.h"
|
||||||
|
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
|
|
|
@ -28,6 +28,8 @@
|
||||||
#ifndef INCLUDED_IRQ_H
|
#ifndef INCLUDED_IRQ_H
|
||||||
#define INCLUDED_IRQ_H
|
#define INCLUDED_IRQ_H
|
||||||
|
|
||||||
|
#include "BlockFile.h"
|
||||||
|
#include "Types.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* CIRQ:
|
* CIRQ:
|
||||||
|
|
|
@ -30,8 +30,11 @@
|
||||||
* probably doesn't matter), so we assume IEEE 1149.1-1990 here.
|
* probably doesn't matter), so we assume IEEE 1149.1-1990 here.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "JTAG.h"
|
||||||
|
|
||||||
#include "Supermodel.h"
|
#include "Supermodel.h"
|
||||||
#include "Model3/JTAG.h"
|
#include "Real3D.h"
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
// Finite state machine. Each state has two possible next states.
|
// Finite state machine. Each state has two possible next states.
|
||||||
|
|
|
@ -28,6 +28,7 @@
|
||||||
#ifndef INCLUDED_JTAG_H
|
#ifndef INCLUDED_JTAG_H
|
||||||
#define INCLUDED_JTAG_H
|
#define INCLUDED_JTAG_H
|
||||||
|
|
||||||
|
#include "BlockFile.h"
|
||||||
#include "Util/BitRegister.h"
|
#include "Util/BitRegister.h"
|
||||||
|
|
||||||
class CReal3D;
|
class CReal3D;
|
||||||
|
|
|
@ -66,6 +66,8 @@
|
||||||
* endian, pushing the responsibility onto the caller.
|
* endian, pushing the responsibility onto the caller.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "MPC10x.h"
|
||||||
|
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
#include "Supermodel.h"
|
#include "Supermodel.h"
|
||||||
|
|
||||||
|
|
|
@ -28,6 +28,8 @@
|
||||||
#ifndef INCLUDED_MPC10X_H
|
#ifndef INCLUDED_MPC10X_H
|
||||||
#define INCLUDED_MPC10X_H
|
#define INCLUDED_MPC10X_H
|
||||||
|
|
||||||
|
#include "PCI.h"
|
||||||
|
#include "BlockFile.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* CMPC10x:
|
* CMPC10x:
|
||||||
|
|
|
@ -210,17 +210,25 @@
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "Model3.h"
|
||||||
|
|
||||||
#include <new>
|
#include <new>
|
||||||
#include <cstdio>
|
#include <cstdio>
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
#include "Supermodel.h"
|
#include "Supermodel.h"
|
||||||
|
#include "DriveBoard/BillBoard.h"
|
||||||
|
#include "DriveBoard/JoystickBoard.h"
|
||||||
|
#include "DriveBoard/SkiBoard.h"
|
||||||
|
#include "DriveBoard/WheelBoard.h"
|
||||||
#include "Game.h"
|
#include "Game.h"
|
||||||
#include "ROMSet.h"
|
#include "ROMSet.h"
|
||||||
#ifdef NET_BOARD
|
#ifdef NET_BOARD
|
||||||
#include "Network/NetBoard.h"
|
#include "Network/NetBoard.h"
|
||||||
#include "Network/SimNetBoard.h"
|
#include "Network/SimNetBoard.h"
|
||||||
#endif // NET_BOARD
|
#endif // NET_BOARD
|
||||||
|
#include "OSD/Audio.h"
|
||||||
|
#include "OSD/Video.h"
|
||||||
#include "Util/Format.h"
|
#include "Util/Format.h"
|
||||||
#include "Util/ByteSwap.h"
|
#include "Util/ByteSwap.h"
|
||||||
#include <functional>
|
#include <functional>
|
||||||
|
|
|
@ -29,9 +29,18 @@
|
||||||
#ifndef INCLUDED_MODEL3_H
|
#ifndef INCLUDED_MODEL3_H
|
||||||
#define INCLUDED_MODEL3_H
|
#define INCLUDED_MODEL3_H
|
||||||
|
|
||||||
#include "Model3/IEmulator.h"
|
#include "53C810.h"
|
||||||
#include "Model3/JTAG.h"
|
#include "93C46.h"
|
||||||
#include "Model3/Crypto.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
|
#ifdef NET_BOARD
|
||||||
#include "Network/INetBoard.h"
|
#include "Network/INetBoard.h"
|
||||||
#endif // NET_BOARD
|
#endif // NET_BOARD
|
||||||
|
|
|
@ -33,6 +33,8 @@
|
||||||
* the vectors do not run out of memory because so few PCI devices exist.
|
* the vectors do not run out of memory because so few PCI devices exist.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "PCI.h"
|
||||||
|
|
||||||
#include "Supermodel.h"
|
#include "Supermodel.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -35,6 +35,8 @@
|
||||||
#ifndef INCLUDED_PCI_H
|
#ifndef INCLUDED_PCI_H
|
||||||
#define INCLUDED_PCI_H
|
#define INCLUDED_PCI_H
|
||||||
|
|
||||||
|
#include "Types.h"
|
||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -31,6 +31,8 @@
|
||||||
* - Writes do nothing yet.
|
* - Writes do nothing yet.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "RTC72421.h"
|
||||||
|
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
#include "Supermodel.h"
|
#include "Supermodel.h"
|
||||||
|
|
||||||
|
|
|
@ -28,6 +28,7 @@
|
||||||
#ifndef INCLUDED_RTC72421_H
|
#ifndef INCLUDED_RTC72421_H
|
||||||
#define INCLUDED_RTC72421_H
|
#define INCLUDED_RTC72421_H
|
||||||
|
|
||||||
|
#include "Types.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* CRTC72421:
|
* CRTC72421:
|
||||||
|
|
|
@ -40,9 +40,12 @@
|
||||||
* - Keep an eye out for games writing non-mipmap textures to the mipmap area.
|
* - Keep an eye out for games writing non-mipmap textures to the mipmap area.
|
||||||
* The render currently cannot cope with this.
|
* The render currently cannot cope with this.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "Real3D.h"
|
||||||
|
|
||||||
#include "Supermodel.h"
|
#include "Supermodel.h"
|
||||||
#include "Model3/JTAG.h"
|
#include "JTAG.h"
|
||||||
|
#include "CPU/PowerPC/ppc.h"
|
||||||
#include "Util/BMPFile.h"
|
#include "Util/BMPFile.h"
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
@ -151,15 +154,15 @@ void CReal3D::LoadState(CBlockFile *SaveState)
|
||||||
Rendering
|
Rendering
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
static void UpdateRenderConfig(IRender3D *Render3D, uint64_t internalRenderConfig[])
|
static void UpdateRenderConfig(IRender3D *Render3D, uint64_t internalRenderConfig[])
|
||||||
{
|
{
|
||||||
bool noSunClamp = (internalRenderConfig[0] & 0x800000) != 0 && (internalRenderConfig[1] & 0x400000) != 0;
|
bool noSunClamp = (internalRenderConfig[0] & 0x800000) != 0 && (internalRenderConfig[1] & 0x400000) != 0;
|
||||||
bool shadeIsSigned = (internalRenderConfig[0] & 0x1) == 0;
|
bool shadeIsSigned = (internalRenderConfig[0] & 0x1) == 0;
|
||||||
Render3D->SetSunClamp(!noSunClamp);
|
Render3D->SetSunClamp(!noSunClamp);
|
||||||
Render3D->SetSignedShade(shadeIsSigned);
|
Render3D->SetSignedShade(shadeIsSigned);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CReal3D::BeginVBlank(int statusCycles)
|
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
|
// 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
|
// 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)
|
void CReal3D::BeginFrame(void)
|
||||||
{
|
{
|
||||||
// If multi-threaded, perform now any queued texture uploads to renderer before rendering begins
|
// If multi-threaded, perform now any queued texture uploads to renderer before rendering begins
|
||||||
if (m_gpuMultiThreaded)
|
if (m_gpuMultiThreaded)
|
||||||
{
|
{
|
||||||
for (const auto &it : queuedUploadTexturesRO) {
|
for (const auto &it : queuedUploadTexturesRO) {
|
||||||
Render3D->UploadTextures(it.level, it.x, it.y, it.width, it.height);
|
Render3D->UploadTextures(it.level, it.x, it.y, it.width, it.height);
|
||||||
}
|
}
|
||||||
|
|
||||||
// done syncing data
|
// done syncing data
|
||||||
queuedUploadTexturesRO.clear();
|
queuedUploadTexturesRO.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
Render3D->BeginFrame();
|
Render3D->BeginFrame();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CReal3D::RenderFrame(void)
|
void CReal3D::RenderFrame(void)
|
||||||
|
@ -277,177 +280,177 @@ void CReal3D::EndFrame(void)
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
Texture Uploading and Decoding
|
Texture Uploading and Decoding
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
// Mipmap coordinates for each reduction level (within a single 2048x1024 page)
|
// 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 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 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 };
|
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
|
// Tables of texel offsets corresponding to an NxN texel texture tile
|
||||||
|
|
||||||
static const unsigned decode8x8[64] =
|
static const unsigned decode8x8[64] =
|
||||||
{
|
{
|
||||||
1, 0, 5, 4, 9, 8,13,12,
|
1, 0, 5, 4, 9, 8,13,12,
|
||||||
3, 2, 7, 6,11,10,15,14,
|
3, 2, 7, 6,11,10,15,14,
|
||||||
17,16,21,20,25,24,29,28,
|
17,16,21,20,25,24,29,28,
|
||||||
19,18,23,22,27,26,31,30,
|
19,18,23,22,27,26,31,30,
|
||||||
33,32,37,36,41,40,45,44,
|
33,32,37,36,41,40,45,44,
|
||||||
35,34,39,38,43,42,47,46,
|
35,34,39,38,43,42,47,46,
|
||||||
49,48,53,52,57,56,61,60,
|
49,48,53,52,57,56,61,60,
|
||||||
51,50,55,54,59,58,63,62
|
51,50,55,54,59,58,63,62
|
||||||
};
|
};
|
||||||
|
|
||||||
static const unsigned decode8x4[32] =
|
static const unsigned decode8x4[32] =
|
||||||
{
|
{
|
||||||
1, 0, 5, 4,
|
1, 0, 5, 4,
|
||||||
3, 2, 7, 6,
|
3, 2, 7, 6,
|
||||||
9, 8,13,12,
|
9, 8,13,12,
|
||||||
11,10,15,14,
|
11,10,15,14,
|
||||||
17,16,21,20,
|
17,16,21,20,
|
||||||
19,18,23,22,
|
19,18,23,22,
|
||||||
25,24,29,28,
|
25,24,29,28,
|
||||||
27,26,31,30
|
27,26,31,30
|
||||||
};
|
};
|
||||||
|
|
||||||
static const unsigned decode8x2[16] =
|
static const unsigned decode8x2[16] =
|
||||||
{
|
{
|
||||||
1, 0,
|
1, 0,
|
||||||
3, 2,
|
3, 2,
|
||||||
5, 4,
|
5, 4,
|
||||||
7, 6,
|
7, 6,
|
||||||
9, 8,
|
9, 8,
|
||||||
11, 10,
|
11, 10,
|
||||||
13, 12,
|
13, 12,
|
||||||
15, 14
|
15, 14
|
||||||
};
|
};
|
||||||
|
|
||||||
static const unsigned decode8x1[8] =
|
static const unsigned decode8x1[8] =
|
||||||
{
|
{
|
||||||
1,
|
1,
|
||||||
3,
|
3,
|
||||||
0,
|
0,
|
||||||
2,
|
2,
|
||||||
5,
|
5,
|
||||||
7,
|
7,
|
||||||
4,
|
4,
|
||||||
6
|
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)
|
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 tileX = (std::min)(8u, width);
|
||||||
uint32_t tileY = (std::min)(8u, height);
|
uint32_t tileY = (std::min)(8u, height);
|
||||||
|
|
||||||
texDataOffset = 0;
|
texDataOffset = 0;
|
||||||
|
|
||||||
if (sixteenBit) // 16-bit textures
|
if (sixteenBit) // 16-bit textures
|
||||||
{
|
{
|
||||||
// Outer 2 loops: NxN tiles
|
// Outer 2 loops: NxN tiles
|
||||||
for (uint32_t y = yPos; y < (yPos + height); y += tileY)
|
for (uint32_t y = yPos; y < (yPos + height); y += tileY)
|
||||||
{
|
{
|
||||||
for (uint32_t x = xPos; x < (xPos + width); x += tileX)
|
for (uint32_t x = xPos; x < (xPos + width); x += tileX)
|
||||||
{
|
{
|
||||||
// Inner 2 loops: NxN texels for the current tile
|
// Inner 2 loops: NxN texels for the current tile
|
||||||
uint32_t destOffset = y * 2048 + x;
|
uint32_t destOffset = y * 2048 + x;
|
||||||
for (uint32_t yy = 0; yy < tileY; yy++)
|
for (uint32_t yy = 0; yy < tileY; yy++)
|
||||||
{
|
{
|
||||||
for (uint32_t xx = 0; xx < tileX; xx++)
|
for (uint32_t xx = 0; xx < tileX; xx++)
|
||||||
{
|
{
|
||||||
if (m_gpuMultiThreaded)
|
if (m_gpuMultiThreaded)
|
||||||
MARK_DIRTY(textureRAMDirty, destOffset * 2);
|
MARK_DIRTY(textureRAMDirty, destOffset * 2);
|
||||||
if (tileX == 1) texData -= tileY;
|
if (tileX == 1) texData -= tileY;
|
||||||
if (tileY == 1) texData -= tileX;
|
if (tileY == 1) texData -= tileX;
|
||||||
if (tileX == 8)
|
if (tileX == 8)
|
||||||
textureRAM[destOffset++] = texData[decode8x8[yy * tileX + xx]];
|
textureRAM[destOffset++] = texData[decode8x8[yy * tileX + xx]];
|
||||||
else if (tileX == 4)
|
else if (tileX == 4)
|
||||||
textureRAM[destOffset++] = texData[decode8x4[yy * tileX + xx]];
|
textureRAM[destOffset++] = texData[decode8x4[yy * tileX + xx]];
|
||||||
else if (tileX == 2)
|
else if (tileX == 2)
|
||||||
textureRAM[destOffset++] = texData[decode8x2[yy * tileX + xx]];
|
textureRAM[destOffset++] = texData[decode8x2[yy * tileX + xx]];
|
||||||
else if (tileX == 1)
|
else if (tileX == 1)
|
||||||
textureRAM[destOffset++] = texData[decode8x1[yy * tileX + xx]];
|
textureRAM[destOffset++] = texData[decode8x1[yy * tileX + xx]];
|
||||||
texDataOffset++;
|
texDataOffset++;
|
||||||
}
|
}
|
||||||
destOffset += 2048 - tileX; // next line
|
destOffset += 2048 - tileX; // next line
|
||||||
}
|
}
|
||||||
texData += tileY * tileX; // next tile
|
texData += tileY * tileX; // next tile
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else // 8-bit textures
|
else // 8-bit textures
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* 8-bit textures appear to be unpacked into 16-bit words in the
|
* 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
|
* texture RAM. Oddly, the rows of the decoding table seem to be
|
||||||
* swapped.
|
* swapped.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (writeLSB && writeMSB) // write to both?
|
if (writeLSB && writeMSB) // write to both?
|
||||||
DebugLog("Observed 8-bit texture with byte_select=3!");
|
DebugLog("Observed 8-bit texture with byte_select=3!");
|
||||||
|
|
||||||
// Outer 2 loops: NxN tiles
|
// Outer 2 loops: NxN tiles
|
||||||
const uint8_t byteSelect = (uint8_t)writeLSB | ((uint8_t)writeMSB << 1);
|
const uint8_t byteSelect = (uint8_t)writeLSB | ((uint8_t)writeMSB << 1);
|
||||||
uint16_t tempData;
|
uint16_t tempData;
|
||||||
const uint16_t byteMask[4] = {0xFFFF, 0xFF00, 0x00FF, 0x0000};
|
const uint16_t byteMask[4] = {0xFFFF, 0xFF00, 0x00FF, 0x0000};
|
||||||
for (uint32_t y = yPos; y < (yPos + height); y += tileY)
|
for (uint32_t y = yPos; y < (yPos + height); y += tileY)
|
||||||
{
|
{
|
||||||
for (uint32_t x = xPos; x < (xPos + width); x += tileX)
|
for (uint32_t x = xPos; x < (xPos + width); x += tileX)
|
||||||
{
|
{
|
||||||
// Inner 2 loops: NxN texels for the current tile
|
// Inner 2 loops: NxN texels for the current tile
|
||||||
uint32_t destOffset = y * 2048 + x;
|
uint32_t destOffset = y * 2048 + x;
|
||||||
for (uint32_t yy = 0; yy < tileY; yy++)
|
for (uint32_t yy = 0; yy < tileY; yy++)
|
||||||
{
|
{
|
||||||
for (uint32_t xx = 0; xx < tileX; xx++)
|
for (uint32_t xx = 0; xx < tileX; xx++)
|
||||||
{
|
{
|
||||||
if (writeLSB | writeMSB) {
|
if (writeLSB | writeMSB) {
|
||||||
if (m_gpuMultiThreaded)
|
if (m_gpuMultiThreaded)
|
||||||
MARK_DIRTY(textureRAMDirty, destOffset * 2);
|
MARK_DIRTY(textureRAMDirty, destOffset * 2);
|
||||||
textureRAM[destOffset] &= byteMask[byteSelect];
|
textureRAM[destOffset] &= byteMask[byteSelect];
|
||||||
const uint8_t shift = (8 * ((xx & 1) ^ 1));
|
const uint8_t shift = (8 * ((xx & 1) ^ 1));
|
||||||
const uint8_t index = (yy ^ 1) * tileX + (xx ^ 1) - (tileX & 1);
|
const uint8_t index = (yy ^ 1) * tileX + (xx ^ 1) - (tileX & 1);
|
||||||
if (tileX == 1) texData -= tileY;
|
if (tileX == 1) texData -= tileY;
|
||||||
if (tileY == 1) texData -= tileX;
|
if (tileY == 1) texData -= tileX;
|
||||||
if (tileX == 8)
|
if (tileX == 8)
|
||||||
tempData = (texData[decode8x8[index] / 2] >> shift) & 0xFF;
|
tempData = (texData[decode8x8[index] / 2] >> shift) & 0xFF;
|
||||||
else if (tileX == 4)
|
else if (tileX == 4)
|
||||||
tempData = (texData[decode8x4[index] / 2] >> shift) & 0xFF;
|
tempData = (texData[decode8x4[index] / 2] >> shift) & 0xFF;
|
||||||
else if (tileX == 2)
|
else if (tileX == 2)
|
||||||
tempData = (texData[decode8x2[index] / 2] >> shift) & 0xFF;
|
tempData = (texData[decode8x2[index] / 2] >> shift) & 0xFF;
|
||||||
else if (tileX == 1)
|
else if (tileX == 1)
|
||||||
tempData = (texData[decode8x1[index] / 2] >> shift) & 0xFF;
|
tempData = (texData[decode8x1[index] / 2] >> shift) & 0xFF;
|
||||||
tempData |= tempData << 8;
|
tempData |= tempData << 8;
|
||||||
tempData &= byteMask[byteSelect] ^ 0xFFFF;
|
tempData &= byteMask[byteSelect] ^ 0xFFFF;
|
||||||
textureRAM[destOffset] |= tempData;
|
textureRAM[destOffset] |= tempData;
|
||||||
}
|
}
|
||||||
destOffset++;
|
destOffset++;
|
||||||
}
|
}
|
||||||
destOffset += 2048 - tileX; // next line
|
destOffset += 2048 - tileX; // next line
|
||||||
}
|
}
|
||||||
uint32_t offset = (std::max)(1u, (tileY * tileX) / 2);
|
uint32_t offset = (std::max)(1u, (tileY * tileX) / 2);
|
||||||
texData += offset; // next tile
|
texData += offset; // next tile
|
||||||
texDataOffset += offset; // next tile
|
texDataOffset += offset; // next tile
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Signal to renderer that textures have changed
|
// Signal to renderer that textures have changed
|
||||||
// TO-DO: mipmaps? What if a game writes non-mipmap textures to mipmap area?
|
// TO-DO: mipmaps? What if a game writes non-mipmap textures to mipmap area?
|
||||||
if (m_gpuMultiThreaded)
|
if (m_gpuMultiThreaded)
|
||||||
{
|
{
|
||||||
// If multi-threaded, then queue calls to UploadTextures for render thread to perform at beginning of next frame
|
// If multi-threaded, then queue calls to UploadTextures for render thread to perform at beginning of next frame
|
||||||
QueuedUploadTextures upl;
|
QueuedUploadTextures upl;
|
||||||
upl.level = level;
|
upl.level = level;
|
||||||
upl.x = xPos;
|
upl.x = xPos;
|
||||||
upl.y = yPos;
|
upl.y = yPos;
|
||||||
upl.width = width;
|
upl.width = width;
|
||||||
upl.height = height;
|
upl.height = height;
|
||||||
queuedUploadTextures.push_back(upl);
|
queuedUploadTextures.push_back(upl);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
Render3D->UploadTextures(level, xPos, yPos, width, height);
|
Render3D->UploadTextures(level, xPos, yPos, width, height);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Texture header:
|
Texture header:
|
||||||
-------- -------- -------- --xxxxxx X-position
|
-------- -------- -------- --xxxxxx X-position
|
||||||
|
@ -510,8 +513,8 @@ void CReal3D::UploadTexture(uint32_t header, const uint16_t *texData)
|
||||||
DebugLog("Unknown texture format %02X\n", type);
|
DebugLog("Unknown texture format %02X\n", type);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
DMA Device
|
DMA Device
|
||||||
|
@ -617,15 +620,15 @@ void CReal3D::WriteDMARegister32(unsigned reg, uint32_t data)
|
||||||
dmaLength = data;
|
dmaLength = data;
|
||||||
DMACopy();
|
DMACopy();
|
||||||
dmaStatus |= 1;
|
dmaStatus |= 1;
|
||||||
IRQ->Assert(dmaIRQ);
|
IRQ->Assert(dmaIRQ);
|
||||||
break;
|
break;
|
||||||
case 0x10: // command register
|
case 0x10: // command register
|
||||||
if ((data&0x20000000)) // DMA ID command
|
if ((data&0x20000000)) // DMA ID command
|
||||||
{
|
{
|
||||||
dmaData = pciID;
|
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());
|
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))
|
else if ((data&0x80000000))
|
||||||
{
|
{
|
||||||
dmaData = ReadRegister(data & 0x3F);
|
dmaData = ReadRegister(data & 0x3F);
|
||||||
}
|
}
|
||||||
|
@ -645,36 +648,36 @@ void CReal3D::WriteDMARegister32(unsigned reg, uint32_t data)
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
void CReal3D::Flush(void)
|
void CReal3D::Flush(void)
|
||||||
{
|
{
|
||||||
commandPortWritten = true;
|
commandPortWritten = true;
|
||||||
DebugLog("Real3D 88000000 written @ PC=%08X\n", ppc_get_pc());
|
DebugLog("Real3D 88000000 written @ PC=%08X\n", ppc_get_pc());
|
||||||
|
|
||||||
// Upload textures (if any)
|
// Upload textures (if any)
|
||||||
if (fifoIdx > 0)
|
if (fifoIdx > 0)
|
||||||
{
|
{
|
||||||
for (uint32_t i = 0; i < fifoIdx; )
|
for (uint32_t i = 0; i < fifoIdx; )
|
||||||
{
|
{
|
||||||
uint32_t size = 2+textureFIFO[i+0]/2;
|
uint32_t size = 2+textureFIFO[i+0]/2;
|
||||||
size /= 4;
|
size /= 4;
|
||||||
uint32_t header = textureFIFO[i+1]; // texture information header
|
uint32_t header = textureFIFO[i+1]; // texture information header
|
||||||
|
|
||||||
// Spikeout seems to be uploading 0 length textures
|
// Spikeout seems to be uploading 0 length textures
|
||||||
if (0 == size)
|
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]);
|
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;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
UploadTexture(header,(uint16_t *)&textureFIFO[i+2]);
|
UploadTexture(header,(uint16_t *)&textureFIFO[i+2]);
|
||||||
DebugLog("Real3D: Texture upload completed: %X bytes (%X)\n", size*4, textureFIFO[i+0]);
|
DebugLog("Real3D: Texture upload completed: %X bytes (%X)\n", size*4, textureFIFO[i+0]);
|
||||||
|
|
||||||
i += size;
|
i += size;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Reset texture FIFO
|
// Reset texture FIFO
|
||||||
fifoIdx = 0;
|
fifoIdx = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CReal3D::WriteTextureFIFO(uint32_t data)
|
void CReal3D::WriteTextureFIFO(uint32_t data)
|
||||||
{
|
{
|
||||||
|
@ -873,21 +876,21 @@ void CReal3D::AttachRenderer(IRender3D *Render3DPtr)
|
||||||
uint32_t CReal3D::GetASICIDCode(ASIC asic) const
|
uint32_t CReal3D::GetASICIDCode(ASIC asic) const
|
||||||
{
|
{
|
||||||
auto it = m_asicID.find(asic);
|
auto it = m_asicID.find(asic);
|
||||||
return it == m_asicID.end() ? 0 : it->second;
|
return it == m_asicID.end() ? 0 : it->second;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CReal3D::SetStepping(int stepping, uint32_t pciIDValue)
|
void CReal3D::SetStepping(int stepping, uint32_t pciIDValue)
|
||||||
|
|
||||||
{
|
{
|
||||||
step = stepping;
|
step = stepping;
|
||||||
if ((step!=0x10) && (step!=0x15) && (step!=0x20) && (step!=0x21))
|
if ((step!=0x10) && (step!=0x15) && (step!=0x20) && (step!=0x21))
|
||||||
{
|
{
|
||||||
DebugLog("Real3D: Unrecognized stepping: %d.%d\n", (step>>4)&0xF, step&0xF);
|
DebugLog("Real3D: Unrecognized stepping: %d.%d\n", (step>>4)&0xF, step&0xF);
|
||||||
step = 0x10;
|
step = 0x10;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set PCI ID
|
// Set PCI ID
|
||||||
pciID = pciIDValue;
|
pciID = pciIDValue;
|
||||||
|
|
||||||
// Pass to renderer
|
// Pass to renderer
|
||||||
if (Render3D != NULL)
|
if (Render3D != NULL)
|
||||||
|
|
|
@ -29,6 +29,12 @@
|
||||||
#ifndef INCLUDED_REAL3D_H
|
#ifndef INCLUDED_REAL3D_H
|
||||||
#define 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 <cstdint>
|
||||||
#include <map>
|
#include <map>
|
||||||
|
|
||||||
|
@ -375,19 +381,19 @@ public:
|
||||||
* any other emulation functions and after Init().
|
* any other emulation functions and after Init().
|
||||||
*
|
*
|
||||||
* Parameters:
|
* 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.
|
* 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
|
* pciIDValue The PCI ID code to return. This should be one of the PCIID
|
||||||
* enum values otherwise games may fail to boot. Although the
|
* enum values otherwise games may fail to boot. Although the
|
||||||
* PCI ID depends on stepping, there are a few games that
|
* PCI ID depends on stepping, there are a few games that
|
||||||
* have to be explicitly configured with an older ID code,
|
* have to be explicitly configured with an older ID code,
|
||||||
* which is why this parameter is exposed.
|
* which is why this parameter is exposed.
|
||||||
*/
|
*/
|
||||||
void SetStepping(int stepping, uint32_t pciIDValue);
|
void SetStepping(int stepping, uint32_t pciIDValue);
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Init(vromPtr, BusObjectPtr, IRQObjectPtr, dmaIRQBit):
|
* Init(vromPtr, BusObjectPtr, IRQObjectPtr, dmaIRQBit):
|
||||||
*
|
*
|
||||||
* One-time initialization of the context. Must be called prior to all
|
* One-time initialization of the context. Must be called prior to all
|
||||||
* other members. Connects the Real3D device to its video ROM and allocates
|
* other members. Connects the Real3D device to its video ROM and allocates
|
||||||
|
@ -424,12 +430,12 @@ public:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// Private member functions
|
// Private member functions
|
||||||
void DMACopy(void);
|
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 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);
|
void UploadTexture(uint32_t header, const uint16_t *texData);
|
||||||
uint32_t UpdateSnapshots(bool copyWhole);
|
uint32_t UpdateSnapshots(bool copyWhole);
|
||||||
uint32_t UpdateSnapshot(bool copyWhole, uint8_t *src, uint8_t *dst, unsigned size, uint8_t *dirty);
|
uint32_t UpdateSnapshot(bool copyWhole, uint8_t *src, uint8_t *dst, unsigned size, uint8_t *dirty);
|
||||||
|
|
||||||
// Config
|
// Config
|
||||||
const Util::Config::Node &m_config;
|
const Util::Config::Node &m_config;
|
||||||
|
|
|
@ -54,7 +54,11 @@
|
||||||
* ROM 600000-7FFFFF -> E00000-FFFFFF
|
* ROM 600000-7FFFFF -> E00000-FFFFFF
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "SoundBoard.h"
|
||||||
|
|
||||||
#include "Supermodel.h"
|
#include "Supermodel.h"
|
||||||
|
#include "OSD/Audio.h"
|
||||||
|
#include "Sound/SCSP.h"
|
||||||
|
|
||||||
// DEBUG
|
// DEBUG
|
||||||
//#define SUPERMODEL_LOG_AUDIO // define this to log all audio to sound.bin
|
//#define SUPERMODEL_LOG_AUDIO // define this to log all audio to sound.bin
|
||||||
|
|
|
@ -50,6 +50,8 @@
|
||||||
* manually reverse the data. This keeps with the convention for VRAM.
|
* manually reverse the data. This keeps with the convention for VRAM.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "TileGen.h"
|
||||||
|
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
#include "Supermodel.h"
|
#include "Supermodel.h"
|
||||||
|
|
||||||
|
|
|
@ -28,6 +28,8 @@
|
||||||
#ifndef INCLUDED_TILEGEN_H
|
#ifndef INCLUDED_TILEGEN_H
|
||||||
#define INCLUDED_TILEGEN_H
|
#define INCLUDED_TILEGEN_H
|
||||||
|
|
||||||
|
#include "IRQ.h"
|
||||||
|
#include "Graphics/Render2D.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* CTileGen:
|
* CTileGen:
|
||||||
|
|
|
@ -25,6 +25,7 @@
|
||||||
|
|
||||||
#include "Types.h"
|
#include "Types.h"
|
||||||
#include "CPU/Bus.h"
|
#include "CPU/Bus.h"
|
||||||
|
#include "CPU/68K/68K.h"
|
||||||
#include "OSD/Thread.h"
|
#include "OSD/Thread.h"
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include "INetBoard.h"
|
#include "INetBoard.h"
|
||||||
|
|
|
@ -27,6 +27,8 @@
|
||||||
|
|
||||||
#ifndef INCLUDED_AUDIO_H
|
#ifndef INCLUDED_AUDIO_H
|
||||||
#define INCLUDED_AUDIO_H
|
#define INCLUDED_AUDIO_H
|
||||||
|
|
||||||
|
#include "Types.h"
|
||||||
|
|
||||||
typedef void (*AudioCallbackFPtr)(void *data);
|
typedef void (*AudioCallbackFPtr)(void *data);
|
||||||
|
|
||||||
|
|
|
@ -23,6 +23,8 @@
|
||||||
* Outputs.cpp
|
* Outputs.cpp
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "Outputs.h"
|
||||||
|
|
||||||
#include "Supermodel.h"
|
#include "Supermodel.h"
|
||||||
|
|
||||||
const char *COutputs::s_outputNames[] =
|
const char *COutputs::s_outputNames[] =
|
||||||
|
|
|
@ -29,6 +29,7 @@
|
||||||
#define INCLUDED_OUTPUTS_H
|
#define INCLUDED_OUTPUTS_H
|
||||||
|
|
||||||
#include "Game.h"
|
#include "Game.h"
|
||||||
|
#include "Types.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* EOutputs enumeration of all available outputs.
|
* EOutputs enumeration of all available outputs.
|
||||||
|
|
|
@ -30,6 +30,8 @@
|
||||||
* initial set up of the buffer is correct.
|
* initial set up of the buffer is correct.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "Audio.h"
|
||||||
|
|
||||||
#include "Supermodel.h"
|
#include "Supermodel.h"
|
||||||
#include "SDLIncludes.h"
|
#include "SDLIncludes.h"
|
||||||
|
|
||||||
|
|
|
@ -69,6 +69,12 @@
|
||||||
#include "WinOutputs.h"
|
#include "WinOutputs.h"
|
||||||
#endif
|
#endif
|
||||||
#include "SDLIncludes.h"
|
#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 <iostream>
|
||||||
#include "Util/BMPFile.h"
|
#include "Util/BMPFile.h"
|
||||||
|
|
|
@ -29,9 +29,11 @@
|
||||||
* - Implement multiple keyboard and mouse support.
|
* - Implement multiple keyboard and mouse support.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "Supermodel.h"
|
|
||||||
#include "SDLInputSystem.h"
|
#include "SDLInputSystem.h"
|
||||||
|
|
||||||
|
#include "Supermodel.h"
|
||||||
|
#include "Inputs/Input.h"
|
||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
|
|
|
@ -25,6 +25,8 @@
|
||||||
* SDL-based implementation of threading primitives.
|
* SDL-based implementation of threading primitives.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "Thread.h"
|
||||||
|
|
||||||
#include "Supermodel.h"
|
#include "Supermodel.h"
|
||||||
#include "SDLIncludes.h"
|
#include "SDLIncludes.h"
|
||||||
|
|
||||||
|
|
|
@ -28,6 +28,8 @@
|
||||||
#ifndef INCLUDED_THREADS_H
|
#ifndef INCLUDED_THREADS_H
|
||||||
#define INCLUDED_THREADS_H
|
#define INCLUDED_THREADS_H
|
||||||
|
|
||||||
|
#include "Types.h"
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
class CSemaphore;
|
class CSemaphore;
|
||||||
|
|
|
@ -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.
|
Anyways credit to R. Belmont and ElSemi for the code, and for being awesome emulation Gods.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "SCSP.h"
|
||||||
|
|
||||||
#include "Supermodel.h"
|
#include "Supermodel.h"
|
||||||
#include "Sound/SCSP.h"
|
#include "SCSPDSP.h"
|
||||||
|
#include "OSD/Thread.h"
|
||||||
|
|
||||||
|
|
||||||
#include <cstdio>
|
#include <cstdio>
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
#include "Sound/SCSPDSP.h"
|
|
||||||
|
|
||||||
static const Util::Config::Node *s_config = 0;
|
static const Util::Config::Node *s_config = 0;
|
||||||
static bool s_multiThreaded = false;
|
static bool s_multiThreaded = false;
|
||||||
|
|
|
@ -28,6 +28,9 @@
|
||||||
#ifndef INCLUDED_SCSP_H
|
#ifndef INCLUDED_SCSP_H
|
||||||
#define 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_w8(UINT32 addr,UINT8 val);
|
||||||
void SCSP_w16(UINT32 addr,UINT16 val);
|
void SCSP_w16(UINT32 addr,UINT16 val);
|
||||||
|
|
|
@ -29,6 +29,8 @@
|
||||||
#ifndef INCLUDED_SCSPDSP_H
|
#ifndef INCLUDED_SCSPDSP_H
|
||||||
#define INCLUDED_SCSPDSP_H
|
#define INCLUDED_SCSPDSP_H
|
||||||
|
|
||||||
|
#include "Types.h"
|
||||||
|
|
||||||
//#define DYNDSP
|
//#define DYNDSP
|
||||||
#define DYNOPT 1 //set to 1 to enable optimization of recompiler
|
#define DYNOPT 1 //set to 1 to enable optimization of recompiler
|
||||||
|
|
||||||
|
|
|
@ -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;
|
int p;
|
||||||
LFO->phase += LFO->phase_step;
|
LFO->phase += LFO->phase_step;
|
||||||
|
@ -137,7 +137,7 @@ signed int INLINE PLFO_Step(struct _LFO *LFO)
|
||||||
return p << (SHIFT - LFO_SHIFT);
|
return p << (SHIFT - LFO_SHIFT);
|
||||||
}
|
}
|
||||||
|
|
||||||
signed int INLINE ALFO_Step(struct _LFO *LFO)
|
signed int inline ALFO_Step(struct _LFO *LFO)
|
||||||
{
|
{
|
||||||
int p;
|
int p;
|
||||||
LFO->phase += LFO->phase_step;
|
LFO->phase += LFO->phase_step;
|
||||||
|
|
|
@ -27,9 +27,7 @@
|
||||||
|
|
||||||
#ifndef INCLUDED_SUPERMODEL_H
|
#ifndef INCLUDED_SUPERMODEL_H
|
||||||
#define 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
|
// Used throughout Supermodel
|
||||||
#include <cstdio>
|
#include <cstdio>
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
|
@ -92,68 +90,10 @@
|
||||||
*/
|
*/
|
||||||
#include "Types.h" // located in OSD/<port>/ directory
|
#include "Types.h" // located in OSD/<port>/ directory
|
||||||
|
|
||||||
/*
|
|
||||||
* OSD Header Files
|
|
||||||
*/
|
|
||||||
|
|
||||||
// Error logging interface
|
// Error logging interface
|
||||||
#include "OSD/Logger.h"
|
#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
|
Helpful Macros and Inlines
|
||||||
|
|
Loading…
Reference in a new issue