mirror of
https://github.com/RaySollium99/libpicofe.git
synced 2025-09-05 06:47:45 -04:00
initial psp code, functional menu
git-svn-id: file:///home/notaz/opt/svn/PicoDrive/platform@274 be3aeb3a-fb24-0410-a615-afba39da0efa
This commit is contained in:
parent
e86e20be70
commit
2951214ea6
15 changed files with 2135 additions and 5 deletions
|
@ -26,7 +26,11 @@
|
||||||
#elif defined(__GIZ__)
|
#elif defined(__GIZ__)
|
||||||
#include "../gizmondo/giz.h"
|
#include "../gizmondo/giz.h"
|
||||||
#define SCREEN_WIDTH 321
|
#define SCREEN_WIDTH 321
|
||||||
#define SCREEN_BUFFER giz_screen // ?
|
#define SCREEN_BUFFER giz_screen
|
||||||
|
#elif defined(PSP)
|
||||||
|
#include "../psp/psp.h"
|
||||||
|
#define SCREEN_WIDTH 512
|
||||||
|
#define SCREEN_BUFFER psp_screen
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
char *PicoConfigFile = "picoconfig.bin";
|
char *PicoConfigFile = "picoconfig.bin";
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
#if defined(__GP2X__)
|
#if defined(__GP2X__) || defined(PSP)
|
||||||
|
#include <stdio.h>
|
||||||
#define lprintf printf
|
#define lprintf printf
|
||||||
#else
|
#else
|
||||||
#include "giz.h"
|
#include "giz.h"
|
||||||
|
|
|
@ -22,6 +22,10 @@
|
||||||
#define SCREEN_WIDTH 321
|
#define SCREEN_WIDTH 321
|
||||||
#define SCREEN_BUFFER menu_screen
|
#define SCREEN_BUFFER menu_screen
|
||||||
extern unsigned char *menu_screen;
|
extern unsigned char *menu_screen;
|
||||||
|
#elif defined(PSP)
|
||||||
|
#include "../psp/psp.h"
|
||||||
|
#define SCREEN_WIDTH 512
|
||||||
|
#define SCREEN_BUFFER psp_screen
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
char menuErrorMsg[64] = { 0, };
|
char menuErrorMsg[64] = { 0, };
|
||||||
|
@ -216,6 +220,7 @@ void menu_init(void)
|
||||||
int tmp = parse_hex_color(buff+16);
|
int tmp = parse_hex_color(buff+16);
|
||||||
if (tmp >= 0) menu_sel_color = tmp;
|
if (tmp >= 0) menu_sel_color = tmp;
|
||||||
else lprintf("skin.txt: parse error for selection_color\n");
|
else lprintf("skin.txt: parse error for selection_color\n");
|
||||||
|
lprintf("sel color: %04x\n", menu_sel_color);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
lprintf("skin.txt: parse error: %s\n", buff);
|
lprintf("skin.txt: parse error: %s\n", buff);
|
||||||
|
|
|
@ -4,6 +4,14 @@
|
||||||
#include "readpng.h"
|
#include "readpng.h"
|
||||||
#include "lprintf.h"
|
#include "lprintf.h"
|
||||||
|
|
||||||
|
#ifdef PSP
|
||||||
|
#define BG_WIDTH 480
|
||||||
|
#define BG_HEIGHT 272
|
||||||
|
#else
|
||||||
|
#define BG_WIDTH 320
|
||||||
|
#define BG_HEIGHT 240
|
||||||
|
#endif
|
||||||
|
|
||||||
void readpng(void *dest, const char *fname, readpng_what what)
|
void readpng(void *dest, const char *fname, readpng_what what)
|
||||||
{
|
{
|
||||||
FILE *fp;
|
FILE *fp;
|
||||||
|
@ -62,9 +70,9 @@ void readpng(void *dest, const char *fname, readpng_what what)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
height = info_ptr->height;
|
height = info_ptr->height;
|
||||||
if (height > 240) height = 240;
|
if (height > BG_HEIGHT) height = BG_HEIGHT;
|
||||||
width = info_ptr->width;
|
width = info_ptr->width;
|
||||||
if (width > 320) width = 320;
|
if (width > BG_WIDTH) width = BG_WIDTH;
|
||||||
|
|
||||||
for (h = 0; h < height; h++)
|
for (h = 0; h < height; h++)
|
||||||
{
|
{
|
||||||
|
@ -75,7 +83,7 @@ void readpng(void *dest, const char *fname, readpng_what what)
|
||||||
*dst++ = ((src[0]&0xf8)<<8) | ((src[1]&0xf8)<<3) | (src[2] >> 3);
|
*dst++ = ((src[0]&0xf8)<<8) | ((src[1]&0xf8)<<3) | (src[2] >> 3);
|
||||||
src += 3;
|
src += 3;
|
||||||
}
|
}
|
||||||
dst += 320 - width;
|
dst += BG_WIDTH - width;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
127
psp/Makefile
Normal file
127
psp/Makefile
Normal file
|
@ -0,0 +1,127 @@
|
||||||
|
|
||||||
|
# pspdev is expected to be in path
|
||||||
|
PSPSDK = $(shell psp-config --pspsdk-path)
|
||||||
|
|
||||||
|
# settings
|
||||||
|
use_musashi = 1
|
||||||
|
use_mz80 = 1
|
||||||
|
amalgamate = 0
|
||||||
|
#profile = 1
|
||||||
|
#up = 1
|
||||||
|
|
||||||
|
|
||||||
|
CFLAGS += -I../.. -I. -D_UNZIP_SUPPORT -DNO_SYNC # -DBENCHMARK
|
||||||
|
CFLAGS += -Wall -Winline
|
||||||
|
ifeq ($(DEBUG),)
|
||||||
|
CFLAGS += -O2 -G0 -ftracer -fstrength-reduce -fomit-frame-pointer -fstrict-aliasing -ffast-math
|
||||||
|
else
|
||||||
|
CFLAGS += -ggdb
|
||||||
|
endif
|
||||||
|
ifeq "$(profile)" "1"
|
||||||
|
CFLAGS += -fprofile-generate
|
||||||
|
endif
|
||||||
|
ifeq "$(profile)" "2"
|
||||||
|
CFLAGS += -fprofile-use
|
||||||
|
endif
|
||||||
|
|
||||||
|
|
||||||
|
# frontend
|
||||||
|
OBJS += main.o emu.o mp3.o menu.o psp.o
|
||||||
|
|
||||||
|
# common
|
||||||
|
OBJS += ../common/emu.o ../common/menu.o ../common/fonts.o ../common/readpng.o
|
||||||
|
|
||||||
|
# Pico
|
||||||
|
ifeq "$(amalgamate)" "1"
|
||||||
|
OBJS += ../../PicoAll.o
|
||||||
|
else
|
||||||
|
OBJS += ../../Pico/Area.o ../../Pico/Cart.o ../../Pico/Memory.o ../../Pico/Misc.o \
|
||||||
|
../../Pico/Pico.o ../../Pico/Sek.o ../../Pico/VideoPort.o ../../Pico/Draw2.o ../../Pico/Draw.o \
|
||||||
|
../../Pico/Patch.o
|
||||||
|
# Pico - CD
|
||||||
|
OBJS += ../../Pico/cd/Pico.o ../../Pico/cd/Memory.o ../../Pico/cd/Sek.o ../../Pico/cd/LC89510.o \
|
||||||
|
../../Pico/cd/cd_sys.o ../../Pico/cd/cd_file.o ../../Pico/cd/gfx_cd.o \
|
||||||
|
../../Pico/cd/Area.o ../../Pico/cd/Misc.o ../../Pico/cd/pcm.o ../../Pico/cd/buffering.o
|
||||||
|
endif
|
||||||
|
|
||||||
|
# Pico - sound
|
||||||
|
ifneq "$(amalgamate)" "1"
|
||||||
|
OBJS += ../../Pico/sound/sound.o
|
||||||
|
endif
|
||||||
|
OBJS += ../../Pico/sound/mix.o
|
||||||
|
OBJS += ../../Pico/sound/sn76496.o ../../Pico/sound/ym2612.o
|
||||||
|
# zlib (hacked)
|
||||||
|
OBJS += ../../zlib/gzio.o ../../zlib/inffast.o ../../zlib/inflate.o ../../zlib/inftrees.o ../../zlib/trees.o \
|
||||||
|
../../zlib/deflate.o ../../zlib/crc32.o ../../zlib/adler32.o ../../zlib/zutil.o ../../zlib/compress.o
|
||||||
|
# unzip
|
||||||
|
OBJS += ../../unzip/unzip.o ../../unzip/unzip_stream.o
|
||||||
|
# CPU cores
|
||||||
|
ifeq "$(use_musashi)" "1"
|
||||||
|
CFLAGS += -DEMU_M68K
|
||||||
|
OBJS += ../../cpu/musashi/m68kops.o ../../cpu/musashi/m68kcpu.o
|
||||||
|
endif
|
||||||
|
# z80
|
||||||
|
ifeq "$(use_mz80)" "1"
|
||||||
|
CFLAGS += -D_USE_MZ80
|
||||||
|
OBJS += ../../cpu/mz80/mz80.o
|
||||||
|
else
|
||||||
|
$(error nothing here!)
|
||||||
|
endif
|
||||||
|
|
||||||
|
|
||||||
|
LIBS += -lpng -lm -lpspgu # -lpspaudio -lpspgu -lpsppower -lpsphprm -lz -lm -lstdc++
|
||||||
|
|
||||||
|
# target
|
||||||
|
TARGET = PicoDrive
|
||||||
|
EXTRA_TARGETS = EBOOT.PBP
|
||||||
|
PSP_EBOOT_TITLE = PICODRIVE
|
||||||
|
#PSP_EBOOT_ICON = .png
|
||||||
|
#PSP_EBOOT_PIC1 = .png
|
||||||
|
|
||||||
|
CUSTOM_CLEAN = myclean
|
||||||
|
|
||||||
|
include $(PSPSDK)/lib/build.mak
|
||||||
|
|
||||||
|
|
||||||
|
# some additional rules
|
||||||
|
.c.o:
|
||||||
|
@echo ">>>" $<
|
||||||
|
$(CC) $(CFLAGS) -c $< -o $@
|
||||||
|
|
||||||
|
../../cpu/musashi/m68kops.c :
|
||||||
|
make -C ../../cpu/musashi
|
||||||
|
|
||||||
|
readme.txt: ../../tools/textfilter ../base_readme.txt
|
||||||
|
../../tools/textfilter ../base_readme.txt $@ PSP
|
||||||
|
|
||||||
|
../../tools/textfilter: ../../tools/textfilter.c
|
||||||
|
make -C ../../tools/ textfilter
|
||||||
|
|
||||||
|
|
||||||
|
# ?
|
||||||
|
up: EBOOT.PBP
|
||||||
|
@cp -v $^ /media/disk/PSP/GAME/PicoDrive/
|
||||||
|
|
||||||
|
|
||||||
|
# cleanup
|
||||||
|
|
||||||
|
myclean:
|
||||||
|
make -C ../../cpu/musashi clean
|
||||||
|
|
||||||
|
|
||||||
|
clean_prof:
|
||||||
|
find ../.. -name '*.gcno' -delete
|
||||||
|
find ../.. -name '*.gcda' -delete
|
||||||
|
|
||||||
|
# ----------- release -----------
|
||||||
|
ifneq ($(findstring rel,$(MAKECMDGOALS)),)
|
||||||
|
ifeq ($(VER),)
|
||||||
|
$(error need VER)
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
|
# ?
|
||||||
|
rel: EBOOT.PBP readme.txt
|
||||||
|
zip -9 -j ../../PicoDrive_$(VER).zip $^
|
||||||
|
# zip -9 -r ../../PicoDrive_$(VER).zip skin -i \*.png -i \*.txt
|
||||||
|
|
76
psp/emu.c
Normal file
76
psp/emu.c
Normal file
|
@ -0,0 +1,76 @@
|
||||||
|
#include <sys/stat.h>
|
||||||
|
#include <sys/types.h>
|
||||||
|
#include <sys/syslimits.h> // PATH_MAX
|
||||||
|
|
||||||
|
#include "../../Pico/PicoInt.h"
|
||||||
|
|
||||||
|
char romFileName[PATH_MAX];
|
||||||
|
unsigned char *PicoDraw2FB; // temporary buffer for alt renderer ( (8+320)*(8+240+8) )
|
||||||
|
int engineState;
|
||||||
|
|
||||||
|
|
||||||
|
void emu_noticeMsgUpdated(void)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void emu_getMainDir(char *dst, int len)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void emu_stateCb(const char *str)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void emu_setDefaultConfig(void)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void emu_forcedFrame(void)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void emu_Init(void)
|
||||||
|
{
|
||||||
|
// make dirs for saves, cfgs, etc.
|
||||||
|
mkdir("mds", 0777);
|
||||||
|
mkdir("srm", 0777);
|
||||||
|
mkdir("brm", 0777);
|
||||||
|
mkdir("cfg", 0777);
|
||||||
|
|
||||||
|
PicoInit();
|
||||||
|
// PicoMessage = emu_msg_cb;
|
||||||
|
// PicoMCDopenTray = emu_msg_tray_open;
|
||||||
|
// PicoMCDcloseTray = menu_loop_tray;
|
||||||
|
}
|
||||||
|
|
||||||
|
void emu_Deinit(void)
|
||||||
|
{
|
||||||
|
// save SRAM
|
||||||
|
/* if ((currentConfig.EmuOpt & 1) && SRam.changed) {
|
||||||
|
emu_SaveLoadGame(0, 1);
|
||||||
|
SRam.changed = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!(currentConfig.EmuOpt & 0x20)) {
|
||||||
|
FILE *f = fopen(PicoConfigFile, "r+b");
|
||||||
|
if (!f) emu_WriteConfig(0);
|
||||||
|
else {
|
||||||
|
// if we already have config, reload it, except last ROM
|
||||||
|
fseek(f, sizeof(currentConfig.lastRomFile), SEEK_SET);
|
||||||
|
fread(¤tConfig.EmuOpt, 1, sizeof(currentConfig) - sizeof(currentConfig.lastRomFile), f);
|
||||||
|
fseek(f, 0, SEEK_SET);
|
||||||
|
fwrite(¤tConfig, 1, sizeof(currentConfig), f);
|
||||||
|
fflush(f);
|
||||||
|
fclose(f);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
PicoExit();
|
||||||
|
}
|
||||||
|
|
||||||
|
void emu_ResetGame(void)
|
||||||
|
{
|
||||||
|
PicoReset(0);
|
||||||
|
//reset_timing = 1;
|
||||||
|
}
|
||||||
|
|
31
psp/emu.h
Normal file
31
psp/emu.h
Normal file
|
@ -0,0 +1,31 @@
|
||||||
|
// (c) Copyright 2006-2007 notaz, All rights reserved.
|
||||||
|
// Free for non-commercial use.
|
||||||
|
|
||||||
|
// For commercial use, separate licencing terms must be obtained.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// engine states
|
||||||
|
enum TPicoGameState {
|
||||||
|
PGS_Paused = 1,
|
||||||
|
PGS_Running,
|
||||||
|
PGS_Quit,
|
||||||
|
PGS_KeyConfig,
|
||||||
|
PGS_ReloadRom,
|
||||||
|
PGS_Menu,
|
||||||
|
PGS_RestartRun,
|
||||||
|
};
|
||||||
|
|
||||||
|
extern char romFileName[];
|
||||||
|
extern int engineState;
|
||||||
|
|
||||||
|
|
||||||
|
void emu_Init(void);
|
||||||
|
void emu_Deinit(void);
|
||||||
|
void emu_Loop(void);
|
||||||
|
void emu_ResetGame(void);
|
||||||
|
void emu_forcedFrame(void);
|
||||||
|
|
||||||
|
void emu_stateCb(const char *str);
|
||||||
|
|
||||||
|
|
59
psp/main.c
Normal file
59
psp/main.c
Normal file
|
@ -0,0 +1,59 @@
|
||||||
|
#include "psp.h"
|
||||||
|
#include "emu.h"
|
||||||
|
#include "menu.h"
|
||||||
|
#include "../common/menu.h"
|
||||||
|
#include "../common/lprintf.h"
|
||||||
|
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
psp_init();
|
||||||
|
|
||||||
|
// emu_ReadConfig(0, 0);
|
||||||
|
emu_Init();
|
||||||
|
menu_init();
|
||||||
|
|
||||||
|
engineState = PGS_Menu;
|
||||||
|
|
||||||
|
for (;;)
|
||||||
|
{
|
||||||
|
switch (engineState)
|
||||||
|
{
|
||||||
|
case PGS_Menu:
|
||||||
|
menu_loop();
|
||||||
|
break;
|
||||||
|
|
||||||
|
case PGS_ReloadRom:
|
||||||
|
/*
|
||||||
|
if (emu_ReloadRom())
|
||||||
|
engineState = PGS_Running;
|
||||||
|
else {
|
||||||
|
lprintf("PGS_ReloadRom == 0\n");
|
||||||
|
engineState = PGS_Menu;
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
break;
|
||||||
|
|
||||||
|
case PGS_RestartRun:
|
||||||
|
engineState = PGS_Running;
|
||||||
|
|
||||||
|
case PGS_Running:
|
||||||
|
// emu_Loop();
|
||||||
|
break;
|
||||||
|
|
||||||
|
case PGS_Quit:
|
||||||
|
goto endloop;
|
||||||
|
|
||||||
|
default:
|
||||||
|
lprintf("engine got into unknown state (%i), exitting\n", engineState);
|
||||||
|
goto endloop;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
endloop:
|
||||||
|
|
||||||
|
emu_Deinit();
|
||||||
|
psp_finish();
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
1632
psp/menu.c
Normal file
1632
psp/menu.c
Normal file
File diff suppressed because it is too large
Load diff
13
psp/menu.h
Normal file
13
psp/menu.h
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
// (c) Copyright 2006,2007 notaz, All rights reserved.
|
||||||
|
// Free for non-commercial use.
|
||||||
|
|
||||||
|
// For commercial use, separate licencing terms must be obtained.
|
||||||
|
|
||||||
|
void menu_loop(void);
|
||||||
|
int menu_loop_tray(void);
|
||||||
|
void menu_romload_prepare(const char *rom_name);
|
||||||
|
void menu_romload_end(void);
|
||||||
|
|
||||||
|
|
||||||
|
#define CONFIGURABLE_KEYS (BTN_UP|BTN_LEFT|BTN_RIGHT|BTN_DOWN|BTN_L|BTN_R|BTN_TRIANGLE|BTN_CIRCLE|BTN_X|BTN_SQUARE|BTN_START|BTN_NOTE)
|
||||||
|
|
20
psp/mp3.c
Normal file
20
psp/mp3.c
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
int mp3_get_bitrate(FILE *f, int size)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void mp3_start_play(FILE *f, int pos)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
int mp3_get_offset(void) // 0-1023
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void mp3_update(int *buffer, int length, int stereo)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
24
psp/port_config.h
Normal file
24
psp/port_config.h
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
// port specific settings
|
||||||
|
|
||||||
|
#ifndef PORT_CONFIG_H
|
||||||
|
#define PORT_CONFIG_H
|
||||||
|
|
||||||
|
#define CPU_CALL
|
||||||
|
|
||||||
|
// draw.c
|
||||||
|
#define OVERRIDE_HIGHCOL 0
|
||||||
|
|
||||||
|
// draw2.c
|
||||||
|
#define START_ROW 0 // which row of tiles to start rendering at?
|
||||||
|
#define END_ROW 28 // ..end
|
||||||
|
|
||||||
|
// pico.c
|
||||||
|
#define CAN_HANDLE_240_LINES 1
|
||||||
|
|
||||||
|
// logging emu events
|
||||||
|
#define EL_LOGMASK 0 // (EL_STATUS|EL_ANOMALY|EL_UIO|EL_SRAMIO) // xffff
|
||||||
|
|
||||||
|
//#define dprintf(f,...) printf("%05i:%03i: " f "\n",Pico.m.frame_count,Pico.m.scanline,##__VA_ARGS__)
|
||||||
|
#define dprintf(x...)
|
||||||
|
|
||||||
|
#endif //PORT_CONFIG_H
|
96
psp/psp.c
Normal file
96
psp/psp.c
Normal file
|
@ -0,0 +1,96 @@
|
||||||
|
#include <pspkernel.h>
|
||||||
|
#include <pspdisplay.h>
|
||||||
|
#include <pspgu.h>
|
||||||
|
|
||||||
|
#include "psp.h"
|
||||||
|
#include "../common/lprintf.h"
|
||||||
|
|
||||||
|
PSP_MODULE_INFO("PicoDrive", 0, 1, 34);
|
||||||
|
|
||||||
|
void *psp_screen = PSP_VRAM_BASE0;
|
||||||
|
static int current_screen = 0; /* front bufer */
|
||||||
|
|
||||||
|
|
||||||
|
/* Exit callback */
|
||||||
|
static int exit_callback(int arg1, int arg2, void *common)
|
||||||
|
{
|
||||||
|
sceKernelExitGame();
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Callback thread */
|
||||||
|
static int callback_thread(SceSize args, void *argp)
|
||||||
|
{
|
||||||
|
int cbid;
|
||||||
|
|
||||||
|
lprintf("callback_thread started with id %i\n", sceKernelGetThreadId());
|
||||||
|
|
||||||
|
cbid = sceKernelCreateCallback("Exit Callback", exit_callback, NULL);
|
||||||
|
sceKernelRegisterExitCallback(cbid);
|
||||||
|
|
||||||
|
sceKernelSleepThreadCB();
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void psp_init(void)
|
||||||
|
{
|
||||||
|
int thid;
|
||||||
|
|
||||||
|
lprintf("entered psp_init, threadId %i\n", sceKernelGetThreadId());
|
||||||
|
|
||||||
|
thid = sceKernelCreateThread("update_thread", callback_thread, 0x11, 0xFA0, 0, 0);
|
||||||
|
if (thid >= 0)
|
||||||
|
{
|
||||||
|
sceKernelStartThread(thid, 0, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* video */
|
||||||
|
sceDisplaySetMode(0, 480, 272);
|
||||||
|
sceDisplaySetFrameBuf(PSP_VRAM_BASE1, 512, PSP_DISPLAY_PIXEL_FORMAT_565, PSP_DISPLAY_SETBUF_NEXTFRAME);
|
||||||
|
current_screen = 1;
|
||||||
|
psp_screen = PSP_VRAM_BASE0;
|
||||||
|
|
||||||
|
/* gu */
|
||||||
|
sceGuInit();
|
||||||
|
|
||||||
|
/* input */
|
||||||
|
sceCtrlSetSamplingCycle(0);
|
||||||
|
sceCtrlSetSamplingMode(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
void psp_finish(void)
|
||||||
|
{
|
||||||
|
sceGuTerm();
|
||||||
|
|
||||||
|
//sceKernelSleepThread();
|
||||||
|
sceKernelExitGame();
|
||||||
|
}
|
||||||
|
|
||||||
|
void psp_video_flip(void)
|
||||||
|
{
|
||||||
|
sceDisplaySetFrameBuf(psp_screen, 512, PSP_DISPLAY_PIXEL_FORMAT_565, PSP_DISPLAY_SETBUF_NEXTFRAME);
|
||||||
|
current_screen ^= 1;
|
||||||
|
psp_screen = current_screen ? PSP_VRAM_BASE1 : PSP_VRAM_BASE0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void psp_video_switch_to_single(void)
|
||||||
|
{
|
||||||
|
psp_screen = PSP_VRAM_BASE0;
|
||||||
|
sceDisplaySetFrameBuf(psp_screen, 512, PSP_DISPLAY_PIXEL_FORMAT_565, PSP_DISPLAY_SETBUF_NEXTFRAME);
|
||||||
|
current_screen = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void psp_msleep(int ms)
|
||||||
|
{
|
||||||
|
sceKernelDelayThread(ms * 1000);
|
||||||
|
}
|
||||||
|
|
||||||
|
unsigned int psp_pad_read(void)
|
||||||
|
{
|
||||||
|
SceCtrlData pad;
|
||||||
|
sceCtrlReadBufferPositive(&pad, 1);
|
||||||
|
|
||||||
|
return pad.Buttons;
|
||||||
|
}
|
||||||
|
|
32
psp/psp.h
Normal file
32
psp/psp.h
Normal file
|
@ -0,0 +1,32 @@
|
||||||
|
#include <pspctrl.h>
|
||||||
|
|
||||||
|
void psp_init(void);
|
||||||
|
void psp_finish(void);
|
||||||
|
|
||||||
|
void psp_msleep(int ms);
|
||||||
|
|
||||||
|
#define PSP_VRAM_BASE0 ((void *) 0x44000000)
|
||||||
|
#define PSP_VRAM_BASE1 ((void *) 0x44044000)
|
||||||
|
|
||||||
|
void psp_video_switch_to_single(void);
|
||||||
|
void psp_video_flip(void);
|
||||||
|
extern void *psp_screen;
|
||||||
|
|
||||||
|
unsigned int psp_pad_read(void);
|
||||||
|
|
||||||
|
|
||||||
|
/* shorter btn names */
|
||||||
|
#define BTN_UP PSP_CTRL_UP
|
||||||
|
#define BTN_LEFT PSP_CTRL_LEFT
|
||||||
|
#define BTN_RIGHT PSP_CTRL_RIGHT
|
||||||
|
#define BTN_DOWN PSP_CTRL_DOWN
|
||||||
|
#define BTN_L PSP_CTRL_LTRIGGER
|
||||||
|
#define BTN_R PSP_CTRL_RTRIGGER
|
||||||
|
#define BTN_TRIANGLE PSP_CTRL_TRIANGLE
|
||||||
|
#define BTN_CIRCLE PSP_CTRL_CIRCLE
|
||||||
|
#define BTN_X PSP_CTRL_CROSS
|
||||||
|
#define BTN_SQUARE PSP_CTRL_SQUARE
|
||||||
|
#define BTN_SELECT PSP_CTRL_SELECT
|
||||||
|
#define BTN_START PSP_CTRL_START
|
||||||
|
#define BTN_NOTE PSP_CTRL_NOTE
|
||||||
|
|
2
psp/version.h
Normal file
2
psp/version.h
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
#define VERSION "1.34"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue