Skip to content

Commit

Permalink
initial pandora port, with hardware scaling and stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
notaz committed Sep 5, 2011
1 parent 43c24b3 commit eb3668f
Show file tree
Hide file tree
Showing 16 changed files with 1,472 additions and 34 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,6 @@
*.u
*.z
gpsp.gpe
tags
cscope.out
pandora/linux
4 changes: 4 additions & 0 deletions common.h
Original file line number Diff line number Diff line change
Expand Up @@ -251,4 +251,8 @@ typedef u32 fixed16_16;
// #define STDIO_DEBUG
#endif

#ifdef PND_BUILD
#include "pandora/pnd.h"
#endif

#endif
4 changes: 2 additions & 2 deletions gp2x/gp2x.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ static u32 gp2x_audio_volume = 74/2;
static volatile u16 *gpsp_gp2x_memregs;
static volatile u32 *gpsp_gp2x_memregl;

u32 button_plat_mask_to_config[] =
u32 button_plat_mask_to_config[PLAT_BUTTON_COUNT] =
{
GP2X_UP,
GP2X_LEFT,
Expand All @@ -59,7 +59,7 @@ u32 button_plat_mask_to_config[] =
GP2X_VOL_MIDDLE
};

u32 gamepad_config_map[16] =
u32 gamepad_config_map[PLAT_BUTTON_COUNT] =
{
BUTTON_ID_UP, // Up
BUTTON_ID_LEFT, // Left
Expand Down
3 changes: 2 additions & 1 deletion gp2x/gp2x.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ void gpsp_plat_quit(void);
u32 gpsp_plat_joystick_read(void);
u32 gpsp_plat_buttons_to_cursor(u32 buttons);

extern u32 button_plat_mask_to_config[];
#define PLAT_BUTTON_COUNT 16
extern u32 button_plat_mask_to_config[PLAT_BUTTON_COUNT];

void gp2x_sound_volume(u32 volume_up);
void gp2x_quit();
Expand Down
77 changes: 51 additions & 26 deletions gui.c
Original file line number Diff line number Diff line change
Expand Up @@ -569,11 +569,11 @@ struct _menu_option_type
void (* action_function)();
void (* passive_function)();
struct _menu_type *sub_menu;
char *display_string;
const char *display_string;
void *options;
u32 *current_option;
u32 num_options;
char *help_string;
const char *help_string;
u32 line_number;
menu_option_type_enum option_type;
};
Expand Down Expand Up @@ -740,16 +740,26 @@ u32 gamepad_config_line_to_button[] =

#endif

#ifdef PND_BUILD

u32 gamepad_config_line_to_button[] =
{ 0, 2, 1, 3, 8, 9, 10, 11, 6, 7, 4, 5, 12, 13, 14, 15 };

#endif

u8 *scale_options[] =
{
#ifdef WIZ_BUILD
#ifdef PSP_BUILD
"unscaled 3:2", "scaled 3:2", "fullscreen 16:9"
#elif defined(WIZ_BUILD)
"unscaled 3:2", "scaled 3:2 (slower)",
"unscaled 3:2 (anti-tear)", "scaled 3:2 (anti-tear)"
#else
#elif defined(PND_BUILD)
"unscaled", "2x", "3x", "fullscreen"
#elif defined(GP2X_BUILD)
"unscaled 3:2", "scaled 3:2", "fullscreen", "scaled 3:2 (software)"
#ifdef PSP_BUILD
" 16:9"
#endif
#else
"unscaled 3:2"
#endif
};

Expand Down Expand Up @@ -1024,7 +1034,7 @@ void get_savestate_snapshot(u8 *savestate_filename)
else
{
memset(snapshot_buffer, 0, 240 * 160 * 2);
print_string_ext("No savestate exists for this slot.",
print_string_ext("No savestate in this slot.",
0xFFFF, 0x0000, 15, 75, snapshot_buffer, 240, 0, 0, FONT_HEIGHT);
print_string("---------- --/--/---- --:--:-- ", COLOR_HELP_TEXT,
COLOR_BG, 10, 40);
Expand Down Expand Up @@ -1084,7 +1094,7 @@ u32 menu(u16 *original_screen)
auto void choose_menu();
auto void clear_help();

u8 *gamepad_help[] =
static const u8 * const gamepad_help[] =
{
"Up button on GBA d-pad.",
"Down button on GBA d-pad.",
Expand Down Expand Up @@ -1315,16 +1325,19 @@ u32 menu(u16 *original_screen)
(u32 *)(&screen_scale),
sizeof(scale_options) / sizeof(scale_options[0]),
#ifndef GP2X_BUILD
"Determines how the GBA screen is resized in relation to the entire\n"
"screen. Select unscaled 3:2 for GBA resolution, scaled 3:2 for GBA\n"
"Determines how the GBA screen is resized in relation to the\n"
"entire screen."
#ifdef PSP_BUILD
" Select unscaled 3:2 for GBA resolution, scaled 3:2 for GBA\n"
"aspect ratio scaled to fill the height of the PSP screen, and\n"
"fullscreen to fill the entire PSP screen."
#endif
#endif
"", 2),
#ifndef GP2X_BUILD
string_selection_option(NULL, "Screen filtering", yes_no_options,
(u32 *)(&screen_filter), 2,
"Determines whether or not bilinear filtering should be used when\n"
"Determines whether or not filtering should be used when\n"
"scaling the screen. Selecting this will produce a more even and\n"
"smooth image, at the cost of being blurry and having less vibrant\n"
"colors.", 3),
Expand Down Expand Up @@ -1352,8 +1365,8 @@ u32 menu(u16 *original_screen)
#ifndef GP2X_BUILD
"If objects in the game flicker at a regular rate certain manual\n"
"frameskip values may cause them to normally disappear. Change this\n"
"value to 'random' to avoid this. Do not use otherwise, as it tends to\n"
"make the image quality worse, especially in high motion games."
"value to 'random' to avoid this. Do not use otherwise, as it tends\n"
"to make the image quality worse, especially in high motion games."
#endif
"", 7),
string_selection_option(NULL, "Audio output", yes_no_options,
Expand Down Expand Up @@ -1395,25 +1408,29 @@ u32 menu(u16 *original_screen)
cheat_option(7),
cheat_option(8),
cheat_option(9),
#if defined(PSP_BUILD) || defined(GP2X_BUILD)
string_selection_option(NULL, "Clock speed",
clock_speed_options, &clock_speed_number,
sizeof(clock_speed_options) / sizeof(clock_speed_options[0]),
"Change the clock speed of the device. Higher clock\n"
"speed will yield better performance, but will drain\n"
"battery life further.", 11),
#endif
string_selection_option(NULL, "Update backup",
update_backup_options, &update_backup_flag, 2,
#ifdef GP2X_BUILD
"Determines when in-game save files should be\n"
"written back to SD card.",
"written back to SD card."
#else
"Determines when in-game save files should be written back to\n"
"memstick. If set to 'automatic' writebacks will occur shortly after\n"
"the game's backup is altered. On 'exit only' it will only be written\n"
"back when you exit from this menu (NOT from using the home button).\n"
"Use the latter with extreme care.",
"card. If set to 'automatic' writebacks will occur shortly after\n"
"the game's backup is altered. On 'exit only' it will only be\n"
"written back when you exit from this menu.\n"
#ifdef PSP
"(NOT from using the home button), use the latter with extreme care."
#endif
#endif
12),
"", 12),
submenu_option(NULL, "Back", "Return to the main menu.", 14)
};

Expand Down Expand Up @@ -1483,7 +1500,7 @@ u32 menu(u16 *original_screen)

#endif

#ifdef GP2X_BUILD
#if defined(GP2X_BUILD) || defined(PND_BUILD)

menu_option_type gamepad_config_options[] =
{
Expand All @@ -1503,10 +1520,18 @@ u32 menu(u16 *original_screen)
gamepad_config_option("Start ", 10),
#endif
gamepad_config_option("Select ", 11),
#ifndef WIZ_BUILD
#if !defined(WIZ_BUILD) && !defined(PND_BUILD)
gamepad_config_option("Stick Push ", 12),
#endif
#ifdef PND_BUILD
gamepad_config_option("1 ", 12),
gamepad_config_option("2 ", 13),
gamepad_config_option("3 ", 14),
gamepad_config_option("4 ", 15),
submenu_option(NULL, "Back", "Return to the main menu.", 16)
#else
submenu_option(NULL, "Back", "Return to the main menu.", 14)
#endif
};


Expand Down Expand Up @@ -1665,13 +1690,13 @@ u32 menu(u16 *original_screen)

if(display_option == current_option)
{
print_string_pad(line_buffer, COLOR_ACTIVE_ITEM, COLOR_BG, 10,
(display_option->line_number * 10) + 40, 41);
print_string_pad(line_buffer, COLOR_ACTIVE_ITEM, COLOR_BG, 6,
(display_option->line_number * 10) + 40, 36);
}
else
{
print_string_pad(line_buffer, COLOR_INACTIVE_ITEM, COLOR_BG, 10,
(display_option->line_number * 10) + 40, 41);
print_string_pad(line_buffer, COLOR_INACTIVE_ITEM, COLOR_BG, 6,
(display_option->line_number * 10) + 40, 36);
}
}

Expand Down
2 changes: 1 addition & 1 deletion input.c
Original file line number Diff line number Diff line change
Expand Up @@ -454,7 +454,7 @@ u32 update_input()
handled_buttons = (last_buttons ^ buttons) & buttons;
last_buttons = buttons;

for(i = 0; i < 16; i++)
for(i = 0; i < PLAT_BUTTON_COUNT; i++)
{
if(handled_buttons & button_plat_mask_to_config[i])
button_id = gamepad_config_map[i];
Expand Down
10 changes: 7 additions & 3 deletions main.c
Original file line number Diff line number Diff line change
Expand Up @@ -203,9 +203,6 @@ int main(int argc, char *argv[])
#endif

getcwd(main_path, 512);
load_config_file();

gamepak_filename[0] = 0;

#ifdef PSP_BUILD
delay_us(2500000);
Expand All @@ -214,6 +211,9 @@ int main(int argc, char *argv[])
#ifndef PC_BUILD
gpsp_plat_init();
#endif
load_config_file();

gamepak_filename[0] = 0;

init_video();

Expand All @@ -235,7 +235,11 @@ int main(int argc, char *argv[])
debug_screen_printl("a860e8c0b6d573d191e4ec7db1b1e4f6 ");
debug_screen_printl(" ");
debug_screen_printl("When you do get it name it gba_bios.bin and put it");
#ifdef PND_BUILD
debug_screen_printl("in <CD card>/pandora/appdata/gpsp/ . ");
#else
debug_screen_printl("in the same directory as gpSP. ");
#endif
debug_screen_printl(" ");
debug_screen_printl("Press any button to exit. ");

Expand Down
41 changes: 41 additions & 0 deletions pandora/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# gpSP makefile
# Gilead Kutnick - Exophase
# pandora port - notaz

# Global definitions

CC = $(CROSS_COMPILE)gcc

OBJS = pnd.o main.o cpu.o memory.o video.o input.o sound.o gui.o \
cheats.o zip.o cpu_threaded.o arm_stub.o video_blend.o warm.o \
linux/fbdev.o linux/xenv.o
BIN = gpsp

# Platform specific definitions

VPATH += .. ../arm
CFLAGS += -DARM_ARCH -DPND_BUILD
CFLAGS += -funsigned-char
CFLAGS += -mcpu=cortex-a8 -mtune=cortex-a8 -mfloat-abi=softfp -ffast-math
CFLAGS += -fno-common -fno-builtin
CFLAGS += -ggdb
CFLAGS += -O2

# expecting to have PATH set up to get correct sdl-config first
CFLAGS += `sdl-config --cflags`
LIBS += `sdl-config --libs`
LIBS += -ldl -lpthread -lz

# Compilation:

%.o: %.S
$(CC) $(CFLAGS) -c -o $@ $<

all: $(BIN)

$(BIN): $(OBJS)
$(CC) $(OBJS) $(LIBS) -o $(BIN)

clean:
rm -f *.o $(BIN)

Loading

0 comments on commit eb3668f

Please sign in to comment.