22#include <stdlib.h>
33#include <sys/param.h>
44#include <kernel.h>
5+ #include <types/event.h>
6+
7+
58#include <gnmdriver.h>
69#include <systemservice.h>
710#include <videoout.h>
811#include <types/userservice.h>
12+
913#include "orbis2d.h"
1014#include "logdebug.h"
1115
@@ -53,10 +57,10 @@ int orbis2dCreateConf()
5357 orbconf -> width = ATTR_WIDTH ;
5458 orbconf -> pitch = ATTR_WIDTH ;
5559 orbconf -> height = ATTR_HEIGHT ;
56- orbconf -> pixelFormat = SCE_VIDEO_OUT_PIXEL_FORMAT_A8R8G8B8_SRGB ;
60+ orbconf -> pixelFormat = 0x80000000 ;
5761 orbconf -> bytesPerPixel = 4 ;
58- orbconf -> tilingMode = SCE_VIDEO_OUT_TILING_MODE_LINEAR ;
59- orbconf -> flipMode = ORBIS2D_FLIP_MODE ;
62+ orbconf -> tilingMode = ORBIS2D_MODE_LINEAR ;
63+ orbconf -> flipMode = ORBIS2D_FLIP_MODE_VSYNC ;
6064 orbconf -> flipRate = ORBIS2D_FLIP_RATE ;
6165 orbconf -> videoHandle = -1 ;
6266 orbconf -> currentBuffer = 0 ;
@@ -160,7 +164,7 @@ void orbis2dStartDrawing()
160164 orbis2dWaitFlipArg (& orbconf -> flipQueue );
161165
162166}
163- void orbis2dWritePixelColor (int x , int y , uint32_t pixelColor )
167+ void orbis2dDrawPixelColor (int x , int y , uint32_t pixelColor )
164168{
165169 int color ;
166170 int pixel = (y * orbconf -> pitch ) + x ;
@@ -178,7 +182,7 @@ void orbis2dDrawRectColor(int x, int w, int y, int h, uint32_t color)
178182 {
179183 for (x0 = x ;x0 < x + w ;x0 ++ )
180184 {
181- orbis2dWritePixelColor (x0 ,y0 ,color );
185+ orbis2dDrawPixelColor (x0 ,y0 ,color );
182186 }
183187 }
184188}
@@ -223,7 +227,7 @@ int orbis2dInitDisplayBuffer(int num, int bufIndexStart)
223227{
224228 SceVideoOutBufferAttribute attr ;
225229 int ret ;
226- sceVideoOutSetBufferAttribute (& attr ,orbconf -> pixelFormat ,orbconf -> tilingMode ,SCE_VIDEO_OUT_ASPECT_RATIO_16_9 ,orbconf -> width ,orbconf -> height ,orbconf -> pitch );
230+ sceVideoOutSetBufferAttribute (& attr ,orbconf -> pixelFormat ,orbconf -> tilingMode ,0 ,orbconf -> width ,orbconf -> height ,orbconf -> pitch );
227231
228232 sys_log ("liborbis2d sceVideoOutSetBufferAttribute done\n" );
229233
@@ -240,15 +244,15 @@ int orbis2dInitMemory()
240244
241245 const uint32_t align = 2 * 1024 * 1024 ;
242246
243- ret = sceKernelAllocateDirectMemory (0 ,sceKernelGetDirectMemorySize (),orbconf -> videoMemStackSize ,align ,SCE_KERNEL_WC_GARLIC ,& start );
247+ ret = sceKernelAllocateDirectMemory (0 ,sceKernelGetDirectMemorySize (),orbconf -> videoMemStackSize ,align ,3 ,& start );
244248 if (ret == 0 )
245249 {
246250
247251 orbconf -> videoMemOffset = start ;
248252
249253 void * pointer = NULL ;
250254
251- ret = sceKernelMapDirectMemory (& pointer ,orbconf -> videoMemStackSize ,SCE_KERNEL_PROT_CPU_READ | SCE_KERNEL_PROT_CPU_WRITE | SCE_KERNEL_PROT_GPU_READ | SCE_KERNEL_PROT_GPU_ALL ,0 ,start ,align );
255+ ret = sceKernelMapDirectMemory (& pointer ,orbconf -> videoMemStackSize ,0x33 ,0 ,start ,align );
252256 if (ret == 0 )
253257 {
254258 orbconf -> videoMemStackBaseAddr = (uintptr_t )pointer ;
@@ -264,7 +268,7 @@ int orbis2dInitVideoHandle()
264268 int handle ;
265269 int ret ;
266270
267- handle = sceVideoOutOpen (SCE_USER_SERVICE_USER_ID_SYSTEM , SCE_VIDEO_OUT_BUS_TYPE_MAIN , 0 , NULL );
271+ handle = sceVideoOutOpen (0xff , 0 , 0 , NULL );
268272
269273 if (handle < 0 )
270274 {
@@ -343,7 +347,7 @@ int orbis2dInit()
343347 // set status of each buffer with flipArg
344348 for (bufIndex = 0 ;bufIndex < ORBIS2D_DISPLAY_BUFFER_NUM ;bufIndex ++ )
345349 {
346- orbconf -> flipArgLog [bufIndex ]= SCE_VIDEO_OUT_BUFFER_INITIAL_FLIP_ARG - 1 ;
350+ orbconf -> flipArgLog [bufIndex ]= -2 ;
347351 }
348352
349353 // prepare initial clear color to the display buffers
0 commit comments