mirror of
https://github.com/libretro/RetroArch.git
synced 2025-02-21 02:01:24 +00:00
(PSP/PSP2) Create sdk_defines.h that will be used for both PSP
and PSP2
This commit is contained in:
parent
3b6fffa9f9
commit
775ac2a189
@ -25,6 +25,7 @@
|
||||
#include <pspctrl.h>
|
||||
#endif
|
||||
|
||||
#include "sdk_defines.h"
|
||||
#include "psp_input.h"
|
||||
|
||||
#include "../driver.h"
|
||||
|
@ -42,38 +42,4 @@ enum {
|
||||
#endif
|
||||
};
|
||||
|
||||
#ifdef SN_TARGET_PSP2
|
||||
#define STATE_BUTTON(state) ((state).buttons)
|
||||
#define STATE_ANALOGLX(state) ((state).lx)
|
||||
#define STATE_ANALOGLY(state) ((state).ly)
|
||||
#define STATE_ANALOGRX(state) ((state).rx)
|
||||
#define STATE_ANALOGRY(state) ((state).ry)
|
||||
#define DEFAULT_SAMPLING_MODE (SCE_CTRL_MODE_DIGITALANALOG)
|
||||
|
||||
#define PSP_CTRL_LEFT SCE_CTRL_LEFT
|
||||
#define PSP_CTRL_DOWN SCE_CTRL_DOWN
|
||||
#define PSP_CTRL_RIGHT SCE_CTRL_RIGHT
|
||||
#define PSP_CTRL_UP SCE_CTRL_UP
|
||||
#define PSP_CTRL_START SCE_CTRL_START
|
||||
#define PSP_CTRL_SELECT SCE_CTRL_SELECT
|
||||
#define PSP_CTRL_TRIANGLE SCE_CTRL_TRIANGLE
|
||||
#define PSP_CTRL_SQUARE SCE_CTRL_SQUARE
|
||||
#define PSP_CTRL_CROSS SCE_CTRL_CROSS
|
||||
#define PSP_CTRL_CIRCLE SCE_CTRL_CIRCLE
|
||||
#define PSP_CTRL_L SCE_CTRL_L
|
||||
#define PSP_CTRL_R SCE_CTRL_R
|
||||
|
||||
#define sceCtrlReadBufferPositive(port, pad_data, bufs) sceCtrlReadBufferPositive(port, pad_data, bufs)
|
||||
#else
|
||||
#define STATE_BUTTON(state) ((state).Buttons)
|
||||
#define STATE_ANALOGLX(state) ((state).Lx)
|
||||
#define STATE_ANALOGLX(state) ((state).Ly)
|
||||
#define STATE_ANALOGRX(state) ((state).Rx)
|
||||
#define STATE_ANALOGRY(state) ((state).Ry)
|
||||
|
||||
#define DEFAULT_SAMPLING_MODE (PSP_CTRL_MODE_ANALOG)
|
||||
|
||||
#define sceCtrlReadBufferPositive(port, pad_data, bufs) sceCtrlReadBufferPositive(pad_data, bufs)
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
89
psp/sdk_defines.h
Normal file
89
psp/sdk_defines.h
Normal file
@ -0,0 +1,89 @@
|
||||
/* RetroArch - A frontend for libretro.
|
||||
* Copyright (C) 2010-2012 - Hans-Kristian Arntzen
|
||||
* Copyright (C) 2011-2012 - Daniel De Matteis
|
||||
*
|
||||
* RetroArch is free software: you can redistribute it and/or modify it under the terms
|
||||
* of the GNU General Public License as published by the Free Software Found-
|
||||
* ation, either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
|
||||
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||
* PURPOSE. See the GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with RetroArch.
|
||||
* If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef _PSP_SDK_DEFINES_H
|
||||
#define _PSP_SDK_DEFINES_H
|
||||
|
||||
/*============================================================
|
||||
ERROR PROTOTYPES
|
||||
============================================================ */
|
||||
|
||||
#if defined(PSP)
|
||||
#define SCE_OK 0
|
||||
#endif
|
||||
|
||||
/*============================================================
|
||||
DISPLAY PROTOTYPES
|
||||
============================================================ */
|
||||
|
||||
#if defined(SN_TARGET_PSP2)
|
||||
#define PSP_DISPLAY_PIXEL_FORMAT_8888 (SCE_DISPLAY_PIXELFORMAT_A8B8G8R8)
|
||||
|
||||
#define sceDisplaySetFrameBuf(topaddr, bufferwidth, pixelformat, sync) sceDisplaySetFrameBuf(topaddr, sync)
|
||||
|
||||
#define PSP_FB_WIDTH 960
|
||||
#define PSP_FB_HEIGHT 544
|
||||
#define PSP_PITCH_PIXELS 1024
|
||||
|
||||
#elif defined(PSP)
|
||||
#define SCE_DISPLAY_UPDATETIMING_NEXTVSYNC 1
|
||||
|
||||
#define PSP_FB_WIDTH 512
|
||||
#define PSP_FB_HEIGHT 512
|
||||
#define PSP_PITCH_PIXELS 512
|
||||
|
||||
#endif
|
||||
|
||||
/*============================================================
|
||||
INPUT PROTOTYPES
|
||||
============================================================ */
|
||||
|
||||
#if defined(SN_TARGET_PSP2)
|
||||
|
||||
#define STATE_BUTTON(state) ((state).buttons)
|
||||
#define STATE_ANALOGLX(state) ((state).lx)
|
||||
#define STATE_ANALOGLY(state) ((state).ly)
|
||||
#define STATE_ANALOGRX(state) ((state).rx)
|
||||
#define STATE_ANALOGRY(state) ((state).ry)
|
||||
#define DEFAULT_SAMPLING_MODE (SCE_CTRL_MODE_DIGITALANALOG)
|
||||
|
||||
#define PSP_CTRL_LEFT SCE_CTRL_LEFT
|
||||
#define PSP_CTRL_DOWN SCE_CTRL_DOWN
|
||||
#define PSP_CTRL_RIGHT SCE_CTRL_RIGHT
|
||||
#define PSP_CTRL_UP SCE_CTRL_UP
|
||||
#define PSP_CTRL_START SCE_CTRL_START
|
||||
#define PSP_CTRL_SELECT SCE_CTRL_SELECT
|
||||
#define PSP_CTRL_TRIANGLE SCE_CTRL_TRIANGLE
|
||||
#define PSP_CTRL_SQUARE SCE_CTRL_SQUARE
|
||||
#define PSP_CTRL_CROSS SCE_CTRL_CROSS
|
||||
#define PSP_CTRL_CIRCLE SCE_CTRL_CIRCLE
|
||||
#define PSP_CTRL_L SCE_CTRL_L
|
||||
#define PSP_CTRL_R SCE_CTRL_R
|
||||
|
||||
#define sceCtrlReadBufferPositive(port, pad_data, bufs) sceCtrlReadBufferPositive(port, pad_data, bufs)
|
||||
|
||||
#elif defined(PSP)
|
||||
|
||||
#define STATE_BUTTON(state) ((state).Buttons)
|
||||
#define STATE_ANALOGLX(state) ((state).Lx)
|
||||
#define STATE_ANALOGLX(state) ((state).Ly)
|
||||
#define STATE_ANALOGRX(state) ((state).Rx)
|
||||
#define STATE_ANALOGRY(state) ((state).Ry)
|
||||
|
||||
#define DEFAULT_SAMPLING_MODE (PSP_CTRL_MODE_ANALOG)
|
||||
|
||||
#define sceCtrlReadBufferPositive(port, pad_data, bufs) sceCtrlReadBufferPositive(pad_data, bufs)
|
||||
#endif
|
@ -24,23 +24,17 @@
|
||||
* - Actually run and test this to make sure it does work
|
||||
*/
|
||||
|
||||
#include "../psp/sdk_defines.h"
|
||||
#include "../general.h"
|
||||
#include "../driver.h"
|
||||
|
||||
#define MALLOC_PARAMS_FRAGMENT_FLAG (1 << 0)
|
||||
#define MALLOC_PARAMS_VERTEX_FLAG (1 << 1)
|
||||
|
||||
#define PSP2_WIDTH 960
|
||||
#define PSP2_HEIGHT 544
|
||||
#define PSP2_PITCH_PIXELS 1024
|
||||
|
||||
#define TEX_FMT_32BPP SCE_GXM_COLOR_FORMAT_A8R8G8B8
|
||||
#define PIX_FMT_32BPP SCE_DISPLAY_PIXELFORMAT_A8R8G8B8
|
||||
|
||||
#define GXM_ALIGN(x, a) (((x) + ((a) - 1)) & ~((a) - 1))
|
||||
|
||||
#define DISPLAY_BUFFER_COUNT 3
|
||||
#define DISPLAY_BUFFER_SIZE (GXM_ALIGN(PSP2_PITCH_PIXELS * PSP2_HEIGHT * 4, 1024 * 1024))
|
||||
#define DISPLAY_BUFFER_SIZE (GXM_ALIGN(PSP_PITCH_PIXELS * PSP_FB_HEIGHT * 4, 1024 * 1024))
|
||||
#define DISPLAY_MAX_PENDING_SWAPS 2
|
||||
|
||||
typedef struct psp2_video
|
||||
@ -150,8 +144,8 @@ static void psp2_gfx_init_fbo(void *data, const video_info_t *video)
|
||||
memset(&rtparams, 0, sizeof(SceGxmRenderTargetParams));
|
||||
|
||||
rtparams.flags = 0;
|
||||
rtparams.width = PSP2_WIDTH;
|
||||
rtparams.height = PSP2_HEIGHT;
|
||||
rtparams.width = PSP_FB_WIDTH;
|
||||
rtparams.height = PSP_FB_HEIGHT;
|
||||
rtparams.scenesPerFrame = 1;
|
||||
rtparams.multisampleMode = SCE_GXM_MULTISAMPLE_NONE;
|
||||
rtparams.multisampleLocations = 0;
|
||||
@ -179,7 +173,8 @@ static void disp_callback(const void *callback_data)
|
||||
{
|
||||
int ret = SCE_OK;
|
||||
|
||||
SceDisplyFrameBuf framebuf;
|
||||
#if defined(SN_TARGET_PSP2)
|
||||
SceDisplayFrameBuf framebuf;
|
||||
|
||||
const DisplayData *display_data = (const DisplayData*)callback_data;
|
||||
|
||||
@ -187,15 +182,18 @@ static void disp_callback(const void *callback_data)
|
||||
|
||||
framebuf.size = sizeof(SceDisplayFrameBuf);
|
||||
framebuf.base = display_data->address;
|
||||
framebuf.pitch = PSP2_PITCH_PIXELS;
|
||||
framebuf.pixelformat = SCE_DISPLAY_PIXELFORMAT_A8B8G8R8;
|
||||
framebuf.width = PSP2_WIDTH;
|
||||
framebuf.height = PSP2_HEIGHT;
|
||||
framebuf.pitch = PSP_PITCH_PIXELS;
|
||||
framebuf.pixelformat = PSP_DISPLAY_PIXELFORMAT_8888;
|
||||
framebuf.width = PSP_FB_WIDTH;
|
||||
framebuf.height = PSP_FB_HEIGHT;
|
||||
|
||||
ret = sceDisplaySetFrameBuf(&framebuf, PSP_FB_WIDTH, PSP_DISPLAY_PIXELFORMAT_8888, SCE_DISPLAY_UPDATETIMING_NEXTVSYNC);
|
||||
#elif defined(PSP)
|
||||
ret = sceDisplaySetFrameBuf(&display_data->address, PSP_FB_WIDTH, PSP_DISPLAY_PIXELFORMAT_8888, SCE_DISPLAY_UPDATETIMING_NEXTVSYNC);
|
||||
#endif
|
||||
|
||||
/* TODO - Don't bother with error checking for now in here */
|
||||
|
||||
ret = sceDisplaySetFrameBuf(&framebuf, SCE_DISPLAY_UPDATETIMING_NEXTVSYNC);
|
||||
|
||||
// Block until swap has occurred and the old buffer is no longer displayed
|
||||
ret = sceDisplayWaitSetFrameBuf();
|
||||
}
|
||||
@ -277,9 +275,9 @@ static void psp2_gfx_init_sync_objects(const video_info_t *video)
|
||||
SCE_GXM_COLOR_SURFACE_LINEAR,
|
||||
SCE_GXM_COLOR_SURFACE_SCALE_NONE,
|
||||
SCE_GXM_OUTPUT_REGISTER_SIZE_32BIT,
|
||||
PSP2_WIDTH,
|
||||
PS2P_HEIGHT,
|
||||
PSP2_PITCH_PIXELS,
|
||||
PSP_FB_WIDTH,
|
||||
PSP_FB_HEIGHT,
|
||||
PSP_PITCH_PIXELS,
|
||||
vid->disp_buf_data[i]);
|
||||
|
||||
if(ret != SCE_OK)
|
||||
@ -536,4 +534,3 @@ const video_driver_t video_psp2_gxm = {
|
||||
psp2_gfx_restart,
|
||||
#endif
|
||||
};
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user