Skip to content

Commit 1b85d78

Browse files
committed
1 parent deb6357 commit 1b85d78

18 files changed

Lines changed: 179 additions & 163 deletions

File tree

Makefile.menu2_wii

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,14 @@ CC =powerpc-eabi-gcc
44
CXX =powerpc-eabi-g++
55
AS =powerpc-eabi-as
66

7-
CFLAGS = -g -Ofast -Wall $(MACHDEP) $(INCLUDE) \
7+
CFLAGS = -g -Ofast -mrvl -Wall $(INCLUDE) \
88
-fno-exceptions -Wno-unused-parameter -pipe \
99
-DUSE_GUI -DWII -DGLN64_GX -DUSE_EXPANSION \
1010
-DUSE_RECOMP_CACHE -DPPC_DYNAREC -DFASTMEM -DMENU_V2\
1111
-DRELEASE #-DSHOW_DEBUG #-DPRINTGECKO #-DPROFILE #-DDEBUGON #-DUSE_TLB_CACHE \
1212
#-DNO_BT -DUSE_ROM_CACHE_L1 -DPRINTGECKO -DGLN64_SDLOG -DEMBEDDED_FONTS -DUSE_EXPANSION -DSHOW_STATS
1313

14-
MACHDEP = -DGEKKO -mrvl -msdata
15-
LDFLAGS = $(MACHDEP) -Wl,-Map,$(notdir $@).map -Wl,--cref
14+
LDFLAGS = -mrvl -Wl,-Map,$(notdir $@).map -Wl,--cref
1615

1716
INCLUDE = -I$(DEVKITPRO)/libogc/include -I$(DEVKITPRO)/libfat/libogc/include
1817
LIBPATHS = -L$(DEVKITPRO)/libogc/lib/wii -L$(DEVKITPRO)/libfat/libogc/lib/wii

fileBrowser/fileBrowser-DVD.c

Lines changed: 25 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -35,14 +35,6 @@
3535
/* DVD Globals */
3636
int dvd_init = 0;
3737

38-
/* Worked out manually from my original Disc */
39-
#define ZELDA_BONUS_ID "D43U01"
40-
#define ZELDA_CLCTR_ID "PZLP01"
41-
#define ZELDA_BONUS_OOT 0x54FBEEF4ULL
42-
#define ZELDA_BONUS_MQ 0x52CCC5FCULL
43-
#define ZELDA_CLCTR_OOT 0x3B9D1FC0ULL
44-
#define ZELDA_CLCTR_MM 0x0C4E1FC0ULL
45-
#define ZELDA_SIZE 0x2000000
4638
#define ZELDA_OOT_NAME "Zelda - Ocarina of Time"
4739
#define ZELDA_MQ_NAME "Zelda - Ocarina of Time Master Quest"
4840
#define ZELDA_MM_NAME "Zelda - Majoras Mask"
@@ -67,33 +59,48 @@ int fileBrowser_DVD_readDir(fileBrowser_file* ffile, fileBrowser_file** dir){
6759
dvd_init = 1;
6860
}
6961

70-
if (!memcmp((void*)0x80000000, ZELDA_BONUS_ID, 6)) { //OoT+MQ bonus disc support.
62+
if (!memcmp((void*)0x80000000, "D43U01", 6)) { //OoT+MQ bonus disc support.
7163
num_entries = 2;
7264
*dir = malloc( num_entries * sizeof(fileBrowser_file) );
7365
strcpy( (*dir)[0].name, ZELDA_OOT_NAME);
74-
(*dir)[0].discoffset = ZELDA_BONUS_OOT;
66+
(*dir)[0].discoffset = 0x54FBEEF4ULL;
7567
(*dir)[0].offset = 0;
76-
(*dir)[0].size = ZELDA_SIZE;
68+
(*dir)[0].size = 0x2000000;
7769
(*dir)[0].attr = 0;
7870
strcpy( (*dir)[1].name, ZELDA_MQ_NAME);
79-
(*dir)[1].discoffset = ZELDA_BONUS_MQ;
71+
(*dir)[1].discoffset = 0x52CCC5FCULL;
8072
(*dir)[1].offset = 0;
81-
(*dir)[1].size = ZELDA_SIZE;
73+
(*dir)[1].size = 0x2000000;
8274
(*dir)[1].attr = 0;
8375
return num_entries;
8476
}
85-
else if (!memcmp((void*)0x80000000, ZELDA_CLCTR_ID, 6)) { //Zelda Collectors disc support.
77+
else if (!memcmp((void*)0x80000000, "D43E01", 6)) {
8678
num_entries = 2;
8779
*dir = malloc( num_entries * sizeof(fileBrowser_file) );
8880
strcpy( (*dir)[0].name, ZELDA_OOT_NAME);
89-
(*dir)[0].discoffset = ZELDA_CLCTR_OOT;
81+
(*dir)[0].discoffset = 0x550569D8ULL;
9082
(*dir)[0].offset = 0;
91-
(*dir)[0].size = ZELDA_SIZE;
83+
(*dir)[0].size = 0x2000000;
84+
(*dir)[0].attr = 0;
85+
strcpy( (*dir)[1].name, ZELDA_MQ_NAME);
86+
(*dir)[1].discoffset = 0x52FBC1E0ULL;
87+
(*dir)[1].offset = 0;
88+
(*dir)[1].size = 0x2000000;
89+
(*dir)[1].attr = 0;
90+
return num_entries;
91+
}
92+
else if (!memcmp((void*)0x80000000, "PZLP01", 6)) { //Zelda Collectors disc support.
93+
num_entries = 2;
94+
*dir = malloc( num_entries * sizeof(fileBrowser_file) );
95+
strcpy( (*dir)[0].name, ZELDA_OOT_NAME);
96+
(*dir)[0].discoffset = 0x3B9D1FC0ULL;
97+
(*dir)[0].offset = 0;
98+
(*dir)[0].size = 0x2000000;
9299
(*dir)[0].attr = 0;
93100
strcpy( (*dir)[1].name, ZELDA_MM_NAME);
94-
(*dir)[1].discoffset = ZELDA_CLCTR_MM;
101+
(*dir)[1].discoffset = 0x0C4E1FC0ULL;
95102
(*dir)[1].offset = 0;
96-
(*dir)[1].size = ZELDA_SIZE;
103+
(*dir)[1].size = 0x2000000;
97104
(*dir)[1].attr = 0;
98105
return num_entries;
99106
}

gc_audio/audio.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ static unsigned int freq;
4545
static AESNDPB *voice;
4646

4747
char audioEnabled;
48+
char scalePitch;
4849

4950
static void aesnd_callback(AESNDPB *pb, uint32_t state)
5051
{
@@ -100,7 +101,9 @@ EXPORT void CALL AiLenChanged(void)
100101
length -= len;
101102
} while (length > 0);
102103

103-
AESND_SetVoiceFrequency(voice, freq * (Timers.vis / VILimit));
104+
if (scalePitch)
105+
AESND_SetVoiceFrequency(voice, freq * (Timers.vis / VILimit));
106+
104107
IRQ_Restore(level);
105108
}
106109
}
@@ -120,6 +123,7 @@ EXPORT BOOL CALL InitiateAudio(AUDIO_INFO Audio_Info)
120123

121124
AESND_SetVoiceFormat(voice, VOICE_STEREO16);
122125
AESND_SetVoiceStream(voice, true);
126+
AESND_SetVoiceLoop(voice, true);
123127

124128
return TRUE;
125129
}
@@ -148,5 +152,5 @@ void pauseAudio(void) {
148152

149153
void resumeAudio(void) {
150154
AESND_SetVoiceFrequency(voice, freq);
151-
AESND_Pause(false);
155+
AESND_Pause(!audioEnabled);
152156
}

gc_memory/MEM2.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
#define KB (1024)
3232

3333
// MEM2 begins at MEM2_LO, the Starlet's Dedicated Memory begins at MEM2_HI
34-
#define MEM2_LO ((char*)0x90080000)
34+
#define MEM2_LO ((char*)0x90000000)
3535
#define MEM2_HI ((char*)0x933E0000)
3636
#define MEM2_SIZE (MEM2_HI - MEM2_LO)
3737

@@ -102,7 +102,7 @@
102102
+ FONT_SIZE + FLASHRAM_SIZE \
103103
+ SRAM_SIZE + MEMPACK_SIZE \
104104
+ BLOCKS_SIZE + RECOMPMETA_SIZE)
105-
#if MEM2_USED_SIZE > (0x933E0000-0x90080000)
105+
#if MEM2_USED_SIZE > (0x933E0000-0x90000000)
106106
#error Too much MEM2 used!
107107
#endif
108108

glN64_GX/Config_linux.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -441,7 +441,7 @@ void Config_LoadConfig()
441441
OGL.fullscreenHeight = 480;
442442
OGL.windowedWidth = 640;
443443
OGL.windowedHeight = 480;
444-
OGL.forceBilinear = 0;
444+
OGL.forceBilinear = glN64_use2xSaiTextures;
445445
OGL.enable2xSaI = glN64_use2xSaiTextures;
446446
OGL.fog = 1;
447447
OGL.textureBitDepth = 1; // normal (16 & 32 bits)

glN64_GX/FrameBuffer.cpp

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,9 @@
2929
#include "Combiner.h"
3030
#include "Types.h"
3131

32-
FrameBufferInfo frameBuffer;
32+
FrameBufferInfo frameBuffer;
33+
34+
extern GXRModeObj *vmode, *rmode;
3335

3436
#ifdef __GX__
3537
extern heap_cntrl* GXtexCache;
@@ -214,9 +216,11 @@ void FrameBuffer_SaveBuffer( u32 address, u16 size, u16 width, u16 height )
214216
#else // !__GX__
215217
//Note: texture realWidth and realHeight should be multiple of 2!
216218
GX_SetTexCopySrc(OGL.GXorigX, OGL.GXorigY,(u16) current->texture->realWidth,(u16) current->texture->realHeight);
217-
GX_SetTexCopyDst((u16) current->texture->realWidth,(u16) current->texture->realHeight, current->texture->GXtexfmt, GX_FALSE);
219+
GX_SetTexCopyDst((u16) current->texture->realWidth,(u16) current->texture->realHeight, current->texture->GXtexfmt, GX_FALSE);
220+
GX_SetCopyFilter(GX_FALSE, NULL, GX_FALSE, NULL);
218221
if (current->texture->GXtexture) GX_CopyTex(current->texture->GXtexture, GX_FALSE);
219-
GX_PixModeSync();
222+
GX_PixModeSync();
223+
GX_SetCopyFilter(GX_FALSE, NULL, GX_TRUE, rmode->vfilter);
220224
#endif // __GX__
221225

222226
*(u32*)&RDRAM[current->startAddress] = current->startAddress;
@@ -325,9 +329,11 @@ void FrameBuffer_SaveBuffer( u32 address, u16 size, u16 width, u16 height )
325329
#else // !__GX__
326330
//Note: texture realWidth and realHeight should be multiple of 2!
327331
GX_SetTexCopySrc((u16) OGL.GXorigX, (u16) OGL.GXorigY,(u16) current->texture->realWidth,(u16) current->texture->realHeight);
328-
GX_SetTexCopyDst((u16) current->texture->realWidth,(u16) current->texture->realHeight, current->texture->GXtexfmt, GX_FALSE);
332+
GX_SetTexCopyDst((u16) current->texture->realWidth,(u16) current->texture->realHeight, current->texture->GXtexfmt, GX_FALSE);
333+
GX_SetCopyFilter(GX_FALSE, NULL, GX_FALSE, NULL);
329334
if (current->texture->GXtexture) GX_CopyTex(current->texture->GXtexture, GX_FALSE);
330-
GX_PixModeSync();
335+
GX_PixModeSync();
336+
GX_SetCopyFilter(GX_FALSE, NULL, GX_TRUE, rmode->vfilter);
331337
#endif // __GX__
332338

333339
*(u32*)&RDRAM[current->startAddress] = current->startAddress;

glN64_GX/GBI.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ static inline u8 GXcastf32u8(register f32 in)
9090
return rval;
9191
}
9292

93-
static inline u8 GXcastf32u16(register f32 in)
93+
static inline u16 GXcastf32u16(register f32 in)
9494
{
9595
u16 rval;
9696
asm("psq_st%U0%X0 %1,%0,1,3" : "=m"(rval) : "f"(in) : "memory");

glN64_GX/OpenGL.cpp

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1420,7 +1420,7 @@ void OGL_DrawRect( int ulx, int uly, int lrx, int lry, float *color )
14201420
OGL_UpdateViewport();
14211421
glEnable( GL_SCISSOR_TEST );
14221422
#else // !__GX__
1423-
GX_SetScissor((u32) 0,(u32) 0,(u32) OGL.width+1,(u32) OGL.height+1); //Disable Scissor
1423+
GX_SetScissor((u32) 0,(u32) 0,(u32) OGL.width,(u32) OGL.height); //Disable Scissor
14241424
GX_SetCullMode (GX_CULL_NONE);
14251425
Mtx44 GXprojection;
14261426
guMtxIdentity(GXprojection);
@@ -1992,7 +1992,8 @@ void OGL_GXinitDlist()
19921992
// VIDEO_WaitVSync();
19931993

19941994
OGL.frameBufferTextures = glN64_useFrameBufferTextures;
1995-
OGL.enable2xSaI = glN64_use2xSaiTextures;
1995+
OGL.enable2xSaI = glN64_use2xSaiTextures;
1996+
OGL.forceBilinear = glN64_use2xSaiTextures;
19961997

19971998
// init primeDepthZtex, Ztexture, AlphaCompare, and Texture Clamping
19981999
TextureCache_UpdatePrimDepthZtex( 1.0f );
@@ -2077,12 +2078,12 @@ void OGL_GXclearEFB()
20772078
GX_SetAlphaCompare(GX_ALWAYS,0,GX_AOP_AND,GX_ALWAYS,0);
20782079
GX_SetFog(GX_FOG_NONE,0.1,1.0,0.0,1.0,(GXColor){0,0,0,255});
20792080
GX_SetViewport((f32) OGL.GXorigX,(f32) OGL.GXorigY,(f32) OGL.GXwidth,(f32) OGL.GXheight, 0.0f, 1.0f);
2080-
GX_SetScissor((u32) 0,(u32) 0,(u32) OGL.width+1,(u32) OGL.height+1); //Disable Scissor
2081+
GX_SetScissor((u32) 0,(u32) 0,(u32) OGL.width,(u32) OGL.height); //Disable Scissor
20812082
// GX_SetScissor(0,0,rmode->fbWidth,rmode->efbHeight);
20822083
GX_SetCullMode (GX_CULL_NONE);
20832084
Mtx44 GXprojection;
20842085
guMtxIdentity(GXprojection);
2085-
guOrtho(GXprojection, 0, OGL.height-1, 0, OGL.width-1, 0.0f, 1.0f);
2086+
guOrtho(GXprojection, 0, OGL.height, 0, OGL.width, 0.0f, 1.0f);
20862087
GX_LoadProjectionMtx(GXprojection, GX_ORTHOGRAPHIC);
20872088
GX_LoadPosMtxImm(OGL.GXmodelViewIdent,GX_PNMTX0);
20882089

@@ -2095,13 +2096,13 @@ void OGL_GXclearEFB()
20952096
GX_SetVtxAttrFmt(GX_VTXFMT0, GX_VA_CLR0, GX_CLR_RGBA, GX_RGBA8, 0);
20962097
f32 ZmaxDepth = (f32) -0xFFFFFF/0x1000000;
20972098
GX_Begin(GX_QUADS, GX_VTXFMT0, 4);
2098-
GX_Position3f32(-1.0f, -1.0f, ZmaxDepth);
2099+
GX_Position3f32(0.0f, 0.0f, ZmaxDepth);
20992100
GX_Color4u8(OGL.GXclearColor.r, OGL.GXclearColor.g, OGL.GXclearColor.b, OGL.GXclearColor.a);
2100-
GX_Position3f32((f32) OGL.width+1, -1.0f, ZmaxDepth);
2101+
GX_Position3f32((f32) OGL.width, 0.0f, ZmaxDepth);
21012102
GX_Color4u8(OGL.GXclearColor.r, OGL.GXclearColor.g, OGL.GXclearColor.b, OGL.GXclearColor.a);
2102-
GX_Position3f32((f32) OGL.width+1,(f32) OGL.height+1, ZmaxDepth);
2103+
GX_Position3f32((f32) OGL.width,(f32) OGL.height, ZmaxDepth);
21032104
GX_Color4u8(OGL.GXclearColor.r, OGL.GXclearColor.g, OGL.GXclearColor.b, OGL.GXclearColor.a);
2104-
GX_Position3f32(-1.0f,(f32) OGL.height+1, ZmaxDepth);
2105+
GX_Position3f32(0.0f,(f32) OGL.height, ZmaxDepth);
21052106
GX_Color4u8(OGL.GXclearColor.r, OGL.GXclearColor.g, OGL.GXclearColor.b, OGL.GXclearColor.a);
21062107
GX_End();
21072108

libgui/GraphicsGX.cpp

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,8 @@ Graphics::Graphics(GXRModeObj *rmode)
4545

4646
VIDEO_Init();
4747
vmode = VIDEO_GetPreferredMode(&vmode_phys);
48+
vmode->viWidth = 720;
49+
vmode->viXOrigin = 0;
4850
VIDEO_SetTrapFilter(trapFilter);
4951
VIDEO_Configure(vmode);
5052

@@ -76,7 +78,6 @@ void Graphics::init()
7678
{
7779

7880
f32 yscale;
79-
u32 xfbHeight;
8081
void *gpfifo = NULL;
8182
GXColor background = {0, 0, 0, 0xff};
8283

@@ -86,20 +87,13 @@ void Graphics::init()
8687

8788
GX_SetViewport(0,0,vmode->fbWidth,vmode->efbHeight,0,1);
8889
yscale = GX_GetYScaleFactor(vmode->efbHeight,vmode->xfbHeight);
89-
xfbHeight = GX_SetDispCopyYScale(yscale);
90+
GX_SetDispCopyYScale(yscale);
9091
GX_SetScissor(0,0,vmode->fbWidth,vmode->efbHeight);
9192
GX_SetDispCopySrc(0,0,vmode->fbWidth,vmode->efbHeight);
92-
GX_SetDispCopyDst(vmode->fbWidth,xfbHeight);
93-
GX_SetCopyFilter(vmode->aa,vmode->sample_pattern,deFlicker,vmode->vfilter);
94-
GX_SetFieldMode(vmode->field_rendering,((vmode->viHeight==2*vmode->xfbHeight)?GX_ENABLE:GX_DISABLE));
95-
96-
if (vmode->aa)
97-
GX_SetPixelFmt(GX_PF_RGB565_Z16, GX_ZC_LINEAR);
98-
else
99-
GX_SetPixelFmt(GX_PF_RGB8_Z24, GX_ZC_LINEAR);
93+
GX_SetDispCopyDst(vmode->fbWidth,vmode->xfbHeight);
94+
GX_SetCopyFilter(GX_FALSE,NULL,GX_TRUE,vmode->vfilter);
10095

10196
GX_SetCullMode(GX_CULL_NONE);
102-
GX_SetDispCopyGamma(GX_GM_1_0);
10397

10498
GX_InvVtxCache();
10599
GX_InvalidateTexAll();
@@ -223,8 +217,8 @@ void Graphics::loadModelView()
223217

224218
void Graphics::loadOrthographic()
225219
{
226-
if(screenMode) guOrtho(currentProjectionMtx, 0, 479, -104, 743, 0, 700);
227-
else guOrtho(currentProjectionMtx, 0, 479, 0, 639, 0, 700);
220+
if(screenMode) guOrtho(currentProjectionMtx, 0, 480, -104, 744, 0, 700);
221+
else guOrtho(currentProjectionMtx, 0, 480, 0, 640, 0, 700);
228222
GX_LoadProjectionMtx(currentProjectionMtx, GX_ORTHOGRAPHIC);
229223
}
230224

libgui/IPLFont.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -212,11 +212,11 @@ void IplFont::drawInit(GXColor fontColor)
212212
// guMtxTransApply (GXmodelView2D, GXmodelView2D, 0.0F, 0.0F, -5.0F);
213213
GX_LoadPosMtxImm(GXmodelView2D,GX_PNMTX0);
214214
if(screenMode && menuActive)
215-
guOrtho(GXprojection2D, 0, 479, -104, 743, 0, 700);
215+
guOrtho(GXprojection2D, 0, 480, -104, 744, 0, 700);
216216
else if(screenMode == SCREENMODE_16x9_PILLARBOX)
217-
guOrtho(GXprojection2D, 0, 479, -104, 743, 0, 700);
217+
guOrtho(GXprojection2D, 0, 480, -104, 744, 0, 700);
218218
else
219-
guOrtho(GXprojection2D, 0, 479, 0, 639, 0, 700);
219+
guOrtho(GXprojection2D, 0, 480, 0, 640, 0, 700);
220220
GX_LoadProjectionMtx(GXprojection2D, GX_ORTHOGRAPHIC);
221221
// GX_SetViewport (0, 0, vmode->fbWidth, vmode->efbHeight, 0, 1);
222222

0 commit comments

Comments
 (0)