MCPcopy Create free account
hub / github.com/DaedalusX64/daedalus / LoadFrameBuffer

Function LoadFrameBuffer

Source/HLEGraphics/uCodes/Ucode_FB.h:24–62  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

22
23#ifndef DAEDALUS_PSP
24static inline CRefPtr<CNativeTexture> LoadFrameBuffer(u32 origin)
25{
26 u32 width = Memory_VI_GetRegister( VI_WIDTH_REG );
27 if( width == 0 )
28 {
29 //DAEDALUS_ERROR("Loading 0 size frame buffer?");
30 return NULL;
31 }
32
33 if( origin <= width*2 )
34 {
35 //DAEDALUS_ERROR("Loading small frame buffer not supported");
36 return NULL;
37 }
38 //ToDO: We should use uViWidth+1 and uViHeight+1
39#define FB_WIDTH 320
40#define FB_HEIGHT 240
41
42#ifdef DAEDALUS_ENABLE_ASSERTS
43 DAEDALUS_ASSERT(g_CI.Size == G_IM_SIZ_16b,"32b frame buffer is not supported");
44 //DAEDALUS_ASSERT((uViWidth+1) == FB_WIDTH,"Variable width is not handled");
45 //DAEDALUS_ASSERT((uViHeight+1) == FB_HEIGHT,"Variable height is not handled");
46 #endif
47 TextureInfo ti;
48
49 ti.SetSwapped (0);
50 ti.SetPalette (0);
51 ti.SetTlutAddress (TLUT_BASE);
52 ti.SetTLutFormat (kTT_RGBA16);
53 ti.SetFormat (0);
54 ti.SetSize (2);
55
56 ti.SetLoadAddress (origin - width*2);
57 ti.SetWidth (FB_WIDTH);
58 ti.SetHeight (FB_HEIGHT);
59 ti.SetPitch (width << 2 >> 1);
60
61 return gRenderer->LoadTextureDirectly(ti);
62}
63
64//Borrowed from StrmnNrmn's N64js
65static inline void DrawFrameBuffer(u32 origin, const CNativeTexture * texture)

Callers 1

RenderFrameBufferFunction · 0.70

Calls 11

SetSwappedMethod · 0.80
SetPaletteMethod · 0.80
SetTlutAddressMethod · 0.80
SetTLutFormatMethod · 0.80
SetFormatMethod · 0.80
SetSizeMethod · 0.80
SetLoadAddressMethod · 0.80
SetWidthMethod · 0.80
SetHeightMethod · 0.80
SetPitchMethod · 0.80
LoadTextureDirectlyMethod · 0.80

Tested by

no test coverage detected