mirror of
https://github.com/RaySollium99/libpicofe.git
synced 2025-09-05 06:47:45 -04:00
debug menu unified, more debug tools
git-svn-id: file:///home/notaz/opt/svn/PicoDrive/platform@545 be3aeb3a-fb24-0410-a615-afba39da0efa
This commit is contained in:
parent
4b811a8abe
commit
b846453101
9 changed files with 212 additions and 168 deletions
75
common/common.h
Normal file
75
common/common.h
Normal file
|
@ -0,0 +1,75 @@
|
||||||
|
// platform specific things for common menu code
|
||||||
|
|
||||||
|
#ifdef __GP2X__
|
||||||
|
#include "../gp2x/gp2x.h"
|
||||||
|
|
||||||
|
#define BTN_UP GP2X_UP
|
||||||
|
#define BTN_DOWN GP2X_DOWN
|
||||||
|
#define BTN_LEFT GP2X_LEFT
|
||||||
|
#define BTN_RIGHT GP2X_RIGHT
|
||||||
|
|
||||||
|
#define BTN_NORTH GP2X_Y
|
||||||
|
#define BTN_SOUTH GP2X_X
|
||||||
|
#define BTN_WEST GP2X_A
|
||||||
|
#define BTN_EAST GP2X_B
|
||||||
|
#define BTN_L GP2X_L
|
||||||
|
#define BTN_R GP2X_R
|
||||||
|
|
||||||
|
unsigned long wait_for_input(unsigned long interesting);
|
||||||
|
void gp2x_pd_clone_buffer2(void);
|
||||||
|
void menu_darken_bg(void *dst, int pixels, int darker);
|
||||||
|
void menu_flip(void);
|
||||||
|
|
||||||
|
#define SCREEN_WIDTH 320
|
||||||
|
#define SCREEN_HEIGHT 240
|
||||||
|
#define SCREEN_BUFFER gp2x_screen
|
||||||
|
|
||||||
|
#define read_buttons(which) \
|
||||||
|
wait_for_input(which)
|
||||||
|
#define menu_draw_begin() \
|
||||||
|
gp2x_pd_clone_buffer2()
|
||||||
|
#define clear_screen() \
|
||||||
|
memset(gp2x_screen, 0, 320*240*2)
|
||||||
|
#define darken_screen() \
|
||||||
|
menu_darken_bg(gp2x_screen, 320*240, 0)
|
||||||
|
#define menu_draw_end() \
|
||||||
|
menu_flip()
|
||||||
|
|
||||||
|
// ------------------------------------
|
||||||
|
|
||||||
|
#elif defined(__GIZ__)
|
||||||
|
|
||||||
|
// TODO
|
||||||
|
//#include "../gizmondo/giz.h"
|
||||||
|
#define SCREEN_WIDTH 321
|
||||||
|
#define SCREEN_BUFFER menu_screen
|
||||||
|
extern unsigned char *menu_screen;
|
||||||
|
|
||||||
|
// ------------------------------------
|
||||||
|
|
||||||
|
#elif defined(PSP)
|
||||||
|
|
||||||
|
#include "../psp/psp.h"
|
||||||
|
|
||||||
|
#define BTN_NORTH BTN_TRIANGLE
|
||||||
|
#define BTN_SOUTH BTN_X
|
||||||
|
#define BTN_WEST BTN_SQUARE
|
||||||
|
#define BTN_EAST BTN_CIRCLE
|
||||||
|
|
||||||
|
unsigned long wait_for_input(unsigned int interesting, int is_key_config);
|
||||||
|
void menu_draw_begin(void);
|
||||||
|
void menu_darken_bg(void *dst, const void *src, int pixels, int darker);
|
||||||
|
void menu_draw_end(void);
|
||||||
|
|
||||||
|
#define SCREEN_WIDTH 512
|
||||||
|
#define SCREEN_HEIGHT 272
|
||||||
|
#define SCREEN_BUFFER psp_screen
|
||||||
|
|
||||||
|
#define read_buttons(which) \
|
||||||
|
wait_for_input(which, 0)
|
||||||
|
#define clear_screen() \
|
||||||
|
memset(SCREEN_BUFFER, 0, SCREEN_WIDTH*SCREEN_HEIGHT*2)
|
||||||
|
#define darken_screen() \
|
||||||
|
menu_darken_bg(psp_screen, psp_screen, SCREEN_WIDTH*SCREEN_HEIGHT, 0)
|
||||||
|
|
||||||
|
#endif
|
124
common/menu.c
124
common/menu.c
|
@ -12,21 +12,9 @@
|
||||||
#include "fonts.h"
|
#include "fonts.h"
|
||||||
#include "readpng.h"
|
#include "readpng.h"
|
||||||
#include "lprintf.h"
|
#include "lprintf.h"
|
||||||
|
#include "common.h"
|
||||||
|
#include "emu.h"
|
||||||
|
|
||||||
#if defined(__GP2X__)
|
|
||||||
#include "../gp2x/gp2x.h"
|
|
||||||
#define SCREEN_WIDTH 320
|
|
||||||
#define SCREEN_BUFFER gp2x_screen
|
|
||||||
#elif defined(__GIZ__)
|
|
||||||
//#include "../gizmondo/giz.h"
|
|
||||||
#define SCREEN_WIDTH 321
|
|
||||||
#define SCREEN_BUFFER menu_screen
|
|
||||||
extern unsigned char *menu_screen;
|
|
||||||
#elif defined(PSP)
|
|
||||||
#include "../psp/psp.h"
|
|
||||||
#define SCREEN_WIDTH 512
|
|
||||||
#define SCREEN_BUFFER psp_screen
|
|
||||||
#endif
|
|
||||||
|
|
||||||
char menuErrorMsg[64] = { 0, };
|
char menuErrorMsg[64] = { 0, };
|
||||||
|
|
||||||
|
@ -362,3 +350,111 @@ const char *me_region_name(unsigned int code, int auto_order)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ------------ debug menu ------------
|
||||||
|
|
||||||
|
#include <sys/stat.h>
|
||||||
|
#include <sys/types.h>
|
||||||
|
|
||||||
|
#include <Pico/Pico.h>
|
||||||
|
#include <Pico/Debug.h>
|
||||||
|
|
||||||
|
void SekStepM68k(void);
|
||||||
|
|
||||||
|
static void draw_text_debug(const char *str, int skip, int from)
|
||||||
|
{
|
||||||
|
const char *p;
|
||||||
|
int len, line;
|
||||||
|
|
||||||
|
p = str;
|
||||||
|
while (skip-- > 0)
|
||||||
|
{
|
||||||
|
while (*p && *p != '\n') p++;
|
||||||
|
if (*p == 0 || p[1] == 0) return;
|
||||||
|
p++;
|
||||||
|
}
|
||||||
|
|
||||||
|
str = p;
|
||||||
|
for (line = from; line < SCREEN_HEIGHT/10; line++)
|
||||||
|
{
|
||||||
|
while (*p && *p != '\n') p++;
|
||||||
|
len = p - str;
|
||||||
|
if (len > 55) len = 55;
|
||||||
|
smalltext_out16_lim(1, line*10, str, 0xffff, len);
|
||||||
|
if (*p == 0) break;
|
||||||
|
p++; str = p;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void draw_frame_debug(void)
|
||||||
|
{
|
||||||
|
char layer_str[48] = "layers: ";
|
||||||
|
if (PicoDrawMask & PDRAW_LAYERB_ON) memcpy(layer_str + 8, "B", 1);
|
||||||
|
if (PicoDrawMask & PDRAW_LAYERA_ON) memcpy(layer_str + 10, "A", 1);
|
||||||
|
if (PicoDrawMask & PDRAW_SPRITES_LOW_ON) memcpy(layer_str + 12, "spr_lo", 6);
|
||||||
|
if (PicoDrawMask & PDRAW_SPRITES_HI_ON) memcpy(layer_str + 19, "spr_hi", 6);
|
||||||
|
|
||||||
|
clear_screen();
|
||||||
|
emu_forcedFrame(0);
|
||||||
|
smalltext_out16(4, SCREEN_HEIGHT-8, layer_str, 0xffff);
|
||||||
|
}
|
||||||
|
|
||||||
|
void debug_menu_loop(void)
|
||||||
|
{
|
||||||
|
int inp, mode = 0;
|
||||||
|
int spr_offs = 0, dumped = 0;
|
||||||
|
|
||||||
|
while (1)
|
||||||
|
{
|
||||||
|
switch (mode)
|
||||||
|
{
|
||||||
|
case 0: menu_draw_begin();
|
||||||
|
draw_text_debug(PDebugMain(), 0, 0);
|
||||||
|
if (dumped) {
|
||||||
|
smalltext_out16(SCREEN_WIDTH-6*10, SCREEN_HEIGHT-8, "dumped", 0xffff);
|
||||||
|
dumped = 0;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 1: draw_frame_debug(); break;
|
||||||
|
case 2: clear_screen();
|
||||||
|
emu_forcedFrame(0);
|
||||||
|
darken_screen();
|
||||||
|
PDebugShowSpriteStats(SCREEN_BUFFER, SCREEN_WIDTH); break;
|
||||||
|
case 3: clear_screen();
|
||||||
|
PDebugShowPalette(SCREEN_BUFFER, SCREEN_WIDTH);
|
||||||
|
PDebugShowSprite((unsigned short *)SCREEN_BUFFER + SCREEN_WIDTH*120+SCREEN_WIDTH/2+16,
|
||||||
|
SCREEN_WIDTH, spr_offs);
|
||||||
|
draw_text_debug(PDebugSpriteList(), spr_offs, 6);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
menu_draw_end();
|
||||||
|
|
||||||
|
inp = read_buttons(BTN_EAST|BTN_SOUTH|BTN_WEST|BTN_L|BTN_R|BTN_UP|BTN_DOWN|BTN_LEFT|BTN_RIGHT);
|
||||||
|
if (inp & BTN_SOUTH) return;
|
||||||
|
if (inp & BTN_L) { mode--; if (mode < 0) mode = 3; }
|
||||||
|
if (inp & BTN_R) { mode++; if (mode > 3) mode = 0; }
|
||||||
|
switch (mode)
|
||||||
|
{
|
||||||
|
case 0:
|
||||||
|
if (inp & BTN_EAST) SekStepM68k();
|
||||||
|
if ((inp & (BTN_WEST|BTN_LEFT)) == (BTN_WEST|BTN_LEFT)) {
|
||||||
|
mkdir("dumps", 0777);
|
||||||
|
PDebugDumpMem();
|
||||||
|
dumped = 1;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
if (inp & BTN_LEFT) PicoDrawMask ^= PDRAW_LAYERB_ON;
|
||||||
|
if (inp & BTN_RIGHT) PicoDrawMask ^= PDRAW_LAYERA_ON;
|
||||||
|
if (inp & BTN_DOWN) PicoDrawMask ^= PDRAW_SPRITES_LOW_ON;
|
||||||
|
if (inp & BTN_UP) PicoDrawMask ^= PDRAW_SPRITES_HI_ON;
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
if (inp & BTN_DOWN) spr_offs++;
|
||||||
|
if (inp & BTN_UP) spr_offs--;
|
||||||
|
if (spr_offs < 0) spr_offs = 0;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -6,6 +6,7 @@ void text_out16(int x, int y, const char *texto, ...);
|
||||||
void smalltext_out16(int x, int y, const char *texto, int color);
|
void smalltext_out16(int x, int y, const char *texto, int color);
|
||||||
void smalltext_out16_lim(int x, int y, const char *texto, int color, int max);
|
void smalltext_out16_lim(int x, int y, const char *texto, int color, int max);
|
||||||
void menu_draw_selection(int x, int y, int w);
|
void menu_draw_selection(int x, int y, int w);
|
||||||
|
void debug_menu_loop(void);
|
||||||
|
|
||||||
extern char menuErrorMsg[64];
|
extern char menuErrorMsg[64];
|
||||||
|
|
||||||
|
|
|
@ -66,7 +66,7 @@ ifeq "$(amalgamate)" "1"
|
||||||
OBJS += ../../PicoAll.o
|
OBJS += ../../PicoAll.o
|
||||||
else
|
else
|
||||||
OBJS += Pico/Area.o Pico/Cart.o Pico/Memory.o Pico/Misc.o Pico/Pico.o Pico/Sek.o \
|
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/VideoPort.o Pico/Draw2.o Pico/Draw.o Pico/Patch.o Pico/Debug.o
|
||||||
# Pico - CD
|
# Pico - CD
|
||||||
OBJS += Pico/cd/Pico.o Pico/cd/Memory.o Pico/cd/Sek.o Pico/cd/LC89510.o \
|
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/cue.o Pico/cd/gfx_cd.o \
|
Pico/cd/cd_sys.o Pico/cd/cd_file.o Pico/cd/cue.o Pico/cd/gfx_cd.o \
|
||||||
|
@ -118,7 +118,7 @@ OBJS += zlib/gzio.o zlib/inffast.o zlib/inflate.o zlib/inftrees.o zlib/trees.o \
|
||||||
OBJS += unzip/unzip.o unzip/unzip_stream.o
|
OBJS += unzip/unzip.o unzip/unzip_stream.o
|
||||||
# debug
|
# debug
|
||||||
ifeq "$(debug_cyclone)" "1"
|
ifeq "$(debug_cyclone)" "1"
|
||||||
OBJS += Pico/Debug.o cpu/musashi/m68kdasm.o
|
OBJS += Pico/DebugCPU.o cpu/musashi/m68kdasm.o
|
||||||
endif
|
endif
|
||||||
# CPU cores
|
# CPU cores
|
||||||
ifeq "$(use_musashi)" "1"
|
ifeq "$(use_musashi)" "1"
|
||||||
|
|
76
gp2x/menu.c
76
gp2x/menu.c
|
@ -37,13 +37,13 @@ const char * const keyNames[] = {
|
||||||
"???", "???", "???", "PUSH", "???", "???", "???", "???"
|
"???", "???", "???", "PUSH", "???", "???", "???", "???"
|
||||||
};
|
};
|
||||||
|
|
||||||
static void menu_darken_bg(void *dst, int pixels, int darker);
|
void menu_darken_bg(void *dst, int pixels, int darker);
|
||||||
static void menu_prepare_bg(int use_game_bg);
|
static void menu_prepare_bg(int use_game_bg);
|
||||||
|
|
||||||
static unsigned long inp_prev = 0;
|
static unsigned long inp_prev = 0;
|
||||||
static int inp_prevjoy = 0;
|
static int inp_prevjoy = 0;
|
||||||
|
|
||||||
static unsigned long wait_for_input(unsigned long interesting)
|
unsigned long wait_for_input(unsigned long interesting)
|
||||||
{
|
{
|
||||||
unsigned long ret;
|
unsigned long ret;
|
||||||
static int repeats = 0, wait = 20;
|
static int repeats = 0, wait = 20;
|
||||||
|
@ -132,7 +132,7 @@ static unsigned long wait_for_input_usbjoy(unsigned long interesting, int *joy)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void menu_flip(void)
|
void menu_flip(void)
|
||||||
{
|
{
|
||||||
gp2x_video_flush_cache();
|
gp2x_video_flush_cache();
|
||||||
gp2x_video_flip2();
|
gp2x_video_flip2();
|
||||||
|
@ -429,74 +429,6 @@ rescan:
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ------------ debug menu ------------
|
|
||||||
|
|
||||||
char *debugString(void);
|
|
||||||
void PicoDrawShowSpriteStats(unsigned short *screen, int stride);
|
|
||||||
void PicoDrawShowPalette(unsigned short *screen, int stride);
|
|
||||||
|
|
||||||
static void draw_main_debug(void)
|
|
||||||
{
|
|
||||||
char *p, *str = debugString();
|
|
||||||
int len, line;
|
|
||||||
|
|
||||||
gp2x_pd_clone_buffer2();
|
|
||||||
|
|
||||||
p = str;
|
|
||||||
for (line = 0; line < 24; line++)
|
|
||||||
{
|
|
||||||
while (*p && *p != '\n') p++;
|
|
||||||
len = p - str;
|
|
||||||
if (len > 55) len = 55;
|
|
||||||
smalltext_out16_lim(1, line*10, str, 0xffff, len);
|
|
||||||
if (*p == 0) break;
|
|
||||||
p++; str = p;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void draw_frame_debug(void)
|
|
||||||
{
|
|
||||||
char layer_str[48] = "layers: ";
|
|
||||||
if (PicoDrawMask & PDRAW_LAYERB_ON) memcpy(layer_str + 8, "B", 1);
|
|
||||||
if (PicoDrawMask & PDRAW_LAYERA_ON) memcpy(layer_str + 10, "A", 1);
|
|
||||||
if (PicoDrawMask & PDRAW_SPRITES_LOW_ON) memcpy(layer_str + 12, "spr_lo", 6);
|
|
||||||
if (PicoDrawMask & PDRAW_SPRITES_HI_ON) memcpy(layer_str + 19, "spr_hi", 6);
|
|
||||||
|
|
||||||
memset(gp2x_screen, 0, 320*240*2);
|
|
||||||
emu_forcedFrame(0);
|
|
||||||
smalltext_out16(4, 232, layer_str, 0xffff);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void debug_menu_loop(void)
|
|
||||||
{
|
|
||||||
int inp, mode = 0;
|
|
||||||
|
|
||||||
while (1)
|
|
||||||
{
|
|
||||||
switch (mode)
|
|
||||||
{
|
|
||||||
case 0: draw_main_debug(); break;
|
|
||||||
case 1: draw_frame_debug(); break;
|
|
||||||
case 2: gp2x_pd_clone_buffer2();
|
|
||||||
PicoDrawShowSpriteStats(gp2x_screen, 320); break;
|
|
||||||
case 3: memset(gp2x_screen, 0, 320*240*2);
|
|
||||||
PicoDrawShowPalette(gp2x_screen, 320); break;
|
|
||||||
}
|
|
||||||
menu_flip();
|
|
||||||
|
|
||||||
inp = wait_for_input(GP2X_B|GP2X_X|GP2X_L|GP2X_R|GP2X_UP|GP2X_DOWN|GP2X_LEFT|GP2X_RIGHT);
|
|
||||||
if (inp & (GP2X_B|GP2X_X)) return;
|
|
||||||
if (inp & GP2X_L) { mode--; if (mode < 0) mode = 3; }
|
|
||||||
if (inp & GP2X_R) { mode++; if (mode > 3) mode = 0; }
|
|
||||||
if (mode == 1) {
|
|
||||||
if (inp & GP2X_LEFT) PicoDrawMask ^= PDRAW_LAYERB_ON;
|
|
||||||
if (inp & GP2X_RIGHT) PicoDrawMask ^= PDRAW_LAYERA_ON;
|
|
||||||
if (inp & GP2X_DOWN) PicoDrawMask ^= PDRAW_SPRITES_LOW_ON;
|
|
||||||
if (inp & GP2X_UP) PicoDrawMask ^= PDRAW_SPRITES_HI_ON;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// ------------ patch/gg menu ------------
|
// ------------ patch/gg menu ------------
|
||||||
|
|
||||||
static void draw_patchlist(int sel)
|
static void draw_patchlist(int sel)
|
||||||
|
@ -1653,7 +1585,7 @@ static void menu_loop_root(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void menu_darken_bg(void *dst, int pixels, int darker)
|
void menu_darken_bg(void *dst, int pixels, int darker)
|
||||||
{
|
{
|
||||||
unsigned int *screen = dst;
|
unsigned int *screen = dst;
|
||||||
pixels /= 2;
|
pixels /= 2;
|
||||||
|
|
|
@ -36,7 +36,7 @@ OBJS += platform/common/emu.o platform/common/menu.o platform/common/config.o pl
|
||||||
|
|
||||||
# Pico
|
# Pico
|
||||||
OBJS += Pico/Area.o Pico/Cart.o Pico/Memory.o Pico/Misc.o Pico/Pico.o Pico/Sek.o \
|
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/VideoPort.o Pico/Draw2.o Pico/Draw.o Pico/Patch.o Pico/Debug.o
|
||||||
# Pico - CD
|
# Pico - CD
|
||||||
OBJS += Pico/cd/Pico.o Pico/cd/Memory.o Pico/cd/Sek.o Pico/cd/LC89510.o \
|
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/cue.o Pico/cd/gfx_cd.o \
|
Pico/cd/cd_sys.o Pico/cd/cd_file.o Pico/cd/cue.o Pico/cd/gfx_cd.o \
|
||||||
|
@ -73,7 +73,7 @@ endif
|
||||||
# misc
|
# misc
|
||||||
ifeq "$(use_fame)" "1"
|
ifeq "$(use_fame)" "1"
|
||||||
ifeq "$(use_musashi)" "1"
|
ifeq "$(use_musashi)" "1"
|
||||||
OBJS += Pico/Debug.o
|
OBJS += Pico/DebugCPU.o
|
||||||
OBJS += cpu/musashi/m68kdasm.o
|
OBJS += cpu/musashi/m68kdasm.o
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
|
@ -5,6 +5,14 @@
|
||||||
|
|
||||||
#define NO_SYNC
|
#define NO_SYNC
|
||||||
|
|
||||||
|
#define CASE_SENSITIVE_FS 1 // CS filesystem
|
||||||
|
#define DONT_OPEN_MANY_FILES 0
|
||||||
|
#define REDUCE_IO_CALLS 0
|
||||||
|
#define SIMPLE_WRITE_SOUND 0
|
||||||
|
|
||||||
|
// draw.c
|
||||||
|
#define OVERRIDE_HIGHCOL 0
|
||||||
|
|
||||||
// draw2.c
|
// draw2.c
|
||||||
#define START_ROW 0 // which row of tiles to start rendering at?
|
#define START_ROW 0 // which row of tiles to start rendering at?
|
||||||
#define END_ROW 28 // ..end
|
#define END_ROW 28 // ..end
|
||||||
|
|
|
@ -7,6 +7,7 @@ PSPSDK = $(shell psp-config --pspsdk-path)
|
||||||
#use_mz80 = 1
|
#use_mz80 = 1
|
||||||
amalgamate = 0
|
amalgamate = 0
|
||||||
for_15fw = 1
|
for_15fw = 1
|
||||||
|
# :!touch platform/psp/psp.c
|
||||||
|
|
||||||
|
|
||||||
CFLAGS += -I../.. -I. -DNO_SYNC
|
CFLAGS += -I../.. -I. -DNO_SYNC
|
||||||
|
@ -33,9 +34,9 @@ OBJS += platform/common/emu.o platform/common/menu.o platform/common/fonts.o pla
|
||||||
ifeq "$(amalgamate)" "1"
|
ifeq "$(amalgamate)" "1"
|
||||||
OBJS += ../../PicoAll.o
|
OBJS += ../../PicoAll.o
|
||||||
else
|
else
|
||||||
OBJS += Pico/Area.o Pico/Cart.o Pico/Memory.o Pico/Misc.o \
|
OBJS += Pico/Area.o Pico/Cart.o Pico/Memory.o Pico/Misc.o Pico/Pico.o Pico/Sek.o Pico/VideoPort.o \
|
||||||
Pico/Pico.o Pico/Sek.o Pico/VideoPort.o Pico/Draw2.o Pico/Draw.o \
|
Pico/Draw2.o Pico/Draw.o Pico/Patch.o Pico/Draw_amips.o Pico/Memory_amips.o \
|
||||||
Pico/Patch.o Pico/Draw_amips.o Pico/Memory_amips.o Pico/Misc_amips.o
|
Pico/Misc_amips.o Pico/Debug.o
|
||||||
# Pico - CD
|
# Pico - CD
|
||||||
OBJS += Pico/cd/Pico.o Pico/cd/Memory.o Pico/cd/Sek.o Pico/cd/LC89510.o \
|
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/cue.o Pico/cd/gfx_cd.o \
|
Pico/cd/cd_sys.o Pico/cd/cd_file.o Pico/cd/cue.o Pico/cd/gfx_cd.o \
|
||||||
|
@ -167,7 +168,7 @@ up: EBOOT.PBP
|
||||||
# cleanup
|
# cleanup
|
||||||
|
|
||||||
myclean:
|
myclean:
|
||||||
rm -rf $(DIRS)
|
#rm -rf $(DIRS)
|
||||||
$(RM) PicoDrive.map
|
$(RM) PicoDrive.map
|
||||||
make -C ../../cpu/musashi clean
|
make -C ../../cpu/musashi clean
|
||||||
|
|
||||||
|
|
79
psp/menu.c
79
psp/menu.c
|
@ -43,13 +43,13 @@ const char * const keyNames[] = {
|
||||||
static unsigned short bg_buffer[480*272] __attribute__((aligned(16)));
|
static unsigned short bg_buffer[480*272] __attribute__((aligned(16)));
|
||||||
#define menu_screen psp_screen
|
#define menu_screen psp_screen
|
||||||
|
|
||||||
static void menu_darken_bg(void *dst, const void *src, int pixels, int darker);
|
void menu_darken_bg(void *dst, const void *src, int pixels, int darker);
|
||||||
static void menu_prepare_bg(int use_game_bg, int use_fg);
|
static void menu_prepare_bg(int use_game_bg, int use_fg);
|
||||||
|
|
||||||
|
|
||||||
static unsigned int inp_prev = 0;
|
static unsigned int inp_prev = 0;
|
||||||
|
|
||||||
static unsigned long wait_for_input(unsigned int interesting, int is_key_config)
|
unsigned long wait_for_input(unsigned int interesting, int is_key_config)
|
||||||
{
|
{
|
||||||
unsigned int ret;
|
unsigned int ret;
|
||||||
static int repeats = 0, wait = 20;
|
static int repeats = 0, wait = 20;
|
||||||
|
@ -92,7 +92,7 @@ static unsigned long wait_for_input(unsigned int interesting, int is_key_config)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void menu_draw_begin(void)
|
void menu_draw_begin(void)
|
||||||
{
|
{
|
||||||
// short *src = (short *)bg_buffer, *dst = (short *)menu_screen;
|
// short *src = (short *)bg_buffer, *dst = (short *)menu_screen;
|
||||||
// int i;
|
// int i;
|
||||||
|
@ -108,7 +108,7 @@ static void menu_draw_begin(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void menu_draw_end(void)
|
void menu_draw_end(void)
|
||||||
{
|
{
|
||||||
psp_video_flip(1);
|
psp_video_flip(1);
|
||||||
}
|
}
|
||||||
|
@ -434,74 +434,6 @@ static char *romsel_loop(char *curr_path)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ------------ debug menu ------------
|
|
||||||
|
|
||||||
char *debugString(void);
|
|
||||||
void PicoDrawShowSpriteStats(unsigned short *screen, int stride);
|
|
||||||
void PicoDrawShowPalette(unsigned short *screen, int stride);
|
|
||||||
|
|
||||||
static void draw_main_debug(void)
|
|
||||||
{
|
|
||||||
char *p, *str = debugString();
|
|
||||||
int len, line;
|
|
||||||
|
|
||||||
menu_draw_begin();
|
|
||||||
|
|
||||||
p = str;
|
|
||||||
for (line = 0; line < 24; line++)
|
|
||||||
{
|
|
||||||
while (*p && *p != '\n') p++;
|
|
||||||
len = p - str;
|
|
||||||
if (len > 55) len = 55;
|
|
||||||
smalltext_out16_lim(1, line*10, str, 0xffff, len);
|
|
||||||
if (*p == 0) break;
|
|
||||||
p++; str = p;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void draw_frame_debug(void)
|
|
||||||
{
|
|
||||||
char layer_str[48] = "layers: ";
|
|
||||||
if (PicoDrawMask & PDRAW_LAYERB_ON) memcpy(layer_str + 8, "B", 1);
|
|
||||||
if (PicoDrawMask & PDRAW_LAYERA_ON) memcpy(layer_str + 10, "A", 1);
|
|
||||||
if (PicoDrawMask & PDRAW_SPRITES_LOW_ON) memcpy(layer_str + 12, "spr_lo", 6);
|
|
||||||
if (PicoDrawMask & PDRAW_SPRITES_HI_ON) memcpy(layer_str + 19, "spr_hi", 6);
|
|
||||||
|
|
||||||
memset(psp_screen, 0, 512*272*2);
|
|
||||||
emu_forcedFrame(0);
|
|
||||||
smalltext_out16(4, 264, layer_str, 0xffff);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void debug_menu_loop(void)
|
|
||||||
{
|
|
||||||
int inp, mode = 0;
|
|
||||||
|
|
||||||
while (1)
|
|
||||||
{
|
|
||||||
switch (mode)
|
|
||||||
{
|
|
||||||
case 0: draw_main_debug(); break;
|
|
||||||
case 1: draw_frame_debug(); break;
|
|
||||||
case 2: menu_draw_begin();
|
|
||||||
PicoDrawShowSpriteStats((unsigned short *)psp_screen+512*16+80, 512); break;
|
|
||||||
case 3: memset(psp_screen, 0, 512*272*2);
|
|
||||||
PicoDrawShowPalette(psp_screen, 512); break;
|
|
||||||
}
|
|
||||||
menu_draw_end();
|
|
||||||
|
|
||||||
inp = wait_for_input(BTN_X|BTN_CIRCLE|BTN_L|BTN_R|BTN_UP|BTN_DOWN|BTN_LEFT|BTN_RIGHT, 0);
|
|
||||||
if (inp & (BTN_X|BTN_CIRCLE)) return;
|
|
||||||
if (inp & BTN_L) { mode--; if (mode < 0) mode = 3; }
|
|
||||||
if (inp & BTN_R) { mode++; if (mode > 3) mode = 0; }
|
|
||||||
if (mode == 1) {
|
|
||||||
if (inp & BTN_LEFT) PicoDrawMask ^= PDRAW_LAYERB_ON;
|
|
||||||
if (inp & BTN_RIGHT) PicoDrawMask ^= PDRAW_LAYERA_ON;
|
|
||||||
if (inp & BTN_DOWN) PicoDrawMask ^= PDRAW_SPRITES_LOW_ON;
|
|
||||||
if (inp & BTN_UP) PicoDrawMask ^= PDRAW_SPRITES_HI_ON;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// ------------ patch/gg menu ------------
|
// ------------ patch/gg menu ------------
|
||||||
|
|
||||||
static void draw_patchlist(int sel)
|
static void draw_patchlist(int sel)
|
||||||
|
@ -1735,8 +1667,7 @@ static void menu_loop_root(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// warning: alignment
|
void menu_darken_bg(void *dst, const void *src, int pixels, int darker)
|
||||||
static void menu_darken_bg(void *dst, const void *src, int pixels, int darker)
|
|
||||||
{
|
{
|
||||||
unsigned int *dest = dst;
|
unsigned int *dest = dst;
|
||||||
const unsigned int *srce = src;
|
const unsigned int *srce = src;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue