Imported dolphin/demo except for one function
This commit is contained in:
parent
ae3ebb8331
commit
36a05264a5
11 changed files with 1866 additions and 0 deletions
72
include/dolphin/demo.h
Normal file
72
include/dolphin/demo.h
Normal file
|
|
@ -0,0 +1,72 @@
|
|||
#ifndef _DOLPHIN_DEMO
|
||||
#define _DOLPHIN_DEMO
|
||||
|
||||
#include <dolphin/pad.h>
|
||||
#include <dolphin/gx.h>
|
||||
|
||||
struct STRUCT_MENU_ITEM {
|
||||
/* 0x00 */ char * name;
|
||||
/* 0x04 */ unsigned long flags;
|
||||
/* 0x08 */ void (* function)(struct STRUCT_MENU *, unsigned long, unsigned long *);
|
||||
/* 0x0C */ struct STRUCT_MENU * link;
|
||||
};
|
||||
|
||||
struct STRUCT_MENU {
|
||||
/* 0x00 */ char * title;
|
||||
/* 0x04 */ struct STRUCT_DEMOWIN * handle;
|
||||
/* 0x08 */ struct STRUCT_MENU_ITEM * items;
|
||||
/* 0x0C */ long max_display_items;
|
||||
/* 0x10 */ unsigned long flags;
|
||||
/* 0x14 */ void (* cb_open)(struct STRUCT_MENU *, unsigned long);
|
||||
/* 0x18 */ void (* cb_move)(struct STRUCT_MENU *, unsigned long);
|
||||
/* 0x1C */ void (* cb_select)(struct STRUCT_MENU *, unsigned long);
|
||||
/* 0x20 */ void (* cb_cancel)(struct STRUCT_MENU *, unsigned long);
|
||||
/* 0x24 */ long num_display_items;
|
||||
/* 0x28 */ long num_items;
|
||||
/* 0x2C */ unsigned long max_str_len;
|
||||
/* 0x30 */ long curr_pos;
|
||||
/* 0x34 */ long display_pos;
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
/* 0x00 */ struct PADStatus pads[4];
|
||||
/* 0x30 */ unsigned long button[4];
|
||||
/* 0x40 */ unsigned long old_button[4];
|
||||
/* 0x50 */ unsigned long changed_button[4];
|
||||
/* 0x60 */ unsigned long repeat_button[4];
|
||||
/* 0x70 */ unsigned long repeat_ctr[4];
|
||||
} DEMOWinPadInfo;
|
||||
|
||||
struct STRUCT_LISTBOX_ITEM {
|
||||
/* 0x00 */ char * name; // offset 0x0, size 0x4
|
||||
/* 0x04 */ unsigned long flags; // offset 0x4, size 0x4
|
||||
};
|
||||
|
||||
struct STRUCT_LISTBOX {
|
||||
/* 0x00 */ char * title; // offset 0x0, size 0x4
|
||||
/* 0x04 */ struct STRUCT_DEMOWIN * handle; // offset 0x4, size 0x4
|
||||
/* 0x08 */ struct STRUCT_LISTBOX_ITEM * items; // offset 0x8, size 0x4
|
||||
/* 0x0C */ long max_display_items; // offset 0xC, size 0x4
|
||||
/* 0x10 */ unsigned long flags; // offset 0x10, size 0x4
|
||||
/* 0x14 */ long num_display_items; // offset 0x14, size 0x4
|
||||
/* 0x18 */ long num_items; // offset 0x18, size 0x4
|
||||
/* 0x1C */ unsigned long max_str_len; // offset 0x1C, size 0x4
|
||||
/* 0x20 */ long curr_pos; // offset 0x20, size 0x4
|
||||
/* 0x24 */ long display_pos; // offset 0x24, size 0x4
|
||||
/* 0x28 */ int cursor_state; // offset 0x28, size 0x4
|
||||
};
|
||||
|
||||
extern unsigned long DEMOFontBitmap[768];
|
||||
|
||||
#include <dolphin/demo/DEMOInit.h>
|
||||
#include <dolphin/demo/DEMOPad.h>
|
||||
#include <dolphin/demo/DEMOPuts.h>
|
||||
#include <dolphin/demo/DEMOStats.h>
|
||||
#include <dolphin/demo/DEMOWin.h>
|
||||
|
||||
// unsorted externs
|
||||
extern void DEMOPrintf(s16 x, s16 y, s16 priority, char *str, ...);
|
||||
|
||||
extern struct _GXRenderModeObj *DEMOGetRenderModeObj();
|
||||
|
||||
#endif
|
||||
21
include/dolphin/demo/DEMOInit.h
Normal file
21
include/dolphin/demo/DEMOInit.h
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
#ifndef _DOLPHIN_DEMOINIT
|
||||
#define _DOLPHIN_DEMOINIT
|
||||
|
||||
#include <dolphin/gx.h>
|
||||
|
||||
extern void *DemoFrameBuffer1;
|
||||
extern void *DemoFrameBuffer2;
|
||||
extern void *DemoCurrentBuffer;
|
||||
|
||||
void DEMOInit(struct _GXRenderModeObj *mode);
|
||||
void DEMOBeforeRender();
|
||||
void DEMODoneRender();
|
||||
void DEMOSwapBuffers();
|
||||
void DEMOSetTevColorIn(enum _GXTevStageID stage, enum _GXTevColorArg a, enum _GXTevColorArg b, enum _GXTevColorArg c, enum _GXTevColorArg d);
|
||||
void DEMOSetTevOp(enum _GXTevStageID id, enum _GXTevMode mode);
|
||||
struct _GXRenderModeObj *DEMOGetRenderModeObj();
|
||||
u32 DEMOGetCurrentBuffer(void);
|
||||
void DEMOEnableBypassWorkaround(unsigned long timeoutFrames);
|
||||
void DEMOReInit(struct _GXRenderModeObj *mode);
|
||||
|
||||
#endif
|
||||
26
include/dolphin/demo/DEMOPad.h
Normal file
26
include/dolphin/demo/DEMOPad.h
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
#ifndef _DOLPHIN_DEMOPAD
|
||||
#define _DOLPHIN_DEMOPAD
|
||||
|
||||
#include <dolphin/pad.h>
|
||||
|
||||
typedef struct {
|
||||
/* 0x00 */ struct PADStatus pst;
|
||||
/* 0x0C */ u16 buttonDown;
|
||||
/* 0x0E */ u16 buttonUp;
|
||||
/* 0x10 */ u16 dirs;
|
||||
/* 0x12 */ u16 dirsNew;
|
||||
/* 0x14 */ u16 dirsReleased;
|
||||
/* 0x16 */ s16 stickDeltaX;
|
||||
/* 0x18 */ s16 stickDeltaY;
|
||||
/* 0x1A */ s16 substickDeltaX;
|
||||
/* 0x1C */ s16 substickDeltaY;
|
||||
} DEMODMPad;
|
||||
|
||||
extern DEMODMPad DemoPad[4];
|
||||
|
||||
extern u32 DemoNumValidPads;
|
||||
|
||||
void DEMOPadRead();
|
||||
void DEMOPadInit();
|
||||
|
||||
#endif
|
||||
27
include/dolphin/demo/DEMOPuts.h
Normal file
27
include/dolphin/demo/DEMOPuts.h
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
#ifndef _DOLPHIN_DEMOPUTS
|
||||
#define _DOLPHIN_DEMOPUTS
|
||||
|
||||
#include <dolphin/gx.h>
|
||||
|
||||
typedef enum {
|
||||
DMTF_POINTSAMPLE,
|
||||
DMTF_BILERP,
|
||||
} DMTexFlt;
|
||||
|
||||
typedef enum { DM_FT_OPQ, DM_FT_RVS, DM_FT_XLU } DMFontType;
|
||||
|
||||
void DEMOSetFontType(DMFontType attr);
|
||||
void DEMOLoadFont(enum _GXTexMapID texMap, enum _GXTexMtx texMtx, DMTexFlt texFlt);
|
||||
void DEMOSetupScrnSpc(long width, long height, float depth);
|
||||
void DEMOInitCaption(long font_type, long width, long height);
|
||||
void DEMOPuts(s16 x, s16 y, s16 z, char *string);
|
||||
void DEMOPrintf(s16 x, s16 y, s16 z, char *fmt, ...);
|
||||
struct OSFontHeader *DEMOInitROMFont();
|
||||
void DEMOSetROMFontSize(s16 size, s16 space);
|
||||
int DEMORFPuts(s16 x, s16 y, s16 z, char *string);
|
||||
int DEMORFPutsEx(s16 x, s16 y, s16 z, char *string, s16 maxWidth, int length);
|
||||
int DEMORFPrintf(s16 x, s16 y, s16 z, char *fmt, ...);
|
||||
char *DEMODumpROMFont(char *string);
|
||||
int DEMOGetRFTextWidth(char *string);
|
||||
|
||||
#endif
|
||||
38
include/dolphin/demo/DEMOStats.h
Normal file
38
include/dolphin/demo/DEMOStats.h
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
#ifndef _DOLPHIN_DEMOSTATS
|
||||
#define _DOLPHIN_DEMOSTATS
|
||||
|
||||
typedef enum DEMO_STAT_TYPE {
|
||||
DEMO_STAT_GP0 = 0,
|
||||
DEMO_STAT_GP1 = 1,
|
||||
DEMO_STAT_MEM = 2,
|
||||
DEMO_STAT_PIX = 3,
|
||||
DEMO_STAT_VC = 4,
|
||||
DEMO_STAT_FR = 5,
|
||||
DEMO_STAT_TBW = 6,
|
||||
DEMO_STAT_TBP = 7,
|
||||
DEMO_STAT_MYC = 8,
|
||||
DEMO_STAT_MYR = 9,
|
||||
} DEMO_STAT_TYPE;
|
||||
|
||||
typedef struct DemoStatData {
|
||||
char text[50];
|
||||
DEMO_STAT_TYPE stat_type;
|
||||
unsigned long stat;
|
||||
unsigned long count;
|
||||
} DemoStatData;
|
||||
|
||||
typedef enum {
|
||||
DEMO_STAT_TL = 0,
|
||||
DEMO_STAT_BL = 1,
|
||||
DEMO_STAT_TLD = 2,
|
||||
DEMO_STAT_BLD = 3,
|
||||
DEMO_STAT_IO = 4,
|
||||
} DEMO_STAT_DISP;
|
||||
|
||||
extern unsigned char DemoStatEnable;
|
||||
|
||||
void DEMOSetStats(DemoStatData * stat, unsigned long nstats, DEMO_STAT_DISP disp);
|
||||
void DEMOUpdateStats(unsigned char inc);
|
||||
void DEMOPrintStats(void);
|
||||
|
||||
#endif
|
||||
77
include/dolphin/demo/DEMOWin.h
Normal file
77
include/dolphin/demo/DEMOWin.h
Normal file
|
|
@ -0,0 +1,77 @@
|
|||
#ifndef _DOLPHIN_DEMOWIN
|
||||
#define _DOLPHIN_DEMOWIN
|
||||
|
||||
#include <dolphin/demo.h>
|
||||
#include <dolphin/gx.h>
|
||||
|
||||
enum DEMOWinItem {
|
||||
DEMOWIN_ITEM_CAP,
|
||||
DEMOWIN_ITEM_BKGND,
|
||||
DEMOWIN_ITEM_BORDER,
|
||||
DEMOWIN_ITEM_DEFAULT
|
||||
};
|
||||
|
||||
// flags
|
||||
#define DEMOWIN_FLAGS_INIT (1 << 0)
|
||||
#define DEMOWIN_FLAGS_OPENED (1 << 1)
|
||||
|
||||
struct STRUCT_DEMOWIN {
|
||||
/* 0x00 */ long x1;
|
||||
/* 0x04 */ long y1;
|
||||
/* 0x08 */ long x2;
|
||||
/* 0x0C */ long y2;
|
||||
/* 0x10 */ unsigned long priority;
|
||||
/* 0x14 */ unsigned long flags;
|
||||
/* 0x18 */ unsigned short x_cal;
|
||||
/* 0x1A */ unsigned short y_cal;
|
||||
/* 0x1C */ unsigned short pixel_width;
|
||||
/* 0x1E */ unsigned short pixel_height;
|
||||
/* 0x20 */ unsigned short char_width;
|
||||
/* 0x22 */ unsigned short char_height;
|
||||
/* 0x24 */ unsigned short num_scroll_lines;
|
||||
/* 0x26 */ unsigned short total_lines;
|
||||
/* 0x28 */ unsigned short curr_output_line;
|
||||
/* 0x2A */ unsigned short curr_output_col;
|
||||
/* 0x2C */ unsigned short curr_view_line;
|
||||
/* 0x2E */ signed short cursor_line;
|
||||
/* 0x30 */ char * caption;
|
||||
/* 0x34 */ unsigned char * buffer;
|
||||
/* 0x38 */ GXColor bkgnd;
|
||||
/* 0x3C */ GXColor cap;
|
||||
/* 0x40 */ GXColor border;
|
||||
/* 0x44 */ void (* refresh)(struct STRUCT_DEMOWIN *);
|
||||
/* 0x48 */ struct STRUCT_DEMOWIN * next;
|
||||
/* 0x4C */ struct STRUCT_DEMOWIN * prev;
|
||||
/* 0x50 */ void * parent;
|
||||
};
|
||||
|
||||
// functions
|
||||
void DEMOWinInit();
|
||||
struct STRUCT_DEMOWIN * DEMOWinCreateWindow(s32 x1, s32 y1, s32 x2, s32 y2, char * caption, u16 scroll, void * func);
|
||||
void DEMOWinDestroyWindow(struct STRUCT_DEMOWIN * handle);
|
||||
void DEMOWinOpenWindow(struct STRUCT_DEMOWIN * handle);
|
||||
void DEMOWinCloseWindow(struct STRUCT_DEMOWIN * handle);
|
||||
void DEMOWinSetWindowColor(struct STRUCT_DEMOWIN * handle, enum DEMOWinItem item, u8 r, u8 g, u8 b, u8 a);
|
||||
void DEMOWinLogPrintf(struct STRUCT_DEMOWIN * handle, char * fmt, ...);
|
||||
void DEMOWinPrintfXY(struct STRUCT_DEMOWIN * handle, u16 col, u16 row, char * fmt, ...);
|
||||
void DEMOWinScrollWindow(struct STRUCT_DEMOWIN * handle, u32 dir);
|
||||
void DEMOWinBringToFront(struct STRUCT_DEMOWIN * handle);
|
||||
void DEMOWinSendToBack(struct STRUCT_DEMOWIN * handle);
|
||||
void DEMOWinClearRow(struct STRUCT_DEMOWIN * handle, u16 row);
|
||||
void DEMOWinClearWindow(struct STRUCT_DEMOWIN * handle);
|
||||
void DEMOWinClearBuffer(struct STRUCT_DEMOWIN * handle);
|
||||
void DEMOWinRefresh();
|
||||
struct STRUCT_MENU * DEMOWinCreateMenuWindow(struct STRUCT_MENU * menu, u16 x, u16 y);
|
||||
void DEMOWinDestroyMenuWindow(struct STRUCT_MENU * menu);
|
||||
u32 DEMOWinMenuChild(struct STRUCT_MENU * menu, int child_flag);
|
||||
void DEMOWinPadInit(DEMOWinPadInfo *p);
|
||||
void DEMOWinPadRead(DEMOWinPadInfo *p);
|
||||
void DEMOWinSetRepeat(unsigned long threshold, unsigned long rate);
|
||||
void DEMOWinResetRepeat();
|
||||
struct STRUCT_LISTBOX * DEMOWinCreateListWindow(struct STRUCT_LISTBOX * list, unsigned short x, unsigned short y);
|
||||
void DEMOWinDestroyListWindow(struct STRUCT_LISTBOX * list);
|
||||
void DEMOWinListSetCursor(struct STRUCT_LISTBOX * list, int x);
|
||||
long DEMOWinListScrollList(struct STRUCT_LISTBOX * list, unsigned long dir);
|
||||
long DEMOWinListMoveCursor(struct STRUCT_LISTBOX * list, unsigned long dir);
|
||||
|
||||
#endif
|
||||
11
include/dolphin/demotypes.h
Normal file
11
include/dolphin/demotypes.h
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
#ifndef _DOLPHIN_DEMOTYPES
|
||||
#define _DOLPHIN_DEMOTYPES
|
||||
|
||||
#include <dolphin/demo.h>
|
||||
|
||||
extern struct STRUCT_DEMOWIN * __first_node;
|
||||
extern struct STRUCT_DEMOWIN * __last_node;
|
||||
extern struct STRUCT_DEMOWIN * __curr_node;
|
||||
extern struct _GXRenderModeObj * __rmp;
|
||||
|
||||
#endif
|
||||
773
src/dolphin/demo/DEMOFont.c
Normal file
773
src/dolphin/demo/DEMOFont.c
Normal file
|
|
@ -0,0 +1,773 @@
|
|||
#include <dolphin.h>
|
||||
#include <dolphin/demo.h>
|
||||
|
||||
unsigned long DEMOFontBitmap[768] ATTRIBUTE_ALIGN(32) = {
|
||||
0x00000000,
|
||||
0x00000000,
|
||||
0x00000000,
|
||||
0x00000000,
|
||||
0x00000000,
|
||||
0x00000000,
|
||||
0x00000000,
|
||||
0x00000000,
|
||||
0x00000000,
|
||||
0x000FF000,
|
||||
0x000FF000,
|
||||
0x000FF000,
|
||||
0x000FF000,
|
||||
0x000FF000,
|
||||
0x00000000,
|
||||
0x000FF000,
|
||||
0x00000000,
|
||||
0x00F00F00,
|
||||
0x00F00F00,
|
||||
0x00000000,
|
||||
0x00000000,
|
||||
0x00000000,
|
||||
0x00000000,
|
||||
0x00000000,
|
||||
0x00000000,
|
||||
0x00F00F00,
|
||||
0x00F00F00,
|
||||
0x0FFFFFF0,
|
||||
0x00F00F00,
|
||||
0x0FFFFFF0,
|
||||
0x00F00F00,
|
||||
0x00F00F00,
|
||||
0x00000000,
|
||||
0x0000F000,
|
||||
0x00FFFFF0,
|
||||
0x0F00F000,
|
||||
0x00FFFF00,
|
||||
0x0000F0F0,
|
||||
0x0FFFFF00,
|
||||
0x0000F000,
|
||||
0x00000000,
|
||||
0x0FF000F0,
|
||||
0x0FF00F00,
|
||||
0x0000F000,
|
||||
0x000F0000,
|
||||
0x00F00FF0,
|
||||
0x0F000FF0,
|
||||
0x00000000,
|
||||
0x00000000,
|
||||
0x000F0000,
|
||||
0x00F0F000,
|
||||
0x00F0F000,
|
||||
0x00FF0000,
|
||||
0x0F000FF0,
|
||||
0x0F0000F0,
|
||||
0x00FFFF00,
|
||||
0x00000000,
|
||||
0x000FF000,
|
||||
0x000FF000,
|
||||
0x0000F000,
|
||||
0x000F0000,
|
||||
0x00000000,
|
||||
0x00000000,
|
||||
0x00000000,
|
||||
0x00000000,
|
||||
0x0000F000,
|
||||
0x000F0000,
|
||||
0x00F00000,
|
||||
0x00F00000,
|
||||
0x00F00000,
|
||||
0x000F0000,
|
||||
0x0000F000,
|
||||
0x00000000,
|
||||
0x000F0000,
|
||||
0x0000F000,
|
||||
0x00000F00,
|
||||
0x00000F00,
|
||||
0x00000F00,
|
||||
0x0000F000,
|
||||
0x000F0000,
|
||||
0x00000000,
|
||||
0x00000000,
|
||||
0x00F000F0,
|
||||
0x000F0F00,
|
||||
0x00FFFFF0,
|
||||
0x000F0F00,
|
||||
0x00F000F0,
|
||||
0x00000000,
|
||||
0x00000000,
|
||||
0x00000000,
|
||||
0x0000F000,
|
||||
0x0000F000,
|
||||
0x00FFFFF0,
|
||||
0x0000F000,
|
||||
0x0000F000,
|
||||
0x00000000,
|
||||
0x00000000,
|
||||
0x00000000,
|
||||
0x00000000,
|
||||
0x00000000,
|
||||
0x000FF000,
|
||||
0x000FF000,
|
||||
0x0000F000,
|
||||
0x000F0000,
|
||||
0x00000000,
|
||||
0x00000000,
|
||||
0x00000000,
|
||||
0x00000000,
|
||||
0x00FFFFF0,
|
||||
0x00000000,
|
||||
0x00000000,
|
||||
0x00000000,
|
||||
0x00000000,
|
||||
0x00000000,
|
||||
0x00000000,
|
||||
0x00000000,
|
||||
0x00000000,
|
||||
0x00000000,
|
||||
0x000FF000,
|
||||
0x000FF000,
|
||||
0x00000000,
|
||||
0x000000F0,
|
||||
0x00000F00,
|
||||
0x0000F000,
|
||||
0x000F0000,
|
||||
0x00F00000,
|
||||
0x0F000000,
|
||||
0x00000000,
|
||||
0x00000000,
|
||||
0x000FF000,
|
||||
0x00F00F00,
|
||||
0x0F0000F0,
|
||||
0x0F0000F0,
|
||||
0x0F0000F0,
|
||||
0x00F00F00,
|
||||
0x000FF000,
|
||||
0x00000000,
|
||||
0x0000F000,
|
||||
0x000FF000,
|
||||
0x0000F000,
|
||||
0x0000F000,
|
||||
0x0000F000,
|
||||
0x0000F000,
|
||||
0x000FFF00,
|
||||
0x00000000,
|
||||
0x00FFFF00,
|
||||
0x0F0000F0,
|
||||
0x000000F0,
|
||||
0x00000F00,
|
||||
0x0000F000,
|
||||
0x000F0000,
|
||||
0x0FFFFFF0,
|
||||
0x00000000,
|
||||
0x00FFFF00,
|
||||
0x0F0000F0,
|
||||
0x000000F0,
|
||||
0x0000FF00,
|
||||
0x000000F0,
|
||||
0x0F0000F0,
|
||||
0x00FFFF00,
|
||||
0x00000000,
|
||||
0x00000F00,
|
||||
0x0000FF00,
|
||||
0x000F0F00,
|
||||
0x00F00F00,
|
||||
0x0FFFFFF0,
|
||||
0x00000F00,
|
||||
0x00000F00,
|
||||
0x00000000,
|
||||
0x0FFFFFF0,
|
||||
0x0F000000,
|
||||
0x0F000000,
|
||||
0x0FFFFF00,
|
||||
0x000000F0,
|
||||
0x0F0000F0,
|
||||
0x00FFFF00,
|
||||
0x00000000,
|
||||
0x000FFF00,
|
||||
0x00F00000,
|
||||
0x0F000000,
|
||||
0x0FFFFF00,
|
||||
0x0F0000F0,
|
||||
0x0F0000F0,
|
||||
0x00FFFF00,
|
||||
0x00000000,
|
||||
0x0FFFFFF0,
|
||||
0x0F0000F0,
|
||||
0x00000F00,
|
||||
0x0000F000,
|
||||
0x0000F000,
|
||||
0x0000F000,
|
||||
0x0000F000,
|
||||
0x00000000,
|
||||
0x00FFFF00,
|
||||
0x0F0000F0,
|
||||
0x0F0000F0,
|
||||
0x00FFFF00,
|
||||
0x0F0000F0,
|
||||
0x0F0000F0,
|
||||
0x00FFFF00,
|
||||
0x00000000,
|
||||
0x00FFFF00,
|
||||
0x0F0000F0,
|
||||
0x0F0000F0,
|
||||
0x00FFFFF0,
|
||||
0x000000F0,
|
||||
0x000000F0,
|
||||
0x00FFFF00,
|
||||
0x00000000,
|
||||
0x00000000,
|
||||
0x000FF000,
|
||||
0x000FF000,
|
||||
0x00000000,
|
||||
0x000FF000,
|
||||
0x000FF000,
|
||||
0x00000000,
|
||||
0x00000000,
|
||||
0x000FF000,
|
||||
0x000FF000,
|
||||
0x00000000,
|
||||
0x000FF000,
|
||||
0x000FF000,
|
||||
0x0000F000,
|
||||
0x000F0000,
|
||||
0x00000000,
|
||||
0x00000F00,
|
||||
0x0000F000,
|
||||
0x000F0000,
|
||||
0x00F00000,
|
||||
0x000F0000,
|
||||
0x0000F000,
|
||||
0x00000F00,
|
||||
0x00000000,
|
||||
0x00000000,
|
||||
0x00000000,
|
||||
0x0FFFFFF0,
|
||||
0x00000000,
|
||||
0x0FFFFFF0,
|
||||
0x00000000,
|
||||
0x00000000,
|
||||
0x00000000,
|
||||
0x00F00000,
|
||||
0x000F0000,
|
||||
0x0000F000,
|
||||
0x00000F00,
|
||||
0x0000F000,
|
||||
0x000F0000,
|
||||
0x00F00000,
|
||||
0x00000000,
|
||||
0x00FFFF00,
|
||||
0x0F0000F0,
|
||||
0x0F0000F0,
|
||||
0x0000FF00,
|
||||
0x000FF000,
|
||||
0x00000000,
|
||||
0x000FF000,
|
||||
0x00000000,
|
||||
0x00FFFF00,
|
||||
0x0F0000F0,
|
||||
0x0F000FF0,
|
||||
0x0F00F0F0,
|
||||
0x0F00FFF0,
|
||||
0x0F000000,
|
||||
0x00FFFFF0,
|
||||
0x00000000,
|
||||
0x000FF000,
|
||||
0x00F00F00,
|
||||
0x0F0000F0,
|
||||
0x0F0000F0,
|
||||
0x0FFFFFF0,
|
||||
0x0F0000F0,
|
||||
0x0F0000F0,
|
||||
0x00000000,
|
||||
0x0FFFFF00,
|
||||
0x0F0000F0,
|
||||
0x0F0000F0,
|
||||
0x0FFFFF00,
|
||||
0x0F0000F0,
|
||||
0x0F0000F0,
|
||||
0x0FFFFF00,
|
||||
0x00000000,
|
||||
0x000FFF00,
|
||||
0x00F000F0,
|
||||
0x0F000000,
|
||||
0x0F000000,
|
||||
0x0F000000,
|
||||
0x00F000F0,
|
||||
0x000FFF00,
|
||||
0x00000000,
|
||||
0x0FFFF000,
|
||||
0x0F000F00,
|
||||
0x0F0000F0,
|
||||
0x0F0000F0,
|
||||
0x0F0000F0,
|
||||
0x0F000F00,
|
||||
0x0FFFF000,
|
||||
0x00000000,
|
||||
0x0FFFFFF0,
|
||||
0x0F000000,
|
||||
0x0F000000,
|
||||
0x0FFFFF00,
|
||||
0x0F000000,
|
||||
0x0F000000,
|
||||
0x0FFFFFF0,
|
||||
0x00000000,
|
||||
0x0FFFFFF0,
|
||||
0x0F000000,
|
||||
0x0F000000,
|
||||
0x0FFFFF00,
|
||||
0x0F000000,
|
||||
0x0F000000,
|
||||
0x0F000000,
|
||||
0x00000000,
|
||||
0x000FFF00,
|
||||
0x00F00000,
|
||||
0x0F000000,
|
||||
0x0F00FFF0,
|
||||
0x0F0000F0,
|
||||
0x00F000F0,
|
||||
0x000FFF00,
|
||||
0x00000000,
|
||||
0x0F0000F0,
|
||||
0x0F0000F0,
|
||||
0x0F0000F0,
|
||||
0x0FFFFFF0,
|
||||
0x0F0000F0,
|
||||
0x0F0000F0,
|
||||
0x0F0000F0,
|
||||
0x00000000,
|
||||
0x000FFF00,
|
||||
0x0000F000,
|
||||
0x0000F000,
|
||||
0x0000F000,
|
||||
0x0000F000,
|
||||
0x0000F000,
|
||||
0x000FFF00,
|
||||
0x00000000,
|
||||
0x0000FFF0,
|
||||
0x00000F00,
|
||||
0x00000F00,
|
||||
0x00000F00,
|
||||
0x00000F00,
|
||||
0x0F000F00,
|
||||
0x00FFF000,
|
||||
0x00000000,
|
||||
0x0F0000F0,
|
||||
0x0F000F00,
|
||||
0x0F00F000,
|
||||
0x0FFF0000,
|
||||
0x0F00F000,
|
||||
0x0F000F00,
|
||||
0x0F0000F0,
|
||||
0x00000000,
|
||||
0x0F000000,
|
||||
0x0F000000,
|
||||
0x0F000000,
|
||||
0x0F000000,
|
||||
0x0F000000,
|
||||
0x0F000000,
|
||||
0x0FFFFFF0,
|
||||
0x00000000,
|
||||
0x0F00000F,
|
||||
0x0FF000FF,
|
||||
0x0F0F0F0F,
|
||||
0x0F00F00F,
|
||||
0x0F00F00F,
|
||||
0x0F00000F,
|
||||
0x0F00000F,
|
||||
0x00000000,
|
||||
0x0F0000F0,
|
||||
0x0FF000F0,
|
||||
0x0F0F00F0,
|
||||
0x0F00F0F0,
|
||||
0x0F00F0F0,
|
||||
0x0F000FF0,
|
||||
0x0F0000F0,
|
||||
0x00000000,
|
||||
0x00FFFF00,
|
||||
0x0F0000F0,
|
||||
0x0F0000F0,
|
||||
0x0F0000F0,
|
||||
0x0F0000F0,
|
||||
0x0F0000F0,
|
||||
0x00FFFF00,
|
||||
0x00000000,
|
||||
0x0FFFFF00,
|
||||
0x0F0000F0,
|
||||
0x0F0000F0,
|
||||
0x0FFFFF00,
|
||||
0x0F000000,
|
||||
0x0F000000,
|
||||
0x0F000000,
|
||||
0x00000000,
|
||||
0x00FFFF00,
|
||||
0x0F0000F0,
|
||||
0x0F0000F0,
|
||||
0x0F0000F0,
|
||||
0x0F00F0F0,
|
||||
0x0F000F00,
|
||||
0x00FFF0F0,
|
||||
0x00000000,
|
||||
0x0FFFFF00,
|
||||
0x0F0000F0,
|
||||
0x0F0000F0,
|
||||
0x0FFFFF00,
|
||||
0x0F00F000,
|
||||
0x0F000F00,
|
||||
0x0F0000F0,
|
||||
0x00000000,
|
||||
0x00FFFF00,
|
||||
0x0F0000F0,
|
||||
0x0F000000,
|
||||
0x00FFFF00,
|
||||
0x000000F0,
|
||||
0x0F0000F0,
|
||||
0x00FFFF00,
|
||||
0x00000000,
|
||||
0x0FFFFFFF,
|
||||
0x0000F000,
|
||||
0x0000F000,
|
||||
0x0000F000,
|
||||
0x0000F000,
|
||||
0x0000F000,
|
||||
0x0000F000,
|
||||
0x00000000,
|
||||
0x0F0000F0,
|
||||
0x0F0000F0,
|
||||
0x0F0000F0,
|
||||
0x0F0000F0,
|
||||
0x0F0000F0,
|
||||
0x0F0000F0,
|
||||
0x00FFFF00,
|
||||
0x00000000,
|
||||
0x0F0000F0,
|
||||
0x0F0000F0,
|
||||
0x0F0000F0,
|
||||
0x0F0000F0,
|
||||
0x00F00F00,
|
||||
0x00F00F00,
|
||||
0x000FF000,
|
||||
0x00000000,
|
||||
0x0F00000F,
|
||||
0x0F00000F,
|
||||
0x0F00000F,
|
||||
0x0F00F00F,
|
||||
0x0F00F00F,
|
||||
0x0F00F00F,
|
||||
0x00FF0FF0,
|
||||
0x00000000,
|
||||
0x0F0000F0,
|
||||
0x0F0000F0,
|
||||
0x00F00F00,
|
||||
0x000FF000,
|
||||
0x00F00F00,
|
||||
0x0F0000F0,
|
||||
0x0F0000F0,
|
||||
0x00000000,
|
||||
0x0F00000F,
|
||||
0x00F000F0,
|
||||
0x000F0F00,
|
||||
0x0000F000,
|
||||
0x0000F000,
|
||||
0x0000F000,
|
||||
0x0000F000,
|
||||
0x00000000,
|
||||
0x0FFFFFF0,
|
||||
0x000000F0,
|
||||
0x00000F00,
|
||||
0x000FF000,
|
||||
0x00F00000,
|
||||
0x0F000000,
|
||||
0x0FFFFFF0,
|
||||
0x00000000,
|
||||
0x000FFF00,
|
||||
0x000F0000,
|
||||
0x000F0000,
|
||||
0x000F0000,
|
||||
0x000F0000,
|
||||
0x000F0000,
|
||||
0x000FFF00,
|
||||
0x00000000,
|
||||
0x0F000000,
|
||||
0x00F00000,
|
||||
0x000F0000,
|
||||
0x0000F000,
|
||||
0x00000F00,
|
||||
0x000000F0,
|
||||
0x00000000,
|
||||
0x00000000,
|
||||
0x00FFF000,
|
||||
0x0000F000,
|
||||
0x0000F000,
|
||||
0x0000F000,
|
||||
0x0000F000,
|
||||
0x0000F000,
|
||||
0x00FFF000,
|
||||
0x00000000,
|
||||
0x000FF000,
|
||||
0x00F00F00,
|
||||
0x0F0000F0,
|
||||
0x00000000,
|
||||
0x00000000,
|
||||
0x00000000,
|
||||
0x00000000,
|
||||
0x00000000,
|
||||
0x00000000,
|
||||
0x00000000,
|
||||
0x00000000,
|
||||
0x00000000,
|
||||
0x00000000,
|
||||
0x00000000,
|
||||
0x0FFFFFF0,
|
||||
0x00000000,
|
||||
0x000FF000,
|
||||
0x000FF000,
|
||||
0x000F0000,
|
||||
0x0000F000,
|
||||
0x00000000,
|
||||
0x00000000,
|
||||
0x00000000,
|
||||
0x00000000,
|
||||
0x00000000,
|
||||
0x00000000,
|
||||
0x00FFFF00,
|
||||
0x0F000F00,
|
||||
0x0F000F00,
|
||||
0x0F000F00,
|
||||
0x00FFFFF0,
|
||||
0x00000000,
|
||||
0x00F00000,
|
||||
0x00F00000,
|
||||
0x00F00000,
|
||||
0x00FFFF00,
|
||||
0x00F000F0,
|
||||
0x00F000F0,
|
||||
0x00FFFF00,
|
||||
0x00000000,
|
||||
0x00000000,
|
||||
0x00000000,
|
||||
0x00FFFF00,
|
||||
0x0F000000,
|
||||
0x0F000000,
|
||||
0x0F000000,
|
||||
0x00FFFF00,
|
||||
0x00000000,
|
||||
0x000000F0,
|
||||
0x000000F0,
|
||||
0x000000F0,
|
||||
0x000FFFF0,
|
||||
0x00F000F0,
|
||||
0x00F000F0,
|
||||
0x000FFFF0,
|
||||
0x00000000,
|
||||
0x00000000,
|
||||
0x00000000,
|
||||
0x00FFFF00,
|
||||
0x0F0000F0,
|
||||
0x0FFFFFF0,
|
||||
0x0F000000,
|
||||
0x00FFFF00,
|
||||
0x00000000,
|
||||
0x0000FF00,
|
||||
0x000F0000,
|
||||
0x000F0000,
|
||||
0x0FFFFF00,
|
||||
0x000F0000,
|
||||
0x000F0000,
|
||||
0x000F0000,
|
||||
0x00000000,
|
||||
0x00000000,
|
||||
0x000FFFF0,
|
||||
0x00F000F0,
|
||||
0x00F000F0,
|
||||
0x000FFFF0,
|
||||
0x000000F0,
|
||||
0x000FFF00,
|
||||
0x00000000,
|
||||
0x00F00000,
|
||||
0x00F00000,
|
||||
0x00F00000,
|
||||
0x00F0FF00,
|
||||
0x00FF00F0,
|
||||
0x00F000F0,
|
||||
0x00F000F0,
|
||||
0x00000000,
|
||||
0x00000000,
|
||||
0x0000F000,
|
||||
0x00000000,
|
||||
0x0000F000,
|
||||
0x0000F000,
|
||||
0x0000F000,
|
||||
0x0000F000,
|
||||
0x00000000,
|
||||
0x00000F00,
|
||||
0x00000000,
|
||||
0x00000F00,
|
||||
0x00000F00,
|
||||
0x00000F00,
|
||||
0x00F00F00,
|
||||
0x000FF000,
|
||||
0x00000000,
|
||||
0x00000000,
|
||||
0x00F00000,
|
||||
0x00F00000,
|
||||
0x00F00F00,
|
||||
0x00F0F000,
|
||||
0x00FFF000,
|
||||
0x00F00F00,
|
||||
0x00000000,
|
||||
0x0000F000,
|
||||
0x0000F000,
|
||||
0x0000F000,
|
||||
0x0000F000,
|
||||
0x0000F000,
|
||||
0x0000F000,
|
||||
0x00000F00,
|
||||
0x00000000,
|
||||
0x00000000,
|
||||
0x00000000,
|
||||
0x00F0FF00,
|
||||
0x0F0F00F0,
|
||||
0x0F0F00F0,
|
||||
0x0F0F00F0,
|
||||
0x0F0F00F0,
|
||||
0x00000000,
|
||||
0x00000000,
|
||||
0x00000000,
|
||||
0x00F0FF00,
|
||||
0x00FF00F0,
|
||||
0x00F000F0,
|
||||
0x00F000F0,
|
||||
0x00F000F0,
|
||||
0x00000000,
|
||||
0x00000000,
|
||||
0x00000000,
|
||||
0x000FFF00,
|
||||
0x00F000F0,
|
||||
0x00F000F0,
|
||||
0x00F000F0,
|
||||
0x000FFF00,
|
||||
0x00000000,
|
||||
0x00000000,
|
||||
0x00FFF000,
|
||||
0x00F00F00,
|
||||
0x00F00F00,
|
||||
0x00FFF000,
|
||||
0x00F00000,
|
||||
0x00F00000,
|
||||
0x00000000,
|
||||
0x00000000,
|
||||
0x000FFF00,
|
||||
0x00F00F00,
|
||||
0x00F00F00,
|
||||
0x000FFF00,
|
||||
0x00000F00,
|
||||
0x00000FF0,
|
||||
0x00000000,
|
||||
0x00000000,
|
||||
0x00000000,
|
||||
0x00F0FFF0,
|
||||
0x00FF0000,
|
||||
0x00F00000,
|
||||
0x00F00000,
|
||||
0x00F00000,
|
||||
0x00000000,
|
||||
0x00000000,
|
||||
0x00000000,
|
||||
0x000FFFF0,
|
||||
0x00F00000,
|
||||
0x000FFF00,
|
||||
0x000000F0,
|
||||
0x00FFFF00,
|
||||
0x00000000,
|
||||
0x00000000,
|
||||
0x0000F000,
|
||||
0x00FFFFF0,
|
||||
0x0000F000,
|
||||
0x0000F000,
|
||||
0x0000F000,
|
||||
0x00000FF0,
|
||||
0x00000000,
|
||||
0x00000000,
|
||||
0x00000000,
|
||||
0x00F000F0,
|
||||
0x00F000F0,
|
||||
0x00F000F0,
|
||||
0x00F000F0,
|
||||
0x000FFFF0,
|
||||
0x00000000,
|
||||
0x00000000,
|
||||
0x00000000,
|
||||
0x00F000F0,
|
||||
0x00F000F0,
|
||||
0x00F000F0,
|
||||
0x000F0F00,
|
||||
0x0000F000,
|
||||
0x00000000,
|
||||
0x00000000,
|
||||
0x00000000,
|
||||
0x0F0000F0,
|
||||
0x0F00F0F0,
|
||||
0x0F00F0F0,
|
||||
0x0F00F0F0,
|
||||
0x00FF0F00,
|
||||
0x00000000,
|
||||
0x00000000,
|
||||
0x00000000,
|
||||
0x00F000F0,
|
||||
0x000F0F00,
|
||||
0x0000F000,
|
||||
0x000F0F00,
|
||||
0x00F000F0,
|
||||
0x00000000,
|
||||
0x00000000,
|
||||
0x0F000F00,
|
||||
0x0F000F00,
|
||||
0x00F00F00,
|
||||
0x000FFF00,
|
||||
0x00000F00,
|
||||
0x00FFF000,
|
||||
0x00000000,
|
||||
0x00000000,
|
||||
0x00000000,
|
||||
0x00FFFFF0,
|
||||
0x00000F00,
|
||||
0x0000F000,
|
||||
0x000F0000,
|
||||
0x00FFFFF0,
|
||||
0x00000000,
|
||||
0x00000F00,
|
||||
0x0000F000,
|
||||
0x0000F000,
|
||||
0x00FF0000,
|
||||
0x0000F000,
|
||||
0x0000F000,
|
||||
0x00000F00,
|
||||
0x00000000,
|
||||
0x0000F000,
|
||||
0x0000F000,
|
||||
0x0000F000,
|
||||
0x0000F000,
|
||||
0x0000F000,
|
||||
0x0000F000,
|
||||
0x0000F000,
|
||||
0x00000000,
|
||||
0x000F0000,
|
||||
0x0000F000,
|
||||
0x0000F000,
|
||||
0x00000FF0,
|
||||
0x0000F000,
|
||||
0x0000F000,
|
||||
0x000F0000,
|
||||
0x00000000,
|
||||
0x00FF00FF,
|
||||
0x0F00FF00,
|
||||
0x00000000,
|
||||
0x00000000,
|
||||
0x00000000,
|
||||
0x00000000,
|
||||
0x00000000,
|
||||
0x00000000,
|
||||
0x00FF0000,
|
||||
0x0FF00000,
|
||||
0xFFFFFFFF,
|
||||
0xFFFFF000,
|
||||
0xFFFFF000,
|
||||
0xFFF00000,
|
||||
0x00000000
|
||||
};
|
||||
251
src/dolphin/demo/DEMOInit.c
Normal file
251
src/dolphin/demo/DEMOInit.c
Normal file
|
|
@ -0,0 +1,251 @@
|
|||
#include <dolphin.h>
|
||||
#include <dolphin/demo.h>
|
||||
#include <dolphin/gx.h>
|
||||
#include <dolphin/pad.h>
|
||||
#include <dolphin/vi.h>
|
||||
#include "game/init.h"
|
||||
|
||||
#include <dolphin/demotypes.h>
|
||||
|
||||
extern unsigned char DemoStatEnable; // size: 0x1, address: 0x0
|
||||
|
||||
// .bss
|
||||
static struct _GXRenderModeObj rmodeobj; // size: 0x3C, address: 0x0
|
||||
|
||||
// .sdata
|
||||
static unsigned char DemoFirstFrame = 1; // size: 0x1, address: 0x0
|
||||
|
||||
// .sbss
|
||||
static void *DefaultFifo = NULL; // size: 0x4, address: 0x0
|
||||
static GXFifoObj *DefaultFifoObj = NULL; // size: 0x4, address: 0x4
|
||||
static struct _GXRenderModeObj *rmode; // size: 0x4, address: 0x8
|
||||
static int BypassWorkaround; // size: 0x4, address: 0xC
|
||||
static unsigned long FrameCount; // size: 0x4, address: 0x10
|
||||
static unsigned long FrameMissThreshold; // size: 0x4, address: 0x14
|
||||
|
||||
// functions
|
||||
static void __DEMOInitRenderMode(struct _GXRenderModeObj *mode);
|
||||
static void __DEMOInitMem();
|
||||
static void __DEMOInitGX();
|
||||
static void __DEMOInitVI();
|
||||
static void __DEMOInitForEmu();
|
||||
static void __BypassRetraceCallback();
|
||||
static void LoadMemInfo();
|
||||
|
||||
void DEMOInit(struct _GXRenderModeObj *mode)
|
||||
{
|
||||
OSInit();
|
||||
DVDInit();
|
||||
VIInit();
|
||||
DEMOPadInit();
|
||||
__DEMOInitRenderMode(mode);
|
||||
__DEMOInitMem();
|
||||
VIConfigure(rmode);
|
||||
DefaultFifo = OSAllocFromHeap(__OSCurrHeap, 0x40000);
|
||||
DefaultFifoObj = GXInit(DefaultFifo, 0x40000);
|
||||
__DEMOInitGX();
|
||||
__DEMOInitVI();
|
||||
}
|
||||
|
||||
static void __DEMOInitRenderMode(struct _GXRenderModeObj *mode)
|
||||
{
|
||||
if (mode != NULL) {
|
||||
rmode = mode;
|
||||
return;
|
||||
}
|
||||
switch (VIGetTvFormat()) {
|
||||
case VI_NTSC:
|
||||
rmode = &GXNtsc480IntDf;
|
||||
break;
|
||||
case VI_PAL:
|
||||
rmode = &GXPal528IntDf;
|
||||
break;
|
||||
case VI_MPAL:
|
||||
rmode = &GXMpal480IntDf;
|
||||
break;
|
||||
default:
|
||||
OSPanic(__FILE__, 0x1A6, "DEMOInit: invalid TV format\n");
|
||||
break;
|
||||
}
|
||||
GXAdjustForOverscan(rmode, &rmodeobj, 0, 0x10);
|
||||
rmode = &rmodeobj;
|
||||
}
|
||||
|
||||
static void __DEMOInitMem()
|
||||
{
|
||||
void *arenaLo = OSGetArenaLo();
|
||||
void *arenaHi = OSGetArenaHi();
|
||||
unsigned long fbSize = ((u16)(rmode->fbWidth + 15) & 0xFFF0) * rmode->xfbHeight * 2;
|
||||
|
||||
DemoFrameBuffer1 = (void *)(((u32)arenaLo + 0x1F) & 0xFFFFFFE0);
|
||||
DemoFrameBuffer2 = (void *)(((u32)DemoFrameBuffer1 + fbSize + 0x1F) & 0xFFFFFFE0);
|
||||
DemoCurrentBuffer = DemoFrameBuffer2;
|
||||
arenaLo = (void *)(((u32)DemoFrameBuffer2 + fbSize + 0x1F) & 0xFFFFFFE0);
|
||||
OSSetArenaLo(arenaLo);
|
||||
if (((OSGetConsoleType() + 0xF0000000) == 4U) && ((OSGetPhysicalMemSize() + 0xFFC00000) != 0U)
|
||||
&& (OSGetConsoleSimulatedMemSize() < 0x01800000U)) {
|
||||
LoadMemInfo();
|
||||
return;
|
||||
}
|
||||
arenaLo = OSGetArenaLo();
|
||||
arenaHi = OSGetArenaHi();
|
||||
arenaLo = OSInitAlloc(arenaLo, arenaHi, 1);
|
||||
OSSetArenaLo(arenaLo);
|
||||
arenaLo = (void *)(((u32)arenaLo + 0x1F) & 0xFFFFFFE0);
|
||||
arenaHi = (void *)((u32)arenaHi & 0xFFFFFFE0);
|
||||
OSSetCurrentHeap(OSCreateHeap((void *)(((u32)arenaLo)), arenaHi));
|
||||
OSSetArenaLo((arenaLo = arenaHi));
|
||||
}
|
||||
|
||||
static void __DEMOInitGX()
|
||||
{
|
||||
GXSetViewport(0.0f, 0.0f, rmode->fbWidth, rmode->xfbHeight, 0.0f, 1.0f);
|
||||
GXSetScissor(0, 0, rmode->fbWidth, rmode->efbHeight);
|
||||
GXSetDispCopySrc(0, 0, rmode->fbWidth, rmode->efbHeight);
|
||||
GXSetDispCopyDst(rmode->fbWidth, rmode->xfbHeight);
|
||||
GXSetDispCopyYScale(((f32)rmode->xfbHeight / (f32)rmode->efbHeight));
|
||||
GXSetCopyFilter(rmode->aa, rmode->sample_pattern, 1, rmode->vfilter);
|
||||
if (rmode->aa != 0) {
|
||||
GXSetPixelFmt(2, 0);
|
||||
}
|
||||
else {
|
||||
GXSetPixelFmt(0, 0);
|
||||
}
|
||||
GXCopyDisp(DemoCurrentBuffer, 1);
|
||||
GXSetDispCopyGamma(0);
|
||||
}
|
||||
|
||||
static void __DEMOInitVI()
|
||||
{
|
||||
unsigned long nin;
|
||||
|
||||
VISetNextFrameBuffer(DemoFrameBuffer1);
|
||||
DemoCurrentBuffer = DemoFrameBuffer2;
|
||||
VIFlush();
|
||||
VIWaitForRetrace();
|
||||
nin = rmode->viTVmode & 1;
|
||||
if (nin != 0) {
|
||||
VIWaitForRetrace();
|
||||
}
|
||||
}
|
||||
|
||||
static void __DEMOInitForEmu() { }
|
||||
|
||||
void DEMOBeforeRender()
|
||||
{
|
||||
if (BypassWorkaround != 0) {
|
||||
GXSetDrawSync(0xFEEB);
|
||||
}
|
||||
if (rmode->field_rendering != 0) {
|
||||
GXSetViewportJitter(0.0f, 0.0f, rmode->fbWidth, rmode->xfbHeight, 0.0f, 1.0f, VIGetNextField());
|
||||
}
|
||||
else {
|
||||
GXSetViewport(0.0f, 0.0f, rmode->fbWidth, rmode->xfbHeight, 0.0f, 1.0f);
|
||||
}
|
||||
GXInvalidateVtxCache();
|
||||
GXInvalidateTexAll();
|
||||
}
|
||||
|
||||
void DEMOSwapBuffers()
|
||||
{
|
||||
VISetNextFrameBuffer(DemoCurrentBuffer);
|
||||
if (DemoFirstFrame != 0) {
|
||||
VISetBlack(0);
|
||||
DemoFirstFrame = 0;
|
||||
}
|
||||
VIFlush();
|
||||
VIWaitForRetrace();
|
||||
if ((u32)DemoCurrentBuffer == (u32)DemoFrameBuffer1) {
|
||||
DemoCurrentBuffer = DemoFrameBuffer2;
|
||||
return;
|
||||
}
|
||||
DemoCurrentBuffer = DemoFrameBuffer1;
|
||||
}
|
||||
|
||||
struct _GXRenderModeObj *DEMOGetRenderModeObj()
|
||||
{
|
||||
return rmode;
|
||||
}
|
||||
|
||||
u32 DEMOGetCurrentBuffer(void)
|
||||
{
|
||||
return (u32)DemoCurrentBuffer;
|
||||
}
|
||||
|
||||
void DEMOEnableBypassWorkaround(unsigned long timeoutFrames)
|
||||
{
|
||||
BypassWorkaround = 1;
|
||||
FrameMissThreshold = timeoutFrames;
|
||||
VISetPreRetraceCallback(__BypassRetraceCallback);
|
||||
}
|
||||
|
||||
static void __BypassRetraceCallback()
|
||||
{
|
||||
FrameCount += 1;
|
||||
}
|
||||
|
||||
static void LoadMemInfo()
|
||||
{
|
||||
void *arenaHiOld;
|
||||
void *arenaLo;
|
||||
void *arenaHi;
|
||||
void *simMemEnd;
|
||||
struct DVDFileInfo fileInfo;
|
||||
unsigned long length;
|
||||
unsigned long transferLength;
|
||||
long offset;
|
||||
unsigned long i;
|
||||
unsigned long indexMax;
|
||||
char *buf[63];
|
||||
struct {
|
||||
void *start;
|
||||
void *end;
|
||||
} *memEntry;
|
||||
|
||||
OSReport("\nNow, try to find memory info file...\n\n");
|
||||
if (!DVDOpen("/meminfo.bin", &fileInfo)) {
|
||||
OSReport("\nCan't find memory info file. Use /XXX toolname/ to maximize available\n");
|
||||
OSReport("memory space. For now, we only use the first %dMB.\n", OSGetConsoleSimulatedMemSize() >> 0x14);
|
||||
arenaLo = OSGetArenaLo();
|
||||
arenaHi = OSGetArenaHi();
|
||||
arenaLo = OSInitAlloc(arenaLo, arenaHi, 1);
|
||||
OSSetArenaLo(arenaLo);
|
||||
arenaLo = (void *)(((u32)arenaLo + 0x1F) & 0xFFFFFFE0);
|
||||
arenaHi = (void *)((u32)arenaHi & 0xFFFFFFE0);
|
||||
OSSetCurrentHeap(OSCreateHeap((void *)(((u32)arenaLo)), arenaHi));
|
||||
OSSetArenaLo((arenaLo = arenaHi));
|
||||
return;
|
||||
}
|
||||
memEntry = (void *)((u32)buf + 0x1F & 0xFFFFFFE0);
|
||||
arenaHiOld = OSGetArenaHi();
|
||||
simMemEnd = OSPhysicalToCached(OSGetConsoleSimulatedMemSize());
|
||||
OSSetArenaHi(OSPhysicalToCached(OSGetPhysicalMemSize()));
|
||||
arenaLo = OSGetArenaLo();
|
||||
arenaHi = OSGetArenaHi();
|
||||
arenaLo = OSInitAlloc(arenaLo, arenaHi, 1);
|
||||
OSSetArenaLo(arenaLo);
|
||||
arenaLo = (void *)(((u32)arenaLo + 0x1F) & 0xFFFFFFE0);
|
||||
arenaHi = (void *)((u32)arenaHi & 0xFFFFFFE0);
|
||||
OSSetCurrentHeap(OSCreateHeap((void *)(arenaLo), arenaHi));
|
||||
OSSetArenaLo((arenaLo = arenaHi));
|
||||
OSAllocFixed(&arenaHiOld, &simMemEnd);
|
||||
length = fileInfo.length;
|
||||
offset = 0;
|
||||
while (length) {
|
||||
OSReport("loop\n");
|
||||
transferLength = (length < 0x20) ? length : 0x20;
|
||||
if (DVDReadPrio(&fileInfo, memEntry, (transferLength + 0x1F) & 0xFFFFFFE0, offset, 2) < 0) {
|
||||
OSPanic(__FILE__, 0x49F, "An error occurred when issuing read to /meminfo.bin\n");
|
||||
}
|
||||
indexMax = (transferLength / 8);
|
||||
for (i = 0; i < indexMax; i++) {
|
||||
OSReport("start: 0x%08x, end: 0x%08x\n", memEntry[i].start, memEntry[i].end);
|
||||
OSAllocFixed(&memEntry[i].start, &memEntry[i].end);
|
||||
OSReport("Removed 0x%08x - 0x%08x from the current heap\n", memEntry[i].start, (char *)memEntry[i].end - 1);
|
||||
}
|
||||
length -= transferLength;
|
||||
offset += transferLength;
|
||||
}
|
||||
DVDClose(&fileInfo);
|
||||
OSDumpHeap(__OSCurrHeap);
|
||||
}
|
||||
146
src/dolphin/demo/DEMOPuts.c
Normal file
146
src/dolphin/demo/DEMOPuts.c
Normal file
|
|
@ -0,0 +1,146 @@
|
|||
#include "stdarg.h"
|
||||
#include "stdio.h"
|
||||
#include <dolphin.h>
|
||||
#include <dolphin/demo.h>
|
||||
#include <dolphin/gx.h>
|
||||
#include <dolphin/mtx.h>
|
||||
|
||||
#include <dolphin/demotypes.h>
|
||||
|
||||
extern unsigned long DEMOFontBitmap[]; // size: 0x0, address: 0x0
|
||||
|
||||
// .bss
|
||||
static struct _GXTexObj fontTexObj; // size: 0x20, address: 0x0
|
||||
|
||||
// .sbss
|
||||
static long fontShift; // size: 0x4, address: 0x0
|
||||
|
||||
// functions
|
||||
static void DrawFontChar(int x, int y, int z, int xChar, int yChar);
|
||||
static void LoadSheet(void *image, enum _GXTexMapID texMapID);
|
||||
|
||||
void DEMOSetFontType(DMFontType attr)
|
||||
{
|
||||
switch (attr) {
|
||||
case DM_FT_RVS:
|
||||
GXSetBlendMode(2, 0, 0, 0xC);
|
||||
break;
|
||||
case DM_FT_XLU:
|
||||
GXSetBlendMode(1, 1, 1, 0);
|
||||
break;
|
||||
case DM_FT_OPQ:
|
||||
default:
|
||||
GXSetBlendMode(1, 1, 0, 0);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void DEMOLoadFont(enum _GXTexMapID texMap, enum _GXTexMtx texMtx, DMTexFlt texFlt)
|
||||
{
|
||||
// float fontTMtx[3][4];
|
||||
// unsigned short width;
|
||||
// unsigned short height;
|
||||
|
||||
// width = 64;
|
||||
// height = 0x1800 / width;
|
||||
// GXInitTexObj(&fontTexObj, (void *)DEMOFontBitmap, width, (u16)height, 0, 0, 0, 0);
|
||||
// if (texFlt == 0) {
|
||||
// GXInitTexObjLOD(&fontTexObj, 0, 0, 0, 0, 0, 0.0f, 0.0f, 0.0f);
|
||||
// fontShift = 0;
|
||||
// }
|
||||
// GXLoadTexObj(&fontTexObj, texMap);
|
||||
// MTXScale(fontTMtx, 1.0f / (width - fontShift), 1.0f / ((u16)height - !fontShift), 1.0f);
|
||||
// GXLoadTexMtxImm(fontTMtx, texMtx, 1);
|
||||
// GXSetNumTexGens(1);
|
||||
// GXSetTexCoordGen(0, 1, 4, texMtx);
|
||||
}
|
||||
|
||||
void DEMOSetupScrnSpc(long width, long height, float depth)
|
||||
{
|
||||
float pMtx[4][4];
|
||||
float mMtx[3][4];
|
||||
|
||||
MTXOrtho(pMtx, 0.0f, height, 0.0f, width, 0.0f, -depth);
|
||||
GXSetProjection(pMtx, 1);
|
||||
MTXIdentity(mMtx);
|
||||
GXLoadPosMtxImm(mMtx, 0);
|
||||
GXSetCurrentMtx(0);
|
||||
}
|
||||
|
||||
void DEMOInitCaption(long font_type, long width, long height)
|
||||
{
|
||||
DEMOSetupScrnSpc(width, height, 100.0f);
|
||||
GXSetZMode(1, 7, 1);
|
||||
GXSetNumChans(0);
|
||||
GXSetNumTevStages(1);
|
||||
GXSetTevOp(0, 3);
|
||||
GXSetTevOrder(0, 0, 0, 0xFF);
|
||||
DEMOLoadFont(0, 0x1E, 0);
|
||||
DEMOSetFontType(font_type);
|
||||
}
|
||||
|
||||
void DEMOPuts(s16 x, s16 y, s16 z, char *string)
|
||||
{
|
||||
char *str;
|
||||
long s;
|
||||
long t;
|
||||
long c;
|
||||
long w;
|
||||
long len;
|
||||
long i;
|
||||
|
||||
str = string;
|
||||
GXClearVtxDesc();
|
||||
GXSetVtxDesc(9, 1);
|
||||
GXSetVtxDesc(0xD, 1);
|
||||
GXSetVtxAttrFmt(0, 9, 1, 3, 0);
|
||||
GXSetVtxAttrFmt(0, 0xD, 1, 3, 1);
|
||||
|
||||
// calc len
|
||||
len = 0;
|
||||
while (1) {
|
||||
c = *(str++);
|
||||
if ((c >= 0x20) && (c <= 0x7F)) {
|
||||
len++;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (len > 0) {
|
||||
GXBegin(0x80, 0, len * 4);
|
||||
for (i = 0; i < len; i++) {
|
||||
w = string[i] - 0x20;
|
||||
s = fontShift + ((w % 8) * 0x10);
|
||||
t = fontShift + ((w / 8) * 0x10);
|
||||
GXPosition3s16(x + (i * 8), y, z);
|
||||
GXTexCoord2s16(s, t);
|
||||
GXPosition3s16(x + (i * 8) + 8, y, z);
|
||||
GXTexCoord2s16(s + 0x10, t);
|
||||
GXPosition3s16(x + (i * 8) + 8, y + 8, z);
|
||||
GXTexCoord2s16(s + 0x10, t + 0x10);
|
||||
GXPosition3s16(x + (i * 8), y + 8, z);
|
||||
GXTexCoord2s16(s, t + 0x10);
|
||||
}
|
||||
GXEnd();
|
||||
len = 0;
|
||||
}
|
||||
|
||||
string = str;
|
||||
if (c == 0xA) {
|
||||
y += 0x8;
|
||||
}
|
||||
else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void DEMOPrintf(s16 x, s16 y, s16 z, char *fmt, ...)
|
||||
{
|
||||
va_list vlist;
|
||||
char buf[256];
|
||||
|
||||
va_start(vlist, fmt);
|
||||
vsprintf(buf, fmt, vlist);
|
||||
DEMOPuts(x, y, z, buf);
|
||||
va_end(vlist);
|
||||
}
|
||||
424
src/dolphin/demo/DEMOStats.c
Normal file
424
src/dolphin/demo/DEMOStats.c
Normal file
|
|
@ -0,0 +1,424 @@
|
|||
#include "dolphin/gx/GXPerf.h"
|
||||
#include "string.h"
|
||||
#include <dolphin.h>
|
||||
#include <dolphin/demo.h>
|
||||
#include <dolphin/gx.h>
|
||||
|
||||
#include <dolphin/demotypes.h>
|
||||
|
||||
unsigned char DemoStatEnable = 0;
|
||||
static DemoStatData *DemoStat;
|
||||
static unsigned long DemoStatIndx;
|
||||
static unsigned long DemoStatMaxIndx;
|
||||
static unsigned long DemoStatClocks;
|
||||
static unsigned long DemoStatDisp;
|
||||
static unsigned long DemoStatStrLen;
|
||||
static unsigned long topPixIn;
|
||||
static unsigned long topPixOut;
|
||||
static unsigned long botPixIn;
|
||||
static unsigned long botPixOut;
|
||||
static unsigned long clrPixIn;
|
||||
static unsigned long copyClks;
|
||||
static unsigned long vcCheck;
|
||||
static unsigned long vcMiss;
|
||||
static unsigned long vcStall;
|
||||
static unsigned long cpReq;
|
||||
static unsigned long tcReq;
|
||||
static unsigned long cpuRdReq;
|
||||
static unsigned long cpuWrReq;
|
||||
static unsigned long dspReq;
|
||||
static unsigned long ioReq;
|
||||
static unsigned long viReq;
|
||||
static unsigned long peReq;
|
||||
static unsigned long rfReq;
|
||||
static unsigned long fiReq;
|
||||
|
||||
// functions
|
||||
static void DEMOWriteStats(unsigned char update);
|
||||
static void DEMOWriteStats(unsigned char update);
|
||||
|
||||
void DEMOSetStats(DemoStatData *stat, unsigned long nstats, DEMO_STAT_DISP disp)
|
||||
{
|
||||
if (!stat || nstats == 0) {
|
||||
DemoStatEnable = FALSE;
|
||||
}
|
||||
else {
|
||||
DemoStatEnable = TRUE;
|
||||
DemoStat = stat;
|
||||
DemoStatIndx = 0;
|
||||
DemoStatMaxIndx = nstats;
|
||||
DemoStatDisp = disp;
|
||||
DemoStatStrLen = strlen(DemoStat->text);
|
||||
}
|
||||
}
|
||||
|
||||
static void DEMOWriteStats(unsigned char update)
|
||||
{
|
||||
unsigned long cnt0;
|
||||
unsigned long cnt1;
|
||||
unsigned long cnt2;
|
||||
unsigned long cnt3;
|
||||
unsigned long cnt4;
|
||||
unsigned long cnt5;
|
||||
unsigned long cnt6;
|
||||
unsigned long cnt7;
|
||||
unsigned long cnt8;
|
||||
unsigned long cnt9;
|
||||
|
||||
switch (DemoStat[DemoStatIndx].stat_type) {
|
||||
case DEMO_STAT_GP0:
|
||||
if (update) {
|
||||
cnt0 = GXReadGP0Metric();
|
||||
DemoStat[DemoStatIndx].count = cnt0;
|
||||
GXSetGPMetric(GX_PERF0_NONE, GX_PERF1_NONE);
|
||||
break;
|
||||
}
|
||||
GXSetGPMetric(DemoStat[DemoStatIndx].stat, GX_PERF1_NONE);
|
||||
GXClearGPMetric();
|
||||
break;
|
||||
case DEMO_STAT_GP1:
|
||||
if (update) {
|
||||
cnt0 = GXReadGP1Metric();
|
||||
DemoStat[DemoStatIndx].count = cnt0;
|
||||
GXSetGPMetric(GX_PERF0_NONE, GX_PERF1_NONE);
|
||||
break;
|
||||
}
|
||||
GXSetGPMetric(GX_PERF0_NONE, DemoStat[DemoStatIndx].stat);
|
||||
GXClearGPMetric();
|
||||
break;
|
||||
case DEMO_STAT_MEM:
|
||||
if (update) {
|
||||
GXReadMemMetric(&cnt0, &cnt1, &cnt2, &cnt3, &cnt4, &cnt5, &cnt6, &cnt7, &cnt8, &cnt9);
|
||||
cpReq = cnt0;
|
||||
tcReq = cnt1;
|
||||
cpuRdReq = cnt2;
|
||||
cpuWrReq = cnt3;
|
||||
dspReq = cnt4;
|
||||
ioReq = cnt5;
|
||||
viReq = cnt6;
|
||||
peReq = cnt7;
|
||||
rfReq = cnt8;
|
||||
fiReq = cnt9;
|
||||
break;
|
||||
}
|
||||
GXClearMemMetric();
|
||||
break;
|
||||
case DEMO_STAT_PIX:
|
||||
if (update) {
|
||||
GXReadPixMetric(&cnt0, &cnt1, &cnt2, &cnt3, &cnt4, &cnt5);
|
||||
topPixIn = cnt0;
|
||||
topPixOut = cnt1;
|
||||
botPixIn = cnt2;
|
||||
botPixOut = cnt3;
|
||||
clrPixIn = cnt4;
|
||||
copyClks = cnt5;
|
||||
break;
|
||||
}
|
||||
GXClearPixMetric();
|
||||
break;
|
||||
case DEMO_STAT_VC:
|
||||
if (update) {
|
||||
GXReadVCacheMetric(&cnt0, &cnt1, &cnt2);
|
||||
vcCheck = cnt0;
|
||||
vcMiss = cnt1;
|
||||
vcStall = cnt2;
|
||||
break;
|
||||
}
|
||||
GXSetVCacheMetric(GX_VC_POS);
|
||||
GXClearVCacheMetric();
|
||||
break;
|
||||
case DEMO_STAT_FR:
|
||||
if (update) {
|
||||
GXReadPixMetric(&cnt0, &cnt1, &cnt2, &cnt3, &cnt4, &cnt5);
|
||||
topPixIn = cnt0;
|
||||
topPixOut = cnt1;
|
||||
botPixIn = cnt2;
|
||||
botPixOut = cnt3;
|
||||
clrPixIn = cnt4;
|
||||
copyClks = cnt5;
|
||||
DemoStatClocks = GXReadGP0Metric();
|
||||
GXSetGPMetric(GX_PERF0_NONE, GX_PERF1_NONE);
|
||||
break;
|
||||
}
|
||||
GXClearPixMetric();
|
||||
GXSetGPMetric(GX_PERF0_CLOCKS, GX_PERF1_NONE);
|
||||
GXClearGPMetric();
|
||||
break;
|
||||
case DEMO_STAT_TBW:
|
||||
case DEMO_STAT_TBP:
|
||||
GXClearPixMetric();
|
||||
if (update) {
|
||||
GXReadPixMetric(&cnt0, &cnt1, &cnt2, &cnt3, &cnt4, &cnt5);
|
||||
topPixIn = cnt0;
|
||||
topPixOut = cnt1;
|
||||
botPixIn = cnt2;
|
||||
botPixOut = cnt3;
|
||||
clrPixIn = cnt4;
|
||||
copyClks = cnt5;
|
||||
DemoStatClocks = GXReadGP0Metric(cnt4, cnt3, cnt2, cnt1, cnt0);
|
||||
GXReadMemMetric(&cnt0, &cnt1, &cnt2, &cnt3, &cnt4, &cnt5, &cnt6, &cnt7, &cnt8, &cnt9);
|
||||
tcReq = cnt1;
|
||||
GXSetGPMetric(GX_PERF0_NONE, GX_PERF1_NONE);
|
||||
break;
|
||||
}
|
||||
GXClearMemMetric();
|
||||
GXSetGPMetric(GX_PERF0_CLOCKS, GX_PERF1_NONE);
|
||||
GXClearGPMetric();
|
||||
break;
|
||||
case DEMO_STAT_MYC:
|
||||
case DEMO_STAT_MYR:
|
||||
break;
|
||||
default:
|
||||
OSPanic("DEMOStats.c", 0x127, "DEMOSetStats: Unknown demo stat type\n");
|
||||
}
|
||||
}
|
||||
|
||||
void DEMOUpdateStats(unsigned char inc)
|
||||
{
|
||||
DEMOWriteStats(inc);
|
||||
if (inc) {
|
||||
DemoStatIndx = DemoStatIndx + 1;
|
||||
if (DemoStatIndx == DemoStatMaxIndx) {
|
||||
DemoStatIndx = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void DEMOPrintStats(void)
|
||||
{
|
||||
GXRenderModeObj *rmode;
|
||||
unsigned long i;
|
||||
signed short text_x;
|
||||
signed short text_y;
|
||||
signed short text_yinc;
|
||||
unsigned short wd;
|
||||
unsigned short ht;
|
||||
float rate;
|
||||
|
||||
if (DemoStatDisp == DEMO_STAT_IO) {
|
||||
for (i = 0; i < DemoStatMaxIndx; i++) {
|
||||
switch (DemoStat[i].stat_type) {
|
||||
case DEMO_STAT_PIX:
|
||||
switch (DemoStat[i].stat) {
|
||||
case 0:
|
||||
OSReport("%s: %8d\n", DemoStat[i].text, topPixIn);
|
||||
break;
|
||||
case 1:
|
||||
OSReport("%s: %8d\n", DemoStat[i].text, topPixOut);
|
||||
break;
|
||||
case 2:
|
||||
OSReport("%s: %8d\n", DemoStat[i].text, botPixIn);
|
||||
break;
|
||||
case 3:
|
||||
OSReport("%s: %8d\n", DemoStat[i].text, botPixOut);
|
||||
break;
|
||||
case 4:
|
||||
OSReport("%s: %8d\n", DemoStat[i].text, clrPixIn);
|
||||
break;
|
||||
case 5:
|
||||
OSReport("%s: %8d\n", DemoStat[i].text, copyClks);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case DEMO_STAT_FR:
|
||||
rate = 162.0F * (topPixIn + botPixIn) / (float)(DemoStatClocks - copyClks);
|
||||
OSReport("%s: %8.2f\n", DemoStat[i].text, rate);
|
||||
break;
|
||||
case DEMO_STAT_TBW:
|
||||
rate = 162.0F * (tcReq << 5) / (float)(DemoStatClocks - copyClks);
|
||||
OSReport("%s: %8.2f\n", DemoStat[i].text, rate);
|
||||
break;
|
||||
case DEMO_STAT_TBP:
|
||||
rate = (tcReq << 5) / (float)(topPixIn + botPixIn);
|
||||
OSReport("%s: %8.2f\n", DemoStat[i].text, rate);
|
||||
break;
|
||||
case DEMO_STAT_VC:
|
||||
switch (DemoStat[i].stat) {
|
||||
case 0:
|
||||
OSReport("%s: %8d\n", DemoStat[i].text, vcCheck);
|
||||
break;
|
||||
case 1:
|
||||
OSReport("%s: %8d\n", DemoStat[i].text, vcMiss);
|
||||
break;
|
||||
case 2:
|
||||
OSReport("%s: %8d\n", DemoStat[i].text, vcStall);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case DEMO_STAT_MYR:
|
||||
rate = DemoStat[i].stat / (float)DemoStat[i].count;
|
||||
OSReport("%s: %8.2f\n", DemoStat[i].text, rate);
|
||||
break;
|
||||
case DEMO_STAT_MEM:
|
||||
switch (DemoStat[i].stat) {
|
||||
case 0:
|
||||
OSReport("%s: %8d\n", DemoStat[i].text, cpReq);
|
||||
break;
|
||||
case 1:
|
||||
OSReport("%s: %8d\n", DemoStat[i].text, tcReq);
|
||||
break;
|
||||
case 2:
|
||||
OSReport("%s: %8d\n", DemoStat[i].text, cpuRdReq);
|
||||
break;
|
||||
case 3:
|
||||
OSReport("%s: %8d\n", DemoStat[i].text, cpuWrReq);
|
||||
break;
|
||||
case 4:
|
||||
OSReport("%s: %8d\n", DemoStat[i].text, dspReq);
|
||||
break;
|
||||
case 5:
|
||||
OSReport("%s: %8d\n", DemoStat[i].text, ioReq);
|
||||
break;
|
||||
case 6:
|
||||
OSReport("%s: %8d\n", DemoStat[i].text, viReq);
|
||||
break;
|
||||
case 7:
|
||||
OSReport("%s: %8d\n", DemoStat[i].text, peReq);
|
||||
break;
|
||||
case 8:
|
||||
OSReport("%s: %8d\n", DemoStat[i].text, rfReq);
|
||||
break;
|
||||
case 9:
|
||||
OSReport("%s: %8d\n", DemoStat[i].text, fiReq);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
OSReport("%s: %8d\n", DemoStat[i].text, DemoStat[i].count);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
rmode = DEMOGetRenderModeObj();
|
||||
switch (DemoStatDisp) {
|
||||
case DEMO_STAT_TL:
|
||||
text_x = 0x10;
|
||||
text_y = 0x10;
|
||||
text_yinc = 0xA;
|
||||
wd = rmode->fbWidth;
|
||||
ht = rmode->xfbHeight;
|
||||
break;
|
||||
case DEMO_STAT_BL:
|
||||
text_x = 0x10;
|
||||
text_y = rmode->xfbHeight - 0x18;
|
||||
text_yinc = -0xA;
|
||||
wd = rmode->fbWidth;
|
||||
ht = rmode->xfbHeight;
|
||||
break;
|
||||
case DEMO_STAT_TLD:
|
||||
text_x = 8;
|
||||
text_y = 8;
|
||||
text_yinc = 9;
|
||||
wd = rmode->fbWidth / 2;
|
||||
ht = rmode->xfbHeight / 2;
|
||||
break;
|
||||
case DEMO_STAT_BLD:
|
||||
text_x = 8;
|
||||
text_y = (rmode->xfbHeight - 0x18) / 2;
|
||||
text_yinc = -9;
|
||||
wd = rmode->fbWidth / 2;
|
||||
ht = rmode->xfbHeight / 2;
|
||||
break;
|
||||
}
|
||||
DEMOInitCaption(0, wd, ht);
|
||||
for (i = 0; i < DemoStatMaxIndx; i++) {
|
||||
switch (DemoStat[i].stat_type) {
|
||||
case DEMO_STAT_PIX:
|
||||
switch (DemoStat[i].stat) {
|
||||
case 0:
|
||||
DEMOPrintf(text_x, text_y, 0, "%s: %8d\n", DemoStat[i].text, topPixIn);
|
||||
break;
|
||||
case 1:
|
||||
DEMOPrintf(text_x, text_y, 0, "%s: %8d\n", DemoStat[i].text, topPixOut);
|
||||
break;
|
||||
case 2:
|
||||
DEMOPrintf(text_x, text_y, 0, "%s: %8d\n", DemoStat[i].text, botPixIn);
|
||||
break;
|
||||
case 3:
|
||||
DEMOPrintf(text_x, text_y, 0, "%s: %8d\n", DemoStat[i].text, botPixOut);
|
||||
break;
|
||||
case 4:
|
||||
DEMOPrintf(text_x, text_y, 0, "%s: %8d\n", DemoStat[i].text, clrPixIn);
|
||||
break;
|
||||
case 5:
|
||||
DEMOPrintf(text_x, text_y, 0, "%s: %8d\n", DemoStat[i].text, copyClks);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case DEMO_STAT_FR:
|
||||
rate = 162.0F * (topPixIn + botPixIn) / (float)(DemoStatClocks - copyClks);
|
||||
DEMOPrintf(text_x, text_y, 0, "%s: %8.2f\n", DemoStat[i].text, rate);
|
||||
break;
|
||||
case DEMO_STAT_TBW:
|
||||
rate = 162.0F * (tcReq << 5) / (float)(DemoStatClocks - copyClks);
|
||||
DEMOPrintf(text_x, text_y, 0, "%s: %8.2f\n", DemoStat[i].text, rate);
|
||||
break;
|
||||
case DEMO_STAT_TBP:
|
||||
rate = (tcReq << 5) / (float)(topPixIn - botPixIn);
|
||||
DEMOPrintf(text_x, text_y, 0, "%s: %8.3f\n", DemoStat[i].text, rate);
|
||||
break;
|
||||
case DEMO_STAT_VC:
|
||||
switch (DemoStat[i].stat) {
|
||||
case 0:
|
||||
DEMOPrintf(text_x, text_y, 0, "%s: %8d\n", DemoStat[i].text, vcCheck);
|
||||
break;
|
||||
case 1:
|
||||
DEMOPrintf(text_x, text_y, 0, "%s: %8d\n", DemoStat[i].text, vcMiss);
|
||||
break;
|
||||
case 2:
|
||||
DEMOPrintf(text_x, text_y, 0, "%s: %8d\n", DemoStat[i].text, vcStall);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case DEMO_STAT_MEM:
|
||||
switch (DemoStat[i].stat) {
|
||||
case 0:
|
||||
DEMOPrintf(text_x, text_y, 0, "%s: %8d\n", DemoStat[i].text, cpReq);
|
||||
break;
|
||||
case 1:
|
||||
DEMOPrintf(text_x, text_y, 0, "%s: %8d\n", DemoStat[i].text, tcReq);
|
||||
break;
|
||||
case 2:
|
||||
DEMOPrintf(text_x, text_y, 0, "%s: %8d\n", DemoStat[i].text, cpuRdReq);
|
||||
break;
|
||||
case 3:
|
||||
DEMOPrintf(text_x, text_y, 0, "%s: %8d\n", DemoStat[i].text, cpuWrReq);
|
||||
break;
|
||||
case 4:
|
||||
DEMOPrintf(text_x, text_y, 0, "%s: %8d\n", DemoStat[i].text, dspReq);
|
||||
break;
|
||||
case 5:
|
||||
DEMOPrintf(text_x, text_y, 0, "%s: %8d\n", DemoStat[i].text, ioReq);
|
||||
break;
|
||||
case 6:
|
||||
DEMOPrintf(text_x, text_y, 0, "%s: %8d\n", DemoStat[i].text, viReq);
|
||||
break;
|
||||
case 7:
|
||||
DEMOPrintf(text_x, text_y, 0, "%s: %8d\n", DemoStat[i].text, peReq);
|
||||
break;
|
||||
case 8:
|
||||
DEMOPrintf(text_x, text_y, 0, "%s: %8d\n", DemoStat[i].text, rfReq);
|
||||
break;
|
||||
case 9:
|
||||
DEMOPrintf(text_x, text_y, 0, "%s: %8d\n", DemoStat[i].text, fiReq);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case DEMO_STAT_GP0:
|
||||
case DEMO_STAT_GP1:
|
||||
case DEMO_STAT_MYC:
|
||||
DEMOPrintf(text_x, text_y, 0, "%s: %8d", DemoStat[i].text, DemoStat[i].count);
|
||||
break;
|
||||
case DEMO_STAT_MYR:
|
||||
rate = DemoStat[i].stat / (float)DemoStat[i].count;
|
||||
DEMOPrintf(text_x, text_y, 0, "%s: %8.3f", DemoStat[i].text, rate);
|
||||
break;
|
||||
default:
|
||||
OSReport("Undefined stat type %d in DEMOPrintStats()\n", DemoStat[i].stat_type);
|
||||
break;
|
||||
}
|
||||
text_y += text_yinc;
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue