Hacking WiiFlow - an open source GUI USB-Loader

MassiveRican

GBATemp's Unofficial Vigilante
Member
Joined
Aug 2, 2011
Messages
2,454
Trophies
1
Location
Creeping in the Shadows
XP
1,190
Country
You might like this, its currently the loading screen i use at the moment when compiling modified builds, 10 frames

wfws1.gif
So how can I compile my WiiFlow with this logo? It's nice and indeed I like it very much.
and as I said in this post ,I want a favor for categories and plugins screens ,if possible of course.
I really don't like the checkbox system ,I think this does not correspond to the graphic style of WiiFlow.
So for my theme I changed the checkbox system by the old system, with buttons. But there is a problem ,the text is under the button. Here are 2 screenshots :

Jul-05-2012-00h26m46s.png

Jul-05-2012-00h26m52s.png

My wish is to have text over the buttons.
I think and hope that will not break the checkbox system.

thx ;)
I also prefer the buttons, something I'm used to seeing in WiiFlow plus it just looks better.
 

Maxternal

Peanut Gallery Spokesman
Member
Joined
Nov 15, 2011
Messages
5,210
Trophies
0
Age
40
Location
Deep in GBAtemp addiction
Website
gbadev.googlecode.com
XP
1,709
Country
So how can I compile my WiiFlow with this logo? It's nice and indeed I like it very much.
You currently have only 5 frames to work with but you would go to the /svn/trunk/data/images/ folder and replace
wait_01.png
wait_02.png
wait_03.png
wait_04.png
wait_05.png
with the frames you wanted it to rotate through for that.

I'm sure adjusting it down to just 5 frames wouldn't be that difficult.
 

bostonBC

Well-Known Member
Member
Joined
Aug 17, 2011
Messages
1,304
Trophies
1
XP
1,416
Country
United States
It seems to be localized to this one game. Is there anything I can do to help debug the problem? Just let me know. Thanks!
Yea, open up this game in GX and please say me if it gets fucked up as well with this game then.
Duh, I should have thought of that!

In GX I see the same odd background on the banner but now I see it is just an attempt at a water effect. In GX there are no other graphic artifacts on other items but then there no other items on the screen at the same time. in any case it doesn't appear to mess up graphics in any other part of the GX program.
 

bostonBC

Well-Known Member
Member
Joined
Aug 17, 2011
Messages
1,304
Trophies
1
XP
1,416
Country
United States
Been putzing around in r543 for a while and things were working ok until I started running some games and now when I exit I get this code dump:



I tried rebuilding the cache, scanning the drive for errors (none found) but it keeps on dumping when I exit. I don't have to run any games now, it just dies when I exit.

Any thoughts? I really want to start using using it :)

Edit: I built r544 and tried it...I deleted my settings/*.ini's and apps/wiiflow/wiiflow.ini files and I was able to go into WiiFlow run coverflow and exit without a dump.

But I went back in and ran a game and then tried exiting and it code dumped again. Now if I just go into WiiFlow and try to exit - without running a game it code dumps. Please let me know if I can do anything to help debug it.

Looks like anytime you run a game it then fails on exit. BTW - I am running from the System Menu and returning to the System Menu. But I have tried returning to HomeBrew and it code dumps the same.

Edit2: I deleted the usb:\wiiflow\settings\gameconfig1/2.ini's but it still code dumped on exit. However if I deleted the usb:\apps\wiiflow\wiiflow.ini it didn't code dump until I tried running a game. After setting it to return to WiiFlow when I ran a game and exited it returned to WiiFlow and when I exited it code dumped. The only other changes I made are setting the default video mode to System and turning on 'Save favorite mode state' which I have done without problems before.

Edit3: I tried resetting the default video mode back to Game and turning off 'Save favorite mode state' but it still code dumps. If I delete the entire WiiFlow.ini it lets me exit without code dumping. If I then run a game without setting the return to WiiFlow option it exits the game back to the system menu without code dumping and if I go back into WiiFlow and then exit it does not code dump! If I go in and then change it to return to WiiFlow and then exit it does not crash but when I come back into WiiFlow and immediately exit after verifying the return to WiiFlow option is set it code dumps.

Looks like the operation of setting the Return To WiiFlow flag causes it to blow up and code dump on exit. If I go back in and Disable the option it code dumps when you exit the first time but when I come back the second or any other time I can verify the option is disabled and when I exit it returns to the system menu w/o a code dump.
 

drakorex

Well-Known Member
Member
Joined
Jan 19, 2011
Messages
1,882
Trophies
0
XP
1,077
Country
United States
Just thought I'd chime in with my latest testing. Let's get to it.

Did a clean install of 542, LOTS of code dumps. When in selected game mode, it dumps when browsing through games, and even when just changing coverflows. Also my covers still don't load on first pass, second,third... Here's a pic after about an hour of loading covers, rebuilding the cache and repeating. If on a blank cover you rebuild the cache, it might load the cover it's on, but none around it, or it might not load at all unless you move onto something else and come back to it...
Jul-05-2012-23h29m41s.png

Also noticed the button placements of some themes are going to need reworked. (see starnight)

I'd like to retract my previous statement. Full banners on settings is a BAD idea. It makes it very difficult to tell what you're doing on some themes, and just annoying with certain banners.
Jul-05-2012-23h27m56s.png

Jul-05-2012-23h28m49s.png
 

FIX94

Former Staff
Former Staff
Joined
Dec 3, 2009
Messages
7,284
Trophies
0
Age
30
Location
???
XP
11,248
Country
Germany
Looks like the operation of setting the Return To WiiFlow flag causes it to blow up and code dump on exit. If I go back in and Disable the option it code dumps when you exit the first time but when I come back the second or any other time I can verify the option is disabled and when I exit it returns to the system menu w/o a code dump.
Thats some cleanup problem for sure. For the banner, can you PM me the .bnr file that I can take a look at it?
 

the-hans3009

Member
Newcomer
Joined
Jul 5, 2012
Messages
15
Trophies
0
XP
6
Country
Cote d'Ivoire
i need change the cover view FceuGX in size normal, no small, only cover Nes, because the covers the Nes there are high x low (as the wii) and the Snes, N64, Gb(c)(a), there are low x high, are more small. (in real size)
 

pepxl

GFX W!Z4RD
Member
Joined
Jun 19, 2009
Messages
3,263
Trophies
1
XP
328
Country
You might like this, its currently the loading screen i use at the moment when compiling modified builds, 10 frames

wfws1.gif
So how can I compile my WiiFlow with this logo? It's nice and indeed I like it very much.

use this video.cpp, changes are merged when updating source from svn, video.ccp at rev545

Add these to your data/images folder and replace current images

http://www.mediafire.com/?4nawzj3h4oc8w5t

video.ccp is located in source/gui

Code:
#include "pngu.h"
#include "video.hpp"
#include <string.h>
#include "Gekko.h"
#include "gecko.h"
#include "utils.h"

#define DEFAULT_FIFO_SIZE	(256 * 1024)

extern const u8 wait_01_png[];
extern const u8 wait_02_png[];
extern const u8 wait_03_png[];
extern const u8 wait_04_png[];
extern const u8 wait_05_png[];
extern const u8 wait_06_png[];
extern const u8 wait_07_png[];
extern const u8 wait_08_png[];
extern const u8 wait_09_png[];
extern const u8 wait_10_png[];
vector<STexture> m_defaultWaitMessages;

const float CVideo::_jitter2[2][2] = {
{ 0.246490f, 0.249999f },
{ -0.246490f, -0.249999f }
};

const float  CVideo::_jitter3[3][2] = {
{ -0.373411f, -0.250550f },
{ 0.256263f, 0.368119f },
{ 0.117148f, -0.117570f }
};

const float CVideo::_jitter4[4][2] = {
{ -0.208147f, 0.353730f },
{ 0.203849f, -0.353780f },
{ -0.292626f, -0.149945f },
{ 0.296924f, 0.149994f }
};

const float CVideo::_jitter5[5][2] = {
{ 0.5f, 0.5f },
{ 0.3f, 0.1f },
{ 0.7f, 0.9f },
{ 0.9f, 0.3f },
{ 0.1f, 0.7f }
};

const float CVideo::_jitter6[6][2] = {
{ 0.4646464646f, 0.4646464646f },
{ 0.1313131313f, 0.7979797979f },
{ 0.5353535353f, 0.8686868686f },
{ 0.8686868686f, 0.5353535353f },
{ 0.7979797979f, 0.1313131313f },
{ 0.2020202020f, 0.2020202020f }
};

const float CVideo::_jitter8[8][2] = {
{ -0.334818f, 0.435331f },
{ 0.286438f, -0.393495f },
{ 0.459462f, 0.141540f },
{ -0.414498f, -0.192829f },
{ -0.183790f, 0.082102f },
{ -0.079263f, -0.317383f },
{ 0.102254f, 0.299133f },
{ 0.164216f, -0.054399f }
};

const int CVideo::_stencilWidth = 128;
const int CVideo::_stencilHeight = 128;

static lwp_t waitThread = LWP_THREAD_NULL;
SmartBuf waitThreadStack;

CVideo::CVideo(void) :
m_rmode(NULL), m_frameBuf(), m_curFB(0), m_fifo(NULL),
m_yScale(0.0f), m_xfbHeight(0), m_wide(false),
m_width2D(640), m_height2D(480), m_x2D(0), m_y2D(0), m_aa(0), m_aaAlpha(false),
m_aaWidth(0), m_aaHeight(0), m_showWaitMessage(false), m_showingWaitMessages(false)
{
memset(m_frameBuf, 0, sizeof m_frameBuf);
}

void CColor::blend(const CColor &src)
{
if (src.a == 0) return;
r = (u8)(((int)src.r * (int)src.a + (int)r * (0xFF - (int)src.a)) / 0xFF);
g = (u8)(((int)src.g * (int)src.a + (int)g * (0xFF - (int)src.a)) / 0xFF);
b = (u8)(((int)src.b * (int)src.a + (int)b * (0xFF - (int)src.a)) / 0xFF);
}

CColor CColor::interpolate(const CColor &c1, const CColor &c2, u8 n)
{
CColor c;
c.r = (u8)(((int)c2.r * (int)n + (int)c1.r * (0xFF - (int)n)) / 0xFF);
c.g = (u8)(((int)c2.g * (int)n + (int)c1.g * (0xFF - (int)n)) / 0xFF);
c.b = (u8)(((int)c2.b * (int)n + (int)c1.b * (0xFF - (int)n)) / 0xFF);
c.a = (u8)(((int)c2.a * (int)n + (int)c1.a * (0xFF - (int)n)) / 0xFF);
return c;
}

void CVideo::setAA(u8 aa, bool alpha, int width, int height)
{
if (aa <= 8 && aa != 7 && width <= m_rmode->fbWidth && height <= m_rmode->efbHeight && ((width | height) & 3) == 0)
{
m_aa = aa;
m_aaAlpha = alpha;
m_aaWidth = width;
m_aaHeight = height;
}
}

void CVideo::init(void)
{
VIDEO_Init();
VIDEO_SetBlack(TRUE);
m_wide = CONF_GetAspectRatio() == CONF_ASPECT_16_9;
m_rmode = VIDEO_GetPreferredMode(NULL);
u32 type = CONF_GetVideo();

m_50hz = false;
if(m_rmode == &TVPal528IntDf)
{
m_rmode= &TVPal574IntDfScale;
m_50hz = true;
}
m_rmode->viWidth = m_wide ? 700 : 672;

//CONF_VIDEO_NTSC and CONF_VIDEO_MPAL and m_rmode TVEurgb60Hz480IntDf are the same max height and width.
if (type == CONF_VIDEO_PAL && m_rmode != &TVEurgb60Hz480IntDf)
{
m_rmode->viHeight = VI_MAX_HEIGHT_PAL;
m_rmode->viXOrigin = (VI_MAX_WIDTH_PAL - m_rmode->viWidth) / 2;
m_rmode->viYOrigin = (VI_MAX_HEIGHT_PAL - m_rmode->viHeight) / 2;
}
else
{
m_rmode->viHeight = VI_MAX_HEIGHT_NTSC;
m_rmode->viXOrigin = (VI_MAX_WIDTH_NTSC - m_rmode->viWidth) / 2;
m_rmode->viYOrigin = (VI_MAX_HEIGHT_NTSC - m_rmode->viHeight) / 2;
}

s8 hoffset = 0;  //Use horizontal offset set in wii menu.
if (CONF_GetDisplayOffsetH(&hoffset) == 0)
m_rmode->viXOrigin += hoffset;

m_frameBuf[0] = MEM_K0_TO_K1(SYS_AllocateFramebuffer(m_rmode));
m_frameBuf[1] = MEM_K0_TO_K1(SYS_AllocateFramebuffer(m_rmode));
VIDEO_Configure(m_rmode);
VIDEO_Flush();
m_curFB = 0;
m_fifo = MEM1_memalign(32, DEFAULT_FIFO_SIZE);
memset(m_fifo, 0, DEFAULT_FIFO_SIZE);
GX_Init(m_fifo, DEFAULT_FIFO_SIZE);
GX_SetCopyClear(CColor(0), 0x00FFFFFF);
_setViewPort(0, 0, m_rmode->fbWidth, m_rmode->efbHeight);
m_yScale = GX_GetYScaleFactor(m_rmode->efbHeight, m_rmode->xfbHeight);
m_xfbHeight = GX_SetDispCopyYScale(m_yScale);
GX_SetScissor(0, 0, m_rmode->fbWidth, m_rmode->efbHeight);
GX_SetDispCopySrc(0, 0, m_rmode->fbWidth, m_rmode->efbHeight);
GX_SetDispCopyDst(m_rmode->fbWidth, m_xfbHeight);
GX_SetCopyFilter(m_rmode->aa, m_rmode->sample_pattern, GX_TRUE, m_rmode->vfilter);
GX_SetFieldMode(m_rmode->field_rendering, ((m_rmode->viHeight == 2 * m_rmode->xfbHeight) ? GX_ENABLE : GX_DISABLE));
GX_SetCullMode(GX_CULL_NONE);
GX_CopyDisp(m_frameBuf[m_curFB], GX_TRUE);
GX_SetDispCopyGamma(GX_GM_1_0);
GX_ClearVtxDesc();
GX_SetVtxDesc(GX_VA_POS, GX_DIRECT);
GX_SetVtxAttrFmt(GX_VTXFMT0, GX_VA_POS, GX_POS_XYZ, GX_F32, 0);
GX_SetVtxDesc(GX_VA_CLR0, GX_DIRECT);
GX_SetVtxAttrFmt(GX_VTXFMT0, GX_VA_CLR0, GX_CLR_RGBA, GX_RGB8, 0);
GX_SetNumTexGens(0);
GX_SetTevOp(GX_TEVSTAGE0, GX_MODULATE);
GX_SetTevOrder(GX_TEVSTAGE0, GX_TEXCOORDNULL, GX_TEXMAP_NULL, GX_COLOR0A0);
GX_SetNumChans(0);
GX_SetZCompLoc(GX_ENABLE);
setup2DProjection();
GX_SetVtxAttrFmt(GX_VTXFMT0, GX_VA_POS, GX_POS_XYZ, GX_F32, 0);
GX_SetVtxAttrFmt(GX_VTXFMT0, GX_VA_CLR0, GX_CLR_RGBA, GX_RGBA8, 0);
for(u32 i = 0; i < 8; i++)
GX_SetVtxAttrFmt(GX_VTXFMT0, GX_VA_TEX0+i, GX_TEX_ST, GX_F32, 0);
_clearScreen();
VIDEO_SetBlack(FALSE);
VIDEO_Flush();
VIDEO_WaitVSync();
if(m_rmode->viTVMode & VI_NON_INTERLACE)
VIDEO_WaitVSync();

m_stencil = MEM1_memalign(32, CVideo::_stencilWidth * CVideo::_stencilHeight);
memset(m_stencil, 0, CVideo::_stencilWidth * CVideo::_stencilHeight);
}

void CVideo::_clearScreen()
{
VIDEO_ClearFrameBuffer(m_rmode, m_frameBuf[0], COLOR_BLACK);
VIDEO_ClearFrameBuffer(m_rmode, m_frameBuf[1], COLOR_BLACK);
render();
render();
}

void CVideo::set2DViewport(u32 w, u32 h, int x, int y)
{
m_width2D = std::min(std::max(512u, w), 800u);
m_height2D = std::min(std::max(384u, h), 600u);
m_x2D = std::min(std::max(-50, x), 50);
m_y2D = std::min(std::max(-50, y), 50);
}

void CVideo::setup2DProjection(bool setViewPort, bool noScale)
{
Mtx44 projMtx;
float width2D = noScale ? 640.f : (int)m_width2D;
float height2D = noScale ? 480.f : (int)m_height2D;
float x = noScale ? 0.f : (float)(640 - width2D) * 0.5f + (float)m_x2D;
float y = noScale ? 0.f : (float)(480 - height2D) * 0.5f + (float)m_y2D;

if (setViewPort)
_setViewPort(0, 0, m_rmode->fbWidth, m_rmode->efbHeight);
guOrtho(projMtx, y, height2D + y, x, width2D + x, 0.f, 1000.0f);
GX_LoadProjectionMtx(projMtx, GX_ORTHOGRAPHIC);
}

void CVideo::renderToTexture(STexture &tex, bool clear)
{
if (!tex.data) tex.data = smartMem2Alloc(GX_GetTexBufferSize(tex.width, tex.height, tex.format, GX_FALSE, 0));
if (!tex.data) return;
GX_DrawDone();
GX_SetCopyFilter(GX_FALSE, NULL, GX_FALSE, NULL);
GX_SetTexCopySrc(0, 0, tex.width, tex.height);
GX_SetTexCopyDst(tex.width, tex.height, tex.format, GX_FALSE);
GX_CopyTex(tex.data.get(), clear ? GX_TRUE : GX_FALSE);
GX_PixModeSync();
GX_SetCopyFilter(m_rmode->aa, m_rmode->sample_pattern, GX_TRUE, m_rmode->vfilter);
DCFlushRange(tex.data.get(), GX_GetTexBufferSize(tex.width, tex.height, tex.format, GX_FALSE, 0));
GX_SetScissor(0, 0, m_rmode->fbWidth, m_rmode->efbHeight);
}

void CVideo::prepare(void)
{
GX_SetPixelFmt(GX_PF_RGB8_Z24, GX_ZC_LINEAR);
_setViewPort(0.f, 0.f, (float)m_rmode->fbWidth, (float)m_rmode->efbHeight);
GX_SetScissor(0, 0, m_rmode->fbWidth, m_rmode->efbHeight);
GX_InvVtxCache();
GX_InvalidateTexAll();
}

void CVideo::cleanup(void)
{
gprintf("Cleaning up video...\n");

_clearScreen();
VIDEO_SetBlack(TRUE);
VIDEO_Flush();

GX_DrawDone();
GX_AbortFrame();

for(u8 i = 0; i < sizeof m_aaBuffer / sizeof m_aaBuffer[0]; ++i)
{
if(m_aaBuffer[i].get())
m_aaBuffer[i].release();

m_aaBufferSize[i] = 0;	
}
for(u8 i = 0; i < m_defaultWaitMessages.size(); i++)
{
m_defaultWaitMessages[i].data.release();
}
free(MEM_K1_TO_K0(m_frameBuf[0]));
free(MEM_K1_TO_K0(m_frameBuf[1]));
MEM1_free(m_stencil);
MEM1_free(m_fifo);
}

void CVideo::prepareAAPass(int aaStep)
{
float x = 0.f;
float y = 0.f;
u32 w = m_aaWidth <= 0 ? m_rmode->fbWidth : (u32)m_aaWidth;
u32 h = m_aaHeight <= 0 ? m_rmode->efbHeight: (u32)m_aaHeight;
switch (m_aa)
{
case 2:
x += CVideo::_jitter2[aaStep][0];
y += CVideo::_jitter2[aaStep][1];
break;
case 3:
x += CVideo::_jitter3[aaStep][0];
y += CVideo::_jitter3[aaStep][1];
break;
case 4:
x += CVideo::_jitter4[aaStep][0];
y += CVideo::_jitter4[aaStep][1];
break;
case 5:
x += CVideo::_jitter5[aaStep][0];
y += CVideo::_jitter5[aaStep][1];
break;
case 6:
x += CVideo::_jitter6[aaStep][0];
y += CVideo::_jitter6[aaStep][1];
break;
case 8:
x += CVideo::_jitter8[aaStep][0];
y += CVideo::_jitter8[aaStep][1];
break;
}
GX_SetPixelFmt(m_aaAlpha ? GX_PF_RGBA6_Z24 : GX_PF_RGB8_Z24, GX_ZC_LINEAR);
_setViewPort(x, y, (float)w, (float)h);
GX_SetScissor(0, 0, w, h);
GX_InvVtxCache();
GX_InvalidateTexAll();
}

void CVideo::renderAAPass(int aaStep)
{
u8 texFmt = GX_TF_RGBA8;
u32 w = m_aaWidth <= 0 ? m_rmode->fbWidth : (u32)m_aaWidth;
u32 h = m_aaHeight <= 0 ? m_rmode->efbHeight: (u32)m_aaHeight;
u32 bufLen = GX_GetTexBufferSize(w, h, texFmt, GX_FALSE, 0);

if (!m_aaBuffer[aaStep] || m_aaBufferSize[aaStep] < bufLen)
{
m_aaBuffer[aaStep] = smartMem2Alloc(bufLen);
if (!!m_aaBuffer[aaStep])
m_aaBufferSize[aaStep] = bufLen;
}
if (!m_aaBuffer[aaStep] || m_aaBufferSize[aaStep] < bufLen)
return;
GX_SetZMode(GX_DISABLE, GX_ALWAYS, GX_TRUE);
GX_DrawDone();
GX_SetCopyFilter(GX_FALSE, NULL, GX_FALSE, NULL);
GX_SetTexCopySrc(0, 0, w, h);
GX_SetTexCopyDst(w, h, texFmt, GX_FALSE);
GX_CopyTex(m_aaBuffer[aaStep].get(), GX_TRUE);
GX_PixModeSync();
GX_SetCopyFilter(m_rmode->aa, m_rmode->sample_pattern, GX_TRUE, m_rmode->vfilter);
}

void CVideo::drawAAScene(bool fs)
{
GXTexObj texObj[8];
Mtx modelViewMtx;
u8 texFmt = GX_TF_RGBA8;
u32 tw = m_aaWidth <= 0 ? m_rmode->fbWidth : (u32)m_aaWidth;
u32 th = m_aaHeight <= 0 ? m_rmode->efbHeight: (u32)m_aaHeight;
float w = fs ? 640.f : (float)tw;
float h = fs ? 480.f : (float)th;
float x = 0.f;
float y = 0.f;
int aa;

if (m_aa <= 0 || m_aa > 8)
return;

for (aa = 0; aa < m_aa; ++aa)
if (!m_aaBuffer[aa])
break;
if (aa == 7)
aa = 6;

GX_SetNumChans(0);
for (int i = 0; i < aa; ++i)
{
GX_InitTexObj(&texObj[i], m_aaBuffer[i].get(), tw , th, texFmt, GX_CLAMP, GX_CLAMP, GX_FALSE);
GX_LoadTexObj(&texObj[i], GX_TEXMAP0 + i);
}
GX_SetNumTexGens(1);
GX_SetTexCoordGen(GX_TEXCOORD0, GX_TG_MTX2x4, GX_TG_TEX0, GX_IDENTITY);
GX_SetTevKColor(GX_KCOLOR0, CColor(0xFF / 1, 0xFF / 5, 0xFF, 0xFF));	// Renders better gradients than 0xFF / aa
GX_SetTevKColor(GX_KCOLOR1, CColor(0xFF / 2, 0xFF / 6, 0xFF, 0xFF));
GX_SetTevKColor(GX_KCOLOR2, CColor(0xFF / 3, 0xFF / 7, 0xFF, 0xFF));
GX_SetTevKColor(GX_KCOLOR3, CColor(0xFF / 4, 0xFF / 8, 0xFF, 0xFF));
for (int i = 0; i < aa; ++i)
{
GX_SetTevKColorSel(GX_TEVSTAGE0 + i, GX_TEV_KCSEL_K0_R + i);
GX_SetTevKAlphaSel(GX_TEVSTAGE0 + i, GX_TEV_KASEL_K0_R + i);
GX_SetTevOrder(GX_TEVSTAGE0 + i, GX_TEXCOORD0, GX_TEXMAP0 + i, GX_COLORNULL);
GX_SetTevColorIn(GX_TEVSTAGE0 + i, i == 0 ? GX_CC_ZERO : GX_CC_CPREV, GX_CC_TEXC, GX_CC_KONST, GX_CC_ZERO);
GX_SetTevAlphaIn(GX_TEVSTAGE0 + i, i == 0 ? GX_CA_ZERO : GX_CA_APREV, GX_CA_TEXA, GX_CA_KONST, GX_CA_ZERO);
GX_SetTevColorOp(GX_TEVSTAGE0 + i, GX_TEV_ADD, GX_TB_ZERO, GX_CS_SCALE_1, GX_TRUE, GX_TEVPREV);
GX_SetTevAlphaOp(GX_TEVSTAGE0 + i, GX_TEV_ADD, GX_TB_ZERO, GX_CS_SCALE_1, GX_TRUE, GX_TEVPREV);
}
GX_SetNumTevStages(aa);

GX_SetAlphaUpdate(GX_TRUE);
GX_SetCullMode(GX_CULL_NONE);
GX_SetZMode(GX_DISABLE, GX_ALWAYS, GX_FALSE);
GX_SetBlendMode(GX_BM_NONE, GX_BL_SRCALPHA, GX_BL_INVSRCALPHA, GX_LO_CLEAR);

GX_ClearVtxDesc();
GX_SetVtxDesc(GX_VA_POS, GX_DIRECT);
GX_SetVtxAttrFmt(GX_VTXFMT0, GX_VA_POS, GX_POS_XYZ, GX_F32, 0);
GX_SetVtxDesc(GX_VA_TEX0, GX_DIRECT);
GX_SetVtxAttrFmt(GX_VTXFMT0, GX_VA_TEX0, GX_TEX_ST, GX_F32, 0);
guMtxIdentity(modelViewMtx);
GX_LoadPosMtxImm(modelViewMtx, GX_PNMTX0);
GX_Begin(GX_QUADS, GX_VTXFMT0, 4);
GX_Position3f32(x, y, 0.f);
GX_TexCoord2f32(0.f, 0.f);
GX_Position3f32(x + w, y, 0.f);
GX_TexCoord2f32(1.f, 0.f);
GX_Position3f32(x + w, y + h, 0.f);
GX_TexCoord2f32(1.f, 1.f);
GX_Position3f32(x, y + h, 0.f);
GX_TexCoord2f32(0.f, 1.f);
GX_End();
GX_SetNumChans(1);
GX_SetNumTexGens(1);
GX_SetNumTevStages(1);
}

void CVideo::_setViewPort(float x, float y, float w, float h)
{
m_vpX = x;
m_vpY = y;
m_vpW = w;
m_vpH = h;
GX_SetViewport(x, y, w, h, 0.f, 1.f);
}

void CVideo::shiftViewPort(float x, float y)
{
GX_SetViewport(m_vpX + x, m_vpY + y, m_vpW, m_vpH, 0.f, 1.f);
}

static inline u32 coordsI8(u32 x, u32 y, u32 w)
{
return (((y >> 2) * (w >> 3) + (x >> 3)) << 5) + ((y & 3) << 3) + (x & 7);
}

int CVideo::stencilVal(int x, int y)
{
if ((u32)x >= m_rmode->fbWidth || (u32)y >= m_rmode->efbHeight)
return 0;
x = x * CVideo::_stencilWidth / 640;
y = y * CVideo::_stencilHeight / 480;
u32 i = coordsI8(x, y, (u32)CVideo::_stencilWidth);
if (i >= (u32)(CVideo::_stencilWidth * CVideo::_stencilHeight))
return 0;
return ((u8*)m_stencil)[i];
}

void CVideo::prepareStencil(void)
{
GX_SetPixelFmt(GX_PF_Y8, GX_ZC_LINEAR);
_setViewPort(0.f, 0.f, (float)CVideo::_stencilWidth, (float)CVideo::_stencilHeight);
GX_SetScissor(0, 0, CVideo::_stencilWidth, CVideo::_stencilHeight);
GX_InvVtxCache();
GX_InvalidateTexAll();
}

void CVideo::renderStencil(void)
{
GX_DrawDone();
GX_SetZMode(GX_DISABLE, GX_ALWAYS, GX_TRUE);
GX_SetColorUpdate(GX_TRUE);
GX_SetCopyFilter(GX_FALSE, NULL, GX_FALSE, NULL);
GX_SetTexCopySrc(0, 0, CVideo::_stencilWidth, CVideo::_stencilHeight);
GX_SetTexCopyDst(CVideo::_stencilWidth, CVideo::_stencilHeight, GX_CTF_R8, GX_FALSE);
GX_CopyTex(m_stencil, GX_TRUE);
GX_PixModeSync();
DCFlushRange(m_stencil, CVideo::_stencilWidth * CVideo::_stencilHeight);
GX_SetCopyFilter(m_rmode->aa, m_rmode->sample_pattern, GX_TRUE, m_rmode->vfilter);
}

void CVideo::render(void)
{
GX_DrawDone();
GX_SetZMode(GX_DISABLE, GX_ALWAYS, GX_TRUE);
GX_SetColorUpdate(GX_TRUE);
GX_CopyDisp(MEM_K1_TO_K0(m_frameBuf[m_curFB]), GX_TRUE);
DCFlushRange(m_frameBuf[m_curFB], 2 * m_rmode->fbWidth * m_rmode->xfbHeight);
VIDEO_SetNextFramebuffer(m_frameBuf[m_curFB]);
VIDEO_Flush();
VIDEO_WaitVSync();
m_curFB ^= 1;
GX_InvalidateTexAll();
}

void CVideo::_showWaitMessages(CVideo *m)
{
m->m_showingWaitMessages = true;
u32 frames = m->m_waitMessageDelay * 50;
u32 waitFrames = frames;

u8 fadeStep = 2 * (u32) (255.f / (waitFrames * m->m_waitMessages.size()));
s8 fadeDirection = 1;
s8 PNGfadeDirection = 1;
s16 currentLightLevel = 0;

vector<STexture>::iterator waitItr = m->m_waitMessages.begin();
gprintf("Going to show a wait message screen, delay: %d, # images: %d\n", waitFrames, m->m_waitMessages.size());

m->waitMessage(*waitItr);
waitItr += PNGfadeDirection;

if (m->m_useWiiLight)
{
wiiLightSetLevel(0);
wiiLightOn();
}

while (m->m_showWaitMessage)
{
if (m->m_useWiiLight)
{
currentLightLevel += (fadeStep * fadeDirection);
if (currentLightLevel >= 255)
{
currentLightLevel = 255;
fadeDirection = -1;
}
else if (currentLightLevel <= 0)
{
currentLightLevel = 0;
fadeDirection = 1;
}
wiiLightSetLevel(currentLightLevel);
}

if (waitFrames == 0)
{
m->waitMessage(*waitItr);
waitItr += PNGfadeDirection;

if(waitItr + 1 == m->m_waitMessages.end() || waitItr == m->m_waitMessages.begin())
PNGfadeDirection *= (-1);

waitFrames = frames;
}
waitFrames--;
VIDEO_WaitVSync();
}
if (m->m_useWiiLight)
wiiLightOff();
m->m_showingWaitMessages = false;
gprintf("Stop showing images\n");
}

void CVideo::hideWaitMessage()
{
m_showWaitMessage = false;
CheckWaitThread();
wiiLightOff();
}

void CVideo::CheckWaitThread(bool force)
{
if ((!m_showingWaitMessages && waitThread != LWP_THREAD_NULL) || force)
{
m_showWaitMessage = false;
gprintf("Now hide wait message\n");

if(LWP_ThreadIsSuspended(waitThread))
LWP_ResumeThread(waitThread);

LWP_JoinThread(waitThread, NULL);

if(waitThreadStack.get())
waitThreadStack.release();
waitThread = LWP_THREAD_NULL;
}
}

void CVideo::waitMessage(float delay)
{
if(m_defaultWaitMessages.size() == 0)
{
STexture m_wTextures[10];
m_wTextures[0].fromPNG(wait_01_png);
m_wTextures[1].fromPNG(wait_02_png);
m_wTextures[2].fromPNG(wait_03_png);
m_wTextures[3].fromPNG(wait_04_png);
m_wTextures[4].fromPNG(wait_05_png);
m_wTextures[5].fromPNG(wait_06_png);
m_wTextures[6].fromPNG(wait_07_png);
m_wTextures[7].fromPNG(wait_08_png);
m_wTextures[8].fromPNG(wait_09_png);
m_wTextures[9].fromPNG(wait_10_png);
for (int i = 0; i < 10; i++)
m_defaultWaitMessages.push_back(m_wTextures[i]);
}
waitMessage(vector<STexture>(), delay);
}

void CVideo::waitMessage(const vector<STexture> &tex, float delay, bool useWiiLight)
{
hideWaitMessage();

m_useWiiLight = useWiiLight;

if (tex.size() == 0)
{
m_waitMessages = m_defaultWaitMessages;
m_waitMessageDelay = 0.2f;
}
else
{
m_waitMessages = tex;
m_waitMessageDelay = delay;
}
_clearScreen();

if (m_waitMessages.size() == 1)
waitMessage(m_waitMessages[0]);
else if (m_waitMessages.size() > 1)
{
CheckWaitThread();
m_showWaitMessage = true;
unsigned int stack_size = (unsigned int)32768;
waitThreadStack = smartMem2Alloc(stack_size);
LWP_CreateThread(&waitThread, (void *(*)(void *))CVideo::_showWaitMessages, (void *)this, waitThreadStack.get(), stack_size, LWP_PRIO_IDLE);
}
}

void CVideo::waitMessage(const STexture &tex)
{
Mtx modelViewMtx;
GXTexObj texObj;

prepare();
setup2DProjection();
GX_SetNumChans(0);
GX_ClearVtxDesc();
GX_SetVtxDesc(GX_VA_POS, GX_DIRECT);
GX_SetVtxAttrFmt(GX_VTXFMT0, GX_VA_POS, GX_POS_XYZ, GX_F32, 0);
GX_SetVtxDesc(GX_VA_TEX0, GX_DIRECT);
GX_SetVtxAttrFmt(GX_VTXFMT0, GX_VA_TEX0, GX_TEX_ST, GX_F32, 0);
GX_SetNumTexGens(1);
GX_SetTevColorIn(GX_TEVSTAGE0, GX_CC_ZERO, GX_CC_ZERO, GX_CC_ZERO, GX_CC_TEXC);
GX_SetTevAlphaIn(GX_TEVSTAGE0, GX_CA_ZERO, GX_CA_ZERO, GX_CA_ZERO, GX_CA_TEXA);
GX_SetTevColorOp(GX_TEVSTAGE0, GX_TEV_ADD, GX_TB_ZERO, GX_CS_SCALE_1, GX_TRUE, GX_TEVPREV);
GX_SetTevAlphaOp(GX_TEVSTAGE0, GX_TEV_ADD, GX_TB_ZERO, GX_CS_SCALE_1, GX_TRUE, GX_TEVPREV);
GX_SetTevOrder(GX_TEVSTAGE0, GX_TEXCOORD0, GX_TEXMAP0, GX_COLORNULL);
GX_SetTexCoordGen(GX_TEXCOORD0, GX_TG_MTX2x4, GX_TG_TEX0, GX_IDENTITY);
GX_SetBlendMode(GX_BM_NONE, GX_BL_SRCALPHA, GX_BL_INVSRCALPHA, GX_LO_CLEAR);
GX_SetAlphaUpdate(GX_TRUE);
GX_SetCullMode(GX_CULL_NONE);
GX_SetZMode(GX_DISABLE, GX_ALWAYS, GX_FALSE);
guMtxIdentity(modelViewMtx);
GX_LoadPosMtxImm(modelViewMtx, GX_PNMTX0);
GX_InitTexObj(&texObj, tex.data.get(), tex.width, tex.height, tex.format, GX_CLAMP, GX_CLAMP, GX_FALSE);
GX_LoadTexObj(&texObj, GX_TEXMAP0);
GX_Begin(GX_QUADS, GX_VTXFMT0, 4);
GX_Position3f32((float)((640 - tex.width) / 2), (float)((480 - tex.height) / 2), 0.f);
GX_TexCoord2f32(0.f, 0.f);
GX_Position3f32((float)((640 + tex.width) / 2), (float)((480 - tex.height) / 2), 0.f);
GX_TexCoord2f32(1.f, 0.f);
GX_Position3f32((float)((640 + tex.width) / 2), (float)((480 + tex.height) / 2), 0.f);
GX_TexCoord2f32(1.f, 1.f);
GX_Position3f32((float)((640 - tex.width) / 2), (float)((480 + tex.height) / 2), 0.f);
GX_TexCoord2f32(0.f, 1.f);
GX_End();
render();
GX_SetNumChans(1);
}

s32 CVideo::TakeScreenshot(const char *path)
{
IMGCTX ctx = PNGU_SelectImageFromDevice(path);
s32 ret = PNGU_EncodeFromYCbYCr(ctx, m_rmode->fbWidth, m_rmode->efbHeight, m_frameBuf[m_curFB], 1);
PNGU_ReleaseImageContext (ctx);
return ret;
}
 
  • Like
Reactions: 1 person

bostonBC

Well-Known Member
Member
Joined
Aug 17, 2011
Messages
1,304
Trophies
1
XP
1,416
Country
United States
Some suggestions

1. - Button to return to Source Menu

2. - Button to read the game manual (manuals originals) PDF format

Thanks for reading!
Do you have a source for Wii game manuals other than the few dozen that Nintendo has at:http://www.nintendo.com/consumer/manuals/index.jsp?

If so please PM me, thanks!

BTW - that would be a real cool feature if it were possible.... Maybe the gametdb folks could stock up on the game manual PDF's too... but that might be a copyright violation.
 

MassiveRican

GBATemp's Unofficial Vigilante
Member
Joined
Aug 2, 2011
Messages
2,454
Trophies
1
Location
Creeping in the Shadows
XP
1,190
Country
Some suggestions

1. - Button to return to Source Menu

2. - Button to read the game manual (manuals originals) PDF format

Thanks for reading!
Do you have a source for Wii game manuals other than the few dozen that Nintendo has at:http://www.nintendo.com/consumer/manuals/index.jsp?

If so please PM me, thanks!

BTW - that would be a real cool feature if it were possible.... Maybe the gametdb folks could stock up on the game manual PDF's too... but that might be a copyright violation.
I also like the game manual idea. Are there any legal implications to hosting them and making them available for download?
 

FIX94

Former Staff
Former Staff
Joined
Dec 3, 2009
Messages
7,284
Trophies
0
Age
30
Location
???
XP
11,248
Country
Germany
Thanks bostonBC, I fixed the banner display problem, it was because of anti aliasing, gx doesnt have it so you didnt see problems there and the code also didnt contain graphic reset for the other buffers, thanks for sending me the banner, took me a bit to find now though, I hope thats the last banner display problem :P
 

bostonBC

Well-Known Member
Member
Joined
Aug 17, 2011
Messages
1,304
Trophies
1
XP
1,416
Country
United States
Thanks bostonBC, I fixed the banner display problem, it was because of anti aliasing, gx doesnt have it so you didnt see problems there and the code also didnt contain graphic reset for the other buffers, thanks for sending me the banner, took me a bit to find now though, I hope thats the last banner display problem :P
Fantastic, thanks! I just compiled r546 and it works fine with that banner now.

The code dump on exit problem is still there though.
 

fledge68

Well-Known Member
Member
Joined
Jan 30, 2012
Messages
2,438
Trophies
2
XP
4,967
Country
United States
I want to thank fledge for fixing my issue,
back on track now...

I noticed the "banners" folder is neither used nor created
Cached banners should be in ID6 only or they won't show
I can't access game settings (banners always disply in full screen and settings btn is hidden)
just press 'a' on the full screen banner and it should shrink to the upper right corner and you will see the usual screen. press 'a' on the small banner to go back to full banner
 

the-hans3009

Member
Newcomer
Joined
Jul 5, 2012
Messages
15
Trophies
0
XP
6
Country
Cote d'Ivoire
Fix94:


there is a way of enlarging only the covers of Fceugx (Nes)??

Because the covers of Nintendo are bigger and super nintendo, n64, gba are small

thanks for replying ..
 

FIX94

Former Staff
Former Staff
Joined
Dec 3, 2009
Messages
7,284
Trophies
0
Age
30
Location
???
XP
11,248
Country
Germany
there is a way of enlarging only the covers of Fceugx (Nes)??
Uhm you may ask that a themer, with themes and custom coverflows that should be possible, I hope somebody hear will reply to that because I'm no themer at all ;)
The code dump on exit problem is still there though.
I cant get it to codedump, can you explain again how to reproduce it?
 

bostonBC

Well-Known Member
Member
Joined
Aug 17, 2011
Messages
1,304
Trophies
1
XP
1,416
Country
United States
there is a way of enlarging only the covers of Fceugx (Nes)??
Uhm you may ask that a themer, with themes and custom coverflows that should be possible, I hope somebody hear will reply to that because I'm no themer at all ;)
The code dump on exit problem is still there though.
I cant get it to codedump, can you explain again how to reproduce it?
Sure, if you start by deleting your apps/wiiflow.ini and then run Wiiflow to recreate it.

Then set the 'Return to Channel' option to return back to WiiFlow.

Then before doing anything else exit WiiFlow and you will see no crash.

Re-run WiiFlow and run a game. Return to WiiFlow and then exit. It code dumps every time.

If you change it back to disabled and run WiiFlow and then exit it code dumps the first time but not the second/subsequent times.

The weird part is after the setting is set if you run WiiFlow and exit it still code dumps with the setting Return to WiiFlow set without having to run a game.
 

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
  • No one is chatting at the moment.
    K3Nv2 @ K3Nv2: Att is displaying prices like it's an ingredients list now lol