commit
5ca4ead178
8 changed files with 407 additions and 50 deletions
|
|
@ -2197,7 +2197,7 @@ fn_800BB33C = .text:0x800BB33C; // type:function size:0x48
|
|||
__DBExceptionDestination = .text:0x800BB384; // type:function size:0x10 scope:global
|
||||
__DBIsExceptionMarked = .text:0x800BB394; // type:function size:0x1C scope:global
|
||||
DBPrintf = .text:0x800BB3B0; // type:function size:0x50 scope:global
|
||||
fn_800BB400 = .text:0x800BB400; // type:function size:0x2C
|
||||
PSMTXIdentity = .text:0x800BB400; // type:function size:0x2C
|
||||
fn_800BB42C = .text:0x800BB42C; // type:function size:0x34
|
||||
fn_800BB460 = .text:0x800BB460; // type:function size:0xCC
|
||||
fn_800BB52C = .text:0x800BB52C; // type:function size:0x50
|
||||
|
|
@ -2215,7 +2215,7 @@ fn_800BBCB0 = .text:0x800BBCB0; // type:function size:0x54
|
|||
fn_800BBD04 = .text:0x800BBD04; // type:function size:0x8C
|
||||
fn_800BBD90 = .text:0x800BBD90; // type:function size:0x54
|
||||
fn_800BBDE4 = .text:0x800BBDE4; // type:function size:0xD0
|
||||
fn_800BBEB4 = .text:0x800BBEB4; // type:function size:0x98
|
||||
C_MTXOrtho = .text:0x800BBEB4; // type:function size:0x98
|
||||
fn_800BBF4C = .text:0x800BBF4C; // type:function size:0x24
|
||||
PSVECSubtract = .text:0x800BBF70; // type:function size:0x24
|
||||
fn_800BBF94 = .text:0x800BBF94; // type:function size:0x1C
|
||||
|
|
@ -2335,7 +2335,7 @@ fn_800C2630 = .text:0x800C2630; // type:function size:0x6C
|
|||
fn_800C269C = .text:0x800C269C; // type:function size:0x7C
|
||||
fn_800C2718 = .text:0x800C2718; // type:function size:0x8
|
||||
fn_800C2720 = .text:0x800C2720; // type:function size:0x68
|
||||
fn_800C2788 = .text:0x800C2788; // type:function size:0xA8
|
||||
VIGetNextField = .text:0x800C2788; // type:function size:0xA8
|
||||
VIGetCurrentLine = .text:0x800C2830; // type:function size:0x98
|
||||
VIGetTvFormat = .text:0x800C28C8; // type:function size:0x7C scope:global
|
||||
VIGetDTVStatus = .text:0x800C2944; // type:function size:0x3C
|
||||
|
|
@ -2441,16 +2441,16 @@ fn_800C95E8 = .text:0x800C95E8; // type:function size:0xFC
|
|||
fn_800C96E4 = .text:0x800C96E4; // type:function size:0x8
|
||||
fn_800C96EC = .text:0x800C96EC; // type:function size:0x8
|
||||
fn_800C96F4 = .text:0x800C96F4; // type:function size:0x158
|
||||
fn_800C984C = .text:0x800C984C; // type:function size:0x360
|
||||
GXSetVtxDesc = .text:0x800C984C; // type:function size:0x360
|
||||
fn_800C9BAC = .text:0x800C9BAC; // type:function size:0x54
|
||||
fn_800C9C00 = .text:0x800C9C00; // type:function size:0x124
|
||||
fn_800C9D24 = .text:0x800C9D24; // type:function size:0x4C
|
||||
fn_800C9D70 = .text:0x800C9D70; // type:function size:0x35C
|
||||
GXClearVtxDesc = .text:0x800C9D24; // type:function size:0x4C
|
||||
GXSetVtxAttrFmt = .text:0x800C9D70; // type:function size:0x35C
|
||||
fn_800CA0CC = .text:0x800CA0CC; // type:function size:0x9C
|
||||
fn_800CA168 = .text:0x800CA168; // type:function size:0x8C
|
||||
GXSetArray = .text:0x800CA168; // type:function size:0x8C
|
||||
fn_800CA1F4 = .text:0x800CA1F4; // type:function size:0x10
|
||||
fn_800CA204 = .text:0x800CA204; // type:function size:0x2D0
|
||||
fn_800CA4D4 = .text:0x800CA4D4; // type:function size:0x48
|
||||
GXSetTexCoordGen2 = .text:0x800CA204; // type:function size:0x2D0
|
||||
GXSetNumTexGens = .text:0x800CA4D4; // type:function size:0x48
|
||||
GXSetMisc = .text:0x800CA51C; // type:function size:0x78 scope:global
|
||||
fn_800CA594 = .text:0x800CA594; // type:function size:0x5C
|
||||
fn_800CA5F0 = .text:0x800CA5F0; // type:function size:0x34
|
||||
|
|
@ -2473,7 +2473,7 @@ fn_800CAAB4 = .text:0x800CAAB4; // type:function size:0x88
|
|||
fn_800CAB3C = .text:0x800CAB3C; // type:function size:0x84
|
||||
__GXPEInit = .text:0x800CABC0; // type:function size:0x80 scope:global
|
||||
fn_800CAC40 = .text:0x800CAC40; // type:function size:0xA0
|
||||
fn_800CACE0 = .text:0x800CACE0; // type:function size:0xF0
|
||||
GXBegin = .text:0x800CACE0; // type:function size:0xF0
|
||||
fn_800CADD0 = .text:0x800CADD0; // type:function size:0x88
|
||||
fn_800CAE58 = .text:0x800CAE58; // type:function size:0x58
|
||||
fn_800CAEB0 = .text:0x800CAEB0; // type:function size:0x54
|
||||
|
|
@ -2506,21 +2506,21 @@ fn_800CBF50 = .text:0x800CBF50; // type:function size:0x28
|
|||
fn_800CBF78 = .text:0x800CBF78; // type:function size:0x148
|
||||
fn_800CC0C0 = .text:0x800CC0C0; // type:function size:0x168
|
||||
fn_800CC228 = .text:0x800CC228; // type:function size:0x168
|
||||
fn_800CC390 = .text:0x800CC390; // type:function size:0x4C
|
||||
fn_800CC3DC = .text:0x800CC3DC; // type:function size:0x1E4
|
||||
GXSetNumChans = .text:0x800CC390; // type:function size:0x4C
|
||||
GXSetChanCtrl = .text:0x800CC3DC; // type:function size:0x1E4
|
||||
fn_800CC5C0 = .text:0x800CC5C0; // type:function size:0x15C
|
||||
fn_800CC71C = .text:0x800CC71C; // type:function size:0xC8
|
||||
fn_800CC7E4 = .text:0x800CC7E4; // type:function size:0x274
|
||||
GXInitTexObj = .text:0x800CC7E4; // type:function size:0x274
|
||||
fn_800CCA58 = .text:0x800CCA58; // type:function size:0x48
|
||||
fn_800CCAA0 = .text:0x800CCAA0; // type:function size:0x194
|
||||
GXInitTexObjLOD = .text:0x800CCAA0; // type:function size:0x194
|
||||
fn_800CCC34 = .text:0x800CCC34; // type:function size:0x8
|
||||
fn_800CCC3C = .text:0x800CCC3C; // type:function size:0x1A8
|
||||
fn_800CCDE4 = .text:0x800CCDE4; // type:function size:0x54
|
||||
GXLoadTexObj = .text:0x800CCDE4; // type:function size:0x54
|
||||
fn_800CCE38 = .text:0x800CCE38; // type:function size:0x48
|
||||
fn_800CCE80 = .text:0x800CCE80; // type:function size:0x9C
|
||||
GXInitTexCacheRegion = .text:0x800CCF1C; // type:function size:0x120 scope:global
|
||||
GXInitTlutRegion = .text:0x800CD03C; // type:function size:0x48 scope:global
|
||||
fn_800CD084 = .text:0x800CD084; // type:function size:0x48
|
||||
GXInvalidateTexAll = .text:0x800CD084; // type:function size:0x48
|
||||
fn_800CD0CC = .text:0x800CD0CC; // type:function size:0x14
|
||||
fn_800CD0E0 = .text:0x800CD0E0; // type:function size:0x14
|
||||
fn_800CD0F4 = .text:0x800CD0F4; // type:function size:0x9C
|
||||
|
|
@ -2537,29 +2537,29 @@ fn_800CDB94 = .text:0x800CDB94; // type:function size:0x64
|
|||
fn_800CDBF8 = .text:0x800CDBF8; // type:function size:0x1AC
|
||||
fn_800CDDA4 = .text:0x800CDDA4; // type:function size:0xCC
|
||||
__GXFlushTextureState = .text:0x800CDE70; // type:function size:0x24 scope:global
|
||||
fn_800CDE94 = .text:0x800CDE94; // type:function size:0x1A4
|
||||
fn_800CE038 = .text:0x800CE038; // type:function size:0x80
|
||||
fn_800CE0B8 = .text:0x800CE0B8; // type:function size:0x84
|
||||
fn_800CE13C = .text:0x800CE13C; // type:function size:0xC0
|
||||
fn_800CE1FC = .text:0x800CE1FC; // type:function size:0xC0
|
||||
fn_800CE2BC = .text:0x800CE2BC; // type:function size:0x74
|
||||
GXSetTevOp = .text:0x800CDE94; // type:function size:0x1A4
|
||||
GXSetTevColorIn = .text:0x800CE038; // type:function size:0x80
|
||||
GXSetTevAlphaIn = .text:0x800CE0B8; // type:function size:0x84
|
||||
GXSetTevColorOp = .text:0x800CE13C; // type:function size:0xC0
|
||||
GXSetTevAlphaOp = .text:0x800CE1FC; // type:function size:0xC0
|
||||
GXSetTevColor = .text:0x800CE2BC; // type:function size:0x74
|
||||
fn_800CE330 = .text:0x800CE330; // type:function size:0x74
|
||||
fn_800CE3A4 = .text:0x800CE3A4; // type:function size:0x74
|
||||
fn_800CE418 = .text:0x800CE418; // type:function size:0x6C
|
||||
fn_800CE484 = .text:0x800CE484; // type:function size:0x6C
|
||||
fn_800CE4F0 = .text:0x800CE4F0; // type:function size:0x58
|
||||
fn_800CE548 = .text:0x800CE548; // type:function size:0xA0
|
||||
fn_800CE5E8 = .text:0x800CE5E8; // type:function size:0x50
|
||||
GXSetAlphaCompare = .text:0x800CE5E8; // type:function size:0x50
|
||||
fn_800CE638 = .text:0x800CE638; // type:function size:0x84
|
||||
fn_800CE6BC = .text:0x800CE6BC; // type:function size:0x1DC
|
||||
fn_800CE898 = .text:0x800CE898; // type:function size:0x34
|
||||
GXSetTevOrder = .text:0x800CE6BC; // type:function size:0x1DC
|
||||
GXSetNumTevStages = .text:0x800CE898; // type:function size:0x34
|
||||
fn_800CE8CC = .text:0x800CE8CC; // type:function size:0x1B0
|
||||
fn_800CEA7C = .text:0x800CEA7C; // type:function size:0x100
|
||||
fn_800CEB7C = .text:0x800CEB7C; // type:function size:0x104
|
||||
fn_800CEC80 = .text:0x800CEC80; // type:function size:0x40
|
||||
fn_800CECC0 = .text:0x800CECC0; // type:function size:0x40
|
||||
fn_800CED00 = .text:0x800CED00; // type:function size:0x78
|
||||
fn_800CED78 = .text:0x800CED78; // type:function size:0x40
|
||||
GXSetBlendMode = .text:0x800CEB7C; // type:function size:0x104
|
||||
GXSetColorUpdate = .text:0x800CEC80; // type:function size:0x40
|
||||
GXSetAlphaUpdate = .text:0x800CECC0; // type:function size:0x40
|
||||
GXSetZMode = .text:0x800CED00; // type:function size:0x78
|
||||
GXSetZCompLoc = .text:0x800CED78; // type:function size:0x40
|
||||
fn_800CEDB8 = .text:0x800CEDB8; // type:function size:0x110
|
||||
fn_800CEEC8 = .text:0x800CEEC8; // type:function size:0x40
|
||||
fn_800CEF08 = .text:0x800CEF08; // type:function size:0x54
|
||||
|
|
@ -2570,19 +2570,19 @@ fn_800CF018 = .text:0x800CF018; // type:function size:0xC8
|
|||
fn_800CF0E0 = .text:0x800CF0E0; // type:function size:0xD4
|
||||
fn_800CF1B4 = .text:0x800CF1B4; // type:function size:0x70
|
||||
fn_800CF224 = .text:0x800CF224; // type:function size:0x174
|
||||
fn_800CF398 = .text:0x800CF398; // type:function size:0xD4
|
||||
GXSetProjection = .text:0x800CF398; // type:function size:0xD4
|
||||
fn_800CF46C = .text:0x800CF46C; // type:function size:0x78
|
||||
fn_800CF4E4 = .text:0x800CF4E4; // type:function size:0x34
|
||||
fn_800CF518 = .text:0x800CF518; // type:function size:0x34
|
||||
fn_800CF54C = .text:0x800CF54C; // type:function size:0x24
|
||||
fn_800CF570 = .text:0x800CF570; // type:function size:0x3C
|
||||
GXLoadPosMtxImm = .text:0x800CF570; // type:function size:0x3C
|
||||
fn_800CF5AC = .text:0x800CF5AC; // type:function size:0x40
|
||||
fn_800CF5EC = .text:0x800CF5EC; // type:function size:0x3C
|
||||
GXSetCurrentMtx = .text:0x800CF5EC; // type:function size:0x3C
|
||||
fn_800CF628 = .text:0x800CF628; // type:function size:0x84
|
||||
fn_800CF6AC = .text:0x800CF6AC; // type:function size:0x11C
|
||||
fn_800CF7C8 = .text:0x800CF7C8; // type:function size:0x24
|
||||
GXSetViewportJitter = .text:0x800CF6AC; // type:function size:0x11C
|
||||
GXSetViewport = .text:0x800CF7C8; // type:function size:0x24
|
||||
fn_800CF7EC = .text:0x800CF7EC; // type:function size:0x4C
|
||||
fn_800CF838 = .text:0x800CF838; // type:function size:0xB0
|
||||
GXSetScissor = .text:0x800CF838; // type:function size:0xB0
|
||||
fn_800CF8E8 = .text:0x800CF8E8; // type:function size:0x44
|
||||
fn_800CF92C = .text:0x800CF92C; // type:function size:0x28
|
||||
fn_800CF954 = .text:0x800CF954; // type:function size:0x84
|
||||
|
|
@ -4843,7 +4843,7 @@ lbl_80121E00 = .data:0x80121E00; // type:object size:0x150
|
|||
HeapSizeTbl = .data:0x80121F50; // type:object size:0x78 scope:local
|
||||
lbl_80121FC8 = .data:0x80121FC8; // type:object size:0x50
|
||||
lbl_80122018 = .data:0x80122018; // type:object size:0x128
|
||||
fcoltbl = .data:0x80122140; // type:object size:0x40 align:32
|
||||
fcoltbl = .data:0x80122140; // type:object size:0x40 scope:local align:32
|
||||
lbl_80122180 = .data:0x80122180; // type:object size:0x1F data:string
|
||||
lbl_8012219F = .data:0x8012219F; // type:object size:0x31
|
||||
lbl_801221D0 = .data:0x801221D0; // type:object size:0x12
|
||||
|
|
@ -4866,7 +4866,7 @@ jumptable_80122528 = .data:0x80122528; // type:object size:0x28 scope:local
|
|||
lbl_80122550 = .data:0x80122550; // type:object size:0x19 data:string
|
||||
lbl_80122569 = .data:0x80122569; // type:object size:0xA data:string
|
||||
lbl_80122573 = .data:0x80122573; // type:object size:0x2D
|
||||
refMapData0 = .data:0x801225A0; // type:object size:0xAFC0
|
||||
refMapData0 = .data:0x801225A0; // type:object size:0xAFC0 noreloc
|
||||
lbl_8012D560 = .data:0x8012D560; // type:object size:0x1B data:string
|
||||
lbl_8012D57B = .data:0x8012D57B; // type:object size:0x16 data:string
|
||||
lbl_8012D591 = .data:0x8012D591; // type:object size:0x21 data:string
|
||||
|
|
@ -5953,7 +5953,7 @@ lbl_801D3B10 = .sbss:0x801D3B10; // type:object size:0x4 data:4byte
|
|||
lbl_801D3B14 = .sbss:0x801D3B14; // type:object size:0x4 data:4byte
|
||||
lbl_801D3B18 = .sbss:0x801D3B18; // type:object size:0x4 data:4byte
|
||||
currentHeapHandle = .sbss:0x801D3B1C; // type:object size:0x4 data:4byte
|
||||
lbl_801D3B20 = .sbss:0x801D3B20; // type:object size:0x8 data:4byte
|
||||
RenderMode = .sbss:0x801D3B20; // type:object size:0x8 data:4byte
|
||||
saftyFrameF = .sbss:0x801D3B28; // type:object size:0x4 data:4byte
|
||||
strlinecnt = .sbss:0x801D3B2C; // type:object size:0x2 data:2byte
|
||||
empstrline = .sbss:0x801D3B2E; // type:object size:0x2 data:2byte
|
||||
|
|
|
|||
|
|
@ -173,7 +173,9 @@ cflags_runtime = [
|
|||
cflags_rel = [
|
||||
*cflags_base,
|
||||
"-O0,s",
|
||||
"-enum int",
|
||||
"-char unsigned",
|
||||
"-fp_contract off",
|
||||
"-sdata 0",
|
||||
"-sdata2 0",
|
||||
"-pool off",
|
||||
|
|
@ -183,7 +185,9 @@ cflags_rel = [
|
|||
cflags_game = [
|
||||
*cflags_base,
|
||||
"-O0,p",
|
||||
"-enum int",
|
||||
"-char unsigned",
|
||||
"-fp_contract off",
|
||||
]
|
||||
|
||||
config.linker_version = "GC/2.6"
|
||||
|
|
@ -234,7 +238,7 @@ config.libs = [
|
|||
Object(NonMatching, "game/jmp.c"),
|
||||
Object(Matching, "game/malloc.c"),
|
||||
Object(Matching, "game/memory.c"),
|
||||
Object(NonMatching, "game/printfunc.c"),
|
||||
Object(Matching, "game/printfunc.c"),
|
||||
Object(Matching, "game/process.c"),
|
||||
Object(NonMatching, "game/sprman.c"),
|
||||
Object(NonMatching, "game/sprput.c"),
|
||||
|
|
|
|||
|
|
@ -86,6 +86,11 @@ static inline void GXPosition2f32(const f32 x, const f32 y) {
|
|||
GXWGFifo.f32 = y;
|
||||
}
|
||||
|
||||
static inline void GXPosition2s16(const s16 x, const s16 y) {
|
||||
GXWGFifo.s16 = x;
|
||||
GXWGFifo.s16 = y;
|
||||
}
|
||||
|
||||
static inline void GXPosition3s16(const s16 x, const s16 y, const s16 z) {
|
||||
GXWGFifo.s16 = x;
|
||||
GXWGFifo.s16 = y;
|
||||
|
|
@ -108,6 +113,12 @@ static inline void GXColor1u32(const u32 v) {
|
|||
GXWGFifo.u32 = v;
|
||||
}
|
||||
|
||||
static inline void GXColor3u8(const u8 r, const u8 g, const u8 b) {
|
||||
GXWGFifo.u8 = r;
|
||||
GXWGFifo.u8 = g;
|
||||
GXWGFifo.u8 = b;
|
||||
}
|
||||
|
||||
static inline void GXColor4u8(const u8 r, const u8 g, const u8 b, const u8 a) {
|
||||
GXWGFifo.u8 = r;
|
||||
GXWGFifo.u8 = g;
|
||||
|
|
@ -125,11 +136,14 @@ static inline void GXTexCoord2f32(const f32 u, const f32 v) {
|
|||
GXWGFifo.f32 = v;
|
||||
}
|
||||
|
||||
|
||||
static inline void GXPosition1x8(u8 index) {
|
||||
GXWGFifo.u8 = index;
|
||||
}
|
||||
|
||||
static inline void GXColor1x8(u8 index) {
|
||||
GXWGFifo.u8 = index;
|
||||
}
|
||||
|
||||
static inline void GXEnd(void) {}
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@
|
|||
|
||||
#include "types.h"
|
||||
#include "common_structs.h"
|
||||
#include "dolphin/gx/GXStruct.h"
|
||||
|
||||
void Hu3DBGColorSet(u8, u8, u8);
|
||||
void Hu3DCameraCreate(s16);
|
||||
|
|
@ -67,6 +68,10 @@ void omOvlGotoEx(int id, s16 end_mode, int stat, int event);
|
|||
void omOvlReturnEx(int level, s16 end_mode);
|
||||
void WipeCreate(char dir, char type, short duration);
|
||||
|
||||
u16 print8(s16 x, s16 y, float scale, char *str, ...);
|
||||
void pfInit(void);
|
||||
void pfClsScr(void);
|
||||
s16 print8(s16 x, s16 y, float scale, char *str, ...);
|
||||
s16 printWin(s16 x, s16 y, s16 w, s16 h, GXColor *color);
|
||||
void pfDrawFonts(void);
|
||||
|
||||
#endif
|
||||
|
|
|
|||
19
include/stdarg.h
Normal file
19
include/stdarg.h
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
#ifndef STDARG_H
|
||||
#define STDARG_H
|
||||
|
||||
typedef struct {
|
||||
char gpr;
|
||||
char fpr;
|
||||
char reserved[2];
|
||||
char* input_arg_area;
|
||||
char* reg_save_area;
|
||||
} __va_list[1];
|
||||
typedef __va_list va_list;
|
||||
|
||||
void* __va_arg(va_list v_list, unsigned char type);
|
||||
|
||||
#define va_start(ap, fmt) ((void) fmt, __builtin_va_info(&ap))
|
||||
#define va_arg(ap, t) (*((t*) __va_arg(ap, _var_arg_typeof(t))))
|
||||
#define va_end(ap) (void) 0
|
||||
|
||||
#endif
|
||||
12
include/stdio.h
Normal file
12
include/stdio.h
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
#ifndef _STDIO_H_
|
||||
#define _STDIO_H_
|
||||
|
||||
#include "stdarg.h"
|
||||
|
||||
int puts(const char* s);
|
||||
int printf(const char*, ...);
|
||||
int sprintf(char* s, const char* format, ...);
|
||||
int vprintf(const char* format, va_list arg);
|
||||
int vsprintf(char* s, const char* format, va_list arg);
|
||||
|
||||
#endif
|
||||
|
|
@ -4,11 +4,13 @@
|
|||
#include "types.h"
|
||||
#include "common_structs.h"
|
||||
#include "dolphin/os.h"
|
||||
#include "dolphin/gx/GXStruct.h"
|
||||
|
||||
extern u16 HuPadBtnDown[4];
|
||||
extern u8 HuPadDStk[4];
|
||||
|
||||
extern OSHeapHandle currentHeapHandle;
|
||||
extern GXRenderModeObj *RenderMode;
|
||||
|
||||
extern BOOL saftyFrameF;
|
||||
extern u16 strlinecnt;
|
||||
|
|
|
|||
|
|
@ -1,28 +1,53 @@
|
|||
#include "common.h"
|
||||
#include "dolphin/mtx.h"
|
||||
#include "dolphin/gx.h"
|
||||
#include "dolphin/vi.h"
|
||||
#include "stdio.h"
|
||||
#include "stdarg.h"
|
||||
|
||||
extern u8 ank8x8_4b[];
|
||||
|
||||
struct strline_data {
|
||||
u16 type;
|
||||
u16 last_idx;
|
||||
u16 color;
|
||||
s16 x;
|
||||
s16 y;
|
||||
s16 w;
|
||||
s16 h;
|
||||
s16 empty_line;
|
||||
s16 empstrline_next;
|
||||
float scale;
|
||||
char str[80];
|
||||
GXColor color;
|
||||
GXColor win_color;
|
||||
};
|
||||
|
||||
static struct strline_data strline[256];
|
||||
static char pfStrBuf[256];
|
||||
|
||||
BOOL saftyFrameF;
|
||||
u16 strlinecnt;
|
||||
u16 empstrline;
|
||||
int fontcolor;
|
||||
u16 empstrline;
|
||||
u16 strlinecnt;
|
||||
BOOL saftyFrameF;
|
||||
|
||||
void pfClsScr(void);
|
||||
static void WireDraw(void);
|
||||
|
||||
static GXColor ATTRIBUTE_ALIGN(32) fcoltbl[16] = {
|
||||
{ 0, 0, 0, 255 },
|
||||
{ 0, 0, 128, 255 },
|
||||
{ 128, 0, 0, 255 },
|
||||
{ 128, 0, 128, 255 },
|
||||
{ 0, 128, 0, 255 },
|
||||
{ 0, 128, 128, 255 },
|
||||
{ 128, 128, 0, 255 },
|
||||
{ 128, 128, 128, 255 },
|
||||
{ 128, 128, 128, 128 },
|
||||
{ 0, 0, 255, 255 },
|
||||
{ 255, 0, 0, 255 },
|
||||
{ 255, 0, 255, 255 },
|
||||
{ 0, 255, 0, 255 },
|
||||
{ 0, 255, 255, 255 },
|
||||
{ 255, 255, 0, 255 },
|
||||
{ 255, 255, 255, 255 }
|
||||
};
|
||||
|
||||
void pfInit(void)
|
||||
{
|
||||
|
|
@ -42,10 +67,286 @@ void pfClsScr(void)
|
|||
empstrline = 0;
|
||||
strlinecnt = 0;
|
||||
for (i = 0; i < 256; i++) {
|
||||
strline[i].empty_line = i+1;
|
||||
strline[i].empstrline_next = i+1;
|
||||
strline[i].type = 0;
|
||||
if (strline[i].str[0] != 0) {
|
||||
strline[i].str[0] = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
s16 print8(s16 x, s16 y, float scale, char *str, ...)
|
||||
{
|
||||
struct strline_data *strline_curr;
|
||||
char *src = pfStrBuf;
|
||||
char *dst;
|
||||
s16 ret;
|
||||
va_list list;
|
||||
strline_curr = &strline[empstrline];
|
||||
if(strlinecnt >= 256) {
|
||||
return -1;
|
||||
}
|
||||
va_start(list, str);
|
||||
vsprintf(pfStrBuf, str, list);
|
||||
strlinecnt++;
|
||||
ret = empstrline;
|
||||
empstrline = strline_curr->empstrline_next;
|
||||
strline_curr->type = 0;
|
||||
strline_curr->color = fontcolor;
|
||||
strline_curr->x = x;
|
||||
strline_curr->y = y;
|
||||
strline_curr->scale = scale;
|
||||
dst = strline_curr->str;
|
||||
while(*src) {
|
||||
*dst++ = *src++;
|
||||
}
|
||||
*dst = 0;
|
||||
va_end(list);
|
||||
return ret;
|
||||
}
|
||||
|
||||
s16 printWin(s16 x, s16 y, s16 w, s16 h, GXColor *color)
|
||||
{
|
||||
struct strline_data *strline_curr;
|
||||
s16 ret;
|
||||
char *src = pfStrBuf;
|
||||
strline_curr = &strline[empstrline];
|
||||
if(strlinecnt >= 256) {
|
||||
return -1;
|
||||
}
|
||||
strlinecnt++;
|
||||
ret = empstrline;
|
||||
empstrline = strline_curr->empstrline_next;
|
||||
strline_curr->type = 1;
|
||||
strline_curr->win_color.r = color->r;
|
||||
strline_curr->win_color.g = color->g;
|
||||
strline_curr->win_color.b = color->b;
|
||||
strline_curr->win_color.a = color->a;
|
||||
strline_curr->x = x;
|
||||
strline_curr->y = y;
|
||||
strline_curr->w = w;
|
||||
strline_curr->h = h;
|
||||
return ret;
|
||||
}
|
||||
|
||||
void pfDrawFonts(void)
|
||||
{
|
||||
GXTexObj font_tex;
|
||||
Mtx44 proj;
|
||||
Mtx modelview;
|
||||
int i;
|
||||
s16 x, y, w, h;
|
||||
|
||||
u16 strline_count = strlinecnt;
|
||||
if(saftyFrameF) {
|
||||
WireDraw();
|
||||
}
|
||||
MTXOrtho(proj, 0, 480, 0, 640, 0, 10);
|
||||
GXSetProjection(proj, GX_ORTHOGRAPHIC);
|
||||
MTXIdentity(modelview);
|
||||
GXLoadPosMtxImm(modelview, GX_PNMTX0);
|
||||
GXSetCurrentMtx(GX_PNMTX0);
|
||||
GXSetViewport(0, 0, RenderMode->fbWidth, RenderMode->efbHeight, 0, 1);
|
||||
GXSetScissor(0, 0, RenderMode->fbWidth, RenderMode->efbHeight);
|
||||
GXClearVtxDesc();
|
||||
GXSetVtxDesc(GX_VA_POS, GX_DIRECT);
|
||||
GXSetVtxDesc(GX_VA_CLR0, GX_INDEX8);
|
||||
GXSetVtxDesc(GX_VA_TEX0, GX_DIRECT);
|
||||
GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_POS, GX_POS_XYZ, GX_S16, 0);
|
||||
GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_CLR0, GX_CLR_RGBA, GX_RGBA8, 0);
|
||||
GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_TEX0, GX_TEX_ST, GX_F32, 0);
|
||||
GXSetArray(GX_VA_CLR0, fcoltbl, sizeof(GXColor));
|
||||
GXSetZMode(GX_FALSE, GX_ALWAYS, GX_FALSE);
|
||||
GXInvalidateTexAll();
|
||||
GXInitTexObj(&font_tex, ank8x8_4b, 128, 128, GX_TF_I4, GX_CLAMP, GX_CLAMP, GX_FALSE);
|
||||
GXInitTexObjLOD(&font_tex, GX_NEAR, GX_NEAR, 0, 0, 0, GX_FALSE, GX_FALSE, GX_ANISO_1);
|
||||
GXLoadTexObj(&font_tex, GX_TEXMAP0);
|
||||
GXSetNumTevStages(1);
|
||||
GXSetNumTexGens(1);
|
||||
GXSetTevOrder(GX_TEVSTAGE0, GX_TEXCOORD0, GX_TEXMAP0, GX_COLOR0A0);
|
||||
GXSetTexCoordGen(GX_TEXCOORD0, GX_TG_MTX2x4, GX_TG_TEX0, GX_IDENTITY);
|
||||
GXSetTevOp(GX_TEVSTAGE0, GX_MODULATE);
|
||||
GXSetNumChans(1);
|
||||
GXSetChanCtrl(GX_COLOR0A0, GX_FALSE, GX_SRC_VTX, GX_SRC_VTX, GX_LIGHT0, GX_DF_CLAMP, GX_AF_SPOT);
|
||||
GXSetZCompLoc(GX_FALSE);
|
||||
GXSetAlphaCompare(GX_GEQUAL, 1, GX_AOP_AND, GX_GEQUAL, 1);
|
||||
GXSetBlendMode(GX_BM_BLEND, GX_BL_SRCALPHA, GX_BL_INVSRCALPHA, GX_LO_NOOP);
|
||||
GXSetAlphaUpdate(GX_TRUE);
|
||||
for(i=0; i<256; i++) {
|
||||
x = strline[i].x;
|
||||
y = strline[i].y;
|
||||
if(strline[i].type == 1) {
|
||||
w = strline[i].w;
|
||||
h = strline[i].h;
|
||||
GXClearVtxDesc();
|
||||
GXSetVtxDesc(GX_VA_POS, GX_DIRECT);
|
||||
GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_POS, GX_POS_XY, GX_S16, 0);
|
||||
GXSetTevColor(GX_TEVREG0, strline[i].win_color);
|
||||
GXSetTevOrder(GX_TEVSTAGE0, GX_TEXCOORD_NULL, GX_TEXMAP_NULL, GX_COLOR0A0);
|
||||
GXSetTevColorIn(GX_TEVSTAGE0, GX_CC_C0, GX_CC_ZERO, GX_CC_ZERO, GX_CC_ZERO);
|
||||
GXSetTevColorOp(GX_TEVSTAGE0, GX_TEV_ADD, GX_TB_ZERO, GX_CS_SCALE_1, GX_TRUE, GX_TEVPREV);
|
||||
GXSetTevAlphaIn(GX_TEVSTAGE0, GX_CA_A0, GX_CA_ZERO, GX_CA_ZERO, GX_CA_ZERO);
|
||||
GXSetTevAlphaOp(GX_TEVSTAGE0, GX_TEV_ADD, GX_TB_ZERO, GX_CS_SCALE_1, GX_TRUE, GX_TEVPREV);
|
||||
GXSetNumTevStages(1);
|
||||
GXSetNumTexGens(0);
|
||||
GXBegin(GX_QUADS, GX_VTXFMT0, 4);
|
||||
GXPosition2s16(x, y);
|
||||
GXPosition2s16(x+w, y);
|
||||
GXPosition2s16(x+w, y+h);
|
||||
GXPosition2s16(x, y+h);
|
||||
GXEnd();
|
||||
GXClearVtxDesc();
|
||||
GXSetVtxDesc(GX_VA_POS, GX_DIRECT);
|
||||
GXSetVtxDesc(GX_VA_CLR0, GX_INDEX8);
|
||||
GXSetVtxDesc(GX_VA_TEX0, GX_DIRECT);
|
||||
GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_POS, GX_POS_XYZ, GX_S16, 0);
|
||||
GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_CLR0, GX_CLR_RGBA, GX_RGBA8, 0);
|
||||
GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_TEX0, GX_TEX_ST, GX_F32, 0);
|
||||
GXSetArray(GX_VA_CLR0, fcoltbl, sizeof(GXColor));
|
||||
GXSetNumTevStages(1);
|
||||
GXSetNumTexGens(1);
|
||||
GXSetTevOrder(GX_TEVSTAGE0, GX_TEXCOORD0, GX_TEXMAP0, GX_COLOR0A0);
|
||||
GXSetTexCoordGen(GX_TEXCOORD0, GX_TG_MTX2x4, GX_TG_TEX0, GX_IDENTITY);
|
||||
GXSetTevOp(GX_TEVSTAGE0, GX_MODULATE);
|
||||
} else {
|
||||
if(strline[i].str[0] != '\0') {
|
||||
float shadow_ofs_x, shadow_ofs_y;
|
||||
float char_w;
|
||||
float char_h;
|
||||
float texcoord_x, texcoord_y;
|
||||
char *str;
|
||||
u16 color;
|
||||
s16 shadow_color;
|
||||
float scale;
|
||||
char_w = char_h = 8.0f*strline[i].scale;
|
||||
str = strline[i].str;
|
||||
color = strline[i].color;
|
||||
shadow_color = -1;
|
||||
scale = 1.0f;
|
||||
while(*str) {
|
||||
char c = *str++;
|
||||
switch(c) {
|
||||
case 255:
|
||||
c = *str++;
|
||||
scale = c/16.0f;
|
||||
char_w = 8.0f*strline[i].scale*scale;
|
||||
char_h = 8.0f*strline[i].scale*scale;
|
||||
break;
|
||||
|
||||
case 254:
|
||||
color = (*str++)-1;
|
||||
break;
|
||||
|
||||
case 253:
|
||||
shadow_color = (*str++)-1;
|
||||
shadow_ofs_x = 1.3333333f*strline[i].scale*scale;
|
||||
shadow_ofs_y = 1.3333333f*strline[i].scale*scale;
|
||||
break;
|
||||
|
||||
default:
|
||||
texcoord_x = (c%16)/16.0f;
|
||||
texcoord_y = ((c/16)/16.0f)+(1/128.0f);
|
||||
if(shadow_color < 0) {
|
||||
GXBegin(GX_QUADS, GX_VTXFMT0, 4);
|
||||
GXPosition3s16(x, y, 0);
|
||||
GXColor1x8(color);
|
||||
GXTexCoord2f32(texcoord_x, texcoord_y);
|
||||
GXPosition3s16(x+char_w, y, 0);
|
||||
GXColor1x8(color);
|
||||
GXTexCoord2f32(texcoord_x+(1/16.0f), texcoord_y);
|
||||
GXPosition3s16(x+char_w, y+char_h, 0);
|
||||
GXColor1x8(color);
|
||||
GXTexCoord2f32(texcoord_x+(1/16.0f), texcoord_y+(1/16.0f));
|
||||
GXPosition3s16(x, y+char_h, 0);
|
||||
GXColor1x8(color);
|
||||
GXTexCoord2f32(texcoord_x, texcoord_y+(1/16.0f));
|
||||
GXEnd();
|
||||
} else {
|
||||
GXBegin(GX_QUADS, GX_VTXFMT0, 8);
|
||||
GXPosition3s16(x+shadow_ofs_x, y+shadow_ofs_y, 0);
|
||||
GXColor1x8(shadow_color);
|
||||
GXTexCoord2f32(texcoord_x, texcoord_y);
|
||||
GXPosition3s16(x+char_w+shadow_ofs_x, y+shadow_ofs_y, 0);
|
||||
GXColor1x8(shadow_color);
|
||||
GXTexCoord2f32(texcoord_x+(1/16.0f), texcoord_y);
|
||||
GXPosition3s16(x+char_w+shadow_ofs_x, y+char_h+shadow_ofs_y, 0);
|
||||
GXColor1x8(shadow_color);
|
||||
GXTexCoord2f32(texcoord_x+(1/16.0f), texcoord_y+(1/16.0f));
|
||||
GXPosition3s16(x+shadow_ofs_x, y+char_h+shadow_ofs_y, 0);
|
||||
GXColor1x8(shadow_color);
|
||||
GXTexCoord2f32(texcoord_x, texcoord_y+(1/16.0f));
|
||||
GXPosition3s16(x, y, 0);
|
||||
GXColor1x8(color);
|
||||
GXTexCoord2f32(texcoord_x, texcoord_y);
|
||||
GXPosition3s16(x+char_w, y, 0);
|
||||
GXColor1x8(color);
|
||||
GXTexCoord2f32(texcoord_x+(1/16.0f), texcoord_y);
|
||||
GXPosition3s16(x+char_w, y+char_h, 0);
|
||||
GXColor1x8(color);
|
||||
GXTexCoord2f32(texcoord_x+(1/16.0f), texcoord_y+(1/16.0f));
|
||||
GXPosition3s16(x, y+char_h, 0);
|
||||
GXColor1x8(color);
|
||||
GXTexCoord2f32(texcoord_x, texcoord_y+(1/16.0f));
|
||||
GXEnd();
|
||||
}
|
||||
x += char_w;
|
||||
if(x > 640) {
|
||||
x = 0;
|
||||
y += char_h;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void WireDraw(void) //Is not private to prevent linker error due to analysis bug of refMapData0
|
||||
{
|
||||
Mtx44 proj;
|
||||
Mtx modelview;
|
||||
MTXOrtho(proj, 0, 480, 0, 576, 0, 10);
|
||||
GXSetProjection(proj, GX_ORTHOGRAPHIC);
|
||||
if(RenderMode->field_rendering) {
|
||||
GXSetViewportJitter(0, 0, 640, 480, 0, 1, VIGetNextField());
|
||||
} else {
|
||||
GXSetViewport(0, 0, 640, 480, 0, 1);
|
||||
}
|
||||
GXSetScissor(0, 0, 640, 480);
|
||||
GXClearVtxDesc();
|
||||
GXSetVtxDesc(GX_VA_POS, GX_DIRECT);
|
||||
GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_POS, GX_POS_XY, GX_F32, 0);
|
||||
GXSetVtxDesc(GX_VA_CLR0, GX_DIRECT);
|
||||
GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_CLR0, GX_CLR_RGB, GX_RGB8, 0);
|
||||
GXSetTevOrder(GX_TEVSTAGE0, GX_TEXCOORD_NULL, GX_TEXMAP_NULL, GX_COLOR0A0);
|
||||
GXSetTevColorIn(GX_TEVSTAGE0, GX_CC_RASC, GX_CC_ZERO, GX_CC_ZERO, GX_CC_ZERO);
|
||||
GXSetTevColorOp(GX_TEVSTAGE0, GX_TEV_ADD, GX_TB_ZERO, GX_CS_SCALE_1, GX_TRUE, GX_TEVPREV);
|
||||
GXSetTevAlphaIn(GX_TEVSTAGE0, GX_CA_KONST, GX_CA_ZERO, GX_CA_ZERO, GX_CA_ZERO);
|
||||
GXSetTevAlphaOp(GX_TEVSTAGE0, GX_TEV_ADD, GX_TB_ZERO, GX_CS_SCALE_1, GX_TRUE, GX_TEVPREV);
|
||||
GXSetNumTexGens(0);
|
||||
GXSetNumTevStages(1);
|
||||
GXSetZMode(GX_FALSE, GX_ALWAYS, GX_FALSE);
|
||||
GXSetNumChans(1);
|
||||
GXSetChanCtrl(GX_COLOR0A0, GX_FALSE, GX_SRC_REG, GX_SRC_VTX, GX_LIGHT_NULL, GX_DF_CLAMP, GX_AF_NONE);
|
||||
MTXIdentity(modelview);
|
||||
GXLoadPosMtxImm(modelview, GX_PNMTX0);
|
||||
GXBegin(GX_LINES, 0, 8);
|
||||
GXPosition2f32(16, 40);
|
||||
GXColor3u8(255, 0, 0);
|
||||
GXPosition2f32(16, 440);
|
||||
GXColor3u8(255, 0, 0);
|
||||
GXPosition2f32(16, 40);
|
||||
GXColor3u8(255, 0, 0);
|
||||
GXPosition2f32(560, 40);
|
||||
GXColor3u8(255, 0, 0);
|
||||
GXPosition2f32(560, 440);
|
||||
GXColor3u8(255, 0, 0);
|
||||
GXPosition2f32(560, 40);
|
||||
GXColor3u8(255, 0, 0);
|
||||
GXPosition2f32(560, 440);
|
||||
GXColor3u8(255, 0, 0);
|
||||
GXPosition2f32(16, 440);
|
||||
GXColor3u8(255, 0, 0);
|
||||
GXEnd();
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue