mirror of https://github.com/PrimeDecomp/prime.git
Header cleanup, NONMATCHING option
This commit is contained in:
parent
3e43c0878f
commit
174a2d98f7
5
Makefile
5
Makefile
|
@ -11,6 +11,9 @@ VERBOSE ?= 0
|
||||||
# If GENERATE_MAP set to 1, tells LDFLAGS to generate a mapfile, which makes linking take several minutes.
|
# If GENERATE_MAP set to 1, tells LDFLAGS to generate a mapfile, which makes linking take several minutes.
|
||||||
GENERATE_MAP ?= 0
|
GENERATE_MAP ?= 0
|
||||||
|
|
||||||
|
# Enable non-matching code & various fixes
|
||||||
|
NONMATCHING ?= 0
|
||||||
|
|
||||||
ifeq ($(VERBOSE),0)
|
ifeq ($(VERBOSE),0)
|
||||||
QUIET := @
|
QUIET := @
|
||||||
endif
|
endif
|
||||||
|
@ -111,7 +114,7 @@ ifeq ($(VERBOSE),0)
|
||||||
# this set of LDFLAGS generates no warnings.
|
# this set of LDFLAGS generates no warnings.
|
||||||
LDFLAGS := $(MAPGEN) -fp fmadd -nodefaults -w off
|
LDFLAGS := $(MAPGEN) -fp fmadd -nodefaults -w off
|
||||||
endif
|
endif
|
||||||
DEFINES = -DPRIME1 -DVERSION=$(VERSION_NUM)
|
DEFINES = -DPRIME1 -DVERSION=$(VERSION_NUM) -DNONMATCHING=$(NONMATCHING)
|
||||||
CFLAGS_BASE = -proc gekko -nodefaults -Cpp_exceptions off -RTTI off -fp hard -fp_contract on -O4,p -maxerrors 1 -enum int -inline auto -str reuse -nosyspath -MMD $(DEFINES) $(INCLUDES)
|
CFLAGS_BASE = -proc gekko -nodefaults -Cpp_exceptions off -RTTI off -fp hard -fp_contract on -O4,p -maxerrors 1 -enum int -inline auto -str reuse -nosyspath -MMD $(DEFINES) $(INCLUDES)
|
||||||
CFLAGS = $(CFLAGS_BASE) -use_lmw_stmw on -str reuse,pool,readonly -gccinc -inline deferred,noauto -common on
|
CFLAGS = $(CFLAGS_BASE) -use_lmw_stmw on -str reuse,pool,readonly -gccinc -inline deferred,noauto -common on
|
||||||
CFLAGS_RUNTIME = $(CFLAGS_BASE) -use_lmw_stmw on -str reuse,pool,readonly -gccinc -inline deferred,auto
|
CFLAGS_RUNTIME = $(CFLAGS_BASE) -use_lmw_stmw on -str reuse,pool,readonly -gccinc -inline deferred,auto
|
||||||
|
|
|
@ -143,7 +143,7 @@ private:
|
||||||
static const GXColor black = {0, 0, 0, 0};
|
static const GXColor black = {0, 0, 0, 0};
|
||||||
GXSetFog(static_cast< GXFogType >(sGXState.x53_fogType), sGXState.x24c_fogParams.x0_fogStartZ, sGXState.x24c_fogParams.x4_fogEndZ,
|
GXSetFog(static_cast< GXFogType >(sGXState.x53_fogType), sGXState.x24c_fogParams.x0_fogStartZ, sGXState.x24c_fogParams.x4_fogEndZ,
|
||||||
sGXState.x24c_fogParams.x8_fogNearZ, sGXState.x24c_fogParams.xc_fogFarZ,
|
sGXState.x24c_fogParams.x8_fogNearZ, sGXState.x24c_fogParams.xc_fogFarZ,
|
||||||
(sGXState.x56_blendMode & 0xE0) == 0x20 ? black : sGXState.x24c_fogParams.x10_fogColor);
|
(sGXState.x56_blendMode & (7 << 5)) == (GX_BL_ONE << 5) ? black : sGXState.x24c_fogParams.x10_fogColor);
|
||||||
}
|
}
|
||||||
|
|
||||||
static SGXState sGXState;
|
static SGXState sGXState;
|
||||||
|
|
|
@ -1,12 +1,15 @@
|
||||||
#ifndef _DOLPHIN_OS_H
|
#ifndef _DOLPHIN_OS_H
|
||||||
#define _DOLPHIN_OS_H
|
#define _DOLPHIN_OS_H
|
||||||
|
|
||||||
#include "types.h"
|
#include <dolphin/types.h>
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// TODO OSInerrupt.h
|
||||||
|
typedef s16 __OSInterrupt;
|
||||||
|
|
||||||
// Upper words of the masks, since UIMM is only 16 bits
|
// Upper words of the masks, since UIMM is only 16 bits
|
||||||
#define OS_CACHED_REGION_PREFIX 0x8000
|
#define OS_CACHED_REGION_PREFIX 0x8000
|
||||||
#define OS_UNCACHED_REGION_PREFIX 0xC000
|
#define OS_UNCACHED_REGION_PREFIX 0xC000
|
||||||
|
@ -20,6 +23,8 @@ extern "C" {
|
||||||
#else
|
#else
|
||||||
#define AT_ADDRESS
|
#define AT_ADDRESS
|
||||||
#endif
|
#endif
|
||||||
|
typedef s64 OSTime;
|
||||||
|
typedef u32 OSTick;
|
||||||
u32 __OSBusClock AT_ADDRESS(OS_BASE_CACHED | 0x00F8); // sync with OSLoMem.h
|
u32 __OSBusClock AT_ADDRESS(OS_BASE_CACHED | 0x00F8); // sync with OSLoMem.h
|
||||||
u32 __OSCoreClock AT_ADDRESS(OS_BASE_CACHED | 0x00FC); // sync with OSLoMem.h
|
u32 __OSCoreClock AT_ADDRESS(OS_BASE_CACHED | 0x00FC); // sync with OSLoMem.h
|
||||||
#define OS_BUS_CLOCK __OSBusClock
|
#define OS_BUS_CLOCK __OSBusClock
|
||||||
|
|
|
@ -64,10 +64,13 @@ typedef int BOOL;
|
||||||
#define NULL 0
|
#define NULL 0
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
#ifndef __cplusplus
|
#if !defined(__cplusplus) || defined(__MWERKS__)
|
||||||
#ifndef nullptr
|
#ifndef nullptr
|
||||||
#define nullptr NULL
|
#define nullptr NULL
|
||||||
#endif
|
#endif
|
||||||
|
#ifndef override
|
||||||
|
#define override
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef ATTRIBUTE_ALIGN
|
#ifndef ATTRIBUTE_ALIGN
|
||||||
|
|
|
@ -7,65 +7,11 @@
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
typedef unsigned char u8;
|
#include <dolphin/types.h>
|
||||||
typedef unsigned short u16;
|
|
||||||
typedef unsigned int u32;
|
|
||||||
typedef unsigned long long u64;
|
|
||||||
|
|
||||||
typedef signed char s8;
|
|
||||||
typedef signed short s16;
|
|
||||||
typedef signed int s32;
|
|
||||||
typedef signed long long s64;
|
|
||||||
|
|
||||||
typedef volatile u8 vu8;
|
|
||||||
typedef volatile u16 vu16;
|
|
||||||
typedef volatile u32 vu32;
|
|
||||||
typedef volatile u64 vu64;
|
|
||||||
|
|
||||||
typedef volatile s8 vs8;
|
|
||||||
typedef volatile s16 vs16;
|
|
||||||
typedef volatile s32 vs32;
|
|
||||||
typedef volatile s64 vs64;
|
|
||||||
|
|
||||||
typedef float f32;
|
|
||||||
typedef double f64;
|
|
||||||
|
|
||||||
typedef volatile float vf32;
|
|
||||||
typedef volatile double vf64;
|
|
||||||
|
|
||||||
typedef s16 __OSInterrupt;
|
|
||||||
typedef s64 OSTime;
|
|
||||||
typedef u32 OSTick;
|
|
||||||
|
|
||||||
// Pointer to unknown, to be determined at a later date.
|
// Pointer to unknown, to be determined at a later date.
|
||||||
typedef void* unkptr;
|
typedef void* unkptr;
|
||||||
|
|
||||||
#ifndef NULL
|
|
||||||
#define NULL 0
|
|
||||||
#endif
|
|
||||||
#ifndef nullptr
|
|
||||||
#define nullptr 0
|
|
||||||
#endif
|
|
||||||
#ifndef override
|
|
||||||
#define override
|
|
||||||
#endif
|
|
||||||
|
|
||||||
typedef int BOOL;
|
|
||||||
#ifndef TRUE
|
|
||||||
#define TRUE 1
|
|
||||||
#endif
|
|
||||||
#ifndef FALSE
|
|
||||||
#define FALSE 0
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef ATTRIBUTE_ALIGN
|
|
||||||
#define ATTRIBUTE_ALIGN(num) __attribute__ ((aligned (num)))
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// where should these go?
|
|
||||||
void srand(int);
|
|
||||||
int rand();
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -6,7 +6,12 @@
|
||||||
|
|
||||||
CGX::SGXState CGX::sGXState;
|
CGX::SGXState CGX::sGXState;
|
||||||
|
|
||||||
|
#if NONMATCHING
|
||||||
|
// Doesn't need to be so big
|
||||||
|
static GXVtxDescList sVtxDescList[12];
|
||||||
|
#else
|
||||||
static GXVtxDescList sVtxDescList[30];
|
static GXVtxDescList sVtxDescList[30];
|
||||||
|
#endif
|
||||||
|
|
||||||
void CGX::SetNumChans(u8 num) {
|
void CGX::SetNumChans(u8 num) {
|
||||||
sGXState.x4e_numChans = num;
|
sGXState.x4e_numChans = num;
|
||||||
|
@ -198,7 +203,7 @@ void CGX::SetTexCoordGen(GXTexCoordID dstCoord, GXTexGenType fn, GXTexGenSrc src
|
||||||
STexState& state = sGXState.x228_texStates[dstCoord];
|
STexState& state = sGXState.x228_texStates[dstCoord];
|
||||||
u32 vm = (mtx - GX_TEXMTX0) / 3;
|
u32 vm = (mtx - GX_TEXMTX0) / 3;
|
||||||
u32 vp = postMtx - GX_PTTEXMTX0;
|
u32 vp = postMtx - GX_PTTEXMTX0;
|
||||||
#ifdef NONMATCHING
|
#if NONMATCHING
|
||||||
// Similarly to GXTexMtx, this should also be divided by 3
|
// Similarly to GXTexMtx, this should also be divided by 3
|
||||||
vp /= 3;
|
vp /= 3;
|
||||||
#endif
|
#endif
|
||||||
|
@ -442,6 +447,7 @@ void CGX::SetStandardDirectTev_Compressed(GXTevStageID stageId, u32 colorArgs, u
|
||||||
SetTevColorOp_Compressed(stageId, colorOps);
|
SetTevColorOp_Compressed(stageId, colorOps);
|
||||||
SetTevAlphaOp_Compressed(stageId, alphaOps);
|
SetTevAlphaOp_Compressed(stageId, alphaOps);
|
||||||
} else if (colorOps != state.x8_colorOps || colorOps != state.xc_alphaOps) {
|
} else if (colorOps != state.x8_colorOps || colorOps != state.xc_alphaOps) {
|
||||||
|
// Fast path for GX_TEV_ADD, GX_TB_ZERO, GX_CS_SCALE_1, true
|
||||||
state.xc_alphaOps = colorOps;
|
state.xc_alphaOps = colorOps;
|
||||||
state.x8_colorOps = colorOps;
|
state.x8_colorOps = colorOps;
|
||||||
GXTevRegID outReg = static_cast< GXTevRegID >(ShiftRightAndMask(colorOps, 3, 9));
|
GXTevRegID outReg = static_cast< GXTevRegID >(ShiftRightAndMask(colorOps, 3, 9));
|
||||||
|
|
|
@ -296,4 +296,5 @@ void CActor::DrawTouchBounds() const {}
|
||||||
|
|
||||||
bool CActor::CanRenderUnsorted(const CStateManager& mgr) const {
|
bool CActor::CanRenderUnsorted(const CStateManager& mgr) const {
|
||||||
// if (GetModelData()->IsNull() && )
|
// if (GetModelData()->IsNull() && )
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue