mirror of
https://github.com/ctruLua/ctruLua.git
synced 2025-10-28 00:39:30 +00:00
Updated to the latest ctrulib, Fixed some minor bugs.
Working with citra, untested on real hardware but should be OK. IR should now work. Let's add some 3D drawing and sound now !
This commit is contained in:
parent
b4d025d602
commit
2e782ed9ea
15 changed files with 85 additions and 91 deletions
|
|
@ -35,7 +35,7 @@ static float ortho_matrix_bot[4*4];
|
|||
//Apt hook cookie
|
||||
static aptHookCookie apt_hook_cookie;
|
||||
//Functions
|
||||
static void apt_hook_func(int hook, void* param);
|
||||
static void apt_hook_func(APT_HookType hook, void *param);
|
||||
static void reset_gpu_apt_resume();
|
||||
|
||||
int sf2d_init()
|
||||
|
|
@ -87,7 +87,7 @@ int sf2d_init_advanced(int gpucmd_size, int temppool_size)
|
|||
cur_side = GFX_LEFT;
|
||||
|
||||
GPUCMD_Finalize();
|
||||
GPUCMD_FlushAndRun(NULL);
|
||||
GPUCMD_FlushAndRun();
|
||||
gspWaitForP3D();
|
||||
|
||||
sf2d_pool_reset();
|
||||
|
|
@ -144,8 +144,8 @@ void sf2d_start_frame(gfxScreen_t screen, gfx3dSide_t side)
|
|||
} else {
|
||||
screen_w = 320;
|
||||
}
|
||||
GPU_SetViewport((u32 *)osConvertVirtToPhys((u32)gpu_depth_fb_addr),
|
||||
(u32 *)osConvertVirtToPhys((u32)gpu_fb_addr),
|
||||
GPU_SetViewport((u32 *)osConvertVirtToPhys(gpu_depth_fb_addr),
|
||||
(u32 *)osConvertVirtToPhys(gpu_fb_addr),
|
||||
0, 0, 240, screen_w);
|
||||
|
||||
GPU_DepthMap(-1.0f, 0.0f);
|
||||
|
|
@ -154,8 +154,8 @@ void sf2d_start_frame(gfxScreen_t screen, gfx3dSide_t side)
|
|||
GPU_SetStencilOp(GPU_STENCIL_KEEP, GPU_STENCIL_KEEP, GPU_STENCIL_KEEP);
|
||||
GPU_SetBlendingColor(0,0,0,0);
|
||||
GPU_SetDepthTestAndWriteMask(true, GPU_GEQUAL, GPU_WRITE_ALL);
|
||||
GPUCMD_AddMaskedWrite(GPUREG_0062, 0x1, 0);
|
||||
GPUCMD_AddWrite(GPUREG_0118, 0);
|
||||
GPUCMD_AddMaskedWrite(GPUREG_EARLYDEPTH_TEST1, 0x1, 0);
|
||||
GPUCMD_AddWrite(GPUREG_EARLYDEPTH_TEST2, 0);
|
||||
|
||||
GPU_SetAlphaBlending(
|
||||
GPU_BLEND_ADD,
|
||||
|
|
@ -177,23 +177,23 @@ void sf2d_end_frame()
|
|||
{
|
||||
GPU_FinishDrawing();
|
||||
GPUCMD_Finalize();
|
||||
GPUCMD_FlushAndRun(NULL);
|
||||
GPUCMD_FlushAndRun();
|
||||
gspWaitForP3D();
|
||||
|
||||
//Copy the GPU rendered FB to the screen FB
|
||||
if (cur_screen == GFX_TOP) {
|
||||
GX_SetDisplayTransfer(NULL, gpu_fb_addr, GX_BUFFER_DIM(240, 400),
|
||||
GX_DisplayTransfer(gpu_fb_addr, GX_BUFFER_DIM(240, 400),
|
||||
(u32 *)gfxGetFramebuffer(GFX_TOP, cur_side, NULL, NULL),
|
||||
GX_BUFFER_DIM(240, 400), 0x1000);
|
||||
} else {
|
||||
GX_SetDisplayTransfer(NULL, gpu_fb_addr, GX_BUFFER_DIM(240, 320),
|
||||
GX_DisplayTransfer(gpu_fb_addr, GX_BUFFER_DIM(240, 320),
|
||||
(u32 *)gfxGetFramebuffer(GFX_BOTTOM, GFX_LEFT, NULL, NULL),
|
||||
GX_BUFFER_DIM(240, 320), 0x1000);
|
||||
}
|
||||
gspWaitForPPF();
|
||||
|
||||
//Clear the screen
|
||||
GX_SetMemoryFill(NULL,
|
||||
GX_MemoryFill(
|
||||
gpu_fb_addr, clear_color, &gpu_fb_addr[240*400], GX_FILL_TRIGGER | GX_FILL_32BIT_DEPTH,
|
||||
gpu_depth_fb_addr, 0, &gpu_depth_fb_addr[240*400], GX_FILL_TRIGGER | GX_FILL_32BIT_DEPTH);
|
||||
gspWaitForPSC0();
|
||||
|
|
@ -203,7 +203,7 @@ void sf2d_swapbuffers()
|
|||
{
|
||||
gfxSwapBuffersGpu();
|
||||
if (vblank_wait) {
|
||||
gspWaitForEvent(GSPEVENT_VBlank0, false);
|
||||
gspWaitForEvent(GSPGPU_EVENT_VBlank0, false);
|
||||
}
|
||||
//Calculate FPS
|
||||
frames++;
|
||||
|
|
@ -289,7 +289,7 @@ gfx3dSide_t sf2d_get_current_side()
|
|||
return cur_side;
|
||||
}
|
||||
|
||||
static void apt_hook_func(int hook, void* param)
|
||||
static void apt_hook_func(APT_HookType hook, void *param)
|
||||
{
|
||||
if (hook == APTHOOK_ONRESTORE) {
|
||||
reset_gpu_apt_resume();
|
||||
|
|
@ -308,6 +308,6 @@ static void reset_gpu_apt_resume()
|
|||
}
|
||||
|
||||
GPUCMD_Finalize();
|
||||
GPUCMD_FlushAndRun(NULL);
|
||||
GPUCMD_FlushAndRun();
|
||||
gspWaitForP3D();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue