src/core1: various video/screen/framebuffer related documentations

neue Datei:     include/core1/vimgr.h
        umbenannt:      src/core1/code_E360.c -> src/core1/vimgr.c
This commit is contained in:
mariob92 2024-10-09 08:11:35 +02:00
parent 50138293a4
commit 6050ddbbd2
45 changed files with 398 additions and 368 deletions

View File

@ -163,7 +163,7 @@ segments:
- [0xF46500, c, code_8C50] - [0xF46500, c, code_8C50]
- [0xF475C0, c, code_ABB0] - [0xF475C0, c, code_ABB0]
- [0xF49870, c, code_CE60] - [0xF49870, c, code_CE60]
- [0xF4AD70, c, code_E360] - [0xF4AD70, c, vimgr]
- [0xF4B4C0, c, viewport] - [0xF4B4C0, c, viewport]
- [0xF4D3D0, c, pfsmanager] - [0xF4D3D0, c, pfsmanager]
- [0xF4E490, c, code_11AC0] - [0xF4E490, c, code_11AC0]
@ -375,7 +375,7 @@ segments:
- [0xF74AD0, .data, code_8C50] - [0xF74AD0, .data, code_8C50]
- [0xF74C60, .data, code_ABB0] - [0xF74C60, .data, code_ABB0]
- [0xF74C70, .data, code_CE60] - [0xF74C70, .data, code_CE60]
- [0xF74CE0, .data, code_E360] - [0xF74CE0, .data, vimgr]
- [0xF74DD0, .data, viewport] - [0xF74DD0, .data, viewport]
- [0xF74DE0, .data, pfsmanager] - [0xF74DE0, .data, pfsmanager]
- [0xF74DF0, .data, code_11AC0] - [0xF74DF0, .data, code_11AC0]
@ -465,7 +465,7 @@ segments:
- [0xF791D0, .bss, code_8C50] - [0xF791D0, .bss, code_8C50]
- [0xF791D0, .bss, code_ABB0] - [0xF791D0, .bss, code_ABB0]
- [0xF791D0, .bss, code_CE60] - [0xF791D0, .bss, code_CE60]
- [0xF791D0, .bss, code_E360] - [0xF791D0, .bss, vimgr]
- [0xF791D0, .bss, viewport] - [0xF791D0, .bss, viewport]
- [0xF791D0, .bss, pfsmanager] - [0xF791D0, .bss, pfsmanager]
- [0xF791D0, .bss, code_11AC0] - [0xF791D0, .bss, code_11AC0]

View File

@ -164,7 +164,7 @@ segments:
- [0xF22F80, c, code_9D30] #DONE - [0xF22F80, c, code_9D30] #DONE
- [0xF23E00, c, code_ABB0] #DONE - [0xF23E00, c, code_ABB0] #DONE
- [0xF260B0, c, code_CE60] #DONE - [0xF260B0, c, code_CE60] #DONE
- [0xF275B0, c, code_E360] #DONE - [0xF275B0, c, vimgr] #DONE
- [0xF27D40, c, viewport] #DONE - [0xF27D40, c, viewport] #DONE
- [0xF29C50, c,pfsmanager] - [0xF29C50, c,pfsmanager]
- [0xF2AD10, c, code_11AC0] #DONE - [0xF2AD10, c, code_11AC0] #DONE
@ -376,7 +376,7 @@ segments:
- [0xF51280, .data, code_9D30] - [0xF51280, .data, code_9D30]
- [0xF51430, .data, code_ABB0] - [0xF51430, .data, code_ABB0]
- [0xF51440, .data, code_CE60] - [0xF51440, .data, code_CE60]
- [0xF514B0, .data, code_E360] - [0xF514B0, .data, vimgr]
- [0xF51550, .data, viewport] - [0xF51550, .data, viewport]
- [0xF51560, .data, pfsmanager] - [0xF51560, .data, pfsmanager]
- [0xF51570, .data, code_11AC0] - [0xF51570, .data, code_11AC0]
@ -466,7 +466,7 @@ segments:
- [0xF55960, .bss, code_8C50] - [0xF55960, .bss, code_8C50]
- [0xF55960, .bss, code_ABB0] - [0xF55960, .bss, code_ABB0]
- [0xF55960, .bss, code_CE60] - [0xF55960, .bss, code_CE60]
- [0xF55960, .bss, code_E360] - [0xF55960, .bss, vimgr]
- [0xF55960, .bss, viewport] - [0xF55960, .bss, viewport]
- [0xF55960, .bss, pfsmanager] - [0xF55960, .bss, pfsmanager]
- [0xF55960, .bss, code_11AC0] - [0xF55960, .bss, code_11AC0]

View File

@ -3,6 +3,7 @@
#include <ultra64.h> #include <ultra64.h>
#include "bool.h" #include "bool.h"
#include "enums.h"
#include "core1/eeprom.h" #include "core1/eeprom.h"
#include "core1/main.h" #include "core1/main.h"
@ -12,8 +13,74 @@
#include "core1/sns.h" #include "core1/sns.h"
#include "core1/ucode.h" #include "core1/ucode.h"
#include "core1/viewport.h" #include "core1/viewport.h"
#include "core1/vimgr.h"
void mlMtx_apply_vec3f(f32[3], f32[3]); void mlMtx_apply_vec3f(f32[3], f32[3]);
void func_80252C08(f32 arg0[3], f32 arg1[3], f32 scale, f32 arg3[3]); void func_80252C08(f32 arg0[3], f32 arg1[3], f32 scale, f32 arg3[3]);
/* src/core1/code_15770.c */
extern u8 D_8000E800;
void func_80253190(Gfx **gfx);
void func_80253208(Gfx **gfx, s32 x, s32 y, s32 w, s32 h, void *color_buffer);
bool func_80253400(void);
bool depthBuffer_isPointerSet(void);
void depthBuffer_stub(void);
void func_80253428(int arg0);
void func_802534A8(int arg0);
void zBuffer_set(Gfx **gfx);
void *zBuffer_get(void);
/* src/core1/code_15B30.c */
typedef struct {
s32 unk0;
s32 unk4;
Gfx *unk8;
Gfx *unkC;
s32 unk10;
s32 unk14;
}Struct_Core1_15B30;
#define DEFAULT_FRAMEBUFFER_WIDTH 292
#define DEFAULT_FRAMEBUFFER_HEIGHT 216
extern s32 gFramebufferWidth;
extern s32 gFramebufferHeight;
extern u16 gFramebuffers[2][DEFAULT_FRAMEBUFFER_WIDTH * DEFAULT_FRAMEBUFFER_HEIGHT];
void func_80253550(void);
void func_8025357C(void);
void func_802535A8(Gfx **arg0, Gfx **arg1, UNK_TYPE(s32) arg2, UNK_TYPE(s32) arg3);
void func_80253640(Gfx ** gdl, void *arg1);
void scissorBox_SetForGameMode(Gfx **gdl, s32 framebuffer_idx);
void setupScissorBoxAndFramebuffer(Gfx **gfx, s32 framebuffer_address);
void setupDefaultScissorBoxAndFramebuffer(Gfx **gfx, s32 framebuffer_idx);
void func_80253DC0(Gfx **gfx);
void finishFrame(Gfx **gdl);
void func_80253E14(Gfx *arg0, Gfx *arg1, s32 arg2);
void func_80253EA4(Gfx *arg0, Gfx *arg1);
void func_80253EC4(Gfx *arg0, Gfx *arg1);
void func_80253EE4(Gfx **arg0, Gfx **arg1, s32 arg2);
void func_80253F74(Gfx **arg0, Gfx **arg1);
void func_80253F94(Gfx **arg0, Gfx **arg1);
void scissorBox_get(u32 *left, u32 *top, u32 *right, u32 *bottom);
void func_80253FE8(void);
void func_80254008(void);
void func_80254028(void);
void drawRectangle2D(Gfx **gfx, s32 x, s32 y, s32 w, s32 h, s32 r, s32 g, s32 b);
void graphicsCache_release(void);
void graphicsCache_init(void);
void scissorBox_set(s32 left, s32 top, s32 right, s32 bottom);
void scissorBox_setDefault(void);
void func_80254374(s32 arg0);
void toggleTextureFilterPoint(void);
void getGraphicsStacks(Gfx **gfx, Mtx **mtx, Vtx **vtx);
void dummy_func_80254464(void);
#endif #endif

28
include/core1/vimgr.h Normal file
View File

@ -0,0 +1,28 @@
#ifndef BANJO_KAZOOIE_CORE1_VIMGR_H
#define BANJO_KAZOOIE_CORE1_VIMGR_H
typedef struct struct_1_s{
OSMesgQueue *messageQueue;
OSMesg message;
} struct1;
u32 getOtherFramebuffer(void);
s32 viMgr_func_8024BD94(void);
s32 getActiveFramebuffer(void);
void viMgr_func_8024BDAC(OSMesgQueue *mq, OSMesg msg);
void viMgr_init(void);
void viMgr_func_8024BF94(s32 arg0);
s32 viMgr_func_8024BFA0(void);
void viMgr_func_8024BFAC(void);
void viMgr_func_8024BFD8(s32 arg0);
void viMgr_func_8024C1B4(void);
void viMgr_func_8024C1DC(void);
void viMgr_func_8024C1FC(OSMesgQueue *mq, OSMesg msg);
void viMgr_setActiveFramebuffer(s32 arg0);
void viMgr_entry(void *arg0);
void viMgr_setScreenBlack(s32 active);
void viMgr_clearFramebuffers(void);
s32 viMgr_func_8024C4E8(void);
void viMgr_func_8024C4F8(s32 arg0);
#endif

View File

@ -14,9 +14,6 @@ struct Overlay {
extern struct Overlay gOverlayTable[]; extern struct Overlay gOverlayTable[];
extern s32 framebuffer_width;
extern s32 framebuffer_height;
extern f32 climbPoleBottom[3]; extern f32 climbPoleBottom[3];
extern f32 climbPoleTop[3]; extern f32 climbPoleTop[3];
#endif #endif

View File

@ -21,7 +21,7 @@ D_803FBE00 = 0x803FBE00;
D_803FFE00 = 0x803FFE00; D_803FFE00 = 0x803FFE00;
D_803FFE10 = 0x803FFE10; D_803FFE10 = 0x803FFE10;
gOverlayTable = 0x803FFE10; gOverlayTable = 0x803FFE10;
D_803A5D00 = 0x803A5D00; /* framebuffers */ gFramebuffers = 0x803A5D00; /* framebuffers */
/* Renames for the boot segment */ /* Renames for the boot segment */
boot_D_8002D500 = D_8002D500; boot_D_8002D500 = D_8002D500;

View File

@ -20,7 +20,7 @@ D_803FBE00 = 0x803FBE00;
D_803FFE00 = 0x803FFE00; D_803FFE00 = 0x803FFE00;
D_803FFE10 = 0x803FFE10; D_803FFE10 = 0x803FFE10;
gOverlayTable = 0x803FFE10; gOverlayTable = 0x803FFE10;
D_803A5D00 = 0x803A5D00; /* framebuffers */ gFramebuffers = 0x803A5D00; /* framebuffers */
/* Renames for the boot segment */ /* Renames for the boot segment */
boot_D_8002D500 = D_8002D500; boot_D_8002D500 = D_8002D500;

View File

@ -36,8 +36,6 @@ static u64 sDebugVar_8027BEF0; // never used
extern u8 core2_TEXT_START[]; extern u8 core2_TEXT_START[];
extern u16 D_803A5D00[2][0x1ECC0/2];
void func_8023DA20(s32 arg0){ void func_8023DA20(s32 arg0){
bzero(&D_8027A130, core2_TEXT_START - (u8*)&D_8027A130); bzero(&D_8027A130, core2_TEXT_START - (u8*)&D_8027A130);
osWriteBackDCacheAll(); osWriteBackDCacheAll();
@ -53,7 +51,7 @@ void func_8023DA74(void){
void func_8023DA9C(s32 arg0){ void func_8023DA9C(s32 arg0){
func_80254008(); func_80254008();
func_8024C428(); viMgr_clearFramebuffers();
if (D_8027A130 == 4){ if (D_8027A130 == 4){
func_802E3580(); func_802E3580();
} }
@ -108,7 +106,7 @@ void core1_init(void) {
ucode_load(); ucode_load();
setBootMap(getDefaultBootMap()); setBootMap(getDefaultBootMap());
rarezip_init(); //initialize decompressor's huft table rarezip_init(); //initialize decompressor's huft table
func_8024BE30(); viMgr_init();
overlayManagerloadCore2(); overlayManagerloadCore2();
sDebugVar_8027BEF0 = sDebugVar_8027A538; sDebugVar_8027BEF0 = sDebugVar_8027A538;
heap_init(); heap_init();
@ -183,7 +181,7 @@ void mainLoop(void){
){ ){
s32 offset; s32 offset;
//render weird CRC failure image //render weird CRC failure image
for(y= 0x1e; y < framebuffer_height - 0x1e; y++){//L8023DEB4 for(y= 0x1e; y < gFramebufferHeight - 0x1e; y++){//L8023DEB4
for(x = 0x14; x < 0xeb; x++){ for(x = 0x14; x < 0xeb; x++){
tmp = ((8 * globalTimer_getTime()) + ((x*x) + (y*y))); tmp = ((8 * globalTimer_getTime()) + ((x*x) + (y*y)));
@ -194,9 +192,9 @@ void mainLoop(void){
rgba = b | r | g | a; rgba = b | r | g | a;
offset = ((framebuffer_width - 0xFF) / 2) + x + (y*framebuffer_width); offset = ((gFramebufferWidth - 0xFF) / 2) + x + (y*gFramebufferWidth);
D_803A5D00[0][offset] = (s32) rgba; gFramebuffers[0][offset] = (s32) rgba;
D_803A5D00[1][offset] = (s32) rgba; gFramebuffers[1][offset] = (s32) rgba;
} }
} }
}//L8023DF70 }//L8023DF70

View File

@ -4,72 +4,67 @@
#include "variables.h" #include "variables.h"
struct { struct {
u16 *data; void *data;
int unk4; int unk4;
} gzBuffer; } sDepthBuffer;
extern u8 D_8000E800; void func_80253190(Gfx **gfx) {
extern u16 D_803A5D00[2][0xF660]; func_80253208(gfx, 0, 0, gFramebufferWidth, gFramebufferHeight, gFramebuffers[getActiveFramebuffer()]);
void func_80253208(Gfx **gdl, s32 x, s32 y, s32 w, s32 h, void *color_buffer);
void func_80253190(Gfx **gdl){
func_80253208(gdl, 0, 0, framebuffer_width, framebuffer_height, D_803A5D00[getActiveFramebuffer()]);
} }
void func_80253208(Gfx **gdl, s32 x, s32 y, s32 w, s32 h, void *color_buffer){ void func_80253208(Gfx **gfx, s32 x, s32 y, s32 w, s32 h, void *color_buffer){
if( gzBuffer.data != NULL && (getGameMode() != GAME_MODE_4_PAUSED || func_80335134())){ if( sDepthBuffer.data != NULL && (getGameMode() != GAME_MODE_4_PAUSED || func_80335134())){
//draw z_buffer //draw z_buffer
gDPPipeSync((*gdl)++); gDPPipeSync((*gfx)++);
gDPSetColorImage((*gdl)++, G_IM_FMT_RGBA, G_IM_SIZ_16b, framebuffer_width, OS_K0_TO_PHYSICAL(gzBuffer.data)); gDPSetColorImage((*gfx)++, G_IM_FMT_RGBA, G_IM_SIZ_16b, gFramebufferWidth, OS_K0_TO_PHYSICAL(sDepthBuffer.data));
gDPSetCycleType((*gdl)++, G_CYC_FILL); gDPSetCycleType((*gfx)++, G_CYC_FILL);
gDPSetRenderMode((*gdl)++, G_RM_NOOP, G_RM_NOOP2); gDPSetRenderMode((*gfx)++, G_RM_NOOP, G_RM_NOOP2);
gDPSetFillColor((*gdl)++, 0xFFFCFFFC); gDPSetFillColor((*gfx)++, 0xFFFCFFFC);
gDPScisFillRectangle((*gdl)++, x, y, x + w - 1, y + h - 1); gDPScisFillRectangle((*gfx)++, x, y, x + w - 1, y + h - 1);
//draw color_buffer //draw color_buffer
gDPPipeSync((*gdl)++); gDPPipeSync((*gfx)++);
gDPSetColorImage((*gdl)++, G_IM_FMT_RGBA, G_IM_SIZ_16b, framebuffer_width, OS_K0_TO_PHYSICAL(color_buffer)); gDPSetColorImage((*gfx)++, G_IM_FMT_RGBA, G_IM_SIZ_16b, gFramebufferWidth, OS_K0_TO_PHYSICAL(color_buffer));
} }
} }
int func_80253400(void){ int func_80253400(void){
return gzBuffer.unk4; return sDepthBuffer.unk4;
} }
int func_8025340C(void){ bool depthBuffer_isPointerSet(void) {
return gzBuffer.data != NULL; return sDepthBuffer.data != NULL;
} }
void dummy_func_80253420(void){} void depthBuffer_stub(void) {}
void func_80253428(int arg0) { void func_80253428(int arg0) {
u16 *var_v0; u16 *var_v0;
int new_var; int new_var;
if (arg0) { if (arg0) {
var_v0 = (gzBuffer.data = &D_8000E800); var_v0 = (sDepthBuffer.data = &D_8000E800);
while (((s32) gzBuffer.data) % 0x40) {\ while (((s32) sDepthBuffer.data) % 0x40) {
var_v0 = (gzBuffer.data = var_v0 + 1); var_v0 = (sDepthBuffer.data = var_v0 + 1);
} }
do { } while ((&D_8000E800 && 1) * 0); //remove this do { } while ((&D_8000E800 && 1) * 0); //remove this
}else{ }else{
gzBuffer.data = 0; sDepthBuffer.data = NULL;
} }
gzBuffer.unk4 = 0; sDepthBuffer.unk4 = FALSE;
} }
void func_802534A8(int arg0){ void func_802534A8(int arg0) {
gzBuffer.unk4 = (gzBuffer.data != NULL && arg0); sDepthBuffer.unk4 = (sDepthBuffer.data != NULL && arg0);
} }
void zBuffer_set(Gfx **gdl){ void zBuffer_set(Gfx **gfx) {
if(gzBuffer.data && getGameMode() != GAME_MODE_4_PAUSED){ if (sDepthBuffer.data && getGameMode() != GAME_MODE_4_PAUSED) {
gDPPipeSync((*gdl)++); gDPPipeSync((*gfx)++);
gDPSetDepthImage((*gdl)++, gzBuffer.data); gDPSetDepthImage((*gfx)++, sDepthBuffer.data);
} }
} }
void *zBuffer_get(void){ void *zBuffer_get(void) {
return gzBuffer.data; return sDepthBuffer.data;
} }

View File

@ -1,29 +1,13 @@
#include <ultra64.h> #include <ultra64.h>
#include "core1/core1.h" #include "core1/core1.h"
#include "functions.h"
#include "variables.h"
static Gfx *sGfxStack[2] = { NULL, NULL };
s32 gFramebufferWidth = DEFAULT_FRAMEBUFFER_WIDTH;
s32 gFramebufferHeight = DEFAULT_FRAMEBUFFER_HEIGHT;
typedef struct { static Mtx *sMtxStack[2];
s32 unk0; static Vtx *sVtxStack[2];
s32 unk4; static s32 sStackSelector;
Gfx *unk8;
Gfx *unkC;
s32 unk10;
s32 unk14;
}Struct_Core1_15B30;
extern u8 D_803A5D00[2][0x1ecc0];
/* .data */
Gfx *gGfxStack[2] = {NULL, NULL};
s32 framebuffer_width = 292;
s32 framebuffer_height = 216;
/* .bss */
Mtx *gMtxStack[2];
Vtx *gVtxStack[2];
s32 gStackSelector;
s32 gTextureFilterPoint; s32 gTextureFilterPoint;
Struct_Core1_15B30 D_80283008[20]; Struct_Core1_15B30 D_80283008[20];
s32 D_802831E8; s32 D_802831E8;
@ -35,11 +19,6 @@ u16 gScissorBoxTop;
u16 gScissorBoxBottom; u16 gScissorBoxBottom;
Gfx *D_80283214; Gfx *D_80283214;
/* .h */
void scissorBox_setDefault(void);
void dummy_func_80254464(void);
/* .code */
void func_80253550(void){ void func_80253550(void){
osRecvMesg(&D_802831F0, NULL, OS_MESG_BLOCK); osRecvMesg(&D_802831F0, NULL, OS_MESG_BLOCK);
} }
@ -74,8 +53,8 @@ void func_80253640(Gfx ** gdl, void *arg1){
gDPSetAlphaCompare((*gdl)++, G_AC_NONE); gDPSetAlphaCompare((*gdl)++, G_AC_NONE);
gDPSetColorDither((*gdl)++, G_CD_MAGICSQ); gDPSetColorDither((*gdl)++, G_CD_MAGICSQ);
gDPSetScissor((*gdl)++, G_SC_NON_INTERLACE, gScissorBoxLeft, gScissorBoxRight, gScissorBoxTop, gScissorBoxBottom); gDPSetScissor((*gdl)++, G_SC_NON_INTERLACE, gScissorBoxLeft, gScissorBoxRight, gScissorBoxTop, gScissorBoxBottom);
func_80253208(gdl, 0, 0, framebuffer_width, framebuffer_height, arg1); func_80253208(gdl, 0, 0, gFramebufferWidth, gFramebufferHeight, arg1);
gDPSetColorImage((*gdl)++, G_IM_FMT_RGBA, G_IM_SIZ_16b, framebuffer_width, OS_K0_TO_PHYSICAL(arg1)); gDPSetColorImage((*gdl)++, G_IM_FMT_RGBA, G_IM_SIZ_16b, gFramebufferWidth, OS_K0_TO_PHYSICAL(arg1));
gDPSetCycleType((*gdl)++, G_CYC_1CYCLE); gDPSetCycleType((*gdl)++, G_CYC_1CYCLE);
gDPSetTextureConvert((*gdl)++, G_TC_FILT); gDPSetTextureConvert((*gdl)++, G_TC_FILT);
gDPSetTextureDetail((*gdl)++, G_TD_CLAMP); gDPSetTextureDetail((*gdl)++, G_TD_CLAMP);
@ -98,13 +77,13 @@ void scissorBox_SetForGameMode(Gfx **gdl, s32 framebuffer_idx) {
} }
else{ else{
scissorBox_setDefault(); scissorBox_setDefault();
func_80253640(gdl, D_803A5D00[framebuffer_idx]); func_80253640(gdl, gFramebuffers[framebuffer_idx]);
} }
} }
void setupScissorBoxAndFramebuffer(Gfx **gfx, s32 framebuffer_address){ void setupScissorBoxAndFramebuffer(Gfx **gfx, s32 framebuffer_address){
gSPSegment((*gfx)++, 0x00, 0x00000000); gSPSegment((*gfx)++, 0x00, 0x00000000);
gDPSetColorImage((*gfx)++, G_IM_FMT_RGBA, G_IM_SIZ_16b, framebuffer_width, OS_PHYSICAL_TO_K0(framebuffer_address)); gDPSetColorImage((*gfx)++, G_IM_FMT_RGBA, G_IM_SIZ_16b, gFramebufferWidth, OS_PHYSICAL_TO_K0(framebuffer_address));
gSPClearGeometryMode((*gfx)++, G_ZBUFFER | G_SHADE | G_CULL_BOTH | G_FOG | G_LIGHTING | G_TEXTURE_GEN | G_TEXTURE_GEN_LINEAR | G_LOD | G_SHADING_SMOOTH); gSPClearGeometryMode((*gfx)++, G_ZBUFFER | G_SHADE | G_CULL_BOTH | G_FOG | G_LIGHTING | G_TEXTURE_GEN | G_TEXTURE_GEN_LINEAR | G_LOD | G_SHADING_SMOOTH);
gSPTexture((*gfx)++, 0, 0, 0, G_TX_RENDERTILE, G_OFF); gSPTexture((*gfx)++, 0, 0, 0, G_TX_RENDERTILE, G_OFF);
gSPSetGeometryMode((*gfx)++, G_ZBUFFER | G_SHADE | G_SHADING_SMOOTH); gSPSetGeometryMode((*gfx)++, G_ZBUFFER | G_SHADE | G_SHADING_SMOOTH);
@ -121,7 +100,7 @@ void setupScissorBoxAndFramebuffer(Gfx **gfx, s32 framebuffer_address){
void setupDefaultScissorBoxAndFramebuffer(Gfx **gfx, s32 framebuffer_idx){ void setupDefaultScissorBoxAndFramebuffer(Gfx **gfx, s32 framebuffer_idx){
scissorBox_setDefault(); scissorBox_setDefault();
setupScissorBoxAndFramebuffer(gfx, D_803A5D00[framebuffer_idx]); setupScissorBoxAndFramebuffer(gfx, gFramebuffers[framebuffer_idx]);
} }
void func_80253DC0(Gfx **gfx){ void func_80253DC0(Gfx **gfx){
@ -184,7 +163,7 @@ void scissorBox_get(u32 *left, u32 *top, u32 *right, u32 *bottom){
} }
void func_80253FE8(void){ void func_80253FE8(void){
func_8024BFAC(); viMgr_func_8024BFAC();
} }
void func_80254008(void){ void func_80254008(void){
@ -208,29 +187,29 @@ void drawRectangle2D(Gfx **gfx, s32 x, s32 y, s32 w, s32 h, s32 r, s32 g, s32 b)
gDPScisFillRectangle((*gfx)++, x, y, x + w -1, y + h -1); gDPScisFillRectangle((*gfx)++, x, y, x + w -1, y + h -1);
} }
void graphicsCache_release(void){ void graphicsCache_release(void) {
if(gGfxStack[0]){ if (sGfxStack[0]) {
free(gGfxStack[0]); free(sGfxStack[0]);
free(gGfxStack[1]); free(sGfxStack[1]);
free(gMtxStack[0]); free(sMtxStack[0]);
free(gMtxStack[1]); free(sMtxStack[1]);
free(gVtxStack[0]); free(sVtxStack[0]);
free(gVtxStack[1]); free(sVtxStack[1]);
gGfxStack[0] = NULL; sGfxStack[0] = NULL;
} }
} }
void graphicsCache_init(void){ void graphicsCache_init(void){
if(gGfxStack[0] == NULL){ if(sGfxStack[0] == NULL){
gGfxStack[0] = (Gfx *)malloc(29600); // 3700 dlist commands sGfxStack[0] = (Gfx *)malloc(29600); // 3700 dlist commands
gGfxStack[1] = (Gfx *)malloc(29600); sGfxStack[1] = (Gfx *)malloc(29600);
gMtxStack[0] = (Mtx *)malloc(44800); // 700 matrices sMtxStack[0] = (Mtx *)malloc(44800); // 700 matrices
gMtxStack[1] = (Mtx *)malloc(44800); sMtxStack[1] = (Mtx *)malloc(44800);
gVtxStack[0] = (Vtx *)malloc(6880); // 430 vertices sVtxStack[0] = (Vtx *)malloc(6880); // 430 vertices
gVtxStack[1] = (Vtx *)malloc(6880); sVtxStack[1] = (Vtx *)malloc(6880);
dummy_func_80254464(); dummy_func_80254464();
} }
gStackSelector = 0; sStackSelector = 0;
gTextureFilterPoint = 0; gTextureFilterPoint = 0;
} }
@ -239,8 +218,8 @@ void scissorBox_set(s32 left, s32 top, s32 right, s32 bottom) {
gScissorBoxTop = top; gScissorBoxTop = top;
gScissorBoxRight = right; gScissorBoxRight = right;
gScissorBoxBottom = bottom; gScissorBoxBottom = bottom;
framebuffer_width = top - left; gFramebufferWidth = top - left;
framebuffer_height = bottom - right; gFramebufferHeight = bottom - right;
viewport_pushFramebufferExtendsToVpStack(); viewport_pushFramebufferExtendsToVpStack();
} }
@ -253,7 +232,7 @@ void func_80254374(s32 arg0) {
Struct_Core1_15B30 *sp1C; Struct_Core1_15B30 *sp1C;
func_80253550(); func_80253550();
func_8024C2A0(arg0); viMgr_setActiveFramebuffer(arg0);
sp1C = &D_80283008[D_802831E8]; sp1C = &D_80283008[D_802831E8];
D_802831E8 = (s32) (D_802831E8 + 1) % 20; D_802831E8 = (s32) (D_802831E8 + 1) % 20;
func_8025357C(); func_8025357C();
@ -267,10 +246,10 @@ void toggleTextureFilterPoint(void){
} }
void getGraphicsStacks(Gfx **gfx, Mtx **mtx, Vtx **vtx){ void getGraphicsStacks(Gfx **gfx, Mtx **mtx, Vtx **vtx){
gStackSelector = (1 - gStackSelector); sStackSelector = (1 - sStackSelector);
*gfx = gGfxStack[gStackSelector]; *gfx = sGfxStack[sStackSelector];
*mtx = gMtxStack[gStackSelector]; *mtx = sMtxStack[sStackSelector];
*vtx = gVtxStack[gStackSelector]; *vtx = sVtxStack[sStackSelector];
} }
void dummy_func_80254464(void){} void dummy_func_80254464(void) {}

View File

@ -219,7 +219,7 @@ void func_80246C2C(void){
if((D_8027FC14 << 1) < 0){ if((D_8027FC14 << 1) < 0){
osDpSetStatus(DPC_SET_FREEZE); osDpSetStatus(DPC_SET_FREEZE);
D_80280688 = osViGetCurrentFramebuffer(); D_80280688 = osViGetCurrentFramebuffer();
func_8024BFAC(); viMgr_func_8024BFAC();
} }
D_8027FC14 = D_8027FC18 = 2; D_8027FC14 = D_8027FC18 = 2;
D_80275998 = 0; D_80275998 = 0;
@ -474,7 +474,7 @@ void func_80247560(void){
osSetEventMesg(OS_EVENT_SP, &D_8027FB60, CORE1_8C50_EVENT_SP); osSetEventMesg(OS_EVENT_SP, &D_8027FB60, CORE1_8C50_EVENT_SP);
osSetEventMesg(OS_EVENT_FAULT, &D_8027FB60, CORE1_8C50_EVENT_FAULT); osSetEventMesg(OS_EVENT_FAULT, &D_8027FB60, CORE1_8C50_EVENT_FAULT);
osSetEventMesg(OS_EVENT_PRENMI, &D_8027FB60, CORE1_8C50_EVENT_PRENMI); osSetEventMesg(OS_EVENT_PRENMI, &D_8027FB60, CORE1_8C50_EVENT_PRENMI);
func_8024BDAC(&D_8027FB60, 5); viMgr_func_8024BDAC(&D_8027FB60, 5);
D_8027FC0C = 0; D_8027FC0C = 0;
D_8027FC10 = 0; D_8027FC10 = 0;
D_8027FC14 = D_8027FC18 = 2; D_8027FC14 = D_8027FC18 = 2;

View File

@ -6,9 +6,6 @@
#include "version.h" #include "version.h"
#if VERSION == VERSION_USA_1_0 #if VERSION == VERSION_USA_1_0
extern u16 D_803A5D00[2][0xF660]; //framebuffer
extern s32 framebuffer_width; //framebuffer width
extern s32 framebuffer_height; //framebuffer height
/* .data */ /* .data */
u8 D_80275A50[8][3] = { u8 D_80275A50[8][3] = {
@ -96,11 +93,11 @@ void func_80247750(s32 r, s32 g, s32 b){
void func_8024776C(s32 x, s32 y) { void func_8024776C(s32 x, s32 y) {
s32 rgba16; s32 rgba16;
if( ((x >= 0) && (x < framebuffer_width)) if( ((x >= 0) && (x < gFramebufferWidth))
&& ((y >= 0) && (y < framebuffer_height)) && ((y >= 0) && (y < gFramebufferHeight))
) { ) {
D_803A5D00[0][x + y*framebuffer_width] = _SHIFTL(D_80275A68 >> 3, 11, 5) | _SHIFTL(D_80275A6C >> 3, 6, 5) | _SHIFTL(D_80275A70 >> 3, 1, 5) | _SHIFTL(1, 0, 1); gFramebuffers[0][x + y*gFramebufferWidth] = _SHIFTL(D_80275A68 >> 3, 11, 5) | _SHIFTL(D_80275A6C >> 3, 6, 5) | _SHIFTL(D_80275A70 >> 3, 1, 5) | _SHIFTL(1, 0, 1);
D_803A5D00[1][x + y*framebuffer_width] = _SHIFTL(D_80275A68 >> 3, 11, 5) | _SHIFTL(D_80275A6C >> 3, 6, 5) | _SHIFTL(D_80275A70 >> 3, 1, 5) | _SHIFTL(1, 0, 1); gFramebuffers[1][x + y*gFramebufferWidth] = _SHIFTL(D_80275A68 >> 3, 11, 5) | _SHIFTL(D_80275A6C >> 3, 6, 5) | _SHIFTL(D_80275A70 >> 3, 1, 5) | _SHIFTL(1, 0, 1);
} }
} }
@ -120,7 +117,7 @@ void func_80247818(s32 x, s32 y, s32 w, s32 h) {
void func_802478C0(s32 r, s32 g, s32 b) { void func_802478C0(s32 r, s32 g, s32 b) {
func_80247750(r, g, b); func_80247750(r, g, b);
func_80247818((framebuffer_width - 128) / 2, (framebuffer_height - 100) / 2, 128, 100); func_80247818((gFramebufferWidth - 128) / 2, (gFramebufferHeight - 100) / 2, 128, 100);
} }
void func_8024792C(void){} void func_8024792C(void){}
@ -207,9 +204,9 @@ void func_80247C20(void) {
} }
if (D_80275BE0) { if (D_80275BE0) {
for(i = 0; i < framebuffer_width * framebuffer_height; i++){ for(i = 0; i < gFramebufferWidth * gFramebufferHeight; i++){
D_803A5D00[0][i] = 0; gFramebuffers[0][i] = 0;
D_803A5D00[1][i] = 0; gFramebuffers[1][i] = 0;
} }
osWriteBackDCacheAll(); osWriteBackDCacheAll();
} }

View File

@ -21,11 +21,6 @@ void draw_prim_rect(s32 x, s32 y, s32 w, s32 h);
void set_prim_color(s32 r, s32 g, s32 b); void set_prim_color(s32 r, s32 g, s32 b);
void func_8024A85C(s32 buffer_indx); void func_8024A85C(s32 buffer_indx);
extern u16 D_803A5D00[2][0xF660]; //framebuffer
extern s32 framebuffer_width; //framebuffer width
extern s32 framebuffer_height; //framebuffer height
/* .bss */ /* .bss */
s32 D_802806E0; s32 D_802806E0;
s32 D_802806E4; s32 D_802806E4;
@ -51,7 +46,7 @@ void draw_sprite_ci4(s32 x, s32 y, BKSprite *sprite, s32 frame, s32 alpha_enable
s32 color1; s32 color1;
s32 color2; s32 color2;
framebuffer = D_803A5D00[D_802806EC]; framebuffer = gFramebuffers[D_802806EC];
sprite_frame = spriteGetFramePtr(sprite, (u32) frame); sprite_frame = spriteGetFramePtr(sprite, (u32) frame);
if (!alpha_enabled){ if (!alpha_enabled){
set_prim_color(0, 0, 0x80); set_prim_color(0, 0, 0x80);
@ -79,12 +74,12 @@ void draw_sprite_ci4(s32 x, s32 y, BKSprite *sprite, s32 frame, s32 alpha_enable
indx1 = ((*tmem) >> 4) & 0xF; indx1 = ((*tmem) >> 4) & 0xF;
indx2 = *tmem & 0xF; indx2 = *tmem & 0xF;
fb_x = (chunk->x + x) + ix; fb_x = (chunk->x + x) + ix;
if ((0 <= fb_x) && (fb_x < framebuffer_width)) if ((0 <= fb_x) && (fb_x < gFramebufferWidth))
{ {
fb_y = (chunk->y + y) + iy; fb_y = (chunk->y + y) + iy;
if ((fb_y >= 0) && (fb_y < framebuffer_height)) if ((fb_y >= 0) && (fb_y < gFramebufferHeight))
{ {
pxl_ptr = (framebuffer + fb_x) + (fb_y * framebuffer_width); pxl_ptr = (framebuffer + fb_x) + (fb_y * gFramebufferWidth);
color1 = palette[indx1]; color1 = palette[indx1];
if (color1 & 1) { if (color1 & 1) {
*pxl_ptr = color1; *pxl_ptr = color1;
@ -127,7 +122,7 @@ void draw_sprite_ci8(s32 x, s32 y, BKSprite *sprite, s32 frame, s32 alpha_enable
if (D_80275C00 == 0xA) { if (D_80275C00 == 0xA) {
D_80275C00 = 0; D_80275C00 = 0;
} }
framebuffer = D_803A5D00[D_802806EC]; framebuffer = gFramebuffers[D_802806EC];
sprite_frame = spriteGetFramePtr(sprite, (u32) frame); sprite_frame = spriteGetFramePtr(sprite, (u32) frame);
if (!alpha_enabled){ if (!alpha_enabled){
set_prim_color(0, 0, 0x80); set_prim_color(0, 0, 0x80);
@ -150,12 +145,12 @@ void draw_sprite_ci8(s32 x, s32 y, BKSprite *sprite, s32 frame, s32 alpha_enable
for (iy = 0; iy < chunk->h; iy++){ for (iy = 0; iy < chunk->h; iy++){
for (ix = 0; ix < chunk->w; ix++){ for (ix = 0; ix < chunk->w; ix++){
fb_x = (chunk->x + x) + ix; fb_x = (chunk->x + x) + ix;
if ((0 <= fb_x) && (fb_x < framebuffer_width)) if ((0 <= fb_x) && (fb_x < gFramebufferWidth))
{ {
fb_y = (chunk->y + y) + iy; fb_y = (chunk->y + y) + iy;
if ((fb_y >= 0) && (fb_y < framebuffer_height)) if ((fb_y >= 0) && (fb_y < gFramebufferHeight))
{ {
pxl_ptr = (framebuffer + fb_x) + (fb_y * framebuffer_width); pxl_ptr = (framebuffer + fb_x) + (fb_y * gFramebufferWidth);
if (palette[*tmem] & 1){ if (palette[*tmem] & 1){
*pxl_ptr = palette[*tmem]; *pxl_ptr = palette[*tmem];
} }
@ -193,7 +188,7 @@ void draw_sprite_rgba16(s32 x, s32 y, BKSprite *sprite, s32 frame, bool alpha_en
u16 *pxl_ptr; u16 *pxl_ptr;
u16 rgba; u16 rgba;
framebuffer_ptr = &D_803A5D00[D_802806EC][0]; framebuffer_ptr = &gFramebuffers[D_802806EC][0];
sprite_ptr = spriteGetFramePtr(sprite, frame); sprite_ptr = spriteGetFramePtr(sprite, frame);
if (!alpha_enabled) { if (!alpha_enabled) {
set_prim_color(0, 0, 0x80); set_prim_color(0, 0, 0x80);
@ -206,10 +201,10 @@ void draw_sprite_rgba16(s32 x, s32 y, BKSprite *sprite, s32 frame, bool alpha_en
for(txtr_y = 0; txtr_y < chunk_ptr->h; txtr_y++) { for(txtr_y = 0; txtr_y < chunk_ptr->h; txtr_y++) {
for(txtr_x = 0; txtr_x < chunk_ptr->w; txtr_x++) { for(txtr_x = 0; txtr_x < chunk_ptr->w; txtr_x++) {
fb_x = chunk_ptr->x + x + txtr_x; fb_x = chunk_ptr->x + x + txtr_x;
if ((fb_x >= 0) && (fb_x < framebuffer_width)) { if ((fb_x >= 0) && (fb_x < gFramebufferWidth)) {
fb_y = chunk_ptr->y + y + txtr_y; fb_y = chunk_ptr->y + y + txtr_y;
if ((fb_y >= 0) && (fb_y < framebuffer_height)) { if ((fb_y >= 0) && (fb_y < gFramebufferHeight)) {
pxl_ptr = framebuffer_ptr + fb_x + (fb_y * framebuffer_width); pxl_ptr = framebuffer_ptr + fb_x + (fb_y * gFramebufferWidth);
rgba = *tmem; rgba = *tmem;
if (rgba & 1) { if (rgba & 1) {
*pxl_ptr = rgba; *pxl_ptr = rgba;
@ -240,7 +235,7 @@ void draw_sprite_i4(s32 x, s32 y, BKSprite *sprite, s32 frame, bool aplha_enable
s32 txtr_x; s32 txtr_x;
u16 *fb_pxl_ptr; u16 *fb_pxl_ptr;
framebuffer_ptr = &D_803A5D00[D_802806EC][0]; framebuffer_ptr = &gFramebuffers[D_802806EC][0];
frame_ptr = spriteGetFramePtr(sprite, frame); frame_ptr = spriteGetFramePtr(sprite, frame);
if (!aplha_enabled) { if (!aplha_enabled) {
set_prim_color(0, 0, 0x80); set_prim_color(0, 0, 0x80);
@ -253,12 +248,12 @@ void draw_sprite_i4(s32 x, s32 y, BKSprite *sprite, s32 frame, bool aplha_enable
for(txtr_y = 0; txtr_y < chunk_ptr->h; txtr_y++) { for(txtr_y = 0; txtr_y < chunk_ptr->h; txtr_y++) {
for(txtr_x = 0; txtr_x < chunk_ptr->w; txtr_x += 2) { for(txtr_x = 0; txtr_x < chunk_ptr->w; txtr_x += 2) {
fb_x = chunk_ptr->x + x + txtr_x; fb_x = chunk_ptr->x + x + txtr_x;
if ((fb_x >= 0) && (fb_x < framebuffer_width)) { if ((fb_x >= 0) && (fb_x < gFramebufferWidth)) {
fb_y = chunk_ptr->y + y + txtr_y; fb_y = chunk_ptr->y + y + txtr_y;
if ((fb_y >= 0) && (fb_y < framebuffer_height)) { if ((fb_y >= 0) && (fb_y < gFramebufferHeight)) {
p1 = (*tmem >> 4); p1 = (*tmem >> 4);
p2 = (*tmem & 0xF); p2 = (*tmem & 0xF);
fb_pxl_ptr = framebuffer_ptr + fb_x + (fb_y * framebuffer_width); fb_pxl_ptr = framebuffer_ptr + fb_x + (fb_y * gFramebufferWidth);
if (p1) { if (p1) {
*fb_pxl_ptr = (p1 << 0xC) | (p1 << 0x7) | (p1 << 0x2) | 1; *fb_pxl_ptr = (p1 << 0xC) | (p1 << 0x7) | (p1 << 0x2) | 1;
} else if (!aplha_enabled) { } else if (!aplha_enabled) {
@ -297,7 +292,7 @@ void draw_sprite_ia4(s32 x, s32 y, BKSprite *sprite, s32 frame, bool aplha_enabl
s32 txtr_x; s32 txtr_x;
u16 *fb_pxl_ptr; u16 *fb_pxl_ptr;
framebuffer_ptr = &D_803A5D00[D_802806EC][0]; framebuffer_ptr = &gFramebuffers[D_802806EC][0];
frame_ptr = spriteGetFramePtr(sprite, frame); frame_ptr = spriteGetFramePtr(sprite, frame);
if (!aplha_enabled) { if (!aplha_enabled) {
set_prim_color(0, 0, 0x80); set_prim_color(0, 0, 0x80);
@ -310,10 +305,10 @@ void draw_sprite_ia4(s32 x, s32 y, BKSprite *sprite, s32 frame, bool aplha_enabl
for(txtr_y = 0; txtr_y < chunk_ptr->h; txtr_y++) { for(txtr_y = 0; txtr_y < chunk_ptr->h; txtr_y++) {
for(txtr_x = 0; txtr_x < chunk_ptr->w; txtr_x += 2) { for(txtr_x = 0; txtr_x < chunk_ptr->w; txtr_x += 2) {
fb_x = chunk_ptr->x + x + txtr_x; fb_x = chunk_ptr->x + x + txtr_x;
if ((fb_x >= 0) && (fb_x < framebuffer_width)) { if ((fb_x >= 0) && (fb_x < gFramebufferWidth)) {
fb_y = chunk_ptr->y + y + txtr_y; fb_y = chunk_ptr->y + y + txtr_y;
if ((fb_y >= 0) && (fb_y < framebuffer_height)) { if ((fb_y >= 0) && (fb_y < gFramebufferHeight)) {
fb_pxl_ptr = framebuffer_ptr + fb_x + (fb_y * framebuffer_width);\ fb_pxl_ptr = framebuffer_ptr + fb_x + (fb_y * gFramebufferWidth);\
p1 = (*tmem >> 4); p1 = (*tmem >> 4);
p2 = (*tmem & 0xF); p2 = (*tmem & 0xF);
p1_i = p1 & 0xE; p1_i = p1 & 0xE;
@ -352,7 +347,7 @@ void draw_sprite_i8(s32 x, s32 y, BKSprite *sprite, s32 frame, s32 alpha_enabled
s32 i_chunk; s32 i_chunk;
s32 txtr_y; s32 txtr_y;
framebuffer_ptr = &D_803A5D00[D_802806EC][0]; framebuffer_ptr = &gFramebuffers[D_802806EC][0];
frame_ptr = spriteGetFramePtr(sprite, frame); frame_ptr = spriteGetFramePtr(sprite, frame);
if (!alpha_enabled) { if (!alpha_enabled) {
set_prim_color(0, 0, 0x80); set_prim_color(0, 0, 0x80);
@ -367,10 +362,10 @@ void draw_sprite_i8(s32 x, s32 y, BKSprite *sprite, s32 frame, s32 alpha_enabled
for(txtr_x = 0; txtr_x < chunk_ptr->w; txtr_x++){ for(txtr_x = 0; txtr_x < chunk_ptr->w; txtr_x++){
fb_x = chunk_ptr->x + x + txtr_x; fb_x = chunk_ptr->x + x + txtr_x;
if (fb_x >= 0) { if (fb_x >= 0) {
if (fb_x < framebuffer_width) { if (fb_x < gFramebufferWidth) {
fb_y = chunk_ptr->y + y + txtr_y; fb_y = chunk_ptr->y + y + txtr_y;
if ((fb_y >= 0) && (fb_y < framebuffer_height)) { if ((fb_y >= 0) && (fb_y < gFramebufferHeight)) {
pixel_ptr = framebuffer_ptr + fb_x + fb_y * framebuffer_width; pixel_ptr = framebuffer_ptr + fb_x + fb_y * gFramebufferWidth;
intensity = (s32) *txtr_ptr >> 3; intensity = (s32) *txtr_ptr >> 3;
if (intensity != 0) { if (intensity != 0) {
*pixel_ptr = (intensity << 0xB) | (intensity << 6) | (intensity << 1) | 1; *pixel_ptr = (intensity << 0xB) | (intensity << 6) | (intensity << 1) | 1;
@ -401,7 +396,7 @@ void draw_sprite_ia8(s32 x, s32 y, BKSprite *sprite, s32 frame, bool alpha_enabl
s32 var_t3; s32 var_t3;
u32 temp_a2; u32 temp_a2;
framebuffer_ptr = &D_803A5D00[D_802806EC][0]; framebuffer_ptr = &gFramebuffers[D_802806EC][0];
sprite_frame = spriteGetFramePtr(sprite, frame); sprite_frame = spriteGetFramePtr(sprite, frame);
if (!alpha_enabled) { if (!alpha_enabled) {
//draw blue rect over display area //draw blue rect over display area
@ -415,10 +410,10 @@ void draw_sprite_ia8(s32 x, s32 y, BKSprite *sprite, s32 frame, bool alpha_enabl
for(var_t3 = 0; var_t3 < chunk_ptr->h; var_t3++){ for(var_t3 = 0; var_t3 < chunk_ptr->h; var_t3++){
for(var_a3 = 0; var_a3 < chunk_ptr->w; var_a3++) { for(var_a3 = 0; var_a3 < chunk_ptr->w; var_a3++) {
fb_x = chunk_ptr->x + x + var_a3; fb_x = chunk_ptr->x + x + var_a3;
if ((fb_x >= 0) && (fb_x < framebuffer_width)) { if ((fb_x >= 0) && (fb_x < gFramebufferWidth)) {
fb_y = chunk_ptr->y + y + var_t3; fb_y = chunk_ptr->y + y + var_t3;
if ((fb_y >= 0) && (fb_y < framebuffer_height)) { if ((fb_y >= 0) && (fb_y < gFramebufferHeight)) {
temp_a1 = framebuffer_ptr + fb_x + fb_y * framebuffer_width; temp_a1 = framebuffer_ptr + fb_x + fb_y * gFramebufferWidth;
temp_a2 = *var_t2; temp_a2 = *var_t2;
if (IA8_A(temp_a2)) { if (IA8_A(temp_a2)) {
*temp_a1 = I4_2_RGBA16(IA8_I(temp_a2), 1); *temp_a1 = I4_2_RGBA16(IA8_I(temp_a2), 1);
@ -456,7 +451,7 @@ void draw_sprite_rgba32(s32 x, s32 y, BKSprite *sprite, s32 frame, s32 alpha_ena
s32 blue8; s32 blue8;
framebuffer = &D_803A5D00[D_802806EC][0]; framebuffer = &gFramebuffers[D_802806EC][0];
sprite_frame = spriteGetFramePtr(sprite, frame); sprite_frame = spriteGetFramePtr(sprite, frame);
if (!alpha_enabled) { if (!alpha_enabled) {
set_prim_color(0, 0, 0x80); set_prim_color(0, 0, 0x80);
@ -478,13 +473,13 @@ void draw_sprite_rgba32(s32 x, s32 y, BKSprite *sprite, s32 frame, s32 alpha_ena
for (ix = 0; ix < chunk_ptr->w; ix++) for (ix = 0; ix < chunk_ptr->w; ix++)
{ {
fb_x = (chunk_ptr->x + x) + ix; fb_x = (chunk_ptr->x + x) + ix;
if ((fb_x >= 0) && (fb_x < framebuffer_width)) if ((fb_x >= 0) && (fb_x < gFramebufferWidth))
{ {
fb_y = (chunk_ptr->y + y) + iy; fb_y = (chunk_ptr->y + y) + iy;
if ((fb_y >= 0) && (fb_y < framebuffer_height)) if ((fb_y >= 0) && (fb_y < gFramebufferHeight))
{ {
txtr_value = *tmem; txtr_value = *tmem;
pxl_ptr = (framebuffer + fb_x) + (fb_y * framebuffer_width); pxl_ptr = (framebuffer + fb_x) + (fb_y * gFramebufferWidth);
fb_value = (unsigned int) (*pxl_ptr); fb_value = (unsigned int) (*pxl_ptr);
alpha = _SHIFTR(txtr_value, 0, 8); alpha = _SHIFTR(txtr_value, 0, 8);
if (alpha) {//blend texture with existing pixel color if (alpha) {//blend texture with existing pixel color
@ -524,7 +519,7 @@ void draw_texture_ci4(s32 x, s32 y, void *tmem, s32 w, s32 h, bool alpha_enabled
palette_ptr = (u16*)tmem; palette_ptr = (u16*)tmem;
pixel_ptr = (u8*)&palette_ptr[0x10]; pixel_ptr = (u8*)&palette_ptr[0x10];
framebuffer_ptr = &D_803A5D00[D_802806EC][x + y * framebuffer_width]; framebuffer_ptr = &gFramebuffers[D_802806EC][x + y * gFramebufferWidth];
for(iy = 0; iy < h; iy++){ for(iy = 0; iy < h; iy++){
for(ix = 0; ix < w; ix++){ for(ix = 0; ix < w; ix++){
icolor = (ix & 1)? pixel_ptr[ix/2 + (iy*w)/2] & 0xF icolor = (ix & 1)? pixel_ptr[ix/2 + (iy*w)/2] & 0xF
@ -532,7 +527,7 @@ void draw_texture_ci4(s32 x, s32 y, void *tmem, s32 w, s32 h, bool alpha_enabled
*framebuffer_ptr = palette_ptr[icolor]; *framebuffer_ptr = palette_ptr[icolor];
framebuffer_ptr++; framebuffer_ptr++;
} }
framebuffer_ptr += (framebuffer_width - w); framebuffer_ptr += (gFramebufferWidth - w);
} }
} }
@ -576,7 +571,7 @@ void func_80249DE0(s32 x, s32 y, s16 *arg2, s32 arg3, s32 arg4) {
return; return;
} }
//otherwise RGBA16 //otherwise RGBA16
framebuffer_ptr = &D_803A5D00[D_802806EC][x + y*framebuffer_width]; framebuffer_ptr = &gFramebuffers[D_802806EC][x + y*gFramebufferWidth];
for(iy = 0; iy < temp_v0->h; iy++){ for(iy = 0; iy < temp_v0->h; iy++){
for(ix = 0; ix < temp_v0->w; ix++){ for(ix = 0; ix < temp_v0->w; ix++){
temp_v1 = *texture_ptr; temp_v1 = *texture_ptr;
@ -588,7 +583,7 @@ void func_80249DE0(s32 x, s32 y, s16 *arg2, s32 arg3, s32 arg4) {
texture_ptr++; texture_ptr++;
framebuffer_ptr++; framebuffer_ptr++;
} }
framebuffer_ptr += (framebuffer_width - temp_v0->w); framebuffer_ptr += (gFramebufferWidth - temp_v0->w);
} }
} }
@ -601,7 +596,7 @@ void func_80249F34(s32 x, s32 y, Struct84s* maskList, s32 maskIndex, s32 mX, s32
mask_texture = func_8033EFB0(maskList, maskIndex); mask_texture = func_8033EFB0(maskList, maskIndex);
mask_ptr = (u16*)(mask_texture + 1) + mX + mY * mask_texture->w; mask_ptr = (u16*)(mask_texture + 1) + mX + mY * mask_texture->w;
color_ptr = &D_803A5D00[D_802806EC][x + y * framebuffer_width]; color_ptr = &gFramebuffers[D_802806EC][x + y * gFramebufferWidth];
for(iy = 0; iy < mH; iy += mStride){ for(iy = 0; iy < mH; iy += mStride){
for(ix = 0; ix < mW; ix++){ for(ix = 0; ix < mW; ix++){
@ -619,7 +614,7 @@ void func_80249F34(s32 x, s32 y, Struct84s* maskList, s32 maskIndex, s32 mX, s32
mask_ptr++; mask_ptr++;
} }
mask_ptr += ((mStride * mask_texture->w) - mW); mask_ptr += ((mStride * mask_texture->w) - mW);
color_ptr += (framebuffer_width - mW); color_ptr += (gFramebufferWidth - mW);
} }
} }
@ -628,14 +623,14 @@ void func_8024A284(s32 x, s32 y, s32 arg2, s32 arg3, s32 horz_spacing, s32 vert_
s32 var_s2; s32 var_s2;
s32 var_s3; s32 var_s3;
for(var_s2 = 0; var_s2 < framebuffer_width; var_s2 += horz_spacing){ for(var_s2 = 0; var_s2 < gFramebufferWidth; var_s2 += horz_spacing){
for(var_s3 = 0; var_s3 < framebuffer_height; var_s3++){ for(var_s3 = 0; var_s3 < gFramebufferHeight; var_s3++){
func_8024A3C8(x + var_s2, y + var_s3); func_8024A3C8(x + var_s2, y + var_s3);
} }
} }
for(var_s3 = 0; var_s3 < framebuffer_height; var_s3 += vert_spacing) { for(var_s3 = 0; var_s3 < gFramebufferHeight; var_s3 += vert_spacing) {
for(var_s2 = 0; var_s2 < framebuffer_width; var_s2++){ for(var_s2 = 0; var_s2 < gFramebufferWidth; var_s2++){
func_8024A3C8(x + var_s2, y + var_s3); func_8024A3C8(x + var_s2, y + var_s3);
} }
} }
@ -646,8 +641,8 @@ void func_8024A3C8(s32 x, s32 y) {
s32 temp_v0; s32 temp_v0;
if (x >= 0) { if (x >= 0) {
if ((x < framebuffer_width) && (y >= 0) && (y < framebuffer_height)) { if ((x < gFramebufferWidth) && (y >= 0) && (y < gFramebufferHeight)) {
D_803A5D00[D_802806EC][x + y * framebuffer_width] = _SHIFTL(D_802806E0 >> 3, 11, 5) | _SHIFTL(D_802806E4 >> 3, 6, 5) | _SHIFTL(D_802806E8 >> 3, 1, 5) | _SHIFTL(1, 0, 1); gFramebuffers[D_802806EC][x + y * gFramebufferWidth] = _SHIFTL(D_802806E0 >> 3, 11, 5) | _SHIFTL(D_802806E4 >> 3, 6, 5) | _SHIFTL(D_802806E8 >> 3, 1, 5) | _SHIFTL(1, 0, 1);
} }
} }
} }
@ -688,8 +683,8 @@ void func_8024A564(s32 x, s32 y, u16 *arg2, s32 arg3, s32 arg4, f32 arg5, f32 ar
s16 *var_t0; s16 *var_t0;
s16 *var_t2; s16 *var_t2;
var_v0 = 0; var_v0 = 0;
var_v1 = framebuffer_width; var_v1 = gFramebufferWidth;
var_t0 = &D_803A5D00[D_802806EC][x + (y * framebuffer_width)]; var_t0 = &gFramebuffers[D_802806EC][x + (y * gFramebufferWidth)];
new_var = (s32) (((f64) (256.0f / (new_var3 = arg6))) + 0.5); new_var = (s32) (((f64) (256.0f / (new_var3 = arg6))) + 0.5);
new_var2 = (s32) (((f64) (256.0f / arg5)) + 0.5); new_var2 = (s32) (((f64) (256.0f / arg5)) + 0.5);
for (var_t1 = (arg4 * arg6) + 0.5; var_t1 != 0; var_t1--) for (var_t1 = (arg4 * arg6) + 0.5; var_t1 != 0; var_t1--)
@ -704,7 +699,7 @@ void func_8024A564(s32 x, s32 y, u16 *arg2, s32 arg3, s32 arg4, f32 arg5, f32 ar
var_t2++; var_t2++;
} }
var_t0 += framebuffer_width; var_t0 += gFramebufferWidth;
var_v0 += new_var; var_v0 += new_var;
} }

View File

@ -11,7 +11,6 @@ typedef struct{
extern struct49s D_803FFE10[]; extern struct49s D_803FFE10[];
extern u8 D_8000E800;
extern u8 D_8002D500; extern u8 D_8002D500;
extern u32 D_8027BF2C; extern u32 D_8027BF2C;
extern u32 D_8027BF30; extern u32 D_8027BF30;

View File

@ -18,7 +18,6 @@ typedef struct struct_2a_s{
} OverlayAddressMap; } OverlayAddressMap;
extern u8 D_803A5D00;
#define SEGMENT_EXTERNS(segname) \ #define SEGMENT_EXTERNS(segname) \
extern u8 segname##_VRAM[]; \ extern u8 segname##_VRAM[]; \
@ -112,7 +111,7 @@ s32 __overlayManager80251178(void){
sp18 = func_802546DC(); sp18 = func_802546DC();
sp1C = __overlayManager80251170(); sp1C = __overlayManager80251170();
return ((sp1C + &D_803A5D00) - largest_overlay->ram_end) + sp18; return ((sp1C + (u8 *)gFramebuffers) - largest_overlay->ram_end) + sp18;
} }
void __overlayManager802511C4(void){ void __overlayManager802511C4(void){

View File

@ -126,7 +126,7 @@ void rumbleManager_init(void) {
osCreateMesgQueue(&D_80282390, &D_802823A8, 1); osCreateMesgQueue(&D_80282390, &D_802823A8, 1);
osCreateThread(&sRumbleThread, 8, rumbleThread_entry, NULL, sRumbleThreadStack + RUMBLE_THREAD_STACK_SIZE, 25); osCreateThread(&sRumbleThread, 8, rumbleThread_entry, NULL, sRumbleThreadStack + RUMBLE_THREAD_STACK_SIZE, 25);
osStartThread(&sRumbleThread); osStartThread(&sRumbleThread);
func_8024BDAC(&D_80282390, 0); viMgr_func_8024BDAC(&D_80282390, 0);
} }
} }

View File

@ -76,7 +76,7 @@ void viewport_getRotation_f3(f32 *pitch, f32 *yaw, f32 *roll) {
void viewport_setRenderViewportAndOrthoMatrix(Gfx **gfx, Mtx **mtx) { void viewport_setRenderViewportAndOrthoMatrix(Gfx **gfx, Mtx **mtx) {
gSPViewport((*gfx)++, &sViewportStack[sViewportStackIndex]); gSPViewport((*gfx)++, &sViewportStack[sViewportStackIndex]);
guOrtho(*mtx, -(2*(f32)framebuffer_width), (2*(f32)framebuffer_width), -(2*(f32)framebuffer_height), (2*(f32)framebuffer_height), 1.0f, 20.0f, 1.0f); guOrtho(*mtx, -(2*(f32)gFramebufferWidth), (2*(f32)gFramebufferWidth), -(2*(f32)gFramebufferHeight), (2*(f32)gFramebufferHeight), 1.0f, 20.0f, 1.0f);
gSPMatrix((*gfx)++, OS_K0_TO_PHYSICAL((*mtx)++), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_PROJECTION); gSPMatrix((*gfx)++, OS_K0_TO_PHYSICAL((*mtx)++), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_PROJECTION);
guTranslate(*mtx, 0.0f, 0.0f, 0.0f); guTranslate(*mtx, 0.0f, 0.0f, 0.0f);
@ -133,7 +133,7 @@ f32 viewport_debug3(void) {
} }
void viewport_pushFramebufferExtendsToVpStack(void) { void viewport_pushFramebufferExtendsToVpStack(void) {
viewport_pushVpScaleAndTranslation((s32) ((f32)framebuffer_width/2), (s32) ((f32)framebuffer_height/2), (s32) ((f32)framebuffer_width/2), (s32) ((f32)framebuffer_height/2)); viewport_pushVpScaleAndTranslation((s32) ((f32)gFramebufferWidth/2), (s32) ((f32)gFramebufferHeight/2), (s32) ((f32)gFramebufferWidth/2), (s32) ((f32)gFramebufferHeight/2));
} }
void viewport_reset(void) { void viewport_reset(void) {
@ -427,13 +427,13 @@ f32 viewport_transformCoordinate(f32 x, f32 y, f32 viewport_translation[3], f32
if ((sViewportFOVy != fovy) || (sViewportNear != near)) { if ((sViewportFOVy != fovy) || (sViewportNear != near)) {
fovy_rad = (sViewportFOVy * M_PI) / 360.0; fovy_rad = (sViewportFOVy * M_PI) / 360.0;
scale = (500.0 + sViewportNear) / (((framebuffer_height / (f32)2) / sinf(fovy_rad)) * cosf(fovy_rad)); scale = (500.0 + sViewportNear) / (((gFramebufferHeight / (f32)2) / sinf(fovy_rad)) * cosf(fovy_rad));
fovy = sViewportFOVy; fovy = sViewportFOVy;
near = sViewportNear; near = sViewportNear;
} }
x = x - (framebuffer_width / (f32)2); x = x - (gFramebufferWidth / (f32)2);
y = (framebuffer_height / (f32)2) - y; y = (gFramebufferHeight / (f32)2) - y;
viewport_rotation[0] = sViewportRotation[0]; viewport_rotation[0] = sViewportRotation[0];
viewport_rotation[1] = sViewportRotation[1]; viewport_rotation[1] = sViewportRotation[1];
@ -481,16 +481,16 @@ bool viewport_func_8024E030(f32 pos[3], f32 *arg1)
} }
temp_f2 = gu_sqrtf((delta[1] * delta[1]) + (delta[2] * delta[2])) * sinf(fovy_radians); temp_f2 = gu_sqrtf((delta[1] * delta[1]) + (delta[2] * delta[2])) * sinf(fovy_radians);
temp_f2_2 = (((f32) framebuffer_width) / ((f32) framebuffer_height)) * temp_f2; temp_f2_2 = (((f32) gFramebufferWidth) / ((f32) gFramebufferHeight)) * temp_f2;
arg1[0] = (f32) (((delta[0] / temp_f2_2) + 1) * (((f32) framebuffer_width) / 2)); arg1[0] = (f32) (((delta[0] / temp_f2_2) + 1) * (((f32) gFramebufferWidth) / 2));
arg1[1] = (f32) ((1 - (delta[1] / temp_f2)) * (((f32) framebuffer_height) / 2)); arg1[1] = (f32) ((1 - (delta[1] / temp_f2)) * (((f32) gFramebufferHeight) / 2));
if ((arg1[0] < (-((f32) framebuffer_width))) || ((((f32) framebuffer_width) * 2) < arg1[0])) { if ((arg1[0] < (-((f32) gFramebufferWidth))) || ((((f32) gFramebufferWidth) * 2) < arg1[0])) {
return FALSE; return FALSE;
} }
if ((arg1[1] < (-((f32) framebuffer_height))) || ((((f32) framebuffer_height) * 2) < arg1[1])) { if ((arg1[1] < (-((f32) gFramebufferHeight))) || ((((f32) gFramebufferHeight) * 2) < arg1[1])) {
return FALSE; return FALSE;
} }

View File

@ -4,18 +4,10 @@
#include "variables.h" #include "variables.h"
#include "version.h" #include "version.h"
#define VIMANAGER_THREAD_STACK_SIZE 0x400
void func_8024BF94(s32 arg0); // Used in US 1.0 NTSC
void func_8024C2F8(void *); static OSViMode sViMode_US10_NTSC = {
typedef struct struct_1_s{
OSMesgQueue *messageQueue;
OSMesg message;
} struct1;
extern u32 D_80000300;
OSViMode D_80275C80 = {
OS_VI_NTSC_LPN1, OS_VI_NTSC_LPN1,
{ {
VI_CTRL_TYPE_16 | VI_CTRL_GAMMA_DITHER_ON | VI_CTRL_GAMMA_ON | 0x3200, /*ctrl*/ VI_CTRL_TYPE_16 | VI_CTRL_GAMMA_DITHER_ON | VI_CTRL_GAMMA_ON | 0x3200, /*ctrl*/
@ -34,7 +26,8 @@ OSViMode D_80275C80 = {
} }
}; };
OSViMode D_80275CD0 = { // Used in US 1.0 MPAL (N64 SDK says: "mainly brazil")
static OSViMode sViMode_US10_MPAL = {
OS_VI_MPAL_LPN1, OS_VI_MPAL_LPN1,
{ {
VI_CTRL_TYPE_16 | VI_CTRL_GAMMA_DITHER_ON | VI_CTRL_GAMMA_ON | 0x3200, /*ctrl*/ VI_CTRL_TYPE_16 | VI_CTRL_GAMMA_DITHER_ON | VI_CTRL_GAMMA_ON | 0x3200, /*ctrl*/
@ -54,7 +47,8 @@ OSViMode D_80275CD0 = {
}; };
#if VERSION == VERSION_PAL #if VERSION == VERSION_PAL
OSViMode D_PAL_80275CD0 = { // Used in PAL
static OSViMode sViMode_PAL = {
OS_VI_PAL_LPN1, OS_VI_PAL_LPN1,
{ {
VI_CTRL_TYPE_16 | VI_CTRL_GAMMA_DITHER_ON | VI_CTRL_GAMMA_ON | VI_CTRL_DIVOT_ON | 0x3100, /*ctrl*/ VI_CTRL_TYPE_16 | VI_CTRL_GAMMA_DITHER_ON | VI_CTRL_GAMMA_ON | VI_CTRL_DIVOT_ON | 0x3100, /*ctrl*/
@ -77,43 +71,34 @@ OSViMode D_PAL_80275CD0 = {
// 42200000 3FAD097B 41F00000 457A0000 // 42200000 3FAD097B 41F00000 457A0000
// C3A68832 DDC3A724 00000000 00000000 // C3A68832 DDC3A724 00000000 00000000
static u32 sActiveFramebuffer;
u32 gActiveFramebuffer;
u32 D_80280724; u32 D_80280724;
u32 D_80280728; u32 D_80280728;
struct1 D_80280730[8]; struct1 D_80280730[8];
OSMesgQueue D_80280770; static OSMesgQueue sMesgQueue1;
OSMesg D_80280788[10]; static OSMesg sMesgBuffer1[10];
OSMesgQueue D_802807B0; static OSMesgQueue sMesgQueue2;
OSMesg D_802807C8[1]; static OSMesg sMesgBuffer2[1];
OSMesgQueue D_802807D0; static OSMesgQueue sMesgQueue3;
OSMesg D_802807E8[FRAMERATE]; static OSMesg sMesgBuffer3[FRAMERATE];
volatile s32 D_802808D8; volatile s32 D_802808D8;
s32 D_802808DC; s32 D_802808DC;
OSThread D_802808E0; static OSThread sViManagerThread;
#define THREAD0_STACK_SIZE 0x400 static u8 sViManagerThreadStack[VIMANAGER_THREAD_STACK_SIZE];
u8 thread0_stack[THREAD0_STACK_SIZE];
u32 getOtherFramebuffer(void) {
extern u8 D_803A5D00[2][0x1ECC0]; //framebuffer return NOT(sActiveFramebuffer);
void func_8024C428(void);
/* .code */
bool func_8024BD80(void){
sizeof(OSThread);
return NOT(gActiveFramebuffer);
} }
s32 func_8024BD94(void){ s32 viMgr_func_8024BD94(void){
return D_80280724; return D_80280724;
} }
s32 getActiveFramebuffer(void){ s32 getActiveFramebuffer(void){
return gActiveFramebuffer; return sActiveFramebuffer;
} }
void func_8024BDAC(OSMesgQueue *mq, OSMesg msg){ void viMgr_func_8024BDAC(OSMesgQueue *mq, OSMesg msg){
s32 i; s32 i;
for(i = 0; i < 8; i++){ for(i = 0; i < 8; i++){
if(D_80280730[i].messageQueue == NULL){ if(D_80280730[i].messageQueue == NULL){
@ -125,72 +110,79 @@ void func_8024BDAC(OSMesgQueue *mq, OSMesg msg){
} }
void func_8024BE30(void){ void viMgr_init(void) {
s32 i; s32 i;
func_8024C428(); viMgr_clearFramebuffers();
osCreateViManager(OS_PRIORITY_VIMGR); osCreateViManager(OS_PRIORITY_VIMGR);
#if VERSION == VERSION_USA_1_0 #if VERSION == VERSION_USA_1_0
if(osTvType != OS_TV_NTSC) if(osTvType != OS_TV_NTSC)
osViSetMode(&D_80275CD0); //PAL osViSetMode(&sViMode_US10_MPAL);
else else
osViSetMode(&D_80275C80); //NTSC osViSetMode(&sViMode_US10_NTSC);
#elif VERSION == VERSION_PAL #elif VERSION == VERSION_PAL
osViSetMode(&D_PAL_80275CD0); //PAL osViSetMode(&sViMode_PAL);
#endif #endif
osViSetSpecialFeatures(OS_VI_DITHER_FILTER_ON); osViSetSpecialFeatures(OS_VI_DITHER_FILTER_ON);
osViSetSpecialFeatures(OS_VI_GAMMA_OFF); osViSetSpecialFeatures(OS_VI_GAMMA_OFF);
osViSwapBuffer(&D_803A5D00); osViSwapBuffer(&gFramebuffers[0]);
osCreateMesgQueue(&D_80280770, D_80280788, 10);
osCreateMesgQueue(&D_802807B0, D_802807C8, 1); osCreateMesgQueue(&sMesgQueue1, sMesgBuffer1, 10);
osCreateMesgQueue(&D_802807D0, D_802807E8, FRAMERATE); osCreateMesgQueue(&sMesgQueue2, sMesgBuffer2, 1);
osViSetEvent(&D_80280770,NULL,1); osCreateMesgQueue(&sMesgQueue3, sMesgBuffer3, FRAMERATE);
gActiveFramebuffer = 0; osViSetEvent(&sMesgQueue1, NULL, 1);
sActiveFramebuffer = 0;
D_80280724 = 1; D_80280724 = 1;
D_80280728 = 0; D_80280728 = 0;
for(i = 0; i<8; i++){
for (i = 0; i < 8; i++) {
D_80280730[i].messageQueue = NULL; D_80280730[i].messageQueue = NULL;
} }
D_802808D8 = 0; D_802808D8 = 0;
func_8024BF94(2); viMgr_func_8024BF94(2);
osCreateThread(&D_802808E0,0,func_8024C2F8,NULL, thread0_stack + THREAD0_STACK_SIZE, 80);
osStartThread(&D_802808E0); osCreateThread(&sViManagerThread, 0, viMgr_entry, NULL, sViManagerThreadStack + VIMANAGER_THREAD_STACK_SIZE, 80);
osStartThread(&sViManagerThread);
} }
void func_8024BF94(s32 arg0){ void viMgr_func_8024BF94(s32 arg0){
D_802808DC = arg0; D_802808DC = arg0;
} }
s32 func_8024BFA0(void){ s32 viMgr_func_8024BFA0(void){
return D_802808DC; return D_802808DC;
} }
void func_8024BFAC(void){ void viMgr_func_8024BFAC(void){
osSendMesg(&D_802807B0, 0, OS_MESG_NOBLOCK); osSendMesg(&sMesgQueue2, 0, OS_MESG_NOBLOCK);
} }
void func_8024BFD8(s32 arg0){ void viMgr_func_8024BFD8(s32 arg0){
static s32 D_80280E90; static s32 D_80280E90;
osSetThreadPri(NULL, 0x7f); osSetThreadPri(NULL, 0x7f);
defragManager_setPriority(0x1E); defragManager_setPriority(0x1E);
defragManager_80240874(); defragManager_80240874();
if(arg0){ if(arg0){
osRecvMesg(&D_802807B0, NULL, OS_MESG_BLOCK); osRecvMesg(&sMesgQueue2, NULL, OS_MESG_BLOCK);
} }
while(D_802808D8 < func_8024BFA0() - D_80280E90){ while(D_802808D8 < viMgr_func_8024BFA0() - D_80280E90){
osRecvMesg(&D_802807D0, NULL, OS_MESG_BLOCK); osRecvMesg(&sMesgQueue3, NULL, OS_MESG_BLOCK);
} }
while(D_802807D0.validCount){ while(sMesgQueue3.validCount){
osRecvMesg(&D_802807D0, NULL, OS_MESG_NOBLOCK); osRecvMesg(&sMesgQueue3, NULL, OS_MESG_NOBLOCK);
} }
osViSwapBuffer(D_803A5D00[gActiveFramebuffer = func_8024BD80()]); osViSwapBuffer(gFramebuffers[sActiveFramebuffer = getOtherFramebuffer()]);
D_80280E90 = 0; D_80280E90 = 0;
while(!(osDpGetStatus() & 2) && osViGetCurrentFramebuffer() != osViGetNextFramebuffer()){ while(!(osDpGetStatus() & 2) && osViGetCurrentFramebuffer() != osViGetNextFramebuffer()){
osRecvMesg(&D_802807D0, NULL, OS_MESG_BLOCK); osRecvMesg(&sMesgQueue3, NULL, OS_MESG_BLOCK);
D_80280E90++; D_80280E90++;
}//L8024C178 }//L8024C178
D_80280724 = D_802808D8; D_80280724 = D_802808D8;
@ -200,35 +192,36 @@ void func_8024BFD8(s32 arg0){
defragManager_setPriority(0xA); defragManager_setPriority(0xA);
} }
void func_8024C1B4(void){ void viMgr_func_8024C1B4(void){
func_8024BFD8(0); viMgr_func_8024BFD8(0);
dummy_func_8025AFB8(); dummy_func_8025AFB8();
} }
void func_8024C1DC(void){ void viMgr_func_8024C1DC(void){
func_8024BFD8(1); viMgr_func_8024BFD8(1);
} }
void func_8024C1FC(OSMesgQueue *mq, OSMesg msg){ void viMgr_func_8024C1FC(OSMesgQueue *mq, OSMesg msg) {
s32 i; s32 i;
for(i = 0; i < 8; i++){
if(D_80280730[i].messageQueue == mq && D_80280730[i].message == msg){ for (i = 0; i < 8; i++) {
if (D_80280730[i].messageQueue == mq && D_80280730[i].message == msg) {
D_80280730[i].messageQueue = NULL; D_80280730[i].messageQueue = NULL;
return; return;
} }
} }
} }
void func_8024C2A0(s32 arg0) { void viMgr_setActiveFramebuffer(s32 fb_idx) {
gActiveFramebuffer = arg0; sActiveFramebuffer = fb_idx;
osViSwapBuffer(D_803A5D00[gActiveFramebuffer]); osViSwapBuffer(gFramebuffers[sActiveFramebuffer]);
} }
void func_8024C2F8(void *arg0){ void viMgr_entry(void *arg0){
s32 i; s32 i;
OSMesg sp48; OSMesg sp48;
do{ do{
osRecvMesg(&D_80280770, &sp48, OS_MESG_BLOCK); osRecvMesg(&sMesgQueue1, &sp48, OS_MESG_BLOCK);
func_80247380(); func_80247380();
D_802808D8++; D_802808D8++;
if(D_802808D8 == 420){ if(D_802808D8 == 420){
@ -236,7 +229,7 @@ void func_8024C2F8(void *arg0){
func_802485BC(); func_802485BC();
#endif #endif
} }
osSendMesg(&D_802807D0, NULL, OS_MESG_NOBLOCK); osSendMesg(&sMesgQueue3, NULL, OS_MESG_NOBLOCK);
for(i = 0; i < 8; i++){ for(i = 0; i < 8; i++){
if(D_80280730[i].messageQueue != NULL){ if(D_80280730[i].messageQueue != NULL){
@ -246,20 +239,19 @@ void func_8024C2F8(void *arg0){
}while(1); }while(1);
} }
void func_8024C408(s32 arg0){ void viMgr_setScreenBlack(s32 active) {
osViBlack(arg0); osViBlack(active);
} }
void func_8024C428(void) { void viMgr_clearFramebuffers(void) {
//zeros all both framebuffers func_80253034(&gFramebuffers, 0, (s32) ((f32)gFramebufferWidth*2*gFramebufferHeight*2)); // TODO: This function does not exist in source code, why does it work?
func_80253034(&D_803A5D00, 0, (s32) ((f32)framebuffer_width*2*framebuffer_height*2)); osWritebackDCache(&gFramebuffers, (s32) ((f32)gFramebufferWidth*2*gFramebufferHeight*2));
osWritebackDCache(&D_803A5D00, (s32) ((f32)framebuffer_width*2* framebuffer_height*2));
} }
s32 func_8024C4E8(void){ s32 viMgr_func_8024C4E8(void) {
return D_802808D8; return D_802808D8;
} }
void func_8024C4F8(s32 arg0){ void viMgr_func_8024C4F8(s32 arg0) {
D_802808D8 = arg0; D_802808D8 = arg0;
} }

View File

@ -8,7 +8,6 @@
#define ABS(d) ((d) >= 0) ? (d) : -(d) #define ABS(d) ((d) >= 0) ? (d) : -(d)
#endif #endif
extern s16 D_803A5D00[2][0xF660]; //framebuffer
extern u8 D_8037DCC8; //bottles bonus flags??? extern u8 D_8037DCC8; //bottles bonus flags???
@ -156,7 +155,7 @@ void chBottlesBonusCursor_draw(Gfx **gfx, Mtx **mtx, Vtx **vtx) {
func_80253208(gfx, func_80253208(gfx,
(s32)(D_8037E5C0.unk18[0] - sp3C/2), (s32)(D_8037E5C0.unk18[1] - sp3C/2), (s32)(D_8037E5C0.unk18[0] - sp3C/2), (s32)(D_8037E5C0.unk18[1] - sp3C/2),
(s32)sp3C, (s32)sp3C, (s32)sp3C, (s32)sp3C,
D_803A5D00[getActiveFramebuffer()] gFramebuffers[getActiveFramebuffer()]
); );
modelRender_draw(gfx, mtx, this->position, rotation, this->scale, NULL, marker_loadModelBin(chBottlesBonusCursorMarker)); modelRender_draw(gfx, mtx, this->position, rotation, this->scale, NULL, marker_loadModelBin(chBottlesBonusCursorMarker));
viewport_func_8024E030(this->position, D_8037E5C0.unk10); viewport_func_8024E030(this->position, D_8037E5C0.unk10);

View File

@ -20,7 +20,7 @@ void func_802BE940(void)
sp3C[0] = (sp3C[1] = (sp3C[2] = 0.0f)); sp3C[0] = (sp3C[1] = (sp3C[2] = 0.0f));
sp3C[1] = -1.0f; sp3C[1] = -1.0f;
ml_vec3f_pitch_rotate_copy(sp24, sp3C, 68.0f); ml_vec3f_pitch_rotate_copy(sp24, sp3C, 68.0f);
sp30[0] = sp24[1] * ((f32) framebuffer_width / framebuffer_height); sp30[0] = sp24[1] * ((f32) gFramebufferWidth / gFramebufferHeight);
sp30[1] = 0; sp30[1] = 0;
D_8037DA40[1] = sp24[1]; D_8037DA40[1] = sp24[1];

View File

@ -11,10 +11,6 @@ extern void func_8033DC18(void);
extern f32 func_8033DC20(void); extern f32 func_8033DC20(void);
extern void func_8033DC9C(f32); extern void func_8033DC9C(f32);
extern s32 framebuffer_width; //framebuffer_width
extern s32 framebuffer_height; //framebuffer_height
extern s16 D_803A5D00[2][0xF660]; //framebuffer
/* .bss */ /* .bss */
struct { struct {
f32 unk0; f32 unk0;
@ -35,7 +31,7 @@ void func_802E31D0(s32 arg0) {
if ((temp_v0 == 0) || (temp_v0 == 3)) { if ((temp_v0 == 0) || (temp_v0 == 3)) {
func_8024A85C(arg0); func_8024A85C(arg0);
func_80249DE0(0, 0, D_8037E8C0.unkC, 0, 0); func_80249DE0(0, 0, D_8037E8C0.unkC, 0, 0);
osWritebackDCache(D_803A5D00[arg0], (s32) ((f32) framebuffer_width * (f32) framebuffer_height * sizeof(s16))); osWritebackDCache(gFramebuffers[arg0], (s32) ((f32) gFramebufferWidth * (f32) gFramebufferHeight * sizeof(s16)));
} }
} }
@ -53,14 +49,14 @@ void func_802E329C(s32 arg0, Gfx **gfx_begin, Gfx **gfx_end) {
vtx_start = vtx; vtx_start = vtx;
scissorBox_SetForGameMode(&gfx, arg0); scissorBox_SetForGameMode(&gfx, arg0);
if (D_8037E8C0.unk14 == 2) { if (D_8037E8C0.unk14 == 2) {
drawRectangle2D(&gfx, 0, 0, (s32) (f32) framebuffer_width, (s32) (f32) framebuffer_height, 0, 0, 0); drawRectangle2D(&gfx, 0, 0, (s32) (f32) gFramebufferWidth, (s32) (f32) gFramebufferHeight, 0, 0, 0);
} }
if ((D_8037E8C0.unk14 == 0) || (D_8037E8C0.unk14 == 3)) { if ((D_8037E8C0.unk14 == 0) || (D_8037E8C0.unk14 == 3)) {
viewport_setRenderViewportAndPerspectiveMatrix(&gfx, &mtx); viewport_setRenderViewportAndPerspectiveMatrix(&gfx, &mtx);
gcbound_draw(&gfx); gcbound_draw(&gfx);
} }
if (D_8037E8C0.unk14 == 1) { if (D_8037E8C0.unk14 == 1) {
drawRectangle2D(&gfx, 0, 0, (s32) (f32) framebuffer_width, (s32) (f32) framebuffer_height, 0, 0, 0); drawRectangle2D(&gfx, 0, 0, (s32) (f32) gFramebufferWidth, (s32) (f32) gFramebufferHeight, 0, 0, 0);
viewport_setRenderViewportAndPerspectiveMatrix(&gfx, &mtx); viewport_setRenderViewportAndPerspectiveMatrix(&gfx, &mtx);
func_802F1858(D_8037E8C0.unk10, &gfx, &mtx, &vtx); func_802F1858(D_8037E8C0.unk10, &gfx, &mtx, &vtx);
} }
@ -95,11 +91,11 @@ void func_802E3524(s32 arg0) {
Gfx *gfx_begin; Gfx *gfx_begin;
Gfx *gfx_end; Gfx *gfx_end;
func_802E31D0(func_8024BD80()); func_802E31D0(getOtherFramebuffer());
func_802E329C(func_8024BD80(), &gfx_begin, &gfx_end); func_802E329C(getOtherFramebuffer(), &gfx_begin, &gfx_end);
func_80253EA4(gfx_begin, gfx_end); func_80253EA4(gfx_begin, gfx_end);
func_80254008(); func_80254008();
func_8024C1B4(); viMgr_func_8024C1B4();
} }
void func_802E3580(void) { void func_802E3580(void) {
@ -107,8 +103,8 @@ void func_802E3580(void) {
func_802F1884(D_8037E8C0.unk10); func_802F1884(D_8037E8C0.unk10);
func_802E5F68(); func_802E5F68();
comusicPlayer_free(); comusicPlayer_free();
dummy_func_80253420(); depthBuffer_stub();
func_8024BF94(2); viMgr_func_8024BF94(2);
} }
void dummy_func_802E35D0(void){} void dummy_func_802E35D0(void){}

View File

@ -301,7 +301,7 @@ void game_draw(s32 arg0){
if(D_8037E8E0.unkC == 0){ if(D_8037E8E0.unkC == 0){
sp2C = gfx; sp2C = gfx;
func_8024C1DC(); viMgr_func_8024C1DC();
func_80253EC4(gfx_start, sp2C); func_80253EC4(gfx_start, sp2C);
if(arg0) { if(arg0) {
@ -365,7 +365,7 @@ void func_802E4170(void){
timedFuncQueue_free(); timedFuncQueue_free();
func_802F9C48(); func_802F9C48();
modelRender_free(); modelRender_free();
dummy_func_80253420(); depthBuffer_stub();
func_802E398C(0); func_802E398C(0);
func_8030AFD8(0); func_8030AFD8(0);
func_80321854(); func_80321854();

View File

@ -481,7 +481,7 @@ void func_802E6628(s32 arg0, char *arg1) {
sp2C = func_802E4E54(0); sp2C = func_802E4E54(0);
arg0 *= D_8037E900->unk4[sp2C].height; arg0 *= D_8037E900->unk4[sp2C].height;
func_802E502C((s32) (((f32) framebuffer_width - (f32) func_802E51A4(arg1, sp2C, 0, D_8037E900->flags)) / 2), arg0, sp2C, arg1, sp28); func_802E502C((s32) (((f32) gFramebufferWidth - (f32) func_802E51A4(arg1, sp2C, 0, D_8037E900->flags)) / 2), arg0, sp2C, arg1, sp28);
} }
void func_802E66F0(s32 arg0, char *arg1) { void func_802E66F0(s32 arg0, char *arg1) {
@ -491,7 +491,7 @@ void func_802E66F0(s32 arg0, char *arg1) {
sp24 = func_802E4E54(0); sp24 = func_802E4E54(0);
arg0 *= D_8037E900->unk4[sp24].height; arg0 *= D_8037E900->unk4[sp24].height;
func_802E502C((s32) (((f32) framebuffer_width - (f32) func_802E51A4(arg1, sp24, 0, D_8037E900->flags)) / 2), arg0, sp24, arg1, D_8037E900->unk1C); func_802E502C((s32) (((f32) gFramebufferWidth - (f32) func_802E51A4(arg1, sp24, 0, D_8037E900->flags)) / 2), arg0, sp24, arg1, D_8037E900->unk1C);
} }
void func_802E67AC(void){ void func_802E67AC(void){

View File

@ -4,7 +4,6 @@
#include "variables.h" #include "variables.h"
extern s16 D_803A5D00[2][0xF660];
typedef struct Struct_Core2_6A4B0_2{ typedef struct Struct_Core2_6A4B0_2{
s16 (*vtx_coord)[3]; s16 (*vtx_coord)[3];
@ -75,8 +74,8 @@ void func_802F1440(Struct_Core2_6A4B0_2 *arg0, Gfx **gfx, Mtx **mtx, Vtx **vtx)
gSPVertex((*gfx)++, osVirtualToPhysical(i_vtx), 16, 0); gSPVertex((*gfx)++, osVirtualToPhysical(i_vtx), 16, 0);
for(sp4C = 0; sp4C < 6; sp4C++){ for(sp4C = 0; sp4C < 6; sp4C++){
for(sp50 = 0; sp50 < 9; sp50++){ for(sp50 = 0; sp50 < 9; sp50++){
s16 *tmem = arg0->tmem_ptr + (0x20*sp50 + 1) + (0x20*sp4C + 0xC)*framebuffer_width; s16 *tmem = arg0->tmem_ptr + (0x20*sp50 + 1) + (0x20*sp4C + 0xC)*gFramebufferWidth;
gDPLoadTextureTile((*gfx)++, osVirtualToPhysical(tmem), G_IM_FMT_RGBA, G_IM_SIZ_16b, framebuffer_width, 0, 0, 0, 33, 33, 0, G_TX_NOMIRROR | G_TX_CLAMP, G_TX_NOMIRROR | G_TX_CLAMP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD); gDPLoadTextureTile((*gfx)++, osVirtualToPhysical(tmem), G_IM_FMT_RGBA, G_IM_SIZ_16b, gFramebufferWidth, 0, 0, 0, 33, 33, 0, G_TX_NOMIRROR | G_TX_CLAMP, G_TX_NOMIRROR | G_TX_CLAMP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD);
for(sp54 = 0; sp54 < 2; sp54++){ for(sp54 = 0; sp54 < 2; sp54++){
gSP1Triangle((*gfx)++, var_s3, var_s3 + 1, var_s3 + 2, 0); gSP1Triangle((*gfx)++, var_s3, var_s3 + 1, var_s3 + 2, 0);
var_s3 += 3; var_s3 += 3;
@ -129,12 +128,12 @@ Struct_Core2_6A4B0_2 *func_802F18F0(void){
void func_802F1934(Struct_Core2_6A4B0_2 * arg0, s32 arg1){ void func_802F1934(Struct_Core2_6A4B0_2 * arg0, s32 arg1){
func_802F18B8(arg0); func_802F18B8(arg0);
arg0->tmem_raw_ptr = malloc(framebuffer_width*framebuffer_height*sizeof(u16) + 0x10); arg0->tmem_raw_ptr = malloc(gFramebufferWidth*gFramebufferHeight*sizeof(u16) + 0x10);
arg0->tmem_ptr = arg0->tmem_raw_ptr; arg0->tmem_ptr = arg0->tmem_raw_ptr;
while(((s32)arg0->tmem_ptr & 0x10) == 0){ while(((s32)arg0->tmem_ptr & 0x10) == 0){
arg0->tmem_ptr = (u16*)((s32)arg0->tmem_ptr + 1); arg0->tmem_ptr = (u16*)((s32)arg0->tmem_ptr + 1);
} }
func_80253010(arg0->tmem_ptr, D_803A5D00[arg1], framebuffer_width*framebuffer_height*sizeof(u16)); func_80253010(arg0->tmem_ptr, gFramebuffers[arg1], gFramebufferWidth*gFramebufferHeight*sizeof(u16));
osWriteBackDCacheAll(); osWriteBackDCacheAll();
} }
@ -163,8 +162,8 @@ void func_802F1A10(Struct_Core2_6A4B0_2 *arg0, f32 angle_degrees) {
cos = cosf(angle_degrees * 2 * BAD_PI); cos = cosf(angle_degrees * 2 * BAD_PI);
sin = sinf(angle_degrees * 2 * BAD_PI); sin = sinf(angle_degrees * 2 * BAD_PI);
viewport_getPosition_vec3f(spC0); viewport_getPosition_vec3f(spC0);
spCC[0] = (-(framebuffer_width / 2) * 4) + 8; spCC[0] = (-(gFramebufferWidth / 2) * 4) + 8;
spCC[1] = ((framebuffer_height / 2) * 4) - 0x38; spCC[1] = ((gFramebufferHeight / 2) * 4) - 0x38;
spCC[2] = -0xA; spCC[2] = -0xA;
for(var_s6 = 0; var_s6 < 6; var_s6++){ for(var_s6 = 0; var_s6 < 6; var_s6++){
for(var_s4 = 0; var_s4 < 9; var_s4++){ for(var_s4 = 0; var_s4 < 9; var_s4++){

View File

@ -6,7 +6,6 @@
#include "ml/mtx.h" #include "ml/mtx.h"
extern s16 D_803A5D00[2][0xF660];
extern f32 func_80257680(f32, f32, f32); extern f32 func_80257680(f32, f32, f32);
@ -87,23 +86,23 @@ void func_802F1FC0(Struct65s *self, Gfx **gfx, Mtx **mtx, Vtx **vtx) {
mlMtx_apply_vec3f(spD0, spD0); mlMtx_apply_vec3f(spD0, spD0);
spD0[0] = (-297.0f * spD0[0]) / spD0[2]; spD0[0] = (-297.0f * spD0[0]) / spD0[2];
spD0[1] = (297.0f * spD0[1]) / spD0[2]; spD0[1] = (297.0f * spD0[1]) / spD0[2];
spC4 = (s32) (spD0[0] + (f32) (framebuffer_width / 2)); spC4 = (s32) (spD0[0] + (f32) (gFramebufferWidth / 2));
spC0 = (s32) (spD0[1] + (f32) (framebuffer_height / 2)); spC0 = (s32) (spD0[1] + (f32) (gFramebufferHeight / 2));
if (spC4 < 0) { if (spC4 < 0) {
spC4 = 0; spC4 = 0;
} else if (framebuffer_width - 0x20 < spC4) { } else if (gFramebufferWidth - 0x20 < spC4) {
spC4 = framebuffer_width - 0x20; spC4 = gFramebufferWidth - 0x20;
} }
if (spC0 < 0) { if (spC0 < 0) {
spC0 = 0; spC0 = 0;
} else if (framebuffer_height - 0x20 < spC0) { } else if (gFramebufferHeight - 0x20 < spC0) {
spC0 = framebuffer_height - 0x20; spC0 = gFramebufferHeight - 0x20;
} }
gSPDisplayList((*gfx)++, D_80368AC0); gSPDisplayList((*gfx)++, D_80368AC0);
func_80347FC0(gfx, D_80368AB0[1].unk0, 0, 0, 0, 0, 0, NULL, NULL, &width, &height); func_80347FC0(gfx, D_80368AB0[1].unk0, 0, 0, 0, 0, 0, NULL, NULL, &width, &height);
temp_addr = &D_803A5D00[func_8024BD80()][spC0*framebuffer_width + (spC4 & 0xFFFC)]; temp_addr = &gFramebuffers[getOtherFramebuffer()][spC0*gFramebufferWidth + (spC4 & 0xFFFC)];
gDPSetTextureImage((*gfx)++, G_IM_FMT_RGBA, G_IM_SIZ_16b, framebuffer_width, temp_addr); gDPSetTextureImage((*gfx)++, G_IM_FMT_RGBA, G_IM_SIZ_16b, gFramebufferWidth, temp_addr);
gDPSetTile((*gfx)++, G_IM_FMT_RGBA, G_IM_SIZ_16b, 9, 0x0080, G_TX_LOADTILE, 0, G_TX_NOMIRROR | G_TX_CLAMP, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOMIRROR | G_TX_CLAMP, G_TX_NOMASK, G_TX_NOLOD); gDPSetTile((*gfx)++, G_IM_FMT_RGBA, G_IM_SIZ_16b, 9, 0x0080, G_TX_LOADTILE, 0, G_TX_NOMIRROR | G_TX_CLAMP, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOMIRROR | G_TX_CLAMP, G_TX_NOMASK, G_TX_NOLOD);
gDPLoadSync((*gfx)++); gDPLoadSync((*gfx)++);
gDPLoadTile((*gfx)++, G_TX_LOADTILE, 0, 0, 0x008C, 0x007C); gDPLoadTile((*gfx)++, G_TX_LOADTILE, 0, 0, 0x008C, 0x007C);

View File

@ -740,8 +740,8 @@ void _printbuffer_draw_letter(char letter, f32* xPtr, f32* yPtr, f32 arg3, Gfx *
temp_f24 = (sp214->x - 1.0); temp_f24 = (sp214->x - 1.0);
spD0 = sp214->y - 1.0; spD0 = sp214->y - 1.0;
temp_f26 = (f64) sp200 - (f32) framebuffer_width * 0.5; temp_f26 = (f64) sp200 - (f32) gFramebufferWidth * 0.5;
spC0 = (f64)f28 - (f32)framebuffer_height*0.5 -0.5f; spC0 = (f64)f28 - (f32)gFramebufferHeight*0.5 -0.5f;
gSPVertex((*gfx)++, *vtx, 4, 0); gSPVertex((*gfx)++, *vtx, 4, 0);
for(iy = 0.0f; iy < 2.0; iy+= 1.0){ for(iy = 0.0f; iy < 2.0; iy+= 1.0){
for(ix = 0.0f; ix < 2.0; ix += 1.0){ for(ix = 0.0f; ix < 2.0; ix += 1.0){

View File

@ -1,9 +1,8 @@
#include <ultra64.h> #include <ultra64.h>
#include "core1/core1.h"
#include "functions.h" #include "functions.h"
#include "variables.h" #include "variables.h"
extern s16 D_803A5D00[2][0xF660];
void func_802FEDE0(BKTextureList *texture_list, s32 indx, s32 x_offset, s32 y_offset){ void func_802FEDE0(BKTextureList *texture_list, s32 indx, s32 x_offset, s32 y_offset){
u16 *sp24; u16 *sp24;
u16 *frame_buffer_ptr; u16 *frame_buffer_ptr;
@ -11,10 +10,10 @@ void func_802FEDE0(BKTextureList *texture_list, s32 indx, s32 x_offset, s32 y_of
s32 x; s32 x;
sp24 = (u16*)func_802EA620(texture_list) + indx*32*32; sp24 = (u16*)func_802EA620(texture_list) + indx*32*32;
frame_buffer_ptr = D_803A5D00[getActiveFramebuffer()]; frame_buffer_ptr = gFramebuffers[getActiveFramebuffer()];
for(y = 0; y < 32; y++){//L802FEE60 for(y = 0; y < 32; y++){//L802FEE60
for(x = 0; x < 32; x++){//L802FEE68 for(x = 0; x < 32; x++){//L802FEE68
sp24[32*(31 - y) + x] = frame_buffer_ptr[(y_offset + y)*framebuffer_width + (x_offset + x)] | 1; //framebuffer to texture??? sp24[32*(31 - y) + x] = frame_buffer_ptr[(y_offset + y)*gFramebufferWidth + (x_offset + x)] | 1; //framebuffer to texture???
}; };
}; };
} }
@ -25,12 +24,12 @@ void func_802FEF48(BKModelBin *model_bin){
s32 x, y; s32 x, y;
texture_list = model_getTextureList(model_bin); texture_list = model_getTextureList(model_bin);
osInvalDCache((void *)D_803A5D00[getActiveFramebuffer()], framebuffer_width * framebuffer_height*2); osInvalDCache((void *)gFramebuffers[getActiveFramebuffer()], gFramebufferWidth * gFramebufferHeight*2);
for(y = 0; y < 8; y++){//L802FEFEC for(y = 0; y < 8; y++){//L802FEFEC
for(x = 0; x < 10; x++){ for(x = 0; x < 10; x++){
//get textures from framebuffer??? //get textures from framebuffer???
func_802FEDE0(texture_list, 10*y + x, 32*x + (framebuffer_width - 10*32)/2, (s32)32*y + (framebuffer_height - 8*32)/2); func_802FEDE0(texture_list, 10*y + x, 32*x + (gFramebufferWidth - 10*32)/2, (s32)32*y + (gFramebufferHeight - 8*32)/2);
} }
}; };

View File

@ -1,9 +1,8 @@
#include <ultra64.h> #include <ultra64.h>
#include "core1/core1.h"
#include "functions.h" #include "functions.h"
#include "variables.h" #include "variables.h"
extern u8 D_803A5D00[2][0x1ecc0];
#define TILE_SIZE 32 #define TILE_SIZE 32
#define TILE_COUNT_X 5 #define TILE_COUNT_X 5
@ -91,7 +90,7 @@ void func_8030C27C(void){
void func_8030C2D4(Gfx **gdl, Mtx **mptr, Vtx **vptr){ void func_8030C2D4(Gfx **gdl, Mtx **mptr, Vtx **vptr){
scissorBox_setDefault(); scissorBox_setDefault();
func_80253640(gdl, D_803A5D00[getActiveFramebuffer()]); func_80253640(gdl, gFramebuffers[getActiveFramebuffer()]);
} }
// Draws a 160x128 image pointed to by D_80382450 into the center of the screen // Draws a 160x128 image pointed to by D_80382450 into the center of the screen

View File

@ -1,9 +1,9 @@
#include <ultra64.h> #include <ultra64.h>
#include "core1/core1.h"
#include "functions.h" #include "functions.h"
#include "variables.h" #include "variables.h"
extern s16 D_803A5D00[2][0xF660];
Gfx D_8036C630[] = Gfx D_8036C630[] =
{ {
@ -40,10 +40,10 @@ void func_80314BB0(Gfx **gfx, Mtx **mtx, Vtx **vtx, void * frame_buffer_1, void
s32 y; s32 y;
gSPDisplayList((*gfx)++, D_8036C630); gSPDisplayList((*gfx)++, D_8036C630);
gDPSetColorImage((*gfx)++, G_IM_FMT_RGBA, G_IM_SIZ_16b, framebuffer_width, OS_PHYSICAL_TO_K0(frame_buffer_1)); gDPSetColorImage((*gfx)++, G_IM_FMT_RGBA, G_IM_SIZ_16b, gFramebufferWidth, OS_PHYSICAL_TO_K0(frame_buffer_1));
for(y = 0; y < framebuffer_height / 32 + 1; y++){ for(y = 0; y < gFramebufferHeight / 32 + 1; y++){
for(x = 0; x < framebuffer_width / 32 + 1; x++){ for(x = 0; x < gFramebufferWidth / 32 + 1; x++){
gDPLoadTextureTile((*gfx)++, osVirtualToPhysical(frame_buffer_2), G_IM_FMT_RGBA, G_IM_SIZ_16b, framebuffer_width, framebuffer_height, gDPLoadTextureTile((*gfx)++, osVirtualToPhysical(frame_buffer_2), G_IM_FMT_RGBA, G_IM_SIZ_16b, gFramebufferWidth, gFramebufferHeight,
0x20*x, 0x20*y, 0x20*(x + 1) - 1, 0x20*(y + 1) - 1, 0x20*x, 0x20*y, 0x20*(x + 1) - 1, 0x20*(y + 1) - 1,
NULL, G_TX_CLAMP, G_TX_CLAMP, G_TX_NOMASK, G_TX_NOMASK, 0, 0 NULL, G_TX_CLAMP, G_TX_CLAMP, G_TX_NOMASK, G_TX_NOMASK, 0, 0
); );
@ -53,13 +53,13 @@ void func_80314BB0(Gfx **gfx, Mtx **mtx, Vtx **vtx, void * frame_buffer_1, void
} }
} }
gSPDisplayList((*gfx)++, D_8036C690); gSPDisplayList((*gfx)++, D_8036C690);
gDPSetColorImage((*gfx)++, G_IM_FMT_RGBA, G_IM_SIZ_16b, framebuffer_width, OS_PHYSICAL_TO_K0(D_803A5D00[getActiveFramebuffer()])); gDPSetColorImage((*gfx)++, G_IM_FMT_RGBA, G_IM_SIZ_16b, gFramebufferWidth, OS_PHYSICAL_TO_K0(gFramebuffers[getActiveFramebuffer()]));
} }
void func_80315084(Gfx **gfx, Mtx **mtx, Vtx **vtx){ void func_80315084(Gfx **gfx, Mtx **mtx, Vtx **vtx){
func_80335128(0); func_80335128(0);
D_803830A0 = 2; D_803830A0 = 2;
func_80314BB0(gfx, mtx, vtx, zBuffer_get(), D_803A5D00[getActiveFramebuffer()]); func_80314BB0(gfx, mtx, vtx, zBuffer_get(), gFramebuffers[getActiveFramebuffer()]);
} }
void func_80315110(Gfx **gfx, Mtx **mtx, Vtx **vtx){ void func_80315110(Gfx **gfx, Mtx **mtx, Vtx **vtx){
@ -72,7 +72,7 @@ void func_80315110(Gfx **gfx, Mtx **mtx, Vtx **vtx){
else{ else{
D_803830A0--; D_803830A0--;
} }
func_80314BB0(gfx, mtx, vtx, D_803A5D00[getActiveFramebuffer()], zBuffer_get()); func_80314BB0(gfx, mtx, vtx, gFramebuffers[getActiveFramebuffer()], zBuffer_get());
} }
void func_803151D0(Gfx **gfx, Mtx **mtx, Vtx **vtx){ void func_803151D0(Gfx **gfx, Mtx **mtx, Vtx **vtx){

View File

@ -143,7 +143,7 @@ void func_803223AC(void) {
func_8032236C(0x1C, 4, &sp28); func_8032236C(0x1C, 4, &sp28);
func_8032236C(0x1D, 5, &sp28); func_8032236C(0x1D, 5, &sp28);
sp28 = (sp28 == 0) ? 2 : sp28; sp28 = (sp28 == 0) ? 2 : sp28;
func_8024BF94(sp28); viMgr_func_8024BF94(sp28);
} }
void func_80322490(void) { void func_80322490(void) {

View File

@ -31,7 +31,7 @@ void func_80334540(Gfx** gdl, Mtx **mptr, Vtx **vptr) {
f32 sp40; f32 sp40;
if (D_803835E0 == 0) { if (D_803835E0 == 0) {
drawRectangle2D(gdl, 0, 0, framebuffer_width, framebuffer_height, 0, 0, 0); drawRectangle2D(gdl, 0, 0, gFramebufferWidth, gFramebufferHeight, 0, 0, 0);
func_802BBD2C(&sp44, &sp40); func_802BBD2C(&sp44, &sp40);
viewport_setNearAndFar(sp44, sp40); viewport_setNearAndFar(sp44, sp40);
viewport_setRenderViewportAndPerspectiveMatrix(gdl, mptr); viewport_setRenderViewportAndPerspectiveMatrix(gdl, mptr);

View File

@ -21,7 +21,7 @@ void func_8033DC18(void){}
f32 func_8033DC20(void){ f32 func_8033DC20(void){
f32 out; f32 out;
D_80384470 = func_8024BD94(); D_80384470 = viMgr_func_8024BD94();
out = 0.016666666666666666*D_80384470; out = 0.016666666666666666*D_80384470;
return out; return out;
} }

View File

@ -39,7 +39,7 @@ f32 time_getDelta(void){
} }
f32 func_8033DDB8(void){ f32 func_8033DDB8(void){
return func_8024BD94()*(1/60.0); return viMgr_func_8024BD94()*(1/60.0);
} }
f32 func_8033DDEC(void){ f32 func_8033DDEC(void){

View File

@ -136,14 +136,14 @@ void func_80350818(Gfx **gfx, Mtx **mtx, Vtx **vtx) {
sp9C[2] = temp_s1->unk4[2]; sp9C[2] = temp_s1->unk4[2];
ml_vec3f_yaw_rotate_copy(sp9C, sp9C, -spD0[1]); ml_vec3f_yaw_rotate_copy(sp9C, sp9C, -spD0[1]);
ml_vec3f_pitch_rotate_copy(sp9C, sp9C, -spD0[0]); ml_vec3f_pitch_rotate_copy(sp9C, sp9C, -spD0[0]);
if (!(((1.2 * (f32)framebuffer_width) / 2) < sp9C[0]) && !(sp9C[0] < ((-1.2 * (f32)framebuffer_width) / 2))) { if (!(((1.2 * (f32)gFramebufferWidth) / 2) < sp9C[0]) && !(sp9C[0] < ((-1.2 * (f32)gFramebufferWidth) / 2))) {
if (!(((1.2 * (f32)framebuffer_height) / 2) < sp9C[1]) && !(sp9C[1] < ((-1.2 * (f32)framebuffer_height) / 2))) { if (!(((1.2 * (f32)gFramebufferHeight) / 2) < sp9C[1]) && !(sp9C[1] < ((-1.2 * (f32)gFramebufferHeight) / 2))) {
sp90[0] = -sp9C[0]; sp90[0] = -sp9C[0];
sp90[1] = -sp9C[1]; sp90[1] = -sp9C[1];
sp90[2] = sp9C[2]; sp90[2] = sp9C[2];
ml_vec3f_pitch_rotate_copy(sp90, sp90, spD0[0]); ml_vec3f_pitch_rotate_copy(sp90, sp90, spD0[0]);
ml_vec3f_yaw_rotate_copy(sp90, sp90, spD0[1]); ml_vec3f_yaw_rotate_copy(sp90, sp90, spD0[1]);
var_f22 = 1.0f - (((sp9C[0] * sp9C[0]) + (sp9C[1] * sp9C[1])) / ((f32)framebuffer_height * (f32)framebuffer_height)); var_f22 = 1.0f - (((sp9C[0] * sp9C[0]) + (sp9C[1] * sp9C[1])) / ((f32)gFramebufferHeight * (f32)gFramebufferHeight));
if (var_f22 < 0.0f) { if (var_f22 < 0.0f) {
var_f22 = 0.0f; var_f22 = 0.0f;
} }
@ -181,7 +181,7 @@ void func_80350BFC(void) {
if (D_80386170.unk4 != NULL) { if (D_80386170.unk4 != NULL) {
D_80386170.unk0 = func_80350780(D_80386170.unk4->unk10); D_80386170.unk0 = func_80350780(D_80386170.unk4->unk10);
D_80386170.unk8 = assetcache_get(0x882); D_80386170.unk8 = assetcache_get(0x882);
ml_vec3f_set_length(D_80386170.unk4->unk4, (2*(f32)framebuffer_width) / 2); ml_vec3f_set_length(D_80386170.unk4->unk4, (2*(f32)gFramebufferWidth) / 2);
D_8038617C.unk0 = 1; D_8038617C.unk0 = 1;
D_8038617C.unk1 = 0; D_8038617C.unk1 = 0;
} }

View File

@ -86,8 +86,8 @@ void fxairscore_draw(enum item_e item_id, struct8s *arg1, Gfx **gfx, Mtx **mtx,
gDPSetPrimColor((*gfx)++, 0, 0, 0x00, 0x00, 0x00, 0x78); gDPSetPrimColor((*gfx)++, 0, 0, 0x00, 0x00, 0x00, 0x78);
} }
x = func_802FB0E4(arg1); x = func_802FB0E4(arg1);
x = ((-40 + x) + D_80381F68[var_s6]) - ((f32) framebuffer_width / 2); x = ((-40 + x) + D_80381F68[var_s6]) - ((f32) gFramebufferWidth / 2);
y = ((78 + (i_part * 15.5)) - ((f32) framebuffer_height / 2)); y = ((78 + (i_part * 15.5)) - ((f32) gFramebufferHeight / 2));
//stagger x position //stagger x position
x = (i_part & 1) ? x + 5.0f : x - 5.0f; x = (i_part & 1) ? x + 5.0f : x - 5.0f;

View File

@ -8,9 +8,6 @@ f32 time_getDelta(void);
f32 func_802FB0DC(struct8s *); f32 func_802FB0DC(struct8s *);
f32 func_802FB0E4(struct8s *); f32 func_802FB0E4(struct8s *);
extern s32 framebuffer_width; //framebuffer_w
extern s32 framebuffer_height; //framebuffer_h
Gfx D_80369920[] = { Gfx D_80369920[] = {
gsDPPipeSync(), gsDPPipeSync(),
@ -154,8 +151,8 @@ void func_802FD360(struct8s *arg0, Gfx **gfx, Mtx **mtx, Vtx **vtx){
tmp_f26 = (arg0->unk20 == ITEM_0_HOURGLASS_TIMER && texture_width == 0x10) ? 1.0f : 0.0f; tmp_f26 = (arg0->unk20 == ITEM_0_HOURGLASS_TIMER && texture_width == 0x10) ? 1.0f : 0.0f;
for(tmp_s4 = 0; tmp_s4 < 2; tmp_s4++){//L802FD528 for(tmp_s4 = 0; tmp_s4 < 2; tmp_s4++){//L802FD528
for(tmp_s2 = 0; tmp_s2 < 2; tmp_s2++){// for(tmp_s2 = 0; tmp_s2 < 2; tmp_s2++){//
(*vtx)->v.ob[0] = ((func_802FB0DC(arg0) + (((texture_width*arg0->unk40*tmp_s2 - texture_width*arg0->unk40/2) - (f32)framebuffer_width/2) + arg0->unk38)) + tmp_f26) * 4.0f; (*vtx)->v.ob[0] = ((func_802FB0DC(arg0) + (((texture_width*arg0->unk40*tmp_s2 - texture_width*arg0->unk40/2) - (f32)gFramebufferWidth/2) + arg0->unk38)) + tmp_f26) * 4.0f;
(*vtx)->v.ob[1] = ((((texture_height*arg0->unk40/2 - texture_height*arg0->unk40*tmp_s4) + (f32)framebuffer_height/2) - arg0->unk3C) - func_802FB0E4(arg0)*arg0->unk4C)*4.0f; (*vtx)->v.ob[1] = ((((texture_height*arg0->unk40/2 - texture_height*arg0->unk40*tmp_s4) + (f32)gFramebufferHeight/2) - arg0->unk3C) - func_802FB0E4(arg0)*arg0->unk4C)*4.0f;
(*vtx)->v.ob[2] = -0x14; (*vtx)->v.ob[2] = -0x14;
(*vtx)->v.tc[0] = ((texture_width -1) * tmp_s2) << 6; (*vtx)->v.tc[0] = ((texture_width -1) * tmp_s2) << 6;
(*vtx)->v.tc[1] = ((texture_height -1) * tmp_s4) << 6; (*vtx)->v.tc[1] = ((texture_height -1) * tmp_s4) << 6;

View File

@ -7,7 +7,6 @@
extern f32 vtxList_getGlobalNorm(BKVertexList *); extern f32 vtxList_getGlobalNorm(BKVertexList *);
extern void func_80253208(Gfx **gdl, s32 x, s32 y, s32 w, s32 h, void *color_buffer); extern void func_80253208(Gfx **gdl, s32 x, s32 y, s32 w, s32 h, void *color_buffer);
extern s16 D_803A5D00[2][0xF660];
extern f32 func_802FB0E4(struct8s*); extern f32 func_802FB0E4(struct8s*);
typedef struct { typedef struct {
@ -210,7 +209,7 @@ void fxcommon3score_draw(enum item_e item_id, void *arg1, Gfx **gfx, Mtx **mtx,
if(a1->unk6C == 0.0f){ if(a1->unk6C == 0.0f){
a1->unk6C = 1.1*(vtxList_getGlobalNorm(model_getVtxList(a1->model)) * a1->unk3C); a1->unk6C = 1.1*(vtxList_getGlobalNorm(model_getVtxList(a1->model)) * a1->unk3C);
} }
func_80253208(gfx, a1->unk30 - a1->unk6C, sp40 - a1->unk6C, 2*a1->unk6C, 2*a1->unk6C, D_803A5D00[getActiveFramebuffer()]); func_80253208(gfx, a1->unk30 - a1->unk6C, sp40 - a1->unk6C, 2*a1->unk6C, 2*a1->unk6C, gFramebuffers[getActiveFramebuffer()]);
if(a1->anim_ctrl != NULL){ if(a1->anim_ctrl != NULL){
animctrl_drawSetup(a1->anim_ctrl, sp5C, 1); animctrl_drawSetup(a1->anim_ctrl, sp5C, 1);
} }

View File

@ -6,9 +6,6 @@
extern f32 func_802FB0E4(struct8s*); extern f32 func_802FB0E4(struct8s*);
extern s32 framebuffer_width;
extern s32 framebuffer_height;
/* .data */ /* .data */
BKSprite * gSpriteHealth = NULL; BKSprite * gSpriteHealth = NULL;
BKSprite * gSpriteRedHealth = NULL; BKSprite * gSpriteRedHealth = NULL;
@ -112,8 +109,8 @@ void fxhealthscore_draw(enum item_e item_id, struct8s *arg1, Gfx **gfx, Mtx **mt
gDPSetPrimColor((*gfx)++, 0, 0, 0xFF, 0xFF, 0xFF, 0x78); gDPSetPrimColor((*gfx)++, 0, 0, 0xFF, 0xFF, 0xFF, 0x78);
} }
f20 = 96.0f - (f32) framebuffer_width / 2 + (i * 13); f20 = 96.0f - (f32) gFramebufferWidth / 2 + (i * 13);
f14 = (f32) framebuffer_height / 2 - func_802FB0E4(arg1) - D_80381F08[s6] - -48.0f; f14 = (f32) gFramebufferHeight / 2 - func_802FB0E4(arg1) - D_80381F08[s6] - -48.0f;
f14 = (i & 1) ? f14 + 5.75 : f14 - 5.75; f14 = (i & 1) ? f14 + 5.75 : f14 - 5.75;
gSPVertex((*gfx)++, *vtx, 4, 0); gSPVertex((*gfx)++, *vtx, 4, 0);

View File

@ -141,8 +141,8 @@ void fxhoneycarrierscore_draw(s32 arg0, struct8s *arg1, Gfx **arg2, Mtx **arg3,
} }
} }
} }
sp128 = (244.0f - ((f32) framebuffer_width / 2)); sp128 = (244.0f - ((f32) gFramebufferWidth / 2));
sp124 = func_802FB0E4(arg1) + ((f32) framebuffer_height / 2) - 246.0f; sp124 = func_802FB0E4(arg1) + ((f32) gFramebufferHeight / 2) - 246.0f;
guTranslate(*arg3, sp128 * 4.0f, sp124 * 4.0f, 0.0f); guTranslate(*arg3, sp128 * 4.0f, sp124 * 4.0f, 0.0f);
gSPMatrix((*arg2)++, OS_K0_TO_PHYSICAL((*arg3)++), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPMatrix((*arg2)++, OS_K0_TO_PHYSICAL((*arg3)++), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
guRotate(*arg3, func_802FDE60(D_803815D8 + D_803815DC), 0.0f, 0.0f, 1.0f); guRotate(*arg3, func_802FDE60(D_803815D8 + D_803815DC), 0.0f, 0.0f, 1.0f);

View File

@ -176,8 +176,8 @@ void fxjinjoscore_draw(s32 arg0, struct8s *arg1, Gfx **gfx, Mtx **mtx, Vtx **vtx
// If the jinjo is collected then it's drawn fully opaque, otherwise it's drawn with partial alpha // If the jinjo is collected then it's drawn fully opaque, otherwise it's drawn with partial alpha
gDPSetPrimColor((*gfx)++, 0, 0, 0x00, 0x00, 0x00, jinjo_collected ? 0xFF : 0x6E); gDPSetPrimColor((*gfx)++, 0, 0, 0x00, 0x00, 0x00, jinjo_collected ? 0xFF : 0x6E);
} }
center_x = pos_x - (f32) framebuffer_width / 2 + x_offset; center_x = pos_x - (f32) gFramebufferWidth / 2 + x_offset;
center_y = (f32) framebuffer_height / 2 + func_802FB0E4(arg1) - 266.0f + 40.0f + y_offset - D_80381E78[jinjo_id]; center_y = (f32) gFramebufferHeight / 2 + func_802FB0E4(arg1) - 266.0f + 40.0f + y_offset - D_80381E78[jinjo_id];
gSPVertex((*gfx)++, *vtx, 4, 0); gSPVertex((*gfx)++, *vtx, 4, 0);
// Set up the positions of the four vertices // Set up the positions of the four vertices
for(i = 0; i < 2; i++){ for(i = 0; i < 2; i++){

View File

@ -102,8 +102,8 @@ void fxlifescore_draw(enum item_e item_id, struct8s *arg1, Gfx **gfx, Mtx **mtx,
sp104 = sp104 + 4; sp104 = sp104 + 4;
} }
var_s5 = (40.0f - ((f32) framebuffer_width / 2)) + spE0; var_s5 = (40.0f - ((f32) gFramebufferWidth / 2)) + spE0;
var_s4 = (((((f32) framebuffer_height / 2) - func_802FB0E4(arg1)) - -16.0f) - spDC); var_s4 = (((((f32) gFramebufferHeight / 2) - func_802FB0E4(arg1)) - -16.0f) - spDC);
for(var_v1 = 0; var_v1 < 2; var_v1++){ for(var_v1 = 0; var_v1 < 2; var_v1++){
for(var_v0 = 0; var_v0 < 2; var_v0++){ for(var_v0 = 0; var_v0 < 2; var_v0++){
(*vtx)->v.ob[0] = (s16) (s32) (((((f32) spF0 * D_80381EB8 * (f32) var_v0) - (((f32) spE8 * D_80381EB8) / 2)) + var_s5) * 4.0f); (*vtx)->v.ob[0] = (s16) (s32) (((((f32) spF0 * D_80381EB8 * (f32) var_v0) - (((f32) spE8 * D_80381EB8) / 2)) + var_s5) * 4.0f);

View File

@ -26,7 +26,7 @@ u8 _gcbound_blue; //D_80380902
void _gcbound_draw(Gfx** dl, s32 a, s32 r, s32 g, s32 b){ void _gcbound_draw(Gfx** dl, s32 a, s32 r, s32 g, s32 b){
gSPDisplayList((*dl)++, &D_803688E8); gSPDisplayList((*dl)++, &D_803688E8);
gDPSetFogColor((*dl)++, r, g, b, a); gDPSetFogColor((*dl)++, r, g, b, a);
gSPTextureRectangle((*dl)++, 0, 0, (framebuffer_width-1)<<2, (framebuffer_height-1)<<2, 0, 0, 0, 0x100, 0x100); gSPTextureRectangle((*dl)++, 0, 0, (gFramebufferWidth-1)<<2, (gFramebufferHeight-1)<<2, 0, 0, 0, 0x100, 0x100);
} }
void gcbound_draw(Gfx** dl){ void gcbound_draw(Gfx** dl){

View File

@ -1373,7 +1373,7 @@ void gcpausemenu_draw(Gfx **gfx, Mtx **mtx, Vtx **vtx) {
} }
gcpausemenu_drawSprite(gfx, mtx, vtx, D_80383010.joystick_sprite, D_80383010.joystick_frame, 30.0f, 196.0f, 1, (s32) D_80383010.left_joystick_alpha); gcpausemenu_drawSprite(gfx, mtx, vtx, D_80383010.joystick_sprite, D_80383010.joystick_frame, 30.0f, 196.0f, 1, (s32) D_80383010.left_joystick_alpha);
gcpausemenu_drawSprite(gfx, mtx, vtx, D_80383010.joystick_sprite, D_80383010.joystick_frame, (f32)(framebuffer_width - 0x1E), 196.0f, 0, (s32) D_80383010.right_joystick_alpha); gcpausemenu_drawSprite(gfx, mtx, vtx, D_80383010.joystick_sprite, D_80383010.joystick_frame, (f32)(gFramebufferWidth - 0x1E), 196.0f, 0, (s32) D_80383010.right_joystick_alpha);
var_a0 = ((*((u32 * ) & D_80383010.state) << 0x1c) >> 0x1f); //left_joystick_visible var_a0 = ((*((u32 * ) & D_80383010.state) << 0x1c) >> 0x1f); //left_joystick_visible
if (var_a0 != 0) { if (var_a0 != 0) {
if (D_80383010.left_joystick_alpha < 0xFF) { if (D_80383010.left_joystick_alpha < 0xFF) {
@ -1396,7 +1396,7 @@ void gcpausemenu_draw(Gfx **gfx, Mtx **mtx, Vtx **vtx) {
D_80383010.right_joystick_alpha = (D_80383010.right_joystick_alpha - 0xC > 0) ? D_80383010.right_joystick_alpha - 0xC : 0; D_80383010.right_joystick_alpha = (D_80383010.right_joystick_alpha - 0xC > 0) ? D_80383010.right_joystick_alpha - 0xC : 0;
} }
} }
gcpausemenu_drawSprite(gfx, mtx, vtx, D_80383010.b_button_sprite, (s32) D_80383010.b_button_frame, framebuffer_width * 0.5, 196.0f, 0, (s32) D_80383010.b_button_alpha); gcpausemenu_drawSprite(gfx, mtx, vtx, D_80383010.b_button_sprite, (s32) D_80383010.b_button_frame, gFramebufferWidth * 0.5, 196.0f, 0, (s32) D_80383010.b_button_alpha);
var_a0 = ((*((u32 * ) & D_80383010.state) << 0x1e) >> 0x1f);//b_button_visible var_a0 = ((*((u32 * ) & D_80383010.state) << 0x1e) >> 0x1f);//b_button_visible
if (var_a0 != 0) { if (var_a0 != 0) {
if (D_80383010.b_button_alpha < 0xFF) { if (D_80383010.b_button_alpha < 0xFF) {

View File

@ -75,7 +75,7 @@ void sky_draw(Gfx **gfx, Mtx **mtx, Vtx **vtx){
viewport_setNearAndFar(5.0f, 15000.0f); viewport_setNearAndFar(5.0f, 15000.0f);
if(gcSky.model_bins[0]){ if(gcSky.model_bins[0]){
drawRectangle2D(gfx, 0, 0, (s32)(f32) framebuffer_width, (s32)(f32)framebuffer_height,0, 0, 0); //fill screen with black drawRectangle2D(gfx, 0, 0, (s32)(f32) gFramebufferWidth, (s32)(f32)gFramebufferHeight,0, 0, 0); //fill screen with black
viewport_setRenderViewportAndPerspectiveMatrix(gfx, mtx); viewport_setRenderViewportAndPerspectiveMatrix(gfx, mtx);
viewport_getPosition_vec3f(position); viewport_getPosition_vec3f(position);
for(i = 0; i < 3; i++){ for(i = 0; i < 3; i++){
@ -89,7 +89,7 @@ void sky_draw(Gfx **gfx, Mtx **mtx, Vtx **vtx){
} }
} }
else{//L8030B200 else{//L8030B200
drawRectangle2D(gfx, 0, 0, (s32)(f32) framebuffer_width, (s32)(f32)framebuffer_height, 0, 0, 0); drawRectangle2D(gfx, 0, 0, (s32)(f32) gFramebufferWidth, (s32)(f32)gFramebufferHeight, 0, 0, 0);
}//L8030B254 }//L8030B254
} }

View File

@ -861,7 +861,7 @@ void func_803164B0(GcZoombox *this, Gfx **gfx, Mtx **mtx, s32 arg3, s32 arg4, BK
} }
sp2C[1] = this->unk172 + ((f32) arg4 * this->unk198); sp2C[1] = this->unk172 + ((f32) arg4 * this->unk198);
sp2C[2] = -10.0f; sp2C[2] = -10.0f;
func_80252330((sp2C[0] * 4.0f) - ((f32)framebuffer_width * 2), ((f32)framebuffer_height * 2) - (sp2C[1] * 4.0f), sp2C[2]); func_80252330((sp2C[0] * 4.0f) - ((f32)gFramebufferWidth * 2), ((f32)gFramebufferHeight * 2) - (sp2C[1] * 4.0f), sp2C[2]);
temp_f12 = (f32) ((f64) this->unk198 * 0.8); temp_f12 = (f32) ((f64) this->unk198 * 0.8);
mlMtxScale_xyz(temp_f12, temp_f12, 1.0f); mlMtxScale_xyz(temp_f12, temp_f12, 1.0f);
mlMtxApply(*mtx); mlMtxApply(*mtx);
@ -1402,8 +1402,8 @@ GcZoombox *gczoombox_new(s32 y, GcZoomboxSprite portrait_id, s32 arg2, s32 arg3,
this->unk1A4_24 = arg3; this->unk1A4_24 = arg3;
if(this->unk1A4_24){ if(this->unk1A4_24){
this->unk16A = 45; this->unk16A = 45;
this->unk174 = framebuffer_width - 0x25; this->unk174 = gFramebufferWidth - 0x25;
this->unk170 = framebuffer_width + 0x66; this->unk170 = gFramebufferWidth + 0x66;
}else{ }else{
this->unk16A = 71; this->unk16A = 71;
this->unk174 = 0x25; this->unk174 = 0x25;
@ -1604,9 +1604,9 @@ void func_80318640(GcZoombox *this, s32 arg1, f32 arg2, f32 arg3, s32 arg4) {
if (this != NULL) { if (this != NULL) {
if (this->unk1A4_24) { if (this->unk1A4_24) {
this->unk174 = framebuffer_width - arg1; this->unk174 = gFramebufferWidth - arg1;
this->unk16A = arg1 + (8.0f * arg2); this->unk16A = arg1 + (8.0f * arg2);
this->unk170 = (framebuffer_width - arg1) + 0x8B; this->unk170 = (gFramebufferWidth - arg1) + 0x8B;
} else { } else {
this->unk174 = arg1; this->unk174 = arg1;
phi_v0 = arg4 ? 0x28 : 0x22; phi_v0 = arg4 ? 0x28 : 0x22;