mirror of
https://github.com/SMGCommunity/Petari.git
synced 2024-11-27 15:30:44 +00:00
vi3in1.o
100%, and some more progress on vi.o
This commit is contained in:
parent
fa17c8a645
commit
c671e6e0e3
@ -22,12 +22,12 @@ __SCFlushSyncCallback,scsystem.o,sc.a,false
|
||||
SCFlushAsync,scsystem.o,sc.a,false
|
||||
MyNandCallback,scsystem.o,sc.a,false
|
||||
SCGetAspectRatio,scapi.o,sc.a,false
|
||||
SCGetDisplayOffsetH,scapi.o,sc.a,false
|
||||
SCGetEuRgb60Mode,scapi.o,sc.a,false
|
||||
SCGetDisplayOffsetH,scapi.o,sc.a,true
|
||||
SCGetEuRgb60Mode,scapi.o,sc.a,true
|
||||
SCGetIdleMode,scapi.o,sc.a,true
|
||||
SCGetLanguage,scapi.o,sc.a,true
|
||||
SCGetProgressiveMode,scapi.o,sc.a,false
|
||||
SCGetScreenSaverMode,scapi.o,sc.a,false
|
||||
SCGetScreenSaverMode,scapi.o,sc.a,true
|
||||
SCGetSoundMode,scapi.o,sc.a,false
|
||||
SCGetCounterBias,scapi.o,sc.a,true
|
||||
SCGetBtDeviceInfoArray,scapi.o,sc.a,false
|
||||
|
|
@ -1,23 +1,23 @@
|
||||
Symbol Name, Object File, Library Archive, Matching
|
||||
OnShutdown,vi.o,vi.a,false
|
||||
OnShutdown,vi.o,vi.a,true
|
||||
__VIRetraceHandler,vi.o,vi.a,false
|
||||
VISetPreRetraceCallback,vi.o,vi.a,true
|
||||
VISetPostRetraceCallback,vi.o,vi.a,true
|
||||
getTiming,vi.o,vi.a,true
|
||||
__VIInit,vi.o,vi.a,false
|
||||
VIInit,vi.o,vi.a,false
|
||||
__VIInit,vi.o,vi.a,true
|
||||
VIInit,vi.o,vi.a,true
|
||||
VIWaitForRetrace,vi.o,vi.a,true
|
||||
setFbbRegs,vi.o,vi.a,true
|
||||
setHorizontalRegs,vi.o,vi.a,true
|
||||
setVerticalRegs,vi.o,vi.a,true
|
||||
VIConfigure,vi.o,vi.a,false
|
||||
VIConfigurePan,vi.o,vi.a,false
|
||||
VIConfigure,vi.o,vi.a,true
|
||||
VIConfigurePan,vi.o,vi.a,true
|
||||
VIFlush,vi.o,vi.a,true
|
||||
VISetNextFrameBuffer,vi.o,vi.a,false
|
||||
VISetNextFrameBuffer,vi.o,vi.a,true
|
||||
VIGetNextFrameBuffer,vi.o,vi.a,false
|
||||
VIGetCurrentFrameBuffer,vi.o,vi.a,false
|
||||
VISetBlack,vi.o,vi.a,true
|
||||
VIGetRetraceCount,vi.o,vi.a,false
|
||||
VIGetRetraceCount,vi.o,vi.a,true
|
||||
VIGetCurrentLine,vi.o,vi.a,true
|
||||
VIGetTvFormat,vi.o,vi.a,true
|
||||
VIGetDTVStatus,vi.o,vi.a,false
|
||||
@ -30,17 +30,17 @@ __VIResetRFIdle,vi.o,vi.a,false
|
||||
WaitMicroTime,i2c.o,vi.a,true
|
||||
sendSlaveAddr,i2c.o,vi.a,true
|
||||
__VISendI2CData,i2c.o,vi.a,true
|
||||
__VISetYUVSEL,vi3in1.o,vi.a,false
|
||||
__VISetFilter4EURGB60,vi3in1.o,vi.a,false
|
||||
__VISetCGMS,vi3in1.o,vi.a,false
|
||||
__VISetWSS,vi3in1.o,vi.a,false
|
||||
__VISetClosedCaption,vi3in1.o,vi.a,false
|
||||
__VISetMacrovision,vi3in1.o,vi.a,false
|
||||
__VISetGammaImm,vi3in1.o,vi.a,false
|
||||
__VISetGamma,vi3in1.o,vi.a,false
|
||||
__VISetTrapFilter,vi3in1.o,vi.a,false
|
||||
VISetTrapFilter,vi3in1.o,vi.a,false
|
||||
__VISetRGBOverDrive,vi3in1.o,vi.a,false
|
||||
VISetRGBModeImm,vi3in1.o,vi.a,false
|
||||
__VISetYUVSEL,vi3in1.o,vi.a,true
|
||||
__VISetFilter4EURGB60,vi3in1.o,vi.a,true
|
||||
__VISetCGMS,vi3in1.o,vi.a,true
|
||||
__VISetWSS,vi3in1.o,vi.a,true
|
||||
__VISetClosedCaption,vi3in1.o,vi.a,true
|
||||
__VISetMacrovision,vi3in1.o,vi.a,true
|
||||
__VISetGammaImm,vi3in1.o,vi.a,true
|
||||
__VISetGamma,vi3in1.o,vi.a,true
|
||||
__VISetTrapFilter,vi3in1.o,vi.a,true
|
||||
VISetTrapFilter,vi3in1.o,vi.a,true
|
||||
__VISetRGBOverDrive,vi3in1.o,vi.a,true
|
||||
VISetRGBModeImm,vi3in1.o,vi.a,true
|
||||
__VISetRGBModeImm,vi3in1.o,vi.a,true
|
||||
__VISetRevolutionModeSimple,vi3in1.o,vi.a,false
|
||||
__VISetRevolutionModeSimple,vi3in1.o,vi.a,true
|
||||
|
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"schemaVersion": 1,
|
||||
"label": "SDK",
|
||||
"message": "20.915%",
|
||||
"message": "22.599%",
|
||||
"color": "blue"
|
||||
}
|
@ -25,13 +25,13 @@
|
||||
| [os](https://github.com/shibbo/Petari/tree/master/libs/RVL_SDK/docs/lib/os.md) | 78.80942422975046% |
|
||||
| [pad](https://github.com/shibbo/Petari/tree/master/libs/RVL_SDK/docs/lib/pad.md) | 0.0% |
|
||||
| [rso](https://github.com/shibbo/Petari/tree/master/libs/RVL_SDK/docs/lib/rso.md) | 0.0% |
|
||||
| [sc](https://github.com/shibbo/Petari/tree/master/libs/RVL_SDK/docs/lib/sc.md) | 68.22790922259779% |
|
||||
| [sc](https://github.com/shibbo/Petari/tree/master/libs/RVL_SDK/docs/lib/sc.md) | 71.65620473201352% |
|
||||
| [si](https://github.com/shibbo/Petari/tree/master/libs/RVL_SDK/docs/lib/si.md) | 100.0% |
|
||||
| [thp](https://github.com/shibbo/Petari/tree/master/libs/RVL_SDK/docs/lib/thp.md) | 0.0% |
|
||||
| [tpl](https://github.com/shibbo/Petari/tree/master/libs/RVL_SDK/docs/lib/tpl.md) | 100.0% |
|
||||
| [usb](https://github.com/shibbo/Petari/tree/master/libs/RVL_SDK/docs/lib/usb.md) | 0.0% |
|
||||
| [vf](https://github.com/shibbo/Petari/tree/master/libs/RVL_SDK/docs/lib/vf.md) | 0.0% |
|
||||
| [vi](https://github.com/shibbo/Petari/tree/master/libs/RVL_SDK/docs/lib/vi.md) | 26.41858552631579% |
|
||||
| [vi](https://github.com/shibbo/Petari/tree/master/libs/RVL_SDK/docs/lib/vi.md) | 84.04605263157895% |
|
||||
| [wenc](https://github.com/shibbo/Petari/tree/master/libs/RVL_SDK/docs/lib/wenc.md) | 0.0% |
|
||||
| [wpad](https://github.com/shibbo/Petari/tree/master/libs/RVL_SDK/docs/lib/wpad.md) | 0.0% |
|
||||
| [wud](https://github.com/shibbo/Petari/tree/master/libs/RVL_SDK/docs/lib/wud.md) | 0.0% |
|
||||
|
@ -9,7 +9,7 @@
|
||||
| Object | Percentage (of Bytes) | Functions Done / Total Functions | Percentage (Functions) | Status
|
||||
| ------------- | ------------- | ------------- | ------------- | -------------
|
||||
| scsystem.o | 74.46153846153845% | 18 / 22 | 81.81818181818183% | :eight_pointed_black_star:
|
||||
| scapi.o | 15.916955017301039% | 3 / 19 | 15.789473684210526% | :eight_pointed_black_star:
|
||||
| scapi.o | 40.484429065743946% | 6 / 19 | 31.57894736842105% | :eight_pointed_black_star:
|
||||
| scapi_prdinfo.o | 100.0% | 3 / 3 | 100.0% | :white_check_mark:
|
||||
|
||||
|
||||
@ -44,12 +44,12 @@
|
||||
| Symbol | Decompiled? |
|
||||
| ------------- | ------------- |
|
||||
| SCGetAspectRatio | :x: |
|
||||
| SCGetDisplayOffsetH | :x: |
|
||||
| SCGetEuRgb60Mode | :x: |
|
||||
| SCGetDisplayOffsetH | :white_check_mark: |
|
||||
| SCGetEuRgb60Mode | :white_check_mark: |
|
||||
| SCGetIdleMode | :white_check_mark: |
|
||||
| SCGetLanguage | :white_check_mark: |
|
||||
| SCGetProgressiveMode | :x: |
|
||||
| SCGetScreenSaverMode | :x: |
|
||||
| SCGetScreenSaverMode | :white_check_mark: |
|
||||
| SCGetSoundMode | :x: |
|
||||
| SCGetCounterBias | :white_check_mark: |
|
||||
| SCGetBtDeviceInfoArray | :x: |
|
||||
|
@ -8,33 +8,33 @@
|
||||
|
||||
| Object | Percentage (of Bytes) | Functions Done / Total Functions | Percentage (Functions) | Status
|
||||
| ------------- | ------------- | ------------- | ------------- | -------------
|
||||
| vi.o | 22.463768115942027% | 12 / 28 | 42.857142857142854% | :eight_pointed_black_star:
|
||||
| vi.o | 71.8840579710145% | 19 / 28 | 67.85714285714286% | :eight_pointed_black_star:
|
||||
| i2c.o | 100.0% | 3 / 3 | 100.0% | :white_check_mark:
|
||||
| vi3in1.o | 1.2354152367879203% | 1 / 14 | 7.142857142857142% | :eight_pointed_black_star:
|
||||
| vi3in1.o | 100.0% | 14 / 14 | 100.0% | :white_check_mark:
|
||||
|
||||
|
||||
# vi.o
|
||||
| Symbol | Decompiled? |
|
||||
| ------------- | ------------- |
|
||||
| OnShutdown | :x: |
|
||||
| OnShutdown | :white_check_mark: |
|
||||
| __VIRetraceHandler | :x: |
|
||||
| VISetPreRetraceCallback | :white_check_mark: |
|
||||
| VISetPostRetraceCallback | :white_check_mark: |
|
||||
| getTiming | :white_check_mark: |
|
||||
| __VIInit | :x: |
|
||||
| VIInit | :x: |
|
||||
| __VIInit | :white_check_mark: |
|
||||
| VIInit | :white_check_mark: |
|
||||
| VIWaitForRetrace | :white_check_mark: |
|
||||
| setFbbRegs | :white_check_mark: |
|
||||
| setHorizontalRegs | :white_check_mark: |
|
||||
| setVerticalRegs | :white_check_mark: |
|
||||
| VIConfigure | :x: |
|
||||
| VIConfigurePan | :x: |
|
||||
| VIConfigure | :white_check_mark: |
|
||||
| VIConfigurePan | :white_check_mark: |
|
||||
| VIFlush | :white_check_mark: |
|
||||
| VISetNextFrameBuffer | :x: |
|
||||
| VISetNextFrameBuffer | :white_check_mark: |
|
||||
| VIGetNextFrameBuffer | :x: |
|
||||
| VIGetCurrentFrameBuffer | :x: |
|
||||
| VISetBlack | :white_check_mark: |
|
||||
| VIGetRetraceCount | :x: |
|
||||
| VIGetRetraceCount | :white_check_mark: |
|
||||
| VIGetCurrentLine | :white_check_mark: |
|
||||
| VIGetTvFormat | :white_check_mark: |
|
||||
| VIGetDTVStatus | :x: |
|
||||
@ -57,19 +57,19 @@
|
||||
# vi3in1.o
|
||||
| Symbol | Decompiled? |
|
||||
| ------------- | ------------- |
|
||||
| __VISetYUVSEL | :x: |
|
||||
| __VISetFilter4EURGB60 | :x: |
|
||||
| __VISetCGMS | :x: |
|
||||
| __VISetWSS | :x: |
|
||||
| __VISetClosedCaption | :x: |
|
||||
| __VISetMacrovision | :x: |
|
||||
| __VISetGammaImm | :x: |
|
||||
| __VISetGamma | :x: |
|
||||
| __VISetTrapFilter | :x: |
|
||||
| VISetTrapFilter | :x: |
|
||||
| __VISetRGBOverDrive | :x: |
|
||||
| VISetRGBModeImm | :x: |
|
||||
| __VISetYUVSEL | :white_check_mark: |
|
||||
| __VISetFilter4EURGB60 | :white_check_mark: |
|
||||
| __VISetCGMS | :white_check_mark: |
|
||||
| __VISetWSS | :white_check_mark: |
|
||||
| __VISetClosedCaption | :white_check_mark: |
|
||||
| __VISetMacrovision | :white_check_mark: |
|
||||
| __VISetGammaImm | :white_check_mark: |
|
||||
| __VISetGamma | :white_check_mark: |
|
||||
| __VISetTrapFilter | :white_check_mark: |
|
||||
| VISetTrapFilter | :white_check_mark: |
|
||||
| __VISetRGBOverDrive | :white_check_mark: |
|
||||
| VISetRGBModeImm | :white_check_mark: |
|
||||
| __VISetRGBModeImm | :white_check_mark: |
|
||||
| __VISetRevolutionModeSimple | :x: |
|
||||
| __VISetRevolutionModeSimple | :white_check_mark: |
|
||||
|
||||
|
||||
|
@ -122,13 +122,16 @@ BOOL SCGetIdleMode(SCIdleModeInfo *);
|
||||
|
||||
BOOL SCFindByteArrayItem(void *, u32, SCItemID);
|
||||
BOOL SCFindU8Item(u8* , SCItemID);
|
||||
BOOL SCFindS8Item(s8 *, SCItemID);
|
||||
BOOL SCFindU32Item(u32 *, SCItemID);
|
||||
|
||||
s8 SCGetProductGameRegion(void);
|
||||
|
||||
BOOL __SCF1(const char *, char *, u32);
|
||||
|
||||
s8 SCGetDisplayOffsetH(void);
|
||||
s8 SCGetProductArea(void);
|
||||
u8 SCGetScreenSaverMode(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
@ -83,11 +83,86 @@ typedef struct VIGammaObj {
|
||||
u16 yout[7];
|
||||
} VIGammaObj;
|
||||
|
||||
typedef enum _VITimeToDIM {
|
||||
VI_DM_DEFAULT = 0,
|
||||
VI_DM_10M,
|
||||
VI_DM_15M
|
||||
} VITimeToDIM;
|
||||
|
||||
typedef enum _VIACPType {
|
||||
VI_ACP_OFF = 1,
|
||||
VI_ACP_TYPE1 = 2,
|
||||
VI_ACP_TYPE2 = 3,
|
||||
VI_ACP_TYPE3 = 4
|
||||
} VIACPType;
|
||||
|
||||
typedef enum _VIGamma {
|
||||
VI_GM_0_1 = 1,
|
||||
VI_GM_0_2,
|
||||
VI_GM_0_3,
|
||||
VI_GM_0_4,
|
||||
VI_GM_0_5,
|
||||
VI_GM_0_6,
|
||||
VI_GM_0_7,
|
||||
VI_GM_0_8,
|
||||
VI_GM_0_9,
|
||||
VI_GM_1_0,
|
||||
VI_GM_1_1,
|
||||
VI_GM_1_2,
|
||||
VI_GM_1_3,
|
||||
VI_GM_1_4,
|
||||
VI_GM_1_5,
|
||||
VI_GM_1_6,
|
||||
VI_GM_1_7,
|
||||
VI_GM_1_8,
|
||||
VI_GM_1_9,
|
||||
VI_GM_2_0,
|
||||
VI_GM_2_1,
|
||||
VI_GM_2_2,
|
||||
VI_GM_2_3,
|
||||
VI_GM_2_4,
|
||||
VI_GM_2_5,
|
||||
VI_GM_2_6,
|
||||
VI_GM_2_7,
|
||||
VI_GM_2_8,
|
||||
VI_GM_2_9,
|
||||
VI_GM_3_0
|
||||
} VIGamma;
|
||||
|
||||
typedef enum _VIOverDrive {
|
||||
VI_ODV_L1 = 0,
|
||||
VI_ODV_L2 = 1,
|
||||
VI_ODV_L3 = 2,
|
||||
VI_ODV_L4 = 3,
|
||||
VI_ODV_L5 = 4,
|
||||
VI_ODV_L6 = 5
|
||||
} VIOverDrive;
|
||||
|
||||
typedef struct VIMacroVisionObj {
|
||||
u8 m[26];
|
||||
} VIMacroVisionObj;
|
||||
|
||||
extern VIMacroVisionObj VINtscACPType1;
|
||||
extern VIMacroVisionObj VINtscACPType2;
|
||||
extern VIMacroVisionObj VINtscACPType3;
|
||||
extern VIMacroVisionObj VIPalACPType1;
|
||||
extern VIMacroVisionObj VIPalACPType2;
|
||||
extern VIMacroVisionObj VIPalACPType3;
|
||||
extern VIMacroVisionObj VIEurgb60ACPType1;
|
||||
extern VIMacroVisionObj VIEurgb60ACPType2;
|
||||
extern VIMacroVisionObj VIEurgb60ACPType3;
|
||||
extern VIMacroVisionObj VIMpalACPType1;
|
||||
extern VIMacroVisionObj VIMpalACPType2;
|
||||
extern VIMacroVisionObj VIMpalACPType3;
|
||||
extern VIMacroVisionObj VIProgressiveACPType;
|
||||
extern VIMacroVisionObj VIZeroACPType;
|
||||
|
||||
BOOL VIResetDimmingCount();
|
||||
|
||||
u32 VIGetTvFormat();
|
||||
|
||||
u32 VIGetCurrentLine();
|
||||
u32 VIGetScanMode(void);
|
||||
|
||||
void VISetBlack(BOOL);
|
||||
void VIFlush();
|
||||
@ -98,6 +173,8 @@ void VISetNextFrameBuffer(void *);
|
||||
void VIConfigure(const GXRenderModeObj *);
|
||||
void VIConfigurePan(u16, u16, u16, u16);
|
||||
|
||||
void __VISetRevolutionModeSimple();
|
||||
|
||||
typedef u8 VIBool;
|
||||
#define VI_FALSE ((VIBool)0)
|
||||
#define VI_TRUE ((VIBool)1)
|
||||
|
@ -1,5 +1,39 @@
|
||||
#include <revolution/sc.h>
|
||||
|
||||
s8 SCGetDisplayOffsetH(void) {
|
||||
s8 offset;
|
||||
|
||||
if (!SCFindS8Item(&offset, 5)) {
|
||||
offset = 0;
|
||||
}
|
||||
else {
|
||||
if (offset < -32) {
|
||||
offset = -32;
|
||||
}
|
||||
else if (offset > 32) {
|
||||
offset = 32;
|
||||
}
|
||||
}
|
||||
|
||||
offset &= ~1;
|
||||
return offset;
|
||||
}
|
||||
|
||||
u8 SCGetEuRgb60Mode(void) {
|
||||
u8 mode;
|
||||
|
||||
if (!SCFindU8Item(&mode, 6)) {
|
||||
mode = 0;
|
||||
}
|
||||
else {
|
||||
if (mode != 1) {
|
||||
mode = 0;
|
||||
}
|
||||
}
|
||||
|
||||
return mode;
|
||||
}
|
||||
|
||||
BOOL SCGetIdleMode(SCIdleModeInfo *info) {
|
||||
return SCFindByteArrayItem(info, sizeof(*info), 9);
|
||||
}
|
||||
@ -27,6 +61,21 @@ u8 SCGetLanguage(void) {
|
||||
return lang;
|
||||
}
|
||||
|
||||
u8 SCGetScreenSaverMode(void) {
|
||||
u8 mode;
|
||||
|
||||
if (!SCFindU8Item(&mode, 15)) {
|
||||
mode = 1;
|
||||
}
|
||||
else {
|
||||
if (mode != 1) {
|
||||
mode = 0;
|
||||
}
|
||||
}
|
||||
|
||||
return mode;
|
||||
}
|
||||
|
||||
u32 SCGetCounterBias(void) {
|
||||
u32 bias;
|
||||
|
||||
|
@ -1,14 +1,35 @@
|
||||
#include <revolution/os.h>
|
||||
#include <revolution/sc.h>
|
||||
#include <revolution/vi.h>
|
||||
#include "private/flipper.h"
|
||||
|
||||
const char* __VIVersion = "<< RVL_SDK - VI \trelease build: Aug 8 2007 02:07:17 (0x4199_60831) >>";
|
||||
|
||||
extern BOOL __OSIsDiag;
|
||||
static BOOL IsInitialized = FALSE;
|
||||
static void __VIRetraceHandler(__OSInterrupt, OSContext *);
|
||||
|
||||
static volatile u32 retraceCount;
|
||||
static volatile u32 flushFlag;
|
||||
static volatile u32 flushFlag3in1;
|
||||
|
||||
static volatile BOOL __VIDimming_All_Clear = FALSE;
|
||||
static volatile BOOL __VIDimmingFlag_Enable;
|
||||
static volatile BOOL __VIDVDStopFlag_Enable;
|
||||
static volatile VITimeToDIM g_current_time_to_dim;
|
||||
static vu32 THD_TIME_TO_DIMMING = 0;
|
||||
static vu32 NEW_TIME_TO_DIMMING = 0;
|
||||
static vu32 THD_TIME_TO_DVD_STOP = 0;
|
||||
static vu32 _gIdleCount_dimming = 0;
|
||||
static vu32 _gIdleCount_dvd = 0;
|
||||
static vu32 __VIDimmingFlag_RF_IDLE;
|
||||
static vu32 __VIDimmingFlag_SI_IDLE;
|
||||
static vu32 __VIDimmingFlag_DEV_IDLE[10];
|
||||
static volatile BOOL __VIDimmingState = FALSE;
|
||||
|
||||
static OSThreadQueue retraceQueue;
|
||||
|
||||
static vu32 __VIDimmingFlag_DEV_IDLE[10];
|
||||
static volatile BOOL __VIDimmingState = FALSE;
|
||||
|
||||
#define ToPhysical(fb) (u32)(((u32)(fb)) & 0x3FFFFFFF)
|
||||
#define IS_LOWER_16MB(x) ((x) < 16*1024*1024)
|
||||
@ -31,9 +52,21 @@ static u32 CurrTvMode;
|
||||
static u32 NextBufAddr;
|
||||
static u32 CurrBufAddr;
|
||||
|
||||
static u32 FBSet = 0;
|
||||
|
||||
static VIRetraceCallback PreCB;
|
||||
static VIRetraceCallback PostCB;
|
||||
|
||||
static u32 encoderType;
|
||||
static s16 displayOffsetH = 0;
|
||||
static s16 displayOffsetV = 0;
|
||||
|
||||
static BOOL OnShutdown( BOOL final, u32 event );
|
||||
static OSShutdownFunctionInfo ShutdownFunctionInfo = {
|
||||
OnShutdown,
|
||||
127
|
||||
};
|
||||
|
||||
static timing_s timing[] = {
|
||||
{
|
||||
6,
|
||||
@ -323,10 +356,78 @@ static timing_s timing[] = {
|
||||
|
||||
static timing_s* timingExtra = NULL;
|
||||
|
||||
static u16 taps[] = {
|
||||
0x1f0,
|
||||
0x1dc,
|
||||
0x1ae,
|
||||
0x174,
|
||||
0x129,
|
||||
0x0db,
|
||||
0x08e,
|
||||
0x046,
|
||||
0x0c,
|
||||
0xe2,
|
||||
0xcb,
|
||||
0xc0,
|
||||
0xc4,
|
||||
0xcf,
|
||||
0xde,
|
||||
0xec,
|
||||
0xfc,
|
||||
0x08,
|
||||
0x0f,
|
||||
0x13,
|
||||
0x13,
|
||||
0x0f,
|
||||
0x0c,
|
||||
0x08,
|
||||
0x01,
|
||||
};
|
||||
|
||||
static BOOL OnShutdown(BOOL final, u32 event) {
|
||||
BOOL retval;
|
||||
static BOOL first = TRUE;
|
||||
static u32 count;
|
||||
|
||||
if (final == FALSE) {
|
||||
switch (event) {
|
||||
case 3:
|
||||
case 1:
|
||||
case 2:
|
||||
if (first) {
|
||||
VISetRGBModeImm();
|
||||
VIFlush();
|
||||
count = retraceCount;
|
||||
first = FALSE;
|
||||
retval = FALSE;
|
||||
}
|
||||
else {
|
||||
if (count == retraceCount) {
|
||||
retval = FALSE;
|
||||
}
|
||||
else {
|
||||
retval = TRUE;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case 4:
|
||||
case 0:
|
||||
case 6:
|
||||
case 5:
|
||||
retval = TRUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
else {
|
||||
retval = TRUE;
|
||||
}
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
static void GetCurrentDisplayPosition(u32 *hct, u32 *vct) {
|
||||
u32 hcount;
|
||||
u32 vcount0;
|
||||
u32 vcount;
|
||||
u32 hcount, vcount0, vcount;
|
||||
|
||||
vcount = (u32)((__VIRegs[0x16]) & 0x7FF);
|
||||
|
||||
@ -340,6 +441,51 @@ static void GetCurrentDisplayPosition(u32 *hct, u32 *vct) {
|
||||
*vct = vcount;
|
||||
}
|
||||
|
||||
static u32 getCurrentFieldEvenOn(void);
|
||||
static s32 cntlzd(u64);
|
||||
|
||||
static BOOL VISetRegs(void) {
|
||||
s32 regIndex;
|
||||
|
||||
if (!((shdwChangeMode == 1) && (getCurrentFieldEvenOdd() == 0))) {
|
||||
while (shdwChanged) {
|
||||
regIndex = cntlzd(shdwChanged);
|
||||
__VIRegs[regIndex] = shdwRegs[regIndex];
|
||||
shdwChanged &= ~(1ull << (63 - (regIndex)));
|
||||
}
|
||||
|
||||
shdwChangeMode = 0;
|
||||
CurrTiming = HorVer.timing;
|
||||
CurrTvMode = HorVer.tv;
|
||||
CurrBufAddr = NextBufAddr;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
else {
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
static void setScalingRegs(u16 panSizeX, u16 dispSizeX, BOOL threeD) {
|
||||
u32 scale;
|
||||
|
||||
panSizeX = (u16)(threeD? panSizeX * 2 : panSizeX);
|
||||
|
||||
if (panSizeX < dispSizeX) {
|
||||
scale = (256 * (u32)panSizeX + (u32)dispSizeX - 1)/ (u32)dispSizeX;
|
||||
|
||||
regs[0x25] = (u16)((((unsigned long)(scale)) ) | (((unsigned long)(1)) << 12));
|
||||
changed |= (1ull << (63 - (0x25)));
|
||||
|
||||
regs[0x38] = (u16)((((unsigned long)(panSizeX)) ));
|
||||
changed |= (1ull << (63 - (0x38)));
|
||||
}
|
||||
else {
|
||||
regs[0x25] = (u16)((((unsigned long)(256)) ) | (((unsigned long)(0)) << 12));
|
||||
changed |= (1ull << (63 - (0x25)));
|
||||
}
|
||||
}
|
||||
|
||||
static void calcFbbs(u32 bufAddr, u16 panPosX, u16 panPosY, u8 wordPerLine, VIXFBMode xfbMode, u16 dispPosY, u32* tfbb, u32* bfbb) {
|
||||
u32 bytesPerLine, xoffInWords;
|
||||
xoffInWords = (u32)panPosX / 16;
|
||||
@ -495,6 +641,10 @@ static u32 getCurrentHalfLine(void) {
|
||||
return ((vcount - 1) << 1) + ((hcount - 1) / CurrTiming->hlw);
|
||||
}
|
||||
|
||||
static u32 getCurrentFieldEvenOn(void) {
|
||||
return (getCurrentHalfLine() < CurrTiming->nhlines) ? 1u : 0u;
|
||||
}
|
||||
|
||||
VIRetraceCallback VISetPreRetraceCallback(VIRetraceCallback cb) {
|
||||
BOOL enabled;
|
||||
VIRetraceCallback oldcb = PreCB;
|
||||
@ -574,6 +724,222 @@ static timing_s* getTiming(VITVMode mode) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void __VIInit(VITVMode mode) {
|
||||
timing_s* tm;
|
||||
u32 nonInter;
|
||||
u32 tv, tvForReg;
|
||||
vu32 a;
|
||||
u16 hct;
|
||||
u16 vct;
|
||||
|
||||
nonInter = (u32)mode & 3;
|
||||
tv = (u32)mode >> 2;
|
||||
|
||||
*(u32*)OSPhysicalToCached(0xCC) = tv;
|
||||
|
||||
tm = getTiming(mode);
|
||||
|
||||
__VIRegs[1] = 2;
|
||||
for(a = 0; a < 1000; a++)
|
||||
;
|
||||
|
||||
__VIRegs[0] = 0;
|
||||
__VIRegs[3] = (u16)((((unsigned long)(tm->hlw)) << 0));
|
||||
__VIRegs[2] = (u16)((((unsigned long)(tm->hce)) << 0) | (((unsigned long)(tm->hcs)) << 8));
|
||||
__VIRegs[5] = (u16)((((unsigned long)(tm->hsy)) << 0) | (((unsigned long)(tm->hbe640 & ( (1 << (9)) - 1 ))) << 7));
|
||||
__VIRegs[4] = (u16)((((unsigned long)(tm->hbe640 >> 9)) << 0) | (((unsigned long)(tm->hbs640)) << 1));
|
||||
|
||||
if (encoderType == 0) {
|
||||
__VIRegs[0x39] = (u16)((((unsigned long)(tm->hbeCCIR656)) << 0) | (((unsigned long)(1)) << 15));
|
||||
__VIRegs[0x3A] = (u16)((((unsigned long)(tm->hbsCCIR656)) << 0));
|
||||
}
|
||||
|
||||
__VIRegs[0] = (u16)((((unsigned long)(tm->equ)) << 0) | (((unsigned long)(0)) << 4));
|
||||
__VIRegs[7] = (u16)((((unsigned long)(tm->prbOdd + tm->acv * 2 - 2)) << 0));
|
||||
__VIRegs[6] = (u16)((((unsigned long)(tm->psbOdd + 2)) << 0));
|
||||
__VIRegs[9] = (u16)((((unsigned long)(tm->prbEven + tm->acv * 2 - 2)) << 0));
|
||||
__VIRegs[8] = (u16)((((unsigned long)(tm->psbEven + 2)) << 0));
|
||||
__VIRegs[0xB] = (u16)((((unsigned long)(tm->bs1)) << 0) | (((unsigned long)(tm->be1)) << 5));
|
||||
__VIRegs[0xA] = (u16)((((unsigned long)(tm->bs3)) << 0) | (((unsigned long)(tm->be3)) << 5));
|
||||
__VIRegs[0xD] = (u16)((((unsigned long)(tm->bs2)) << 0) | (((unsigned long)(tm->be2)) << 5));
|
||||
__VIRegs[0xC] = (u16)((((unsigned long)(tm->bs4)) << 0) | (((unsigned long)(tm->be4)) << 5));
|
||||
__VIRegs[0x24] = (u16)((((unsigned long)(40)) << 0) | (((unsigned long)(40)) << 8));
|
||||
__VIRegs[0x1B] = 1;
|
||||
__VIRegs[0x1A] = (u16)((((unsigned long)(1)) << 0) | (((unsigned long)(1)) << 12) | (((unsigned long)(0)) << 15));
|
||||
|
||||
hct = (u16)(tm->hlw + 1);
|
||||
vct = (u16)(tm->nhlines / 2 + 1);
|
||||
__VIRegs[0x19] = (u16)hct;
|
||||
__VIRegs[0x18] = (u16)((((unsigned long)(vct)) << 0) | (((unsigned long)(1)) << 12) | (((unsigned long)(0)) << 15));
|
||||
|
||||
switch (tv) {
|
||||
case VI_PAL:
|
||||
case VI_MPAL:
|
||||
case VI_DEBUG:
|
||||
tvForReg = tv;
|
||||
break;
|
||||
|
||||
default:
|
||||
tvForReg = VI_NTSC;
|
||||
break;
|
||||
}
|
||||
|
||||
if ((nonInter == VI_INTERLACE) || (nonInter == VI_NON_INTERLACE)) {
|
||||
__VIRegs[1] = (u16)((((unsigned long)(1)) << 0) | (((unsigned long)(0)) << 1) | (((unsigned long)(nonInter & 1)) << 2) | (((unsigned long)(0)) << 3) | (((unsigned long)(0)) << 4) | (((unsigned long)(0)) << 6) | (((unsigned long)(tvForReg)) << 8));
|
||||
__VIRegs[0x36] = 0;
|
||||
}
|
||||
else {
|
||||
__VIRegs[1] = (u16)((((unsigned long)(1)) << 0) | (((unsigned long)(0)) << 1) | (((unsigned long)(1)) << 2) | (((unsigned long)(0)) << 3) | (((unsigned long)(0)) << 4) | (((unsigned long)(0)) << 6) | (((unsigned long)(tvForReg)) << 8));
|
||||
__VIRegs[0x36] = 1;
|
||||
}
|
||||
}
|
||||
|
||||
#define CLAMP(x,l,h) (((x) > (h)) ? (h) : (((x) < (l)) ? (l) : (x)))
|
||||
#define MIN(a,b) (((a) < (b)) ? (a) : (b))
|
||||
#define MAX(a,b) (((a) > (b)) ? (a) : (b))
|
||||
|
||||
static void AdjustPosition(u16 acv) {
|
||||
s32 coeff, frac;
|
||||
|
||||
HorVer.AdjustedDispPosX = (u16)CLAMP((s16)HorVer.DispPosX + displayOffsetH,
|
||||
0, 720 - HorVer.DispSizeX);
|
||||
|
||||
coeff = (HorVer.FBMode == VI_XFBMODE_SF)? 2 : 1;
|
||||
frac = HorVer.DispPosY & 1;
|
||||
|
||||
HorVer.AdjustedDispPosY = (u16)MAX((s16)HorVer.DispPosY + displayOffsetV, frac);
|
||||
|
||||
HorVer.AdjustedDispSizeY = (u16)(HorVer.DispSizeY
|
||||
+ MIN((s16)HorVer.DispPosY + displayOffsetV - frac, 0)
|
||||
- MAX((s16)HorVer.DispPosY + (s16)HorVer.DispSizeY +
|
||||
displayOffsetV - ((s16)acv*2 - frac), 0));
|
||||
|
||||
HorVer.AdjustedPanPosY = (u16)(HorVer.PanPosY
|
||||
- MIN((s16)HorVer.DispPosY + displayOffsetV - frac, 0) / coeff);
|
||||
|
||||
HorVer.AdjustedPanSizeY = (u16)(HorVer.PanSizeY
|
||||
+ MIN((s16)HorVer.DispPosY + displayOffsetV - frac, 0) / coeff
|
||||
- MAX((s16)HorVer.DispPosY + (s16)HorVer.DispSizeY +
|
||||
displayOffsetV - ((s16)acv*2 - frac), 0) / coeff);
|
||||
}
|
||||
|
||||
static void ImportAdjustingValues(void) {
|
||||
displayOffsetH = SCGetDisplayOffsetH();
|
||||
displayOffsetV = 0;
|
||||
}
|
||||
|
||||
void VIInit(void) {
|
||||
u16 dspCfg;
|
||||
u32 value, tv, tvInBootrom;
|
||||
|
||||
if (IsInitialized) {
|
||||
return;
|
||||
}
|
||||
|
||||
OSRegisterVersion(__VIVersion);
|
||||
IsInitialized = TRUE;
|
||||
|
||||
if (!(__VIRegs[1] & 1)) {
|
||||
__VIInit(VI_TVMODE_NTSC_INT);
|
||||
}
|
||||
|
||||
retraceCount = 0;
|
||||
changed = 0;
|
||||
shdwChanged = 0;
|
||||
changeMode = 0;
|
||||
shdwChangeMode = 0;
|
||||
flushFlag = 0;
|
||||
flushFlag3in1 = 0;
|
||||
|
||||
__VIRegs[0x27] = (u16)((((unsigned long)(taps[0])) << 0) | (((unsigned long)(taps[1] & ( (1 << (6)) - 1 ))) << 10));
|
||||
__VIRegs[0x26] = (u16)((((unsigned long)(taps[1] >> 6)) << 0) | (((unsigned long)(taps[2])) << 4));
|
||||
__VIRegs[0x29] = (u16)((((unsigned long)(taps[3])) << 0) | (((unsigned long)(taps[4] & ( (1 << (6)) - 1 ))) << 10));
|
||||
__VIRegs[0x28] = (u16)((((unsigned long)(taps[4] >> 6)) << 0) | (((unsigned long)(taps[5])) << 4));
|
||||
__VIRegs[0x2B] = (u16)((((unsigned long)(taps[6])) << 0) | (((unsigned long)(taps[7] & ( (1 << (6)) - 1 ))) << 10));
|
||||
__VIRegs[0x2A] = (u16)((((unsigned long)(taps[7] >> 6)) << 0) | (((unsigned long)(taps[8])) << 4));
|
||||
__VIRegs[0x2D] = (u16)((((unsigned long)(taps[9])) << 0) | (((unsigned long)(taps[10])) << 8));
|
||||
__VIRegs[0x2C] = (u16)((((unsigned long)(taps[11])) << 0) | (((unsigned long)(taps[12])) << 8));
|
||||
__VIRegs[0x2F] = (u16)((((unsigned long)(taps[13])) << 0) | (((unsigned long)(taps[14])) << 8));
|
||||
__VIRegs[0x2E] = (u16)((((unsigned long)(taps[15])) << 0) | (((unsigned long)(taps[16])) << 8));
|
||||
__VIRegs[0x31] = (u16)((((unsigned long)(taps[17])) << 0) | (((unsigned long)(taps[18])) << 8));
|
||||
__VIRegs[0x30] = (u16)((((unsigned long)(taps[19])) << 0) | (((unsigned long)(taps[20])) << 8));
|
||||
__VIRegs[0x33] = (u16)((((unsigned long)(taps[21])) << 0) | (((unsigned long)(taps[22])) << 8));
|
||||
__VIRegs[0x32] = (u16)((((unsigned long)(taps[23])) << 0) | (((unsigned long)(taps[24])) << 8));
|
||||
|
||||
__VIRegs[0x38] = (u16)640;
|
||||
ImportAdjustingValues();
|
||||
tvInBootrom = *(u32*)OSPhysicalToCached(0xCC);
|
||||
dspCfg = __VIRegs[1];
|
||||
HorVer.nonInter = VIGetScanMode();
|
||||
|
||||
HorVer.tv = ((((unsigned long)(dspCfg)) & 0x00000300) >> 8);
|
||||
if ((tvInBootrom == VI_EURGB60) ||( (tvInBootrom == VI_PAL) && (HorVer.tv == VI_NTSC))) {
|
||||
HorVer.tv = VI_EURGB60;
|
||||
}
|
||||
|
||||
tv = (HorVer.tv == VI_DEBUG)? VI_NTSC : HorVer.tv;
|
||||
HorVer.timing = getTiming((VITVMode)VI_TVMODE(tv, HorVer.nonInter));
|
||||
regs[1] = dspCfg;
|
||||
CurrTiming = HorVer.timing;
|
||||
CurrTvMode = HorVer.tv;
|
||||
HorVer.DispSizeX = 640;
|
||||
HorVer.DispSizeY = (u16)(CurrTiming->acv * 2);
|
||||
HorVer.DispPosX = (u16)( (720 - HorVer.DispSizeX) / 2 );
|
||||
HorVer.DispPosY = 0;
|
||||
AdjustPosition(CurrTiming->acv);
|
||||
HorVer.FBSizeX = 640;
|
||||
HorVer.FBSizeY = (u16)(CurrTiming->acv * 2);
|
||||
HorVer.PanPosX = 0;
|
||||
HorVer.PanPosY = 0;
|
||||
HorVer.PanSizeX = 640;
|
||||
HorVer.PanSizeY = (u16)(CurrTiming->acv * 2);
|
||||
HorVer.FBMode = VI_XFBMODE_SF;
|
||||
HorVer.wordPerLine = 40;
|
||||
HorVer.std = 40;
|
||||
HorVer.wpl = 40;
|
||||
HorVer.xof = 0;
|
||||
HorVer.black = TRUE;
|
||||
HorVer.threeD = FALSE;
|
||||
|
||||
OSInitThreadQueue(&retraceQueue);
|
||||
|
||||
value = __VIRegs[0x18];
|
||||
value = (((unsigned long)(value)) & ~0x00008000) | (((unsigned long)(0)) << 15);
|
||||
__VIRegs[0x18] = (u16)value;
|
||||
|
||||
value = __VIRegs[0x1A];
|
||||
value = (((unsigned long)(value)) & ~0x00008000) | (((unsigned long)(0)) << 15);
|
||||
__VIRegs[0x1A] = (u16)value;
|
||||
|
||||
PreCB = (VIRetraceCallback)NULL;
|
||||
PostCB = (VIRetraceCallback)NULL;
|
||||
|
||||
__OSSetInterruptHandler(24, __VIRetraceHandler);
|
||||
__OSUnmaskInterrupts((0x80000000u >> (24)));
|
||||
OSRegisterShutdownFunction(&ShutdownFunctionInfo);
|
||||
|
||||
switch(VIGetTvFormat()) {
|
||||
case VI_PAL:
|
||||
THD_TIME_TO_DIMMING = 15000;
|
||||
NEW_TIME_TO_DIMMING = 15000;
|
||||
THD_TIME_TO_DVD_STOP = 90000;
|
||||
break;
|
||||
default:
|
||||
THD_TIME_TO_DIMMING = 18000;
|
||||
NEW_TIME_TO_DIMMING = 18000;
|
||||
THD_TIME_TO_DVD_STOP = 108000;
|
||||
break;
|
||||
}
|
||||
_gIdleCount_dimming = 0;
|
||||
_gIdleCount_dvd = 0;
|
||||
g_current_time_to_dim = VI_DM_DEFAULT;
|
||||
__VIDimming_All_Clear = TRUE;
|
||||
__VIDimmingState = FALSE;
|
||||
VIEnableDimming(TRUE);
|
||||
|
||||
VIEnableDVDStopMotor(FALSE);
|
||||
__VISetRevolutionModeSimple();
|
||||
}
|
||||
|
||||
void VIWaitForRetrace(void) {
|
||||
BOOL enabled;
|
||||
@ -589,6 +955,56 @@ void VIWaitForRetrace(void) {
|
||||
OSRestoreInterrupts(enabled);
|
||||
}
|
||||
|
||||
static void setInterruptRegs(timing_s* tm) {
|
||||
u16 vct, hct, borrow;
|
||||
|
||||
vct = (u16)(tm->nhlines / 2);
|
||||
borrow = (u16)(tm->nhlines % 2);
|
||||
hct = (u16)((borrow)? tm->hlw : (u16)0);
|
||||
|
||||
vct++;
|
||||
hct++;
|
||||
|
||||
regs[0x19] = (u16)hct;
|
||||
changed |= (1ull << (63 - (0x19)));
|
||||
|
||||
regs[0x18] = (u16)((((unsigned long)(vct)) ) | (((unsigned long)(1)) << 12) | (((unsigned long)(0)) << 15));
|
||||
changed |= (1ull << (63 - (0x18)));
|
||||
}
|
||||
|
||||
static void setPicConfig(u16 fbSizeX, VIXFBMode xfbMode, u16 panPosX,
|
||||
u16 panSizeX, u8* wordPerLine, u8* std, u8* wpl,
|
||||
u8* xof)
|
||||
{
|
||||
*wordPerLine = (u8)( (fbSizeX + 15)/16 );
|
||||
*std = (u8)((xfbMode == VI_XFBMODE_SF)? *wordPerLine : (u8)( 2 * *wordPerLine ));
|
||||
*xof = (u8)( panPosX % 16 );
|
||||
*wpl = (u8)( (*xof + panSizeX + 15) / 16 );
|
||||
|
||||
regs[0x24] = (u16)((((unsigned long)(*std)) ) | (((unsigned long)(*wpl)) << 8));
|
||||
changed |= (1ull << (63 - (0x24)));
|
||||
}
|
||||
|
||||
static void setBBIntervalRegs(timing_s* tm) {
|
||||
u16 val;
|
||||
|
||||
val = (u16)((((unsigned long)(tm->bs1))) | (((unsigned long)(tm->be1)) << 5));
|
||||
regs[0xB] = val;
|
||||
changed |= (1ull << (63 - (0x0b)));
|
||||
|
||||
val = (u16)((((unsigned long)(tm->bs3))) | (((unsigned long)(tm->be3)) << 5));
|
||||
regs[0xA] = val;
|
||||
changed |= (1ull << (63 - (0x0a)));
|
||||
|
||||
val = (u16)((((unsigned long)(tm->bs2))) | (((unsigned long)(tm->be2)) << 5));
|
||||
regs[0xD] = val;
|
||||
changed |= (1ull << (63 - (0x0d)));
|
||||
|
||||
val = (u16)((((unsigned long)(tm->bs4))) | (((unsigned long)(tm->be4)) << 5));
|
||||
regs[0xC] = val;
|
||||
changed |= (1ull << (63 - (0x0c)));
|
||||
}
|
||||
|
||||
void VISetBlack(BOOL black) {
|
||||
BOOL enabled;
|
||||
timing_s* tm;
|
||||
@ -600,6 +1016,10 @@ void VISetBlack(BOOL black) {
|
||||
OSRestoreInterrupts(enabled);
|
||||
}
|
||||
|
||||
u32 VIGetRetraceCount(void) {
|
||||
return retraceCount;
|
||||
}
|
||||
|
||||
u32 VIGetCurrentLine(void) {
|
||||
u32 halfLine;
|
||||
timing_s* tm;
|
||||
@ -632,6 +1052,158 @@ static s32 cntlzd(u64 bit) {
|
||||
return (32 + __cntlzw(lo));
|
||||
}
|
||||
|
||||
static void PrintDebugPalCaution(void) {
|
||||
static u32 message = 0;
|
||||
|
||||
if (message == 0) {
|
||||
message = 1;
|
||||
OSReport("***************************************\n");
|
||||
OSReport(" ! ! ! C A U T I O N ! ! ! \n");
|
||||
OSReport("This TV format \"DEBUG_PAL\" is only for \n");
|
||||
OSReport("temporary solution until PAL DAC board \n");
|
||||
OSReport("is available. Please do NOT use this \n");
|
||||
OSReport("mode in real games!!! \n");
|
||||
OSReport("***************************************\n");
|
||||
}
|
||||
}
|
||||
|
||||
void VIConfigure(const GXRenderModeObj* rm) {
|
||||
timing_s* tm;
|
||||
u32 regDspCfg, regClksel;
|
||||
BOOL enabled;
|
||||
u32 newNonInter, tvInBootrom, tvInGame;
|
||||
|
||||
enabled = OSDisableInterrupts();
|
||||
newNonInter = (u32)rm->viTVmode & 3;
|
||||
|
||||
if (HorVer.nonInter != newNonInter) {
|
||||
changeMode = 1;
|
||||
HorVer.nonInter = newNonInter;
|
||||
}
|
||||
|
||||
tvInGame = (u32)rm->viTVmode >> 2;
|
||||
tvInBootrom = *(u32*)OSPhysicalToCached(0xCC);
|
||||
|
||||
if (tvInGame == VI_DEBUG_PAL) {
|
||||
PrintDebugPalCaution();
|
||||
}
|
||||
|
||||
if ( ((tvInBootrom != VI_PAL && tvInBootrom != VI_EURGB60) &&
|
||||
(tvInGame == VI_PAL || tvInGame == VI_EURGB60)) ||
|
||||
((tvInBootrom == VI_PAL || tvInBootrom == VI_EURGB60) &&
|
||||
(tvInGame != VI_PAL && tvInGame != VI_EURGB60))) {
|
||||
|
||||
OSPanic(__FILE__, 0xA57, "VIConfigure(): Tried to change mode from (%d) to (%d), which is forbidden\n", tvInBootrom, tvInGame);
|
||||
}
|
||||
|
||||
if ( (tvInGame == VI_NTSC) || (tvInGame == VI_MPAL) ) {
|
||||
HorVer.tv = tvInBootrom;
|
||||
}
|
||||
else {
|
||||
HorVer.tv = tvInGame;
|
||||
}
|
||||
|
||||
HorVer.DispPosX = rm->viXOrigin;
|
||||
HorVer.DispPosY = (u16)((HorVer.nonInter == VI_NON_INTERLACE) ? (u16)(rm->viYOrigin * 2) : rm->viYOrigin);
|
||||
HorVer.DispSizeX = rm->viWidth;
|
||||
HorVer.FBSizeX = rm->fbWidth;
|
||||
HorVer.FBSizeY = rm->xfbHeight;
|
||||
HorVer.FBMode = rm->xFBmode;
|
||||
HorVer.PanSizeX = HorVer.FBSizeX;
|
||||
HorVer.PanSizeY = HorVer.FBSizeY;
|
||||
HorVer.PanPosX = 0;
|
||||
HorVer.PanPosY = 0;
|
||||
|
||||
HorVer.DispSizeY = (u16)((HorVer.nonInter == VI_PROGRESSIVE)? HorVer.PanSizeY :
|
||||
(HorVer.nonInter == VI_3D)? HorVer.PanSizeY :
|
||||
(HorVer.FBMode == VI_XFBMODE_SF)? (u16)(2 * HorVer.PanSizeY) : HorVer.PanSizeY);
|
||||
|
||||
HorVer.threeD = (HorVer.nonInter == VI_3D) ? TRUE : FALSE;
|
||||
|
||||
tm = getTiming((VITVMode)VI_TVMODE(HorVer.tv, HorVer.nonInter));
|
||||
HorVer.timing = tm;
|
||||
|
||||
AdjustPosition(tm->acv);
|
||||
setInterruptRegs(tm);
|
||||
|
||||
regDspCfg = regs[1];
|
||||
regClksel = regs[0x36];
|
||||
|
||||
if ((HorVer.nonInter == VI_PROGRESSIVE) || (HorVer.nonInter == VI_3D)) {
|
||||
regDspCfg = (((unsigned long)(regDspCfg)) & ~0x00000004) | (((unsigned long)(1)) << 2);
|
||||
|
||||
if (HorVer.tv == VI_HD720) {
|
||||
regClksel = (((unsigned long)(regClksel)) & ~0x00000001) | (((unsigned long)(0)));
|
||||
}
|
||||
else {
|
||||
regClksel = (((unsigned long)(regClksel)) & ~0x00000001) | (((unsigned long)(1)));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
regDspCfg = (((unsigned long)(regDspCfg)) & ~0x00000004) | (((unsigned long)(HorVer.nonInter & 1)) << 2);
|
||||
regClksel = (((unsigned long)(regClksel)) & ~0x00000001) | (((unsigned long)(0)));
|
||||
}
|
||||
|
||||
regDspCfg = (((unsigned long)(regDspCfg)) & ~0x00000008) | (((unsigned long)(HorVer.threeD)) << 3);
|
||||
|
||||
if ((HorVer.tv == VI_PAL) || (HorVer.tv == VI_MPAL) || (HorVer.tv == VI_DEBUG)) {
|
||||
regDspCfg = (((unsigned long)(regDspCfg)) & ~0x00000300) | (((unsigned long)(HorVer.tv)) << 8);
|
||||
}
|
||||
else {
|
||||
regDspCfg = (((unsigned long)(regDspCfg)) & ~0x00000300) | (((unsigned long)(0)) << 8);
|
||||
}
|
||||
|
||||
regs[1] = (u16)regDspCfg;
|
||||
regs[0x36] = (u16)regClksel;
|
||||
changed |= (1ull << (63 - (0x01)));
|
||||
changed |= (1ull << (63 - (0x36)));
|
||||
|
||||
setScalingRegs(HorVer.PanSizeX, HorVer.DispSizeX, HorVer.threeD);
|
||||
setHorizontalRegs(tm, HorVer.AdjustedDispPosX, HorVer.DispSizeX);
|
||||
setBBIntervalRegs(tm);
|
||||
setPicConfig(HorVer.FBSizeX, HorVer.FBMode, HorVer.PanPosX, HorVer.PanSizeX, &HorVer.wordPerLine, &HorVer.std, &HorVer.wpl, &HorVer.xof);
|
||||
|
||||
if (FBSet) {
|
||||
setFbbRegs(&HorVer, &HorVer.tfbb, &HorVer.bfbb, &HorVer.rtfbb, &HorVer.rbfbb);
|
||||
}
|
||||
|
||||
setVerticalRegs(HorVer.AdjustedDispPosY, HorVer.AdjustedDispSizeY, tm->equ, tm->acv, tm->prbOdd, tm->prbEven, tm->psbOdd, tm->psbEven, HorVer.black);
|
||||
OSRestoreInterrupts(enabled);
|
||||
}
|
||||
|
||||
void VIConfigurePan(u16 xOrg, u16 yOrg, u16 width, u16 height) {
|
||||
BOOL enabled;
|
||||
timing_s* tm;
|
||||
|
||||
enabled = OSDisableInterrupts();
|
||||
|
||||
HorVer.PanPosX = xOrg;
|
||||
HorVer.PanPosY = yOrg;
|
||||
HorVer.PanSizeX = width;
|
||||
HorVer.PanSizeY = height;
|
||||
HorVer.DispSizeY = (u16)((HorVer.nonInter == VI_PROGRESSIVE)? HorVer.PanSizeY :
|
||||
(HorVer.nonInter == VI_3D)? HorVer.PanSizeY :
|
||||
(HorVer.FBMode == VI_XFBMODE_SF)? (u16)(2 * HorVer.PanSizeY) : HorVer.PanSizeY);
|
||||
|
||||
tm = HorVer.timing;
|
||||
|
||||
AdjustPosition(tm->acv);
|
||||
setScalingRegs(HorVer.PanSizeX, HorVer.DispSizeX, HorVer.threeD);
|
||||
setPicConfig(HorVer.FBSizeX, HorVer.FBMode, HorVer.PanPosX, HorVer.PanSizeX,
|
||||
&HorVer.wordPerLine, &HorVer.std, &HorVer.wpl, &HorVer.xof);
|
||||
|
||||
if (FBSet) {
|
||||
setFbbRegs(&HorVer, &HorVer.tfbb, &HorVer.bfbb, &HorVer.rtfbb, &HorVer.rbfbb);
|
||||
}
|
||||
|
||||
setVerticalRegs(HorVer.AdjustedDispPosY, HorVer.DispSizeY, tm->equ, tm->acv,
|
||||
tm->prbOdd, tm->prbEven, tm->psbOdd, tm->psbEven,
|
||||
HorVer.black);
|
||||
|
||||
OSRestoreInterrupts(enabled);
|
||||
}
|
||||
|
||||
void VIFlush(void) {
|
||||
BOOL enabled;
|
||||
s32 regIndex;
|
||||
@ -653,6 +1225,14 @@ void VIFlush(void) {
|
||||
OSRestoreInterrupts(enabled);
|
||||
}
|
||||
|
||||
void VISetNextFrameBuffer(void* fb) {
|
||||
BOOL enabled = OSDisableInterrupts();
|
||||
HorVer.bufAddr = (u32)fb;
|
||||
FBSet = 1;
|
||||
setFbbRegs(&HorVer, &HorVer.tfbb, &HorVer.bfbb, &HorVer.rtfbb, &HorVer.rbfbb);
|
||||
OSRestoreInterrupts(enabled);
|
||||
}
|
||||
|
||||
u32 VIGetTvFormat(void) {
|
||||
u32 format;
|
||||
BOOL enabled;
|
||||
@ -687,6 +1267,32 @@ u32 VIGetTvFormat(void) {
|
||||
return format;
|
||||
}
|
||||
|
||||
u32 VIGetScanMode(void) {
|
||||
u32 scanMode;
|
||||
BOOL enabled;
|
||||
|
||||
enabled = OSDisableInterrupts();
|
||||
|
||||
if (((((unsigned long)(__VIRegs[0x36])) & 0x00000001) >> 0) == 1)
|
||||
{
|
||||
scanMode = VI_PROGRESSIVE;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (((((unsigned long)(__VIRegs[0x01])) & 0x00000004) >> 2) == 0)
|
||||
{
|
||||
scanMode = VI_INTERLACE;
|
||||
}
|
||||
else
|
||||
{
|
||||
scanMode = VI_NON_INTERLACE;
|
||||
}
|
||||
}
|
||||
OSRestoreInterrupts(enabled);
|
||||
|
||||
return scanMode;
|
||||
}
|
||||
|
||||
BOOL __VIResetDev0Idle(void) {
|
||||
__VIDimmingFlag_DEV_IDLE[0] = 0;
|
||||
return TRUE;
|
||||
@ -694,4 +1300,39 @@ BOOL __VIResetDev0Idle(void) {
|
||||
|
||||
BOOL VIResetDimmingCount(void) {
|
||||
return __VIResetDev0Idle();
|
||||
}
|
||||
}
|
||||
|
||||
BOOL VIEnableDVDStopMotor(BOOL enable) {
|
||||
BOOL old = __VIDVDStopFlag_Enable;
|
||||
__VIDVDStopFlag_Enable = enable;
|
||||
return old;
|
||||
}
|
||||
|
||||
u32 VIGetDVDStopMotorCount(void) {
|
||||
u32 count;
|
||||
|
||||
if (_gIdleCount_dvd >= THD_TIME_TO_DVD_STOP) {
|
||||
count = 0;
|
||||
}
|
||||
else {
|
||||
count = (u32)THD_TIME_TO_DVD_STOP - _gIdleCount_dvd;
|
||||
}
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
BOOL VIEnableDimming(BOOL enable) {
|
||||
u8 value;
|
||||
BOOL old = __VIDimmingFlag_Enable;
|
||||
|
||||
if (enable == TRUE) {
|
||||
value = SCGetScreenSaverMode();
|
||||
|
||||
if (value == 0) {
|
||||
enable = FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
__VIDimmingFlag_Enable = enable;
|
||||
return old;
|
||||
}
|
||||
|
@ -2,10 +2,818 @@
|
||||
|
||||
static VIVideo Vdac_Flag_Region;
|
||||
volatile u32 Vdac_Flag_Changed = 0;
|
||||
static VIACPType __type;
|
||||
static u32 __tvType = 0xFF;
|
||||
|
||||
static VIGammaObj gammaSet[] = {
|
||||
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
|
||||
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
|
||||
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
|
||||
0x0000,0x0000,0x0000,0x0030,0x0397,0x3B49,
|
||||
0x0010,0x001D,0x0036,0x0058,0x0082,0x00B3,0x00EB,
|
||||
0x1000,0x1000,0x1000,0x1000,0x1080,0x1B80,0xEB00,
|
||||
0x0000,0x0028,0x005A,0x02DB,0x0D8D,0x3049,
|
||||
0x0010,0x001D,0x0036,0x0058,0x0082,0x00B3,0x00EB,
|
||||
0x1000,0x1000,0x1040,0x1100,0x1880,0x4200,0xEB00,
|
||||
0x0000,0x007A,0x023C,0x076D,0x129C,0x2724,
|
||||
0x0010,0x001D,0x0036,0x0058,0x0082,0x00B3,0x00EB,
|
||||
0x1000,0x1000,0x10C0,0x1580,0x2900,0x6200,0xEB00,
|
||||
0x004E,0x0199,0x052D,0x0B24,0x1429,0x20A4,
|
||||
0x0010,0x001D,0x0036,0x0058,0x0082,0x00B3,0x00EB,
|
||||
0x1000,0x1040,0x12C0,0x1DC0,0x3B00,0x78C0,0xEB00,
|
||||
0x00EC,0x03D7,0x0800,0x0D9E,0x143E,0x1BDB,
|
||||
0x0010,0x001D,0x0036,0x0058,0x0082,0x00B3,0x00EB,
|
||||
0x1000,0x10C0,0x16C0,0x27C0,0x4B80,0x8980,0xEB00,
|
||||
0x0276,0x0666,0x0A96,0x0EF3,0x13AC,0x1849,
|
||||
0x0010,0x001D,0x0036,0x0058,0x0082,0x00B3,0x00EB,
|
||||
0x1000,0x1200,0x1C00,0x3280,0x59C0,0x9600,0xEB00,
|
||||
0x04EC,0x08F5,0x0C96,0x0FCF,0x12C6,0x1580,
|
||||
0x0010,0x001D,0x0036,0x0058,0x0082,0x00B3,0x00EB,
|
||||
0x1000,0x1400,0x2200,0x3CC0,0x6640,0x9FC0,0xEB00,
|
||||
0x0800,0x0BAE,0x0E00,0x1030,0x11CB,0x1349,
|
||||
0x0010,0x001D,0x0036,0x0058,0x0082,0x00B3,0x00EB,
|
||||
0x1000,0x1680,0x28C0,0x4680,0x7100,0xA780,0xEB00,
|
||||
0x0BB1,0x0E14,0x0F2D,0x1018,0x10E5,0x1180,
|
||||
0x0010,0x001D,0x0036,0x0058,0x0082,0x00B3,0x00EB,
|
||||
0x1000,0x1980,0x2F80,0x4FC0,0x7A00,0xADC0,0xEB00,
|
||||
0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,
|
||||
0x10,0x20,0x40,0x60,0x80,0xA0,0xEB,
|
||||
0x1000,0x2000,0x4000,0x6000,0x8000,0xA000,0xEB00,
|
||||
0x14EC,0x11C2,0x1078,0x0FB6,0x0F2F,0x0EB6,
|
||||
0x0010,0x001D,0x0036,0x0058,0x0082,0x00B3,0x00EB,
|
||||
0x1000,0x2100,0x3CC0,0x5FC0,0x8900,0xB780,0xEB00,
|
||||
0x19D8,0x1333,0x10D2,0x0F6D,0x0E5E,0x0DA4,
|
||||
0x0010,0x001D,0x0036,0x0058,0x0082,0x00B3,0x00EB,
|
||||
0x1000,0x2500,0x4300,0x66C0,0x8F40,0xBB40,0xEB00,
|
||||
0x1EC4,0x147A,0x110F,0x0F0C,0x0DA1,0x0CB6,
|
||||
0x0010,0x001D,0x0036,0x0058,0x0082,0x00B3,0x00EB,
|
||||
0x1000,0x2900,0x4900,0x6D40,0x94C0,0xBE80,0xEB00,
|
||||
0x2400,0x1570,0x110F,0x0EAA,0x0D0F,0x0BDB,
|
||||
0x0010,0x001D,0x0036,0x0058,0x0082,0x00B3,0x00EB,
|
||||
0x1000,0x2D40,0x4EC0,0x7300,0x9980,0xC180,0xEB00,
|
||||
0x293B,0x163D,0x110F,0x0E30,0x0C7D,0x0B24,
|
||||
0x0010,0x001D,0x0036,0x0058,0x0082,0x00B3,0x00EB,
|
||||
0x1000,0x3180,0x5440,0x7880,0x9DC0,0xC400,0xEB00,
|
||||
0x2E27,0x170A,0x10D2,0x0DE7,0x0BEB,0x0A80,
|
||||
0x0010,0x001D,0x0036,0x0058,0x0082,0x00B3,0x00EB,
|
||||
0x1000,0x3580,0x5980,0x7D40,0xA1C0,0xC640,0xEB00,
|
||||
0x3362,0x175C,0x10D2,0x0D6D,0x0B6D,0x09ED,
|
||||
0x0010,0x001D,0x0036,0x0058,0x0082,0x00B3,0x00EB,
|
||||
0x1000,0x39C0,0x5E40,0x8200,0xA540,0xC840,0xEB00,
|
||||
0x384E,0x17AE,0x10B4,0x0D0C,0x0AF0,0x096D,
|
||||
0x0010,0x001D,0x0036,0x0058,0x0082,0x00B3,0x00EB,
|
||||
0x1000,0x3DC0,0x62C0,0x8640,0xA880,0xCA00,0xEB00,
|
||||
0x3D3B,0x1800,0x105A,0x0CC3,0x0A72,0x0900,
|
||||
0x0010,0x001D,0x0036,0x0058,0x0082,0x00B3,0x00EB,
|
||||
0x1000,0x41C0,0x6740,0x8A00,0xAB80,0xCB80,0xEB00,
|
||||
0x41D8,0x1828,0x103C,0x0C49,0x0A1F,0x0892,
|
||||
0x0010,0x001D,0x0036,0x0058,0x0082,0x00B3,0x00EB,
|
||||
0x1000,0x4580,0x6B40,0x8DC0,0xAE00,0xCD00,0xEB00,
|
||||
0x4676,0x1851,0x0FE1,0x0C00,0x09B6,0x0836,
|
||||
0x0010,0x001D,0x0036,0x0058,0x0082,0x00B3,0x00EB,
|
||||
0x1000,0x4940,0x6F40,0x9100,0xB080,0xCE40,0xEB00,
|
||||
0x4AC4,0x187A,0x0FA5,0x0B9E,0x0963,0x07DB,
|
||||
0x0010,0x001D,0x0036,0x0058,0x0082,0x00B3,0x00EB,
|
||||
0x1000,0x4CC0,0x7300,0x9440,0xB2C0,0xCF80,0xEB00,
|
||||
0x4F13,0x1851,0x0F69,0x0B6D,0x090F,0x0780,
|
||||
0x0010,0x001D,0x0036,0x0058,0x0082,0x00B3,0x00EB,
|
||||
0x1000,0x5040,0x7640,0x9700,0xB500,0xD0C0,0xEB00,
|
||||
0x5313,0x187A,0x0F0F,0x0B24,0x08BC,0x0736,
|
||||
0x0010,0x001D,0x0036,0x0058,0x0082,0x00B3,0x00EB,
|
||||
0x1000,0x5380,0x79C0,0x99C0,0xB700,0xD1C0,0xEB00,
|
||||
0x5713,0x1851,0x0EF0,0x0AC3,0x087D,0x06ED,
|
||||
0x0010,0x001D,0x0036,0x0058,0x0082,0x00B3,0x00EB,
|
||||
0x1000,0x56C0,0x7CC0,0x9C80,0xB8C0,0xD2C0,0xEB00,
|
||||
0x5B13,0x1828,0x0E96,0x0A92,0x0829,0x06B6,
|
||||
0x0010,0x001D,0x0036,0x0058,0x0082,0x00B3,0x00EB,
|
||||
0x1000,0x5A00,0x7FC0,0x9EC0,0xBA80,0xD380,0xEB00,
|
||||
0x5EC4,0x1800,0x0E78,0x0A30,0x0800,0x066D,
|
||||
0x0010,0x001D,0x0036,0x0058,0x0082,0x00B3,0x00EB,
|
||||
0x1000,0x5D00,0x8280,0xA140,0xBC00,0xD480,0xEB00,
|
||||
0x6276,0x17D7,0x0E1E,0x0A00,0x07C1,0x0636,
|
||||
0x0010,0x001D,0x0036,0x0058,0x0082,0x00B3,0x00EB,
|
||||
0x1000,0x6000,0x8540,0xA340,0xBD80,0xD540,0xEB00,
|
||||
0x65D8,0x17AE,0x0DE1,0x09CF,0x0782,0x0600,
|
||||
0x0010,0x001D,0x0036,0x0058,0x0082,0x00B3,0x00EB,
|
||||
0x1000,0x62C0,0x87C0,0xA540,0xBF00,0xD600,0xEB00,
|
||||
0x693B,0x1785,0x0DA5,0x0986,0x0743,0x05DB,
|
||||
0x0010,0x001D,0x0036,0x0058,0x0082,0x00B3,0x00EB,
|
||||
0x1000,0x6580,0x8A40,0xA740,0xC040,0xD680,0xEB00
|
||||
};
|
||||
|
||||
VIMacroVisionObj VINtscACPType1 = {
|
||||
0x36,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x1B,
|
||||
0x1B,
|
||||
0x24,
|
||||
0x07,
|
||||
0xF8,
|
||||
0x00,
|
||||
0x00,
|
||||
0x0F,
|
||||
0x0F,
|
||||
0x60,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00
|
||||
};
|
||||
|
||||
VIMacroVisionObj VINtscACPType2 = {
|
||||
0x3E,
|
||||
0x1D,
|
||||
0x11,
|
||||
0x25,
|
||||
0x11,
|
||||
0x01,
|
||||
0x07,
|
||||
0x00,
|
||||
0x1B,
|
||||
0x1B,
|
||||
0x24,
|
||||
0x07,
|
||||
0xF8,
|
||||
0x00,
|
||||
0x00,
|
||||
0x0F,
|
||||
0x0F,
|
||||
0x60,
|
||||
0x01,
|
||||
0x0A,
|
||||
0x00,
|
||||
0x05,
|
||||
0x04,
|
||||
0x03,
|
||||
0xFF,
|
||||
0x00
|
||||
};
|
||||
|
||||
VIMacroVisionObj VINtscACPType3 = {
|
||||
0x3E,
|
||||
0x17,
|
||||
0x15,
|
||||
0x21,
|
||||
0x15,
|
||||
0x05,
|
||||
0x05,
|
||||
0x02,
|
||||
0x1B,
|
||||
0x1B,
|
||||
0x24,
|
||||
0x07,
|
||||
0xF8,
|
||||
0x00,
|
||||
0x00,
|
||||
0x0F,
|
||||
0x0F,
|
||||
0x60,
|
||||
0x01,
|
||||
0x0A,
|
||||
0x00,
|
||||
0x05,
|
||||
0x04,
|
||||
0x03,
|
||||
0xFF,
|
||||
0x00
|
||||
};
|
||||
|
||||
VIMacroVisionObj VIPalACPType1 = {
|
||||
0x36,
|
||||
0x1A,
|
||||
0x22,
|
||||
0x2A,
|
||||
0x22,
|
||||
0x05,
|
||||
0x02,
|
||||
0x00,
|
||||
0x1C,
|
||||
0x3D,
|
||||
0x14,
|
||||
0x03,
|
||||
0xFE,
|
||||
0x01,
|
||||
0x54,
|
||||
0xFE,
|
||||
0x7E,
|
||||
0x60,
|
||||
0x00,
|
||||
0x08,
|
||||
0x00,
|
||||
0x04,
|
||||
0x07,
|
||||
0x01,
|
||||
0x55,
|
||||
0x01
|
||||
};
|
||||
|
||||
VIMacroVisionObj VIPalACPType2 = {
|
||||
0x36,
|
||||
0x1A,
|
||||
0x22,
|
||||
0x2A,
|
||||
0x22,
|
||||
0x05,
|
||||
0x02,
|
||||
0x00,
|
||||
0x1C,
|
||||
0x3D,
|
||||
0x14,
|
||||
0x03,
|
||||
0xFE,
|
||||
0x01,
|
||||
0x54,
|
||||
0xFE,
|
||||
0x7E,
|
||||
0x60,
|
||||
0x00,
|
||||
0x08,
|
||||
0x00,
|
||||
0x04,
|
||||
0x07,
|
||||
0x01,
|
||||
0x55,
|
||||
0x01
|
||||
};
|
||||
|
||||
VIMacroVisionObj VIPalACPType3 = {
|
||||
0x36,
|
||||
0x1A,
|
||||
0x22,
|
||||
0x2A,
|
||||
0x22,
|
||||
0x05,
|
||||
0x02,
|
||||
0x00,
|
||||
0x1C,
|
||||
0x3D,
|
||||
0x14,
|
||||
0x03,
|
||||
0xFE,
|
||||
0x01,
|
||||
0x54,
|
||||
0xFE,
|
||||
0x7E,
|
||||
0x60,
|
||||
0x00,
|
||||
0x08,
|
||||
0x00,
|
||||
0x04,
|
||||
0x07,
|
||||
0x01,
|
||||
0x55,
|
||||
0x01
|
||||
};
|
||||
|
||||
VIMacroVisionObj VIEurgb60ACPType1 = {
|
||||
0x36,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x1B,
|
||||
0x1B,
|
||||
0x24,
|
||||
0x07,
|
||||
0xF8,
|
||||
0x00,
|
||||
0x00,
|
||||
0x1E,
|
||||
0x1E,
|
||||
0x60,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x01
|
||||
};
|
||||
|
||||
VIMacroVisionObj VIEurgb60ACPType2 = {
|
||||
0x36,
|
||||
0x1D,
|
||||
0x11,
|
||||
0x25,
|
||||
0x11,
|
||||
0x01,
|
||||
0x07,
|
||||
0x00,
|
||||
0x1B,
|
||||
0x1B,
|
||||
0x24,
|
||||
0x07,
|
||||
0xF8,
|
||||
0x00,
|
||||
0x00,
|
||||
0x1E,
|
||||
0x1E,
|
||||
0x60,
|
||||
0x01,
|
||||
0x0A,
|
||||
0x00,
|
||||
0x05,
|
||||
0x04,
|
||||
0x03,
|
||||
0xFF,
|
||||
0x01
|
||||
};
|
||||
|
||||
VIMacroVisionObj VIEurgb60ACPType3 = {
|
||||
0x36,
|
||||
0x17,
|
||||
0x15,
|
||||
0x21,
|
||||
0x15,
|
||||
0x05,
|
||||
0x05,
|
||||
0x02,
|
||||
0x1B,
|
||||
0x1B,
|
||||
0x24,
|
||||
0x07,
|
||||
0xF8,
|
||||
0x00,
|
||||
0x00,
|
||||
0x1E,
|
||||
0x1E,
|
||||
0x60,
|
||||
0x01,
|
||||
0x0A,
|
||||
0x00,
|
||||
0x05,
|
||||
0x04,
|
||||
0x03,
|
||||
0xFF,
|
||||
0x01
|
||||
};
|
||||
|
||||
VIMacroVisionObj VIMpalACPType1 = {
|
||||
0x36,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x1B,
|
||||
0x1B,
|
||||
0x24,
|
||||
0x07,
|
||||
0xF8,
|
||||
0x00,
|
||||
0x00,
|
||||
0x0F,
|
||||
0x0F,
|
||||
0x60,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00
|
||||
};
|
||||
|
||||
VIMacroVisionObj VIMpalACPType2 = {
|
||||
0x36,
|
||||
0x1D,
|
||||
0x11,
|
||||
0x25,
|
||||
0x11,
|
||||
0x01,
|
||||
0x07,
|
||||
0x00,
|
||||
0x1B,
|
||||
0x1B,
|
||||
0x24,
|
||||
0x07,
|
||||
0xF8,
|
||||
0x00,
|
||||
0x00,
|
||||
0x0F,
|
||||
0x0F,
|
||||
0x60,
|
||||
0x01,
|
||||
0x0A,
|
||||
0x00,
|
||||
0x05,
|
||||
0x04,
|
||||
0x03,
|
||||
0xFF,
|
||||
0x00
|
||||
};
|
||||
|
||||
VIMacroVisionObj VIMpalACPType3 = {
|
||||
0x36,
|
||||
0x17,
|
||||
0x15,
|
||||
0x21,
|
||||
0x15,
|
||||
0x05,
|
||||
0x05,
|
||||
0x02,
|
||||
0x1B,
|
||||
0x1B,
|
||||
0x24,
|
||||
0x07,
|
||||
0xF8,
|
||||
0x00,
|
||||
0x00,
|
||||
0x0F,
|
||||
0x0F,
|
||||
0x60,
|
||||
0x01,
|
||||
0x0A,
|
||||
0x00,
|
||||
0x05,
|
||||
0x04,
|
||||
0x03,
|
||||
0xFF,
|
||||
0x00
|
||||
};
|
||||
|
||||
VIMacroVisionObj VIProgressiveACPType = {
|
||||
0x01,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00
|
||||
};
|
||||
|
||||
VIMacroVisionObj VIZeroACPType = {
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00
|
||||
};
|
||||
|
||||
extern s32 __VISendI2CData(u8, u8 *, s32);
|
||||
extern void WaitMicroTime(s32);
|
||||
|
||||
void __VISetYUVSEL(VIBool outsel) NO_INLINE {
|
||||
u8 buffer[2];
|
||||
u32 tv;
|
||||
|
||||
tv = *(u32*)OSPhysicalToCached(0xCC);
|
||||
|
||||
switch (tv) {
|
||||
case VI_PAL:
|
||||
case VI_EURGB60:
|
||||
Vdac_Flag_Region = VI_VMODE_PAL;
|
||||
break;
|
||||
case VI_MPAL:
|
||||
Vdac_Flag_Region = VI_VMODE_MPAL;
|
||||
break;
|
||||
case VI_NTSC:
|
||||
Vdac_Flag_Region = VI_VMODE_NTSC;
|
||||
break;
|
||||
default:
|
||||
Vdac_Flag_Region = VI_VMODE_NTSC;
|
||||
break;
|
||||
}
|
||||
|
||||
buffer[0] = 0x1;
|
||||
buffer[1] = (u8)((outsel << 5) | Vdac_Flag_Region);
|
||||
__VISendI2CData((u8)0xE0, buffer, 2);
|
||||
WaitMicroTime(2);
|
||||
}
|
||||
|
||||
void __VISetTiming(VITiming timing) {
|
||||
u8 buffer[2];
|
||||
|
||||
buffer[0] = 0x0;
|
||||
buffer[1] = timing;
|
||||
__VISendI2CData((u8)0xE0, buffer, 2);
|
||||
WaitMicroTime(2);
|
||||
}
|
||||
|
||||
void __VISetFilter4EURGB60(VIBool enable) {
|
||||
u8 buffer[2];
|
||||
buffer[0] = 0x6E;
|
||||
buffer[1] = enable;
|
||||
__VISendI2CData((u8)0xE0, buffer, 2);
|
||||
WaitMicroTime(2);
|
||||
}
|
||||
|
||||
void __VISetVBICtrl(VIBool cgms, VIBool wss, VIBool cc) {
|
||||
u8 buffer[2];
|
||||
|
||||
buffer[0] = 0x2;
|
||||
buffer[1] = (u8)(((~wss & 0x1) << 2) | ((~cgms & 0x1) << 1) | (~cc & 0x1));
|
||||
__VISendI2CData((u8)0xE0, buffer, 2);
|
||||
WaitMicroTime(2);
|
||||
}
|
||||
|
||||
static u8 __wd0 = 0xFF;
|
||||
static u8 __wd1 = 0xFF;
|
||||
static u8 __wd2 = 0xFF;
|
||||
|
||||
void __VISetCGMS(void) {
|
||||
u8 buffer[3];
|
||||
buffer[0] = 5;
|
||||
buffer[1] = (u8)(((__wd1 & 0xF) << 2) | (__wd0 & 3));
|
||||
buffer[2] = __wd2;
|
||||
__VISendI2CData((u8)0xE0, buffer, 3);
|
||||
WaitMicroTime(2);
|
||||
}
|
||||
|
||||
void __VISetCGMSClear(void) {
|
||||
__wd0 = 0;
|
||||
__wd1 = 0;
|
||||
__wd2 = 0;
|
||||
__VISetCGMS();
|
||||
}
|
||||
|
||||
static u8 __gp1 = 0xFF;
|
||||
static u8 __gp2 = 0xFF;
|
||||
static u8 __gp3 = 0xFF;
|
||||
static u8 __gp4 = 0xFF;
|
||||
|
||||
void __VISetWSS(void) {
|
||||
u8 buffer[3];
|
||||
buffer[0] = 0x8;
|
||||
buffer[1] = (u8)(((__gp2 & 0xf) << 4) | (__gp1 & 0xf));
|
||||
buffer[2] = (u8)(((__gp4 & 0x7) << 3) | (__gp3 & 0x7));
|
||||
__VISendI2CData((u8)0xE0, buffer, 3);
|
||||
WaitMicroTime(2);
|
||||
}
|
||||
|
||||
void VISetWSS(u8 gp1, u8 gp2, u8 gp3, u8 gp4) {
|
||||
if ((__gp1 == gp1) && (__gp2 == gp2) && (__gp3 == gp3) && (__gp4 == gp4)) {
|
||||
return;
|
||||
}
|
||||
|
||||
__gp1 = gp1;
|
||||
__gp2 = gp2;
|
||||
__gp3 = gp3;
|
||||
__gp4 = gp4;
|
||||
|
||||
Vdac_Flag_Changed |= 2;
|
||||
}
|
||||
|
||||
static u8 __cc1 = 0xFF;
|
||||
static u8 __cc2 = 0xFF;
|
||||
static u8 __cc3 = 0xFF;
|
||||
static u8 __cc4 = 0xFF;
|
||||
|
||||
void __VISetClosedCaption(void) {
|
||||
u8 buffer[5];
|
||||
buffer[0] = 0x7A;
|
||||
buffer[1] = (u8)(__cc1 & 0x7F);
|
||||
buffer[2] = (u8)(__cc2 & 0x7F);
|
||||
buffer[3] = (u8)(__cc3 & 0x7F);
|
||||
buffer[4] = (u8)(__cc4 & 0x7F);
|
||||
__VISendI2CData((u8)0xE0, buffer, 5);
|
||||
WaitMicroTime(2);
|
||||
}
|
||||
|
||||
void VISetClosedCaption(u8 cc1, u8 cc2, u8 cc3, u8 cc4) {
|
||||
if ((__cc1 == cc1) && (__cc2 == cc2) && (__cc3 == cc3) && (__cc4 == cc4)) {
|
||||
return;
|
||||
}
|
||||
|
||||
__cc1 = cc1;
|
||||
__cc2 = cc2;
|
||||
__cc3 = cc3;
|
||||
__cc4 = cc4;
|
||||
|
||||
Vdac_Flag_Changed |= 4;
|
||||
}
|
||||
|
||||
void __VISetMacrovisionImm(VIMacroVisionObj *mparam) {
|
||||
u8 i;
|
||||
u8 buffer[27];
|
||||
|
||||
buffer[0] = 0x40;
|
||||
|
||||
for(i = 1; i < 27; i++) {
|
||||
buffer[i] = mparam->m[i - 1];
|
||||
}
|
||||
|
||||
__VISendI2CData((u8)0xE0, buffer, 27);
|
||||
WaitMicroTime(2);
|
||||
}
|
||||
|
||||
void __VISetMacrovision(void) {
|
||||
switch (__type) {
|
||||
case 2:
|
||||
switch (__tvType) {
|
||||
case VI_NTSC:
|
||||
__VISetMacrovisionImm(&VINtscACPType1);
|
||||
break;
|
||||
case VI_PAL:
|
||||
__VISetMacrovisionImm(&VIPalACPType1);
|
||||
break;
|
||||
case VI_MPAL:
|
||||
__VISetMacrovisionImm(&VIMpalACPType1);
|
||||
break;
|
||||
case VI_EURGB60:
|
||||
__VISetMacrovisionImm(&VIEurgb60ACPType1);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
switch (__tvType) {
|
||||
case VI_NTSC:
|
||||
__VISetMacrovisionImm(&VINtscACPType2);
|
||||
break;
|
||||
case VI_PAL:
|
||||
__VISetMacrovisionImm(&VIPalACPType2);
|
||||
break;
|
||||
case VI_MPAL:
|
||||
__VISetMacrovisionImm(&VIMpalACPType2);
|
||||
break;
|
||||
case VI_EURGB60:
|
||||
__VISetMacrovisionImm(&VIEurgb60ACPType2);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 4:
|
||||
switch (__tvType) {
|
||||
case VI_NTSC:
|
||||
__VISetMacrovisionImm(&VINtscACPType3);
|
||||
break;
|
||||
case VI_PAL:
|
||||
__VISetMacrovisionImm(&VIPalACPType3);
|
||||
break;
|
||||
case VI_MPAL:
|
||||
__VISetMacrovisionImm(&VIMpalACPType3);
|
||||
break;
|
||||
case VI_EURGB60:
|
||||
__VISetMacrovisionImm(&VIEurgb60ACPType3);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
__VISetMacrovisionImm(&VIZeroACPType);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void __VISetGammaImm(VIGammaObj *gamma) {
|
||||
u8 i, j;
|
||||
u8 buffer[34];
|
||||
|
||||
buffer[0] = 0x10;
|
||||
i = 1;
|
||||
for (j = 0; j < 6; j++) {
|
||||
buffer[i] = (u8)((gamma->a[j] >> 8) & 0xFF);
|
||||
buffer[i + 1] = (u8)(gamma->a[j] & 0xFF);
|
||||
i += 2;
|
||||
}
|
||||
|
||||
for (j = 0; j < 7; j++) {
|
||||
buffer[i] = gamma->yin[j];
|
||||
i++;
|
||||
}
|
||||
|
||||
for (j = 0; j < 7; j++) {
|
||||
buffer[i] = (u8)((gamma->yout[j] >> 8) & 0xFF);
|
||||
buffer[i + 1] = (u8)(gamma->yout[j] & 0xC0);
|
||||
i += 2;
|
||||
}
|
||||
|
||||
__VISendI2CData((u8)0xE0, buffer, 34);
|
||||
WaitMicroTime(2);
|
||||
}
|
||||
|
||||
static VIGamma __gamma;
|
||||
void __VISetGamma(void) {
|
||||
__VISetGammaImm(&gammaSet[__gamma]);
|
||||
}
|
||||
|
||||
static VIBool __filter = 0xFF;
|
||||
|
||||
void __VISetTrapFilter(void) {
|
||||
u8 buffer[2];
|
||||
|
||||
buffer[0] = 0x3;
|
||||
|
||||
if (__filter == VI_TRUE) {
|
||||
buffer[1] = VI_FALSE;
|
||||
}
|
||||
else {
|
||||
buffer[1] = VI_TRUE;
|
||||
}
|
||||
|
||||
__VISendI2CData((u8)0xE0, buffer, 2);
|
||||
WaitMicroTime(2);
|
||||
}
|
||||
|
||||
void __VISetTrapFilterImm(VIBool filter) {
|
||||
u8 buffer[2];
|
||||
buffer[0] = 0x3;
|
||||
|
||||
if (filter == VI_TRUE) {
|
||||
buffer[1] = VI_FALSE;
|
||||
}
|
||||
else {
|
||||
buffer[1] = VI_TRUE;
|
||||
}
|
||||
__VISendI2CData((u8)0xE0, buffer, 2);
|
||||
WaitMicroTime(2);
|
||||
}
|
||||
|
||||
void VISetTrapFilter(VIBool filter) {
|
||||
if (__filter == filter) {
|
||||
return;
|
||||
}
|
||||
|
||||
__filter = filter;
|
||||
Vdac_Flag_Changed |= 0x20;
|
||||
}
|
||||
|
||||
static VIOverDrive __level;
|
||||
|
||||
void __VISetRGBOverDrive(void) {
|
||||
u8 buffer[2];
|
||||
|
||||
if (Vdac_Flag_Region == VI_VMODE_RGB) {
|
||||
buffer[0] = 0xA;
|
||||
buffer[1] = (u8)((__level << 1) | VI_ENABLE);
|
||||
__VISendI2CData((u8)0xE0, buffer, 2);
|
||||
WaitMicroTime(2);
|
||||
}
|
||||
else {
|
||||
buffer[0] = 0xA;
|
||||
buffer[1] = VI_DISABLE;
|
||||
__VISendI2CData((u8)0xE0, buffer, 2);
|
||||
WaitMicroTime(2);
|
||||
}
|
||||
}
|
||||
|
||||
void VISetRGBOverDrive(VIOverDrive level) {
|
||||
if (__level == level) {
|
||||
return;
|
||||
}
|
||||
__level = level;
|
||||
Vdac_Flag_Changed |= 0x40;
|
||||
}
|
||||
|
||||
void VISetRGBModeImm( void ) {
|
||||
Vdac_Flag_Changed |= 0x80;
|
||||
}
|
||||
|
||||
static void __VISetVideoMode(VIVideo vmode, VIBool outsel) {
|
||||
u8 buffer[2];
|
||||
Vdac_Flag_Region = vmode;
|
||||
@ -15,6 +823,54 @@ static void __VISetVideoMode(VIVideo vmode, VIBool outsel) {
|
||||
WaitMicroTime(2);
|
||||
}
|
||||
|
||||
static void __VISetCCSEL(VIBool ccsel) {
|
||||
u8 buffer[2];
|
||||
|
||||
buffer[0] = 0x6A;
|
||||
buffer[1] = VI_ENABLE;
|
||||
__VISendI2CData((u8)0xE0, buffer, 2);
|
||||
WaitMicroTime(2);
|
||||
}
|
||||
|
||||
static void __VISetOverSampling(VIBool os) {
|
||||
u8 buffer[2];
|
||||
buffer[0] = 0x65;
|
||||
buffer[1] = VI_ENABLE;
|
||||
__VISendI2CData((u8)0xE0, buffer, 2);
|
||||
WaitMicroTime(2);
|
||||
}
|
||||
|
||||
void __VISetVolume(u8 volumeL, u8 volumeR) {
|
||||
u8 buffer[3];
|
||||
buffer[0] = 0x71;
|
||||
buffer[1] = volumeL;
|
||||
buffer[2] = volumeR;
|
||||
__VISendI2CData((u8)0xE0, buffer, 3);
|
||||
WaitMicroTime(2);
|
||||
}
|
||||
|
||||
void __VISetRGBModeImm(void) {
|
||||
__VISetVideoMode(VI_VMODE_RGB, VI_DISABLE);
|
||||
}
|
||||
|
||||
void __VISetRevolutionModeSimple(void) {
|
||||
u32 dtv;
|
||||
|
||||
__VISetCCSEL(VI_TRUE);
|
||||
__VISetOverSampling(VI_TRUE);
|
||||
dtv = VIGetDTVStatus();
|
||||
__VISetYUVSEL((VIBool)dtv);
|
||||
__VISetTiming(VI_TMG_GAME);
|
||||
__VISetVolume(0x8E, 0x8E);
|
||||
__VISetVBICtrl(VI_DISABLE, VI_DISABLE, VI_DISABLE);
|
||||
__VISetCGMSClear();
|
||||
VISetWSS(0, 0, 0, 0);
|
||||
__VISetWSS();
|
||||
VISetClosedCaption(0, 0, 0, 0);
|
||||
__VISetClosedCaption();
|
||||
__VISetMacrovisionImm(&VIZeroACPType);
|
||||
VISetRGBOverDrive(VI_ODV_L1);
|
||||
__VISetRGBOverDrive();
|
||||
__VISetTrapFilterImm(VI_DISABLE);
|
||||
__VISetGammaImm(&gammaSet[VI_GM_1_0]);
|
||||
}
|
Loading…
Reference in New Issue
Block a user