mirror of
https://github.com/dolphin-emu/fifoplayer.git
synced 2026-01-31 01:05:16 +01:00
Fix fifoplayer build and add support for modifying GenMode.
This commit is contained in:
@@ -159,7 +159,20 @@ void LayoutStream::ActiveItemChanged(const QModelIndex& index)
|
||||
|
||||
#define GET(type, name) type& name = *(type*)&cmddata
|
||||
|
||||
if (fifo_data[cmd_start+1] == BPMEM_SCISSORTL) // 0x20
|
||||
if (fifo_data[cmd_start+1] == BPMEM_GENMODE) // 0x00
|
||||
{
|
||||
GET(GenMode, mode);
|
||||
|
||||
AddLabel(tr("Gen mode")).endl();
|
||||
AddLabel(tr("numtexgens: ")).AddSpinBox(mode.numtexgens).endl();
|
||||
AddLabel(tr("numcolchans: ")).AddSpinBox(mode.numcolchans).endl();
|
||||
AddCheckBox(mode.ms_en, tr("Enable multisampling")).endl();
|
||||
AddLabel(tr("numtexstages: ")).AddSpinBox(mode.numtexstages).endl();
|
||||
AddLabel(tr("Culling: ")).AddComboBox(mode.cullmode, {tr("Disabled"), tr("Cull front facing"), tr("Cull back facing"), tr("Cull everything") }).endl();
|
||||
AddLabel(tr("numindstages: ")).AddSpinBox(mode.numindstages).endl();
|
||||
AddCheckBox(mode.zfreeze, tr("Enable zfreeze")).endl();
|
||||
}
|
||||
else if (fifo_data[cmd_start+1] == BPMEM_SCISSORTL) // 0x20
|
||||
{
|
||||
GET(X12Y12, coord);
|
||||
AddLabel(tr("Scissor rectangle")).endl();
|
||||
|
||||
@@ -563,16 +563,14 @@ struct FourTexUnits
|
||||
|
||||
union GenMode
|
||||
{
|
||||
struct
|
||||
{
|
||||
u32 numtexgens : 4; // 0xF
|
||||
u32 numcolchans : 5; // 0x1E0
|
||||
u32 ms_en : 1; // 0x200
|
||||
u32 numtevstages : 4; // 0x3C00
|
||||
u32 cullmode : 2; // 0xC000
|
||||
u32 numindstages : 3; // 0x30000
|
||||
u32 zfreeze : 5; //0x3C0000
|
||||
};
|
||||
BitField<0,4> numtexgens;
|
||||
BitField<4,5> numcolchans;
|
||||
BitField<9,1> ms_en;
|
||||
BitField<10,4> numtexstages;
|
||||
BitField<14,2> cullmode;
|
||||
BitField<16,3> numindstages;
|
||||
BitField<19,5> zfreeze;
|
||||
|
||||
u32 hex;
|
||||
};
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
#define BITFIELD_H
|
||||
|
||||
#include "CommonTypes.h"
|
||||
#include "endian_conv.h"
|
||||
#include <assert.h>
|
||||
|
||||
// NOTE: Only works for sizeof(T)<=4 bytes
|
||||
@@ -68,8 +69,6 @@ union SomeClass
|
||||
// Slow, non-templated bit-fields - required for Qt, since Q_OBJECT classes cannot be templated
|
||||
// TODO: Too specialized now, needs to be moved to Qt!
|
||||
// non-templated bitfields acting on big endian storages but using host values for assignment and (u32) casts
|
||||
u32 be32toh(u32);
|
||||
u32 htobe32(u32);
|
||||
class BitFieldWrapper
|
||||
{
|
||||
private:
|
||||
|
||||
@@ -2,65 +2,7 @@
|
||||
#define FIFOPLAYER_DFFFILE_H
|
||||
|
||||
#include "CommonTypes.h"
|
||||
|
||||
#ifdef HAVE_ENDIAN_H
|
||||
#include <endian.h>
|
||||
#else // asumming libogc
|
||||
#include <gctypes.h>
|
||||
#endif
|
||||
|
||||
#if BYTE_ORDER==BIG_ENDIAN
|
||||
static uint64_t le64toh(uint64_t val)
|
||||
{
|
||||
return ((val&0xff)<<56)|((val&0xff00)<<40)|((val&0xff0000)<<24)|((val&0xff000000)<<8) |
|
||||
((val&0xff00000000)>>8)|((val&0xff0000000000)>>24)|((val&0xff000000000000)>>40)|((val&0xff00000000000000)>>56);
|
||||
}
|
||||
|
||||
static uint32_t le32toh(uint32_t val)
|
||||
{
|
||||
return ((val&0xff)<<24)|((val&0xff00)<<8)|((val&0xff0000)>>8)|((val&0xff000000)>>24);
|
||||
}
|
||||
|
||||
static uint32_t h32tole(uint32_t val)
|
||||
{
|
||||
return le32toh(val);
|
||||
}
|
||||
|
||||
static uint16_t le16toh(uint16_t val)
|
||||
{
|
||||
return ((val&0xff)<<8)|((val&0xff00)>>8);
|
||||
}
|
||||
|
||||
static uint32_t h16tole(uint32_t val)
|
||||
{
|
||||
return le16toh(val);
|
||||
}
|
||||
|
||||
static uint64_t be64toh(uint64_t val)
|
||||
{
|
||||
return val;
|
||||
}
|
||||
|
||||
static uint32_t be32toh(uint32_t val)
|
||||
{
|
||||
return val;
|
||||
}
|
||||
|
||||
static uint16_t be16toh(uint16_t val)
|
||||
{
|
||||
return val;
|
||||
}
|
||||
|
||||
static uint32_t htobe32(uint32_t val)
|
||||
{
|
||||
return val;
|
||||
}
|
||||
|
||||
|
||||
#elif BYTE_ORDER==LITTLE_ENDIAN
|
||||
// endian.h should have taken care of defining these...
|
||||
#endif
|
||||
|
||||
#include "endian_conv.h"
|
||||
|
||||
#pragma pack(push, 4)
|
||||
|
||||
|
||||
62
source/endian_conv.h
Normal file
62
source/endian_conv.h
Normal file
@@ -0,0 +1,62 @@
|
||||
#ifndef ENDIAN_CONV_H
|
||||
#define ENDIAN_CONV_H
|
||||
|
||||
#ifdef HAVE_ENDIAN_H
|
||||
#include <endian.h>
|
||||
#else // asumming libogc
|
||||
#include <gctypes.h>
|
||||
#endif
|
||||
|
||||
#if BYTE_ORDER==BIG_ENDIAN
|
||||
static inline uint64_t le64toh(uint64_t val)
|
||||
{
|
||||
return ((val&0xff)<<56)|((val&0xff00)<<40)|((val&0xff0000)<<24)|((val&0xff000000)<<8) |
|
||||
((val&0xff00000000)>>8)|((val&0xff0000000000)>>24)|((val&0xff000000000000)>>40)|((val&0xff00000000000000)>>56);
|
||||
}
|
||||
|
||||
static inline uint32_t le32toh(uint32_t val)
|
||||
{
|
||||
return ((val&0xff)<<24)|((val&0xff00)<<8)|((val&0xff0000)>>8)|((val&0xff000000)>>24);
|
||||
}
|
||||
|
||||
static inline uint32_t h32tole(uint32_t val)
|
||||
{
|
||||
return le32toh(val);
|
||||
}
|
||||
|
||||
static inline uint16_t le16toh(uint16_t val)
|
||||
{
|
||||
return ((val&0xff)<<8)|((val&0xff00)>>8);
|
||||
}
|
||||
|
||||
static inline uint32_t h16tole(uint32_t val)
|
||||
{
|
||||
return le16toh(val);
|
||||
}
|
||||
|
||||
static inline uint64_t be64toh(uint64_t val)
|
||||
{
|
||||
return val;
|
||||
}
|
||||
|
||||
static inline uint32_t be32toh(uint32_t val)
|
||||
{
|
||||
return val;
|
||||
}
|
||||
|
||||
static inline uint16_t be16toh(uint16_t val)
|
||||
{
|
||||
return val;
|
||||
}
|
||||
|
||||
static inline uint32_t htobe32(uint32_t val)
|
||||
{
|
||||
return val;
|
||||
}
|
||||
|
||||
|
||||
#elif BYTE_ORDER==LITTLE_ENDIAN
|
||||
// endian.h should have taken care of defining these...
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -553,7 +553,8 @@ int main()
|
||||
wgPipe->U8 = GX_LOAD_BP_REG;
|
||||
wgPipe->U32 = (BPMEM_EFB_ADDR << 24) | ((MEM_VIRTUAL_TO_PHYSICAL(frameBuffer[fb]) >> 5) & 0xFFFFFF);
|
||||
|
||||
UPE_Copy copy;
|
||||
u32 temp;
|
||||
UPE_Copy& copy = *(UPE_Copy*)&temp;
|
||||
copy.Hex = 0;
|
||||
copy.clear = 1;
|
||||
copy.copy_to_xfb = 1;
|
||||
|
||||
Reference in New Issue
Block a user