 |
forums.ps2dev.org Homebrew PS2, PSP & PS3 Development Discussions
|
| View previous topic :: View next topic |
| Author |
Message |
youresam
Joined: 06 Nov 2005 Posts: 87
|
Posted: Tue Jan 31, 2006 9:37 am Post subject: My code for different graphics mode, Shine please look. |
|
|
Alright, I have been wanting the low graphics mode for a while now, and I figure if I paste the code I can think of here, you might add it.
Alright, heres the deal... for some reason, my compiler doesnt work well with luaplayer. Although I can compile it, it crashes on exit.
So, heres some sample code:
Add to luasystem.cpp right before the get current directory function.
| Code: | | static int highGraphicsMode = 1; |
Add these functions.
| Code: | static int lua_highGraphics(lua_State *L)
{
if (lua_gettop(L) != 0) return luaL_error(L, "no arguments expected");
if (highGraphicsMode) return 0;
highGraphicsMode = 0;
return 0;
}
static int lua_lowGraphics(lua_State *L)
{
if (lua_gettop(L) != 0) return luaL_error(L, "no arguments expected");
if (!highGraphicsMode) return 0;
highGraphicsMode = 1;
return 0;
} |
Add this to the bottom with the list. (After the sleep function)
| Code: | {"lowGraphicsMode", lua_lowGraphics},
{"highGraphicsMode", lua_highGraphics}, |
Add this to graphics.cpp.
| Code: | void blitImageToScreen(int sx, int sy, int width, int height, Image* source, int dx, int dy)
{
if (!initialized) return;
Color* vram = getVramDrawBuffer();
sceKernelDcacheWritebackInvalidateAll();
guStart();
if (highGraphicsMode) sceGuCopyImage(GU_PSM_8888, sx, sy, width, height, source->textureWidth, source->data, dx, dy, PSP_LINE_SIZE, vram);
if (!highGraphicsMode) sceGuCopyImage(GU_PSM_5551, sx, sy, width, height, source->textureWidth, source->data, dx, dy, PSP_LINE_SIZE, vram);
sceGuFinish();
sceGuSync(0,0);
} |
However, Im not sure about:
sceGuDrawBuffer(GU_PSM_8888, (void*)FRAMEBUFFER_SIZE, PSP_LINE_SIZE);
...
sceGuTexMode(GU_PSM_8888, 0, 0, 0);
Dont know much about what that does....
So, if someone could test this out, that would be great, thanks! |
|
| Back to top |
|
 |
Dr. Vegetable
Joined: 14 Nov 2005 Posts: 171 Location: Boston, Massachusetts
|
Posted: Tue Jan 31, 2006 12:17 pm Post subject: |
|
|
No offense, but did you actually test this code?
| Code: |
static int lua_highGraphics(lua_State *L)
{
if (lua_gettop(L) != 0) return luaL_error(L, "no arguments expected");
if (highGraphicsMode) return 0;
// This point only reached if highGraphicsMode is already zero!
highGraphicsMode = 0;
return 0;
}
static int lua_lowGraphics(lua_State *L)
{
if (lua_gettop(L) != 0) return luaL_error(L, "no arguments expected");
if (!highGraphicsMode) return 0;
// This point only reached if highGraphicsMode is already non-zero!
highGraphicsMode = 1;
return 0;
}
|
It looks to me like these two functions are backwards. Shouldn't lua_highGraphics() set highGraphicsMode = 1 and lua_lowGraphics() clear highGraphicsMode = 0; ?
Or better yet:
| Code: |
static int lua_highGraphics(lua_State *L)
{
if (lua_gettop(L) != 0) return luaL_error(L, "no arguments expected");
highGraphicsMode = 1;
return 0;
}
static int lua_lowGraphics(lua_State *L)
{
if (lua_gettop(L) != 0) return luaL_error(L, "no arguments expected");
highGraphicsMode = 0;
return 0;
}
|
|
|
| Back to top |
|
 |
Shine
Joined: 03 Dec 2004 Posts: 728 Location: Germany
|
Posted: Wed Feb 01, 2006 7:09 am Post subject: Re: My code for different graphics mode, Shine please look. |
|
|
| youresam wrote: | Alright, I have been wanting the low graphics mode for a while now, and I figure if I paste the code I can think of here, you might add it.
|
For full support of 2 graphics modes you'll need to change nearly every position where "Color" is used. This would be easier with a C++ template class, where the template parameter is the color type and u16 or u32 and some traits class for parametrizing the different code, where needed. But I think it would be better to concentrate on integrating pspgl, like suggested in another thread in this forum by me again, then you'll have every possible pixelformat and existing functions may be faster (beause of multiple graphics buffer pipelines in pspgl and other optimized code).
I've still no time this and next week for Lua Player, so if someone wants to implement it, I can test it and commit to SVN repository. |
|
| Back to top |
|
 |
youresam
Joined: 06 Nov 2005 Posts: 87
|
Posted: Wed Feb 01, 2006 11:25 am Post subject: |
|
|
to dr. vegitable:
Yeah, I got those backwards... like I said, untested.
to Shine:
Alright, well, I dont have time to compile it, either. So, like you said, anyone who can, please test it.
Thanks |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|