mirror of
https://github.com/RaySollium99/picodrive.git
synced 2025-09-05 15:27:46 -04:00
ROM load progress bar
git-svn-id: file:///home/notaz/opt/svn/PicoDrive@224 be3aeb3a-fb24-0410-a615-afba39da0efa
This commit is contained in:
parent
6d7acf9eff
commit
a9b3ffd3cc
7 changed files with 73 additions and 8 deletions
|
@ -210,7 +210,7 @@ $(error need VER)
|
|||
endif
|
||||
endif
|
||||
|
||||
rel: PicoDrive.gpe code940/code940.bin ../readme.txt config.txt PicoDrive.man.txt PicoDrive.png
|
||||
rel: PicoDrive.gpe code940/pico940.bin ../readme.txt config.txt PicoDrive.man.txt PicoDrive.png
|
||||
zip -9 -j ../../PicoDrive_$(VER).zip $^ mmuhack.o
|
||||
|
||||
code940/code940.bin:
|
||||
|
|
|
@ -287,6 +287,8 @@ int emu_ReloadRom(void)
|
|||
return 0;
|
||||
}
|
||||
|
||||
menu_romload_prepare(used_rom_name);
|
||||
|
||||
if(rom_data) {
|
||||
free(rom_data);
|
||||
rom_data = 0;
|
||||
|
@ -297,9 +299,11 @@ int emu_ReloadRom(void)
|
|||
sprintf(menuErrorMsg, "PicoCartLoad() failed.");
|
||||
printf("%s\n", menuErrorMsg);
|
||||
pm_close(rom);
|
||||
menu_romload_end();
|
||||
return 0;
|
||||
}
|
||||
pm_close(rom);
|
||||
menu_romload_end();
|
||||
|
||||
// detect wrong files (Pico crashes on very small files), also see if ROM EP is good
|
||||
if(rom_size <= 0x200 || strncmp((char *)rom_data, "Pico", 4) == 0 ||
|
||||
|
|
|
@ -159,10 +159,11 @@ void gp2x_video_wait_vsync(void)
|
|||
|
||||
void gp2x_memcpy_buffers(int buffers, void *data, int offset, int len)
|
||||
{
|
||||
if (buffers & (1<<0)) memcpy((char *)gp2x_screens[0] + offset, data, len);
|
||||
if (buffers & (1<<1)) memcpy((char *)gp2x_screens[1] + offset, data, len);
|
||||
if (buffers & (1<<2)) memcpy((char *)gp2x_screens[2] + offset, data, len);
|
||||
if (buffers & (1<<3)) memcpy((char *)gp2x_screens[3] + offset, data, len);
|
||||
char *dst;
|
||||
if (buffers & (1<<0)) { dst = (char *)gp2x_screens[0] + offset; if (dst != data) memcpy(dst, data, len); }
|
||||
if (buffers & (1<<1)) { dst = (char *)gp2x_screens[1] + offset; if (dst != data) memcpy(dst, data, len); }
|
||||
if (buffers & (1<<2)) { dst = (char *)gp2x_screens[2] + offset; if (dst != data) memcpy(dst, data, len); }
|
||||
if (buffers & (1<<3)) { dst = (char *)gp2x_screens[3] + offset; if (dst != data) memcpy(dst, data, len); }
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -420,6 +420,39 @@ static unsigned long wait_for_input_usbjoy(unsigned long interesting, int *joy)
|
|||
|
||||
|
||||
|
||||
// --------- loading ROM screen ----------
|
||||
|
||||
static void load_progress_cb(int percent)
|
||||
{
|
||||
int ln, len = percent * 320 / 100;
|
||||
unsigned char *dst = (unsigned char *)gp2x_screen + 320*20;
|
||||
|
||||
if (len > 320) len = 320;
|
||||
for (ln = 10; ln > 0; ln--, dst += 320)
|
||||
memset(dst, 0xf0, len);
|
||||
gp2x_video_flip2();
|
||||
}
|
||||
|
||||
void menu_romload_prepare(const char *rom_name)
|
||||
{
|
||||
const char *p = rom_name + strlen(rom_name);
|
||||
while (p > rom_name && *p != '/') p--;
|
||||
|
||||
gp2x_pd_clone_buffer2();
|
||||
gp2x_smalltext8(1, 1, "Loading");
|
||||
gp2x_smalltext8_lim(1, 10, p, 53);
|
||||
gp2x_memcpy_buffers(3, gp2x_screen, 0, 320*240);
|
||||
gp2x_video_flip2();
|
||||
PicoCartLoadProgressCB = load_progress_cb;
|
||||
}
|
||||
|
||||
void menu_romload_end(void)
|
||||
{
|
||||
PicoCartLoadProgressCB = NULL;
|
||||
gp2x_smalltext8(1, 30, "Starting emulation...");
|
||||
gp2x_video_flip2();
|
||||
}
|
||||
|
||||
// -------------- ROM selector --------------
|
||||
|
||||
static void draw_dirlist(char *curdir, struct dirent **namelist, int n, int sel)
|
||||
|
@ -429,7 +462,6 @@ static void draw_dirlist(char *curdir, struct dirent **namelist, int n, int sel)
|
|||
start = 12 - sel;
|
||||
n--; // exclude current dir (".")
|
||||
|
||||
//memset(gp2x_screen, 0, 320*240);
|
||||
gp2x_pd_clone_buffer2();
|
||||
|
||||
if(start - 2 >= 0)
|
||||
|
|
|
@ -10,6 +10,8 @@ void gp2x_text_out15 (int x, int y, const char *text);
|
|||
void gp2x_text_out8_2(int x, int y, const char *texto, int color);
|
||||
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 \
|
||||
(GP2X_UP|GP2X_DOWN|GP2X_LEFT|GP2X_RIGHT|GP2X_A|GP2X_B|GP2X_X|GP2X_Y| \
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue